[llvm] 625f08d - [SystemZ][z/OS] Set text flag correctly for llvm-reduce tool

Abhina Sreeskantharajan via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 10:39:38 PST 2022


Author: Abhina Sreeskantharajan
Date: 2022-11-18T13:39:34-05:00
New Revision: 625f08da730fc5e763a339f705e5bfefe71eb7e7

URL: https://github.com/llvm/llvm-project/commit/625f08da730fc5e763a339f705e5bfefe71eb7e7
DIFF: https://github.com/llvm/llvm-project/commit/625f08da730fc5e763a339f705e5bfefe71eb7e7.diff

LOG: [SystemZ][z/OS] Set text flag correctly for llvm-reduce tool

This patch sets the text flag correctly for llvm-reduce files

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D138304

Added: 
    

Modified: 
    llvm/tools/llvm-reduce/TestRunner.cpp
    llvm/tools/llvm-reduce/deltas/Delta.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-reduce/TestRunner.cpp b/llvm/tools/llvm-reduce/TestRunner.cpp
index bd637dbe3ce21..6ac882a377f02 100644
--- a/llvm/tools/llvm-reduce/TestRunner.cpp
+++ b/llvm/tools/llvm-reduce/TestRunner.cpp
@@ -97,7 +97,9 @@ void writeBitcode(ReducerWorkItem &M, raw_ostream &OutStream) {
 
 void TestRunner::writeOutput(StringRef Message) {
   std::error_code EC;
-  raw_fd_ostream Out(OutputFilename, EC);
+  raw_fd_ostream Out(OutputFilename, EC,
+                     EmitBitcode && !Program->isMIR() ? sys::fs::OF_None
+                                                      : sys::fs::OF_Text);
   if (EC) {
     errs() << "Error opening output file: " << EC.message() << "!\n";
     exit(1);

diff  --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index feefea15bf9e1..509ee62252a3e 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -74,7 +74,8 @@ bool isReduced(ReducerWorkItem &M, TestRunner &Test) {
   int FD;
   std::error_code EC = sys::fs::createTemporaryFile(
       "llvm-reduce", M.isMIR() ? "mir" : (UseBitcode ? "bc" : "ll"), FD,
-      CurrentFilepath);
+      CurrentFilepath,
+      UseBitcode && !M.isMIR() ? sys::fs::OF_None : sys::fs::OF_Text);
   if (EC) {
     errs() << "Error making unique filename: " << EC.message() << "!\n";
     exit(1);


        


More information about the llvm-commits mailing list