[LLVMdev] Which transform passes to apply?

David Tweed david.tweed at arm.com
Tue Dec 4 01:22:51 PST 2012


If you want LLVM to do this you'll definitely have to enable unsafe-math
flags since the transformation isn't strictly valid in IEEE floating point
(the only web ref I can find quickly is


). Duncan has been doing some work in implementing stuff in that area that I
haven't kept up with. However, it might be worth considering tracking those
empty operations you want to at your own DSL level, so that you've got more
control over when these fp-unsafe optimizations are applied. (I was doing
something with automatic differentiation -- which throws up lots of
"multiply by 1"s , "add 0"s, etc --- about a year ago and found this was the
way to go then, but as mentioned there's been some activity in the area I
haven't been following.)

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Josh Klontz
Sent: 04 December 2012 05:24
To: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Which transform passes to apply?

Thanks Duncan, GVN/EarlyCSE worked as suggested. Any pointers on how to
optimize out:
%accumulate = fadd double %6, 0.000000e+00

Using the 3.1 release and the C++ API, I can't figure out how
FPMathOperator, TargetOptions, nor IRBuilder::SetDefaultFPMathTag work. I
also don't see any floating point math transformation passes. I did see
IRBuilder::SetFastMathFlags, do I need to update to 3.2 and use this call?

View this message in context:
Sent from the LLVM - Dev mailing list archive at Nabble.com.
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu

More information about the llvm-dev mailing list