From 130131ea7871c8774e79116f5c845fff37f143c5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 26 Apr 2011 21:50:51 +0000 Subject: [PATCH] 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 --- lib/Analysis/MemoryDependenceAnalysis.cpp | 37 ----------------------- test/Transforms/GVN/invariant-simple.ll | 36 ---------------------- 2 files changed, 73 deletions(-) delete mode 100644 test/Transforms/GVN/invariant-simple.ll diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index c8c4b4c6fcb..cb3260990ae 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -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(Inst)) { // Debug intrinsics don't (and can't) cause dependences. if (isa(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(Inst)) { @@ -315,10 +285,6 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad, } if (StoreInst *SI = dyn_cast(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 diff --git a/test/Transforms/GVN/invariant-simple.ll b/test/Transforms/GVN/invariant-simple.ll deleted file mode 100644 index 98ea48cdde3..00000000000 --- a/test/Transforms/GVN/invariant-simple.ll +++ /dev/null @@ -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) -- 2.34.1