[llvm] [SimplifyCFG] Supporting hoisting/sinking callbases with differing attrs (PR #109472)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 14:52:47 PDT 2024


================
@@ -1910,6 +1910,14 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(Instruction *TI,
           if (!I2->use_empty())
             I2->replaceAllUsesWith(I1);
           I1->andIRFlags(I2);
+          if (auto *CB = dyn_cast<CallBase>(I1)) {
+            bool Success = CB->tryIntersectAttributes(cast<CallBase>(I2));
+            assert(Success && "We should not be trying to hoist callbases "
+                              "with non-intersectable attributes");
+            // For NDEBUG Compile.
----------------
nikic wrote:

Using `[[maybe_unused]]` may be cleaner.

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


More information about the llvm-commits mailing list