mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-25 04:39:44 +00:00
9d85eff56a
DSE's overlap checking contained special logic, used only when no DataLayout was available, which inferred a complete overwrite when the pointee types were equal. This logic seems fine for regular loads/stores, but does not work for memcpy and friends. Instead of fixing this, I'm just removing it. Philosophically, transformations should not contain enhanced behavior used only when data layout is lacking (data layout should be strictly additive), and maintaining these rarely-tested code paths seems not worthwhile at this stage. Credit to Aliaksei Zasenka for the bug report and the diagnosis. The test case (slightly reduced from that provided by Aliaksei) replaces the original contents of test/Transforms/DeadStoreElimination/no-targetdata.ll -- a few other tests have been updated to have a data layout. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220035 91177308-0d34-0410-b5e6-96231b3b80d8
41 lines
861 B
LLVM
41 lines
861 B
LLVM
; RUN: opt -basicaa -dse -S < %s | FileCheck %s
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
%t = type { i32 }
|
|
|
|
@g = global i32 42
|
|
|
|
define void @test1(%t* noalias %pp) {
|
|
%p = getelementptr inbounds %t* %pp, i32 0, i32 0
|
|
|
|
store i32 1, i32* %p; <-- This is dead
|
|
%x = load i32* inttoptr (i32 12345 to i32*)
|
|
store i32 %x, i32* %p
|
|
ret void
|
|
; CHECK-LABEL: define void @test1(
|
|
; CHECK: store
|
|
; CHECK-NOT: store
|
|
; CHECK: ret void
|
|
}
|
|
|
|
define void @test3() {
|
|
store i32 1, i32* @g; <-- This is dead.
|
|
store i32 42, i32* @g
|
|
ret void
|
|
; CHECK-LABEL: define void @test3(
|
|
; CHECK: store
|
|
; CHECK-NOT: store
|
|
; CHECK: ret void
|
|
}
|
|
|
|
define void @test4(i32* %p) {
|
|
store i32 1, i32* %p
|
|
%x = load i32* @g; <-- %p and @g could alias
|
|
store i32 %x, i32* %p
|
|
ret void
|
|
; CHECK-LABEL: define void @test4(
|
|
; CHECK: store
|
|
; CHECK: store
|
|
; CHECK: ret void
|
|
}
|