[PATCH] D73803: [InstCombine] Add replaceOperand() helper

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 31 13:30:53 PST 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri, xbolva00.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

Adds a `replaceOperand()` helper, which is like `Instruction.setOperand()` but adds the old operand to the worklist. This reduces the amount of missing or incorrect worklist management.

This only applies the helper to a relatively small subset of `setOperand()` calls in InstCombine, namely those of the pattern `I.setOperand(); return &I;`, where it is most obviously applicable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73803

Files:
  llvm/include/llvm/Transforms/InstCombine/InstCombineWorklist.h
  llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/lib/Transforms/InstCombine/InstCombineInternal.h
  llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
  llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
  llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73803.241798.patch
Type: text/x-patch
Size: 12607 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200131/befa7a53/attachment.bin>


More information about the llvm-commits mailing list