summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-12-16 23:25:51 +0000
committerDan Gohman <dan433584@gmail.com>2015-12-16 23:25:51 +0000
commit417295381308b9af6e431d3ceb42b4770969bc96 (patch)
tree94bc9ba9015450b497e82a27ccb82d672d76a609 /llvm/lib/Target/WebAssembly
parent38dcc9e355094a3fc5f2c81c074696d5e01d0de8 (diff)
downloadbcm5719-llvm-417295381308b9af6e431d3ceb42b4770969bc96.tar.gz
bcm5719-llvm-417295381308b9af6e431d3ceb42b4770969bc96.zip
[WebAssembly] Fix legalization of shift operators on large integer types.
llvm-svn: 255847
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index 2364366f3f5..ed7cb1909d9 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -207,6 +207,13 @@ MVT WebAssemblyTargetLowering::getScalarShiftAmountTy(const DataLayout & /*DL*/,
unsigned BitWidth = NextPowerOf2(VT.getSizeInBits() - 1);
if (BitWidth > 1 && BitWidth < 8)
BitWidth = 8;
+
+ if (BitWidth > 64) {
+ BitWidth = 64;
+ assert(BitWidth >= Log2_32_Ceil(VT.getSizeInBits()) &&
+ "64-bit shift counts ought to be enough for anyone");
+ }
+
MVT Result = MVT::getIntegerVT(BitWidth);
assert(Result != MVT::INVALID_SIMPLE_VALUE_TYPE &&
"Unable to represent scalar shift amount type");
OpenPOWER on IntegriCloud