diff --git a/llvm/test/Transforms/InstCombine/select-cmp.ll b/llvm/test/Transforms/InstCombine/select-cmp.ll new file mode 100644 index 00000000000000..dd39a78a9029cd --- /dev/null +++ b/llvm/test/Transforms/InstCombine/select-cmp.ll @@ -0,0 +1,13 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt < %s -passes=instcombine -S | FileCheck %s + +define i1 @f(i1 %cond, i32 %x, i32 %x2) { +; CHECK-LABEL: @f( +; CHECK-NEXT: [[Y:%.*]] = select i1 [[COND:%.*]], i32 poison, i32 [[X:%.*]] +; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[Y]], [[X2:%.*]] +; CHECK-NEXT: ret i1 [[C]] +; + %y = select i1 %cond, i32 poison, i32 %x + %c = icmp eq i32 %y, %x2 + ret i1 %c +}