[PATCH] D147198: [WASM] Prevent casting `undef` to `CosntantSDNode`
Peter Rong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 30 20:14:17 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b2476910ba3: [WASM] Prevent casting `undef` to `CosntantSDNode` (authored by Peter).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147198/new/
https://reviews.llvm.org/D147198
Files:
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/test/CodeGen/WebAssembly/pr61828.ll
Index: llvm/test/CodeGen/WebAssembly/pr61828.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/WebAssembly/pr61828.ll
@@ -0,0 +1,9 @@
+; RUN: llc < %s -mattr=+simd128 -mtriple=wasm64
+
+define void @foo(i64 %i0, i64 %i1, ptr %p) {
+ %B4 = urem i64 %i0, %i0
+ %B5 = udiv i64 %i1, %B4
+ %I = insertelement <4 x float> <float 0.25, float 0.25, float 0.25, float 0.25>, float 0.5, i64 %B5
+ store <4 x float> %I, ptr %p
+ ret void
+}
Index: llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
===================================================================
--- llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -2242,7 +2242,7 @@
SelectionDAG &DAG) const {
// Allow constant lane indices, expand variable lane indices
SDNode *IdxNode = Op.getOperand(Op.getNumOperands() - 1).getNode();
- if (isa<ConstantSDNode>(IdxNode) || IdxNode->isUndef()) {
+ if (isa<ConstantSDNode>(IdxNode)) {
// Ensure the index type is i32 to match the tablegen patterns
uint64_t Idx = cast<ConstantSDNode>(IdxNode)->getZExtValue();
SmallVector<SDValue, 3> Ops(Op.getNode()->ops());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147198.509889.patch
Type: text/x-patch
Size: 1270 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230331/d0890db7/attachment.bin>
More information about the llvm-commits
mailing list