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

escha via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 16:47:31 PDT 2015


> On Sep 15, 2015, at 10:49 AM, Sanjay Patel via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> spatel created this revision.
> spatel added reviewers: hfinkel, arsenm, bkramer.
> spatel added a subscriber: llvm-commits.
> 
> I'm not sure if this is the right fix, but PR24818 and PR24343 show that we're now speculating costly ops on x86 when we shouldn't. I've confirmed that we're hoisting fdiv on all in-tree targets without this patch, and that seems wrong, so I think we should fix this in the base class rather than everyone's overrides.
> 
> The test just below the one I'm proposing assumes that fsqrt is cheap enough to speculate, but that's not generally true either. Do we want SimplifyCFG to make this speculative transform and then have backends undo it for expensive ops?

Will there be a target hook to allow re-enabling speculation of such expensive operations? For example, on a GPU, fdiv/fsqrt might not be quite as bad.

—escha


More information about the llvm-commits mailing list