[llvm] [SimplifyCFG][swifterror] Don't sink calls with swifterror params (PR #139015)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 13:45:26 PDT 2025


================
@@ -4224,6 +4224,13 @@ bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
   if (I->getOperand(OpIdx)->getType()->isMetadataTy())
     return false;
 
+  // swifterror pointers can only be used by a load, store, or as a swifterror
+  // argument; swifterror pointers are not allowed to be used in select or phi
+  // instructions.
+  if (OpIdx < I->getNumOperands())
----------------
nikic wrote:

I don't think this check is needed either? We already perform an unconditional OpIdx access above here.

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


More information about the llvm-commits mailing list