[LLVMbugs] [Bug 23583] New: instcombine miscompile after r237539
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 19 15:58:37 PDT 2015
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: unassignedbugs at nondot.org
Reporter: hans at chromium.org
CC: james.molloy at arm.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150519/c8e2200f/attachment.html>
More information about the llvm-bugs
mailing list