This is an archive of the discontinued LLVM Phabricator instance.

[Types] Define a getWithNewBitWidth for Types and make use of it.
ClosedPublic

Authored by dmgreen on Oct 17 2019, 2:26 PM.

Details

Summary

This is designed to change the bitwidth of a type without altering the number of vector lanes. Also useful in D68651. Otherwise an NFC.

Diff Detail

Event Timeline

dmgreen created this revision.Oct 17 2019, 2:26 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 17 2019, 2:26 PM

Nice, i like this!
This doesn't change the bitwidth of the type it is called on though, it returns new type,
so i think the name needs a bit more thought (i can't give a better suggestion right now)

llvm/include/llvm/IR/Type.h
386

s/the bitwidth/the lane bitwidth/

xbolva00 added inline comments.
llvm/include/llvm/IR/Type.h
388

NewBitWidth

Hows about a static getWithNewBitWidth(Type*, NewBitWidth)? Similar to Types existing static get methods.

So used like: Type *CondTy = Type::getWithNewBitWidth(RetTy, 1)

Hows about a static getWithNewBitWidth(Type*, NewBitWidth)? Similar to Types existing static get methods.

So used like: Type *CondTy = Type::getWithNewBitWidth(RetTy, 1)

AH yes, i think that would be good.
I don't really see why it should be static, getExtendedType() isn't.

dmgreen updated this revision to Diff 225843.Oct 21 2019, 2:52 AM

Renamed to getWithNewBitWidth

dmgreen retitled this revision from [Types] Define a changeBitWidth for Types and make use of it. to [Types] Define a getWithNewBitWidth for Types and make use of it..Oct 21 2019, 2:53 AM
dmgreen updated this revision to Diff 225845.Oct 21 2019, 2:55 AM
dmgreen marked 2 inline comments as done.

Update comment

lebedev.ri accepted this revision.Oct 21 2019, 2:59 AM

LG, thank you for the cleanup!

This revision is now accepted and ready to land.Oct 21 2019, 2:59 AM
This revision was automatically updated to reflect the committed changes.