[PATCH] D94433: Do not emit non-power-of-2 alignment assume bundles (PR48713).
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 6 09:49:19 PDT 2021
lebedev.ri added a comment.
This looks like it's moving in the right direction.
Please split this up into clang change and a verifier change.
================
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;
+ }
----------------
No, we should emit it as a simple assumption.
================
Comment at: llvm/lib/IR/Verifier.cpp:4611-4619
Assert(Call.getOperand(Elem.Begin + 1)->getType()->isIntegerTy(),
"second argument should be an integer");
+ ConstantInt *Alignment = dyn_cast<ConstantInt>(Call.getOperand(Elem.Begin + 1));
+ if (Alignment)
+ Assert(Alignment->getValue().isPowerOf2(),
+ "alignment must be a power of 2", Call);
if (ArgCount == 3)
----------------
@jdoerfert Should second/third arguments be a *constant* integers ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94433/new/
https://reviews.llvm.org/D94433
More information about the llvm-commits
mailing list