; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define i32 @foo(i32 %x, i32 %y) {
; CHECK-LABEL: @foo(
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @llvm.umax.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
; CHECK-NEXT: [[TMP2:%.*]] = xor i32 [[TMP1]], -1
; CHECK-NEXT: ret i32 [[TMP2]]
;
%1 = xor i32 %x, -1
%2 = xor i32 %y, -1
%3 = icmp ugt i32 %1, %2
%4 = select i1 %3, i32 %2, i32 %1, !prof !1
ret i32 %4
}
!1 = !{!"branch_weights", i32 1, i32 6}