[LLVMbugs] [Bug 5901] New: Optimization changes behavior
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Dec 28 22:01:44 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=5901
Summary: Optimization changes behavior
Product: new-bugs
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: viridia at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=3987)
--> (http://llvm.org/bugs/attachment.cgi?id=3987)
Unoptimized unit test
Not sure if this is LLVM's bug or mine, but I have a function which behaves
differently when optimization is enabled. (Specifically, an assertion failed).
I decided to add it as a bug report rather than posting to llvm-dev because
it's the easiest way to handle attachments.
I've included both the optimized and unoptimized module files as text. The
function that is failing is @UnionTypeTest.testRefOrValueTypeUnion.
A bit of explanation of what's going on: The code is a unit test for
discriminated unions. The union is represented as either { i1, i32 } or { i1,
tart.core.String* }, depending on whether the first field is true or false.
When allocating the union, it chooses the larger of the two types. Extracting
the value is done by bit-casting the pointer to the field containing the
payload.
In the optimized version, the alloca is converted into a first-class SSA value,
which is constructed using insertvalue. For example, instead of setting the
integer field to 1, it sets the pointer field to 0x100000000. (Since the
pointer is a 64-bit value.) (Although to be honest I am not certain that is the
right value for a little-endian machine.)
In the optimized version, it looks like the code is looking at the wrong struct
element when deciding what type is stored in the union.
--
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