https://bugs.llvm.org/show_bug.cgi?id=42876
Bug ID: 42876
Summary: bool != less efficient than bool ==
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: RISC-V
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
void a(_Bool a, _Bool b, void c()) { if (a==b) c(); }
void a2(_Bool a, _Bool b, void c()) { if (a!=b) c(); }
Build with clang -O2 --target=riscv32. Output:
a: # @a
# %bb.0: # %entry
addi sp, sp, -16
sw ra, 12(sp)
bne a0, a1, .LBB0_2
[...]
a2: # @a2
# %bb.0: # %entry
addi sp, sp, -16
sw ra, 12(sp)
xor a0, a0, a1
addi a1, zero, 1
bne a0, a1, .LBB1_2
Something similar happens on some other targets; on x86 and 32-bit ARM, there's
an extra "cmp".
It looks like something weird is happening in target-independent SelectionDAG;
I haven't tried to dig further.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs