]> granicus.if.org Git - llvm/commit
[RISCV] Fix ICE in isDesirableToCommuteWithShift
authorSam Elliott <selliott@lowrisc.org>
Mon, 12 Aug 2019 13:51:00 +0000 (13:51 +0000)
committerSam Elliott <selliott@lowrisc.org>
Mon, 12 Aug 2019 13:51:00 +0000 (13:51 +0000)
commitb342539dcd23ffffb3ab6f0b1905f549007af953
tree828fd25389a59168b48eb5da1bb3d1279a0b89bc
parentd55550443ace17122b2713c6131969822da2c986
[RISCV] Fix ICE in isDesirableToCommuteWithShift

Summary:
Ana Pazos reported a bug where we were not checking that an APInt would
fit into 64-bits before calling `getSExtValue()`. This caused asserts when
compiling large constants, such as i128s, as happens when compiling compiler-rt.

This patch adds a testcase and makes the callback less error-prone.

Reviewers: apazos, asb, luismarques

Reviewed By: luismarques

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

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368572 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/RISCVISelLowering.cpp
test/CodeGen/RISCV/add-before-shl.ll