AArch64 GIsel: legalize lshr operands, even if it is poison
authorJameson Nash <vtjnash@gmail.com>
Tue, 30 Nov 2021 19:59:49 +0000 (14:59 -0500)
committerJameson Nash <vtjnash@gmail.com>
Tue, 30 Nov 2021 20:28:35 +0000 (15:28 -0500)
commit18308e171b5b1dd99627a4d88c7d6c5ff21b8c96
tree798c8e108fcd087a947ac6a900b4f4659ecaef8a
parent86d5dc9afc9b99a143214604ff7a43652ce6df46
AArch64 GIsel: legalize lshr operands, even if it is poison

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

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 IR input, as long as the value is unused.

Discovered while trying to build Julia with LLVM v13:
https://github.com/JuliaLang/julia/pull/42602.

Reviewed By: aemerson

Differential Revision: https://reviews.llvm.org/D114389
llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
llvm/test/CodeGen/AArch64/GlobalISel/select-binop.mir
llvm/test/CodeGen/AArch64/GlobalISel/select-scalar-shift-imm.mir