hanchenye-llvm-project/llvm/test/Transforms/GVN
Vedant Kumar 6d354ed72e [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
..
PRE [Debugify] Move debug value intrinsics closer to their operand defs 2018-06-06 19:05:42 +00:00
2007-07-25-DominatedLoop.ll
2007-07-25-InfiniteLoop.ll
2007-07-25-Loop.ll
2007-07-25-NestedLoop.ll
2007-07-25-SinglePredecessor.ll
2007-07-26-InterlockingLoops.ll
2007-07-26-NonRedundant.ll
2007-07-26-PhiErasure.ll
2007-07-30-PredIDom.ll
2007-07-31-NoDomInherit.ll
2007-07-31-RedundantPhi.ll
2008-02-12-UndefLoad.ll
2008-02-13-NewPHI.ll
2008-07-02-Unreachable.ll
2008-12-09-SelfRemove.ll
2008-12-12-RLE-Crash.ll
2008-12-14-rle-reanalyze.ll
2008-12-15-CacheVisited.ll
2009-01-21-SortInvalidation.ll
2009-01-22-SortInvalidation.ll
2009-03-10-PREOnVoid.ll
2009-07-13-MemDepSortFail.ll
2009-11-12-MemDepMallocBitCast.ll
2010-03-31-RedundantPHIs.ll
2010-05-08-OneBit.ll
2010-11-13-Simplify.ll
2011-04-27-phioperands.ll
2011-07-07-MatchIntrinsicExtract.ll
2011-09-07-TypeIdFor.ll
2012-05-22-PreCrash.ll
2016-08-30-MaskedScatterGather.ll Support arbitrary address space pointers in masked gather/scatter intrinsics. 2017-05-03 12:28:54 +00:00
MemdepMiscompile.ll
assume-equal.ll
basic-undef-test.ll
basic.ll
big-endian.ll
bitcast-of-call.ll
br-identical.ll
calloc-load-removal.ll
calls-nonlocal.ll
calls-readonly.ll
commute.ll
cond_br.ll
cond_br2.ll
condprop.ll
crash-no-aa.ll
crash.ll
dbg-redundant-load.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
debugloc.ll
edge.ll
fence.ll [Debugify] Move debug value intrinsics closer to their operand defs 2018-06-06 19:05:42 +00:00
flags.ll
fold-const-expr.ll
fpmath.ll
funclet.ll
int_sideeffect.ll Add an @llvm.sideeffect intrinsic 2017-11-08 21:59:51 +00:00
invariant.group.ll Dissallow non-empty metadata for invariant.group 2018-05-18 23:53:46 +00:00
invariant.start.ll
lifetime-simple.ll
load-constant-mem.ll
load-from-unreachable-predecessor.ll
malloc-load-removal.ll
no_speculative_loads_with_asan.ll Hardware-assisted AddressSanitizer (llvm part). 2017-12-09 00:21:41 +00:00
noalias.ll
non-integral-pointers.ll [GVN] Don't coerce non-integral pointers to integers or vice versa 2017-04-19 18:21:09 +00:00
non-local-offset.ll
nonescaping-malloc.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
null-aliases-nothing.ll
opt-remarks.ll [DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label. 2018-05-09 02:40:45 +00:00
phi-translate-partial-alias.ll
pr10820.ll
pr12979.ll
pr14166.ll
pr17732.ll Remove alignment argument from memcpy/memmove/memset in favour of alignment attributes (Step 1) 2018-01-19 17:13:12 +00:00
pr17852.ll
pr24397.ll
pr24426.ll
pr25440.ll
pr28562.ll
pr32314.ll [BasicAA] Add test case that goes with r305481. 2017-06-15 17:27:56 +00:00
pr34908.ll [GVN] Don't replace constants with constants. 2017-10-11 04:21:51 +00:00
pr36063.ll Mark MergedLoadStoreMotion as not preserving MemDep results 2018-02-23 10:41:57 +00:00
pre-compare.ll
pre-new-inst.ll
propagate-ir-flags.ll
range.ll
readattrs.ll
rle-must-alias.ll
rle-no-phi-translate.ll
rle-nonlocal.ll
stale-loop-info.ll
tbaa.ll [Analysis] Generate more precise TBAA tags when one access encloses the other 2017-12-18 20:05:20 +00:00
unreachable_block_infinite_loop.ll
volatile-nonvolatile.ll