[llvm] r242033 - Cleanup after r241809 - remove uncessary call to std::sort
Silviu Baranga
silviu.baranga at arm.com
Mon Jul 13 07:48:25 PDT 2015
Author: sbaranga
Date: Mon Jul 13 09:48:24 2015
New Revision: 242033
URL: http://llvm.org/viewvc/llvm-project?rev=242033&view=rev
Log:
Cleanup after r241809 - remove uncessary call to std::sort
Summary:
The iteration order within a member of DepCands is deterministic
and therefore we don't have to sort the accesses within a member.
We also don't have to copy the indices of the pointers into a
vector, since we can iterate over the members of the class.
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D11145
Modified:
llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll
llvm/trunk/test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll
Modified: llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp?rev=242033&r1=242032&r2=242033&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopAccessAnalysis.cpp Mon Jul 13 09:48:24 2015
@@ -240,19 +240,14 @@ void LoopAccessInfo::RuntimePointerCheck
SmallVector<CheckingPtrGroup, 2> Groups;
auto LeaderI = DepCands.findValue(DepCands.getLeaderValue(Access));
- SmallVector<unsigned, 2> MemberIndices;
-
- // Get all indeces of the members of this equivalence class and sort them.
- // This will allow us to process all accesses in the order in which they
- // were added to the RuntimePointerCheck.
+ // Because DepCands is constructed by visiting accesses in the order in
+ // which they appear in alias sets (which is deterministic) and the
+ // iteration order within an equivalence class member is only dependent on
+ // the order in which unions and insertions are performed on the
+ // equivalence class, the iteration order is deterministic.
for (auto MI = DepCands.member_begin(LeaderI), ME = DepCands.member_end();
MI != ME; ++MI) {
unsigned Pointer = PositionMap[MI->getPointer()];
- MemberIndices.push_back(Pointer);
- }
- std::sort(MemberIndices.begin(), MemberIndices.end());
-
- for (unsigned Pointer : MemberIndices) {
bool Merged = false;
// Mark this pointer as seen.
Seen.insert(Pointer);
Modified: llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll?rev=242033&r1=242032&r2=242033&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll (original)
+++ llvm/trunk/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll Mon Jul 13 09:48:24 2015
@@ -82,26 +82,26 @@ for.end:
; CHECK: Run-time memory checks:
; CHECK-NEXT: Check 0:
; CHECK-NEXT: Comparing group 0:
-; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
+; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: Against group 1:
-; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %ind
; CHECK-NEXT: %arrayidxA1 = getelementptr inbounds i16, i16* %a, i64 %add
+; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %ind
; CHECK-NEXT: Check 1:
; CHECK-NEXT: Comparing group 0:
-; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
+; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: Against group 2:
; CHECK-NEXT: %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %ind
; CHECK-NEXT: Grouped accesses:
; CHECK-NEXT: Group 0:
; CHECK-NEXT: (Low: %c High: (78 + %c))
-; CHECK-NEXT: Member: {%c,+,4}
; CHECK-NEXT: Member: {(2 + %c),+,4}
+; CHECK-NEXT: Member: {%c,+,4}
; CHECK-NEXT: Group 1:
; CHECK-NEXT: (Low: %a High: (40 + %a))
-; CHECK-NEXT: Member: {%a,+,2}
; CHECK-NEXT: Member: {(2 + %a),+,2}
+; CHECK-NEXT: Member: {%a,+,2}
; CHECK-NEXT: Group 2:
; CHECK-NEXT: (Low: %b High: (38 + %b))
; CHECK-NEXT: Member: {%b,+,2}
@@ -154,26 +154,26 @@ for.end:
; CHECK: Run-time memory checks:
; CHECK-NEXT: Check 0:
; CHECK-NEXT: Comparing group 0:
-; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
+; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: Against group 1:
-; CHECK-NEXT: %arrayidxA = getelementptr i16, i16* %a, i64 %ind
; CHECK-NEXT: %arrayidxA1 = getelementptr i16, i16* %a, i64 %add
+; CHECK-NEXT: %arrayidxA = getelementptr i16, i16* %a, i64 %ind
; CHECK-NEXT: Check 1:
; CHECK-NEXT: Comparing group 0:
-; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: %arrayidxC1 = getelementptr inbounds i16, i16* %c, i64 %store_ind_inc
+; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %store_ind
; CHECK-NEXT: Against group 2:
; CHECK-NEXT: %arrayidxB = getelementptr i16, i16* %b, i64 %ind
; CHECK-NEXT: Grouped accesses:
; CHECK-NEXT: Group 0:
; CHECK-NEXT: (Low: %c High: (78 + %c))
-; CHECK-NEXT: Member: {%c,+,4}
; CHECK-NEXT: Member: {(2 + %c),+,4}
+; CHECK-NEXT: Member: {%c,+,4}
; CHECK-NEXT: Group 1:
; CHECK-NEXT: (Low: %a High: (40 + %a))
-; CHECK-NEXT: Member: {%a,+,2}
; CHECK-NEXT: Member: {(2 + %a),+,2}
+; CHECK-NEXT: Member: {%a,+,2}
; CHECK-NEXT: Group 2:
; CHECK-NEXT: (Low: %b High: (38 + %b))
; CHECK-NEXT: Member: {%b,+,2}
Modified: llvm/trunk/test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll?rev=242033&r1=242032&r2=242033&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll (original)
+++ llvm/trunk/test/Analysis/LoopAccessAnalysis/unsafe-and-rt-checks.ll Mon Jul 13 09:48:24 2015
@@ -15,14 +15,14 @@ target triple = "x86_64-apple-macosx10.1
; CHECK: Run-time memory checks:
; CHECK-NEXT: 0:
; CHECK-NEXT: Comparing group
-; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3
+; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
; CHECK-NEXT: Against group
; CHECK-NEXT: %arrayidxB = getelementptr inbounds i16, i16* %b, i64 %storemerge3
; CHECK-NEXT: 1:
; CHECK-NEXT: Comparing group
-; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
; CHECK-NEXT: %arrayidxA = getelementptr inbounds i16, i16* %a, i64 %storemerge3
+; CHECK-NEXT: %arrayidxA_plus_2 = getelementptr inbounds i16, i16* %a, i64 %add
; CHECK-NEXT: Against group
; CHECK-NEXT: %arrayidxC = getelementptr inbounds i16, i16* %c, i64 %storemerge3
More information about the llvm-commits
mailing list