summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelLowering.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-09-29 18:15:26 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-09-29 18:15:26 +0000
commita2efe82b8160e9e72b94899cdcee21c7a6ec3797 (patch)
treed1f1cfea5ef792de431bad9dd2d71180af67da1e /llvm/lib/Target/X86/X86ISelLowering.cpp
parent845789e823c5a57bcd5b3a0284b3d51dfe9ec9d7 (diff)
downloadbcm5719-llvm-a2efe82b8160e9e72b94899cdcee21c7a6ec3797.tar.gz
bcm5719-llvm-a2efe82b8160e9e72b94899cdcee21c7a6ec3797.zip
[X86] SimplifyDemandedVectorEltsForTargetNode - remove identity target shuffles before simplifying inputs
By removing demanded target shuffles that simplify to zero/undef/identity before simplifying its inputs we improve chances of further simplification, as only the immediate parent user of the combined is added back to the work list - this still doesn't help us if its passed through other ops though (bitcasts....). llvm-svn: 343390
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 6a131cd1277..356c445f7ab 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -31732,25 +31732,8 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
[VT](SDValue V) { return VT != V.getValueType(); }))
return false;
- // Attempt to simplify inputs.
- int NumSrcs = OpInputs.size();
- for (int Src = 0; Src != NumSrcs; ++Src) {
- int Lo = Src * NumElts;
- APInt SrcElts = APInt::getNullValue(NumElts);
- for (int i = 0; i != NumElts; ++i)
- if (DemandedElts[i]) {
- int M = OpMask[i] - Lo;
- if (0 <= M && M < NumElts)
- SrcElts.setBit(M);
- }
-
- APInt SrcUndef, SrcZero;
- if (SimplifyDemandedVectorElts(OpInputs[Src], SrcElts, SrcUndef, SrcZero,
- TLO, Depth + 1))
- return true;
- }
-
// Check if shuffle mask can be simplified to undef/zero/identity.
+ int NumSrcs = OpInputs.size();
for (int i = 0; i != NumElts; ++i)
if (!DemandedElts[i])
OpMask[i] = SM_SentinelUndef;
@@ -31768,6 +31751,23 @@ bool X86TargetLowering::SimplifyDemandedVectorEltsForTargetNode(
if (isSequentialOrUndefInRange(OpMask, 0, NumElts, Src * NumElts))
return TLO.CombineTo(Op, OpInputs[Src]);
+ // Attempt to simplify inputs.
+ for (int Src = 0; Src != NumSrcs; ++Src) {
+ int Lo = Src * NumElts;
+ APInt SrcElts = APInt::getNullValue(NumElts);
+ for (int i = 0; i != NumElts; ++i)
+ if (DemandedElts[i]) {
+ int M = OpMask[i] - Lo;
+ if (0 <= M && M < NumElts)
+ SrcElts.setBit(M);
+ }
+
+ APInt SrcUndef, SrcZero;
+ if (SimplifyDemandedVectorElts(OpInputs[Src], SrcElts, SrcUndef, SrcZero,
+ TLO, Depth + 1))
+ return true;
+ }
+
// Extract known zero/undef elements.
// TODO - Propagate input undef/zero elts.
for (int i = 0; i != NumElts; ++i) {
OpenPOWER on IntegriCloud