[PATCH] D104805: IR: Fix use-list-order round-tripping for call and invoke
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 23 11:52:02 PDT 2021
dexonsmith added a comment.
In D104805#2836748 <https://reviews.llvm.org/D104805#2836748>, @dexonsmith wrote:
> In D104805#2836738 <https://reviews.llvm.org/D104805#2836738>, @nikic wrote:
>
>> Can you please point me to the code where the use-list order prediction is made?
>
> I'll need a minute to find it for BitcodeWriter.
Found it in ValueEnumerator.cpp:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp#L249
// LID and RID are equal, so we have different operands of the same user.
// Assume operands are added in order for all instructions.
if (LID <= ID)
if (!IsGlobalValue) // GlobalValue uses don't get reversed.
return LU->getOperandNo() < RU->getOperandNo();
return LU->getOperandNo() > RU->getOperandNo();
Note that we could update the code in ValueEnumerator and AsmWriter instead, but IMO it's simpler to just assign the operands in order of index in the first place.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D104805/new/
https://reviews.llvm.org/D104805
More information about the llvm-commits
mailing list