[PATCH] D124889: [ValueTracking] Add support to deduce a PHI node being a power of 2 if each incoming value is a power of 2.

William Junda Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 14:30:32 PDT 2022


huangjd added inline comments.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2058
+    }
+  }
+
----------------
nikic wrote:
> Hm, I think that for recurrences, this context instruction adjustment is not necessary. I believe the reason why we need it in general for phis is that we might follow a backedge, in which case we will be working with values from a previous loop iterations. This can't happen when we're looking at Start, because it must dominate the whole loop.
I saw similar usage in computeKnownBitsFromOperator. at line 1464. The comment said 

>       ... TODO: It may be correct to use the original context.  IF warranted, explore and
>        add sufficient tests to cover.

I am worry about some unusual cases such as the "Start" value is actually coming from a BB dominated by PHI's BB, and matchSimpleRecurrence is not strict on checking value domination, so I would be cautious here 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124889



More information about the llvm-commits mailing list