[PATCH] D12882: [SimplifyCFG] do not speculate fdiv by default; it's expensive (PR24818)

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 18:16:09 PDT 2015


Can you give some context on specifically which speculative 
optimizations you're hoping to avoid here?  Are you only worried about 
if-then-else-to-select from SimplifyCFG?  What about cases like LICM?  
Do you think those should hoist or not?

My general feeling is that we *should* speculate these instructions if 
is legal and we have reason to predict it as being profitable (e.g. in 
LICM).  We do not currently have a global scheduler (or even a global 
schedule fixer-uper beyond some hacks in CodeGenPrep), but I've been 
thinking about this for other reasons.  In cases where the only use is 
down a particular path, adding a "fixup" which undoes hoisting seems 
plausible and reasonable.

For this particular case, it really seems like this should be handled 
via a select-to-control flow conversion for expensive operations done 
late in the pipeline.  IMO, selects is a better intermediate form for 
optimization, and we should undo the transformation late when heading 
into the backend.  In fact, we already have the framework for this in 
CodeGenPrep::OptimizeSelectInst.  Have you considered tweaking that instead?

Philip



On 09/16/2015 08:25 AM, Sanjay Patel wrote:
> spatel added reviewers: sanjoy, reames, jmolloy.
> spatel added a comment.
>
> Thanks for verifying that, Dimitry.
>
> Adding some more reviewers who may be able to provide guidance.
>
>
> http://reviews.llvm.org/D12882
>
>
>



More information about the llvm-commits mailing list