[llvm-branch-commits] Utils: Inhibit load/store folding through phis for llvm.protected.field.ptr. (PR #151649)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Sep 2 05:55:20 PDT 2025


================
@@ -697,8 +697,7 @@ static bool isSafeAndProfitableToSinkLoad(LoadInst *L) {
 Instruction *InstCombinerImpl::foldPHIArgLoadIntoPHI(PHINode &PN) {
   LoadInst *FirstLI = cast<LoadInst>(PN.getIncomingValue(0));
 
-  // Can't forward swifterror through a phi.
-  if (FirstLI->getOperand(0)->isSwiftError())
+  if (!shouldFoldOperandThroughPhi(FirstLI->getOperand(0)))
----------------
nikic wrote:

I think my general preference would be to not add a new API for this and just call canReplaceOperandWithVariable() here.

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


More information about the llvm-branch-commits mailing list