[all-commits] [llvm/llvm-project] 898de3: [BranchFolding] Fix PR43964 about branch folder no...

Björn Pettersson via All-commits all-commits at lists.llvm.org
Thu Nov 21 09:15:08 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 898de302919b3caf09b820757c58190cd8621255
      https://github.com/llvm/llvm-project/commit/898de302919b3caf09b820757c58190cd8621255
  Author: Bjorn Pettersson <bjorn.a.pettersson at ericsson.com>
  Date:   2019-11-21 (Thu, 21 Nov 2019)

  Changed paths:
    M llvm/lib/CodeGen/BranchFolding.cpp
    A llvm/test/CodeGen/X86/branchfolding-debug-invariant.mir

  Log Message:
  -----------
  [BranchFolding] Fix PR43964 about branch folder not being debug invariant

Summary:
The fix in BranchFolder related to non debug invariant problems
done in commit ec32dff0b075055 actually introduced some new
problems with debug invariance.

Before that patch ComputeCommonTailLength would move iterators
back, past debug instructions, in order to make ProfitableToMerge
make consistent answers "when one block differs from the other
only by whether debugging pseudos are present at the beginning".
But the changes in ec32dff0b075055 undid that by moving the iterators
forward again.

This patch refactors ComputeCommonTailLength. The function was
really complex, considering that the SkipTopCFIAndReturn part
always moved the iterators forward to the first "real" instruction
in the found tail after ec32dff0b075055.

The patch also restores the logic to "back past possible debugging
pseudos at beginning of block" to make sure ProfitableToMerge
gives consistent answers independent of DBG_VALUE instructions
before the tail. That is now done by ProfitableToMerge instead of
being hidden as a side-effect in ComputeCommonTailLength.

Reviewers: probinson, yechunliang, jmorse

Reviewed By: jmorse

Subscribers: Orlando, mehdi_amini, dexonsmith, aprantl, hiraditya, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list