[LLVMbugs] [Bug 1657] New: licm promotes store to null pointer
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Fri Sep 14 07:41:50 PDT 2007
http://llvm.org/bugs/show_bug.cgi?id=1657
Summary: licm promotes store to null pointer
Product: libraries
Version: 2.0
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: jay.foad at antixlabs.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=1120)
--> (http://llvm.org/bugs/attachment.cgi?id=1120)
bitcode for test case
I'm using LLVM 2.0 on cygwin.
The attached bitcode file pre.o contains a store to a null pointer:
%tmp1.i = getelementptr %struct.decision* null, i32 0, i32 0 ; <i8*>
[#uses=1]
store i8 0, i8* %tmp1.i
but in practice this is never executed, because it's preceded by a conditional
branch (where the condition is always true) which branches over it.
If I run this through "opt -f -o post.o pre.o -licm -debug", the resulting
bitcode file contains a load from a null pointer and a store to a null pointer,
both of which are unconditionally executed:
entry:
...
%tmp1.i = getelementptr %struct.decision* null, i32 0, i32 0 ; <i8*>
[#uses=2]
%tmp1.i.promoted = load i8* %tmp1.i ; <i8> [#uses=1]
...
clear_modes.exit: ; preds = %blah.i
store i8 %tmp1.i.tmp.0, i8* %tmp1.i
call void @exit( i32 0 )
unreachable
This has broken my program: it's now going to trap, when it wouldn't have
before I ran the LICM pass on it.
Here's the debug output from LICM:
LICM hoisting to entry: %tmp3.i = icmp eq %struct.decision* null, null;
<i1> [#uses=1]
LICM hoisting to entry: %tmp1.i = getelementptr %struct.decision* null,
i32 0, i32 0 ; <i8*> [#uses=1]
LICM: Promoting value: %tmp1.i = getelementptr %struct.decision* null, i32 0,
i32 0 ; <i8*> [#uses=1]
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list