[PATCH] D93974: [ValueTracking] Safe assumption context for args

Gil Rapaport via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 07:01:30 PST 2021


gilr added a comment.

Sorry for the delay @nikic.

In D93974#2476165 <https://reviews.llvm.org/D93974#2476165>, @nikic wrote:

> Am I understanding correctly that this tries to use the last instruction in the entry block rather than the first one to avoid triggering the ephemeral value check, in case the first instruction is part of an assumption?

Yes, the first instruction is fine except for an assume which appears (along with its ephemeral values) as the first thing in the function, which in case of an argument seems quite likely.

> In any case, I don't think it's appropriate to perform a full block scan to determine the context instruction. safeCxtI() should be cheap (as in O(1)).

An unbounded scan of the entry block might indeed be too much even if applied only to arguments. The scan can perhaps be limited to some small number of instructions (5 seems like the minimum to cover most patterns in computeKnownBits()) which gets reset if an assume is encountered.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93974



More information about the llvm-commits mailing list