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

[Attributor] Loads in readonly functions are replaced with wrong value #53726

Closed
jdoerfert opened this issue Feb 10, 2022 · 6 comments
Closed

Comments

@jdoerfert
Copy link
Member

Readonly function calls are assumed dead if the return value is assumed dead. This is OK but we cannot ignore them when we determine reachability as part of the identification of memory content, e.g., what value is loaded from some ptr. If we ignore the call, the load is not reachable from a store prior to the call, which then leads us to believe the load will result in a different value, often undef.

@jdoerfert jdoerfert added the ipo Interprocedural optimizations label Feb 10, 2022
@jdoerfert jdoerfert added this to the LLVM 14.0.0 Release milestone Feb 10, 2022
@jdoerfert jdoerfert self-assigned this Feb 10, 2022
@tstellar
Copy link
Collaborator

/cherry-pick d1387a2

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 11, 2022

/branch llvmbot/llvm-project/issue53726

llvmbot pushed a commit to llvmbot/llvm-project that referenced this issue Feb 11, 2022
The oversight caused us to ignore call sites that are effectively dead
when we computed reachability (or more precise the call edges of a
function). The problem is that loads in the readonly callee might depend
on stores prior to the callee. If we do not track the call edge we
mistakenly assumed the store before the call cannot reach the load.
The problem is nicely visible in:
  `llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll`

Caused by D118673.

Fixes llvm#53726

(cherry picked from commit d1387a2)
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 11, 2022

/pull-request llvmbot#41

jdoerfert added a commit to jdoerfert/llvm-project that referenced this issue Feb 17, 2022
The oversight caused us to ignore call sites that are effectively dead
when we computed reachability (or more precise the call edges of a
function). The problem is that loads in the readonly callee might depend
on stores prior to the callee. If we do not track the call edge we
mistakenly assumed the store before the call cannot reach the load.
The problem is nicely visible in:
  `llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll`

Caused by D118673.

Fixes llvm#53726
@jdoerfert
Copy link
Member Author

/branch jdoerfert/llvm-project/issue53726

@llvmbot
Copy link
Collaborator

llvmbot commented Feb 17, 2022

/pull-request llvmbot#73

tstellar pushed a commit to llvmbot/llvm-project that referenced this issue Feb 21, 2022
The oversight caused us to ignore call sites that are effectively dead
when we computed reachability (or more precise the call edges of a
function). The problem is that loads in the readonly callee might depend
on stores prior to the callee. If we do not track the call edge we
mistakenly assumed the store before the call cannot reach the load.
The problem is nicely visible in:
  `llvm/test/Transforms/Attributor/ArgumentPromotion/basictest.ll`

Caused by D118673.

Fixes llvm#53726
@tstellar
Copy link
Collaborator

Merged: 13fdc7a

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