[LLVMdev] Why does Select have a higher speculation cost than other instructions?

Tom Stellard tom at stellard.net
Wed May 28 11:52:47 PDT 2014


Hi,

The ComputeSpeculationCost() function in
Transforms/Utils/SimplifyCFG.cpp uses a higher speculation cost for
Select than other instructions.  Does anyone know why this is?

I would like SimplifyCFG to be able to speculatively execute Select
instructions.  Which of these solutions makes the most sense:

1. Change speculation cost of Select from 2 to 1.

2. Add a TargetTransformInfo callback for Select speculation cost.

3. Add a TargetTransformInfo callback for PhiNodeFoldingThreshold to
enable speculation of more expensive instructions.

4. Something else.

Thanks,
Tom



More information about the llvm-dev mailing list