[PATCH] D92069: [NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike.
Nemanja Ivanovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 18 07:44:45 PST 2021
nemanjai added a comment.
I don't see an issue in providing two functions to achieve the two different goals:
lookThruCopyLike() // Look through a chain of copies.
lookThruSingleUseCopyChain() // Look through a chain of copies, checking that each def has a single use.
Also, I am a little curious about what this change is meant to accomplish. The name of the introduced `bool` parameter is `AllDefHaveOneUser` yet we don't actually check all defs - we only check the final one that we are returning. So it is presumably possible to have something like this (all regs virtual):
%1 = ...
%2 = SUBREG_TO_REG %1, ...
%3 = COPY %2
%4 = SUBREG_TO_REG %2
%5 = COPY %4
%6 = COPY %4
%7 = <some use of %4>
%8 = <some use of %5>
%9 = <some use of %6>
Running `lookThruCopyLike()` on `%9` will presumably correctly return `%1` and if a `bool` argument is passed, it will be set to `true`. I would argue that this is a surprising result since I would expect `AllDefHaveOneUser` to mean that all the definitions traversed (`%9, %6, %4, %2, %1`) have a single use. But this is clearly not the case. Am I just missing something?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92069/new/
https://reviews.llvm.org/D92069
More information about the llvm-commits
mailing list