Page MenuHomePhabricator

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

Authored by jingyue on Nov 9 2014, 4:41 PM.

Details

Summary

We 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.

This patch

  1. adds a NVPTX-specific TargetTransformInfo with specialized computing

of cost of arithmetic instructions;

  1. compares the cost of arithmetics on the wider type and that on the

narrower type before widening an indvar.

Fixes PR21148.

Diff Detail

Event Timeline

jingyue updated this revision to Diff 15965.Nov 9 2014, 4:41 PM
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).

A minor clarification

lib/Target/NVPTX/CMakeLists.txt
12

Added NVPTXTargetTransformInfo.cpp and sorted other entries.

+ Tom Stellard who apparently doesn't have a phab account?
+ jholewinski@nvidia

jholewinski edited edge metadata.Nov 10 2014, 10:10 AM

This looks like a good start to me, but I'm not an expert on IndVarSimplify.

lib/Transforms/Scalar/IndVarSimplify.cpp
78

I'm not opposed to the style change, but it is extra noise in the patch.

jingyue abandoned this revision.Nov 10 2014, 10:16 AM

Thanks Tom and Justin.

I split this patch to D6195 and D6196 to be clearer. Justin, I assume D6195 looks good to you too because it's part of this patch.

Jingyue