mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-26 13:10:34 +00:00
fix PR8677, patch by Jakub Staszak!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120325 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7bb5996e47
commit
e9e973018a
@ -235,8 +235,10 @@ bool DSE::runOnBasicBlock(BasicBlock &BB) {
|
||||
&BB);
|
||||
}
|
||||
|
||||
// If not a definite must-alias dependency, ignore it.
|
||||
if (!InstDep.isDef())
|
||||
// If not a definite must-alias store dependency, ignore it. If this is a
|
||||
// load from the same pointer, we don't want to transform load+store into
|
||||
// a noop.
|
||||
if (!InstDep.isDef() || !isa<StoreInst>(InstDep.getInst()))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -20,3 +20,17 @@ define void @test2(i32 *%p, i32 *%q) {
|
||||
; CHECK: @test2
|
||||
; CHECK-NEXT: store i32 20
|
||||
}
|
||||
|
||||
|
||||
; PR8677
|
||||
@g = global i32 1
|
||||
|
||||
define i32 @test3(i32* %g_addr) nounwind {
|
||||
; CHECK: @test3
|
||||
; CHEcK: load i32* %g_addr
|
||||
%g_value = load i32* %g_addr, align 4
|
||||
store i32 -1, i32* @g, align 4
|
||||
store i32 %g_value, i32* %g_addr, align 4
|
||||
%tmp3 = load i32* @g, align 4
|
||||
ret i32 %tmp3
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user