[PATCH] Added llvm.is.constant intrinsic

Renato Golin renato.golin at linaro.org
Tue Aug 5 07:22:55 PDT 2014


>>! In D4276#14, @janusz wrote:
> 1. Do we want the code to promote or expand llvm.is.constant? On one hand it would make the code more complete but on the other it is not really required because zext() and trunc() don't change the 'constantness'

Depends on how hard would it be to infer constantness at a lower level with the added complexity. I'd say, as a general idea, leaving the IR untouched and adding logic to infer that later would be better, but I'm not sure of all the cases.


> 2. In my implementation llvm.is.constant is lowered to true/false rather late. Would it help in some cases if we added an early check in InstCombine? InstCombine would lower llvm.is.constant to true if the argument is known to be constant. Otherwise InstCombine would leave it unmodified.

Yes, that'd be great. I think we could teach even Clang about that, so that pre-processor constantness is explited at the front-end level. Though, I understand if those things take their time to get implemented.

http://reviews.llvm.org/D4276






More information about the llvm-commits mailing list