diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2021-09-04 22:38:46 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-09-07 20:59:12 +0200 |
commit | f5832eaaadc5382a4385e63d25f5ce08bc7a516c (patch) | |
tree | e08e458ff32d77a377de011a50eae55913e6585e /llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | |
parent | 7f54009a1fd8c7ea422bd58b45ba5cdc73a3a55e (diff) | |
download | llvm-f5832eaaadc5382a4385e63d25f5ce08bc7a516c.zip llvm-f5832eaaadc5382a4385e63d25f5ce08bc7a516c.tar.gz llvm-f5832eaaadc5382a4385e63d25f5ce08bc7a516c.tar.bz2 |
[UseListOrder] Fix use list order for function operands
Functions can have a personality function, as well as prefix and
prologue data as additional operands. Unused operands are assigned
a dummy value of i1* null. This patch addresses multiple issues in
use-list order preservation for these:
* Fix verify-uselistorder to also enumerate the dummy values.
This means that now use-list order values of these values are
shuffled even if there is no other mention of i1* null in the
module. This results in failures of Assembler/call-arg-is-callee.ll,
Assembler/opaque-ptr.ll and Bitcode/use-list-order2.ll.
* The use-list order prediction in ValueEnumerator does not take
into account the fact that a global may use a value more than
once and leaves uses in the same global effectively unordered.
We should be comparing the operand number here, as we do for
the more general case.
* While we enumerate all operands of a function together (which
seems sensible to me), the bitcode reader would first resolve
prefix data for all function, then prologue data for all
functions, then personality functions for all functions. Change
this to resolve all operands for a given function together
instead.
Differential Revision: https://reviews.llvm.org/D109282
Diffstat (limited to 'llvm/lib/Bitcode/Writer/ValueEnumerator.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Writer/ValueEnumerator.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp index d86db61..0c6e746 100644 --- a/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/llvm/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -229,8 +229,11 @@ static void predictValueUseListOrderImpl(const Value *V, const Function *F, // have been read (despite having earlier IDs). Rather than awkwardly // modeling this behaviour here, orderModule() has assigned IDs to // initializers of GlobalValues before GlobalValues themselves. - if (OM.isGlobalValue(LID) && OM.isGlobalValue(RID)) + if (OM.isGlobalValue(LID) && OM.isGlobalValue(RID)) { + if (LID == RID) + return LU->getOperandNo() > RU->getOperandNo(); return LID < RID; + } // If ID is 4, then expect: 7 6 5 1 2 3. if (LID < RID) { |