aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-13 19:40:18 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-05-13 19:40:18 +0000
commit323dc634b984b7d30e10b82ae4e9536559488f70 (patch)
tree2e4ee0efdcaba3f0b554747c6437a4cd0885a7ef /llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
parentd9930d499a55c573de0ef4f7629fa6880dd7d65f (diff)
downloadllvm-323dc634b984b7d30e10b82ae4e9536559488f70.zip
llvm-323dc634b984b7d30e10b82ae4e9536559488f70.tar.gz
llvm-323dc634b984b7d30e10b82ae4e9536559488f70.tar.bz2
[WebAssembly] Don't assume that zext/sext result is i32/i64 in fast isel (PR41841)
Usually this will abort fast-isel at the instruction using the non-legal result, but if the only use is in a different basic block, we'll incorrectly assume that the zext/sext is to i32 (rather than i128 in this case). Differential Revision: https://reviews.llvm.org/D61823 llvm-svn: 360616
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
index 535a925..39c682d 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -523,7 +523,10 @@ unsigned WebAssemblyFastISel::zeroExtend(unsigned Reg, const Value *V,
return Result;
}
- return zeroExtendToI32(Reg, V, From);
+ if (To == MVT::i32)
+ return zeroExtendToI32(Reg, V, From);
+
+ return 0;
}
unsigned WebAssemblyFastISel::signExtend(unsigned Reg, const Value *V,
@@ -542,7 +545,10 @@ unsigned WebAssemblyFastISel::signExtend(unsigned Reg, const Value *V,
return Result;
}
- return signExtendToI32(Reg, V, From);
+ if (To == MVT::i32)
+ return signExtendToI32(Reg, V, From);
+
+ return 0;
}
unsigned WebAssemblyFastISel::getRegForUnsignedValue(const Value *V) {