This is an archive of the discontinued LLVM Phabricator instance.

AArch64 GIsel: legalize lshr operands, even if it is poison

Authored by vtjnash on Nov 22 2021, 1:01 PM.



Discovered while trying to build Julia with LLVM v13 (

While this shift is not defined (returns poison), it should not crash codegen,
as it may appear inside dead code (for example, a select instruction), and it
is legal as long as the value is not used.

Previously, this caused GlobalISel to emit invalid IR (a gpr32 to gpr64 copy) and fail during verification.

Tagging Amara as reviewer, as you wrote this code originally in rGcac1151845e6b .

Diff Detail

Event Timeline

vtjnash created this revision.Nov 22 2021, 1:01 PM
vtjnash requested review of this revision.Nov 22 2021, 1:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2021, 1:01 PM
vtjnash edited the summary of this revision. (Show Details)Nov 22 2021, 1:05 PM
vtjnash added a reviewer: aemerson.
vtjnash added a project: Restricted Project.
aemerson accepted this revision.Nov 30 2021, 12:27 AM

LGTM. Can you rewrite the patch description for the commit message to more clearly explain what the actual problem this is solving too?

This revision is now accepted and ready to land.Nov 30 2021, 12:27 AM