aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/CaptureTracking.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-02-28 10:23:27 +0100
committerNikita Popov <npopov@redhat.com>2025-02-28 11:15:28 +0100
commitabd97d9685c07c4787ff22e56c0a7b8963630063 (patch)
tree18093f5a9b9f912d6168137e38d051e97d22ed9a /llvm/lib/Analysis/CaptureTracking.cpp
parent0ba4767feac7878044b1352d86806e8e5a9bcf29 (diff)
downloadllvm-abd97d9685c07c4787ff22e56c0a7b8963630063.zip
llvm-abd97d9685c07c4787ff22e56c0a7b8963630063.tar.gz
llvm-abd97d9685c07c4787ff22e56c0a7b8963630063.tar.bz2
[CaptureTracking] Take non-willreturn calls into account
We can leak one bit of information about the address by either diverging or not. Part of https://github.com/llvm/llvm-project/issues/129090.
Diffstat (limited to 'llvm/lib/Analysis/CaptureTracking.cpp')
-rw-r--r--llvm/lib/Analysis/CaptureTracking.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp
index 6e5748c..98f68d3 100644
--- a/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/llvm/lib/Analysis/CaptureTracking.cpp
@@ -279,9 +279,9 @@ UseCaptureInfo llvm::DetermineUseCaptureKind(
case Instruction::Invoke: {
auto *Call = cast<CallBase>(I);
// Not captured if the callee is readonly, doesn't return a copy through
- // its return value and doesn't unwind (a readonly function can leak bits
- // by throwing an exception or not depending on the input value).
- if (Call->onlyReadsMemory() && Call->doesNotThrow() &&
+ // its return value and doesn't unwind or diverge (a readonly function can
+ // leak bits by throwing an exception or not depending on the input value).
+ if (Call->onlyReadsMemory() && Call->doesNotThrow() && Call->willReturn() &&
Call->getType()->isVoidTy())
return CaptureComponents::None;