[PATCH] D89386: [AMDGPU] Fix access beyond the end of the basic block in execMayBeModifiedBeforeAnyUse.
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 11:19:27 PDT 2020
foad added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:7108
- for (auto &UseInst : MRI.use_nodbg_instructions(VReg)) {
+ for (auto &Use : MRI.use_nodbg_operands(VReg)) {
+ auto &UseInst = *Use.getParent();
----------------
vpykhtin wrote:
> arsenm wrote:
> > Why change to the uses instead of instructions?
> This is the core problem. instructions aren't guaranteed to be unique on iteration depending on the order of uses in use-def list for a register. See the unittest below that shows how this can happen.
To put it another way: counting uses here allows you to exit early from the loop below when you have seen all the uses. Counting instructions here (with use_nodbg_instructions) does not work reliably because you might count some instructions twice depending on the order they appear in the use list.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89386/new/
https://reviews.llvm.org/D89386
More information about the llvm-commits
mailing list