68 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=dse -S %s | FileCheck %s3 4declare ptr @_Znwm() local_unnamed_addr #05 6; Function Attrs: argmemonly nounwind willreturn writeonly7declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #18 9define ptr @test1(i1 %c, i64 %N) {10; CHECK-LABEL: @test1(11; CHECK-NEXT: entry: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 ptr null15; CHECK: cond.end.i.i.i:16; CHECK-NEXT: [[ALLOC:%.*]] = tail call noalias nonnull ptr @_Znam() #[[ATTR2:[0-9]+]]17; CHECK-NEXT: tail call void @llvm.memset.p0.i64(ptr nonnull align 8 [[ALLOC]], i8 0, i64 [[N:%.*]], i1 false) #[[ATTR3:[0-9]+]]18; CHECK-NEXT: store i64 0, ptr [[ALLOC]], align 819; CHECK-NEXT: ret ptr [[ALLOC]]20;21entry:22 br i1 %c, label %cond.true.i.i.i, label %cond.end.i.i.i23 24cond.true.i.i.i: ; preds = %entry25 ret ptr null26 27cond.end.i.i.i: ; preds = %entry28 %alloc = tail call noalias nonnull ptr @_Znam() #229 tail call void @llvm.memset.p0.i64(ptr nonnull align 8 %alloc, i8 0, i64 %N, i1 false) #330 store i64 0, ptr %alloc, align 831 ret ptr %alloc32}33 34declare ptr @_Znam()35 36 37define ptr @test2(i1 %c, i64 %N) {38; CHECK-LABEL: @test2(39; CHECK-NEXT: entry:40; CHECK-NEXT: br i1 [[C:%.*]], label [[CLEANUP_CONT104:%.*]], label [[IF_THEN:%.*]]41; CHECK: if.then:42; CHECK-NEXT: [[MUL:%.*]] = shl nuw nsw i64 [[N:%.*]], 343; CHECK-NEXT: [[ALLOC:%.*]] = call noalias nonnull ptr @_Znwm() #[[ATTR2]]44; CHECK-NEXT: store i64 0, ptr [[ALLOC]], align 845; CHECK-NEXT: call void @llvm.memset.p0.i64(ptr nonnull align 8 [[ALLOC]], i8 0, i64 [[MUL]], i1 false) #[[ATTR3]]46; CHECK-NEXT: ret ptr [[ALLOC]]47; CHECK: cleanup.cont104:48; CHECK-NEXT: ret ptr null49;50entry:51 br i1 %c, label %cleanup.cont104, label %if.then52 53if.then: ; preds = %entry54 %mul = shl nuw nsw i64 %N, 355 %alloc = call noalias nonnull ptr @_Znwm() #256 store i64 0, ptr %alloc, align 857 call void @llvm.memset.p0.i64(ptr nonnull align 8 %alloc, i8 0, i64 %mul, i1 false) #358 ret ptr %alloc59 60cleanup.cont104: ; preds = %entry61 ret ptr null62}63 64attributes #0 = { "use-soft-float"="false" }65attributes #1 = { argmemonly nounwind willreturn writeonly }66attributes #2 = { builtin nounwind }67attributes #3 = { nounwind }68