This is an archive of the discontinued LLVM Phabricator instance.

[TypePromotion] Fix a hardcoded use of 32 as the size being promoted to.
ClosedPublic

Authored by craig.topper on Nov 9 2021, 9:52 AM.

Details

Summary

At least I think that's what the 32 here is. Use RegisterBitWidth
instead.

While there replace zext with zextOrSelf to simplify the code.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 9 2021, 9:52 AM
craig.topper requested review of this revision.Nov 9 2021, 9:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 9:52 AM
craig.topper edited the summary of this revision. (Show Details)Nov 9 2021, 9:52 AM

Update comment as well

samparker accepted this revision.Nov 10 2021, 6:43 AM

Thanks.

This revision is now accepted and ready to land.Nov 10 2021, 6:43 AM
dmgreen accepted this revision.Nov 10 2021, 6:57 AM
dmgreen added a subscriber: dmgreen.

Do you mind making a couple of other adjustments whilst you are here? If not, I can look into them later - I apparently need to look into adjusting this same function.

llvm/lib/CodeGen/TypePromotion.cpp
368

TypePromotion::TypeSize -> TypeSize ?

370

Total.getBitWidth() -> RegisterBitWidth
Max.getBitWidth() -> TypeSize

379

Can you format this comment whilst you are here?

Simplify the code for comparing Total and Max.
Reformat comment

craig.topper requested review of this revision.Nov 10 2021, 9:32 AM
dmgreen accepted this revision.Nov 10 2021, 11:24 AM

Thanks. I was thinking that could be simplified

This revision is now accepted and ready to land.Nov 10 2021, 11:24 AM