Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

target-side padding for non-byte-sized loads/stores #1019

Open
regehr opened this issue Feb 27, 2024 · 1 comment
Open

target-side padding for non-byte-sized loads/stores #1019

regehr opened this issue Feb 27, 2024 · 1 comment
Labels
memory Memory Model

Comments

@regehr
Copy link
Contributor

regehr commented Feb 27, 2024

Nuno and I have talked about this but I'd like to drop an issue here as a reminder.

this function:

define i8 @f(ptr %p) {
  %x = load i1, ptr %p, align 4
  %y = zext i1 %x to i8
  ret i8 %y
}

is quite properly lowered by the AArch64 backend to:

f:
        ldrb    w0, [x0]
        ret

but now it looks like there's been a refinement failure since Alive thinks this load can return values other than 0,1.

if I knew which loads and stores on the ARM side corresponded to LLVM-side loads and stores of i1, I could patch up the load side and insert the corresponding checking on the store side. but I don't, and I can't think of a different way to support this.

as far as I know, for practical purposes, i1 is the only case that actually matters

@nunoplopes nunoplopes added the memory Memory Model label Feb 28, 2024
@regehr
Copy link
Contributor Author

regehr commented Mar 4, 2024

well, I didn't really want to do this, but now I'm tagging each LLVM instruction with a debug location and then using that to track where each ARM instruction comes from, in order to support patching up this sort of thing. this is working fine so far.

there are other use cases for this mapping, such as finding call site attributes, that I can't solve any other way that I can think of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory Memory Model
Projects
None yet
Development

No branches or pull requests

2 participants