getTypeLegalizationCost()

Hi,

I noticed that

BasicTTIImplBase::getArithmeticInstrCost() returned too high values for some vector instructions.

This happened regardless of if the vector type was to later be widened, or if it was legal.

In this method this call is made:

LT = TLI->getTypeLegalizationCost(DL, Ty);

This doesn't return any sensible values, because computeRegisterProperties() has not been called, so all vector types get split. It returns {2, i32} for v2i8, for example. I think it should have returned {1, v16i8}.

This seemed a bit odd to me, so it would be interesting to hear any opinions on this regarding if this is something to be fixed perhaps. It should be worth to know the legal vector types during calls to TargetTransformInfo... Or is it something that is missing in the backend (SystemZ)?

/Jonas

Hi,

I noticed that

BasicTTIImplBase::getArithmeticInstrCost() returned too high values for some vector instructions.

This happened regardless of if the vector type was to later be widened, or if it was legal.

In this method this call is made:

LT = TLI->getTypeLegalizationCost(DL, Ty);

This doesn't return any sensible values, because computeRegisterProperties() has not been called, so all vector types get split. It returns {2, i32} for v2i8, for example. I think it should have returned {1, v16i8}.

This seemed a bit odd to me, so it would be interesting to hear any opinions on this regarding if this is something to be fixed perhaps. It should be worth to know the legal vector types during calls to TargetTransformInfo... Or is it something that is missing in the backend (SystemZ)?

Sounds like something needs to be fixed. I don't understand the problem, however, because computeRegisterProperties is generally called in the *TargetLowering constructor (the same place that all of the other legalization information is set). It looks like your calling it early in the constructor in SystemZ (like on AArch64), whereas it gets called late in the constructor on PowerPC and x86. Is that causing an issue?

  -Hal