llvm.org GIT mirror llvm / 6cc4b8d
Dont merge consecutive loads/stores into vectors when noimplicitfloat is used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175190 91177308-0d34-0410-b5e6-96231b3b80d8 Nadav Rotem 7 years ago
2 changed file(s) with 44 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
77017701 bool DAGCombiner::MergeConsecutiveStores(StoreSDNode* St) {
77027702 EVT MemVT = St->getMemoryVT();
77037703 int64_t ElementSizeBytes = MemVT.getSizeInBits()/8;
7704 bool NoVectors = DAG.getMachineFunction().getFunction()->getAttributes().
7705 hasAttribute(AttributeSet::FunctionIndex, Attribute::NoImplicitFloat);
77047706
77057707 // Don't merge vectors into wider inputs.
77067708 if (MemVT.isVector() || !MemVT.isSimple())
78767878
78777879 // We only use vectors if the constant is known to be zero and the
78787880 // function is not marked with the noimplicitfloat attribute.
7879 if (NonZero || (DAG.getMachineFunction().getFunction()->getAttributes().
7880 hasAttribute(AttributeSet::FunctionIndex,
7881 Attribute::NoImplicitFloat)))
7881 if (NonZero || NoVectors)
78827882 LastLegalVectorType = 0;
78837883
78847884 // Check if we found a legal integer type to store.
78857885 if (LastLegalType == 0 && LastLegalVectorType == 0)
78867886 return false;
78877887
7888 bool UseVector = LastLegalVectorType > LastLegalType;
7888 bool UseVector = (LastLegalVectorType > LastLegalType) && !NoVectors;
78897889 unsigned NumElem = UseVector ? LastLegalVectorType : LastLegalType;
78907890
78917891 // Make sure we have something to merge.
80388038 // All loads much share the same chain.
80398039 if (LoadNodes[i].MemNode->getChain() != FirstChain)
80408040 break;
8041
8041
80428042 int64_t CurrAddress = LoadNodes[i].OffsetFromBase;
80438043 if (CurrAddress - StartAddress != (ElementSizeBytes * i))
80448044 break;
80588058
80598059 // Only use vector types if the vector type is larger than the integer type.
80608060 // If they are the same, use integers.
8061 bool UseVectorTy = LastLegalVectorType > LastLegalIntegerType;
8061 bool UseVectorTy = LastLegalVectorType > LastLegalIntegerType && !NoVectors;
80628062 unsigned LastLegalType = std::max(LastLegalVectorType, LastLegalIntegerType);
80638063
80648064 // We add +1 here because the LastXXX variables refer to location while
3939 ret void
4040 }
4141
42 ; Move the constants using a single vector store.
43 ; CHECK: merge_const_store_vec
44 ; CHECK: vmovups
42 ; No vectors because we use noimplicitfloat
43 ; CHECK: merge_const_store_no_vec
44 ; CHECK-NOT: vmovups
4545 ; CHECK: ret
46 define void @merge_const_store_vec(i32 %count, %struct.B* nocapture %p) nounwind uwtable noinline ssp {
46 define void @merge_const_store_no_vec(i32 %count, %struct.B* nocapture %p) noimplicitfloat{
4747 %1 = icmp sgt i32 %count, 0
4848 br i1 %1, label %.lr.ph, label %._crit_edge
4949 .lr.ph:
7373 ret void
7474 }
7575
76 ; Move the constants using a single vector store.
77 ; CHECK: merge_const_store_vec
78 ; CHECK: vmovups
79 ; CHECK: ret
80 define void @merge_const_store_vec(i32 %count, %struct.B* nocapture %p) nounwind uwtable noinline ssp {
81 %1 = icmp sgt i32 %count, 0
82 br i1 %1, label %.lr.ph, label %._crit_edge
83 .lr.ph:
84 %i.02 = phi i32 [ %10, %.lr.ph ], [ 0, %0 ]
85 %.01 = phi %struct.B* [ %11, %.lr.ph ], [ %p, %0 ]
86 %2 = getelementptr inbounds %struct.B* %.01, i64 0, i32 0
87 store i32 0, i32* %2, align 4
88 %3 = getelementptr inbounds %struct.B* %.01, i64 0, i32 1
89 store i32 0, i32* %3, align 4
90 %4 = getelementptr inbounds %struct.B* %.01, i64 0, i32 2
91 store i32 0, i32* %4, align 4
92 %5 = getelementptr inbounds %struct.B* %.01, i64 0, i32 3
93 store i32 0, i32* %5, align 4
94 %6 = getelementptr inbounds %struct.B* %.01, i64 0, i32 4
95 store i32 0, i32* %6, align 4
96 %7 = getelementptr inbounds %struct.B* %.01, i64 0, i32 5
97 store i32 0, i32* %7, align 4
98 %8 = getelementptr inbounds %struct.B* %.01, i64 0, i32 6
99 store i32 0, i32* %8, align 4
100 %9 = getelementptr inbounds %struct.B* %.01, i64 0, i32 7
101 store i32 0, i32* %9, align 4
102 %10 = add nsw i32 %i.02, 1
103 %11 = getelementptr inbounds %struct.B* %.01, i64 1
104 %exitcond = icmp eq i32 %10, %count
105 br i1 %exitcond, label %._crit_edge, label %.lr.ph
106 ._crit_edge:
107 ret void
108 }
109
76110 ; Move the first 4 constants as a single vector. Move the rest as scalars.
77111 ; CHECK: merge_nonconst_store
78112 ; CHECK: movl $67305985