[LLVMbugs] [Bug 12351] New: LTO removes necessary code in Me and My Shadow

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Mar 25 15:48:00 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12351

             Bug #: 12351
           Summary: LTO removes necessary code in Me and My Shadow
           Product: tools
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: lto
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kripkensteinr at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


At

http://syntensity.com/static/testcase.zip

is a bitcode file (attaching it here fails to submit the bug, not sure why)
generated from Me&My Shadow, a GPL game I am building with clang. The bitcode
file in the attachment works, however, running LTO on it removes necessary
code.

The attached testcase.sh will disassemble the bitcode file, run |opt
-disable-inlining -std-link-opts|, then disassemble the output of that. It can
then be seen that in @_ZN6Player10otherCheckEPS_ (search for otherCheck), right
after the printf in that function, it branches to if.end67. It stores a value
there (what happens is it found that two players collided, so it adjusts the y
value of the one on top so it stands on the other). However, in the LTO .ll
file (again, search for otherCheck, then printf), if.end67 goes right into the
inAir stuff, it is missing 3 lines from the non-LTO version. (As a consequence,
the y is not adjusted, and in the game the character falls through the other
instead of standing on their shoulders.)

%y44, which it stores to, is the y element in a rectangle struct in the player
struct. This is used all over the code, so writes to it can't be eliminated
wholesale.

The value being written is %add81 = %24 - %33 = shadow (other player)'s y -
player's height. The shadow's y changes a lot during the game, so it isn't a
constant that can be ignored. (I suspect the height is constant, but that isn't
crucial.)

So there seems to be no justification for removing that code, and it indeed
breaks the game.

-- 
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