aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Scalar/JumpThreading.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-01-31 15:23:53 +0100
committerGitHub <noreply@github.com>2024-01-31 15:23:53 +0100
commit4f32f5d5720fbef06672714a62376f236a36aef5 (patch)
tree30ad90672002618b7654db8409cb027079a550d8 /llvm/lib/Transforms/Scalar/JumpThreading.cpp
parente538486e90539096e7851d0deba4ea9ed94fced2 (diff)
downloadllvm-4f32f5d5720fbef06672714a62376f236a36aef5.zip
llvm-4f32f5d5720fbef06672714a62376f236a36aef5.tar.gz
llvm-4f32f5d5720fbef06672714a62376f236a36aef5.tar.bz2
[AA][JumpThreading] Don't use DomTree for AA in JumpThreading (#79294)
JumpThreading may perform AA queries while the dominator tree is not up to date, which may result in miscompilations. Fix this by adding a new AAQI option to disable the use of the dominator tree in BasicAA. Fixes https://github.com/llvm/llvm-project/issues/79175.
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/JumpThreading.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index b7cf024..bb33a5d 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -1261,6 +1261,8 @@ bool JumpThreadingPass::simplifyPartiallyRedundantLoad(LoadInst *LoadI) {
BasicBlock::iterator BBIt(LoadI);
bool IsLoadCSE;
BatchAAResults BatchAA(*AA);
+ // The dominator tree is updated lazily and may not be valid at this point.
+ BatchAA.disableDominatorTree();
if (Value *AvailableVal = FindAvailableLoadedValue(
LoadI, LoadBB, BBIt, DefMaxInstsToScan, &BatchAA, &IsLoadCSE)) {
// If the value of the load is locally available within the block, just use