summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-07-11 18:09:04 +0000
committerCraig Topper <craig.topper@intel.com>2018-07-11 18:09:04 +0000
commit38b290f7d72f67f9daca7d8ab3e32ffd90689cb8 (patch)
tree7b7b22590be2526b74fa9a6f07e1276d47686e35 /llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
parent667a5b541fac4930898b2a75541781f4201f106d (diff)
downloadbcm5719-llvm-38b290f7d72f67f9daca7d8ab3e32ffd90689cb8.tar.gz
bcm5719-llvm-38b290f7d72f67f9daca7d8ab3e32ffd90689cb8.zip
[X86] Remove patterns for inserting a load into a zero vector.
We can instead block the load folding isProfitableToFold. Then isel will emit a register->register move for the zeroing part and a separate load. The PostProcessISelDAG should be able to remove the register->register move. This saves us patterns and fixes the fact that we only had unaligned load patterns. The test changes show places where we should have been using an aligned load. llvm-svn: 336828
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelDAGToDAG.cpp')
-rw-r--r--llvm/lib/Target/X86/X86ISelDAGToDAG.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 3b903dafe2c..4ebb50d9817 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -614,9 +614,12 @@ X86DAGToDAGISel::IsProfitableToFold(SDValue N, SDNode *U, SDNode *Root) const {
}
}
- // Prevent folding a load if this can implemented with an insert_subreg.
+ // Prevent folding a load if this can implemented with an insert_subreg or
+ // a move that implicitly zeroes.
if (Root->getOpcode() == ISD::INSERT_SUBVECTOR &&
- Root->getOperand(0).isUndef() && isNullConstant(Root->getOperand(2)))
+ isNullConstant(Root->getOperand(2)) &&
+ (Root->getOperand(0).isUndef() ||
+ ISD::isBuildVectorAllZeros(Root->getOperand(0).getNode())))
return false;
return true;
OpenPOWER on IntegriCloud