Page MenuHomePhabricator

[UseListOrder] Fix use list order for function operands

Authored by nikic on Sep 4 2021, 3:01 PM.



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 (how I got here...) 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 comparison 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 resolve first 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.

Diff Detail

Event Timeline

nikic created this revision.Sep 4 2021, 3:01 PM
nikic requested review of this revision.Sep 4 2021, 3:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2021, 3:01 PM
dexonsmith accepted this revision.Sep 7 2021, 7:49 AM

LGTM, thanks for cleaning this up.

If there's an isolated test you can add to more consistently reproduce the problems addressed here that'd be great.

This revision is now accepted and ready to land.Sep 7 2021, 7:49 AM
This revision was automatically updated to reflect the committed changes.