[PATCH] D75362: [InstCombine] Process blocks in RPO

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 09:10:30 PST 2020


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

InstComine currently processes blocks in some ill-defined depth-first order. This can break the usual invariant that the operands of an instruction should be simplified before the instruction itself, if uses across basic blocks (particularly inside phi nodes) are involved.

This patch switches the initial worklist population to use RPO instead, which will ensure that predecessors are visited before successors (back-edges notwithstanding).

This drops the number of tests with more than two InstCombine iterations from 33 to 25. There are two test changes, both don't look negative though.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75362

Files:
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/icmp-div-constant.ll
  test/Transforms/InstCombine/pr44245.ll
  test/Transforms/InstCombine/store.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75362.247284.patch
Type: text/x-patch
Size: 5840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200228/0e7882e7/attachment.bin>


More information about the llvm-commits mailing list