[llvm] [IR] Reject unhandled assume bundles and seperate them from normal attributes (PR #197007)
Nikolas Klauser via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 05:17:56 PDT 2026
================
@@ -1088,13 +1087,15 @@ void llvm::computeKnownBitsFromContext(const Value *V, KnownBits &Known,
"Got assumption for the wrong function!");
if (Elem.Index != AssumptionCache::ExprResultIdx) {
- if (!V->getType()->isPointerTy())
- continue;
- if (RetainedKnowledge RK = getKnowledgeFromBundle(
- *I, I->bundle_op_info_begin()[Elem.Index])) {
- if (RK.WasOn == V && RK.AttrKind == Attribute::Alignment &&
- isPowerOf2_64(RK.ArgValue) && isValidAssumeForContext(I, Q))
- Known.Zero.setLowBits(Log2_64(RK.ArgValue));
+ if (auto OBU = I->getOperandBundleAt(Elem.Index);
+ getBundleAttrFromOBU(OBU) == BundleAttr::Align) {
+ auto [Ptr, _, Alignment, Offset] = getAssumeAlignInfo(OBU);
+ assert(Ptr == V);
+ if (!Alignment || !isPowerOf2_64(*Alignment))
+ continue;
+ auto AlignVal = MinAlign(Offset.value_or(0), *Alignment);
----------------
philnik777 wrote:
Indeed. Added regression tests to `ValueTracking/assume.ll` (I think this should be the right place?). Fixed by setting `Offset` to zero if it doesn't exist inside `getAssumeAlignInfo` and bailing in the `nullopt` case.
https://github.com/llvm/llvm-project/pull/197007
More information about the llvm-commits
mailing list