This is an archive of the discontinued LLVM Phabricator instance.

[TargetTransformInfo] Handle intrinsic call in getInstructionLatency()
ClosedPublic

Authored by Carrot on Sep 20 2017, 3:33 PM.

Details

Summary

Usually an intrinsic is a simple target instruction, it should have a small latency. A real function call has much larger latency. So handle the intrinsic call in function getInstructionLatency().

Diff Detail

Repository
rL LLVM

Event Timeline

Carrot created this revision.Sep 20 2017, 3:33 PM
hfinkel added inline comments.Sep 21 2017, 10:04 AM
include/llvm/Analysis/TargetTransformInfoImpl.h
792 ↗(On Diff #116096)

I think that you want to do the same thing here that we do in getCallCost (call isLoweredToCall), perhaps like this:

if (!static_cast<T *>(this)->isLoweredToCall(F))
      return 1;
Carrot updated this revision to Diff 116263.Sep 21 2017, 1:53 PM
Carrot marked an inline comment as done.
hfinkel added inline comments.Sep 21 2017, 3:09 PM
include/llvm/Analysis/TargetTransformInfoImpl.h
793 ↗(On Diff #116263)

Actually, do we want to just return 1 here, or do we want to fall through to the logic below (which returns 3 for FP types)?

Carrot updated this revision to Diff 116356.Sep 22 2017, 9:02 AM
Carrot marked an inline comment as done.
Carrot added inline comments.
include/llvm/Analysis/TargetTransformInfoImpl.h
793 ↗(On Diff #116263)

Good catch! It will give more precise result.

hfinkel accepted this revision.Sep 22 2017, 9:27 AM

LGTM

include/llvm/Analysis/TargetTransformInfoImpl.h
791 ↗(On Diff #116356)

This variable name should start with a capital letter (per our coding conventions).

This revision is now accepted and ready to land.Sep 22 2017, 9:27 AM
Carrot updated this revision to Diff 116369.Sep 22 2017, 10:06 AM
Carrot marked an inline comment as done.

Will commit this patch.

This revision was automatically updated to reflect the committed changes.