[PATCH] isDereferenceablePointer: look through gc.relocate calls
Ramkumar Ramachandra
artagnon at gmail.com
Mon Feb 9 13:10:03 PST 2015
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7454
Files:
llvm/trunk/lib/IR/Value.cpp
llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
Index: llvm/trunk/lib/IR/Value.cpp
===================================================================
--- llvm/trunk/lib/IR/Value.cpp
+++ llvm/trunk/lib/IR/Value.cpp
@@ -23,8 +23,10 @@
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
+#include "llvm/IR/Statepoint.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Debug.h"
@@ -570,6 +572,13 @@
return true;
}
+ // For gc.relocate, look through relocations
+ if (const IntrinsicInst *I = dyn_cast<IntrinsicInst>(V))
+ if (I->getIntrinsicID() == Intrinsic::experimental_gc_relocate) {
+ GCRelocateOperands RelocateInst(I);
+ return isDereferenceablePointer(RelocateInst.derivedPtr(), DL, Visited);
+ }
+
if (const AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(V))
return isDereferenceablePointer(ASC->getOperand(0), DL, Visited);
Index: llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
===================================================================
--- llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
+++ llvm/trunk/test/Analysis/ValueTracking/memory-dereferenceable.ll
@@ -12,8 +12,7 @@
; CHECK: %globalptr
; CHECK: %alloca
; CHECK: %dparam
-; We haven't yet taught it to look through relocations
-; CHECK-NOT: %relocate
+; CHECK: %relocate
; CHECK-NOT: %nparam
entry:
%globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7454.19605.patch
Type: text/x-patch
Size: 1596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150209/0ca46b13/attachment.bin>
More information about the llvm-commits
mailing list