[llvm-bugs] [Bug 35413] New: [X86] Failure to use condition code result from promoted bitop
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Nov 24 08:29:02 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35413
Bug ID: 35413
Summary: [X86] Failure to use condition code result from
promoted bitop
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: llvm-dev at redking.me.uk
CC: craig.topper at gmail.com, filcab at gmail.com,
llvm-bugs at lists.llvm.org, spatel+llvm at rotateright.com
After promoting a OR(i16,i16) to OR(i32,i32) (with signext args), we fail to
realise that we can use the EFLAGS result from the OR to test for zero instead
of creating a separate TESTW.
short bar16();
short foo16(short a, short b) {
if ((a | b) < 0)
return bar16();
return a | b;
}
int bar32();
int foo32(int a, int b) {
if ((a | b) < 0)
return bar32();
return a | b;
}
define signext i16 @foo16(i16 signext, i16 signext) {
%3 = or i16 %1, %0
%4 = icmp slt i16 %3, 0
br i1 %4, label %5, label %7
; <label>:5: ; preds = %2
%6 = tail call signext i16 @bar16()
br label %7
; <label>:7: ; preds = %2, %5
%8 = phi i16 [ %6, %5 ], [ %3, %2 ]
ret i16 %8
}
declare signext i16 @bar16()
define i32 @foo32(i32, i32) {
%3 = or i32 %1, %0
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
; <label>:5: ; preds = %2
%6 = tail call i32 @bar32()
br label %7
; <label>:7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ %3, %2 ]
ret i32 %8
}
declare i32 @bar32()
foo16:
orl %esi, %edi
testw %di, %di <<- UNNECESSARY??
je .LBB1_2
movl %edi, %eax
retq
.LBB1_2:
jmp bar16()@PLT # TAILCALL
foo32:
orl %esi, %edi
je .LBB2_2
movl %edi, %eax
retq
.LBB2_2:
jmp bar32()@PLT # TAILCALL
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171124/8a587058/attachment.html>
More information about the llvm-bugs
mailing list