aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopVersioning.cpp
diff options
context:
space:
mode:
authorRamkumar Ramachandra <ramkumar.ramachandra@codasip.com>2025-09-09 12:38:54 +0100
committerGitHub <noreply@github.com>2025-09-09 11:38:54 +0000
commit5544afd25368413fd663362cd4eb58811bf558d2 (patch)
tree31785b96eafdb20a3ebcb355919c616f037359bc /llvm/lib/Transforms/Utils/LoopVersioning.cpp
parent14f7e5fa06235dac1a2d82290aa4d69de9d56862 (diff)
downloadllvm-5544afd25368413fd663362cd4eb58811bf558d2.zip
llvm-5544afd25368413fd663362cd4eb58811bf558d2.tar.gz
llvm-5544afd25368413fd663362cd4eb58811bf558d2.tar.bz2
[LoopUtils] Simplify expanded RT-checks (#157518)
Follow up on 528b13d ([SCEVExp] Add helper to clean up dead instructions after expansion.) to hoist the SCEVExapnder::eraseDeadInstructions call from LoopVectorize into the LoopUtils APIs add[Diff]RuntimeChecks, so that other callers (LoopDistribute and LoopVersioning) can benefit from the patch.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopVersioning.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
index 1711163..ec2e6c1 100644
--- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp
+++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
@@ -81,6 +81,8 @@ void LoopVersioning::versionLoop(
} else
RuntimeCheck = MemRuntimeCheck ? MemRuntimeCheck : SCEVRuntimeCheck;
+ Exp.eraseDeadInstructions(SCEVRuntimeCheck);
+
assert(RuntimeCheck && "called even though we don't need "
"any runtime checks");