[PATCH] D94433: Do not emit non-power-of-2 alignment assume bundles (PR48713).
Ryan Mansfield via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 9 11:39:04 PDT 2021
rmansfield added inline comments.
================
Comment at: clang/lib/CodeGen/CGCall.cpp:4561-4565
+ // Non power-of-2 alignment is UB and rejected by the IR verifier.
+ if (!AlignmentCI->getValue().isPowerOf2()) {
+ AA = nullptr; // We're done. Disallow doing anything else.
return Attrs;
+ }
----------------
lebedev.ri wrote:
> rmansfield wrote:
> > lebedev.ri wrote:
> > > No, we should emit it as a simple assumption.
> > Thanks for the feedback. Sorry for misunderstanding, from earlier comments I thought that no llvm.assume should be emitted for non-power-of-2 alignments. Can you elaborate on what you mean by simple assumption should be emitted?
> Just remove `AA = nullptr; // We're done. Disallow doing anything else.` here and you'll see
Sorry I didn't understand this comment and I haven't had time to revisit it to fully understand. I'm confused because if I remove the AA = nullptr; there's no change to clang and it will continue to generate an assume that the IR verifier is now being changed to reject.
e.g. in clang/test/CodeGen/non-power-of-2-alignment-assumptions.c
alloc(7);
would generate
%call = call i8* @alloc(i32 7)
call void @llvm.assume(i1 true) [ "align"(i8* %call, i64 7) ]
which would now be backend error: e.g
```
alignment must be a power of 2
call void @llvm.assume(i1 true) [ "align"(i8* %call, i64 7) ]
in function t1
fatal error: error in backend: Broken function found, compilation aborted!
```
If you could explain what you would expect clang to emit in this case, I think that would help me and I can have another look.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94433/new/
https://reviews.llvm.org/D94433
More information about the llvm-commits
mailing list