https://llvm.org/bugs/show_bug.cgi?id=23583
Bug ID: 23583
Summary: instcombine miscompile after r237539
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Consider this reduced test case from a 64-bit Chromium build on Linux:
int f() __attribute__((noinline));
int f() { volatile int x = -1; return x; }
void ParseUniformName(unsigned long *outSubscript) {
int index = f();
if (index >= 0) {
*outSubscript = index;
} else {
*outSubscript = 0xffffffffu;
}
}
#include <stdio.h>
int main() {
unsigned long index = 0xdeadbeef;
ParseUniformName(&index);
printf("index = 0x%zx\n", index);
return 0;
}
The expected output is 0xffffffff, but compiling with ToT Clang at -O3 yields
0xffffffffffffffff instead.
This seems to have regressed at r237539.
Asm before:
_Z16ParseUniformNamePm: # @_Z16ParseUniformNamePm
.cfi_startproc
# BB#0: # %entry
pushq %rbx
.Ltmp0:
.cfi_def_cfa_offset 16
.Ltmp1:
.cfi_offset %rbx, -16
movq %rdi, %rbx
callq _Z1fv
testl %eax, %eax
cltq
movl $4294967295, %ecx # imm = 0xFFFFFFFF
cmovnsq %rax, %rcx
movq %rcx, (%rbx)
popq %rbx
retq
Asm after:
_Z16ParseUniformNamePm: # @_Z16ParseUniformNamePm
.cfi_startproc
# BB#0: # %entry
pushq %rbx
.Ltmp0:
.cfi_def_cfa_offset 16
.Ltmp1:
.cfi_offset %rbx, -16
movq %rdi, %rbx
callq _Z1fv
cmpl $-2, %eax
movl $-1, %ecx
cmovgl %eax, %ecx
movslq %ecx, %rax
movq %rax, (%rbx)
popq %rbx
retq
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs