[all-commits] [llvm/llvm-project] c0fa44: AArch64: Remove reversedInstructionsWithoutDebug h...

Vedant Kumar via All-commits all-commits at lists.llvm.org
Fri Apr 24 11:28:40 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c0fa447e02c4cd8c53c3ab03efa6391175e3d56e
      https://github.com/llvm/llvm-project/commit/c0fa447e02c4cd8c53c3ab03efa6391175e3d56e
  Author: Vedant Kumar <vsk at apple.com>
  Date:   2020-04-24 (Fri, 24 Apr 2020)

  Changed paths:
    M llvm/include/llvm/CodeGen/MachineBasicBlock.h
    M llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    A llvm/test/CodeGen/AArch64/peephole-opt-check-cflags.mir

  Log Message:
  -----------
  AArch64: Remove reversedInstructionsWithoutDebug helper

When using reversedInstructionsWithoutDebug to construct a range from a
pair of MachineInstrBundleIterators, the range unexpectedly leaves out an
element. This results in mis-optimization as @mstorsjo points out in
https://reviews.llvm.org/D78157.

The problem is that when we convert a MachineInstrBundleIterator to a
reverse iterator, the result gets incremented:

  MachineInstrBundleIterator(++I.getReverse())

The comment there explains that the "resulting iterator will dereference
... to the previous node, which is somewhat unexpected; but converting
the two endpoints in a range will give the same range in reverse". This
makes it hard to understand what reversedInstructionsWithoutDebug will
do: I've removed the helper to prevent similar mistakes in the future.




More information about the All-commits mailing list