[all-commits] [llvm/llvm-project] 972840: [IR] Add Instruction::getInsertionPointAfterDef()

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Aug 31 01:50:33 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 972840aa3b3d83a3a49cb5cfa3f4e1582ee63a3b
      https://github.com/llvm/llvm-project/commit/972840aa3b3d83a3a49cb5cfa3f4e1582ee63a3b
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M llvm/include/llvm/IR/Instruction.h
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/Transforms/Coroutines/CoroFrame.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

  Log Message:
  -----------
  [IR] Add Instruction::getInsertionPointAfterDef()

Transforms occasionally want to insert an instruction directly
after the definition point of a value. This involves quite a few
different edge cases, e.g. for phi nodes the next insertion point
is not the next instruction, and for invokes and callbrs its not
even in the same block. Additionally, the insertion point may not
exist at all if catchswitch is involved.

This adds a general Instruction::getInsertionPointAfterDef() API to
implement the necessary logic. For now it is used in two places
where this should be mostly NFC. I will follow up with additional
uses where this fixes specific bugs in the existing implementations.

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




More information about the All-commits mailing list