[llvm] [DropUnnecessaryAssumes] Add support for operand bundles (PR #160311)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 05:13:40 PDT 2025


================
@@ -26,8 +37,41 @@ DropUnnecessaryAssumesPass::run(Function &F, FunctionAnalysisManager &FAM) {
     if (!Assume)
       continue;
 
-    // TODO: Handle assumes with operand bundles.
-    if (Assume->hasOperandBundles())
+    SmallVector<WeakTrackingVH> DeadBundleArgs;
+    SmallVector<OperandBundleDef> KeptBundles;
+    unsigned NumBundles = Assume->getNumOperandBundles();
+    for (unsigned I = 0; I != NumBundles; ++I) {
+      // Handle operand bundle assumptions.
+      OperandBundleUse Bundle = Assume->getOperandBundleAt(I);
+      SmallPtrSet<Value *, 8> Affected;
----------------
nikic wrote:

I've switched it to SmallVector. The non-bundle case may have duplicates, but I guess it doesn't really matter in this context.

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


More information about the llvm-commits mailing list