diff options
| author | Dan Gohman <dan433584@gmail.com> | 2015-12-10 00:26:26 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2015-12-10 00:26:26 +0000 |
| commit | a8483755d37acf9468ec54ae66d4e720907cd264 (patch) | |
| tree | 472d7c4e0d7ed9118268253a9ec4e2b139d2a200 /llvm/lib | |
| parent | 7935fa3d1bf00d1991eb6d4950ac34d7467174c0 (diff) | |
| download | bcm5719-llvm-a8483755d37acf9468ec54ae66d4e720907cd264.tar.gz bcm5719-llvm-a8483755d37acf9468ec54ae66d4e720907cd264.zip | |
[WebAssembly] Fix legalization of shift operators with illegal types.
llvm-svn: 255181
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index a8b93ca8a2f..37b82d6385a 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -202,7 +202,13 @@ bool WebAssemblyTargetLowering::isOffsetFoldingLegal( MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout & /*DL*/, EVT VT) const { - return VT.getSimpleVT(); + unsigned BitWidth = NextPowerOf2(VT.getSizeInBits() - 1); + if (BitWidth > 1 && BitWidth < 8) + BitWidth = 8; + MVT Result = MVT::getIntegerVT(BitWidth); + assert(Result != MVT::INVALID_SIMPLE_VALUE_TYPE && + "Unable to represent scalar shift amount type"); + return Result; } const char * |

