Skip to content

[Attributor] Do not derive norecurse without looking at all call sites #53884

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

Closed
jdoerfert opened this issue Feb 16, 2022 · 8 comments
Closed

Comments

@jdoerfert
Copy link
Member

Since we did not track the fact that we might have skipped call sites assumed dead in checkForAllCallSites we accidentally derive norecurse in certain situations.
An example (https://godbolt.org/z/oxvcjsaGf):

declare void @extern()

define i1 @test_rec_neg(i1 %c) norecurse {
    %rc1 = call i1 @rec(i1 true)
    br i1 %rc1, label %t, label %f
t:
    %rc2 = call i1 @rec(i1 %c)
    ret i1 %rc2
f:
    ret i1 %rc1
}

define internal i1 @rec(i1 %c1) {
    br i1 %c1, label %t, label %f
t:
    ret i1 true
f:
    %r = call i1 @rec(i1 true)
    call void @extern()
    ret i1 false
}
@jdoerfert jdoerfert added the ipo Interprocedural optimizations label Feb 16, 2022
@jdoerfert jdoerfert added this to the LLVM 14.0.0 Release milestone Feb 16, 2022
@jdoerfert jdoerfert self-assigned this Feb 16, 2022
@jdoerfert
Copy link
Member Author

/cherry-pick 6ed1ef0

@llvmbot
Copy link
Member

llvmbot commented Feb 16, 2022

Failed to cherry-pick: 6ed1ef0

https://github.com/llvm/llvm-project/actions/runs/1855580229

Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:

/branch <user>/<repo>/<branch>

@jdoerfert
Copy link
Member Author

/cherry-pick 6ed1ef0

@llvmbot
Copy link
Member

llvmbot commented Feb 16, 2022

Failed to cherry-pick: 6ed1ef0

https://github.com/llvm/llvm-project/actions/runs/1855716837

Please manually backport the fix and push it to your github fork. Once this is done, please add a comment like this:

/branch <user>/<repo>/<branch>

@jdoerfert
Copy link
Member Author

/branch jdoerfert/llvm-projects/issue53884

@llvmbot
Copy link
Member

llvmbot commented Feb 18, 2022

/pull-request llvmbot#80

@tstellar
Copy link
Collaborator

tstellar commented Mar 1, 2022

@jdoerfert Can you rebase the issue53884 branch? The patches no longer apply.

jdoerfert added a commit to jdoerfert/llvm-project that referenced this issue Mar 1, 2022
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.

This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.

Fixes llvm#53884
tstellar pushed a commit to llvmbot/llvm-project that referenced this issue Mar 1, 2022
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.

This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.

Fixes llvm#53884
@tstellar
Copy link
Collaborator

tstellar commented Mar 1, 2022

Merged: f58ab32

jdoerfert added a commit to jdoerfert/llvm-project that referenced this issue Mar 25, 2022
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.

This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.

Fixes llvm#53884
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
`UsedAssumedInformation` is a return argument utilized to determine what
information is known. Most APIs used it already but
`genericValueTraversal` did not. This adds it to `genericValueTraversal`
and replaces `AllCallSitesKnown` of `checkForAllCallSites` with the
commonly used `UsedAssumedInformation`.

This was supposed to be a NFC commit, then the test change appeared.
Turns out, we had one user of `AllCallSitesKnown` (AANoReturn) and the
way we set `AllCallSitesKnown` was wrong as we ignored the fact some
call sites were optimistically assumed dead. Included a dedicated test
for this as well now.

Fixes llvm/llvm-project#53884
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants