; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=x86_64-unknown-linux < %s | FileCheck %s ; ; combineSelect's "select(~Cond, X, Y) -> select(Cond, Y, X)" was incorrectly ; firing on scalar selects. The stores block folds of or/xor to expose the bug. define i32 @test(i32 %arg, i8 %arg1, ptr %arg2, ptr %arg3) nounwind { ; CHECK-LABEL: test: ; CHECK: # %bb.0: # %bb ; CHECK-NEXT: orb $-2, %sil ; CHECK-NEXT: movb %sil, (%rcx) ; CHECK-NEXT: notb %sil ; CHECK-NEXT: movb %sil, (%rdx) ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: testb %sil, %sil ; CHECK-NEXT: cmovnel %edi, %eax ; CHECK-NEXT: retq bb: %or = or i8 %arg1, -2 store i8 %or, ptr %arg3, align 1 %xor = xor i8 %or, -1 store i8 %xor, ptr %arg2, align 1 %icmp = icmp ne i8 %xor, 0 %select = select i1 %icmp, i32 %arg, i32 0 ret i32 %select }