llvm-project/llvm/test/Transforms/LCSSA
David Stenberg c9163855dd [DebugInfo][LCSSA] Rewrite pre-existing debug values outside loop
Summary:
Extend LCSSA so that debug values outside loops are rewritten to
use the PHI nodes that the pass creates.

This fixes PR39019. In that case, we ran LCSSA on a loop that
was later on vectorized, which left us with something like this:

  for.cond.cleanup:
    %add.lcssa = phi i32 [ %add, %for.body ], [ %34, %middle.block ]
    call void @llvm.dbg.value(metadata i32 %add,
    ret i32 %add.lcssa

  for.body:
    %add =
    [...]
    br i1 %exitcond, label %for.cond.cleanup, label %for.body

which later resulted in the debug.value becoming undef when
removing the scalar loop (and the location would have probably
been wrong for the vectorized case otherwise).

As we now may need to query the AvailableVals cache more than
once for a basic block, FindAvailableVals() in SSAUpdaterImpl is
changed so that it updates the cache for blocks that we do not
create a PHI node for, regardless of the block's number of
predecessors. The debug value in the attached IR reproducer
would not be properly rewritten without this.

Debug values residing in blocks where we have not inserted any
PHI nodes are currently left as-is by this patch. I'm not sure
what should be done with those uses.

Reviewers: mattd, aprantl, vsk, probinson

Reviewed By: mattd, aprantl

Subscribers: jmorse, gbedwell, JDevlieghere, llvm-commits

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

llvm-svn: 344589
2018-10-16 08:06:48 +00:00
..
2006-06-03-IncorrectIDFPhis.ll
2006-06-12-MultipleExitsSameBlock.ll
2006-07-09-NoDominator.ll
2006-10-31-UnreachableBlock-2.ll
2006-10-31-UnreachableBlock.ll
2007-07-12-LICM-2.ll
2007-07-12-LICM-3.ll
2007-07-12-LICM.ll
avoid-intrinsics-in-catchswitch.ll [Test] Fix the test to output to /dev/null instead of redirecting. 2018-02-23 19:03:04 +00:00
basictest.ll [DebugInfo][LCSSA] Preserve debug location in lcssa phis 2018-07-31 14:54:52 +00:00
indirectbr.ll
invoke-dest.ll
mixed-catch.ll
pr28424.ll
pr28608.ll
remove-phis.ll [LCSSA] Do not remove used PHI nodes in formLCSSAForInstructions 2018-05-08 06:59:47 +00:00
rewrite-existing-dbg-values.ll [DebugInfo][LCSSA] Rewrite pre-existing debug values outside loop 2018-10-16 08:06:48 +00:00
unreachable-use.ll
unused-phis.ll