|
|
9c4e62 |
From 69bb97a917250d0d299c4aa3d03bde9513351159 Mon Sep 17 00:00:00 2001
|
|
|
9c4e62 |
From: Tom Stellard <tstellar@redhat.com>
|
|
|
9c4e62 |
Date: Mon, 9 Jul 2018 10:35:30 -0700
|
|
|
9c4e62 |
Subject: [PATCH] Don't run BV DAG Combine before legalization if it assumes legal types
|
|
|
9c4e62 |
|
|
|
9c4e62 |
---
|
|
|
9c4e62 |
lib/Target/PowerPC/PPCISelLowering.cpp | 13 ++++++++++---
|
|
|
9c4e62 |
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
|
9c4e62 |
|
|
|
9c4e62 |
diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp
|
|
|
9c4e62 |
index 4966e88..378e494 100644
|
|
|
9c4e62 |
--- a/lib/Target/PowerPC/PPCISelLowering.cpp
|
|
|
9c4e62 |
+++ b/lib/Target/PowerPC/PPCISelLowering.cpp
|
|
|
9c4e62 |
@@ -11923,10 +11923,15 @@ static SDValue combineBVOfVecSExt(SDNode *N, SelectionDAG &DAG) {
|
|
|
9c4e62 |
auto isSExtOfVecExtract = [&](SDValue Op) -> bool {
|
|
|
9c4e62 |
if (!Op)
|
|
|
9c4e62 |
return false;
|
|
|
9c4e62 |
- if (Op.getOpcode() != ISD::SIGN_EXTEND)
|
|
|
9c4e62 |
+ if (Op.getOpcode() != ISD::SIGN_EXTEND &&
|
|
|
9c4e62 |
+ Op.getOpcode() != ISD::SIGN_EXTEND_INREG)
|
|
|
9c4e62 |
return false;
|
|
|
9c4e62 |
|
|
|
9c4e62 |
+ // A SIGN_EXTEND_INREG might be fed by an ANY_EXTEND to produce a value
|
|
|
9c4e62 |
+ // of the right width.
|
|
|
9c4e62 |
SDValue Extract = Op.getOperand(0);
|
|
|
9c4e62 |
+ if (Extract.getOpcode() == ISD::ANY_EXTEND)
|
|
|
9c4e62 |
+ Extract = Extract.getOperand(0);
|
|
|
9c4e62 |
if (Extract.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
|
|
|
9c4e62 |
return false;
|
|
|
9c4e62 |
|
|
|
9c4e62 |
@@ -12014,8 +12019,10 @@ SDValue PPCTargetLowering::DAGCombineBuildVector(SDNode *N,
|
|
|
9c4e62 |
return Reduced;
|
|
|
9c4e62 |
|
|
|
9c4e62 |
// If we're building a vector out of extended elements from another vector
|
|
|
9c4e62 |
- // we have P9 vector integer extend instructions.
|
|
|
9c4e62 |
- if (Subtarget.hasP9Altivec()) {
|
|
|
9c4e62 |
+ // we have P9 vector integer extend instructions. The code assumes legal
|
|
|
9c4e62 |
+ // input types (i.e. it can't handle things like v4i16) so do not run before
|
|
|
9c4e62 |
+ // legalization.
|
|
|
9c4e62 |
+ if (Subtarget.hasP9Altivec() && !DCI.isBeforeLegalize()) {
|
|
|
9c4e62 |
Reduced = combineBVOfVecSExt(N, DAG);
|
|
|
9c4e62 |
if (Reduced)
|
|
|
9c4e62 |
return Reduced;
|
|
|
9c4e62 |
--
|
|
|
9c4e62 |
1.8.3.1
|
|
|
9c4e62 |
|