Benjins wrote:

I am seeing some downstream failures as of this PR when running with assertions 
enabled. It seems to be that during upgrade of old bitcode files, invalid 
alignments now trigger an assertion where they didn't before
We have a test case in [llvm-ir](https://github.com/cdisselkoen/llvm-ir) that 
has an old bitcode file, with this IR in it:
```llvm
define void @tests.masked.store(ptr %ptr, <2 x i1> %mask, <2 x double> %val) {
  call void @llvm.masked.store.v2f64.p0v2f64(<2 x double> %val, ptr %ptr, i32 
3, <2 x i1> %mask)
  ret void
}
```
which means the alignment of 3 trips the assertion here:
https://github.com/llvm/llvm-project/blob/90bc75043cef9de0dfb2667508595203208f65b0/llvm/include/llvm/Support/Alignment.h#L122-L124

Now, an alignment of 3 is obviously incorrect. I don't know the exact source of 
this bitcode file, but the IR was probably hand-built, I'm wondering if the 
assertion is expected, or it is meant to be otherwise handled in the upgrade 
path

fwiw, trying this on latest w/ assertions gives a normal diagnostic: `error: 
alignment is not a power of two`
```llvm
define void @tests.masked.store(ptr %ptr, <2 x i1> %mask, <2 x double> %val) {
  call void @llvm.masked.store.v2f64.p0(<2 x double> %val, ptr align 3 %ptr, <2 
x i1> %mask)
  ret void
}
```

And the specific bitcode file from our test is here. Running `llvm-dis` on it 
w/ assertions enabled throws the error
https://github.com/cdisselkoen/llvm-ir/blob/main/tests/llvm_bc/auto_upgrade_intrinsics.bc

https://github.com/llvm/llvm-project/pull/163802
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to