[X86] Fix crash with i64 bitreverse on 32-bit targets with XOP.
authorCraig Topper <craig.topper@sifive.com>
Mon, 16 Nov 2020 02:16:34 +0000 (18:16 -0800)
committerCraig Topper <craig.topper@sifive.com>
Mon, 16 Nov 2020 03:02:34 +0000 (19:02 -0800)
commit57c0c4a27575840ae0a48eb9f8455a5ed087c857
tree78e6814b360d7c042f3578803276eba9360e9401
parent918e3439e20d068b3336febf084d7e11baa48311
[X86] Fix crash with i64 bitreverse on 32-bit targets with XOP.

We unconditionally marked i64 as Custom, but did not install a
handler in ReplaceNodeResults when i64 isn't legal type. This
leads to ReplaceNodeResults asserting.

We have two options to fix this. Only mark i64 as Custom on
64-bit targets and let it expand to two i32 bitreverses which
each need a VPPERM. Or the other option is to add the Custom
handling to ReplaceNodeResults. This is what I went with.
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/bitreverse.ll