mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4b97d2ca91
commit
ba59efdfc8
@ -23,8 +23,10 @@
|
|||||||
#include "llvm/IR/GetElementPtrTypeIterator.h"
|
#include "llvm/IR/GetElementPtrTypeIterator.h"
|
||||||
#include "llvm/IR/InstrTypes.h"
|
#include "llvm/IR/InstrTypes.h"
|
||||||
#include "llvm/IR/Instructions.h"
|
#include "llvm/IR/Instructions.h"
|
||||||
|
#include "llvm/IR/IntrinsicInst.h"
|
||||||
#include "llvm/IR/Module.h"
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/IR/Operator.h"
|
#include "llvm/IR/Operator.h"
|
||||||
|
#include "llvm/IR/Statepoint.h"
|
||||||
#include "llvm/IR/ValueHandle.h"
|
#include "llvm/IR/ValueHandle.h"
|
||||||
#include "llvm/IR/ValueSymbolTable.h"
|
#include "llvm/IR/ValueSymbolTable.h"
|
||||||
#include "llvm/Support/Debug.h"
|
#include "llvm/Support/Debug.h"
|
||||||
@ -570,6 +572,13 @@ static bool isDereferenceablePointer(const Value *V, const DataLayout *DL,
|
|||||||
return true;
|
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))
|
if (const AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(V))
|
||||||
return isDereferenceablePointer(ASC->getOperand(0), DL, Visited);
|
return isDereferenceablePointer(ASC->getOperand(0), DL, Visited);
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ define void @test(i32 addrspace(1)* byval %dparam) {
|
|||||||
; CHECK: %globalptr
|
; CHECK: %globalptr
|
||||||
; CHECK: %alloca
|
; CHECK: %alloca
|
||||||
; CHECK: %dparam
|
; CHECK: %dparam
|
||||||
; We haven't yet taught it to look through relocations
|
; CHECK: %relocate
|
||||||
; CHECK-NOT: %relocate
|
|
||||||
; CHECK-NOT: %nparam
|
; CHECK-NOT: %nparam
|
||||||
entry:
|
entry:
|
||||||
%globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0
|
%globalptr = getelementptr inbounds [6 x i8]* @globalstr, i32 0, i32 0
|
||||||
|
Loading…
Reference in New Issue
Block a user