summaryrefslogtreecommitdiff
path: root/lib/Analysis/CaptureTracking.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-11-19 21:34:07 +0000
committerDan Gohman <gohman@apple.com>2009-11-19 21:34:07 +0000
commit2a0fab118f15c01b165bebb73e6c89db48a35b9c (patch)
treef75ce66f63b7738175162dc11d858f5d7a411f1a /lib/Analysis/CaptureTracking.cpp
parentb83012a180dbd8d55672fd946ac9c6256cb00bce (diff)
downloadllvm-2a0fab118f15c01b165bebb73e6c89db48a35b9c.tar.gz
llvm-2a0fab118f15c01b165bebb73e6c89db48a35b9c.tar.bz2
llvm-2a0fab118f15c01b165bebb73e6c89db48a35b9c.tar.xz
Comparing a pointer with null is not a capture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/CaptureTracking.cpp')
-rw-r--r--lib/Analysis/CaptureTracking.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Analysis/CaptureTracking.cpp b/lib/Analysis/CaptureTracking.cpp
index f615881829..7cd055dcd8 100644
--- a/lib/Analysis/CaptureTracking.cpp
+++ b/lib/Analysis/CaptureTracking.cpp
@@ -98,6 +98,11 @@ bool llvm::PointerMayBeCaptured(const Value *V, bool ReturnCaptures) {
Worklist.push_back(U);
}
break;
+ case Instruction::ICmp:
+ // Comparing the pointer against null does not count as a capture.
+ if (isa<ConstantPointerNull>(I->getOperand(1)))
+ break;
+ return true;
default:
// Something else - be conservative and say it is captured.
return true;