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
- adds a NVPTX-specific TargetTransformInfo with specialized computing
of cost of arithmetic instructions;
- compares the cost of arithmetics on the wider type and that on the
narrower type before widening an indvar.
Fixes PR21148.
Added NVPTXTargetTransformInfo.cpp and sorted other entries.