[LLVMbugs] [Bug 11104] New: Inefficient Code Gen for Boolean Expression Evaluation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 10 09:32:31 PDT 2011


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

           Summary: Inefficient Code Gen for Boolean Expression Evaluation
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: justin.holewinski at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=7431)
 --> (http://llvm.org/bugs/attachment.cgi?id=7431)
Test Case Source

Clang is currently producing inefficient LLVM IR for expression evaluation
involving short-circuit evaluation. In the attached test case, both an integer
and a boolean expression is computed. However, short-circuit evaluation of the
boolean expression may render the integer computation useless. An additional
basic block is inserted in the LLVM IR to allow short-circuit evaluation, but
the possibly-unnecessary integer computation is not placed in this basic block.
Instead, the computation is *always* performed.

Please see the attached short-circuit.cpp test case, as well as the
short-circuit.clang.ll LLVM IR file which shows the inefficiency. Additionally,
the short-circuit.dragonegg.ll shows the LLVM IR output from DragonEgg, which
shows GCC moving the integer computation into a basic block which will only be
executed if the result of the integer expression is actually needed.

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