[llvm] [SimplifyCFG][JumpThreading] Don't duplicate inline-asm instructions (PR #71571)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 8 08:03:03 PST 2023


================
@@ -491,8 +491,10 @@ static unsigned getJumpThreadDuplicationCost(const TargetTransformInfo *TTI,
 
     // Blocks with NoDuplicate are modelled as having infinite cost, so they
     // are never duplicated.
+    // Conservatively disallow inline-asm instructions. Duplicating inline-asm
+    // instructions can potentially create duplicate labels.
     if (const CallInst *CI = dyn_cast<CallInst>(I))
-      if (CI->cannotDuplicate() || CI->isConvergent())
+      if (CI->cannotDuplicate() || CI->isConvergent() || CI->isInlineAsm())
----------------
nikic wrote:

*If* we want to say that inline asm cannot be duplicated, then that should be part of `cannotDuplicate()`, not a separate query. There are a number of other places checking cannotDuplicate().

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


More information about the llvm-commits mailing list