[llvm] r290954 - [ADT] Speculative attempt to fix build bot issues with r290952.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 03:40:18 PST 2017
Author: chandlerc
Date: Wed Jan 4 05:40:18 2017
New Revision: 290954
URL: http://llvm.org/viewvc/llvm-project?rev=290954&view=rev
Log:
[ADT] Speculative attempt to fix build bot issues with r290952.
This just removes the usage of llvm::reverse and llvm::seq. That makes
it harder to handle the empty case correctly and so I've also added
a test there.
This is just a shot in the dark at what might be behind the buildbot
failures. I can't reproduce any issues locally including with ASan...
I feel like I'm missing something...
Modified:
llvm/trunk/include/llvm/ADT/PriorityWorklist.h
llvm/trunk/unittests/ADT/PriorityWorklistTest.cpp
Modified: llvm/trunk/include/llvm/ADT/PriorityWorklist.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PriorityWorklist.h?rev=290954&r1=290953&r2=290954&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PriorityWorklist.h (original)
+++ llvm/trunk/include/llvm/ADT/PriorityWorklist.h Wed Jan 4 05:40:18 2017
@@ -112,12 +112,16 @@ public:
template <typename SequenceT>
typename std::enable_if<!std::is_convertible<SequenceT, T>::value>::type
insert(SequenceT &&Input) {
+ if (std::begin(Input) == std::end(Input))
+ // Nothing to do for an empty input sequence.
+ return;
+
// First pull the input sequence into the vector as a bulk append
// operation.
ptrdiff_t StartIndex = V.size();
V.insert(V.end(), std::begin(Input), std::end(Input));
// Now walk backwards fixing up the index map and deleting any duplicates.
- for (auto i : reverse(seq<ptrdiff_t>(StartIndex, V.size()))) {
+ for (ptrdiff_t i = V.size() - 1; i >= StartIndex; --i) {
auto InsertResult = M.insert({V[i], i});
if (InsertResult.second)
continue;
Modified: llvm/trunk/unittests/ADT/PriorityWorklistTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/PriorityWorklistTest.cpp?rev=290954&r1=290953&r2=290954&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/PriorityWorklistTest.cpp (original)
+++ llvm/trunk/unittests/ADT/PriorityWorklistTest.cpp Wed Jan 4 05:40:18 2017
@@ -109,6 +109,14 @@ TYPED_TEST(PriorityWorklistTest, InsertS
EXPECT_EQ(7, W.pop_back_val());
EXPECT_EQ(2, W.pop_back_val());
ASSERT_TRUE(W.empty());
+
+ ASSERT_TRUE(W.insert(2));
+ ASSERT_TRUE(W.insert(7));
+ // Inserting an empty sequence does nothing.
+ W.insert(std::vector<int>());
+ EXPECT_EQ(7, W.pop_back_val());
+ EXPECT_EQ(2, W.pop_back_val());
+ ASSERT_TRUE(W.empty());
}
TYPED_TEST(PriorityWorklistTest, EraseIf) {
More information about the llvm-commits
mailing list