1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
llvm-mirror/lib/Transforms/InstCombine
Bjorn Pettersson 348b96dc3b [DebugInfo] Sink related dbg users when sinking in InstCombine
Summary:
When sinking an instruction in InstCombine we now also sink
the DbgInfoIntrinsics that are using the sunken value.

Example)

When sinking the load in this input

bb.X:
  %0 = load i64, i64* %start, align 4, !dbg !31
  tail call void @llvm.dbg.value(metadata i64 %0, ...)
  br i1 %cond, label %for.end, label %for.body.lr.ph
for.body.lr.ph:
  br label %for.body

we now also move the dbg.value, like this

bb.X:
  br i1 %cond, label %for.end, label %for.body.lr.ph
for.body.lr.ph:
  %0 = load i64, i64* %start, align 4, !dbg !31
  tail call void @llvm.dbg.value(metadata i64 %0, ...)
  br label %for.body

In the past we haven't moved the dbg.value so we got

bb.X:
  tail call void @llvm.dbg.value(metadata i64 %0, ...)
  br i1 %cond, label %for.end, label %for.body.lr.ph
for.body.lr.ph:
  %0 = load i64, i64* %start, align 4, !dbg !31
  br label %for.body


So in the past we got a debug-use before the def of %0.
And that dbg.value was also on the path jumping to %for.end, for
which %0 never was defined.

CodeGenPrepare normally comes to rescue later (when not moving
the dbg.value), since it moves dbg.value instrinsics quite
brutally, without really analysing if it is correct to move
the intrinsic (see PR31878).
So at the moment this patch isn't expected to have much impact,
besides that it is moving the dbg.value already in opt, making
the IR look more sane directly.

This can be seen as a preparation to (hopefully) make it possible
to turn off CodeGenPrepare::placeDbgValues later as a solution
to PR31878.

I also adjusted test/DebugInfo/X86/sdagsplit-1.ll to make the
IR in the test case up-to-date with this behavior in InstCombine.

Reviewers: rnk, vsk, aprantl

Reviewed By: vsk, aprantl

Subscribers: mattd, JDevlieghere, llvm-commits

Tags: #debug-info

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

llvm-svn: 330243
2018-04-18 08:08:04 +00:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] simplify fneg+fadd folds; NFC 2018-04-16 14:13:57 +00:00
InstCombineAndOrXor.cpp [InstCombine] Simplify 'xor' to 'or' if no common bits are set. 2018-04-15 18:59:44 +00:00
InstCombineCalls.cpp [X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR. 2018-04-13 06:07:18 +00:00
InstCombineCasts.cpp [InstCombine] simplify code that propagates FMF; NFC 2018-04-07 14:14:23 +00:00
InstCombineCompares.cpp [InstCombine] Fold compare of int constant against a splatted vector of ints 2018-04-03 17:26:20 +00:00
InstCombineInternal.h [InstCombine] simplify fneg+fadd folds; NFC 2018-04-16 14:13:57 +00:00
InstCombineLoadStoreAlloca.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
InstCombineMulDivRem.cpp [InstCombine] allow more fmul folds with 'reassoc' 2018-04-03 22:19:19 +00:00
InstCombinePHI.cpp Fix a couple of layering violations in Transforms 2018-03-21 22:34:23 +00:00
InstCombineSelect.cpp [InstCombine]: foldSelectICmpAndAnd(): and is commutative 2018-04-13 09:57:57 +00:00
InstCombineShifts.cpp [InstCombine] move constant check into foldBinOpIntoSelectOrPhi; NFCI 2018-02-28 16:36:24 +00:00
InstCombineSimplifyDemanded.cpp [X86] Remove the pmuldq/pmuldq intrinsics and replace with native IR. 2018-04-13 06:07:18 +00:00
InstCombineVectorOps.cpp
InstructionCombining.cpp [DebugInfo] Sink related dbg users when sinking in InstCombine 2018-04-18 08:08:04 +00:00
LLVMBuild.txt