[PATCH] D4276: Added llvm.is.constant intrinsic

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 13:51:50 PST 2018


jyknight added a comment.

Picking this back up again...

I'm ready to actually submit this now that Bill has the clang-side code that'll use it almost in place. Woo! :)

In https://reviews.llvm.org/D4276#1073957, @efriedma wrote:

> Needs a testcase for the SCCP fix.  Otherwise LGTM.


The SCCP bug is already be exhibited by the tests in `test/CodeGen/Generic/is-constant.ll` which pass a struct. Since I believe `llvm.is.constant` is the only thing we can constant-fold which takes struct args at the moment anyhow, that's really the only viable test. So I think there's nothing else needed here.

In https://reviews.llvm.org/D4276#1135976, @Bharathi wrote:

> This feature would be very useful to us and testing this patch against our code base gave us an interesting case where llvm.is.constant (used in a conditional) is lowered to false in CodeGenPrepare and the dead branch that arises out of this lowering does not get eliminated. The code that gets generated after CodeGenPrepare pass has "br i1 false .." with both true and false conditions preserved and this propagates further and remains the same in the final assembly code.


It may make sense to iterate, as you say, but that can/should be a different patch.


https://reviews.llvm.org/D4276





More information about the llvm-commits mailing list