aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2025-05-12 14:37:26 -0700
committerGitHub <noreply@github.com>2025-05-12 14:37:26 -0700
commit78f0af5d895be284e4f7448fed007a04ee6a35d4 (patch)
tree6fc143ced1ccdc191373775c3017da0f157325bb /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parent6b7b289038acb297f433fe1c0cb66158277e9974 (diff)
downloadllvm-78f0af5d895be284e4f7448fed007a04ee6a35d4.zip
llvm-78f0af5d895be284e4f7448fed007a04ee6a35d4.tar.gz
llvm-78f0af5d895be284e4f7448fed007a04ee6a35d4.tar.bz2
[SimplifyCFG][swifterror] Don't sink calls with swifterror params (#139015)
We've encountered an LLVM verification failure when building Swift with the SimplifyCFG pass enabled. I found that https://reviews.llvm.org/D158083 fixed this pass by preventing sinking loads or stores of swifterror values, but it did not implement the same protection for call or invokes. In `Verifier.cpp` [here](https://github.com/ellishg/llvm-project/blob/c68535581135a1513c9c4c1c7672307d4b5e616e/llvm/lib/IR/Verifier.cpp#L4360-L4364) and [here](https://github.com/ellishg/llvm-project/blob/c68535581135a1513c9c4c1c7672307d4b5e616e/llvm/lib/IR/Verifier.cpp#L3661-L3662) we can see that swifterror values must also be used directly by call instructions.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp8
1 files changed, 0 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 5cd244c..d94abea 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2208,14 +2208,6 @@ static bool canSinkInstructions(
if (!I->isSameOperationAs(I0, Instruction::CompareUsingIntersectedAttrs))
return false;
- // swifterror pointers can only be used by a load or store; sinking a load
- // or store would require introducing a select for the pointer operand,
- // which isn't allowed for swifterror pointers.
- if (isa<StoreInst>(I) && I->getOperand(1)->isSwiftError())
- return false;
- if (isa<LoadInst>(I) && I->getOperand(0)->isSwiftError())
- return false;
-
// Treat MMRAs conservatively. This pass can be quite aggressive and
// could drop a lot of MMRAs otherwise.
if (MMRAMetadata(*I) != I0MMRA)