Gautam Chakrabarti via llvm-dev
2018-Sep-10 23:02 UTC
[llvm-dev] Bug in ComputeSpeculationCost in SimplifyCFG?
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? Thanks, Gautam ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180910/862cda60/attachment.html>
Friedman, Eli via llvm-dev
2018-Sep-11 17:57 UTC
[llvm-dev] Bug in ComputeSpeculationCost in SimplifyCFG?
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>