[Debugify] Don't apply DI before the bitcode writer pass
Applying synthetic debug info before the bitcode writer pass has no
testing-related purpose. This commit prevents that from happening.
It also adds tests which check that IR produced with/without
-debugify-each enabled is identical after stripping. This makes it
possible to check that individual passes (or full pipelines) are
invariant to debug info.
llvm-svn: 333861
diff --git a/llvm/test/DebugInfo/debugify-each.ll b/llvm/test/DebugInfo/debugify-each.ll
index b3e08ff..b395b26 100644
--- a/llvm/test/DebugInfo/debugify-each.ll
+++ b/llvm/test/DebugInfo/debugify-each.ll
@@ -13,7 +13,25 @@
; Verify that debugify each can be safely used with piping
; RUN: opt -debugify-each -O1 < %s | opt -O2 -o /dev/null
-define void @foo() {
+; Check that stripped textual IR compares equal before and after applying
+; debugify.
+; RUN: opt -O1 < %s -S -o - | \
+; RUN: opt -strip -strip-dead-prototypes -strip-module-flags -S -o %t.before
+; RUN: opt -O1 -debugify-each < %s -S -o - | \
+; RUN: opt -strip -strip-dead-prototypes -strip-module-flags -S -o %t.after
+; RUN: diff %t.before %t.after
+
+; Check that stripped IR compares equal before and after applying debugify.
+; RUN: opt -O1 < %s | \
+; RUN: opt -strip -strip-dead-prototypes -strip-module-flags | \
+; RUN: llvm-dis -o %t.before
+; RUN: opt -O1 -debugify-each < %s | \
+; RUN: opt -strip -strip-dead-prototypes -strip-module-flags | \
+; RUN: llvm-dis -o %t.after
+; RUN: diff %t.before %t.after
+
+define void @foo(i32 %arg) {
+ call i32 asm "bswap $0", "=r,r"(i32 %arg)
ret void
}