From 2a0fab118f15c01b165bebb73e6c89db48a35b9c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 19 Nov 2009 21:34:07 +0000 Subject: 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 --- lib/Analysis/CaptureTracking.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Analysis/CaptureTracking.cpp') 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(I->getOperand(1))) + break; + return true; default: // Something else - be conservative and say it is captured. return true; -- cgit v1.2.3-18-g5258