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

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 11:42:15 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;
----------------
andjo403 wrote:

```suggestion
      SmallPtrSet<Value *, 2> Affected;
```
findValuesAffectedByOperandBundle can currently max add two affected arguments

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


More information about the llvm-commits mailing list