[RISCV] Fix ICE in isDesirableToCommuteWithShift
authorSam Elliott <selliott@lowrisc.org>
Tue, 9 Jul 2019 16:24:16 +0000 (16:24 +0000)
committerSam Elliott <selliott@lowrisc.org>
Tue, 9 Jul 2019 16:24:16 +0000 (16:24 +0000)
commit114d2db49b133594257ba0d74cc433f23759bac8
tree61ef557a2561943d6e3849529d844f2f819fa287
parent6616e269a690b12335946c4cd019ef298ed0b288
[RISCV] Fix ICE in isDesirableToCommuteWithShift

Summary:
There was an error being thrown from isDesirableToCommuteWithShift in
some tests. This was tracked down to the method being called before
legalisation, with an extended value type, not a machine value type.

In the case I diagnosed, the error was only hit with an instruction sequence
involving `i24`s in the add and shift. `i24` is not a Machine ValueType, it is
instead an Extended ValueType which was causing the issue.

I have added a test to cover this case, and fixed the error in the callback.

Reviewers: asb, luismarques

Reviewed By: asb

Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64425

llvm-svn: 365511
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/add-before-shl.ll