1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes='require<profile-summary>,function(codegenprepare)' < %s | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 define i1 @PR41004(i32 %x, i32 %y, i32 %t1) {
8 ; CHECK-LABEL: @PR41004(
10 ; CHECK-NEXT: [[MUL_FR:%.*]] = freeze i32 [[Y:%.*]]
11 ; CHECK-NEXT: [[T0:%.*]] = icmp eq i32 [[MUL_FR]], 1
12 ; CHECK-NEXT: br i1 [[T0]], label [[SELECT_TRUE_SINK:%.*]], label [[SELECT_END:%.*]]
13 ; CHECK: select.true.sink:
14 ; CHECK-NEXT: [[REM:%.*]] = srem i32 [[X:%.*]], 2
15 ; CHECK-NEXT: br label [[SELECT_END]]
17 ; CHECK-NEXT: [[MUL:%.*]] = phi i32 [ [[REM]], [[SELECT_TRUE_SINK]] ], [ 0, [[ENTRY:%.*]] ]
18 ; CHECK-NEXT: [[USUB:%.*]] = call { i32, i1 } @llvm.usub.with.overflow.i32(i32 [[T1:%.*]], i32 1)
19 ; CHECK-NEXT: [[NEG:%.*]] = extractvalue { i32, i1 } [[USUB]], 0
20 ; CHECK-NEXT: [[TOBOOL:%.*]] = extractvalue { i32, i1 } [[USUB]], 1
21 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[NEG]], [[MUL]]
22 ; CHECK-NEXT: ret i1 [[TOBOOL]]
26 %t0 = icmp eq i32 %y, 1
27 %mul = select i1 %t0, i32 %rem, i32 0
28 %neg = add i32 %t1, -1
29 %add = add i32 %neg, %mul
33 %tobool = icmp eq i32 %t1, 0