llvm-mirror/tools/opt
Vedant Kumar a9b43731f7 [Debugify] Move debug value intrinsics closer to their operand defs
Before this patch, debugify would insert debug value intrinsics before the
terminating instruction in a block. This had the advantage of being simple,
but was a bit too simple/unrealistic.

This patch teaches debugify to insert debug values immediately after their
operand defs. This enables better testing of the compiler.

For example, with this patch, `opt -debugify-each` is able to identify a
vectorizer DI-invariance bug fixed in llvm.org/PR32761. In this bug, the
vectorizer produced different output with/without debug info present.

Reverting Davide's bugfix locally, I see:

$ ~/scripts/opt-check-dbg-invar.sh ./bin/opt \
  .../SLPVectorizer/AArch64/spillcost-di.ll -slp-vectorizer
Comparing: -slp-vectorizer .../SLPVectorizer/AArch64/spillcost-di.ll
  Baseline: /var/folders/j8/t4w0bp8j6x1g6fpghkcb4sjm0000gp/T/tmp.iYYeL1kf
  With DI : /var/folders/j8/t4w0bp8j6x1g6fpghkcb4sjm0000gp/T/tmp.sQtQSeet
9,11c9,11
<   %5 = getelementptr inbounds %0, %0* %2, i64 %0, i32 1
<   %6 = bitcast i64* %4 to <2 x i64>*
<   %7 = load <2 x i64>, <2 x i64>* %6, align 8, !tbaa !0
---
>   %5 = load i64, i64* %4, align 8, !tbaa !0
>   %6 = getelementptr inbounds %0, %0* %2, i64 %0, i32 1
>   %7 = load i64, i64* %6, align 8, !tbaa !5
12a13
>   store i64 %5, i64* %8, align 8, !tbaa !0
14,15c15
<   %10 = bitcast i64* %8 to <2 x i64>*
<   store <2 x i64> %7, <2 x i64>* %10, align 8, !tbaa !0
---
>   store i64 %7, i64* %9, align 8, !tbaa !5
:: Found a test case ^

Running this over the *.ll files in tree, I found four additional examples
which compile differently with/without DI present. I plan on filing bugs for
these.

llvm-svn: 334118
2018-06-06 19:05:42 +00:00
..
AnalysisWrappers.cpp
BreakpointPrinter.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
BreakpointPrinter.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
CMakeLists.txt Another try to commit 323321 (aggressive instruction combine). 2018-01-25 12:06:32 +00:00
Debugify.cpp [Debugify] Move debug value intrinsics closer to their operand defs 2018-06-06 19:05:42 +00:00
GraphPrinters.cpp
LLVMBuild.txt
NewPMDriver.cpp IWYU for llvm-config.h in llvm, additions. 2018-04-30 14:59:11 +00:00
NewPMDriver.h Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
opt.cpp [opt] Introduce -strip-named-metadata 2018-06-05 00:56:08 +00:00
PassPrinters.cpp Remove \brief commands from doxygen comments. 2018-05-01 15:54:18 +00:00
PassPrinters.h [Debugfiy] Print the pass name next to the result 2018-05-15 23:38:05 +00:00
PrintSCC.cpp