Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCEV createNodeForPHI is too optimistic about NSW. #17826

Open
atrick opened this issue Oct 3, 2013 · 0 comments
Open

SCEV createNodeForPHI is too optimistic about NSW. #17826

atrick opened this issue Oct 3, 2013 · 0 comments
Labels
bugzilla

Comments

@atrick
Copy link
Contributor

atrick commented Oct 3, 2013

Bugzilla Link 17452
Version trunk
OS All
Attachments Unit test

Extended Description

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.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla
Projects
None yet
Development

No branches or pull requests

1 participant