This is an archive of the discontinued LLVM Phabricator instance.

Disable indvar widening if arithmetics on the wider type are more expensive
ClosedPublic

Authored by jingyue on Nov 10 2014, 10:08 AM.

Details

Summary

IndVarSimplify should not widen an indvar if arithmetics on the wider
indvar are more expensive than those on the narrower indvar. For
instance, although NVPTX64 treats i64 as a legal type, an ADD on i64 is
twice as expensive as that on i32, because the hardware needs to
simulate a 64-bit integer using two 32-bit integers.

Split from D6188, and based on D6195 which adds NVPTXTargetTransformInfo.

Fixes PR21148.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 15998.Nov 10 2014, 10:08 AM
jingyue retitled this revision from to Disable indvar widening if arithmetics on the wider type are more expensive.
jingyue updated this object.
jingyue edited the test plan for this revision. (Show Details)
jingyue added reviewers: atrick, jholewinski, eliben, meheff.
jingyue added a subscriber: Unknown Object (MLST).

+ Tom Stellard

This is separated from D6188, and focuses mostly on IndVarSimplify.

Jingyue

jingyue updated this revision to Diff 16025.Nov 10 2014, 9:40 PM

rebase against the latest version

atrick accepted this revision.Nov 11 2014, 11:50 AM
atrick edited edge metadata.

LGTM.

I don't like the fact that TTI info silently changes behavior of an early IR pass while not required to be present; that's a broader issue though that I'd rather not debate in this context. This is actually a pretty benign use of TTI.

This revision is now accepted and ready to land.Nov 11 2014, 11:50 AM

Thanks Andrew!

I don't like that either. I saw there's effort on making DataLayout mandatory, and think maybe the same thing will eventually happen to TargetTransformInfo. We already have a default "boring" NoTTI, so the switch wouldn't be too hard.

Jingyue

jingyue closed this revision.Nov 11 2014, 10:49 PM