[llvm-dev] Bug in ComputeSpeculationCost in SimplifyCFG?

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 11 10:57:37 PDT 2018


On 9/10/2018 4:02 PM, Gautam Chakrabarti via llvm-dev wrote:
>
> I am trying to understand the cost returned by ComputeSpeculationCost 
> function in SimplifyCFG. It appears even when it returns TCC_Expensive 
> (which means “prohibitively expensive”), the caller may proceed with a 
> transform, because TCC_Expensive is not really a high cost, but its 
> value is 4.
>
> For example when DominatesMergePoint calls this, it may still move 
> ahead because TCC_Expensive cost may be less than CostRemaining. 
> Looking thru the history, it appears this behavior changed with 
> r228826 
> (http://llvm.org/viewvc/llvm-project?view=revision&revision=228826), 
> when this API was moved to use TargetTransformInfo for cost analysis 
> instead of the hard-coded cost estimates.
>
> Is this a bug?
>

It looks dubious, yes... although I'm not sure it's actually possible to 
cause issues in practice with the default thresholds. Patch welcome.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180911/6ca06a47/attachment.html>


More information about the llvm-dev mailing list