summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorNadav Rotem <nadav.rotem@intel.com>2011-09-24 18:32:19 +0000
committerNadav Rotem <nadav.rotem@intel.com>2011-09-24 18:32:19 +0000
commit77426a754b5ade2d2e92140fd2894f764ffd8b81 (patch)
treedd9eb2e6bf484ed28c5a1ceba9611199e891bc6b /llvm/lib/CodeGen
parentc9d78d7444da004eed2813dbfa507dfab4922b31 (diff)
downloadbcm5719-llvm-77426a754b5ade2d2e92140fd2894f764ffd8b81.tar.gz
bcm5719-llvm-77426a754b5ade2d2e92140fd2894f764ffd8b81.zip
[Vector-Select] Address one of the problems in 10902.
When generating the trunc-store of i1's, we need to use the vector type and not the scalar type. This patch fixes the assertion in CodeGen/Generic/bool-vector.ll when running with -promote-elements. llvm-svn: 140463
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 1337ef2242b..f201227ae9f 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1180,6 +1180,10 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
// bytes. For example, promote EXTLOAD:i20 -> EXTLOAD:i24.
unsigned NewWidth = SrcVT.getStoreSizeInBits();
EVT NVT = EVT::getIntegerVT(*DAG.getContext(), NewWidth);
+ if (SrcVT.isVector()) {
+ NVT = EVT::getVectorVT(*DAG.getContext(), NVT,
+ SrcVT.getVectorNumElements());
+ }
SDValue Ch;
// The extra bits are guaranteed to be zero, since we stored them that
@@ -1521,7 +1525,12 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
// TRUNCSTORE:i1 X -> TRUNCSTORE:i8 (and X, 1)
EVT NVT = EVT::getIntegerVT(*DAG.getContext(),
StVT.getStoreSizeInBits());
- Tmp3 = DAG.getZeroExtendInReg(Tmp3, dl, StVT);
+ if (StVT.isVector()) {
+ NVT = EVT::getVectorVT(*DAG.getContext(), NVT,
+ StVT.getVectorNumElements());
+ }
+
+ Tmp3 = DAG.getZeroExtendInReg(Tmp3, dl, StVT.getScalarType());
Result = DAG.getTruncStore(Tmp1, dl, Tmp3, Tmp2, ST->getPointerInfo(),
NVT, isVolatile, isNonTemporal, Alignment);
} else if (StWidth & (StWidth - 1)) {
OpenPOWER on IntegriCloud