You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.167
Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
parent
e19d552987
commit
b084638f15
@ -1,23 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
; PR9561
|
||||
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-n8:16:32"
|
||||
target triple = "i386-apple-darwin9.8"
|
||||
|
||||
@A = external global [0 x i32]
|
||||
|
||||
declare ghccc void @Func2(i32*, i32*, i32*, i32)
|
||||
|
||||
define ghccc void @Func1(i32* noalias %Arg1, i32* noalias %Arg2, i32* %Arg3, i32 %Arg4) {
|
||||
entry:
|
||||
store i32 add (i32 ptrtoint ([0 x i32]* @A to i32), i32 1), i32* %Arg2
|
||||
; CHECK: store i32 add (i32 ptrtoint ([0 x i32]* @A to i32), i32 1), i32* %Arg2
|
||||
%ln2gz = getelementptr i32, i32* %Arg1, i32 14
|
||||
%ln2gA = bitcast i32* %ln2gz to double*
|
||||
%ln2gB = load double, double* %ln2gA
|
||||
%ln2gD = getelementptr i32, i32* %Arg2, i32 -3
|
||||
%ln2gE = bitcast i32* %ln2gD to double*
|
||||
store double %ln2gB, double* %ln2gE
|
||||
; CHECK: store double %ln2gB, double* %ln2gE
|
||||
tail call ghccc void @Func2(i32* %Arg1, i32* %Arg2, i32* %Arg3, i32 %Arg4) nounwind
|
||||
ret void
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
; RUN: opt -dse -S < %s | FileCheck %s
|
||||
|
||||
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-darwin"
|
||||
|
||||
%"class.std::auto_ptr" = type { i32* }
|
||||
|
||||
; CHECK-LABEL: @_Z3foov(
|
||||
define void @_Z3foov(%"class.std::auto_ptr"* noalias nocapture sret %agg.result) uwtable ssp {
|
||||
_ZNSt8auto_ptrIiED1Ev.exit:
|
||||
%temp.lvalue = alloca %"class.std::auto_ptr", align 8
|
||||
call void @_Z3barv(%"class.std::auto_ptr"* sret %temp.lvalue)
|
||||
%_M_ptr.i.i = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* %temp.lvalue, i64 0, i32 0
|
||||
%tmp.i.i = load i32*, i32** %_M_ptr.i.i, align 8
|
||||
; CHECK-NOT: store i32* null
|
||||
store i32* null, i32** %_M_ptr.i.i, align 8
|
||||
%_M_ptr.i.i4 = getelementptr inbounds %"class.std::auto_ptr", %"class.std::auto_ptr"* %agg.result, i64 0, i32 0
|
||||
store i32* %tmp.i.i, i32** %_M_ptr.i.i4, align 8
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @_Z3barv(%"class.std::auto_ptr"* sret)
|
@ -1,85 +0,0 @@
|
||||
; RUN: opt -dse -S < %s | FileCheck %s
|
||||
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-f128:128:128-n8:16:32:64"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
%struct.pair.162 = type { %struct.BasicBlock*, i32, [4 x i8] }
|
||||
%struct.BasicBlock = type { %struct.Value, %struct.ilist_node.24, %struct.iplist.22, %struct.Function* }
|
||||
%struct.Value = type { i32 (...)**, i8, i8, i16, %struct.Type*, %struct.Use*, %struct.StringMapEntry* }
|
||||
%struct.Type = type { %struct.LLVMContext*, i8, [3 x i8], i32, {}* }
|
||||
%struct.LLVMContext = type { %struct.LLVMContextImpl* }
|
||||
%struct.LLVMContextImpl = type opaque
|
||||
%struct.Use = type { %struct.Value*, %struct.Use*, %struct.PointerIntPair }
|
||||
%struct.PointerIntPair = type { i64 }
|
||||
%struct.StringMapEntry = type opaque
|
||||
%struct.ilist_node.24 = type { %struct.ilist_half_node.23, %struct.BasicBlock* }
|
||||
%struct.ilist_half_node.23 = type { %struct.BasicBlock* }
|
||||
%struct.iplist.22 = type { %struct.ilist_traits.21, %struct.Instruction* }
|
||||
%struct.ilist_traits.21 = type { %struct.ilist_half_node.25 }
|
||||
%struct.ilist_half_node.25 = type { %struct.Instruction* }
|
||||
%struct.Instruction = type { [52 x i8], %struct.ilist_node.26, %struct.BasicBlock*, %struct.DebugLoc }
|
||||
%struct.ilist_node.26 = type { %struct.ilist_half_node.25, %struct.Instruction* }
|
||||
%struct.DebugLoc = type { i32, i32 }
|
||||
%struct.Function = type { %struct.GlobalValue, %struct.ilist_node.14, %struct.iplist.4, %struct.iplist, %struct.ValueSymbolTable*, %struct.AttrListPtr }
|
||||
%struct.GlobalValue = type <{ [52 x i8], [4 x i8], %struct.Module*, i8, i16, [5 x i8], %struct.basic_string }>
|
||||
%struct.Module = type { %struct.LLVMContext*, %struct.iplist.20, %struct.iplist.16, %struct.iplist.12, %struct.vector.2, %struct.ilist, %struct.basic_string, %struct.ValueSymbolTable*, %struct.OwningPtr, %struct.basic_string, %struct.basic_string, %struct.basic_string, i8* }
|
||||
%struct.iplist.20 = type { %struct.ilist_traits.19, %struct.GlobalVariable* }
|
||||
%struct.ilist_traits.19 = type { %struct.ilist_node.18 }
|
||||
%struct.ilist_node.18 = type { %struct.ilist_half_node.17, %struct.GlobalVariable* }
|
||||
%struct.ilist_half_node.17 = type { %struct.GlobalVariable* }
|
||||
%struct.GlobalVariable = type { %struct.GlobalValue, %struct.ilist_node.18, i8, [7 x i8] }
|
||||
%struct.iplist.16 = type { %struct.ilist_traits.15, %struct.Function* }
|
||||
%struct.ilist_traits.15 = type { %struct.ilist_node.14 }
|
||||
%struct.ilist_node.14 = type { %struct.ilist_half_node.13, %struct.Function* }
|
||||
%struct.ilist_half_node.13 = type { %struct.Function* }
|
||||
%struct.iplist.12 = type { %struct.ilist_traits.11, %struct.GlobalAlias* }
|
||||
%struct.ilist_traits.11 = type { %struct.ilist_node.10 }
|
||||
%struct.ilist_node.10 = type { %struct.ilist_half_node.9, %struct.GlobalAlias* }
|
||||
%struct.ilist_half_node.9 = type { %struct.GlobalAlias* }
|
||||
%struct.GlobalAlias = type { %struct.GlobalValue, %struct.ilist_node.10 }
|
||||
%struct.vector.2 = type { %struct._Vector_base.1 }
|
||||
%struct._Vector_base.1 = type { %struct._Vector_impl.0 }
|
||||
%struct._Vector_impl.0 = type { %struct.basic_string*, %struct.basic_string*, %struct.basic_string* }
|
||||
%struct.basic_string = type { %struct._Alloc_hider }
|
||||
%struct._Alloc_hider = type { i8* }
|
||||
%struct.ilist = type { %struct.iplist.8 }
|
||||
%struct.iplist.8 = type { %struct.ilist_traits.7, %struct.NamedMDNode* }
|
||||
%struct.ilist_traits.7 = type { %struct.ilist_node.6 }
|
||||
%struct.ilist_node.6 = type { %struct.ilist_half_node.5, %struct.NamedMDNode* }
|
||||
%struct.ilist_half_node.5 = type { %struct.NamedMDNode* }
|
||||
%struct.NamedMDNode = type { %struct.ilist_node.6, %struct.basic_string, %struct.Module*, i8* }
|
||||
%struct.ValueSymbolTable = type opaque
|
||||
%struct.OwningPtr = type { %struct.GVMaterializer* }
|
||||
%struct.GVMaterializer = type opaque
|
||||
%struct.iplist.4 = type { %struct.ilist_traits.3, %struct.BasicBlock* }
|
||||
%struct.ilist_traits.3 = type { %struct.ilist_half_node.23 }
|
||||
%struct.iplist = type { %struct.ilist_traits, %struct.Argument* }
|
||||
%struct.ilist_traits = type { %struct.ilist_half_node }
|
||||
%struct.ilist_half_node = type { %struct.Argument* }
|
||||
%struct.Argument = type { %struct.Value, %struct.ilist_node, %struct.Function* }
|
||||
%struct.ilist_node = type { %struct.ilist_half_node, %struct.Argument* }
|
||||
%struct.AttrListPtr = type { %struct.AttributeListImpl* }
|
||||
%struct.AttributeListImpl = type opaque
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
|
||||
; CHECK: _ZSt9iter_swapIPSt4pairIPN4llvm10BasicBlockEjES5_EvT_T0_
|
||||
; CHECK: store
|
||||
; CHECK: ret void
|
||||
define void @_ZSt9iter_swapIPSt4pairIPN4llvm10BasicBlockEjES5_EvT_T0_(%struct.pair.162* %__a, %struct.pair.162* %__b) nounwind uwtable inlinehint {
|
||||
entry:
|
||||
%memtmp = alloca %struct.pair.162, align 8
|
||||
%0 = getelementptr inbounds %struct.pair.162, %struct.pair.162* %memtmp, i64 0, i32 0
|
||||
%1 = getelementptr inbounds %struct.pair.162, %struct.pair.162* %__a, i64 0, i32 0
|
||||
%2 = load %struct.BasicBlock*, %struct.BasicBlock** %1, align 8
|
||||
store %struct.BasicBlock* %2, %struct.BasicBlock** %0, align 8
|
||||
%3 = getelementptr inbounds %struct.pair.162, %struct.pair.162* %memtmp, i64 0, i32 1
|
||||
%4 = getelementptr inbounds %struct.pair.162, %struct.pair.162* %__a, i64 0, i32 1
|
||||
%5 = load i32, i32* %4, align 4
|
||||
store i32 %5, i32* %3, align 8
|
||||
%6 = bitcast %struct.pair.162* %__a to i8*
|
||||
%7 = bitcast %struct.pair.162* %__b to i8*
|
||||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %6, i8* %7, i64 12, i32 1, i1 false)
|
||||
%8 = bitcast %struct.pair.162* %memtmp to i8*
|
||||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %7, i8* %8, i64 12, i32 1, i1 false)
|
||||
ret void
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S -enable-dse-partial-overwrite-tracking | FileCheck %s
|
||||
; PR28588
|
||||
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define void @_UPT_destroy(i8* nocapture %ptr) local_unnamed_addr #0 {
|
||||
entry:
|
||||
%edi = getelementptr inbounds i8, i8* %ptr, i64 8
|
||||
|
||||
; CHECK-NOT: tail call void @llvm.memset.p0i8.i64(i8* %edi, i8 0, i64 176, i32 8, i1 false)
|
||||
; CHECK-NOT: store i32 -1, i32* %addr
|
||||
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %edi, i8 0, i64 176, i32 8, i1 false)
|
||||
%format4.i = getelementptr inbounds i8, i8* %ptr, i64 144
|
||||
%addr = bitcast i8* %format4.i to i32*
|
||||
store i32 -1, i32* %addr, align 8
|
||||
|
||||
; CHECK: tail call void @free
|
||||
tail call void @free(i8* nonnull %ptr)
|
||||
ret void
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @free(i8* nocapture) local_unnamed_addr #0
|
||||
|
||||
; Function Attrs: argmemonly nounwind
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i32, i1) #1
|
||||
|
||||
attributes #0 = { nounwind }
|
||||
attributes #1 = { argmemonly nounwind }
|
@ -1,108 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
|
||||
define void @write4to7(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @write4to7(
|
||||
entry:
|
||||
%arrayidx0 = getelementptr inbounds i32, i32* %p, i64 1
|
||||
%p3 = bitcast i32* %arrayidx0 to i8*
|
||||
; CHECK: [[GEP:%[0-9]+]] = getelementptr inbounds i8, i8* %p3, i64 4
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* [[GEP]], i8 0, i64 24, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
|
||||
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 1
|
||||
store i32 1, i32* %arrayidx1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write0to3(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @write0to3(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: [[GEP:%[0-9]+]] = getelementptr inbounds i8, i8* %p3, i64 4
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* [[GEP]], i8 0, i64 24, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
|
||||
store i32 1, i32* %p, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write0to7(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @write0to7(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: [[GEP:%[0-9]+]] = getelementptr inbounds i8, i8* %p3, i64 8
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* [[GEP]], i8 0, i64 24, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
%p4 = bitcast i32* %p to i64*
|
||||
store i64 1, i64* %p4, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write0to7_2(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @write0to7_2(
|
||||
entry:
|
||||
%arrayidx0 = getelementptr inbounds i32, i32* %p, i64 1
|
||||
%p3 = bitcast i32* %arrayidx0 to i8*
|
||||
; CHECK: [[GEP:%[0-9]+]] = getelementptr inbounds i8, i8* %p3, i64 4
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* [[GEP]], i8 0, i64 24, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
|
||||
%p4 = bitcast i32* %p to i64*
|
||||
store i64 1, i64* %p4, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
; We do not trim the beginning of the eariler write if the alignment of the
|
||||
; start pointer is changed.
|
||||
define void @dontwrite0to3_align8(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @dontwrite0to3_align8(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 8, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 8, i1 false)
|
||||
store i32 1, i32* %p, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @dontwrite0to1(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @dontwrite0to1(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
%p4 = bitcast i32* %p to i16*
|
||||
store i16 1, i16* %p4, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @dontwrite2to9(i32* nocapture %p) {
|
||||
; CHECK-LABEL: @dontwrite2to9(
|
||||
entry:
|
||||
%arrayidx0 = getelementptr inbounds i32, i32* %p, i64 1
|
||||
%p3 = bitcast i32* %arrayidx0 to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
%p4 = bitcast i32* %p to i16*
|
||||
%arrayidx2 = getelementptr inbounds i16, i16* %p4, i64 1
|
||||
%p5 = bitcast i16* %arrayidx2 to i64*
|
||||
store i64 1, i64* %p5, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write8To15AndThen0To7(i64* nocapture %P) {
|
||||
entry:
|
||||
; CHECK-LABEL: @write8To15AndThen0To7(
|
||||
; CHECK: [[GEP:%[0-9]+]] = getelementptr inbounds i8, i8* %mybase0, i64 16
|
||||
; CHECK: tail call void @llvm.memset.p0i8.i64(i8* [[GEP]], i8 0, i64 16, i32 8, i1 false)
|
||||
|
||||
%base0 = bitcast i64* %P to i8*
|
||||
%mybase0 = getelementptr inbounds i8, i8* %base0, i64 0
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %mybase0, i8 0, i64 32, i32 8, i1 false)
|
||||
|
||||
%base64_0 = getelementptr inbounds i64, i64* %P, i64 0
|
||||
%base64_1 = getelementptr inbounds i64, i64* %P, i64 1
|
||||
|
||||
store i64 1, i64* %base64_1
|
||||
store i64 2, i64* %base64_0
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
|
||||
|
@ -1,112 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
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-S128"
|
||||
|
||||
%struct.vec2 = type { <4 x i32>, <4 x i32> }
|
||||
%struct.vec2plusi = type { <4 x i32>, <4 x i32>, i32 }
|
||||
|
||||
@glob1 = global %struct.vec2 zeroinitializer, align 16
|
||||
@glob2 = global %struct.vec2plusi zeroinitializer, align 16
|
||||
|
||||
define void @write24to28(i32* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @write24to28(
|
||||
entry:
|
||||
%arrayidx0 = getelementptr inbounds i32, i32* %p, i64 1
|
||||
%p3 = bitcast i32* %arrayidx0 to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 24, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
|
||||
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 7
|
||||
store i32 1, i32* %arrayidx1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write28to32(i32* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @write28to32(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 28, i32 4, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 4, i1 false)
|
||||
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 7
|
||||
store i32 1, i32* %arrayidx1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @dontwrite28to32memset(i32* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @dontwrite28to32memset(
|
||||
entry:
|
||||
%p3 = bitcast i32* %p to i8*
|
||||
; CHECK: call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 16, i1 false)
|
||||
call void @llvm.memset.p0i8.i64(i8* %p3, i8 0, i64 32, i32 16, i1 false)
|
||||
%arrayidx1 = getelementptr inbounds i32, i32* %p, i64 7
|
||||
store i32 1, i32* %arrayidx1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write32to36(%struct.vec2plusi* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @write32to36(
|
||||
entry:
|
||||
%0 = bitcast %struct.vec2plusi* %p to i8*
|
||||
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2plusi* @glob2 to i8*), i64 32, i32 16, i1 false)
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2plusi* @glob2 to i8*), i64 36, i32 16, i1 false)
|
||||
%c = getelementptr inbounds %struct.vec2plusi, %struct.vec2plusi* %p, i64 0, i32 2
|
||||
store i32 1, i32* %c, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write16to32(%struct.vec2* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @write16to32(
|
||||
entry:
|
||||
%0 = bitcast %struct.vec2* %p to i8*
|
||||
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 16, i32 16, i1 false)
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 32, i32 16, i1 false)
|
||||
%c = getelementptr inbounds %struct.vec2, %struct.vec2* %p, i64 0, i32 1
|
||||
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %c, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @dontwrite28to32memcpy(%struct.vec2* nocapture %p) nounwind uwtable ssp {
|
||||
; CHECK-LABEL: @dontwrite28to32memcpy(
|
||||
entry:
|
||||
%0 = bitcast %struct.vec2* %p to i8*
|
||||
; CHECK: tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 32, i32 16, i1 false)
|
||||
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* bitcast (%struct.vec2* @glob1 to i8*), i64 32, i32 16, i1 false)
|
||||
%arrayidx1 = getelementptr inbounds %struct.vec2, %struct.vec2* %p, i64 0, i32 0, i64 7
|
||||
store i32 1, i32* %arrayidx1, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
|
||||
|
||||
%struct.trapframe = type { i64, i64, i64 }
|
||||
|
||||
; bugzilla 11455 - make sure negative GEP's don't break this optimisation
|
||||
; CHECK-LABEL: @cpu_lwp_fork(
|
||||
define void @cpu_lwp_fork(%struct.trapframe* %md_regs, i64 %pcb_rsp0) nounwind uwtable noinline ssp {
|
||||
entry:
|
||||
%0 = inttoptr i64 %pcb_rsp0 to %struct.trapframe*
|
||||
%add.ptr = getelementptr inbounds %struct.trapframe, %struct.trapframe* %0, i64 -1
|
||||
%1 = bitcast %struct.trapframe* %add.ptr to i8*
|
||||
%2 = bitcast %struct.trapframe* %md_regs to i8*
|
||||
; CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 24, i32 1, i1 false)
|
||||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 24, i32 1, i1 false)
|
||||
%tf_trapno = getelementptr inbounds %struct.trapframe, %struct.trapframe* %0, i64 -1, i32 1
|
||||
store i64 3, i64* %tf_trapno, align 8
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @write16To23AndThen24To31(i64* nocapture %P, i64 %n64, i32 %n32, i16 %n16, i8 %n8) {
|
||||
entry:
|
||||
; CHECK-LABEL: @write16To23AndThen24To31(
|
||||
; CHECK: tail call void @llvm.memset.p0i8.i64(i8* %mybase0, i8 0, i64 16, i32 8, i1 false)
|
||||
|
||||
%base0 = bitcast i64* %P to i8*
|
||||
%mybase0 = getelementptr inbounds i8, i8* %base0, i64 0
|
||||
tail call void @llvm.memset.p0i8.i64(i8* %mybase0, i8 0, i64 32, i32 8, i1 false)
|
||||
|
||||
%base64_2 = getelementptr inbounds i64, i64* %P, i64 2
|
||||
%base64_3 = getelementptr inbounds i64, i64* %P, i64 3
|
||||
|
||||
store i64 3, i64* %base64_2
|
||||
store i64 3, i64* %base64_3
|
||||
ret void
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -enable-dse-partial-store-merging=false -S | FileCheck %s
|
||||
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
|
||||
|
||||
; Ensure that the dead store is deleted in this case. It is wholely
|
||||
; overwritten by the second store.
|
||||
define void @test1(i32 *%V) {
|
||||
%V2 = bitcast i32* %V to i8* ; <i8*> [#uses=1]
|
||||
store i8 0, i8* %V2
|
||||
store i32 1234567, i32* %V
|
||||
ret void
|
||||
; CHECK-LABEL: @test1(
|
||||
; CHECK-NEXT: store i32 1234567
|
||||
}
|
||||
|
||||
; Note that we could do better by merging the two stores into one.
|
||||
define void @test2(i32* %P) {
|
||||
; CHECK-LABEL: @test2(
|
||||
store i32 0, i32* %P
|
||||
; CHECK: store i32
|
||||
%Q = bitcast i32* %P to i16*
|
||||
store i16 1, i16* %Q
|
||||
; CHECK: store i16
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
define i32 @test3(double %__x) {
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK: store double
|
||||
%__u = alloca { [3 x i32] }
|
||||
%tmp.1 = bitcast { [3 x i32] }* %__u to double*
|
||||
store double %__x, double* %tmp.1
|
||||
%tmp.4 = getelementptr { [3 x i32] }, { [3 x i32] }* %__u, i32 0, i32 0, i32 1
|
||||
%tmp.5 = load i32, i32* %tmp.4
|
||||
%tmp.6 = icmp slt i32 %tmp.5, 0
|
||||
%tmp.7 = zext i1 %tmp.6 to i32
|
||||
ret i32 %tmp.7
|
||||
}
|
||||
|
||||
; PR6043
|
||||
define void @test4(i8* %P) {
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: store double
|
||||
|
||||
store i8 19, i8* %P ;; dead
|
||||
%A = getelementptr i8, i8* %P, i32 3
|
||||
|
||||
store i8 42, i8* %A ;; dead
|
||||
|
||||
%Q = bitcast i8* %P to double*
|
||||
store double 0.0, double* %Q
|
||||
ret void
|
||||
}
|
||||
|
||||
; PR8657
|
||||
declare void @test5a(i32*)
|
||||
define void @test5(i32 %i) nounwind ssp {
|
||||
%A = alloca i32
|
||||
%B = bitcast i32* %A to i8*
|
||||
%C = getelementptr i8, i8* %B, i32 %i
|
||||
store i8 10, i8* %C ;; Dead store to variable index.
|
||||
store i32 20, i32* %A
|
||||
|
||||
call void @test5a(i32* %A)
|
||||
ret void
|
||||
; CHECK-LABEL: @test5(
|
||||
; CHECK-NEXT: alloca
|
||||
; CHECK-NEXT: store i32 20
|
||||
; CHECK-NEXT: call void @test5a
|
||||
}
|
||||
|
||||
declare void @test5a_as1(i32*)
|
||||
define void @test5_addrspacecast(i32 %i) nounwind ssp {
|
||||
%A = alloca i32
|
||||
%B = addrspacecast i32* %A to i8 addrspace(1)*
|
||||
%C = getelementptr i8, i8 addrspace(1)* %B, i32 %i
|
||||
store i8 10, i8 addrspace(1)* %C ;; Dead store to variable index.
|
||||
store i32 20, i32* %A
|
||||
|
||||
call void @test5a(i32* %A)
|
||||
ret void
|
||||
; CHECK-LABEL: @test5_addrspacecast(
|
||||
; CHECK-NEXT: alloca
|
||||
; CHECK-NEXT: store i32 20
|
||||
; CHECK-NEXT: call void @test5a
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
; RUN: opt -basicaa -dse -S < %s | FileCheck %s
|
||||
|
||||
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-macosx10.7.0"
|
||||
|
||||
; Sanity tests for atomic stores.
|
||||
; Note that it turns out essentially every transformation DSE does is legal on
|
||||
; atomic ops, just some transformations are not allowed across release-acquire pairs.
|
||||
|
||||
@x = common global i32 0, align 4
|
||||
@y = common global i32 0, align 4
|
||||
|
||||
declare void @randomop(i32*)
|
||||
|
||||
; DSE across unordered store (allowed)
|
||||
define void @test1() {
|
||||
; CHECK-LABEL: test1
|
||||
; CHECK-NOT: store i32 0
|
||||
; CHECK: store i32 1
|
||||
store i32 0, i32* @x
|
||||
store atomic i32 0, i32* @y unordered, align 4
|
||||
store i32 1, i32* @x
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE remove unordered store (allowed)
|
||||
define void @test4() {
|
||||
; CHECK-LABEL: test4
|
||||
; CHECK-NOT: store atomic
|
||||
; CHECK: store i32 1
|
||||
store atomic i32 0, i32* @x unordered, align 4
|
||||
store i32 1, i32* @x
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE unordered store overwriting non-atomic store (allowed)
|
||||
define void @test5() {
|
||||
; CHECK-LABEL: test5
|
||||
; CHECK: store atomic i32 1
|
||||
store i32 0, i32* @x
|
||||
store atomic i32 1, i32* @x unordered, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE no-op unordered atomic store (allowed)
|
||||
define void @test6() {
|
||||
; CHECK-LABEL: test6
|
||||
; CHECK-NOT: store
|
||||
; CHECK: ret void
|
||||
%x = load atomic i32, i32* @x unordered, align 4
|
||||
store atomic i32 %x, i32* @x unordered, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE seq_cst store (be conservative; DSE doesn't have infrastructure
|
||||
; to reason about atomic operations).
|
||||
define void @test7() {
|
||||
; CHECK-LABEL: test7
|
||||
; CHECK: store atomic
|
||||
%a = alloca i32
|
||||
store atomic i32 0, i32* %a seq_cst, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE and seq_cst load (be conservative; DSE doesn't have infrastructure
|
||||
; to reason about atomic operations).
|
||||
define i32 @test8() {
|
||||
; CHECK-LABEL: test8
|
||||
; CHECK: store
|
||||
; CHECK: load atomic
|
||||
%a = alloca i32
|
||||
call void @randomop(i32* %a)
|
||||
store i32 0, i32* %a, align 4
|
||||
%x = load atomic i32, i32* @x seq_cst, align 4
|
||||
ret i32 %x
|
||||
}
|
||||
|
||||
; DSE across monotonic load (allowed as long as the eliminated store isUnordered)
|
||||
define i32 @test9() {
|
||||
; CHECK-LABEL: test9
|
||||
; CHECK-NOT: store i32 0
|
||||
; CHECK: store i32 1
|
||||
store i32 0, i32* @x
|
||||
%x = load atomic i32, i32* @y monotonic, align 4
|
||||
store i32 1, i32* @x
|
||||
ret i32 %x
|
||||
}
|
||||
|
||||
; DSE across monotonic store (allowed as long as the eliminated store isUnordered)
|
||||
define void @test10() {
|
||||
; CHECK-LABEL: test10
|
||||
; CHECK-NOT: store i32 0
|
||||
; CHECK: store i32 1
|
||||
store i32 0, i32* @x
|
||||
store atomic i32 42, i32* @y monotonic, align 4
|
||||
store i32 1, i32* @x
|
||||
ret void
|
||||
}
|
||||
|
||||
; DSE across monotonic load (forbidden since the eliminated store is atomic)
|
||||
define i32 @test11() {
|
||||
; CHECK-LABEL: test11
|
||||
; CHECK: store atomic i32 0
|
||||
; CHECK: store atomic i32 1
|
||||
store atomic i32 0, i32* @x monotonic, align 4
|
||||
%x = load atomic i32, i32* @y monotonic, align 4
|
||||
store atomic i32 1, i32* @x monotonic, align 4
|
||||
ret i32 %x
|
||||
}
|
||||
|
||||
; DSE across monotonic store (forbidden since the eliminated store is atomic)
|
||||
define void @test12() {
|
||||
; CHECK-LABEL: test12
|
||||
; CHECK: store atomic i32 0
|
||||
; CHECK: store atomic i32 1
|
||||
store atomic i32 0, i32* @x monotonic, align 4
|
||||
store atomic i32 42, i32* @y monotonic, align 4
|
||||
store atomic i32 1, i32* @x monotonic, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; But DSE is not allowed across a release-acquire pair.
|
||||
define i32 @test15() {
|
||||
; CHECK-LABEL: test15
|
||||
; CHECK: store i32 0
|
||||
; CHECK: store i32 1
|
||||
store i32 0, i32* @x
|
||||
store atomic i32 0, i32* @y release, align 4
|
||||
%x = load atomic i32, i32* @y acquire, align 4
|
||||
store i32 1, i32* @x
|
||||
ret i32 %x
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
|
||||
declare noalias i8* @calloc(i64, i64)
|
||||
|
||||
define i32* @test1() {
|
||||
; CHECK-LABEL: test1
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
%2 = bitcast i8* %1 to i32*
|
||||
; This store is dead and should be removed
|
||||
store i32 0, i32* %2, align 4
|
||||
; CHECK-NOT: store i32 0, i32* %2, align 4
|
||||
ret i32* %2
|
||||
}
|
||||
|
||||
define i32* @test2() {
|
||||
; CHECK-LABEL: test2
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
%2 = bitcast i8* %1 to i32*
|
||||
%3 = getelementptr i32, i32* %2, i32 5
|
||||
store i32 0, i32* %3, align 4
|
||||
; CHECK-NOT: store i32 0, i32* %2, align 4
|
||||
ret i32* %2
|
||||
}
|
||||
|
||||
define i32* @test3(i32 *%arg) {
|
||||
; CHECK-LABEL: test3
|
||||
store i32 0, i32* %arg, align 4
|
||||
; CHECK: store i32 0, i32* %arg, align 4
|
||||
ret i32* %arg
|
||||
}
|
||||
|
||||
declare void @clobber_memory(i8*)
|
||||
define i8* @test4() {
|
||||
; CHECK-LABEL: test4
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
call void @clobber_memory(i8* %1)
|
||||
store i8 0, i8* %1, align 4
|
||||
; CHECK: store i8 0, i8* %1, align 4
|
||||
ret i8* %1
|
||||
}
|
||||
|
||||
define i32* @test5() {
|
||||
; CHECK-LABEL: test5
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
%2 = bitcast i8* %1 to i32*
|
||||
store volatile i32 0, i32* %2, align 4
|
||||
; CHECK: store volatile i32 0, i32* %2, align 4
|
||||
ret i32* %2
|
||||
}
|
||||
|
||||
define i8* @test6() {
|
||||
; CHECK-LABEL: test6
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
store i8 5, i8* %1, align 4
|
||||
; CHECK: store i8 5, i8* %1, align 4
|
||||
ret i8* %1
|
||||
}
|
||||
|
||||
define i8* @test7(i8 %arg) {
|
||||
; CHECK-LABEL: test7
|
||||
%1 = tail call noalias i8* @calloc(i64 1, i64 4)
|
||||
store i8 %arg, i8* %1, align 4
|
||||
; CHECK: store i8 %arg, i8* %1, align 4
|
||||
ret i8* %1
|
||||
}
|
@ -1,239 +0,0 @@
|
||||
; RUN: opt -S -dse -enable-dse-partial-store-merging=false < %s | FileCheck %s
|
||||
target datalayout = "E-m:e-i64:64-n32:64"
|
||||
target triple = "powerpc64-bgq-linux"
|
||||
|
||||
%"struct.std::complex" = type { { float, float } }
|
||||
|
||||
define void @_Z4testSt7complexIfE(%"struct.std::complex"* noalias nocapture sret %agg.result, i64 %c.coerce) {
|
||||
entry:
|
||||
; CHECK-LABEL: @_Z4testSt7complexIfE
|
||||
|
||||
%ref.tmp = alloca i64, align 8
|
||||
%tmpcast = bitcast i64* %ref.tmp to %"struct.std::complex"*
|
||||
%c.sroa.0.0.extract.shift = lshr i64 %c.coerce, 32
|
||||
%c.sroa.0.0.extract.trunc = trunc i64 %c.sroa.0.0.extract.shift to i32
|
||||
%0 = bitcast i32 %c.sroa.0.0.extract.trunc to float
|
||||
%c.sroa.2.0.extract.trunc = trunc i64 %c.coerce to i32
|
||||
%1 = bitcast i32 %c.sroa.2.0.extract.trunc to float
|
||||
call void @_Z3barSt7complexIfE(%"struct.std::complex"* nonnull sret %tmpcast, i64 %c.coerce)
|
||||
%2 = bitcast %"struct.std::complex"* %agg.result to i64*
|
||||
%3 = load i64, i64* %ref.tmp, align 8
|
||||
store i64 %3, i64* %2, align 4
|
||||
; CHECK-NOT: store i64
|
||||
|
||||
%_M_value.realp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %agg.result, i64 0, i32 0, i32 0
|
||||
%4 = lshr i64 %3, 32
|
||||
%5 = trunc i64 %4 to i32
|
||||
%6 = bitcast i32 %5 to float
|
||||
%_M_value.imagp.i.i = getelementptr inbounds %"struct.std::complex", %"struct.std::complex"* %agg.result, i64 0, i32 0, i32 1
|
||||
%7 = trunc i64 %3 to i32
|
||||
%8 = bitcast i32 %7 to float
|
||||
%mul_ad.i.i = fmul fast float %6, %1
|
||||
%mul_bc.i.i = fmul fast float %8, %0
|
||||
%mul_i.i.i = fadd fast float %mul_ad.i.i, %mul_bc.i.i
|
||||
%mul_ac.i.i = fmul fast float %6, %0
|
||||
%mul_bd.i.i = fmul fast float %8, %1
|
||||
%mul_r.i.i = fsub fast float %mul_ac.i.i, %mul_bd.i.i
|
||||
store float %mul_r.i.i, float* %_M_value.realp.i.i, align 4
|
||||
store float %mul_i.i.i, float* %_M_value.imagp.i.i, align 4
|
||||
ret void
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
declare void @_Z3barSt7complexIfE(%"struct.std::complex"* sret, i64)
|
||||
|
||||
define void @test1(i32 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test1
|
||||
|
||||
store i32 5, i32* %ptr
|
||||
%bptr = bitcast i32* %ptr to i8*
|
||||
store i8 7, i8* %bptr
|
||||
%wptr = bitcast i32* %ptr to i16*
|
||||
store i16 -30062, i16* %wptr
|
||||
%bptr2 = getelementptr inbounds i8, i8* %bptr, i64 2
|
||||
store i8 25, i8* %bptr2
|
||||
%bptr3 = getelementptr inbounds i8, i8* %bptr, i64 3
|
||||
store i8 47, i8* %bptr3
|
||||
%bptr1 = getelementptr inbounds i8, i8* %bptr, i64 1
|
||||
%wptrp = bitcast i8* %bptr1 to i16*
|
||||
store i16 2020, i16* %wptrp, align 1
|
||||
ret void
|
||||
|
||||
; CHECK-NOT: store i32 5, i32* %ptr
|
||||
; CHECK-NOT: store i8 7, i8* %bptr
|
||||
; CHECK: store i16 -30062, i16* %wptr
|
||||
; CHECK-NOT: store i8 25, i8* %bptr2
|
||||
; CHECK: store i8 47, i8* %bptr3
|
||||
; CHECK: store i16 2020, i16* %wptrp, align 1
|
||||
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
define void @test2(i32 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test2
|
||||
|
||||
store i32 5, i32* %ptr
|
||||
|
||||
%bptr = bitcast i32* %ptr to i8*
|
||||
%bptrm1 = getelementptr inbounds i8, i8* %bptr, i64 -1
|
||||
%bptr1 = getelementptr inbounds i8, i8* %bptr, i64 1
|
||||
%bptr2 = getelementptr inbounds i8, i8* %bptr, i64 2
|
||||
%bptr3 = getelementptr inbounds i8, i8* %bptr, i64 3
|
||||
|
||||
%wptr = bitcast i8* %bptr to i16*
|
||||
%wptrm1 = bitcast i8* %bptrm1 to i16*
|
||||
%wptr1 = bitcast i8* %bptr1 to i16*
|
||||
%wptr2 = bitcast i8* %bptr2 to i16*
|
||||
%wptr3 = bitcast i8* %bptr3 to i16*
|
||||
|
||||
store i16 1456, i16* %wptrm1, align 1
|
||||
store i16 1346, i16* %wptr, align 1
|
||||
store i16 1756, i16* %wptr1, align 1
|
||||
store i16 1126, i16* %wptr2, align 1
|
||||
store i16 5656, i16* %wptr3, align 1
|
||||
|
||||
; CHECK-NOT: store i32 5, i32* %ptr
|
||||
|
||||
; CHECK: store i16 1456, i16* %wptrm1, align 1
|
||||
; CHECK: store i16 1346, i16* %wptr, align 1
|
||||
; CHECK: store i16 1756, i16* %wptr1, align 1
|
||||
; CHECK: store i16 1126, i16* %wptr2, align 1
|
||||
; CHECK: store i16 5656, i16* %wptr3, align 1
|
||||
|
||||
ret void
|
||||
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
define signext i8 @test3(i32 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test3
|
||||
|
||||
store i32 5, i32* %ptr
|
||||
|
||||
%bptr = bitcast i32* %ptr to i8*
|
||||
%bptrm1 = getelementptr inbounds i8, i8* %bptr, i64 -1
|
||||
%bptr1 = getelementptr inbounds i8, i8* %bptr, i64 1
|
||||
%bptr2 = getelementptr inbounds i8, i8* %bptr, i64 2
|
||||
%bptr3 = getelementptr inbounds i8, i8* %bptr, i64 3
|
||||
|
||||
%wptr = bitcast i8* %bptr to i16*
|
||||
%wptrm1 = bitcast i8* %bptrm1 to i16*
|
||||
%wptr1 = bitcast i8* %bptr1 to i16*
|
||||
%wptr2 = bitcast i8* %bptr2 to i16*
|
||||
%wptr3 = bitcast i8* %bptr3 to i16*
|
||||
|
||||
%v = load i8, i8* %bptr, align 1
|
||||
store i16 1456, i16* %wptrm1, align 1
|
||||
store i16 1346, i16* %wptr, align 1
|
||||
store i16 1756, i16* %wptr1, align 1
|
||||
store i16 1126, i16* %wptr2, align 1
|
||||
store i16 5656, i16* %wptr3, align 1
|
||||
|
||||
; CHECK: store i32 5, i32* %ptr
|
||||
|
||||
ret i8 %v
|
||||
|
||||
; CHECK: ret i8 %v
|
||||
}
|
||||
|
||||
%struct.foostruct = type {
|
||||
i32 (i8*, i8**, i32, i8, i8*)*,
|
||||
i32 (i8*, i8**, i32, i8, i8*)*,
|
||||
i32 (i8*, i8**, i32, i8, i8*)*,
|
||||
i32 (i8*, i8**, i32, i8, i8*)*,
|
||||
void (i8*, i32, i32)*
|
||||
}
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1)
|
||||
declare void @goFunc(%struct.foostruct*)
|
||||
declare i32 @fa(i8*, i8**, i32, i8, i8*)
|
||||
|
||||
define void @test4() {
|
||||
entry:
|
||||
; CHECK-LABEL: @test4
|
||||
|
||||
%bang = alloca %struct.foostruct, align 8
|
||||
%v1 = bitcast %struct.foostruct* %bang to i8*
|
||||
call void @llvm.memset.p0i8.i64(i8* %v1, i8 0, i64 40, i32 8, i1 false)
|
||||
%v2 = getelementptr inbounds %struct.foostruct, %struct.foostruct* %bang, i64 0, i32 0
|
||||
store i32 (i8*, i8**, i32, i8, i8*)* @fa, i32 (i8*, i8**, i32, i8, i8*)** %v2, align 8
|
||||
%v3 = getelementptr inbounds %struct.foostruct, %struct.foostruct* %bang, i64 0, i32 1
|
||||
store i32 (i8*, i8**, i32, i8, i8*)* @fa, i32 (i8*, i8**, i32, i8, i8*)** %v3, align 8
|
||||
%v4 = getelementptr inbounds %struct.foostruct, %struct.foostruct* %bang, i64 0, i32 2
|
||||
store i32 (i8*, i8**, i32, i8, i8*)* @fa, i32 (i8*, i8**, i32, i8, i8*)** %v4, align 8
|
||||
%v5 = getelementptr inbounds %struct.foostruct, %struct.foostruct* %bang, i64 0, i32 3
|
||||
store i32 (i8*, i8**, i32, i8, i8*)* @fa, i32 (i8*, i8**, i32, i8, i8*)** %v5, align 8
|
||||
%v6 = getelementptr inbounds %struct.foostruct, %struct.foostruct* %bang, i64 0, i32 4
|
||||
store void (i8*, i32, i32)* null, void (i8*, i32, i32)** %v6, align 8
|
||||
call void @goFunc(%struct.foostruct* %bang)
|
||||
ret void
|
||||
|
||||
; CHECK-NOT: memset
|
||||
; CHECK: ret void
|
||||
}
|
||||
|
||||
define signext i8 @test5(i32 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test5
|
||||
|
||||
store i32 0, i32* %ptr
|
||||
|
||||
%bptr = bitcast i32* %ptr to i8*
|
||||
%bptr1 = getelementptr inbounds i8, i8* %bptr, i64 1
|
||||
%bptr2 = getelementptr inbounds i8, i8* %bptr, i64 2
|
||||
%bptr3 = getelementptr inbounds i8, i8* %bptr, i64 3
|
||||
|
||||
%wptr = bitcast i8* %bptr to i16*
|
||||
%wptr1 = bitcast i8* %bptr1 to i16*
|
||||
%wptr2 = bitcast i8* %bptr2 to i16*
|
||||
|
||||
store i16 65535, i16* %wptr2, align 1
|
||||
store i16 1456, i16* %wptr1, align 1
|
||||
store i16 1346, i16* %wptr, align 1
|
||||
|
||||
; CHECK-NOT: store i32 0, i32* %ptr
|
||||
|
||||
ret i8 0
|
||||
}
|
||||
|
||||
define signext i8 @test6(i32 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test6
|
||||
|
||||
store i32 0, i32* %ptr
|
||||
|
||||
%bptr = bitcast i32* %ptr to i16*
|
||||
%bptr1 = getelementptr inbounds i16, i16* %bptr, i64 0
|
||||
%bptr2 = getelementptr inbounds i16, i16* %bptr, i64 1
|
||||
|
||||
store i16 1456, i16* %bptr2, align 1
|
||||
store i16 65535, i16* %bptr1, align 1
|
||||
|
||||
; CHECK-NOT: store i32 0, i32* %ptr
|
||||
|
||||
ret i8 0
|
||||
}
|
||||
|
||||
define signext i8 @test7(i64 *%ptr) {
|
||||
entry:
|
||||
; CHECK-LABEL: @test7
|
||||
|
||||
store i64 0, i64* %ptr
|
||||
|
||||
%bptr = bitcast i64* %ptr to i16*
|
||||
%bptr1 = getelementptr inbounds i16, i16* %bptr, i64 0
|
||||
%bptr2 = getelementptr inbounds i16, i16* %bptr, i64 1
|
||||
%bptr3 = getelementptr inbounds i16, i16* %bptr, i64 2
|
||||
%bptr4 = getelementptr inbounds i16, i16* %bptr, i64 3
|
||||
|
||||
store i16 1346, i16* %bptr1, align 1
|
||||
store i16 1756, i16* %bptr3, align 1
|
||||
store i16 1456, i16* %bptr2, align 1
|
||||
store i16 5656, i16* %bptr4, align 1
|
||||
|
||||
; CHECK-NOT: store i64 0, i64* %ptr
|
||||
|
||||
ret i8 0
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
; 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, %t* %pp, i32 0, i32 0
|
||||
|
||||
store i32 1, i32* %p; <-- This is dead
|
||||
%x = load i32, 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, 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
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -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-darwin10.0"
|
||||
|
||||
@g80 = external global i8 ; <i8*> [#uses=3]
|
||||
|
||||
declare signext i8 @foo(i8 signext, i8 signext) nounwind readnone ssp
|
||||
|
||||
declare i32 @func68(i32) nounwind readonly ssp
|
||||
|
||||
; PR4815
|
||||
define void @test1(i32 %int32p54) noreturn nounwind ssp {
|
||||
entry:
|
||||
br label %bb
|
||||
|
||||
bb: ; preds = %bb, %entry
|
||||
%storemerge = phi i8 [ %2, %bb ], [ 1, %entry ] ; <i8> [#uses=1]
|
||||
store i8 %storemerge, i8* @g80
|
||||
%0 = tail call i32 @func68(i32 1) nounwind ssp ; <i32> [#uses=1]
|
||||
%1 = trunc i32 %0 to i8 ; <i8> [#uses=1]
|
||||
store i8 %1, i8* @g80, align 1
|
||||
store i8 undef, i8* @g80, align 1
|
||||
%2 = tail call signext i8 @foo(i8 signext undef, i8 signext 1) nounwind ; <i8> [#uses=1]
|
||||
br label %bb
|
||||
}
|
||||
|
||||
define fastcc i32 @test2() nounwind ssp {
|
||||
bb14: ; preds = %bb4
|
||||
%0 = bitcast i8* undef to i8** ; <i8**> [#uses=1]
|
||||
%1 = getelementptr inbounds i8*, i8** %0, i64 undef ; <i8**> [#uses=1]
|
||||
%2 = bitcast i8** %1 to i16* ; <i16*> [#uses=2]
|
||||
%3 = getelementptr inbounds i16, i16* %2, i64 undef ; <i16*> [#uses=1]
|
||||
%4 = bitcast i16* %3 to i8* ; <i8*> [#uses=1]
|
||||
%5 = getelementptr inbounds i8, i8* %4, i64 undef ; <i8*> [#uses=1]
|
||||
%6 = getelementptr inbounds i16, i16* %2, i64 undef ; <i16*> [#uses=1]
|
||||
store i16 undef, i16* %6, align 2
|
||||
%7 = getelementptr inbounds i8, i8* %5, i64 undef ; <i8*> [#uses=1]
|
||||
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %7, i8* undef, i64 undef, i32 1, i1 false)
|
||||
unreachable
|
||||
}
|
||||
|
||||
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
|
||||
|
||||
|
||||
; rdar://7635088
|
||||
define i32 @test3() {
|
||||
entry:
|
||||
ret i32 0
|
||||
|
||||
dead:
|
||||
%P2 = getelementptr i32, i32 *%P2, i32 52
|
||||
%Q2 = getelementptr i32, i32 *%Q2, i32 52
|
||||
store i32 4, i32* %P2
|
||||
store i32 4, i32* %Q2
|
||||
br label %dead
|
||||
}
|
||||
|
||||
|
||||
; PR3141
|
||||
%struct.ada__tags__dispatch_table = type { [1 x i32] }
|
||||
%struct.f393a00_1__object = type { %struct.ada__tags__dispatch_table*, i8 }
|
||||
%struct.f393a00_2__windmill = type { %struct.f393a00_1__object, i16 }
|
||||
|
||||
define void @test4(%struct.f393a00_2__windmill* %a, %struct.f393a00_2__windmill* %b) {
|
||||
entry:
|
||||
%t = alloca %struct.f393a00_2__windmill ; <%struct.f393a00_2__windmill*> [#uses=1]
|
||||
%0 = getelementptr %struct.f393a00_2__windmill, %struct.f393a00_2__windmill* %t, i32 0, i32 0, i32 0 ; <%struct.ada__tags__dispatch_table**> [#uses=1]
|
||||
%1 = load %struct.ada__tags__dispatch_table*, %struct.ada__tags__dispatch_table** null, align 4 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
%2 = load %struct.ada__tags__dispatch_table*, %struct.ada__tags__dispatch_table** %0, align 8 ; <%struct.ada__tags__dispatch_table*> [#uses=1]
|
||||
store %struct.ada__tags__dispatch_table* %2, %struct.ada__tags__dispatch_table** null, align 4
|
||||
store %struct.ada__tags__dispatch_table* %1, %struct.ada__tags__dispatch_table** null, align 4
|
||||
ret void
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
; RUN: opt -basicaa -dse -S < %s | FileCheck %s
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
%class.basic_string = type { %"class.__gnu_cxx::__versa_string" }
|
||||
%"class.__gnu_cxx::__versa_string" = type { %"class.__gnu_cxx::__sso_string_base" }
|
||||
%"class.__gnu_cxx::__sso_string_base" = type { %"struct.__gnu_cxx::__vstring_utility<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider", i64, %union.anon }
|
||||
%"struct.__gnu_cxx::__vstring_utility<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider" = type { i8* }
|
||||
%union.anon = type { i64, [8 x i8] }
|
||||
|
||||
; Function Attrs: nounwind
|
||||
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #0
|
||||
|
||||
; Function Attrs: noinline nounwind readonly uwtable
|
||||
declare zeroext i1 @callee_takes_string(%class.basic_string* nonnull) #1 align 2
|
||||
|
||||
; Function Attrs: nounwind uwtable
|
||||
define weak_odr zeroext i1 @test() #2 align 2 {
|
||||
|
||||
; CHECK-LABEL: @test
|
||||
|
||||
bb:
|
||||
%tmp = alloca %class.basic_string, align 8
|
||||
%tmp1 = alloca %class.basic_string, align 8
|
||||
%tmp3 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp, i64 0, i32 0, i32 0, i32 2
|
||||
%tmp4 = bitcast %union.anon* %tmp3 to i8*
|
||||
%tmp5 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp, i64 0, i32 0, i32 0, i32 0, i32 0
|
||||
%tmp6 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp, i64 0, i32 0, i32 0, i32 1
|
||||
%tmp7 = getelementptr inbounds i8, i8* %tmp4, i64 1
|
||||
%tmp8 = bitcast %class.basic_string* %tmp to i8*
|
||||
%tmp9 = bitcast i64 0 to i64
|
||||
%tmp10 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp1, i64 0, i32 0, i32 0, i32 2
|
||||
%tmp11 = bitcast %union.anon* %tmp10 to i8*
|
||||
%tmp12 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp1, i64 0, i32 0, i32 0, i32 0, i32 0
|
||||
%tmp13 = getelementptr inbounds %class.basic_string, %class.basic_string* %tmp1, i64 0, i32 0, i32 0, i32 1
|
||||
%tmp14 = getelementptr inbounds i8, i8* %tmp11, i64 1
|
||||
%tmp15 = bitcast %class.basic_string* %tmp1 to i8*
|
||||
br label %_ZN12basic_stringIcSt11char_traitsIcESaIcEEC2EPKcRKS2_.exit
|
||||
|
||||
_ZN12basic_stringIcSt11char_traitsIcESaIcEEC2EPKcRKS2_.exit: ; preds = %bb
|
||||
store i8* %tmp4, i8** %tmp5, align 8
|
||||
store i8 62, i8* %tmp4, align 8
|
||||
store i64 1, i64* %tmp6, align 8
|
||||
store i8 0, i8* %tmp7, align 1
|
||||
%tmp16 = call zeroext i1 @callee_takes_string(%class.basic_string* nonnull %tmp)
|
||||
br label %_ZN9__gnu_cxx17__sso_string_baseIcSt11char_traitsIcESaIcEED2Ev.exit3
|
||||
|
||||
_ZN9__gnu_cxx17__sso_string_baseIcSt11char_traitsIcESaIcEED2Ev.exit3: ; preds = %_ZN12basic_stringIcSt11char_traitsIcESaIcEEC2EPKcRKS2_.exit
|
||||
|
||||
; CHECK: _ZN9__gnu_cxx17__sso_string_baseIcSt11char_traitsIcESaIcEED2Ev.exit3:
|
||||
|
||||
; The following can be read through the call %tmp17:
|
||||
store i8* %tmp11, i8** %tmp12, align 8
|
||||
store i8 125, i8* %tmp11, align 8
|
||||
store i64 1, i64* %tmp13, align 8
|
||||
store i8 0, i8* %tmp14, align 1
|
||||
|
||||
; CHECK: store i8* %tmp11, i8** %tmp12, align 8
|
||||
; CHECK: store i8 125, i8* %tmp11, align 8
|
||||
; CHECK: store i64 1, i64* %tmp13, align 8
|
||||
; CHECK: store i8 0, i8* %tmp14, align 1
|
||||
|
||||
%tmp17 = call zeroext i1 @callee_takes_string(%class.basic_string* nonnull %tmp1)
|
||||
call void @llvm.memset.p0i8.i64(i8* %tmp11, i8 -51, i64 16, i32 8, i1 false) #0
|
||||
call void @llvm.memset.p0i8.i64(i8* %tmp15, i8 -51, i64 32, i32 8, i1 false) #0
|
||||
call void @llvm.memset.p0i8.i64(i8* %tmp4, i8 -51, i64 16, i32 8, i1 false) #0
|
||||
call void @llvm.memset.p0i8.i64(i8* %tmp8, i8 -51, i64 32, i32 8, i1 false) #0
|
||||
ret i1 %tmp17
|
||||
}
|
||||
|
||||
attributes #0 = { nounwind }
|
||||
attributes #1 = { noinline nounwind readonly uwtable }
|
||||
attributes #2 = { nounwind uwtable }
|
||||
|
@ -1,25 +0,0 @@
|
||||
; RUN: opt -dse -disable-output < %s
|
||||
; test that we don't crash
|
||||
declare void @bar()
|
||||
|
||||
define void @foo() {
|
||||
bb1:
|
||||
%memtmp3.i = alloca [21 x i8], align 1
|
||||
%0 = getelementptr inbounds [21 x i8], [21 x i8]* %memtmp3.i, i64 0, i64 0
|
||||
br label %bb3
|
||||
|
||||
bb2:
|
||||
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %0)
|
||||
br label %bb3
|
||||
|
||||
bb3:
|
||||
call void @bar()
|
||||
call void @llvm.lifetime.end.p0i8(i64 -1, i8* %0)
|
||||
br label %bb4
|
||||
|
||||
bb4:
|
||||
ret void
|
||||
|
||||
}
|
||||
|
||||
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) nounwind
|
@ -1,96 +0,0 @@
|
||||
; RUN: opt -S -basicaa -dse < %s | FileCheck %s
|
||||
|
||||
; We conservative choose to prevent dead store elimination
|
||||
; across release or stronger fences. It's not required
|
||||
; (since the must still be a race on %addd.i), but
|
||||
; it is conservatively correct. A legal optimization
|
||||
; could hoist the second store above the fence, and then
|
||||
; DSE one of them.
|
||||
define void @test1(i32* %addr.i) {
|
||||
; CHECK-LABEL: @test1
|
||||
; CHECK: store i32 5
|
||||
; CHECK: fence
|
||||
; CHECK: store i32 5
|
||||
; CHECK: ret
|
||||
store i32 5, i32* %addr.i, align 4
|
||||
fence release
|
||||
store i32 5, i32* %addr.i, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; Same as previous, but with different values. If we ever optimize
|
||||
; this more aggressively, this allows us to check that the correct
|
||||
; store is retained (the 'i32 1' store in this case)
|
||||
define void @test1b(i32* %addr.i) {
|
||||
; CHECK-LABEL: @test1b
|
||||
; CHECK: store i32 42
|
||||
; CHECK: fence release
|
||||
; CHECK: store i32 1
|
||||
; CHECK: ret
|
||||
store i32 42, i32* %addr.i, align 4
|
||||
fence release
|
||||
store i32 1, i32* %addr.i, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; We *could* DSE across this fence, but don't. No other thread can
|
||||
; observe the order of the acquire fence and the store.
|
||||
define void @test2(i32* %addr.i) {
|
||||
; CHECK-LABEL: @test2
|
||||
; CHECK: store
|
||||
; CHECK: fence
|
||||
; CHECK: store
|
||||
; CHECK: ret
|
||||
store i32 5, i32* %addr.i, align 4
|
||||
fence acquire
|
||||
store i32 5, i32* %addr.i, align 4
|
||||
ret void
|
||||
}
|
||||
|
||||
; We DSE stack alloc'ed and byval locations, in the presence of fences.
|
||||
; Fence does not make an otherwise thread local store visible.
|
||||
; Right now the DSE in presence of fence is only done in end blocks (with no successors),
|
||||
; but the same logic applies to other basic blocks as well.
|
||||
; The store to %addr.i can be removed since it is a byval attribute
|
||||
define void @test3(i32* byval %addr.i) {
|
||||
; CHECK-LABEL: @test3
|
||||
; CHECK-NOT: store
|
||||
; CHECK: fence
|
||||
; CHECK: ret
|
||||
store i32 5, i32* %addr.i, align 4
|
||||
fence release
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @foo(i8* nocapture %p)
|
||||
|
||||
declare noalias i8* @malloc(i32)
|
||||
|
||||
; DSE of stores in locations allocated through library calls.
|
||||
define void @test_nocapture() {
|
||||
; CHECK-LABEL: @test_nocapture
|
||||
; CHECK: malloc
|
||||
; CHECK: foo
|
||||
; CHECK-NOT: store
|
||||
; CHECK: fence
|
||||
%m = call i8* @malloc(i32 24)
|
||||
call void @foo(i8* %m)
|
||||
store i8 4, i8* %m
|
||||
fence release
|
||||
ret void
|
||||
}
|
||||
|
||||
|
||||
; This is a full fence, but it does not make a thread local store visible.
|
||||
; We can DSE the store in presence of the fence.
|
||||
define void @fence_seq_cst() {
|
||||
; CHECK-LABEL: @fence_seq_cst
|
||||
; CHECK-NEXT: fence seq_cst
|
||||
; CHECK-NEXT: ret void
|
||||
%P1 = alloca i32
|
||||
store i32 0, i32* %P1, align 4
|
||||
fence seq_cst
|
||||
store i32 4, i32* %P1, align 4
|
||||
ret void
|
||||
}
|
||||
|
@ -1,70 +0,0 @@
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
|
||||
target datalayout = "e-p:64:64:64"
|
||||
|
||||
declare void @free(i8* nocapture)
|
||||
declare noalias i8* @malloc(i64)
|
||||
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: @free
|
||||
; CHECK-NEXT: ret void
|
||||
define void @test(i32* %Q, i32* %P) {
|
||||
%DEAD = load i32, i32* %Q ; <i32> [#uses=1]
|
||||
store i32 %DEAD, i32* %P
|
||||
%1 = bitcast i32* %P to i8*
|
||||
tail call void @free(i8* %1) nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: bitcast
|
||||
; CHECK-NEXT: @free
|
||||
; CHECK-NEXT: ret void
|
||||
define void @test2({i32, i32}* %P) {
|
||||
%Q = getelementptr {i32, i32}, {i32, i32} *%P, i32 0, i32 1
|
||||
store i32 4, i32* %Q
|
||||
%1 = bitcast {i32, i32}* %P to i8*
|
||||
tail call void @free(i8* %1) nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @test3(
|
||||
; CHECK-NOT: store
|
||||
; CHECK: ret void
|
||||
define void @test3() {
|
||||
%m = call i8* @malloc(i64 24)
|
||||
store i8 0, i8* %m
|
||||
%m1 = getelementptr i8, i8* %m, i64 1
|
||||
store i8 1, i8* %m1
|
||||
call void @free(i8* %m) nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
; PR11240
|
||||
; CHECK-LABEL: @test4(
|
||||
; CHECK-NOT: store
|
||||
; CHECK: ret void
|
||||
define void @test4(i1 %x) nounwind {
|
||||
entry:
|
||||
%alloc1 = tail call noalias i8* @malloc(i64 4) nounwind
|
||||
br i1 %x, label %skipinit1, label %init1
|
||||
|
||||
init1:
|
||||
store i8 1, i8* %alloc1
|
||||
br label %skipinit1
|
||||
|
||||
skipinit1:
|
||||
tail call void @free(i8* %alloc1) nounwind
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @test5(
|
||||
define void @test5() {
|
||||
br label %bb
|
||||
|
||||
bb:
|
||||
tail call void @free(i8* undef) nounwind
|
||||
br label %bb
|
||||
}
|
||||
|
@ -1,261 +0,0 @@
|
||||
; RUN: opt -S -dse < %s | FileCheck %s
|
||||
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
||||
|
||||
; If there are two stores to the same location, DSE should be able to remove
|
||||
; the first store if the two stores are separated by no more than 98
|
||||
; instructions. The existence of debug intrinsics between the stores should
|
||||
; not affect this instruction limit.
|
||||
|
||||
@x = global i32 0, align 4
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @test_within_limit() !dbg !4 {
|
||||
entry:
|
||||
; The first store; later there is a second store to the same location,
|
||||
; so this store should be optimized away by DSE.
|
||||
; CHECK-NOT: store i32 1, i32* @x, align 4
|
||||
store i32 1, i32* @x, align 4
|
||||
|
||||
; Insert 98 dummy instructions between the two stores
|
||||
%0 = bitcast i32 0 to i32
|
||||
%1 = bitcast i32 0 to i32
|
||||
%2 = bitcast i32 0 to i32
|
||||
%3 = bitcast i32 0 to i32
|
||||
%4 = bitcast i32 0 to i32
|
||||
%5 = bitcast i32 0 to i32
|
||||
%6 = bitcast i32 0 to i32
|
||||
%7 = bitcast i32 0 to i32
|
||||
%8 = bitcast i32 0 to i32
|
||||
%9 = bitcast i32 0 to i32
|
||||
%10 = bitcast i32 0 to i32
|
||||
%11 = bitcast i32 0 to i32
|
||||
%12 = bitcast i32 0 to i32
|
||||
%13 = bitcast i32 0 to i32
|
||||
%14 = bitcast i32 0 to i32
|
||||
%15 = bitcast i32 0 to i32
|
||||
%16 = bitcast i32 0 to i32
|
||||
%17 = bitcast i32 0 to i32
|
||||
%18 = bitcast i32 0 to i32
|
||||
%19 = bitcast i32 0 to i32
|
||||
%20 = bitcast i32 0 to i32
|
||||
%21 = bitcast i32 0 to i32
|
||||
%22 = bitcast i32 0 to i32
|
||||
%23 = bitcast i32 0 to i32
|
||||
%24 = bitcast i32 0 to i32
|
||||
%25 = bitcast i32 0 to i32
|
||||
%26 = bitcast i32 0 to i32
|
||||
%27 = bitcast i32 0 to i32
|
||||
%28 = bitcast i32 0 to i32
|
||||
%29 = bitcast i32 0 to i32
|
||||
%30 = bitcast i32 0 to i32
|
||||
%31 = bitcast i32 0 to i32
|
||||
%32 = bitcast i32 0 to i32
|
||||
%33 = bitcast i32 0 to i32
|
||||
%34 = bitcast i32 0 to i32
|
||||
%35 = bitcast i32 0 to i32
|
||||
%36 = bitcast i32 0 to i32
|
||||
%37 = bitcast i32 0 to i32
|
||||
%38 = bitcast i32 0 to i32
|
||||
%39 = bitcast i32 0 to i32
|
||||
%40 = bitcast i32 0 to i32
|
||||
%41 = bitcast i32 0 to i32
|
||||
%42 = bitcast i32 0 to i32
|
||||
%43 = bitcast i32 0 to i32
|
||||
%44 = bitcast i32 0 to i32
|
||||
%45 = bitcast i32 0 to i32
|
||||
%46 = bitcast i32 0 to i32
|
||||
%47 = bitcast i32 0 to i32
|
||||
%48 = bitcast i32 0 to i32
|
||||
%49 = bitcast i32 0 to i32
|
||||
%50 = bitcast i32 0 to i32
|
||||
%51 = bitcast i32 0 to i32
|
||||
%52 = bitcast i32 0 to i32
|
||||
%53 = bitcast i32 0 to i32
|
||||
%54 = bitcast i32 0 to i32
|
||||
%55 = bitcast i32 0 to i32
|
||||
%56 = bitcast i32 0 to i32
|
||||
%57 = bitcast i32 0 to i32
|
||||
%58 = bitcast i32 0 to i32
|
||||
%59 = bitcast i32 0 to i32
|
||||
%60 = bitcast i32 0 to i32
|
||||
%61 = bitcast i32 0 to i32
|
||||
%62 = bitcast i32 0 to i32
|
||||
%63 = bitcast i32 0 to i32
|
||||
%64 = bitcast i32 0 to i32
|
||||
%65 = bitcast i32 0 to i32
|
||||
%66 = bitcast i32 0 to i32
|
||||
%67 = bitcast i32 0 to i32
|
||||
%68 = bitcast i32 0 to i32
|
||||
%69 = bitcast i32 0 to i32
|
||||
%70 = bitcast i32 0 to i32
|
||||
%71 = bitcast i32 0 to i32
|
||||
%72 = bitcast i32 0 to i32
|
||||
%73 = bitcast i32 0 to i32
|
||||
%74 = bitcast i32 0 to i32
|
||||
%75 = bitcast i32 0 to i32
|
||||
%76 = bitcast i32 0 to i32
|
||||
%77 = bitcast i32 0 to i32
|
||||
%78 = bitcast i32 0 to i32
|
||||
%79 = bitcast i32 0 to i32
|
||||
%80 = bitcast i32 0 to i32
|
||||
%81 = bitcast i32 0 to i32
|
||||
%82 = bitcast i32 0 to i32
|
||||
%83 = bitcast i32 0 to i32
|
||||
%84 = bitcast i32 0 to i32
|
||||
%85 = bitcast i32 0 to i32
|
||||
%86 = bitcast i32 0 to i32
|
||||
%87 = bitcast i32 0 to i32
|
||||
%88 = bitcast i32 0 to i32
|
||||
%89 = bitcast i32 0 to i32
|
||||
%90 = bitcast i32 0 to i32
|
||||
%91 = bitcast i32 0 to i32
|
||||
%92 = bitcast i32 0 to i32
|
||||
%93 = bitcast i32 0 to i32
|
||||
%94 = bitcast i32 0 to i32
|
||||
%95 = bitcast i32 0 to i32
|
||||
%96 = bitcast i32 0 to i32
|
||||
%97 = bitcast i32 0 to i32
|
||||
|
||||
; Insert a meaningless dbg.value intrinsic; it should have no
|
||||
; effect on the working of DSE in any way.
|
||||
call void @llvm.dbg.value(metadata i32 undef, metadata !10, metadata !DIExpression()), !dbg !DILocation(scope: !4)
|
||||
|
||||
; CHECK: store i32 -1, i32* @x, align 4
|
||||
store i32 -1, i32* @x, align 4
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind
|
||||
define i32 @test_outside_limit() {
|
||||
entry:
|
||||
; The first store; later there is a second store to the same location
|
||||
; CHECK: store i32 1, i32* @x, align 4
|
||||
store i32 1, i32* @x, align 4
|
||||
|
||||
; Insert 99 dummy instructions between the two stores; this is
|
||||
; one too many instruction for the DSE to take place.
|
||||
%0 = bitcast i32 0 to i32
|
||||
%1 = bitcast i32 0 to i32
|
||||
%2 = bitcast i32 0 to i32
|
||||
%3 = bitcast i32 0 to i32
|
||||
%4 = bitcast i32 0 to i32
|
||||
%5 = bitcast i32 0 to i32
|
||||
%6 = bitcast i32 0 to i32
|
||||
%7 = bitcast i32 0 to i32
|
||||
%8 = bitcast i32 0 to i32
|
||||
%9 = bitcast i32 0 to i32
|
||||
%10 = bitcast i32 0 to i32
|
||||
%11 = bitcast i32 0 to i32
|
||||
%12 = bitcast i32 0 to i32
|
||||
%13 = bitcast i32 0 to i32
|
||||
%14 = bitcast i32 0 to i32
|
||||
%15 = bitcast i32 0 to i32
|
||||
%16 = bitcast i32 0 to i32
|
||||
%17 = bitcast i32 0 to i32
|
||||
%18 = bitcast i32 0 to i32
|
||||
%19 = bitcast i32 0 to i32
|
||||
%20 = bitcast i32 0 to i32
|
||||
%21 = bitcast i32 0 to i32
|
||||
%22 = bitcast i32 0 to i32
|
||||
%23 = bitcast i32 0 to i32
|
||||
%24 = bitcast i32 0 to i32
|
||||
%25 = bitcast i32 0 to i32
|
||||
%26 = bitcast i32 0 to i32
|
||||
%27 = bitcast i32 0 to i32
|
||||
%28 = bitcast i32 0 to i32
|
||||
%29 = bitcast i32 0 to i32
|
||||
%30 = bitcast i32 0 to i32
|
||||
%31 = bitcast i32 0 to i32
|
||||
%32 = bitcast i32 0 to i32
|
||||
%33 = bitcast i32 0 to i32
|
||||
%34 = bitcast i32 0 to i32
|
||||
%35 = bitcast i32 0 to i32
|
||||
%36 = bitcast i32 0 to i32
|
||||
%37 = bitcast i32 0 to i32
|
||||
%38 = bitcast i32 0 to i32
|
||||
%39 = bitcast i32 0 to i32
|
||||
%40 = bitcast i32 0 to i32
|
||||
%41 = bitcast i32 0 to i32
|
||||
%42 = bitcast i32 0 to i32
|
||||
%43 = bitcast i32 0 to i32
|
||||
%44 = bitcast i32 0 to i32
|
||||
%45 = bitcast i32 0 to i32
|
||||
%46 = bitcast i32 0 to i32
|
||||
%47 = bitcast i32 0 to i32
|
||||
%48 = bitcast i32 0 to i32
|
||||
%49 = bitcast i32 0 to i32
|
||||
%50 = bitcast i32 0 to i32
|
||||
%51 = bitcast i32 0 to i32
|
||||
%52 = bitcast i32 0 to i32
|
||||
%53 = bitcast i32 0 to i32
|
||||
%54 = bitcast i32 0 to i32
|
||||
%55 = bitcast i32 0 to i32
|
||||
%56 = bitcast i32 0 to i32
|
||||
%57 = bitcast i32 0 to i32
|
||||
%58 = bitcast i32 0 to i32
|
||||
%59 = bitcast i32 0 to i32
|
||||
%60 = bitcast i32 0 to i32
|
||||
%61 = bitcast i32 0 to i32
|
||||
%62 = bitcast i32 0 to i32
|
||||
%63 = bitcast i32 0 to i32
|
||||
%64 = bitcast i32 0 to i32
|
||||
%65 = bitcast i32 0 to i32
|
||||
%66 = bitcast i32 0 to i32
|
||||
%67 = bitcast i32 0 to i32
|
||||
%68 = bitcast i32 0 to i32
|
||||
%69 = bitcast i32 0 to i32
|
||||
%70 = bitcast i32 0 to i32
|
||||
%71 = bitcast i32 0 to i32
|
||||
%72 = bitcast i32 0 to i32
|
||||
%73 = bitcast i32 0 to i32
|
||||
%74 = bitcast i32 0 to i32
|
||||
%75 = bitcast i32 0 to i32
|
||||
%76 = bitcast i32 0 to i32
|
||||
%77 = bitcast i32 0 to i32
|
||||
%78 = bitcast i32 0 to i32
|
||||
%79 = bitcast i32 0 to i32
|
||||
%80 = bitcast i32 0 to i32
|
||||
%81 = bitcast i32 0 to i32
|
||||
%82 = bitcast i32 0 to i32
|
||||
%83 = bitcast i32 0 to i32
|
||||
%84 = bitcast i32 0 to i32
|
||||
%85 = bitcast i32 0 to i32
|
||||
%86 = bitcast i32 0 to i32
|
||||
%87 = bitcast i32 0 to i32
|
||||
%88 = bitcast i32 0 to i32
|
||||
%89 = bitcast i32 0 to i32
|
||||
%90 = bitcast i32 0 to i32
|
||||
%91 = bitcast i32 0 to i32
|
||||
%92 = bitcast i32 0 to i32
|
||||
%93 = bitcast i32 0 to i32
|
||||
%94 = bitcast i32 0 to i32
|
||||
%95 = bitcast i32 0 to i32
|
||||
%96 = bitcast i32 0 to i32
|
||||
%97 = bitcast i32 0 to i32
|
||||
%98 = bitcast i32 0 to i32
|
||||
|
||||
; CHECK: store i32 -1, i32* @x, align 4
|
||||
store i32 -1, i32* @x, align 4
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
; Function Attrs: nounwind readnone
|
||||
declare void @llvm.dbg.value(metadata, metadata, metadata)
|
||||
|
||||
!llvm.dbg.cu = !{!0}
|
||||
!llvm.module.flags = !{!11, !13}
|
||||
|
||||
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
||||
!1 = !DIFile(filename: "test.c", directory: "/home/tmp")
|
||||
!2 = !{}
|
||||
!4 = distinct !DISubprogram(name: "test_within_limit", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 4, file: !1, scope: !5, type: !6, variables: !2)
|
||||
!5 = !DIFile(filename: "test.c", directory: "/home/tmp")
|
||||
!6 = !DISubroutineType(types: !7)
|
||||
!7 = !{!8}
|
||||
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
||||
!9 = !{!10}
|
||||
!10 = !DILocalVariable(name: "x", scope: !4, type: !8)
|
||||
!11 = !{i32 2, !"Dwarf Version", i32 4}
|
||||
!12 = !{i32* undef}
|
||||
|
||||
!13 = !{i32 1, !"Debug Info Version", i32 3}
|
@ -1,15 +0,0 @@
|
||||
; RUN: opt -S < %s -dse | FileCheck %s
|
||||
|
||||
declare void @llvm.sideeffect()
|
||||
|
||||
; Dead store elimination across a @llvm.sideeffect.
|
||||
|
||||
; CHECK-LABEL: dse
|
||||
; CHECK: store
|
||||
; CHECK-NOT: store
|
||||
define void @dse(float* %p) {
|
||||
store float 0.0, float* %p
|
||||
call void @llvm.sideeffect()
|
||||
store float 0.0, float* %p
|
||||
ret void
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
; Test to make sure llvm.invariant.start calls are not treated as clobbers.
|
||||
; RUN: opt < %s -basicaa -dse -S | FileCheck %s
|
||||
|
||||
declare {}* @llvm.invariant.start.p0i8(i64, i8* nocapture) nounwind readonly
|
||||
|
||||
; We cannot remove the store 1 to %p.
|
||||
; FIXME: By the semantics of invariant.start, the store 3 to p is unreachable.
|
||||
define void @test(i8 *%p) {
|
||||
store i8 1, i8* %p, align 4
|
||||
%i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %p)
|
||||
store i8 3, i8* %p, align 4
|
||||
ret void
|
||||
; CHECK-LABEL: @test(
|
||||
; CHECK-NEXT: store i8 1, i8* %p, align 4
|
||||
; CHECK-NEXT: %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %p)
|
||||
; CHECK-NEXT: store i8 3, i8* %p, align 4
|
||||
; CHECK-NEXT: ret void
|
||||
}
|
||||
|
||||
; FIXME: We should be able to remove the first store to p, even though p and q
|
||||
; may alias.
|
||||
define void @test2(i8* %p, i8* %q) {
|
||||
store i8 1, i8* %p, align 4
|
||||
store i8 2, i8* %q, align 4
|
||||
%i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %q)
|
||||
store i8 3, i8* %p, align 4
|
||||
ret void
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: store i8 1, i8* %p, align 4
|
||||
; CHECK-NEXT: store i8 2, i8* %q, align 4
|
||||
; CHECK-NEXT: %i = call {}* @llvm.invariant.start.p0i8(i64 1, i8* %q)
|
||||
; CHECK-NEXT: store i8 3, i8* %p, align 4
|
||||
; CHECK-NEXT: ret void
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
; RUN: opt -S -basicaa -dse < %s | FileCheck %s
|
||||
|
||||
declare i8* @strcpy(i8* %dest, i8* %src) nounwind
|
||||
define void @test1(i8* %src) {
|
||||
; CHECK-LABEL: @test1(
|
||||
%B = alloca [16 x i8]
|
||||
%dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
|
||||
; CHECK-NOT: @strcpy
|
||||
%call = call i8* @strcpy(i8* %dest, i8* %src)
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @strncpy(i8* %dest, i8* %src, i32 %n) nounwind
|
||||
define void @test2(i8* %src) {
|
||||
; CHECK-LABEL: @test2(
|
||||
%B = alloca [16 x i8]
|
||||
%dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
|
||||
; CHECK-NOT: @strncpy
|
||||
%call = call i8* @strncpy(i8* %dest, i8* %src, i32 12)
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @strcat(i8* %dest, i8* %src) nounwind
|
||||
define void @test3(i8* %src) {
|
||||
; CHECK-LABEL: @test3(
|
||||
%B = alloca [16 x i8]
|
||||
%dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
|
||||
; CHECK-NOT: @strcat
|
||||
%call = call i8* @strcat(i8* %dest, i8* %src)
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
||||
declare i8* @strncat(i8* %dest, i8* %src, i32 %n) nounwind
|
||||
define void @test4(i8* %src) {
|
||||
; CHECK-LABEL: @test4(
|
||||
%B = alloca [16 x i8]
|
||||
%dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
|
||||
; CHECK-NOT: @strncat
|
||||
%call = call i8* @strncat(i8* %dest, i8* %src, i32 12)
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
||||
define void @test5(i8* nocapture %src) {
|
||||
; CHECK-LABEL: @test5(
|
||||
%dest = alloca [100 x i8], align 16
|
||||
%arraydecay = getelementptr inbounds [100 x i8], [100 x i8]* %dest, i64 0, i64 0
|
||||
%call = call i8* @strcpy(i8* %arraydecay, i8* %src)
|
||||
; CHECK: %call = call i8* @strcpy
|
||||
%arrayidx = getelementptr inbounds i8, i8* %call, i64 10
|
||||
store i8 97, i8* %arrayidx, align 1
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @user(i8* %p)
|
||||
define void @test6(i8* %src) {
|
||||
; CHECK-LABEL: @test6(
|
||||
%B = alloca [16 x i8]
|
||||
%dest = getelementptr inbounds [16 x i8], [16 x i8]* %B, i64 0, i64 0
|
||||
; CHECK: @strcpy
|
||||
%call = call i8* @strcpy(i8* %dest, i8* %src)
|
||||
; CHECK: @user
|
||||
call void @user(i8* %dest)
|
||||
; CHECK: ret void
|
||||
ret void
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user