llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Attributor incorrectly infers `align` (and probably `nonnull` too)

Open osa1 opened this issue 2 months ago • 1 comments

This is the same bug as #220520, but in Attributor.

declare void @g(ptr)

define void @src(ptr %p) {
  call void @g(ptr align 4 %p)
  store i8 1, ptr %p, align 1
  ret void
}

./build/bin/opt -passes=attributor attributor_test.ll -S -o - generates:

declare void @g(ptr)

define void @src(ptr align 4 %p) {
  call void @g(ptr align 4 %p)
  store i8 1, ptr %p, align 4
  ret void
}

But we can only assume the call is UB when %p is misaligned when the parameter is noundef.

Probably a similar fix to this one needs to be applied to Attributor too: #221018.

osa1 avatar Sep 19 '26 07:09 osa1

Hi, I'd like to work on this. It looks like a miscompilation

xxxxbc avatar Sep 20 '26 07:09 xxxxbc