1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=div-rem-pairs -S -mtriple=msp430-unknown-unknown | FileCheck %s
4 ; Do not hoist to the common predecessor block since we don't
5 ; have a div-rem operation.
7 define i32 @no_domination(i1 %cmp, i32 %a, i32 %b) {
8 ; CHECK-LABEL: @no_domination(
10 ; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
12 ; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 [[A:%.*]], [[B:%.*]]
13 ; CHECK-NEXT: br label [[END:%.*]]
15 ; CHECK-NEXT: [[REM:%.*]] = srem i32 [[A]], [[B]]
16 ; CHECK-NEXT: br label [[END]]
18 ; CHECK-NEXT: [[RET:%.*]] = phi i32 [ [[DIV]], [[IF]] ], [ [[REM]], [[ELSE]] ]
19 ; CHECK-NEXT: ret i32 [[RET]]
22 br i1 %cmp, label %if, label %else
25 %div = sdiv i32 %a, %b
29 %rem = srem i32 %a, %b
33 %ret = phi i32 [ %div, %if ], [ %rem, %else ]