summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-04-22 20:21:36 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-04-22 20:21:36 +0000
commit629d12de70959f49f0b8f78eb9e6e217103a24c7 (patch)
treeb4b1bfc0306ed7cbc5a790a87418dc1e473f3d7e /llvm/include
parent66ac1d61526268d1f81db8ed1d5caccfed2452ec (diff)
downloadbcm5719-llvm-629d12de70959f49f0b8f78eb9e6e217103a24c7.tar.gz
bcm5719-llvm-629d12de70959f49f0b8f78eb9e6e217103a24c7.zip
DAGCombiner: Relax alignment restriction when changing load type
If the target allows the alignment, this should still be OK. llvm-svn: 267209
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Target/TargetLowering.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/include/llvm/Target/TargetLowering.h b/llvm/include/llvm/Target/TargetLowering.h
index 207436722d3..9b5ff57fea8 100644
--- a/llvm/include/llvm/Target/TargetLowering.h
+++ b/llvm/include/llvm/Target/TargetLowering.h
@@ -268,8 +268,21 @@ public:
/// efficiently, casting the load to a smaller vector of larger types and
/// loading is more efficient, however, this can be undone by optimizations in
/// dag combiner.
- virtual bool isLoadBitCastBeneficial(EVT /* Load */,
- EVT /* Bitcast */) const {
+ virtual bool isLoadBitCastBeneficial(EVT LoadVT,
+ EVT BitcastVT) const {
+ // Don't do if we could do an indexed load on the original type, but not on
+ // the new one.
+ if (!LoadVT.isSimple() || !BitcastVT.isSimple())
+ return true;
+
+ MVT LoadMVT = LoadVT.getSimpleVT();
+
+ // Don't bother doing this if it's just going to be promoted again later, as
+ // doing so might interfere with other combines.
+ if (getOperationAction(ISD::LOAD, LoadMVT) == Promote &&
+ getTypeToPromoteTo(ISD::LOAD, LoadMVT) == BitcastVT.getSimpleVT())
+ return false;
+
return true;
}
OpenPOWER on IntegriCloud