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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 12:08:28 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;
----------------
artagnon wrote:

Can it be a SmallVector instead, since we don't seem to use lookup APIs? Is there an issue with de-duplication?

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


More information about the llvm-commits mailing list