mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-30 19:35:54 +00:00
Fix unchecked uses of DominatorTree in MemoryDependenceAnalysis.
Use unknown results for places where it would be needed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181176 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
eaf14786ca
commit
8b9dc21d6f
@ -911,7 +911,6 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
|
|||||||
SmallVectorImpl<NonLocalDepResult> &Result,
|
SmallVectorImpl<NonLocalDepResult> &Result,
|
||||||
DenseMap<BasicBlock*, Value*> &Visited,
|
DenseMap<BasicBlock*, Value*> &Visited,
|
||||||
bool SkipFirstBlock) {
|
bool SkipFirstBlock) {
|
||||||
|
|
||||||
// Look up the cached info for Pointer.
|
// Look up the cached info for Pointer.
|
||||||
ValueIsLoadPair CacheKey(Pointer.getAddr(), isLoad);
|
ValueIsLoadPair CacheKey(Pointer.getAddr(), isLoad);
|
||||||
|
|
||||||
@ -999,8 +998,17 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
|
|||||||
for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
|
for (NonLocalDepInfo::iterator I = Cache->begin(), E = Cache->end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
Visited.insert(std::make_pair(I->getBB(), Addr));
|
Visited.insert(std::make_pair(I->getBB(), Addr));
|
||||||
if (!I->getResult().isNonLocal() && DT->isReachableFromEntry(I->getBB()))
|
if (I->getResult().isNonLocal()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!DT) {
|
||||||
|
Result.push_back(NonLocalDepResult(I->getBB(),
|
||||||
|
MemDepResult::getUnknown(),
|
||||||
|
Addr));
|
||||||
|
} else if (DT->isReachableFromEntry(I->getBB())) {
|
||||||
Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), Addr));
|
Result.push_back(NonLocalDepResult(I->getBB(), I->getResult(), Addr));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++NumCacheCompleteNonLocalPtr;
|
++NumCacheCompleteNonLocalPtr;
|
||||||
return false;
|
return false;
|
||||||
@ -1045,9 +1053,16 @@ getNonLocalPointerDepFromBB(const PHITransAddr &Pointer,
|
|||||||
NumSortedEntries);
|
NumSortedEntries);
|
||||||
|
|
||||||
// If we got a Def or Clobber, add this to the list of results.
|
// If we got a Def or Clobber, add this to the list of results.
|
||||||
if (!Dep.isNonLocal() && DT->isReachableFromEntry(BB)) {
|
if (!Dep.isNonLocal()) {
|
||||||
Result.push_back(NonLocalDepResult(BB, Dep, Pointer.getAddr()));
|
if (!DT) {
|
||||||
continue;
|
Result.push_back(NonLocalDepResult(BB,
|
||||||
|
MemDepResult::getUnknown(),
|
||||||
|
Pointer.getAddr()));
|
||||||
|
continue;
|
||||||
|
} else if (DT->isReachableFromEntry(BB)) {
|
||||||
|
Result.push_back(NonLocalDepResult(BB, Dep, Pointer.getAddr()));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
test/Analysis/MemoryDependenceAnalysis/lit.local.cfg
Normal file
1
test/Analysis/MemoryDependenceAnalysis/lit.local.cfg
Normal file
@ -0,0 +1 @@
|
|||||||
|
config.suffixes = ['.ll']
|
@ -0,0 +1,19 @@
|
|||||||
|
; RUN: opt -memdep -gvn < %s
|
||||||
|
|
||||||
|
define void @__memdep_requires_dominator_tree(i32* nocapture %bufUInt, i32* nocapture %pattern) nounwind {
|
||||||
|
entry:
|
||||||
|
br label %for.body
|
||||||
|
|
||||||
|
for.exit: ; preds = %for.body
|
||||||
|
ret void
|
||||||
|
|
||||||
|
for.body: ; preds = %for.body, %entry
|
||||||
|
%i.01 = phi i32 [ 0, %entry ], [ %tmp8.7, %for.body ]
|
||||||
|
%arrayidx = getelementptr i32* %bufUInt, i32 %i.01
|
||||||
|
%arrayidx5 = getelementptr i32* %pattern, i32 %i.01
|
||||||
|
%tmp6 = load i32* %arrayidx5, align 4
|
||||||
|
store i32 %tmp6, i32* %arrayidx, align 4
|
||||||
|
%tmp8.7 = add i32 %i.01, 8
|
||||||
|
%cmp.7 = icmp ult i32 %tmp8.7, 1024
|
||||||
|
br i1 %cmp.7, label %for.body, label %for.exit
|
||||||
|
}
|
14
test/Transforms/GVN/unreachable_block_infinite_loop.ll
Normal file
14
test/Transforms/GVN/unreachable_block_infinite_loop.ll
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
; RUN: opt -memdep -gvn -disable-output
|
||||||
|
|
||||||
|
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
|
||||||
|
target triple = "x86_64-apple-darwin10.0"
|
||||||
|
|
||||||
|
define i32 @test2() nounwind ssp {
|
||||||
|
entry:
|
||||||
|
ret i32 0
|
||||||
|
|
||||||
|
unreachable_block:
|
||||||
|
%a = add i32 %a, 1
|
||||||
|
ret i32 %a
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user