[LLVMbugs] [Bug 1938] New: SCCP mis-optimizes branches with undefined condition

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Jan 21 07:26:08 PST 2008


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

           Summary: SCCP mis-optimizes branches with undefined condition
           Product: libraries
           Version: 2.1
          Platform: PC
        OS/Version: Linux
            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=1345)
 --> (http://llvm.org/bugs/attachment.cgi?id=1345)
test case

The attached source is derived from this GCC test case:

http://gcc.gnu.org/ml/gcc-patches/2003-04/msg00321.html

If I run it through "opt -sccp", I get this:

bb:             ; preds = %bb.backedge, %entry
        %indvar = phi i32 [ 0, %entry ], [ %k, %bb.backedge ]           ; <i32>
        %k = add i32 %indvar, 1         ; <i32> [#uses=3]
        br i1 undef, label %cond_true, label %cond_false

...

cond_false:             ; preds = %bb
        br i1 undef, label %bb.backedge, label %bb12

At run time, if bb branches to cond_false, and cond_false branches to bb12,
then we'll reach bb12 with %k equal to 1, so the program will call abort().

Before SCCP ran there was no way to reach bb12 until %k was 10, so the program
would never abort. So SCCP has broken it.


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