[all-commits] [llvm/llvm-project] 7e88d5: [NFC][RemoveDIs] Have CreateNeg only accept iterat...

Jeremy Morse via All-commits all-commits at lists.llvm.org
Thu Feb 29 05:00:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7e88d5176060fa4d86376460db8310083b7c0e2d
      https://github.com/llvm/llvm-project/commit/7e88d5176060fa4d86376460db8310083b7c0e2d
  Author: Jeremy Morse <jeremy.morse at sony.com>
  Date:   2024-02-29 (Thu, 29 Feb 2024)

  Changed paths:
    M llvm/include/llvm/IR/InstrTypes.h
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/IR/Instructions.cpp
    M llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
    M llvm/lib/Transforms/Scalar/Reassociate.cpp

  Log Message:
  -----------
  [NFC][RemoveDIs] Have CreateNeg only accept iterators (#82999)

Removing debug-intrinsics requires that we always insert with an
iterator, not with an instruction position. To enforce that, we need to
eliminate the `Instruction *` taking functions. It's safe to leave the
insert-at-end-of-block functions as the intention is clear for debug
info purposes (i.e., insert after both instructions and debug-info at
the end of the function).

This patch demonstrates how that needs to happen. At a variety of
call-sites to the `CreateNeg` constructor we need to consider:
* Has this instruction been selected because of the operation it
performs? In that case, just call `getIterator` and pass an iterator in.
* Has this instruction been selected because of it's position? If so, we
need to keep the iterator identifying that position (see the 3rd hunk
changing Reassociate.cpp, although it's coincidentally not debug-info
significant).

This also demonstrates what we'll try and do with the constructor
methods going forwards: have one fully explicit set of parameters
including iterator, and another with default-arguments where the
block-to-insert-into argument defaults to nullptr / no-position,
creating an instruction that hasn't been inserted yet.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list