[llvm] r332642 - [Debugify] Print the output to stderr
Anastasis Grammenos via llvm-commits
llvm-commits at lists.llvm.org
Thu May 17 11:19:58 PDT 2018
Author: gramanas
Date: Thu May 17 11:19:58 2018
New Revision: 332642
URL: http://llvm.org/viewvc/llvm-project?rev=332642&view=rev
Log:
[Debugify] Print the output to stderr
Currently debugify prints it's output to stdout,
with this patch all the output generated goes to stderr.
This change lets us use debugify without taking away
the ability to pipe the output to other llvm tools.
Modified:
llvm/trunk/test/DebugInfo/debugify-each.ll
llvm/trunk/test/DebugInfo/debugify.ll
llvm/trunk/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
llvm/trunk/tools/opt/Debugify.cpp
Modified: llvm/trunk/test/DebugInfo/debugify-each.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/debugify-each.ll?rev=332642&r1=332641&r2=332642&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/debugify-each.ll (original)
+++ llvm/trunk/test/DebugInfo/debugify-each.ll Thu May 17 11:19:58 2018
@@ -1,15 +1,18 @@
-; RUN: opt -debugify-each -O3 -S -o /dev/null < %s > %t
+; RUN: opt -debugify-each -O3 -S -o /dev/null < %s 2> %t
; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
-; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s > %t
+; RUN: opt -enable-debugify -debugify-each -O3 -S -o /dev/null < %s 2> %t
; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
-; RUN: opt -debugify-each -instrprof -instrprof -sroa -sccp -S -o /dev/null < %s > %t
+; RUN: opt -debugify-each -instrprof -instrprof -sroa -sccp -S -o /dev/null < %s 2> %t
; RUN: FileCheck %s -input-file=%t -check-prefix=MODULE-PASS
; RUN: FileCheck %s -input-file=%t -check-prefix=FUNCTION-PASS
+; Verify that debugify each can be safely used with piping
+; RUN: opt -debugify-each -O1 < %s | opt -O2 -o /dev/null
+
define void @foo() {
ret void
}
Modified: llvm/trunk/test/DebugInfo/debugify.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/debugify.ll?rev=332642&r1=332641&r2=332642&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/debugify.ll (original)
+++ llvm/trunk/test/DebugInfo/debugify.ll Thu May 17 11:19:58 2018
@@ -13,13 +13,17 @@
; RUN: opt -enable-debugify -passes=verify -S -o - < %s | \
; RUN: FileCheck %s -implicit-check-not="CheckModuleDebugify: FAIL"
-; RUN: opt -debugify -strip -check-debugify -S -o - < %s | \
+; RUN: opt -debugify -strip -check-debugify -S -o - < %s 2>&1 | \
; RUN: FileCheck %s -check-prefix=CHECK-FAIL
-; RUN: opt -enable-debugify -strip -S -o - < %s | \
+; RUN: opt -enable-debugify -strip -S -o - < %s 2>&1 | \
; RUN: FileCheck %s -check-prefix=CHECK-FAIL
-; RUN: opt -enable-debugify -S -o - < %s | FileCheck %s -check-prefix=PASS
+; RUN: opt -enable-debugify -S -o - < %s 2>&1 | FileCheck %s -check-prefix=PASS
+
+; Verify that debugify can be safely used with piping
+; RUN: opt -enable-debugify -O1 < %s | opt -O2 -o /dev/null
+; RUN: opt -debugify -mem2reg -check-debugify < %s | opt -O2 -o /dev/null
; CHECK-LABEL: define void @foo
define void @foo() {
Modified: llvm/trunk/test/Transforms/Mem2Reg/PromoteMemToRegister.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Mem2Reg/PromoteMemToRegister.ll?rev=332642&r1=332641&r2=332642&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Mem2Reg/PromoteMemToRegister.ll (original)
+++ llvm/trunk/test/Transforms/Mem2Reg/PromoteMemToRegister.ll Thu May 17 11:19:58 2018
@@ -1,5 +1,5 @@
; Simple sanity check testcase. Both alloca's should be eliminated.
-; RUN: opt < %s -debugify -mem2reg -check-debugify -S | FileCheck %s
+; RUN: opt < %s -debugify -mem2reg -check-debugify -S 2>&1 | FileCheck %s
; CHECK-NOT: alloca
; CHECK: CheckModuleDebugify [{{.*}}]: PASS
Modified: llvm/trunk/tools/opt/Debugify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Debugify.cpp?rev=332642&r1=332641&r2=332642&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Debugify.cpp (original)
+++ llvm/trunk/tools/opt/Debugify.cpp Thu May 17 11:19:58 2018
@@ -163,10 +163,10 @@ bool checkDebugifyMetadata(Module &M,
continue;
}
- outs() << "ERROR: Instruction with empty DebugLoc in function ";
- outs() << F.getName() << " --";
- I.print(outs());
- outs() << "\n";
+ errs() << "ERROR: Instruction with empty DebugLoc in function ";
+ errs() << F.getName() << " --";
+ I.print(errs());
+ errs() << "\n";
HasErrors = true;
}
@@ -185,17 +185,17 @@ bool checkDebugifyMetadata(Module &M,
// Print the results.
for (unsigned Idx : MissingLines.set_bits())
- outs() << "WARNING: Missing line " << Idx + 1 << "\n";
+ errs() << "WARNING: Missing line " << Idx + 1 << "\n";
for (unsigned Idx : MissingVars.set_bits())
- outs() << "ERROR: Missing variable " << Idx + 1 << "\n";
+ errs() << "ERROR: Missing variable " << Idx + 1 << "\n";
HasErrors |= MissingVars.count() > 0;
- outs() << Banner << " [" << NameOfWrappedPass << "]: "
+ errs() << Banner << " [" << NameOfWrappedPass << "]: "
<< (HasErrors ? "FAIL" : "PASS") << '\n';
if (HasErrors) {
- outs() << "Module IR Dump\n";
- M.print(outs(), nullptr, false);
+ errs() << "Module IR Dump\n";
+ M.print(errs(), nullptr, false);
}
// Strip the Debugify Metadata if required.
More information about the llvm-commits
mailing list