[PATCH] D118585: [llvm-reduce] Specify ShouldPreserveUseListOrder for internal .ll dumps

Markus Lavin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 02:03:02 PST 2022


markus created this revision.
markus added a reviewer: aeubanks.
markus requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I recently ran into a case where I was trying to reduce a `.bc` file and the interestingness test I had written reported that the input was interesting when run in isolation but when running `llvm-reduce` it failed the initial sanity check before reduction starts. Turns out that internally `llvm-reduce` only deals with `.ll` files and does not set the `ShouldPreserveUseListOrder` option when producing these. For this rare case setting the option made the difference between being able to reduce or not.

I suggest that we either always set that option or alternatively add a command line option to have it set.


https://reviews.llvm.org/D118585

Files:
  llvm/tools/llvm-reduce/ReducerWorkItem.cpp


Index: llvm/tools/llvm-reduce/ReducerWorkItem.cpp
===================================================================
--- llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -169,6 +169,7 @@
     printMIR(ROS, *M);
     printMIR(ROS, *MF);
   } else {
-    M->print(ROS, nullptr);
+    M->print(ROS, /*AssemblyAnnotationWriter=*/nullptr,
+             /*ShouldPreserveUseListOrder=*/true);
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118585.404443.patch
Type: text/x-patch
Size: 439 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220131/c59eabaa/attachment.bin>


More information about the llvm-commits mailing list