[llvm] [PredicateInfo] Extract information from assume operand bundles (PR #177349)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 22 05:41:50 PST 2026


================
@@ -118,7 +118,25 @@ class PredicateAssume : public PredicateBase {
       : PredicateBase(PT_Assume, Op, Condition), AssumeInst(AssumeInst) {}
   PredicateAssume() = delete;
   static bool classof(const PredicateBase *PB) {
-    return PB->Type == PT_Assume;
+    return PB->Type == PT_Assume || PB->Type == PT_BundleAssume;
+  }
+
+protected:
+  PredicateAssume(PredicateType PT, Value *Op, IntrinsicInst *AssumeInst,
+                  Value *Condition)
+      : PredicateBase(PT, Op, Condition), AssumeInst(AssumeInst) {}
+};
+
+class PredicateBundleAssume : public PredicateAssume {
----------------
nikic wrote:

Hm, I think we need to be a bit more careful here, see for example this NewGVN code assuming the PredicateAssume always has a Condition: https://github.com/llvm/llvm-project/blob/9357c5906cd8b3d5f15fec853f458b1478f03e4a/llvm/lib/Transforms/Scalar/NewGVN.cpp#L2101-L2102

I think we should have a common PrediateAssume base from which PredicateBundleAssume and PredicateConditionAssume inherit. The former would have AttrKind, the latter Condition.

https://github.com/llvm/llvm-project/pull/177349


More information about the llvm-commits mailing list