summaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CaptureTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-02-21 08:53:22 +0100
committerNikita Popov <npopov@redhat.com>2023-02-21 09:01:55 +0100
commit4d192f2d2a545c8cd51ef86f9e83209eccbe229e (patch)
treebb317a9031c5860c3f7af7d0878d82d6b12a05b7 /llvm/lib/Analysis/CaptureTracking.cpp
parent250620ab19d667ea1e03f53dc185ce19202e761d (diff)
[InstSimplify][CaptureTracking] Reduce scope of special case
As described in PR54002, the "icmp of load from global" special case in CaptureTracking is incorrect, as is the InstSimplify code that makes use of it. This moves the special case from CaptureTracking into InstSimplify to limit its scope to the buggy transform only, and not affect other code using CaptureTracking as well.
Diffstat (limited to 'llvm/lib/Analysis/CaptureTracking.cpp')
-rw-r--r--llvm/lib/Analysis/CaptureTracking.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index 7f3a2b49aca9..34a320435c0a 100644
--- a/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/llvm/lib/Analysis/CaptureTracking.cpp
@@ -403,12 +403,7 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
return UseCaptureKind::NO_CAPTURE;
}
}
- // Comparison against value stored in global variable. Given the pointer
- // does not escape, its value cannot be guessed and stored separately in a
- // global variable.
- auto *LI = dyn_cast<LoadInst>(I->getOperand(OtherIdx));
- if (LI && isa<GlobalVariable>(LI->getPointerOperand()))
- return UseCaptureKind::NO_CAPTURE;
+
// Otherwise, be conservative. There are crazy ways to capture pointers
// using comparisons.
return UseCaptureKind::MAY_CAPTURE;