summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2019-10-25 19:21:44 -0400
committerSanjay Patel <spatel@rotateright.com>2019-10-25 19:27:26 -0400
commit4c47617627fbc88fe91195528408178b2dc0e4c9 (patch)
tree4ec1153752bcfbc96445e1bef58028584db7a8bb /llvm/lib
parentf3ad8ae7b73860ea34b7f6a7e86ab0f314ea3ce6 (diff)
downloadbcm5719-llvm-4c47617627fbc88fe91195528408178b2dc0e4c9.tar.gz
bcm5719-llvm-4c47617627fbc88fe91195528408178b2dc0e4c9.zip
[SDAG] fold extract_vector_elt with undef index
This makes the DAG behavior consistent with IR's extractelement after: rGb32e4664a715 https://bugs.llvm.org/show_bug.cgi?id=42689 I've tried to maintain test intent for WebAssembly. The AMDGPU test is trying to test for crashing or other bad behavior, but I'm not sure if that's possible after this change.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 52a71b91d93..8ea7ce94da1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -5228,8 +5228,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
"The result of EXTRACT_VECTOR_ELT must be at least as wide as the \
element type of the vector.");
- // EXTRACT_VECTOR_ELT of an UNDEF is an UNDEF.
- if (N1.isUndef())
+ // Extract from an undefined value or using an undefined index is undefined.
+ if (N1.isUndef() || N2.isUndef())
return getUNDEF(VT);
// EXTRACT_VECTOR_ELT of out-of-bounds element is an UNDEF
OpenPOWER on IntegriCloud