36 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -passes=div-rem-pairs -S -mtriple=riscv64-unknown-unknown | FileCheck %s3 4; Do not hoist to the common predecessor block since we don't5; have a div-rem operation.6 7define i32 @no_domination(i1 %cmp, i32 %a, i32 %b) {8; CHECK-LABEL: @no_domination(9; CHECK-NEXT: entry:10; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]11; CHECK: if:12; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 [[A:%.*]], [[B:%.*]]13; CHECK-NEXT: br label [[END:%.*]]14; CHECK: else:15; CHECK-NEXT: [[REM:%.*]] = srem i32 [[A]], [[B]]16; CHECK-NEXT: br label [[END]]17; CHECK: end:18; CHECK-NEXT: [[RET:%.*]] = phi i32 [ [[DIV]], [[IF]] ], [ [[REM]], [[ELSE]] ]19; CHECK-NEXT: ret i32 [[RET]]20;21entry:22 br i1 %cmp, label %if, label %else23 24if:25 %div = sdiv i32 %a, %b26 br label %end27 28else:29 %rem = srem i32 %a, %b30 br label %end31 32end:33 %ret = phi i32 [ %div, %if ], [ %rem, %else ]34 ret i32 %ret35}36