ldexp constant propagation


I have the C program below, which contains a mathematical expression.

C code:

Hi Ali,

I found the problem to be with "ldexp". If I change my mathematical expression to something else (e.g. containing "sin", "sqrt", etc.) the constant propagation does happen. Any ideas on why this doesn't work for exponentials, and how I can fix it?

I think the code that's supposed to do what you want is in
lib/Analysis/ConstantFolding.cpp, which indeed doesn't know how to
handle ldexp yet. Unfortunately there's no ldexp intrinsic yet either
so you'll have to plumb that through LLVM too.