[LLVMdev] global question
Mike Stump
mrs at apple.com
Sat Mar 7 09:27:06 PST 2009
On Mar 7, 2009, at 8:56 AM, John Regehr wrote:
> it seems clear that a constant propagation pass could have inferred
> that x is 0.
The only problem is that you could have another translation unit, and
it could be in C++, and it could have a global object with a
constructor that runs, and that constructor might set the value of x
to 1. So, inferring the value is 0 isn't possible in that case. Now,
if you do -fwhole-program and/or tell the optimizer the only export is
main, it might have a chance at doing that you want.
More information about the llvm-dev
mailing list