[llvm] r224899 - [CodeGenPrepare] Teach when it is profitable to speculate calls to @llvm.cttz/ctlz.

Robinson, Paul Paul_Robinson at playstation.sony.com
Thu Jan 1 14:04:57 PST 2015


Hi Andrea, one comment comment...

> +bool X86TargetLowering::isCheapToSpeculateCttz() const {
> +  // Don't try to speculate cttz if we can't directly use TZCNT.
> +  return Subtarget->hasBMI();
> +}
> +
> +bool X86TargetLowering::isCheapToSpeculateCtlz() const {
> +  // Don't try to speculate ctlz if we can't directly use LZCNT.
> +  return Subtarget->hasLZCNT();

These predicates default to "don't speculate" so the point here is
what conditions should override the default; and phrasing those as
positive statements would be easier to read than double-negatives.
Maybe something like:
// Speculate cttz only if we can directly use TZCNT.
and similar for ctlz.

Thanks,
--paulr





More information about the llvm-commits mailing list