mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-03 13:31:05 +00:00
remove support for llvm.invariant.end from memdep. It is a
work-in-progress that is not progressing, and it has issues. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130247 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
554daa67bd
commit
130131ea78
@ -229,37 +229,14 @@ MemDepResult MemoryDependenceAnalysis::
|
||||
getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
BasicBlock::iterator ScanIt, BasicBlock *BB) {
|
||||
|
||||
Value *InvariantTag = 0;
|
||||
|
||||
// Walk backwards through the basic block, looking for dependencies.
|
||||
while (ScanIt != BB->begin()) {
|
||||
Instruction *Inst = --ScanIt;
|
||||
|
||||
// If we're in an invariant region, no dependencies can be found before
|
||||
// we pass an invariant-begin marker.
|
||||
if (InvariantTag == Inst) {
|
||||
InvariantTag = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) {
|
||||
// Debug intrinsics don't (and can't) cause dependences.
|
||||
if (isa<DbgInfoIntrinsic>(II)) continue;
|
||||
|
||||
// If we pass an invariant-end marker, then we've just entered an
|
||||
// invariant region and can start ignoring dependencies.
|
||||
if (II->getIntrinsicID() == Intrinsic::invariant_end) {
|
||||
// FIXME: This only considers queries directly on the invariant-tagged
|
||||
// pointer, not on query pointers that are indexed off of them. It'd
|
||||
// be nice to handle that at some point.
|
||||
AliasAnalysis::AliasResult R =
|
||||
AA->alias(AliasAnalysis::Location(II->getArgOperand(2)), MemLoc);
|
||||
if (R == AliasAnalysis::MustAlias)
|
||||
InvariantTag = II->getArgOperand(0);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// If we reach a lifetime begin or end marker, then the query ends here
|
||||
// because the value is undefined.
|
||||
if (II->getIntrinsicID() == Intrinsic::lifetime_start) {
|
||||
@ -274,13 +251,6 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
}
|
||||
}
|
||||
|
||||
// If we're querying on a load and we're in an invariant region, we're done
|
||||
// at this point. Nothing a load depends on can live in an invariant region.
|
||||
//
|
||||
// FIXME: this will prevent us from returning load/load must-aliases, so GVN
|
||||
// won't remove redundant loads.
|
||||
if (isLoad && InvariantTag) continue;
|
||||
|
||||
// Values depend on loads if the pointers are must aliased. This means that
|
||||
// a load depends on another must aliased load from the same value.
|
||||
if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) {
|
||||
@ -315,10 +285,6 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
}
|
||||
|
||||
if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) {
|
||||
// There can't be stores to the value we care about inside an
|
||||
// invariant region.
|
||||
if (InvariantTag) continue;
|
||||
|
||||
// If alias analysis can tell that this store is guaranteed to not modify
|
||||
// the query pointer, ignore it. Use getModRefInfo to handle cases where
|
||||
// the query pointer points to constant memory etc.
|
||||
@ -363,9 +329,6 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad,
|
||||
// If the call has no effect on the queried pointer, just ignore it.
|
||||
continue;
|
||||
case AliasAnalysis::Mod:
|
||||
// If we're in an invariant region, we can ignore calls that ONLY
|
||||
// modify the pointer.
|
||||
if (InvariantTag) continue;
|
||||
return MemDepResult::getClobber(Inst);
|
||||
case AliasAnalysis::Ref:
|
||||
// If the call is known to never store to the pointer, and if this is a
|
||||
|
@ -1,36 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
|
||||
target triple = "i386-apple-darwin7"
|
||||
|
||||
define i8 @test(i8* %P) nounwind {
|
||||
; CHECK: @test
|
||||
; CHECK-NOT: load
|
||||
; CHECK: ret i8
|
||||
entry:
|
||||
store i8 1, i8* %P
|
||||
%0 = call {}* @llvm.invariant.start(i64 32, i8* %P)
|
||||
%1 = tail call i32 @foo(i8* %P)
|
||||
call void @llvm.invariant.end({}* %0, i64 32, i8* %P)
|
||||
%2 = load i8* %P
|
||||
ret i8 %2
|
||||
}
|
||||
|
||||
define i8 @test2(i8* %P) nounwind {
|
||||
; CHECK: @test2
|
||||
; CHECK: store i8 1
|
||||
; CHECK: store i8 2
|
||||
; CHECK: ret i8 0
|
||||
entry:
|
||||
store i8 1, i8* %P
|
||||
%0 = call {}* @llvm.invariant.start(i64 32, i8* %P)
|
||||
%1 = tail call i32 @bar(i8* %P)
|
||||
call void @llvm.invariant.end({}* %0, i64 32, i8* %P)
|
||||
store i8 2, i8* %P
|
||||
ret i8 0
|
||||
}
|
||||
|
||||
declare i32 @foo(i8*) nounwind
|
||||
declare i32 @bar(i8*) nounwind readonly
|
||||
declare {}* @llvm.invariant.start(i64 %S, i8* nocapture %P) readonly
|
||||
declare void @llvm.invariant.end({}* %S, i64 %SS, i8* nocapture %P)
|
Loading…
Reference in New Issue
Block a user