Skip to content

Commit 5c1b0a6

Browse files
committed
Only process dbg.values / DPValues in sinking if there are some.
1 parent eabd2a9 commit 5c1b0a6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4219,8 +4219,10 @@ bool InstCombinerImpl::tryToSinkInstruction(Instruction *I,
42194219
SmallVector<DbgVariableIntrinsic *, 2> DbgUsers;
42204220
SmallVector<DPValue *, 2> DPValues;
42214221
findDbgUsers(DbgUsers, I, &DPValues);
4222-
tryToSinkInstructionDbgValues(I, InsertPos, SrcBlock, DestBlock, DbgUsers);
4223-
tryToSinkInstructionDPValues(I, InsertPos, SrcBlock, DestBlock, DPValues);
4222+
if (!DbgUsers.empty())
4223+
tryToSinkInstructionDbgValues(I, InsertPos, SrcBlock, DestBlock, DbgUsers);
4224+
if (!DPValues.empty())
4225+
tryToSinkInstructionDPValues(I, InsertPos, SrcBlock, DestBlock, DPValues);
42244226

42254227
// PS: there are numerous flaws with this behaviour, not least that right now
42264228
// assignments can be re-ordered past other assignments to the same variable

0 commit comments

Comments
 (0)