[PATCH] D53758: Handle value uses wrapped in metadata for the use-list order

David Stenberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 8 06:18:20 PST 2018


dstenb updated this revision to Diff 173153.
dstenb edited the summary of this revision.
dstenb added a comment.

In the previous revision I had overlooked two things in the writers:

1. The code did not look for uses in metadata operands in predictUseListOrder(). This resulted in the use-list order being emitted too early (which caused the crash in my previous revision), or not at all if there were no non-metadata uses of the constant.
2. For bitcode files, constants used in metadata are emitted as module-level constants. I have had to change the order in orderModule() to account for that.

I have updated the test case to reflect those changes.

Also, I had missed to look at metadata operands when changing use-lists in verify-uselistorder, meaning that we would not fuzz test the use-list order for constants where we only have uses in metadata operands.

Also, as a minor cleanup, I removed the comment shown below from AsmWriter's orderModule(). I don't think the comment is correct, as things are ordered differently in assembly and bitcode, and I suspect that it was simply copy-pasted from the BitcodeWriter's orderModule() implementation.

  // This needs to match the order used by ValueEnumerator::ValueEnumerator()
  // and ValueEnumerator::incorporateFunction().


https://reviews.llvm.org/D53758

Files:
  lib/Bitcode/Writer/ValueEnumerator.cpp
  lib/IR/AsmWriter.cpp
  test/Assembler/metadata-use-uselistorder.ll
  tools/verify-uselistorder/verify-uselistorder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53758.173153.patch
Type: text/x-patch
Size: 8756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181108/ae4b024b/attachment.bin>


More information about the llvm-commits mailing list