1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -mtriple=x86_64-unknown-unknown < %s -simplifycfg-merge-cond-stores=true -simplifycfg-merge-cond-stores-aggressively=false -phi-node-folding-threshold=2 -S | FileCheck %s
4 define void @test_costly(i32* %p, i32 %a, i32 %b, i32 %c, i32 %d) {
5 ; CHECK-LABEL: @test_costly(
7 ; CHECK-NEXT: [[X1:%.*]] = icmp eq i32 [[A:%.*]], 0
8 ; CHECK-NEXT: br i1 [[X1]], label [[FALLTHROUGH:%.*]], label [[YES1:%.*]]
10 ; CHECK-NEXT: [[VAL0:%.*]] = sdiv i32 [[D:%.*]], [[C:%.*]]
11 ; CHECK-NEXT: store i32 [[VAL0]], i32* [[P:%.*]], align 4
12 ; CHECK-NEXT: br label [[FALLTHROUGH]]
14 ; CHECK-NEXT: [[X2:%.*]] = icmp eq i32 [[B:%.*]], 0
15 ; CHECK-NEXT: br i1 [[X2]], label [[END:%.*]], label [[YES2:%.*]]
17 ; CHECK-NEXT: [[VAL1:%.*]] = sdiv i32 [[C]], [[D]]
18 ; CHECK-NEXT: store i32 [[VAL1]], i32* [[P]], align 4
19 ; CHECK-NEXT: br label [[END]]
21 ; CHECK-NEXT: ret void
24 %x1 = icmp eq i32 %a, 0
25 br i1 %x1, label %fallthrough, label %yes1
28 %val0 = sdiv i32 %d, %c
29 store i32 %val0, i32* %p
33 %x2 = icmp eq i32 %b, 0
34 br i1 %x2, label %end, label %yes2
37 %val1 = sdiv i32 %c, %d
38 store i32 %val1, i32* %p