Idempotent intrinsics

Hi all,

Just a quick question about the idempotence of an intrinsic function. Is there a way to specify that an intrinsic function is idempotent? I am trying to give as much information about the intrinsic function I added to LLVM so that LLVM can do optimizations otherwise disabled. Thanks a lot in advance.

Bin

Hi Bin,

Just a quick question about the idempotence of an intrinsic function. Is
there a way to specify that an intrinsic function is idempotent? I am
trying to give as much information about the intrinsic function I added
to LLVM so that LLVM can do optimizations otherwise disabled. Thanks a
lot in advance.

there is no way right now.

Ciao, Duncan.

Is this the mathematical definition of idempotence (f(f(x)) == f(x)) or
the programming definition of idempotence (the initial call to f() may
have side-effects, but repeat calls do not, and all calls return the
same value)? Neither is directly modeled by IR. The first is easy
to do with a custom optimization pass. The second can be modeled
by readonly or readnone if you're willing to say that you don't care
whether any side-effects actually occur if the value isn't used;
otherwise it's more complicated.

John.