diff options
author | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-02-09 21:08:03 +0000 |
---|---|---|
committer | Ramkumar Ramachandra <artagnon@gmail.com> | 2015-02-09 21:08:03 +0000 |
commit | a7343d65f4eb198178c8c652768c1a52db977b69 (patch) | |
tree | 2d89b4723781b304eb81eccfa7113b4a89bff28a /llvm/lib/IR/Value.cpp | |
parent | 641c24b9bf81c035dbb95a310b2d487e6b7a63bd (diff) | |
download | bcm5719-llvm-a7343d65f4eb198178c8c652768c1a52db977b69.tar.gz bcm5719-llvm-a7343d65f4eb198178c8c652768c1a52db977b69.zip |
isDereferenceablePointer: look through gc.relocate calls
While a theoretical GC might change dereferenceability on collection,
there is no such known collector and no need to account for the case
with a flag yet.
Differential Revision: http://reviews.llvm.org/D7454
llvm-svn: 228606
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r-- | llvm/lib/IR/Value.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 52dcd6311ff..7d205f975eb 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/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 @@ static bool isDereferenceablePointer(const Value *V, const DataLayout *DL, 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); |