[PATCH] Added llvm.is.constant intrinsic

Joerg Sonnenberger joerg at britannica.bec.de
Mon Jun 30 04:13:57 PDT 2014


On Mon, Jun 30, 2014 at 10:45:24AM +0200, Sobczak, Janusz wrote:
> I'm thinking about modyfing __builtin_constant_p() implementation in clang
> to do this (for integer arguments):
> if (argument is known to be constant)
>     replace  __builtin_constant_p() with 1 (True)
> else
>    replace __builtin_constant_p() with @llvm.is_constant() IR

What is the intended use case here? All cases that *I* consider to be
sane applications of __builtin_constant_p are workaround for target
specific features that are better exposed as intrinsics themselve, e.g.
IO asm instructions on x86. It is one of the most abused features of
GCC, especially since it can introduce magic variance due to optimizer
changes.

Joerg



More information about the llvm-commits mailing list