[LLVMbugs] [Bug 17452] New: SCEV createNodeForPHI is too optimistic about NSW.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 2 15:06:27 PDT 2013


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

            Bug ID: 17452
           Summary: SCEV createNodeForPHI is too optimistic about NSW.
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: atrick at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11329
  --> http://llvm.org/bugs/attachment.cgi?id=11329&action=edit
Unit test

SCEV::createNodeForPhi flags an AddRec expression as NSW if the value on the
backedge is flagged nsw. It disregards whether the value has the same form as
the expression, or is merely a subexression as in:

        %i.0 = phi i32 [ 0, %pre ], [ %tmp3, %loop ]
        %tmp2 = add i32 %i.0, 1
        %tmp3 = add nsw i32 %tmp2, 1
        %check = icmp slt i32 %i.0, %N

A unit test is attached. It could be appended to nsw.ll.

I believe it would be sufficient to test if one of the BEValue's operands is
the PHINode before propagating NSW without losing any important cases.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131002/2df5dad0/attachment.html>


More information about the llvm-bugs mailing list