1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -dse -S %s | FileCheck %s
4 declare i8* @_Znwm() local_unnamed_addr #0
6 ; Function Attrs: argmemonly nounwind willreturn writeonly
7 declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg) #1
9 define void @test1(i1 %c) {
10 ; CHECK-LABEL: @test1(
12 ; CHECK-NEXT: br i1 [[C:%.*]], label [[COND_TRUE_I_I_I:%.*]], label [[COND_END_I_I_I:%.*]]
13 ; CHECK: cond.true.i.i.i:
14 ; CHECK-NEXT: ret void
15 ; CHECK: cond.end.i.i.i:
16 ; CHECK-NEXT: [[CALL_I_I_I_I_I:%.*]] = tail call noalias nonnull i8* @_Znam()
17 ; CHECK-NEXT: [[TMP0:%.*]] = bitcast i8* [[CALL_I_I_I_I_I]] to i64*
18 ; CHECK-NEXT: tail call void @llvm.memset.p0i8.i64(i8* nonnull align 8 [[CALL_I_I_I_I_I]], i8 0, i64 undef, i1 false)
19 ; CHECK-NEXT: store i64 0, i64* [[TMP0]], align 8
20 ; CHECK-NEXT: ret void
23 br i1 %c, label %cond.true.i.i.i, label %cond.end.i.i.i
25 cond.true.i.i.i: ; preds = %entry
28 cond.end.i.i.i: ; preds = %entry
29 %call.i.i.i.i.i = tail call noalias nonnull i8* @_Znam() #2
30 %0 = bitcast i8* %call.i.i.i.i.i to i64*
31 tail call void @llvm.memset.p0i8.i64(i8* nonnull align 8 %call.i.i.i.i.i, i8 0, i64 undef, i1 false) #3
32 store i64 0, i64* %0, align 8
36 declare i8* @_Znam() local_unnamed_addr #0
39 define void @test2(i1 %c) {
40 ; CHECK-LABEL: @test2(
42 ; CHECK-NEXT: br i1 [[C:%.*]], label [[CLEANUP_CONT104:%.*]], label [[IF_THEN:%.*]]
44 ; CHECK-NEXT: [[MUL_I_I_I_I:%.*]] = shl nuw nsw i64 undef, 3
45 ; CHECK-NEXT: [[CALL_I_I_I_I_I_I131:%.*]] = call noalias nonnull i8* @_Znwm()
46 ; CHECK-NEXT: [[DOTCAST_I_I:%.*]] = bitcast i8* [[CALL_I_I_I_I_I_I131]] to i64*
47 ; CHECK-NEXT: store i64 0, i64* [[DOTCAST_I_I]], align 8
48 ; CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* nonnull align 8 [[CALL_I_I_I_I_I_I131]], i8 0, i64 [[MUL_I_I_I_I]], i1 false)
49 ; CHECK-NEXT: ret void
50 ; CHECK: cleanup.cont104:
51 ; CHECK-NEXT: ret void
54 br i1 %c, label %cleanup.cont104, label %if.then
56 if.then: ; preds = %entry
57 %mul.i.i.i.i = shl nuw nsw i64 undef, 3
58 %call.i.i.i.i.i.i131 = call noalias nonnull i8* @_Znwm() #2
59 %.cast.i.i = bitcast i8* %call.i.i.i.i.i.i131 to i64*
60 store i64 0, i64* %.cast.i.i, align 8
61 call void @llvm.memset.p0i8.i64(i8* nonnull align 8 %call.i.i.i.i.i.i131, i8 0, i64 %mul.i.i.i.i, i1 false) #3
64 cleanup.cont104: ; preds = %entry
68 attributes #0 = { "use-soft-float"="false" }
69 attributes #1 = { argmemonly nounwind willreturn writeonly }
70 attributes #2 = { builtin nounwind }
71 attributes #3 = { nounwind }