diff --git a/llvm/test/Transforms/SimplifyCFG/speculate-store.ll b/llvm/test/Transforms/SimplifyCFG/speculate-store.ll index ee8aa127de7d..27c9ed5f2e77 100644 --- a/llvm/test/Transforms/SimplifyCFG/speculate-store.ll +++ b/llvm/test/Transforms/SimplifyCFG/speculate-store.ll @@ -1,11 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s define void @ifconvertstore(i32* %A, i32 %B, i32 %C, i32 %D) { ; CHECK-LABEL: @ifconvertstore( -; CHECK: store i32 %B, i32* %A -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 %D, 42 -; CHECK-NEXT: [[C_B:%.*]] = select i1 [[CMP]], i32 %C, i32 %B, !prof !0 -; CHECK-NEXT: store i32 [[C_B]], i32* %A +; CHECK-NEXT: entry: +; CHECK-NEXT: store i32 [[B:%.*]], i32* [[A:%.*]], align 4 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[D:%.*]], 42 +; CHECK-NEXT: [[SPEC_STORE_SELECT:%.*]] = select i1 [[CMP]], i32 [[C:%.*]], i32 [[B]], !prof [[PROF0:![0-9]+]] +; CHECK-NEXT: store i32 [[SPEC_STORE_SELECT]], i32* [[A]], align 4 ; CHECK-NEXT: ret void ; entry: @@ -28,7 +30,15 @@ ret.end: define void @noifconvertstore1(i32* %A1, i32* %A2, i32 %B, i32 %C, i32 %D) { ; CHECK-LABEL: @noifconvertstore1( -; CHECK-NOT: select +; CHECK-NEXT: entry: +; CHECK-NEXT: store i32 [[B:%.*]], i32* [[A1:%.*]], align 4 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[D:%.*]], 42 +; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RET_END:%.*]] +; CHECK: if.then: +; CHECK-NEXT: store i32 [[C:%.*]], i32* [[A2:%.*]], align 4 +; CHECK-NEXT: br label [[RET_END]] +; CHECK: ret.end: +; CHECK-NEXT: ret void ; entry: store i32 %B, i32* %A1 @@ -48,7 +58,16 @@ declare void @unknown_fun() define void @noifconvertstore2(i32* %A, i32 %B, i32 %C, i32 %D) { ; CHECK-LABEL: @noifconvertstore2( -; CHECK-NOT: select +; CHECK-NEXT: entry: +; CHECK-NEXT: store i32 [[B:%.*]], i32* [[A:%.*]], align 4 +; CHECK-NEXT: call void @unknown_fun() +; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[D:%.*]], 42 +; CHECK-NEXT: br i1 [[CMP6]], label [[IF_THEN:%.*]], label [[RET_END:%.*]] +; CHECK: if.then: +; CHECK-NEXT: store i32 [[C:%.*]], i32* [[A]], align 4 +; CHECK-NEXT: br label [[RET_END]] +; CHECK: ret.end: +; CHECK-NEXT: ret void ; entry: ; First store to the location. @@ -69,7 +88,15 @@ ret.end: define void @noifconvertstore_volatile(i32* %A, i32 %B, i32 %C, i32 %D) { ; CHECK-LABEL: @noifconvertstore_volatile( -; CHECK-NOT: select +; CHECK-NEXT: entry: +; CHECK-NEXT: store i32 [[B:%.*]], i32* [[A:%.*]], align 4 +; CHECK-NEXT: [[CMP6:%.*]] = icmp sgt i32 [[D:%.*]], 42 +; CHECK-NEXT: br i1 [[CMP6]], label [[IF_THEN:%.*]], label [[RET_END:%.*]] +; CHECK: if.then: +; CHECK-NEXT: store volatile i32 [[C:%.*]], i32* [[A]], align 4 +; CHECK-NEXT: br label [[RET_END]] +; CHECK: ret.end: +; CHECK-NEXT: ret void ; entry: ; First store to the location.