This is an archive of the discontinued LLVM Phabricator instance.

GlobalISel: Return APInt from getConstantVRegVal
ClosedPublic

Authored by arsenm on Dec 14 2020, 12:44 PM.

Details

Summary

Returning int64_t was arbitrarily limiting for wide integer types, and
the functions should handle the full generality of the IR.

Also changes the full form which returns the originally defined
vreg. Add another wrapper for the common case of just immediately
converting to int64_t (arguably this would be useful for the full
return value case as well).

One possible issue with this change is some of the existing uses did
break without conversion to getConstantVRegSExtVal, and it's possible
some without adequate test coverage are now broken.

Diff Detail

Event Timeline

arsenm created this revision.Dec 14 2020, 12:44 PM
arsenm requested review of this revision.Dec 14 2020, 12:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2020, 12:44 PM
Herald added a subscriber: wdng. · View Herald Transcript
paquette added inline comments.Dec 16 2020, 10:57 AM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1413

Why getZExtValue here rather than getSExtValue? Looks more correct considering it's an unsigned, but the old behaviour would have gotten the sign extended value.

arsenm added inline comments.Dec 16 2020, 11:02 AM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1413

Yes, I'm assuming this is supposed to be an unsigned value

aemerson added inline comments.Dec 16 2020, 3:29 PM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1413

Yeah, as a length arg this should always be unsigned.

1656

This should be ZExt though?

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
4665

ZExt

llvm/lib/Target/AArch64/GISel/AArch64PostLegalizerLowering.cpp
441

ZExt

arsenm updated this revision to Diff 312362.Dec 16 2020, 7:06 PM
arsenm marked 4 inline comments as done.

More zextval

bogner accepted this revision.Dec 21 2020, 9:54 AM
bogner added inline comments.
llvm/lib/CodeGen/GlobalISel/Utils.cpp
275

Why not just call the APInt version and add the bitwidth check, rather than duplicating the function?

This revision is now accepted and ready to land.Dec 21 2020, 9:54 AM