[PATCH] D23824: [ADCE] Add handling of PHI nodes when removing control flow

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 1 11:52:14 PDT 2016

dberlin added a subscriber: dberlin.

Comment at: lib/Transforms/Scalar/ADCE.cpp:463
@@ +462,3 @@
+      }
+      if (CommonReachngDefinition != Value) {
+        // When there are two definitions from "dead" predecessor paths we
I'm curious why you bother with this detection?
Pretty much every other pass we have can already do a better job of it :)
That is, they can determine not just if they are dead or trivially equivalent, but produce equivalent values.

You are basically detecting the block is not necessary to produce that value to the phi node.
That's, IMHO, more of a redundancy elimination technique than a dead code one.
The code isn't dead, it's just equivalent to some other code.
Or am i missing something?

Do you have examples where the standard pass pipeline doesn't remove the block producing the equivalent value?


More information about the llvm-commits mailing list