[PATCH] D90231: [GVN] Don't replace argument to @llvm.is.constant.*()

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 28 02:43:52 PDT 2020


jonpa added a comment.

In D90231#2358461 <https://reviews.llvm.org/D90231#2358461>, @uweigand wrote:

> In D90231#2358421 <https://reviews.llvm.org/D90231#2358421>, @jonpa wrote:
>
>> I think it makes general sense to not optimize the argument to @llvm.is.constant.
>
> Sometimes, it may be necessary to optimize the argument to @llvm.is.constant so that you even recognize it is in fact constant.  An example might be a constant argument propagated into an inlined function which uses @llvm.is.constant on the argument variable.  (This seems to be a quite typical use of the predicate e.g. in kernel sources.)
>
> Not sure if this would be affected by your proposed patch, but it's something to keep in mind.

That's a good point... Maybe that means that each optimizer really should take care of this on its own. Perhaps having the GVN pass (and probably others) pass 'true' to a new (default-false) argument to replaceDominatedUsesWith() to make this exception take effect would be better? That way the value would by default be replaced, but not for this particular type of optimization...


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

https://reviews.llvm.org/D90231



More information about the llvm-commits mailing list