[PATCH] D142293: [InstCombine] Add PHINode operands to worklist on instruction erasure

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 01:32:15 PST 2023


nikic added a comment.

Hm, this feels very hacky. I don't like the idea of adjusting the worklist management for specific patterns.

To suggest a possible alternative, it might be possible to extend isDeadPHICycle(), by making it look through side-effect free instructions, as well as multiple users. This will allow it to remove larger dead phi cycles, so it would not just peel off one phi cycle at a time, but could remove the whole graph at once. (Of course subject to the visitation limit -- with the current one of 16, that would mean we could remove 8 nested phi cycles in one go, which is probably good enough?)



================
Comment at: llvm/test/Transforms/InstCombine/phi-elimination-iteration.ll:1
+; RUN: opt < %s -passes=instcombine -S -debug 2>&1 | FileCheck %s
+define void @f() {
----------------
Use `-instcombine-infinite-loop-threshold=2` to make sure it folds in one iteration instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142293/new/

https://reviews.llvm.org/D142293



More information about the llvm-commits mailing list