diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-11-06 09:06:48 -0500 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-11-06 09:28:41 -0500 |
commit | 8e34dd941cb304c785ef623633ad663b59cfced0 (patch) | |
tree | 7c15cb6ce73fd4c566e396685c2f17c9eed45dc1 /llvm/lib | |
parent | 3e54404c71564d9c684742439f178f07f1e45a70 (diff) | |
download | bcm5719-llvm-8e34dd941cb304c785ef623633ad663b59cfced0.tar.gz bcm5719-llvm-8e34dd941cb304c785ef623633ad663b59cfced0.zip |
[x86] avoid crashing when splitting AVX stores with non-simple type (PR43916)
The store splitting transform was assuming a simple type (MVT),
but that's not necessarily the case as shown in the test.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index d1ed862db55..c4ee6a193a0 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -21776,12 +21776,14 @@ static SDValue splitVectorStore(StoreSDNode *Store, SelectionDAG &DAG) { "Expecting 256/512-bit op"); // Splitting volatile memory ops is not allowed unless the operation was not - // legal to begin with. We are assuming the input op is legal (this transform - // is only used for targets with AVX). + // legal to begin with. Assume the input store is legal (this transform is + // only used for targets with AVX). Note: It is possible that we have an + // illegal type like v2i128, and so we could allow splitting a volatile store + // in that case if that is important. if (!Store->isSimple()) return SDValue(); - MVT StoreVT = StoredVal.getSimpleValueType(); + EVT StoreVT = StoredVal.getValueType(); unsigned NumElems = StoreVT.getVectorNumElements(); unsigned HalfSize = StoredVal.getValueSizeInBits() / 2; unsigned HalfAlign = (128 == HalfSize ? 16 : 32); |