xref: /aosp_15_r20/external/llvm/test/Transforms/LICM/pr26843.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -basicaa -licm < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4*9880d681SAndroid Build Coastguard Workertarget triple = "i686-pc-windows-msvc18.0.0"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker@v = common global i32 zeroinitializer, align 4
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Make sure the store to v is not sunk past the memset
9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @main
10*9880d681SAndroid Build Coastguard Worker; CHECK: for.body:
11*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: store i32 1, i32* @v
12*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: tail call void @llvm.memset
13*9880d681SAndroid Build Coastguard Worker; CHECK: end:
14*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 0
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Workerdefine i32 @main(i1 %k) {
17*9880d681SAndroid Build Coastguard Workerentry:
18*9880d681SAndroid Build Coastguard Worker  br label %for.body
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerfor.body:
21*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* @v, align 4
22*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.memset.p0i8.i32(i8* bitcast (i32* @v to i8*), i8 0, i32 4, i32 4, i1 false)
23*9880d681SAndroid Build Coastguard Worker  br label %for.latch
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerfor.latch:
26*9880d681SAndroid Build Coastguard Worker  br i1 %k, label %for.body, label %end
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerend:
29*9880d681SAndroid Build Coastguard Worker  ret i32 0
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.memset.p0i8.i32(i8* nocapture, i8, i32, i32, i1)
33