1 # http://lists.llvm.org/pipermail/llvm-dev/2015-October/091115.html |
|
2 # - 22031298 - toxic bugs in LLVM ilist/plist end up eliminating entire |
|
3 # MachineBasicBlocks |
|
4 # - Presumed fixed (?) in trunk upstream. Not verified. |
|
5 # - Verified fixed in our 3.6.2 fork. |
|
6 # Not for upstream. Autoconf-based built system is removed in 3.8.X. |
|
7 --- Makefile.rules 2015-10-05 11:01:32.687305595 -0700 |
|
8 +++ Makefile.rules 2015-12-08 11:12:41.094567698 -0800 |
|
9 @@ -331,6 +331,12 @@ |
|
10 endif |
|
11 endif |
|
12 |
|
13 +ifeq ($(HOST_OS), $(filter $(HOST_OS), SunOS)) |
|
14 + REQUIRES_EH := 1 |
|
15 +else |
|
16 + REQUIRES_EH := 0 |
|
17 +endif |
|
18 + |
|
19 ifeq ($(ENABLE_WERROR),1) |
|
20 CXX.Flags += -Werror |
|
21 C.Flags += -Werror |
|
22 @@ -355,14 +361,16 @@ |
|
23 endif |
|
24 |
|
25 # IF REQUIRES_EH=1 is specified then don't disable exceptions |
|
26 -ifndef REQUIRES_EH |
|
27 +ifneq ($(REQUIRES_EH), 1) |
|
28 + REQUIRES_RTTI := 0 |
|
29 CXX.Flags += -fno-exceptions |
|
30 else |
|
31 # If the library requires EH, it also requires RTTI. |
|
32 REQUIRES_RTTI := 1 |
|
33 + CXX.Flags += -fexceptions |
|
34 endif |
|
35 |
|
36 -ifdef REQUIRES_FRAME_POINTER |
|
37 +ifeq ($(REQUIRES_FRAME_POINTER), 1) |
|
38 CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) |
|
39 C.Flags := $(filter-out -fomit-frame-pointer,$(C.Flags)) |
|
40 LD.Flags := $(filter-out -fomit-frame-pointer,$(LD.Flags)) |
|
41 @@ -371,6 +379,8 @@ |
|
42 # If REQUIRES_RTTI=1 is specified then don't disable run-time type id. |
|
43 ifneq ($(REQUIRES_RTTI), 1) |
|
44 CXX.Flags += -fno-rtti |
|
45 +else |
|
46 + CXX.Flags += -frtti |
|
47 endif |
|
48 |
|
49 ifeq ($(ENABLE_COVERAGE),1) |
|
50 --- include/llvm/ADT/DenseMap.h 2015-10-05 11:01:32.000000000 -0700 |
|
51 +++ include/llvm/ADT/DenseMap.h 2016-01-24 14:13:03.000000000 -0800 |
|
52 @@ -254,7 +254,7 @@ |
|
53 DenseMapBase() {} |
|
54 |
|
55 void destroyAll() { |
|
56 - if ((getNumBuckets() == 0) || empty()) // Nothing to do. |
|
57 + if (getNumBuckets() == 0) // Nothing to do. |
|
58 return; |
|
59 |
|
60 const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); |
|
61 @@ -264,10 +264,6 @@ |
|
62 P->getSecond().~ValueT(); |
|
63 P->getFirst().~KeyT(); |
|
64 } |
|
65 - |
|
66 -#ifndef NDEBUG |
|
67 - memset((void*)getBuckets(), 0x5a, sizeof(BucketT)*getNumBuckets()); |
|
68 -#endif |
|
69 } |
|
70 |
|
71 void initEmpty() { |
|
72 @@ -856,7 +852,8 @@ |
|
73 |
|
74 // First move the inline buckets into a temporary storage. |
|
75 AlignedCharArrayUnion<BucketT[InlineBuckets]> TmpStorage; |
|
76 - BucketT *TmpBegin = reinterpret_cast<BucketT *>(TmpStorage.buffer); |
|
77 + BucketT *TmpBegin = |
|
78 + reinterpret_cast<BucketT*>(reinterpret_cast<void*>(TmpStorage.buffer)); |
|
79 BucketT *TmpEnd = TmpBegin; |
|
80 |
|
81 // Loop over the buckets, moving non-empty, non-tombstones into the |
|
82 @@ -940,17 +937,22 @@ |
|
83 // Note that this cast does not violate aliasing rules as we assert that |
|
84 // the memory's dynamic type is the small, inline bucket buffer, and the |
|
85 // 'storage.buffer' static type is 'char *'. |
|
86 - return reinterpret_cast<const BucketT *>(storage.buffer); |
|
87 + return reinterpret_cast<const BucketT*>( |
|
88 + reinterpret_cast<const void*>(storage.buffer)); |
|
89 } |
|
90 + |
|
91 BucketT *getInlineBuckets() { |
|
92 return const_cast<BucketT *>( |
|
93 const_cast<const SmallDenseMap *>(this)->getInlineBuckets()); |
|
94 } |
|
95 + |
|
96 const LargeRep *getLargeRep() const { |
|
97 assert(!Small); |
|
98 // Note, same rule about aliasing as with getInlineBuckets. |
|
99 - return reinterpret_cast<const LargeRep *>(storage.buffer); |
|
100 + return reinterpret_cast<const LargeRep*>( |
|
101 + reinterpret_cast<const void*>(storage.buffer)); |
|
102 } |
|
103 + |
|
104 LargeRep *getLargeRep() { |
|
105 return const_cast<LargeRep *>( |
|
106 const_cast<const SmallDenseMap *>(this)->getLargeRep()); |
|
107 --- include/llvm/ADT/Optional.h 2014-09-30 19:12:35.000000000 -0700 |
|
108 +++ include/llvm/ADT/Optional.h 2015-12-07 14:59:03.998240128 -0800 |
|
109 @@ -163,16 +163,34 @@ |
|
110 reset(); |
|
111 } |
|
112 |
|
113 - const T* getPointer() const { assert(hasVal); return reinterpret_cast<const T*>(storage.buffer); } |
|
114 - T* getPointer() { assert(hasVal); return reinterpret_cast<T*>(storage.buffer); } |
|
115 - const T& getValue() const LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); } |
|
116 + const T* getPointer() const { |
|
117 + assert(hasVal); |
|
118 + return reinterpret_cast<const T*>( |
|
119 + reinterpret_cast<const void*>(storage.buffer)); |
|
120 + } |
|
121 + |
|
122 + T* getPointer() { |
|
123 + assert(hasVal); |
|
124 + return reinterpret_cast<T*>( |
|
125 + reinterpret_cast<void*>(storage.buffer)); |
|
126 + } |
|
127 + |
|
128 + const T& getValue() const LLVM_LVALUE_FUNCTION { |
|
129 + assert(hasVal); |
|
130 + return *getPointer(); |
|
131 + } |
|
132 + |
|
133 T& getValue() LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); } |
|
134 |
|
135 LLVM_EXPLICIT operator bool() const { return hasVal; } |
|
136 bool hasValue() const { return hasVal; } |
|
137 const T* operator->() const { return getPointer(); } |
|
138 T* operator->() { return getPointer(); } |
|
139 - const T& operator*() const LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); } |
|
140 + const T& operator*() const LLVM_LVALUE_FUNCTION { |
|
141 + assert(hasVal); |
|
142 + return *getPointer(); |
|
143 + } |
|
144 + |
|
145 T& operator*() LLVM_LVALUE_FUNCTION { assert(hasVal); return *getPointer(); } |
|
146 |
|
147 template <typename U> |
|
148 --- include/llvm/ADT/ilist.h 2014-07-28 17:38:55.000000000 -0700 |
|
149 +++ include/llvm/ADT/ilist.h 2015-11-10 13:51:33.696789150 -0800 |
|
150 @@ -104,6 +104,53 @@ |
|
151 } |
|
152 }; |
|
153 |
|
154 +template <typename NodeTy> class ilist_half_node; |
|
155 +template <typename NodeTy> class ilist_node; |
|
156 + |
|
157 +/// Traits with an embedded ilist_node as a sentinel. |
|
158 +/// |
|
159 +/// FIXME: The downcast in createSentinel() is UB. |
|
160 +template <typename NodeTy> struct ilist_embedded_sentinel_traits { |
|
161 + /// Get hold of the node that marks the end of the list. |
|
162 + NodeTy *createSentinel() const { |
|
163 + // Since i(p)lists always publicly derive from their corresponding traits, |
|
164 + // placing a data member in this class will augment the i(p)list. But since |
|
165 + // the NodeTy is expected to be publicly derive from ilist_node<NodeTy>, |
|
166 + // there is a legal viable downcast from it to NodeTy. We use this trick to |
|
167 + // superimpose an i(p)list with a "ghostly" NodeTy, which becomes the |
|
168 + // sentinel. Dereferencing the sentinel is forbidden (save the |
|
169 + // ilist_node<NodeTy>), so no one will ever notice the superposition. |
|
170 + return static_cast<NodeTy *>(&Sentinel); |
|
171 + } |
|
172 + static void destroySentinel(NodeTy *) {} |
|
173 + |
|
174 + NodeTy *provideInitialHead() const { return createSentinel(); } |
|
175 + NodeTy *ensureHead(NodeTy *) const { return createSentinel(); } |
|
176 + static void noteHead(NodeTy *, NodeTy *) {} |
|
177 + |
|
178 +private: |
|
179 + mutable ilist_node<NodeTy> Sentinel; |
|
180 +}; |
|
181 + |
|
182 +/// Trait with an embedded ilist_half_node as a sentinel. |
|
183 +/// |
|
184 +/// FIXME: The downcast in createSentinel() is UB. |
|
185 +template <typename NodeTy> struct ilist_half_embedded_sentinel_traits { |
|
186 + /// Get hold of the node that marks the end of the list. |
|
187 + NodeTy *createSentinel() const { |
|
188 + // See comment in ilist_embedded_sentinel_traits::createSentinel(). |
|
189 + return static_cast<NodeTy *>(&Sentinel); |
|
190 + } |
|
191 + static void destroySentinel(NodeTy *) {} |
|
192 + |
|
193 + NodeTy *provideInitialHead() const { return createSentinel(); } |
|
194 + NodeTy *ensureHead(NodeTy *) const { return createSentinel(); } |
|
195 + static void noteHead(NodeTy *, NodeTy *) {} |
|
196 + |
|
197 +private: |
|
198 + mutable ilist_half_node<NodeTy> Sentinel; |
|
199 +}; |
|
200 + |
|
201 /// ilist_node_traits - A fragment for template traits for intrusive list |
|
202 /// that provides default node related operations. |
|
203 /// |
|
204 @@ -173,8 +220,8 @@ |
|
205 template<class T> void operator-(T) const; |
|
206 public: |
|
207 |
|
208 - ilist_iterator(pointer NP) : NodePtr(NP) {} |
|
209 - ilist_iterator(reference NR) : NodePtr(&NR) {} |
|
210 + explicit ilist_iterator(pointer NP) : NodePtr(NP) {} |
|
211 + explicit ilist_iterator(reference NR) : NodePtr(&NR) {} |
|
212 ilist_iterator() : NodePtr(nullptr) {} |
|
213 |
|
214 // This is templated so that we can allow constructing a const iterator from |
|
215 @@ -191,8 +238,10 @@ |
|
216 return *this; |
|
217 } |
|
218 |
|
219 + void reset(pointer NP) { NodePtr = NP; } |
|
220 + |
|
221 // Accessors... |
|
222 - operator pointer() const { |
|
223 + explicit operator pointer() const { |
|
224 return NodePtr; |
|
225 } |
|
226 |
|
227 @@ -237,14 +286,14 @@ |
|
228 // These are to catch errors when people try to use them as random access |
|
229 // iterators. |
|
230 template<typename T> |
|
231 -void operator-(int, ilist_iterator<T>) LLVM_DELETED_FUNCTION; |
|
232 +void operator-(int, ilist_iterator<T>) = delete; |
|
233 template<typename T> |
|
234 -void operator-(ilist_iterator<T>,int) LLVM_DELETED_FUNCTION; |
|
235 +void operator-(ilist_iterator<T>,int) = delete; |
|
236 |
|
237 template<typename T> |
|
238 -void operator+(int, ilist_iterator<T>) LLVM_DELETED_FUNCTION; |
|
239 +void operator+(int, ilist_iterator<T>) = delete; |
|
240 template<typename T> |
|
241 -void operator+(ilist_iterator<T>,int) LLVM_DELETED_FUNCTION; |
|
242 +void operator+(ilist_iterator<T>,int) = delete; |
|
243 |
|
244 // operator!=/operator== - Allow mixed comparisons without dereferencing |
|
245 // the iterator, which could very likely be pointing to end(). |
|
246 @@ -332,8 +381,8 @@ |
|
247 |
|
248 // No fundamental reason why iplist can't be copyable, but the default |
|
249 // copy/copy-assign won't do. |
|
250 - iplist(const iplist &) LLVM_DELETED_FUNCTION; |
|
251 - void operator=(const iplist &) LLVM_DELETED_FUNCTION; |
|
252 + iplist(const iplist &) = delete; |
|
253 + void operator=(const iplist &) = delete; |
|
254 |
|
255 public: |
|
256 typedef NodeTy *pointer; |
|
257 @@ -422,7 +471,7 @@ |
|
258 this->setPrev(CurNode, New); |
|
259 |
|
260 this->addNodeToList(New); // Notify traits that we added a node... |
|
261 - return New; |
|
262 + return iterator(New); |
|
263 } |
|
264 |
|
265 iterator insertAfter(iterator where, NodeTy *New) { |
|
266 @@ -443,7 +492,7 @@ |
|
267 else |
|
268 Head = NextNode; |
|
269 this->setPrev(NextNode, PrevNode); |
|
270 - IT = NextNode; |
|
271 + IT.reset(NextNode); |
|
272 this->removeNodeFromList(Node); // Notify traits that we removed a node... |
|
273 |
|
274 // Set the next/prev pointers of the current node to null. This isn't |
|
275 @@ -461,12 +510,18 @@ |
|
276 return remove(MutIt); |
|
277 } |
|
278 |
|
279 + NodeTy *remove(NodeTy *IT) { return remove(iterator(IT)); } |
|
280 + NodeTy *remove(NodeTy &IT) { return remove(iterator(IT)); } |
|
281 + |
|
282 // erase - remove a node from the controlled sequence... and delete it. |
|
283 iterator erase(iterator where) { |
|
284 this->deleteNode(remove(where)); |
|
285 return where; |
|
286 } |
|
287 |
|
288 + iterator erase(NodeTy *IT) { return erase(iterator(IT)); } |
|
289 + iterator erase(NodeTy &IT) { return erase(iterator(IT)); } |
|
290 + |
|
291 /// Remove all nodes from the list like clear(), but do not call |
|
292 /// removeNodeFromList() or deleteNode(). |
|
293 /// |
|
294 @@ -522,7 +577,7 @@ |
|
295 this->setNext(Last, PosNext); |
|
296 this->setPrev(PosNext, Last); |
|
297 |
|
298 - this->transferNodesFromList(L2, First, PosNext); |
|
299 + this->transferNodesFromList(L2, iterator(First), iterator(PosNext)); |
|
300 |
|
301 // Now that everything is set, restore the pointers to the list sentinels. |
|
302 L2.setTail(L2Sentinel); |
|
303 @@ -579,6 +634,59 @@ |
|
304 void splice(iterator where, iplist &L2, iterator first, iterator last) { |
|
305 if (first != last) transfer(where, L2, first, last); |
|
306 } |
|
307 + void splice(iterator where, iplist &L2, NodeTy &N) { |
|
308 + splice(where, L2, iterator(N)); |
|
309 + } |
|
310 + void splice(iterator where, iplist &L2, NodeTy *N) { |
|
311 + splice(where, L2, iterator(N)); |
|
312 + } |
|
313 + |
|
314 + template <class Compare> |
|
315 + void merge(iplist &Right, Compare comp) { |
|
316 + if (this == &Right) |
|
317 + return; |
|
318 + iterator First1 = begin(), Last1 = end(); |
|
319 + iterator First2 = Right.begin(), Last2 = Right.end(); |
|
320 + while (First1 != Last1 && First2 != Last2) { |
|
321 + if (comp(*First2, *First1)) { |
|
322 + iterator Next = First2; |
|
323 + transfer(First1, Right, First2, ++Next); |
|
324 + First2 = Next; |
|
325 + } else { |
|
326 + ++First1; |
|
327 + } |
|
328 + } |
|
329 + if (First2 != Last2) |
|
330 + transfer(Last1, Right, First2, Last2); |
|
331 + } |
|
332 + void merge(iplist &Right) { return merge(Right, op_less); } |
|
333 + |
|
334 + template <class Compare> |
|
335 + void sort(Compare comp) { |
|
336 + // The list is empty, vacuously sorted. |
|
337 + if (empty()) |
|
338 + return; |
|
339 + // The list has a single element, vacuously sorted. |
|
340 + if (std::next(begin()) == end()) |
|
341 + return; |
|
342 + // Find the split point for the list. |
|
343 + iterator Center = begin(), End = begin(); |
|
344 + while (End != end() && std::next(End) != end()) { |
|
345 + Center = std::next(Center); |
|
346 + End = std::next(std::next(End)); |
|
347 + } |
|
348 + // Split the list into two. |
|
349 + iplist RightHalf; |
|
350 + RightHalf.splice(RightHalf.begin(), *this, Center, end()); |
|
351 + |
|
352 + // Sort the two sublists. |
|
353 + sort(comp); |
|
354 + RightHalf.sort(comp); |
|
355 + |
|
356 + // Merge the two sublists back together. |
|
357 + merge(RightHalf, comp); |
|
358 + } |
|
359 + void sort() { sort(op_less); } |
|
360 }; |
|
361 |
|
362 |
|
363 --- include/llvm/ADT/ilist_node.h 2014-08-13 09:26:38.000000000 -0700 |
|
364 +++ include/llvm/ADT/ilist_node.h 2015-11-02 09:17:47.446456035 -0800 |
|
365 @@ -19,12 +19,15 @@ |
|
366 |
|
367 template<typename NodeTy> |
|
368 struct ilist_traits; |
|
369 +template <typename NodeTy> struct ilist_embedded_sentinel_traits; |
|
370 +template <typename NodeTy> struct ilist_half_embedded_sentinel_traits; |
|
371 |
|
372 /// ilist_half_node - Base class that provides prev services for sentinels. |
|
373 /// |
|
374 template<typename NodeTy> |
|
375 class ilist_half_node { |
|
376 friend struct ilist_traits<NodeTy>; |
|
377 + friend struct ilist_half_embedded_sentinel_traits<NodeTy>; |
|
378 NodeTy *Prev; |
|
379 protected: |
|
380 NodeTy *getPrev() { return Prev; } |
|
381 @@ -36,6 +39,8 @@ |
|
382 template<typename NodeTy> |
|
383 struct ilist_nextprev_traits; |
|
384 |
|
385 +template <typename NodeTy> class ilist_iterator; |
|
386 + |
|
387 /// ilist_node - Base class that provides next/prev services for nodes |
|
388 /// that use ilist_nextprev_traits or ilist_default_traits. |
|
389 /// |
|
390 @@ -43,6 +48,8 @@ |
|
391 class ilist_node : private ilist_half_node<NodeTy> { |
|
392 friend struct ilist_nextprev_traits<NodeTy>; |
|
393 friend struct ilist_traits<NodeTy>; |
|
394 + friend struct ilist_half_embedded_sentinel_traits<NodeTy>; |
|
395 + friend struct ilist_embedded_sentinel_traits<NodeTy>; |
|
396 NodeTy *Next; |
|
397 NodeTy *getNext() { return Next; } |
|
398 const NodeTy *getNext() const { return Next; } |
|
399 @@ -51,6 +58,15 @@ |
|
400 ilist_node() : Next(nullptr) {} |
|
401 |
|
402 public: |
|
403 + ilist_iterator<NodeTy> getIterator() { |
|
404 + // FIXME: Stop downcasting to create the iterator (potential UB). |
|
405 + return ilist_iterator<NodeTy>(static_cast<NodeTy *>(this)); |
|
406 + } |
|
407 + ilist_iterator<const NodeTy> getIterator() const { |
|
408 + // FIXME: Stop downcasting to create the iterator (potential UB). |
|
409 + return ilist_iterator<const NodeTy>(static_cast<const NodeTy *>(this)); |
|
410 + } |
|
411 + |
|
412 /// @name Adjacent Node Accessors |
|
413 /// @{ |
|
414 |
|
415 --- include/llvm/CodeGen/CommandFlags.h 2015-01-13 21:24:33.000000000 -0800 |
|
416 +++ include/llvm/CodeGen/CommandFlags.h 2016-01-26 14:46:39.000000000 -0800 |
|
417 @@ -31,7 +31,7 @@ |
|
418 MCPU("mcpu", |
|
419 cl::desc("Target a specific cpu type (-mcpu=help for details)"), |
|
420 cl::value_desc("cpu-name"), |
|
421 - cl::init("")); |
|
422 + cl::init(std::string(""))); |
|
423 |
|
424 cl::list<std::string> |
|
425 MAttrs("mattr", |
|
426 @@ -177,7 +177,7 @@ |
|
427 cl::opt<std::string> |
|
428 TrapFuncName("trap-func", cl::Hidden, |
|
429 cl::desc("Emit a call to trap function rather than a trap instruction"), |
|
430 - cl::init("")); |
|
431 + cl::init(std::string(""))); |
|
432 |
|
433 cl::opt<bool> |
|
434 EnablePIE("enable-pie", |
|
435 @@ -192,11 +192,11 @@ |
|
436 cl::opt<std::string> StopAfter("stop-after", |
|
437 cl::desc("Stop compilation after a specific pass"), |
|
438 cl::value_desc("pass-name"), |
|
439 - cl::init("")); |
|
440 + cl::init(std::string(""))); |
|
441 cl::opt<std::string> StartAfter("start-after", |
|
442 cl::desc("Resume compilation after a specific pass"), |
|
443 cl::value_desc("pass-name"), |
|
444 - cl::init("")); |
|
445 + cl::init(std::string(""))); |
|
446 |
|
447 cl::opt<bool> DataSections("data-sections", |
|
448 cl::desc("Emit data into separate sections"), |
|
449 @@ -258,7 +258,7 @@ |
|
450 // CFI. |
|
451 cl::opt<std::string> |
|
452 CFIFuncName("cfi-func-name", cl::desc("The name of the CFI function to call"), |
|
453 - cl::init("")); |
|
454 + cl::init(std::string(""))); |
|
455 |
|
456 // Common utility function tightly tied to the options listed here. Initializes |
|
457 // a TargetOptions object with CodeGen flags and returns it. |
|
458 --- include/llvm/CodeGen/MachineBasicBlock.h 2014-11-13 16:34:59.000000000 -0800 |
|
459 +++ include/llvm/CodeGen/MachineBasicBlock.h 2015-12-06 12:31:19.423838338 -0800 |
|
460 @@ -165,7 +165,7 @@ |
|
461 Ty &operator*() const { return *MII; } |
|
462 Ty *operator->() const { return &operator*(); } |
|
463 |
|
464 - operator Ty*() const { return MII; } |
|
465 + operator Ty*() const { return MII.getNodePtrUnchecked(); } |
|
466 |
|
467 bool operator==(const bundle_iterator &x) const { |
|
468 return MII == x.MII; |
|
469 --- include/llvm/CodeGen/MachineFunction.h 2015-01-06 12:05:02.000000000 -0800 |
|
470 +++ include/llvm/CodeGen/MachineFunction.h 2015-12-06 20:18:16.623633498 -0800 |
|
471 @@ -352,12 +352,10 @@ |
|
472 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE); |
|
473 } |
|
474 |
|
475 - void remove(iterator MBBI) { |
|
476 - BasicBlocks.remove(MBBI); |
|
477 - } |
|
478 - void erase(iterator MBBI) { |
|
479 - BasicBlocks.erase(MBBI); |
|
480 - } |
|
481 + void remove(iterator MBBI) { BasicBlocks.remove(MBBI); } |
|
482 + void remove(MachineBasicBlock *MBBI) { BasicBlocks.remove(MBBI); } |
|
483 + void erase(iterator MBBI) { BasicBlocks.erase(MBBI); } |
|
484 + void erase(MachineBasicBlock *MBBI) { BasicBlocks.erase(MBBI); } |
|
485 |
|
486 //===--------------------------------------------------------------------===// |
|
487 // Internal functions used to automatically number MachineBasicBlocks |
|
488 --- include/llvm/CodeGen/MachineInstrBuilder.h 2014-10-31 16:19:46.000000000 -0700 |
|
489 +++ include/llvm/CodeGen/MachineInstrBuilder.h 2015-12-06 13:48:56.344154780 -0800 |
|
490 @@ -280,7 +280,7 @@ |
|
491 const MCInstrDesc &MCID, |
|
492 unsigned DestReg) { |
|
493 if (I->isInsideBundle()) { |
|
494 - MachineBasicBlock::instr_iterator MII = I; |
|
495 + MachineBasicBlock::instr_iterator MII(I); |
|
496 return BuildMI(BB, MII, DL, MCID, DestReg); |
|
497 } |
|
498 |
|
499 @@ -317,7 +317,7 @@ |
|
500 DebugLoc DL, |
|
501 const MCInstrDesc &MCID) { |
|
502 if (I->isInsideBundle()) { |
|
503 - MachineBasicBlock::instr_iterator MII = I; |
|
504 + MachineBasicBlock::instr_iterator MII(I); |
|
505 return BuildMI(BB, MII, DL, MCID); |
|
506 } |
|
507 |
|
508 @@ -472,7 +472,7 @@ |
|
509 if (I == Begin) { |
|
510 if (!empty()) |
|
511 MI->bundleWithSucc(); |
|
512 - Begin = MI; |
|
513 + Begin = MI->getIterator(); |
|
514 return *this; |
|
515 } |
|
516 if (I == End) { |
|
517 --- include/llvm/CodeGen/MachineInstrBundle.h 2014-04-13 17:51:57.000000000 -0700 |
|
518 +++ include/llvm/CodeGen/MachineInstrBundle.h 2015-12-06 12:35:51.016366535 -0800 |
|
519 @@ -44,23 +44,23 @@ |
|
520 /// getBundleStart - Returns the first instruction in the bundle containing MI. |
|
521 /// |
|
522 inline MachineInstr *getBundleStart(MachineInstr *MI) { |
|
523 - MachineBasicBlock::instr_iterator I = MI; |
|
524 + MachineBasicBlock::instr_iterator I(MI); |
|
525 while (I->isBundledWithPred()) |
|
526 --I; |
|
527 - return I; |
|
528 + return &*I; |
|
529 } |
|
530 |
|
531 inline const MachineInstr *getBundleStart(const MachineInstr *MI) { |
|
532 - MachineBasicBlock::const_instr_iterator I = MI; |
|
533 + MachineBasicBlock::const_instr_iterator I(MI); |
|
534 while (I->isBundledWithPred()) |
|
535 --I; |
|
536 - return I; |
|
537 + return &*I; |
|
538 } |
|
539 |
|
540 /// Return an iterator pointing beyond the bundle containing MI. |
|
541 inline MachineBasicBlock::instr_iterator |
|
542 getBundleEnd(MachineInstr *MI) { |
|
543 - MachineBasicBlock::instr_iterator I = MI; |
|
544 + MachineBasicBlock::instr_iterator I(MI); |
|
545 while (I->isBundledWithSucc()) |
|
546 ++I; |
|
547 return ++I; |
|
548 @@ -69,7 +69,7 @@ |
|
549 /// Return an iterator pointing beyond the bundle containing MI. |
|
550 inline MachineBasicBlock::const_instr_iterator |
|
551 getBundleEnd(const MachineInstr *MI) { |
|
552 - MachineBasicBlock::const_instr_iterator I = MI; |
|
553 + MachineBasicBlock::const_instr_iterator I(MI); |
|
554 while (I->isBundledWithSucc()) |
|
555 ++I; |
|
556 return ++I; |
|
557 @@ -116,10 +116,10 @@ |
|
558 /// |
|
559 explicit MachineOperandIteratorBase(MachineInstr *MI, bool WholeBundle) { |
|
560 if (WholeBundle) { |
|
561 - InstrI = getBundleStart(MI); |
|
562 + InstrI = getBundleStart(MI)->getIterator(); |
|
563 InstrE = MI->getParent()->instr_end(); |
|
564 } else { |
|
565 - InstrI = InstrE = MI; |
|
566 + InstrI = InstrE = MI->getIterator(); |
|
567 ++InstrE; |
|
568 } |
|
569 OpI = InstrI->operands_begin(); |
|
570 --- include/llvm/CodeGen/SlotIndexes.h 2014-04-13 17:51:57.000000000 -0700 |
|
571 +++ include/llvm/CodeGen/SlotIndexes.h 2015-12-06 13:26:01.031361628 -0800 |
|
572 @@ -427,11 +427,11 @@ |
|
573 /// Returns the next non-null index, if one exists. |
|
574 /// Otherwise returns getLastIndex(). |
|
575 SlotIndex getNextNonNullIndex(SlotIndex Index) { |
|
576 - IndexList::iterator I = Index.listEntry(); |
|
577 + IndexList::iterator I = Index.listEntry()->getIterator(); |
|
578 IndexList::iterator E = indexList.end(); |
|
579 while (++I != E) |
|
580 if (I->getInstr()) |
|
581 - return SlotIndex(I, Index.getSlot()); |
|
582 + return SlotIndex(&*I, Index.getSlot()); |
|
583 // We reached the end of the function. |
|
584 return getLastIndex(); |
|
585 } |
|
586 @@ -580,11 +580,11 @@ |
|
587 IndexList::iterator prevItr, nextItr; |
|
588 if (Late) { |
|
589 // Insert mi's index immediately before the following instruction. |
|
590 - nextItr = getIndexAfter(mi).listEntry(); |
|
591 + nextItr = getIndexAfter(mi).listEntry()->getIterator(); |
|
592 prevItr = std::prev(nextItr); |
|
593 } else { |
|
594 // Insert mi's index immediately after the preceding instruction. |
|
595 - prevItr = getIndexBefore(mi).listEntry(); |
|
596 + prevItr = getIndexBefore(mi).listEntry()->getIterator(); |
|
597 nextItr = std::next(prevItr); |
|
598 } |
|
599 |
|
600 @@ -646,11 +646,11 @@ |
|
601 if (nextMBB == mbb->getParent()->end()) { |
|
602 startEntry = &indexList.back(); |
|
603 endEntry = createEntry(nullptr, 0); |
|
604 - newItr = indexList.insertAfter(startEntry, endEntry); |
|
605 + newItr = indexList.insertAfter(startEntry->getIterator(), endEntry); |
|
606 } else { |
|
607 startEntry = createEntry(nullptr, 0); |
|
608 - endEntry = getMBBStartIdx(nextMBB).listEntry(); |
|
609 - newItr = indexList.insert(endEntry, startEntry); |
|
610 + endEntry = getMBBStartIdx(&*nextMBB).listEntry(); |
|
611 + newItr = indexList.insert(endEntry->getIterator(), startEntry); |
|
612 } |
|
613 |
|
614 SlotIndex startIdx(startEntry, SlotIndex::Slot_Block); |
|
615 --- include/llvm/IR/IRBuilder.h 2014-12-30 06:28:14.000000000 -0800 |
|
616 +++ include/llvm/IR/IRBuilder.h 2015-11-24 09:08:00.970126898 -0800 |
|
617 @@ -58,9 +58,10 @@ |
|
618 FastMathFlags FMF; |
|
619 public: |
|
620 |
|
621 - IRBuilderBase(LLVMContext &context, MDNode *FPMathTag = nullptr) |
|
622 - : Context(context), DefaultFPMathTag(FPMathTag), FMF() { |
|
623 - ClearInsertionPoint(); |
|
624 + IRBuilderBase(LLVMContext &Ctx, MDNode *FPMathTag = nullptr) |
|
625 + : CurDbgLocation(), BB(nullptr), InsertPt(), |
|
626 + Context(Ctx), DefaultFPMathTag(FPMathTag), FMF() { |
|
627 + // ClearInsertionPoint(); |
|
628 } |
|
629 |
|
630 //===--------------------------------------------------------------------===// |
|
631 @@ -71,7 +72,7 @@ |
|
632 /// inserted into a block. |
|
633 void ClearInsertionPoint() { |
|
634 BB = nullptr; |
|
635 - InsertPt = nullptr; |
|
636 + InsertPt.reset(nullptr); |
|
637 } |
|
638 |
|
639 BasicBlock *GetInsertBlock() const { return BB; } |
|
640 @@ -89,8 +90,8 @@ |
|
641 /// the specified instruction. |
|
642 void SetInsertPoint(Instruction *I) { |
|
643 BB = I->getParent(); |
|
644 - InsertPt = I; |
|
645 - assert(I != BB->end() && "Can't read debug loc from end()"); |
|
646 + InsertPt = I->getIterator(); |
|
647 + assert(InsertPt != BB->end() && "Can't read debug loc from end()"); |
|
648 SetCurrentDebugLocation(I->getDebugLoc()); |
|
649 } |
|
650 |
|
651 @@ -99,6 +100,8 @@ |
|
652 void SetInsertPoint(BasicBlock *TheBB, BasicBlock::iterator IP) { |
|
653 BB = TheBB; |
|
654 InsertPt = IP; |
|
655 + if (IP != TheBB->end()) |
|
656 + SetCurrentDebugLocation(IP->getDebugLoc()); |
|
657 } |
|
658 |
|
659 /// \brief Find the nearest point that dominates this use, and specify that |
|
660 @@ -107,10 +110,12 @@ |
|
661 Instruction *UseInst = cast<Instruction>(U.getUser()); |
|
662 if (PHINode *Phi = dyn_cast<PHINode>(UseInst)) { |
|
663 BasicBlock *PredBB = Phi->getIncomingBlock(U); |
|
664 - assert(U != PredBB->getTerminator() && "critical edge not split"); |
|
665 - SetInsertPoint(PredBB, PredBB->getTerminator()); |
|
666 + TerminatorInst *TI = PredBB->getTerminator(); |
|
667 + assert(U != TI && "critical edge not split"); |
|
668 + SetInsertPoint(PredBB, TI->getIterator()); |
|
669 return; |
|
670 } |
|
671 + |
|
672 SetInsertPoint(UseInst); |
|
673 } |
|
674 |
|
675 --- include/llvm/IR/Metadata.h 2015-10-05 11:01:32.758196248 -0700 |
|
676 +++ include/llvm/IR/Metadata.h 2015-11-27 09:20:10.357775627 -0800 |
|
677 @@ -927,6 +927,71 @@ |
|
678 using ReplaceableMetadataImpl::replaceAllUsesWith; |
|
679 }; |
|
680 |
|
681 +template <class T> |
|
682 +class TypedMDOperandIterator : public std::iterator<std::input_iterator_tag, T*, std::ptrdiff_t, void, T*> { |
|
683 +private: |
|
684 + MDNode::op_iterator I = nullptr; |
|
685 + |
|
686 +public: |
|
687 + TypedMDOperandIterator() = default; |
|
688 + explicit TypedMDOperandIterator(MDNode::op_iterator I) : I(I) {} |
|
689 + ~TypedMDOperandIterator() { } |
|
690 + |
|
691 + T *operator*() const { return cast_or_null<T>(*I); } |
|
692 + |
|
693 + TypedMDOperandIterator &operator++() { |
|
694 + ++I; |
|
695 + return *this; |
|
696 + } |
|
697 + |
|
698 + TypedMDOperandIterator operator++(int) { |
|
699 + TypedMDOperandIterator Temp(*this); |
|
700 + ++I; |
|
701 + return Temp; |
|
702 + } |
|
703 + |
|
704 + bool operator==(const TypedMDOperandIterator &X) const { return I == X.I; } |
|
705 + bool operator!=(const TypedMDOperandIterator &X) const { return I != X.I; } |
|
706 +}; |
|
707 + |
|
708 +template<class T> class MDTupleTypedArrayWrapper { |
|
709 +private: |
|
710 + const MDTuple *N = nullptr; |
|
711 + |
|
712 +public: |
|
713 + MDTupleTypedArrayWrapper() = default; |
|
714 + MDTupleTypedArrayWrapper(const MDTuple *N) : N(N) {} |
|
715 + ~MDTupleTypedArrayWrapper() { } |
|
716 + |
|
717 + template<class U> |
|
718 + MDTupleTypedArrayWrapper(const MDTupleTypedArrayWrapper<U> &Other, |
|
719 + typename std::enable_if<std::is_convertible<U*, T*>::value>::type* = nullptr) |
|
720 + : N(Other.get()) { } |
|
721 + |
|
722 + template<class U> |
|
723 + explicit MDTupleTypedArrayWrapper(const MDTupleTypedArrayWrapper<U> &Other, |
|
724 + typename std::enable_if<!std::is_convertible<U*, T*>::value>::type* = nullptr) |
|
725 + : N(Other.get()) { } |
|
726 + |
|
727 + explicit operator bool() const { return get(); } |
|
728 + explicit operator MDTuple *() const { return get(); } |
|
729 + |
|
730 + MDTuple *get() const { return const_cast<MDTuple *>(N); } |
|
731 + MDTuple *operator->() const { return get(); } |
|
732 + MDTuple &operator*() const { return *get(); } |
|
733 + |
|
734 + unsigned size() const { return N ? N->getNumOperands() : 0u; } |
|
735 + T *operator[](unsigned I) const { return cast_or_null<T>(N->getOperand(I)); } |
|
736 + |
|
737 + typedef TypedMDOperandIterator<T> iterator; |
|
738 + iterator begin() const { return N ? iterator(N->op_begin()) : iterator(); } |
|
739 + iterator end() const { return N ? iterator(N->op_end()) : iterator(); } |
|
740 +}; |
|
741 + |
|
742 +#define HANDLE_METADATA(CLASS) \ |
|
743 + typedef MDTupleTypedArrayWrapper<CLASS> CLASS##Array; |
|
744 +#include "llvm/IR/Metadata.def" |
|
745 + |
|
746 //===----------------------------------------------------------------------===// |
|
747 /// \brief A tuple of MDNodes. |
|
748 /// |
|
749 --- include/llvm/MC/MCSection.h 2013-04-17 14:18:16.000000000 -0700 |
|
750 +++ include/llvm/MC/MCSection.h 2015-12-07 12:32:38.557027450 -0800 |
|
751 @@ -15,6 +15,9 @@ |
|
752 #define LLVM_MC_MCSECTION_H |
|
753 |
|
754 #include "llvm/ADT/StringRef.h" |
|
755 +#include "llvm/ADT/ilist.h" |
|
756 +#include "llvm/ADT/ilist_node.h" |
|
757 +#include "llvm/MC/MCAssembler.h" |
|
758 #include "llvm/MC/SectionKind.h" |
|
759 #include "llvm/Support/Compiler.h" |
|
760 |
|
761 @@ -41,6 +44,14 @@ |
|
762 MCSection(SectionVariant V, SectionKind K) : Variant(V), Kind(K) {} |
|
763 SectionVariant Variant; |
|
764 SectionKind Kind; |
|
765 + |
|
766 + public: |
|
767 + typedef iplist<MCFragment> FragmentListType; |
|
768 + typedef FragmentListType::const_iterator const_iterator; |
|
769 + typedef FragmentListType::iterator iterator; |
|
770 + typedef FragmentListType::const_reverse_iterator const_reverse_iterator; |
|
771 + typedef FragmentListType::reverse_iterator reverse_iterator; |
|
772 + |
|
773 public: |
|
774 virtual ~MCSection(); |
|
775 |
|
776 --- include/llvm/MC/MCTargetOptionsCommandFlags.h 2015-01-14 03:23:27.000000000 -0800 |
|
777 +++ include/llvm/MC/MCTargetOptionsCommandFlags.h 2016-01-26 19:29:37.000000000 -0800 |
|
778 @@ -43,7 +43,7 @@ |
|
779 cl::opt<std::string> |
|
780 ABIName("target-abi", cl::Hidden, |
|
781 cl::desc("The name of the ABI to be targeted from the backend."), |
|
782 - cl::init("")); |
|
783 + cl::init(std::string(""))); |
|
784 |
|
785 static inline MCTargetOptions InitMCTargetOptionsFromFlags() { |
|
786 MCTargetOptions Options; |
|
787 --- include/llvm/Support/GenericDomTree.h 2015-01-14 02:33:21.000000000 -0800 |
|
788 +++ include/llvm/Support/GenericDomTree.h 2015-12-08 09:12:30.450453075 -0800 |
|
789 @@ -715,7 +715,11 @@ |
|
790 /// recalculate - compute a dominator tree for the given function |
|
791 template <class FT> void recalculate(FT &F) { |
|
792 typedef GraphTraits<FT *> TraitsTy; |
|
793 + typedef typename GraphTraits<FT*>::ChildIteratorType TraitsTyChildIterator; |
|
794 + typedef typename GraphTraits<FT*>::nodes_iterator TraitsTyNodeIterator; |
|
795 + |
|
796 reset(); |
|
797 + |
|
798 this->Vertex.push_back(nullptr); |
|
799 |
|
800 if (!this->IsPostDominators) { |
|
801 @@ -728,19 +732,22 @@ |
|
802 Calculate<FT, NodeT *>(*this, F); |
|
803 } else { |
|
804 // Initialize the roots list |
|
805 - for (typename TraitsTy::nodes_iterator I = TraitsTy::nodes_begin(&F), |
|
806 - E = TraitsTy::nodes_end(&F); |
|
807 + for (TraitsTyNodeIterator I = TraitsTy::nodes_begin(&F), |
|
808 + E = TraitsTy::nodes_end(&F); |
|
809 I != E; ++I) { |
|
810 - if (TraitsTy::child_begin(I) == TraitsTy::child_end(I)) |
|
811 - addRoot(I); |
|
812 + TraitsTyChildIterator ChildBegin(TraitsTy::child_begin(&*I)); |
|
813 + TraitsTyChildIterator ChildEnd(TraitsTy::child_end(&*I)); |
|
814 + |
|
815 + if (ChildBegin == ChildEnd) |
|
816 + addRoot(&*I); |
|
817 |
|
818 // Prepopulate maps so that we don't get iterator invalidation issues |
|
819 // later. |
|
820 - this->IDoms[I] = nullptr; |
|
821 - this->DomTreeNodes[I] = nullptr; |
|
822 + this->IDoms[&*I] = nullptr; |
|
823 + this->DomTreeNodes[&*I] = nullptr; |
|
824 } |
|
825 |
|
826 - Calculate<FT, Inverse<NodeT *>>(*this, F); |
|
827 + Calculate<FT, Inverse<NodeT*> >(*this, F); |
|
828 } |
|
829 } |
|
830 }; |
|
831 --- include/llvm/Transforms/Utils/SSAUpdaterImpl.h 2014-04-21 15:55:11.000000000 -0700 |
|
832 +++ include/llvm/Transforms/Utils/SSAUpdaterImpl.h 2015-11-29 13:46:28.070241785 -0800 |
|
833 @@ -378,7 +378,7 @@ |
|
834 void FindExistingPHI(BlkT *BB, BlockListTy *BlockList) { |
|
835 for (typename BlkT::iterator BBI = BB->begin(), BBE = BB->end(); |
|
836 BBI != BBE; ++BBI) { |
|
837 - PhiT *SomePHI = Traits::InstrIsPHI(BBI); |
|
838 + PhiT *SomePHI = Traits::InstrIsPHI(&*BBI); |
|
839 if (!SomePHI) |
|
840 break; |
|
841 if (CheckIfPHIMatches(SomePHI)) { |
|
842 --- lib/Analysis/AliasAnalysisEvaluator.cpp 2014-07-24 05:16:19.000000000 -0700 |
|
843 +++ lib/Analysis/AliasAnalysisEvaluator.cpp 2015-11-27 17:10:53.853958210 -0800 |
|
844 @@ -146,9 +146,9 @@ |
|
845 SetVector<Value *> Loads; |
|
846 SetVector<Value *> Stores; |
|
847 |
|
848 - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) |
|
849 - if (I->getType()->isPointerTy()) // Add all pointer arguments. |
|
850 - Pointers.insert(I); |
|
851 + for (auto &I : F.args()) |
|
852 + if (I.getType()->isPointerTy()) // Add all pointer arguments. |
|
853 + Pointers.insert(&I); |
|
854 |
|
855 for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) { |
|
856 if (I->getType()->isPointerTy()) // Add all pointer instructions. |
|
857 --- lib/Analysis/AliasAnalysis.cpp 2014-12-15 06:09:53.000000000 -0800 |
|
858 +++ lib/Analysis/AliasAnalysis.cpp 2015-11-27 09:33:58.058293495 -0800 |
|
859 @@ -501,12 +501,12 @@ |
|
860 const ModRefResult Mode) { |
|
861 assert(I1.getParent() == I2.getParent() && |
|
862 "Instructions not in same basic block!"); |
|
863 - BasicBlock::const_iterator I = &I1; |
|
864 - BasicBlock::const_iterator E = &I2; |
|
865 + BasicBlock::const_iterator I = I1.getIterator(); |
|
866 + BasicBlock::const_iterator E = I2.getIterator(); |
|
867 ++E; // Convert from inclusive to exclusive range. |
|
868 |
|
869 for (; I != E; ++I) // Check every instruction in range |
|
870 - if (getModRefInfo(I, Loc) & Mode) |
|
871 + if (getModRefInfo(&(*I), Loc) & Mode) |
|
872 return true; |
|
873 return false; |
|
874 } |
|
875 --- lib/Analysis/AliasSetTracker.cpp 2014-11-19 11:36:18.000000000 -0800 |
|
876 +++ lib/Analysis/AliasSetTracker.cpp 2015-11-27 09:52:20.756423865 -0800 |
|
877 @@ -229,8 +229,8 @@ |
|
878 iterator Cur = I++; |
|
879 if (Cur->Forward || !Cur->aliasesPointer(Ptr, Size, AAInfo, AA)) continue; |
|
880 |
|
881 - if (!FoundSet) { // If this is the first alias set ptr can go into. |
|
882 - FoundSet = Cur; // Remember it. |
|
883 + if (!FoundSet) { // If this is the first alias set ptr can go into. |
|
884 + FoundSet = &(*Cur); // Remember it. |
|
885 } else { // Otherwise, we must merge the sets. |
|
886 FoundSet->mergeSetIn(*Cur, *this); // Merge in contents. |
|
887 } |
|
888 @@ -264,16 +264,13 @@ |
|
889 if (Cur->Forward || !Cur->aliasesUnknownInst(Inst, AA)) |
|
890 continue; |
|
891 if (!FoundSet) // If this is the first alias set ptr can go into. |
|
892 - FoundSet = Cur; // Remember it. |
|
893 + FoundSet = &(*Cur); // Remember it. |
|
894 else if (!Cur->Forward) // Otherwise, we must merge the sets. |
|
895 FoundSet->mergeSetIn(*Cur, *this); // Merge in contents. |
|
896 } |
|
897 return FoundSet; |
|
898 } |
|
899 |
|
900 - |
|
901 - |
|
902 - |
|
903 /// getAliasSetForPointer - Return the alias set that the specified pointer |
|
904 /// lives in. |
|
905 AliasSet &AliasSetTracker::getAliasSetForPointer(Value *Pointer, uint64_t Size, |
|
906 @@ -287,13 +284,13 @@ |
|
907 // Return the set! |
|
908 return *Entry.getAliasSet(*this)->getForwardedTarget(*this); |
|
909 } |
|
910 - |
|
911 + |
|
912 if (AliasSet *AS = findAliasSetForPointer(Pointer, Size, AAInfo)) { |
|
913 // Add it to the alias set it aliases. |
|
914 AS->addPointer(*this, Entry, Size, AAInfo); |
|
915 return *AS; |
|
916 } |
|
917 - |
|
918 + |
|
919 if (New) *New = true; |
|
920 // Otherwise create a new alias set to hold the loaded pointer. |
|
921 AliasSets.push_back(new AliasSet()); |
|
922 @@ -379,8 +376,8 @@ |
|
923 } |
|
924 |
|
925 void AliasSetTracker::add(BasicBlock &BB) { |
|
926 - for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I) |
|
927 - add(I); |
|
928 + for (auto &I : BB) |
|
929 + add(&I); |
|
930 } |
|
931 |
|
932 void AliasSetTracker::add(const AliasSetTracker &AST) { |
|
933 --- lib/Analysis/BasicAliasAnalysis.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
934 +++ lib/Analysis/BasicAliasAnalysis.cpp 2015-11-27 09:53:17.612141117 -0800 |
|
935 @@ -1440,7 +1440,7 @@ |
|
936 // the Values cannot come from different iterations of a potential cycle the |
|
937 // phi nodes could be involved in. |
|
938 for (auto *P : VisitedPhiBBs) |
|
939 - if (isPotentiallyReachable(P->begin(), Inst, DT, LI)) |
|
940 + if (isPotentiallyReachable(&P->front(), Inst, DT, LI)) |
|
941 return false; |
|
942 |
|
943 return true; |
|
944 --- lib/Analysis/BlockFrequencyInfo.cpp 2014-06-26 15:52:05.000000000 -0700 |
|
945 +++ lib/Analysis/BlockFrequencyInfo.cpp 2015-11-27 09:55:32.251496178 -0800 |
|
946 @@ -34,17 +34,17 @@ |
|
947 }; |
|
948 |
|
949 static cl::opt<GVDAGType> |
|
950 -ViewBlockFreqPropagationDAG("view-block-freq-propagation-dags", cl::Hidden, |
|
951 - cl::desc("Pop up a window to show a dag displaying how block " |
|
952 - "frequencies propagation through the CFG."), |
|
953 - cl::values( |
|
954 - clEnumValN(GVDT_None, "none", |
|
955 - "do not display graphs."), |
|
956 - clEnumValN(GVDT_Fraction, "fraction", "display a graph using the " |
|
957 - "fractional block frequency representation."), |
|
958 - clEnumValN(GVDT_Integer, "integer", "display a graph using the raw " |
|
959 - "integer fractional block frequency representation."), |
|
960 - clEnumValEnd)); |
|
961 +ViewBlockFreqPropagationDAG("view-block-freq-propagation-dags", |
|
962 + cl::Hidden, |
|
963 + cl::desc("Pop up a window to show a dag displaying how block " |
|
964 + "frequencies propagation through the CFG."), |
|
965 + cl::values(clEnumValN(GVDT_None, "none", |
|
966 + "do not display graphs."), |
|
967 + clEnumValN(GVDT_Fraction, "fraction", "display a graph using the " |
|
968 + "fractional block frequency representation."), |
|
969 + clEnumValN(GVDT_Integer, "integer", "display a graph using the raw " |
|
970 + "integer fractional block frequency representation."), |
|
971 + clEnumValEnd)); |
|
972 |
|
973 namespace llvm { |
|
974 |
|
975 @@ -55,8 +55,9 @@ |
|
976 typedef Function::const_iterator nodes_iterator; |
|
977 |
|
978 static inline const NodeType *getEntryNode(const BlockFrequencyInfo *G) { |
|
979 - return G->getFunction()->begin(); |
|
980 + return &(G->getFunction()->front()); |
|
981 } |
|
982 + |
|
983 static ChildIteratorType child_begin(const NodeType *N) { |
|
984 return succ_begin(N); |
|
985 } |
|
986 --- lib/Analysis/BranchProbabilityInfo.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
987 +++ lib/Analysis/BranchProbabilityInfo.cpp 2015-11-27 09:59:58.010012465 -0800 |
|
988 @@ -529,11 +529,10 @@ |
|
989 // We print the probabilities from the last function the analysis ran over, |
|
990 // or the function it is currently running over. |
|
991 assert(LastF && "Cannot print prior to running over a function"); |
|
992 - for (Function::const_iterator BI = LastF->begin(), BE = LastF->end(); |
|
993 - BI != BE; ++BI) { |
|
994 - for (succ_const_iterator SI = succ_begin(BI), SE = succ_end(BI); |
|
995 + for (const auto &BI : *LastF) { |
|
996 + for (succ_const_iterator SI = succ_begin(&BI), SE = succ_end(&BI); |
|
997 SI != SE; ++SI) { |
|
998 - printEdgeProbability(OS << " ", BI, *SI); |
|
999 + printEdgeProbability(OS << " ", &BI, *SI); |
|
1000 } |
|
1001 } |
|
1002 } |
|
1003 --- lib/Analysis/CFG.cpp 2015-01-12 19:46:47.000000000 -0800 |
|
1004 +++ lib/Analysis/CFG.cpp 2015-11-27 10:13:16.659243122 -0800 |
|
1005 @@ -204,8 +204,9 @@ |
|
1006 return true; |
|
1007 |
|
1008 // Linear scan, start at 'A', see whether we hit 'B' or the end first. |
|
1009 - for (BasicBlock::const_iterator I = A, E = BB->end(); I != E; ++I) { |
|
1010 - if (&*I == B) |
|
1011 + for (BasicBlock::const_iterator I = A->getIterator(), E = BB->end(); |
|
1012 + I != E; ++I) { |
|
1013 + if (&(*I) == B) |
|
1014 return true; |
|
1015 } |
|
1016 |
|
1017 --- lib/Analysis/CodeMetrics.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
1018 +++ lib/Analysis/CodeMetrics.cpp 2015-11-27 10:14:02.544976823 -0800 |
|
1019 @@ -115,7 +115,7 @@ |
|
1020 for (BasicBlock::const_iterator II = BB->begin(), E = BB->end(); |
|
1021 II != E; ++II) { |
|
1022 // Skip ephemeral values. |
|
1023 - if (EphValues.count(II)) |
|
1024 + if (EphValues.count(&(*II))) |
|
1025 continue; |
|
1026 |
|
1027 // Special handling for calls. |
|
1028 --- lib/Analysis/CostModel.cpp 2014-07-03 15:24:18.000000000 -0700 |
|
1029 +++ lib/Analysis/CostModel.cpp 2015-11-27 10:20:35.600601500 -0800 |
|
1030 @@ -524,7 +524,7 @@ |
|
1031 |
|
1032 for (Function::iterator B = F->begin(), BE = F->end(); B != BE; ++B) { |
|
1033 for (BasicBlock::iterator it = B->begin(), e = B->end(); it != e; ++it) { |
|
1034 - Instruction *Inst = it; |
|
1035 + Instruction *Inst = &(*it); |
|
1036 unsigned Cost = getInstructionCost(Inst); |
|
1037 if (Cost != (unsigned)-1) |
|
1038 OS << "Cost Model: Found an estimated cost of " << Cost; |
|
1039 --- lib/Analysis/IPA/CallGraph.cpp 2014-08-07 13:41:17.000000000 -0700 |
|
1040 +++ lib/Analysis/IPA/CallGraph.cpp 2015-11-27 17:17:06.153920405 -0800 |
|
1041 @@ -25,7 +25,7 @@ |
|
1042 CallsExternalNode(new CallGraphNode(nullptr)) { |
|
1043 // Add every function to the call graph. |
|
1044 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) |
|
1045 - addToCallGraph(I); |
|
1046 + addToCallGraph(&*I); |
|
1047 |
|
1048 // If we didn't find a main function, use the external call graph node |
|
1049 if (!Root) |
|
1050 --- lib/Analysis/IPA/GlobalsModRef.cpp 2014-05-08 10:57:50.000000000 -0700 |
|
1051 +++ lib/Analysis/IPA/GlobalsModRef.cpp 2015-11-27 17:21:08.993461915 -0800 |
|
1052 @@ -209,9 +209,9 @@ |
|
1053 std::vector<Function*> Readers, Writers; |
|
1054 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) |
|
1055 if (I->hasLocalLinkage()) { |
|
1056 - if (!AnalyzeUsesOfPointer(I, Readers, Writers)) { |
|
1057 + if (!AnalyzeUsesOfPointer(&*I, Readers, Writers)) { |
|
1058 // Remember that we are tracking this global. |
|
1059 - NonAddressTakenGlobals.insert(I); |
|
1060 + NonAddressTakenGlobals.insert(&*I); |
|
1061 ++NumNonAddrTakenFunctions; |
|
1062 } |
|
1063 Readers.clear(); Writers.clear(); |
|
1064 @@ -220,24 +220,26 @@ |
|
1065 for (Module::global_iterator I = M.global_begin(), E = M.global_end(); |
|
1066 I != E; ++I) |
|
1067 if (I->hasLocalLinkage()) { |
|
1068 - if (!AnalyzeUsesOfPointer(I, Readers, Writers)) { |
|
1069 + if (!AnalyzeUsesOfPointer(&*I, Readers, Writers)) { |
|
1070 // Remember that we are tracking this global, and the mod/ref fns |
|
1071 - NonAddressTakenGlobals.insert(I); |
|
1072 + NonAddressTakenGlobals.insert(&*I); |
|
1073 |
|
1074 for (unsigned i = 0, e = Readers.size(); i != e; ++i) |
|
1075 - FunctionInfo[Readers[i]].GlobalInfo[I] |= Ref; |
|
1076 + FunctionInfo[Readers[i]].GlobalInfo[&*I] |= Ref; |
|
1077 |
|
1078 if (!I->isConstant()) // No need to keep track of writers to constants |
|
1079 for (unsigned i = 0, e = Writers.size(); i != e; ++i) |
|
1080 - FunctionInfo[Writers[i]].GlobalInfo[I] |= Mod; |
|
1081 + FunctionInfo[Writers[i]].GlobalInfo[&*I] |= Mod; |
|
1082 ++NumNonAddrTakenGlobalVars; |
|
1083 |
|
1084 // If this global holds a pointer type, see if it is an indirect global. |
|
1085 if (I->getType()->getElementType()->isPointerTy() && |
|
1086 - AnalyzeIndirectGlobalMemory(I)) |
|
1087 + AnalyzeIndirectGlobalMemory(&*I)) |
|
1088 ++NumIndirectGlobalVars; |
|
1089 } |
|
1090 - Readers.clear(); Writers.clear(); |
|
1091 + |
|
1092 + Readers.clear(); |
|
1093 + Writers.clear(); |
|
1094 } |
|
1095 } |
|
1096 |
|
1097 --- lib/Analysis/IPA/InlineCost.cpp 2015-02-12 13:28:02.000000000 -0800 |
|
1098 +++ lib/Analysis/IPA/InlineCost.cpp 2015-11-27 17:25:16.116008808 -0800 |
|
1099 @@ -900,7 +900,7 @@ |
|
1100 continue; |
|
1101 |
|
1102 // Skip ephemeral values. |
|
1103 - if (EphValues.count(I)) |
|
1104 + if (EphValues.count(&*I)) |
|
1105 continue; |
|
1106 |
|
1107 ++NumInstructions; |
|
1108 @@ -912,7 +912,7 @@ |
|
1109 // all of the per-instruction logic. The visit tree returns true if we |
|
1110 // consumed the instruction in any way, and false if the instruction's base |
|
1111 // cost should count against inlining. |
|
1112 - if (Base::visit(I)) |
|
1113 + if (Base::visit(&*I)) |
|
1114 ++NumInstructionsSimplified; |
|
1115 else |
|
1116 Cost += InlineConstants::InstrCost; |
|
1117 @@ -1089,15 +1089,15 @@ |
|
1118 FAI != FAE; ++FAI, ++CAI) { |
|
1119 assert(CAI != CS.arg_end()); |
|
1120 if (Constant *C = dyn_cast<Constant>(CAI)) |
|
1121 - SimplifiedValues[FAI] = C; |
|
1122 + SimplifiedValues[&*FAI] = C; |
|
1123 |
|
1124 Value *PtrArg = *CAI; |
|
1125 if (ConstantInt *C = stripAndComputeInBoundsConstantOffsets(PtrArg)) { |
|
1126 - ConstantOffsetPtrs[FAI] = std::make_pair(PtrArg, C->getValue()); |
|
1127 + ConstantOffsetPtrs[&*FAI] = std::make_pair(PtrArg, C->getValue()); |
|
1128 |
|
1129 // We can SROA any pointer arguments derived from alloca instructions. |
|
1130 if (isa<AllocaInst>(PtrArg)) { |
|
1131 - SROAArgValues[FAI] = PtrArg; |
|
1132 + SROAArgValues[&*FAI] = PtrArg; |
|
1133 SROAArgCosts[PtrArg] = 0; |
|
1134 } |
|
1135 } |
|
1136 @@ -1334,9 +1334,8 @@ |
|
1137 if (isa<IndirectBrInst>(BI->getTerminator()) || BI->hasAddressTaken()) |
|
1138 return false; |
|
1139 |
|
1140 - for (BasicBlock::iterator II = BI->begin(), IE = BI->end(); II != IE; |
|
1141 - ++II) { |
|
1142 - CallSite CS(II); |
|
1143 + for (auto &II : *BI) { |
|
1144 + CallSite CS(&II); |
|
1145 if (!CS) |
|
1146 continue; |
|
1147 |
|
1148 --- lib/Analysis/IVUsers.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
1149 +++ lib/Analysis/IVUsers.cpp 2015-11-27 10:24:31.961529730 -0800 |
|
1150 @@ -248,7 +248,6 @@ |
|
1151 } |
|
1152 |
|
1153 bool IVUsers::runOnLoop(Loop *l, LPPassManager &LPM) { |
|
1154 - |
|
1155 L = l; |
|
1156 LI = &getAnalysis<LoopInfo>(); |
|
1157 DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); |
|
1158 @@ -260,7 +259,7 @@ |
|
1159 // them by stride. Start by finding all of the PHI nodes in the header for |
|
1160 // this loop. If they are induction variables, inspect their uses. |
|
1161 for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) |
|
1162 - (void)AddUsersIfInteresting(I); |
|
1163 + (void) AddUsersIfInteresting(&(*I)); |
|
1164 |
|
1165 return false; |
|
1166 } |
|
1167 --- lib/Analysis/Lint.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
1168 +++ lib/Analysis/Lint.cpp 2015-11-27 10:28:34.901567525 -0800 |
|
1169 @@ -231,7 +231,8 @@ |
|
1170 for (; AI != AE; ++AI) { |
|
1171 Value *Actual = *AI; |
|
1172 if (PI != PE) { |
|
1173 - Argument *Formal = PI++; |
|
1174 + Argument *Formal = &(*PI); |
|
1175 + PI++; |
|
1176 Assert1(Formal->getType() == Actual->getType(), |
|
1177 "Undefined behavior: Call argument type mismatches " |
|
1178 "callee parameter type", &I); |
|
1179 @@ -609,8 +610,8 @@ |
|
1180 |
|
1181 void Lint::visitUnreachableInst(UnreachableInst &I) { |
|
1182 // This isn't undefined behavior, it's merely suspicious. |
|
1183 - Assert1(&I == I.getParent()->begin() || |
|
1184 - std::prev(BasicBlock::iterator(&I))->mayHaveSideEffects(), |
|
1185 + Assert1(&I == &(I.getParent()->front()) || |
|
1186 + std::prev(I.getIterator())->mayHaveSideEffects(), |
|
1187 "Unusual: unreachable immediately preceded by instruction without " |
|
1188 "side effects", &I); |
|
1189 } |
|
1190 @@ -641,7 +642,7 @@ |
|
1191 // TODO: Look through vector insert/extract/shuffle. |
|
1192 V = OffsetOk ? GetUnderlyingObject(V, DL) : V->stripPointerCasts(); |
|
1193 if (LoadInst *L = dyn_cast<LoadInst>(V)) { |
|
1194 - BasicBlock::iterator BBI = L; |
|
1195 + BasicBlock::iterator BBI = L->getIterator(); |
|
1196 BasicBlock *BB = L->getParent(); |
|
1197 SmallPtrSet<BasicBlock *, 4> VisitedBlocks; |
|
1198 for (;;) { |
|
1199 --- lib/Analysis/Loads.cpp 2014-11-25 00:20:27.000000000 -0800 |
|
1200 +++ lib/Analysis/Loads.cpp 2015-11-27 17:11:12.096570890 -0800 |
|
1201 @@ -110,7 +110,8 @@ |
|
1202 // from/to. If so, the previous load or store would have already trapped, |
|
1203 // so there is no harm doing an extra load (also, CSE will later eliminate |
|
1204 // the load entirely). |
|
1205 - BasicBlock::iterator BBI = ScanFrom, E = ScanFrom->getParent()->begin(); |
|
1206 + BasicBlock::iterator BBI = ScanFrom->getIterator(); |
|
1207 + BasicBlock::iterator E = ScanFrom->getParent()->begin(); |
|
1208 |
|
1209 // We can at least always strip pointer casts even though we can't use the |
|
1210 // base here. |
|
1211 @@ -189,7 +190,8 @@ |
|
1212 while (ScanFrom != ScanBB->begin()) { |
|
1213 // We must ignore debug info directives when counting (otherwise they |
|
1214 // would affect codegen). |
|
1215 - Instruction *Inst = --ScanFrom; |
|
1216 + --ScanFrom; |
|
1217 + Instruction *Inst = &(*ScanFrom); |
|
1218 if (isa<DbgInfoIntrinsic>(Inst)) |
|
1219 continue; |
|
1220 |
|
1221 --- lib/Analysis/MemoryBuiltins.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
1222 +++ lib/Analysis/MemoryBuiltins.cpp 2015-11-27 10:36:01.320964520 -0800 |
|
1223 @@ -642,7 +642,7 @@ |
|
1224 |
|
1225 // always generate code immediately before the instruction being |
|
1226 // processed, so that the generated code dominates the same BBs |
|
1227 - Instruction *PrevInsertPoint = Builder.GetInsertPoint(); |
|
1228 + BuilderTy::InsertPointGuard Guard(Builder); |
|
1229 if (Instruction *I = dyn_cast<Instruction>(V)) |
|
1230 Builder.SetInsertPoint(I); |
|
1231 |
|
1232 @@ -671,9 +671,6 @@ |
|
1233 Result = unknown(); |
|
1234 } |
|
1235 |
|
1236 - if (PrevInsertPoint) |
|
1237 - Builder.SetInsertPoint(PrevInsertPoint); |
|
1238 - |
|
1239 // Don't reuse CacheIt since it may be invalid at this point. |
|
1240 CacheMap[V] = Result; |
|
1241 return Result; |
|
1242 @@ -763,7 +760,7 @@ |
|
1243 |
|
1244 // compute offset/size for each PHI incoming pointer |
|
1245 for (unsigned i = 0, e = PHI.getNumIncomingValues(); i != e; ++i) { |
|
1246 - Builder.SetInsertPoint(PHI.getIncomingBlock(i)->getFirstInsertionPt()); |
|
1247 + Builder.SetInsertPoint(&*PHI.getIncomingBlock(i)->getFirstInsertionPt()); |
|
1248 SizeOffsetEvalType EdgeData = compute_(PHI.getIncomingValue(i)); |
|
1249 |
|
1250 if (!bothKnown(EdgeData)) { |
|
1251 --- lib/Analysis/MemoryDependenceAnalysis.cpp 2015-01-08 16:26:45.000000000 -0800 |
|
1252 +++ lib/Analysis/MemoryDependenceAnalysis.cpp 2015-11-27 17:13:54.649752810 -0800 |
|
1253 @@ -215,7 +215,8 @@ |
|
1254 if (!Limit) |
|
1255 return MemDepResult::getUnknown(); |
|
1256 |
|
1257 - Instruction *Inst = --ScanIt; |
|
1258 + --ScanIt; |
|
1259 + Instruction *Inst = &(*ScanIt); |
|
1260 |
|
1261 // If this inst is a memory op, get the pointer it accessed |
|
1262 AliasAnalysis::Location Loc; |
|
1263 @@ -415,7 +416,8 @@ |
|
1264 |
|
1265 // Walk backwards through the basic block, looking for dependencies. |
|
1266 while (ScanIt != BB->begin()) { |
|
1267 - Instruction *Inst = --ScanIt; |
|
1268 + --ScanIt; |
|
1269 + Instruction *Inst = &(*ScanIt); |
|
1270 |
|
1271 if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(Inst)) |
|
1272 // Debug intrinsics don't (and can't) cause dependencies. |
|
1273 @@ -676,12 +678,14 @@ |
|
1274 if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(QueryInst)) |
|
1275 isLoad |= II->getIntrinsicID() == Intrinsic::lifetime_start; |
|
1276 |
|
1277 - LocalCache = getPointerDependencyFrom(MemLoc, isLoad, ScanPos, |
|
1278 + LocalCache = getPointerDependencyFrom(MemLoc, isLoad, |
|
1279 + ScanPos->getIterator(), |
|
1280 QueryParent, QueryInst); |
|
1281 } else if (isa<CallInst>(QueryInst) || isa<InvokeInst>(QueryInst)) { |
|
1282 CallSite QueryCS(QueryInst); |
|
1283 bool isReadOnly = AA->onlyReadsMemory(QueryCS); |
|
1284 - LocalCache = getCallSiteDependencyFrom(QueryCS, isReadOnly, ScanPos, |
|
1285 + LocalCache = getCallSiteDependencyFrom(QueryCS, isReadOnly, |
|
1286 + ScanPos->getIterator(), |
|
1287 QueryParent); |
|
1288 } else |
|
1289 // Non-memory instruction. |
|
1290 @@ -805,7 +809,7 @@ |
|
1291 BasicBlock::iterator ScanPos = DirtyBB->end(); |
|
1292 if (ExistingResult) { |
|
1293 if (Instruction *Inst = ExistingResult->getResult().getInst()) { |
|
1294 - ScanPos = Inst; |
|
1295 + ScanPos = Inst->getIterator(); |
|
1296 // We're removing QueryInst's use of Inst. |
|
1297 RemoveFromReverseMap(ReverseNonLocalDeps, Inst, |
|
1298 QueryCS.getInstruction()); |
|
1299 @@ -969,11 +973,11 @@ |
|
1300 assert(ExistingResult->getResult().getInst()->getParent() == BB && |
|
1301 "Instruction invalidated?"); |
|
1302 ++NumCacheDirtyNonLocalPtr; |
|
1303 - ScanPos = ExistingResult->getResult().getInst(); |
|
1304 + ScanPos = ExistingResult->getResult().getInst()->getIterator(); |
|
1305 |
|
1306 // Eliminating the dirty entry from 'Cache', so update the reverse info. |
|
1307 ValueIsLoadPair CacheKey(Loc.Ptr, isLoad); |
|
1308 - RemoveFromReverseMap(ReverseNonLocalPtrDeps, ScanPos, CacheKey); |
|
1309 + RemoveFromReverseMap(ReverseNonLocalPtrDeps, &(*ScanPos), CacheKey); |
|
1310 } else { |
|
1311 ++NumUncacheNonLocalPtr; |
|
1312 } |
|
1313 @@ -1524,8 +1528,10 @@ |
|
1314 // Using a dirty version of the instruction after RemInst saves having to scan |
|
1315 // the entire block to get to this point. |
|
1316 MemDepResult NewDirtyVal; |
|
1317 - if (!RemInst->isTerminator()) |
|
1318 - NewDirtyVal = MemDepResult::getDirty(++BasicBlock::iterator(RemInst)); |
|
1319 + if (!RemInst->isTerminator()) { |
|
1320 + ++RemInst; |
|
1321 + NewDirtyVal = MemDepResult::getDirty(&*RemInst->getIterator()); |
|
1322 + } |
|
1323 |
|
1324 ReverseDepMapType::iterator ReverseDepIt = ReverseLocalDeps.find(RemInst); |
|
1325 if (ReverseDepIt != ReverseLocalDeps.end()) { |
|
1326 --- lib/Analysis/ScalarEvolutionExpander.cpp 2015-03-16 14:15:49.000000000 -0700 |
|
1327 +++ lib/Analysis/ScalarEvolutionExpander.cpp 2015-11-27 17:14:51.881419145 -0800 |
|
1328 @@ -59,7 +59,7 @@ |
|
1329 // Create a new cast, and leave the old cast in place in case |
|
1330 // it is being used as an insert point. Clear its operand |
|
1331 // so that it doesn't hold anything live. |
|
1332 - Ret = CastInst::Create(Op, V, Ty, "", IP); |
|
1333 + Ret = CastInst::Create(Op, V, Ty, "", &(*IP)); |
|
1334 Ret->takeName(CI); |
|
1335 CI->replaceAllUsesWith(Ret); |
|
1336 CI->setOperand(0, UndefValue::get(V->getType())); |
|
1337 @@ -71,12 +71,12 @@ |
|
1338 |
|
1339 // Create a new cast. |
|
1340 if (!Ret) |
|
1341 - Ret = CastInst::Create(Op, V, Ty, V->getName(), IP); |
|
1342 + Ret = CastInst::Create(Op, V, Ty, V->getName(), &(*IP)); |
|
1343 |
|
1344 // We assert at the end of the function since IP might point to an |
|
1345 // instruction with different dominance properties than a cast |
|
1346 // (an invoke for example) and not dominate BIP (but the cast does). |
|
1347 - assert(SE.DT->dominates(Ret, BIP)); |
|
1348 + assert(SE.DT->dominates(Ret, &(*BIP))); |
|
1349 |
|
1350 rememberInstruction(Ret); |
|
1351 return Ret; |
|
1352 @@ -139,7 +139,8 @@ |
|
1353 |
|
1354 // Cast the instruction immediately after the instruction. |
|
1355 Instruction *I = cast<Instruction>(V); |
|
1356 - BasicBlock::iterator IP = I; ++IP; |
|
1357 + ++I; |
|
1358 + BasicBlock::iterator IP = I->getIterator(); |
|
1359 if (InvokeInst *II = dyn_cast<InvokeInst>(I)) |
|
1360 IP = II->getNormalDest()->begin(); |
|
1361 while (isa<PHINode>(IP) || isa<LandingPadInst>(IP)) |
|
1362 @@ -170,7 +171,7 @@ |
|
1363 ScanLimit++; |
|
1364 if (IP->getOpcode() == (unsigned)Opcode && IP->getOperand(0) == LHS && |
|
1365 IP->getOperand(1) == RHS) |
|
1366 - return IP; |
|
1367 + return &(*IP); |
|
1368 if (IP == BlockBegin) break; |
|
1369 } |
|
1370 } |
|
1371 @@ -186,7 +187,7 @@ |
|
1372 if (!Preheader) break; |
|
1373 |
|
1374 // Ok, move up a level. |
|
1375 - Builder.SetInsertPoint(Preheader, Preheader->getTerminator()); |
|
1376 + Builder.SetInsertPoint(Preheader->getTerminator()); |
|
1377 } |
|
1378 |
|
1379 // If we haven't found this binop, insert it. |
|
1380 @@ -518,7 +519,8 @@ |
|
1381 Type::getInt8PtrTy(Ty->getContext(), PTy->getAddressSpace())); |
|
1382 |
|
1383 assert(!isa<Instruction>(V) || |
|
1384 - SE.DT->dominates(cast<Instruction>(V), Builder.GetInsertPoint())); |
|
1385 + SE.DT->dominates(cast<Instruction>(V), |
|
1386 + &(*Builder.GetInsertPoint()))); |
|
1387 |
|
1388 // Expand the operands for a plain byte offset. |
|
1389 Value *Idx = expandCodeFor(SE.getAddExpr(Ops), Ty); |
|
1390 @@ -542,7 +544,7 @@ |
|
1391 ScanLimit++; |
|
1392 if (IP->getOpcode() == Instruction::GetElementPtr && |
|
1393 IP->getOperand(0) == V && IP->getOperand(1) == Idx) |
|
1394 - return IP; |
|
1395 + return &(*IP); |
|
1396 if (IP == BlockBegin) break; |
|
1397 } |
|
1398 } |
|
1399 @@ -557,7 +559,7 @@ |
|
1400 if (!Preheader) break; |
|
1401 |
|
1402 // Ok, move up a level. |
|
1403 - Builder.SetInsertPoint(Preheader, Preheader->getTerminator()); |
|
1404 + Builder.SetInsertPoint(Preheader->getTerminator()); |
|
1405 } |
|
1406 |
|
1407 // Emit a GEP. |
|
1408 @@ -588,7 +590,7 @@ |
|
1409 if (!Preheader) break; |
|
1410 |
|
1411 // Ok, move up a level. |
|
1412 - Builder.SetInsertPoint(Preheader, Preheader->getTerminator()); |
|
1413 + Builder.SetInsertPoint(Preheader->getTerminator()); |
|
1414 } |
|
1415 |
|
1416 // Insert a pretty getelementptr. Note that this GEP is not marked inbounds, |
|
1417 @@ -1168,8 +1170,8 @@ |
|
1418 PostIncLoops.clear(); |
|
1419 |
|
1420 // Expand code for the start value. |
|
1421 - Value *StartV = expandCodeFor(Normalized->getStart(), ExpandTy, |
|
1422 - L->getHeader()->begin()); |
|
1423 + Value *StartV = |
|
1424 + expandCodeFor(Normalized->getStart(), ExpandTy, &(L->getHeader()->front())); |
|
1425 |
|
1426 // StartV must be hoisted into L's preheader to dominate the new phi. |
|
1427 assert(!isa<Instruction>(StartV) || |
|
1428 @@ -1186,7 +1188,7 @@ |
|
1429 if (useSubtract) |
|
1430 Step = SE.getNegativeSCEV(Step); |
|
1431 // Expand the step somewhere that dominates the loop header. |
|
1432 - Value *StepV = expandCodeFor(Step, IntTy, L->getHeader()->begin()); |
|
1433 + Value *StepV = expandCodeFor(Step, IntTy, &(L->getHeader()->front())); |
|
1434 |
|
1435 // Create the PHI. |
|
1436 BasicBlock *Header = L->getHeader(); |
|
1437 @@ -1297,7 +1299,7 @@ |
|
1438 // or dominated by IVIncInsertPos. |
|
1439 if (isa<Instruction>(Result) |
|
1440 && !SE.DT->dominates(cast<Instruction>(Result), |
|
1441 - Builder.GetInsertPoint())) { |
|
1442 + &(*Builder.GetInsertPoint()))) { |
|
1443 // The induction variable's postinc expansion does not dominate this use. |
|
1444 // IVUsers tries to prevent this case, so it is rare. However, it can |
|
1445 // happen when an IVUser outside the loop is not dominated by the latch |
|
1446 @@ -1315,8 +1317,9 @@ |
|
1447 { |
|
1448 // Expand the step somewhere that dominates the loop header. |
|
1449 BuilderType::InsertPointGuard Guard(Builder); |
|
1450 - StepV = expandCodeFor(Step, IntTy, L->getHeader()->begin()); |
|
1451 + StepV = expandCodeFor(Step, IntTy, &(L->getHeader()->front())); |
|
1452 } |
|
1453 + |
|
1454 Result = expandIVInc(PN, StepV, L, ExpandTy, IntTy, useSubtract); |
|
1455 } |
|
1456 } |
|
1457 @@ -1395,7 +1398,7 @@ |
|
1458 isa<LandingPadInst>(NewInsertPt)) |
|
1459 ++NewInsertPt; |
|
1460 V = expandCodeFor(SE.getTruncateExpr(SE.getUnknown(V), Ty), nullptr, |
|
1461 - NewInsertPt); |
|
1462 + &(*NewInsertPt)); |
|
1463 return V; |
|
1464 } |
|
1465 |
|
1466 @@ -1436,7 +1439,7 @@ |
|
1467 BasicBlock *Header = L->getHeader(); |
|
1468 pred_iterator HPB = pred_begin(Header), HPE = pred_end(Header); |
|
1469 CanonicalIV = PHINode::Create(Ty, std::distance(HPB, HPE), "indvar", |
|
1470 - Header->begin()); |
|
1471 + &(Header->front())); |
|
1472 rememberInstruction(CanonicalIV); |
|
1473 |
|
1474 SmallSet<BasicBlock *, 4> PredSeen; |
|
1475 @@ -1581,7 +1584,8 @@ |
|
1476 |
|
1477 Value *SCEVExpander::expandCodeFor(const SCEV *SH, Type *Ty, |
|
1478 Instruction *IP) { |
|
1479 - Builder.SetInsertPoint(IP->getParent(), IP); |
|
1480 + assert(IP && "Invalid Instruction argument!"); |
|
1481 + Builder.SetInsertPoint(IP); |
|
1482 return expandCodeFor(SH, Ty); |
|
1483 } |
|
1484 |
|
1485 @@ -1599,7 +1603,7 @@ |
|
1486 Value *SCEVExpander::expand(const SCEV *S) { |
|
1487 // Compute an insertion point for this SCEV object. Hoist the instructions |
|
1488 // as far out in the loop nest as possible. |
|
1489 - Instruction *InsertPt = Builder.GetInsertPoint(); |
|
1490 + Instruction *InsertPt = &(*Builder.GetInsertPoint()); |
|
1491 for (Loop *L = SE.LI->getLoopFor(Builder.GetInsertBlock()); ; |
|
1492 L = L->getParentLoop()) |
|
1493 if (SE.isLoopInvariant(S, L)) { |
|
1494 @@ -1610,18 +1614,18 @@ |
|
1495 // LSR sets the insertion point for AddRec start/step values to the |
|
1496 // block start to simplify value reuse, even though it's an invalid |
|
1497 // position. SCEVExpander must correct for this in all cases. |
|
1498 - InsertPt = L->getHeader()->getFirstInsertionPt(); |
|
1499 + InsertPt = &*L->getHeader()->getFirstInsertionPt(); |
|
1500 } |
|
1501 } else { |
|
1502 // If the SCEV is computable at this level, insert it into the header |
|
1503 // after the PHIs (and after any other instructions that we've inserted |
|
1504 // there) so that it is guaranteed to dominate any user inside the loop. |
|
1505 if (L && SE.hasComputableLoopEvolution(S, L) && !PostIncLoops.count(L)) |
|
1506 - InsertPt = L->getHeader()->getFirstInsertionPt(); |
|
1507 + InsertPt = &*L->getHeader()->getFirstInsertionPt(); |
|
1508 while (InsertPt != Builder.GetInsertPoint() |
|
1509 && (isInsertedInstruction(InsertPt) |
|
1510 || isa<DbgInfoIntrinsic>(InsertPt))) { |
|
1511 - InsertPt = std::next(BasicBlock::iterator(InsertPt)); |
|
1512 + InsertPt = &(*std::next(BasicBlock::iterator(InsertPt))); |
|
1513 } |
|
1514 break; |
|
1515 } |
|
1516 @@ -1633,7 +1637,7 @@ |
|
1517 return I->second; |
|
1518 |
|
1519 BuilderType::InsertPointGuard Guard(Builder); |
|
1520 - Builder.SetInsertPoint(InsertPt->getParent(), InsertPt); |
|
1521 + Builder.SetInsertPoint(InsertPt); |
|
1522 |
|
1523 // Expand the expression into instructions. |
|
1524 Value *V = visit(S); |
|
1525 @@ -1671,8 +1675,9 @@ |
|
1526 |
|
1527 // Emit code for it. |
|
1528 BuilderType::InsertPointGuard Guard(Builder); |
|
1529 - PHINode *V = cast<PHINode>(expandCodeFor(H, nullptr, |
|
1530 - L->getHeader()->begin())); |
|
1531 + PHINode *V = |
|
1532 + cast<PHINode>(expandCodeFor(H, nullptr, |
|
1533 + &(L->getHeader()->front()))); |
|
1534 |
|
1535 return V; |
|
1536 } |
|
1537 @@ -1778,7 +1783,7 @@ |
|
1538 if (OrigInc->getType() != IsomorphicInc->getType()) { |
|
1539 Instruction *IP = nullptr; |
|
1540 if (PHINode *PN = dyn_cast<PHINode>(OrigInc)) |
|
1541 - IP = PN->getParent()->getFirstInsertionPt(); |
|
1542 + IP = &*PN->getParent()->getFirstInsertionPt(); |
|
1543 else |
|
1544 IP = OrigInc->getNextNode(); |
|
1545 |
|
1546 @@ -1796,7 +1801,7 @@ |
|
1547 ++NumElim; |
|
1548 Value *NewIV = OrigPhiRef; |
|
1549 if (OrigPhiRef->getType() != Phi->getType()) { |
|
1550 - IRBuilder<> Builder(L->getHeader()->getFirstInsertionPt()); |
|
1551 + IRBuilder<> Builder(&*L->getHeader()->getFirstInsertionPt()); |
|
1552 Builder.SetCurrentDebugLocation(Phi->getDebugLoc()); |
|
1553 NewIV = Builder.CreateTruncOrBitCast(OrigPhiRef, Phi->getType(), IVName); |
|
1554 } |
|
1555 --- lib/Analysis/ScalarEvolutionNormalization.cpp 2014-08-29 14:53:01.000000000 -0700 |
|
1556 +++ lib/Analysis/ScalarEvolutionNormalization.cpp 2015-11-27 15:32:52.251292445 -0800 |
|
1557 @@ -109,7 +109,7 @@ |
|
1558 SmallVector<const SCEV *, 8> Operands; |
|
1559 const Loop *L = AR->getLoop(); |
|
1560 // The addrec conceptually uses its operands at loop entry. |
|
1561 - Instruction *LUser = L->getHeader()->begin(); |
|
1562 + Instruction *LUser = &(L->getHeader()->front()); |
|
1563 // Transform each operand. |
|
1564 for (SCEVNAryExpr::op_iterator I = AR->op_begin(), E = AR->op_end(); |
|
1565 I != E; ++I) { |
|
1566 --- lib/Analysis/SparsePropagation.cpp 2014-04-21 19:48:03.000000000 -0700 |
|
1567 +++ lib/Analysis/SparsePropagation.cpp 2015-11-27 16:56:54.595156233 -0800 |
|
1568 @@ -328,17 +328,17 @@ |
|
1569 |
|
1570 void SparseSolver::Print(Function &F, raw_ostream &OS) const { |
|
1571 OS << "\nFUNCTION: " << F.getName() << "\n"; |
|
1572 - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { |
|
1573 - if (!BBExecutable.count(BB)) |
|
1574 + for (auto &BB : F) { |
|
1575 + if (!BBExecutable.count(&BB)) |
|
1576 OS << "INFEASIBLE: "; |
|
1577 OS << "\t"; |
|
1578 - if (BB->hasName()) |
|
1579 - OS << BB->getName() << ":\n"; |
|
1580 + if (BB.hasName()) |
|
1581 + OS << BB.getName() << ":\n"; |
|
1582 else |
|
1583 OS << "; anon bb\n"; |
|
1584 - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { |
|
1585 - LatticeFunc->PrintValue(getLatticeState(I), OS); |
|
1586 - OS << *I << "\n"; |
|
1587 + for (auto &I : BB) { |
|
1588 + LatticeFunc->PrintValue(getLatticeState(&I), OS); |
|
1589 + OS << I << "\n"; |
|
1590 } |
|
1591 |
|
1592 OS << "\n"; |
|
1593 --- lib/Analysis/ValueTracking.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
1594 +++ lib/Analysis/ValueTracking.cpp 2015-11-27 17:02:21.643435710 -0800 |
|
1595 @@ -403,8 +403,8 @@ |
|
1596 for (BasicBlock::const_iterator I = |
|
1597 std::next(BasicBlock::const_iterator(Q.CxtI)), |
|
1598 IE(Inv); I != IE; ++I) |
|
1599 - if (!isSafeToSpeculativelyExecute(I, DL) && |
|
1600 - !isAssumeLikeIntrinsic(I)) |
|
1601 + if (!isSafeToSpeculativelyExecute(&*I, DL) && |
|
1602 + !isAssumeLikeIntrinsic(&*I)) |
|
1603 return false; |
|
1604 |
|
1605 return !isEphemeralValueOf(Inv, Q.CxtI); |
|
1606 @@ -421,15 +421,15 @@ |
|
1607 // of the block); the common case is that the assume will come first. |
|
1608 for (BasicBlock::iterator I = std::next(BasicBlock::iterator(Inv)), |
|
1609 IE = Inv->getParent()->end(); I != IE; ++I) |
|
1610 - if (I == Q.CxtI) |
|
1611 + if (&*I == Q.CxtI) |
|
1612 return true; |
|
1613 |
|
1614 // The context must come first... |
|
1615 for (BasicBlock::const_iterator I = |
|
1616 std::next(BasicBlock::const_iterator(Q.CxtI)), |
|
1617 IE(Inv); I != IE; ++I) |
|
1618 - if (!isSafeToSpeculativelyExecute(I, DL) && |
|
1619 - !isAssumeLikeIntrinsic(I)) |
|
1620 + if (!isSafeToSpeculativelyExecute(&*I, DL) && |
|
1621 + !isAssumeLikeIntrinsic(&*I)) |
|
1622 return false; |
|
1623 |
|
1624 return !isEphemeralValueOf(Inv, Q.CxtI); |
|
1625 --- lib/AsmParser/LLParser.cpp 2015-01-13 13:10:44.000000000 -0800 |
|
1626 +++ lib/AsmParser/LLParser.cpp 2015-12-06 12:01:01.192696877 -0800 |
|
1627 @@ -152,8 +152,10 @@ |
|
1628 U->resolveCycles(); |
|
1629 |
|
1630 // Look for intrinsic functions and CallInst that need to be upgraded |
|
1631 - for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ) |
|
1632 - UpgradeCallsToIntrinsic(FI++); // must be post-increment, as we remove |
|
1633 + for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ) { |
|
1634 + UpgradeCallsToIntrinsic(&*FI); // must be post-increment, as we remove |
|
1635 + ++FI; |
|
1636 + } |
|
1637 |
|
1638 UpgradeDebugInfo(*M); |
|
1639 |
|
1640 @@ -2091,7 +2093,7 @@ |
|
1641 for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); |
|
1642 AI != E; ++AI) |
|
1643 if (!AI->hasName()) |
|
1644 - NumberedVals.push_back(AI); |
|
1645 + NumberedVals.push_back(&*AI); |
|
1646 } |
|
1647 |
|
1648 LLParser::PerFunctionState::~PerFunctionState() { |
|
1649 --- lib/Bitcode/Reader/BitcodeReader.cpp 2015-02-17 13:27:11.000000000 -0800 |
|
1650 +++ lib/Bitcode/Reader/BitcodeReader.cpp 2015-12-06 12:21:14.006297865 -0800 |
|
1651 @@ -1830,7 +1830,7 @@ |
|
1652 return Error("Invalid ID"); |
|
1653 ++BBI; |
|
1654 } |
|
1655 - BB = BBI; |
|
1656 + BB = &*BBI; |
|
1657 } else { |
|
1658 // Otherwise insert a placeholder and remember it so it can be inserted |
|
1659 // when the function is parsed. |
|
1660 @@ -1945,20 +1945,15 @@ |
|
1661 return Error("Malformed global initializer set"); |
|
1662 |
|
1663 // Look for intrinsic functions which need to be upgraded at some point |
|
1664 - for (Module::iterator FI = TheModule->begin(), FE = TheModule->end(); |
|
1665 - FI != FE; ++FI) { |
|
1666 + for (Function &F : *TheModule) { |
|
1667 Function *NewFn; |
|
1668 - if (UpgradeIntrinsicFunction(FI, NewFn)) |
|
1669 - UpgradedIntrinsics.push_back(std::make_pair(FI, NewFn)); |
|
1670 + if (UpgradeIntrinsicFunction(&F, NewFn)) |
|
1671 + UpgradedIntrinsics.push_back(std::make_pair(&F, NewFn)); |
|
1672 } |
|
1673 |
|
1674 // Look for global variables which need to be renamed. |
|
1675 - for (Module::global_iterator |
|
1676 - GI = TheModule->global_begin(), GE = TheModule->global_end(); |
|
1677 - GI != GE;) { |
|
1678 - GlobalVariable *GV = GI++; |
|
1679 - UpgradeGlobalVariable(GV); |
|
1680 - } |
|
1681 + for (GlobalVariable &GV : TheModule->globals()) |
|
1682 + UpgradeGlobalVariable(&GV); |
|
1683 |
|
1684 // Force deallocation of memory for these vectors to favor the client that |
|
1685 // want lazy deserialization. |
|
1686 @@ -2528,8 +2523,8 @@ |
|
1687 unsigned ModuleMDValueListSize = MDValueList.size(); |
|
1688 |
|
1689 // Add all the function arguments to the value table. |
|
1690 - for(Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) |
|
1691 - ValueList.push_back(I); |
|
1692 + for (Argument &I : F->args()) |
|
1693 + ValueList.push_back(&I); |
|
1694 |
|
1695 unsigned NextValueNo = ValueList.size(); |
|
1696 BasicBlock *CurBB = nullptr; |
|
1697 @@ -3555,9 +3550,8 @@ |
|
1698 |
|
1699 // Iterate over the module, deserializing any functions that are still on |
|
1700 // disk. |
|
1701 - for (Module::iterator F = TheModule->begin(), E = TheModule->end(); |
|
1702 - F != E; ++F) { |
|
1703 - if (std::error_code EC = materialize(F)) |
|
1704 + for (Function &F : *TheModule) { |
|
1705 + if (std::error_code EC = materialize(&F)) |
|
1706 return EC; |
|
1707 } |
|
1708 // At this point, if there are any function bodies, the current bit is |
|
1709 --- lib/Bitcode/Writer/BitcodeWriter.cpp 2015-01-13 13:10:44.000000000 -0800 |
|
1710 +++ lib/Bitcode/Writer/BitcodeWriter.cpp 2015-12-06 12:22:42.877667625 -0800 |
|
1711 @@ -924,7 +924,7 @@ |
|
1712 // If no metadata, ignore instruction. |
|
1713 if (MDs.empty()) continue; |
|
1714 |
|
1715 - Record.push_back(VE.getInstructionID(I)); |
|
1716 + Record.push_back(VE.getInstructionID(&*I)); |
|
1717 |
|
1718 for (unsigned i = 0, e = MDs.size(); i != e; ++i) { |
|
1719 Record.push_back(MDs[i].first); |
|
1720 --- lib/Bitcode/Writer/ValueEnumerator.cpp 2015-01-13 13:10:44.000000000 -0800 |
|
1721 +++ lib/Bitcode/Writer/ValueEnumerator.cpp 2015-12-06 12:26:51.090576745 -0800 |
|
1722 @@ -290,18 +290,18 @@ |
|
1723 // Enumerate the global variables. |
|
1724 for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); |
|
1725 I != E; ++I) |
|
1726 - EnumerateValue(I); |
|
1727 + EnumerateValue(&*I); |
|
1728 |
|
1729 // Enumerate the functions. |
|
1730 for (Module::const_iterator I = M.begin(), E = M.end(); I != E; ++I) { |
|
1731 - EnumerateValue(I); |
|
1732 + EnumerateValue(&*I); |
|
1733 EnumerateAttributes(cast<Function>(I)->getAttributes()); |
|
1734 } |
|
1735 |
|
1736 // Enumerate the aliases. |
|
1737 for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); |
|
1738 I != E; ++I) |
|
1739 - EnumerateValue(I); |
|
1740 + EnumerateValue(&*I); |
|
1741 |
|
1742 // Remember what is the cutoff between globalvalue's and other constants. |
|
1743 unsigned FirstConstant = Values.size(); |
|
1744 @@ -509,7 +509,7 @@ |
|
1745 for (Module::const_named_metadata_iterator I = M.named_metadata_begin(), |
|
1746 E = M.named_metadata_end(); |
|
1747 I != E; ++I) |
|
1748 - EnumerateNamedMDNode(I); |
|
1749 + EnumerateNamedMDNode(&*I); |
|
1750 } |
|
1751 |
|
1752 void ValueEnumerator::EnumerateNamedMDNode(const NamedMDNode *MD) { |
|
1753 @@ -726,7 +726,7 @@ |
|
1754 // Adding function arguments to the value table. |
|
1755 for (Function::const_arg_iterator I = F.arg_begin(), E = F.arg_end(); |
|
1756 I != E; ++I) |
|
1757 - EnumerateValue(I); |
|
1758 + EnumerateValue(&*I); |
|
1759 |
|
1760 FirstFuncConstantID = Values.size(); |
|
1761 |
|
1762 @@ -739,8 +739,8 @@ |
|
1763 isa<InlineAsm>(*OI)) |
|
1764 EnumerateValue(*OI); |
|
1765 } |
|
1766 - BasicBlocks.push_back(BB); |
|
1767 - ValueMap[BB] = BasicBlocks.size(); |
|
1768 + BasicBlocks.push_back(&*BB); |
|
1769 + ValueMap[&*BB] = BasicBlocks.size(); |
|
1770 } |
|
1771 |
|
1772 // Optimize the constant layout. |
|
1773 @@ -765,7 +765,7 @@ |
|
1774 } |
|
1775 |
|
1776 if (!I->getType()->isVoidTy()) |
|
1777 - EnumerateValue(I); |
|
1778 + EnumerateValue(&*I); |
|
1779 } |
|
1780 } |
|
1781 |
|
1782 @@ -793,7 +793,7 @@ |
|
1783 DenseMap<const BasicBlock*, unsigned> &IDMap) { |
|
1784 unsigned Counter = 0; |
|
1785 for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) |
|
1786 - IDMap[BB] = ++Counter; |
|
1787 + IDMap[&*BB] = ++Counter; |
|
1788 } |
|
1789 |
|
1790 /// getGlobalBasicBlockID - This returns the function-specific ID for the |
|
1791 --- lib/CodeGen/Analysis.cpp 2015-06-12 08:57:35.000000000 -0700 |
|
1792 +++ lib/CodeGen/Analysis.cpp 2015-12-06 12:38:15.443685028 -0800 |
|
1793 @@ -514,7 +514,7 @@ |
|
1794 if (isa<DbgInfoIntrinsic>(BBI)) |
|
1795 continue; |
|
1796 if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() || |
|
1797 - !isSafeToSpeculativelyExecute(BBI)) |
|
1798 + !isSafeToSpeculativelyExecute(&*BBI)) |
|
1799 return false; |
|
1800 } |
|
1801 |
|
1802 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp 2015-01-12 16:48:10.000000000 -0800 |
|
1803 +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp 2016-01-21 10:23:14.978051692 -0800 |
|
1804 @@ -857,6 +857,7 @@ |
|
1805 MCSymbol *Sym = GetBlockAddressSymbol(&BB); |
|
1806 if (Sym->isDefined()) |
|
1807 continue; |
|
1808 + |
|
1809 OutStreamer.AddComment("Address of block that was removed by CodeGen"); |
|
1810 OutStreamer.EmitLabel(Sym); |
|
1811 } |
|
1812 @@ -864,8 +865,8 @@ |
|
1813 // Emit target-specific gunk after the function body. |
|
1814 EmitFunctionBodyEnd(); |
|
1815 |
|
1816 - // If the target wants a .size directive for the size of the function, emit |
|
1817 - // it. |
|
1818 + // If the target wants a .size directive for the size of the function, |
|
1819 + // emit it. |
|
1820 if (MAI->hasDotTypeDotSizeDirective()) { |
|
1821 // Create a symbol for the end of function, so we can get the size as |
|
1822 // difference between the function label and the temp label. |
|
1823 @@ -885,6 +886,7 @@ |
|
1824 NamedRegionTimer T(HI.TimerName, HI.TimerGroupName, TimePassesIsEnabled); |
|
1825 HI.Handler->endFunction(MF); |
|
1826 } |
|
1827 + |
|
1828 MMI->EndFunction(); |
|
1829 |
|
1830 // Print out jump tables referenced by the function. |
|
1831 --- lib/CodeGen/AtomicExpandPass.cpp 2014-09-25 10:27:43.000000000 -0700 |
|
1832 +++ lib/CodeGen/AtomicExpandPass.cpp 2015-12-06 12:41:26.021558967 -0800 |
|
1833 @@ -298,7 +298,8 @@ |
|
1834 // atomicrmw.end: |
|
1835 // fence? |
|
1836 // [...] |
|
1837 - BasicBlock *ExitBB = BB->splitBasicBlock(AI, "atomicrmw.end"); |
|
1838 + BasicBlock *ExitBB = BB->splitBasicBlock(AI->getIterator(), |
|
1839 + "atomicrmw.end"); |
|
1840 BasicBlock *LoopBB = BasicBlock::Create(Ctx, "atomicrmw.start", F, ExitBB); |
|
1841 |
|
1842 // This grabs the DebugLoc from AI. |
|
1843 @@ -355,7 +356,7 @@ |
|
1844 // br i1 %success, label %atomicrmw.end, label %loop |
|
1845 // atomicrmw.end: |
|
1846 // [...] |
|
1847 - BasicBlock *ExitBB = BB->splitBasicBlock(AI, "atomicrmw.end"); |
|
1848 + BasicBlock *ExitBB = BB->splitBasicBlock(AI->getIterator(), "atomicrmw.end"); |
|
1849 BasicBlock *LoopBB = BasicBlock::Create(Ctx, "atomicrmw.start", F, ExitBB); |
|
1850 |
|
1851 // This grabs the DebugLoc from AI. |
|
1852 @@ -436,7 +437,7 @@ |
|
1853 // %restmp = insertvalue { iN, i1 } undef, iN %loaded, 0 |
|
1854 // %res = insertvalue { iN, i1 } %restmp, i1 %success, 1 |
|
1855 // [...] |
|
1856 - BasicBlock *ExitBB = BB->splitBasicBlock(CI, "cmpxchg.end"); |
|
1857 + BasicBlock *ExitBB = BB->splitBasicBlock(CI->getIterator(), "cmpxchg.end"); |
|
1858 auto FailureBB = BasicBlock::Create(Ctx, "cmpxchg.failure", F, ExitBB); |
|
1859 auto SuccessBB = BasicBlock::Create(Ctx, "cmpxchg.success", F, FailureBB); |
|
1860 auto TryStoreBB = BasicBlock::Create(Ctx, "cmpxchg.trystore", F, SuccessBB); |
|
1861 --- lib/CodeGen/BasicTargetTransformInfo.cpp 2015-01-07 16:51:32.000000000 -0800 |
|
1862 +++ lib/CodeGen/BasicTargetTransformInfo.cpp 2015-12-06 12:42:25.950965490 -0800 |
|
1863 @@ -240,7 +240,7 @@ |
|
1864 |
|
1865 for (BasicBlock::iterator J = BB->begin(), JE = BB->end(); J != JE; ++J) |
|
1866 if (isa<CallInst>(J) || isa<InvokeInst>(J)) { |
|
1867 - ImmutableCallSite CS(J); |
|
1868 + ImmutableCallSite CS(&*J); |
|
1869 if (const Function *F = CS.getCalledFunction()) { |
|
1870 if (!TopTTI->isLoweredToCall(F)) |
|
1871 continue; |
|
1872 --- lib/CodeGen/BranchFolding.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
1873 +++ lib/CodeGen/BranchFolding.cpp 2015-12-06 14:41:40.491854005 -0800 |
|
1874 @@ -130,7 +130,7 @@ |
|
1875 TriedMerging.erase(MBB); |
|
1876 |
|
1877 // Remove the block. |
|
1878 - MF->erase(MBB); |
|
1879 + MF->erase(MBB->getIterator()); |
|
1880 } |
|
1881 |
|
1882 /// OptimizeImpDefsBlock - If a basic block is just a bunch of implicit_def |
|
1883 @@ -207,12 +207,12 @@ |
|
1884 |
|
1885 // Fix CFG. The later algorithms expect it to be right. |
|
1886 bool MadeChange = false; |
|
1887 - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; I++) { |
|
1888 - MachineBasicBlock *MBB = I, *TBB = nullptr, *FBB = nullptr; |
|
1889 + for (MachineBasicBlock &MBB : MF) { |
|
1890 + MachineBasicBlock *TBB = nullptr, *FBB = nullptr; |
|
1891 SmallVector<MachineOperand, 4> Cond; |
|
1892 - if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond, true)) |
|
1893 - MadeChange |= MBB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty()); |
|
1894 - MadeChange |= OptimizeImpDefsBlock(MBB); |
|
1895 + if (!TII->AnalyzeBranch(MBB, TBB, FBB, Cond, true)) |
|
1896 + MadeChange |= MBB.CorrectExtraCFGEdges(TBB, FBB, !Cond.empty()); |
|
1897 + MadeChange |= OptimizeImpDefsBlock(&MBB); |
|
1898 } |
|
1899 |
|
1900 bool MadeChangeThisIteration = true; |
|
1901 @@ -426,7 +426,7 @@ |
|
1902 MachineFunction &MF = *CurMBB.getParent(); |
|
1903 |
|
1904 // Create the fall-through block. |
|
1905 - MachineFunction::iterator MBBI = &CurMBB; |
|
1906 + MachineFunction::iterator MBBI = CurMBB.getIterator(); |
|
1907 MachineBasicBlock *NewMBB =MF.CreateMachineBasicBlock(BB); |
|
1908 CurMBB.getParent()->insert(++MBBI, NewMBB); |
|
1909 |
|
1910 @@ -479,7 +479,7 @@ |
|
1911 DebugLoc dl; // FIXME: this is nowhere |
|
1912 if (I != MF->end() && |
|
1913 !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond, true)) { |
|
1914 - MachineBasicBlock *NextBB = I; |
|
1915 + MachineBasicBlock *NextBB = &*I; |
|
1916 if (TBB == NextBB && !Cond.empty() && !FBB) { |
|
1917 if (!TII->ReverseBranchCondition(Cond)) { |
|
1918 TII->RemoveBranch(*CurMBB); |
|
1919 @@ -785,8 +785,8 @@ |
|
1920 // block, which we can't jump to), we can treat all blocks with this same |
|
1921 // tail at once. Use PredBB if that is one of the possibilities, as that |
|
1922 // will not introduce any extra branches. |
|
1923 - MachineBasicBlock *EntryBB = MergePotentials.begin()->getBlock()-> |
|
1924 - getParent()->begin(); |
|
1925 + MachineBasicBlock *EntryBB = |
|
1926 + &MergePotentials.front().getBlock()->getParent()->front(); |
|
1927 unsigned commonTailIndex = SameTails.size(); |
|
1928 // If there are two blocks, check to see if one can be made to fall through |
|
1929 // into the other. |
|
1930 @@ -860,12 +860,12 @@ |
|
1931 |
|
1932 // First find blocks with no successors. |
|
1933 MergePotentials.clear(); |
|
1934 - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); |
|
1935 - I != E && MergePotentials.size() < TailMergeThreshold; ++I) { |
|
1936 - if (TriedMerging.count(I)) |
|
1937 - continue; |
|
1938 - if (I->succ_empty()) |
|
1939 - MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(I), I)); |
|
1940 + for (MachineBasicBlock &MBB : MF) { |
|
1941 + if (MergePotentials.size() == TailMergeThreshold) |
|
1942 + break; |
|
1943 + |
|
1944 + if (!TriedMerging.count(&MBB) && MBB.succ_empty()) |
|
1945 + MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(&MBB), &MBB)); |
|
1946 } |
|
1947 |
|
1948 // If this is a large problem, avoid visiting the same basic blocks |
|
1949 @@ -901,8 +901,8 @@ |
|
1950 I != E; ++I) { |
|
1951 if (I->pred_size() < 2) continue; |
|
1952 SmallPtrSet<MachineBasicBlock *, 8> UniquePreds; |
|
1953 - MachineBasicBlock *IBB = I; |
|
1954 - MachineBasicBlock *PredBB = std::prev(I); |
|
1955 + MachineBasicBlock *IBB = &*I; |
|
1956 + MachineBasicBlock *PredBB = &*std::prev(I); |
|
1957 MergePotentials.clear(); |
|
1958 for (MachineBasicBlock::pred_iterator P = I->pred_begin(), |
|
1959 E2 = I->pred_end(); |
|
1960 @@ -933,18 +933,21 @@ |
|
1961 if (TII->ReverseBranchCondition(NewCond)) |
|
1962 continue; |
|
1963 // This is the QBB case described above |
|
1964 - if (!FBB) |
|
1965 - FBB = std::next(MachineFunction::iterator(PBB)); |
|
1966 + if (!FBB) { |
|
1967 + auto Next = ++PBB->getIterator(); |
|
1968 + if (Next != MF.end()) |
|
1969 + FBB = &*Next; |
|
1970 + } |
|
1971 } |
|
1972 |
|
1973 // Failing case: the only way IBB can be reached from PBB is via |
|
1974 // exception handling. Happens for landing pads. Would be nice to have |
|
1975 // a bit in the edge so we didn't have to do all this. |
|
1976 if (IBB->isLandingPad()) { |
|
1977 - MachineFunction::iterator IP = PBB; IP++; |
|
1978 + MachineFunction::iterator IP = ++PBB->getIterator(); |
|
1979 MachineBasicBlock *PredNextBB = nullptr; |
|
1980 if (IP != MF.end()) |
|
1981 - PredNextBB = IP; |
|
1982 + PredNextBB = &*IP; |
|
1983 if (!TBB) { |
|
1984 if (IBB != PredNextBB) // fallthrough |
|
1985 continue; |
|
1986 @@ -985,7 +988,7 @@ |
|
1987 |
|
1988 // Reinsert an unconditional branch if needed. The 1 below can occur as a |
|
1989 // result of removing blocks in TryTailMergeBlocks. |
|
1990 - PredBB = std::prev(I); // this may have been changed in TryTailMergeBlocks |
|
1991 + PredBB = &*std::prev(I); // this may have been changed in TryTailMergeBlocks |
|
1992 if (MergePotentials.size() == 1 && |
|
1993 MergePotentials.begin()->getBlock() != PredBB) |
|
1994 FixTail(MergePotentials.begin()->getBlock(), IBB, TII); |
|
1995 @@ -1044,7 +1047,7 @@ |
|
1996 |
|
1997 for (MachineFunction::iterator I = std::next(MF.begin()), E = MF.end(); |
|
1998 I != E; ) { |
|
1999 - MachineBasicBlock *MBB = I++; |
|
2000 + MachineBasicBlock *MBB = &*I++; |
|
2001 MadeChange |= OptimizeBlock(MBB); |
|
2002 |
|
2003 // If it is dead, remove it. |
|
2004 @@ -1132,7 +1135,7 @@ |
|
2005 MachineFunction &MF = *MBB->getParent(); |
|
2006 ReoptimizeBlock: |
|
2007 |
|
2008 - MachineFunction::iterator FallThrough = MBB; |
|
2009 + MachineFunction::iterator FallThrough = MBB->getIterator(); |
|
2010 ++FallThrough; |
|
2011 |
|
2012 // If this block is empty, make everyone use its fall-through, not the block |
|
2013 @@ -1150,12 +1153,12 @@ |
|
2014 // instead. |
|
2015 while (!MBB->pred_empty()) { |
|
2016 MachineBasicBlock *Pred = *(MBB->pred_end()-1); |
|
2017 - Pred->ReplaceUsesOfBlockWith(MBB, FallThrough); |
|
2018 + Pred->ReplaceUsesOfBlockWith(MBB, &*FallThrough); |
|
2019 } |
|
2020 // If MBB was the target of a jump table, update jump tables to go to the |
|
2021 // fallthrough instead. |
|
2022 if (MachineJumpTableInfo *MJTI = MF.getJumpTableInfo()) |
|
2023 - MJTI->ReplaceMBBInJumpTables(MBB, FallThrough); |
|
2024 + MJTI->ReplaceMBBInJumpTables(MBB, &*FallThrough); |
|
2025 MadeChange = true; |
|
2026 } |
|
2027 return MadeChange; |
|
2028 @@ -1293,7 +1296,7 @@ |
|
2029 TII->InsertBranch(PrevBB, MBB, nullptr, NewPriorCond, dl); |
|
2030 |
|
2031 // Move this block to the end of the function. |
|
2032 - MBB->moveAfter(--MF.end()); |
|
2033 + MBB->moveAfter(&MF.back()); |
|
2034 MadeChange = true; |
|
2035 ++NumBranchOpts; |
|
2036 return MadeChange; |
|
2037 @@ -1440,11 +1443,8 @@ |
|
2038 if (!MBB->isLandingPad()) { |
|
2039 // Check all the predecessors of this block. If one of them has no fall |
|
2040 // throughs, move this block right after it. |
|
2041 - for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(), |
|
2042 - E = MBB->pred_end(); PI != E; ++PI) { |
|
2043 + for (MachineBasicBlock *PredBB : MBB->predecessors()) { |
|
2044 // Analyze the branch at the end of the pred. |
|
2045 - MachineBasicBlock *PredBB = *PI; |
|
2046 - MachineFunction::iterator PredFallthrough = PredBB; ++PredFallthrough; |
|
2047 MachineBasicBlock *PredTBB = nullptr, *PredFBB = nullptr; |
|
2048 SmallVector<MachineOperand, 4> PredCond; |
|
2049 if (PredBB != MBB && !PredBB->canFallThrough() && |
|
2050 @@ -1462,8 +1462,7 @@ |
|
2051 // B elsewhere |
|
2052 // next: |
|
2053 if (CurFallsThru) { |
|
2054 - MachineBasicBlock *NextBB = |
|
2055 - std::next(MachineFunction::iterator(MBB)); |
|
2056 + MachineBasicBlock *NextBB = &*std::next(MBB->getIterator()); |
|
2057 CurCond.clear(); |
|
2058 TII->InsertBranch(*MBB, NextBB, nullptr, CurCond, DebugLoc()); |
|
2059 } |
|
2060 @@ -1476,11 +1475,13 @@ |
|
2061 |
|
2062 if (!CurFallsThru) { |
|
2063 // Check all successors to see if we can move this block before it. |
|
2064 + for (MachineBasicBlock *SuccBB : MBB->successors()) { |
|
2065 +#if 0 |
|
2066 for (MachineBasicBlock::succ_iterator SI = MBB->succ_begin(), |
|
2067 E = MBB->succ_end(); SI != E; ++SI) { |
|
2068 +#endif |
|
2069 // Analyze the branch at the end of the block before the succ. |
|
2070 - MachineBasicBlock *SuccBB = *SI; |
|
2071 - MachineFunction::iterator SuccPrev = SuccBB; --SuccPrev; |
|
2072 + MachineFunction::iterator SuccPrev = --SuccBB->getIterator(); |
|
2073 |
|
2074 // If this block doesn't already fall-through to that successor, and if |
|
2075 // the succ doesn't already have a block that can fall through into it, |
|
2076 @@ -1502,8 +1503,8 @@ |
|
2077 SmallVector<MachineOperand, 4> PrevCond; |
|
2078 if (FallThrough != MF.end() && |
|
2079 !TII->AnalyzeBranch(PrevBB, PrevTBB, PrevFBB, PrevCond, true) && |
|
2080 - PrevBB.isSuccessor(FallThrough)) { |
|
2081 - MBB->moveAfter(--MF.end()); |
|
2082 + PrevBB.isSuccessor(&*FallThrough)) { |
|
2083 + MBB->moveAfter(&MF.back()); |
|
2084 MadeChange = true; |
|
2085 return MadeChange; |
|
2086 } |
|
2087 @@ -1522,7 +1523,7 @@ |
|
2088 bool BranchFolder::HoistCommonCode(MachineFunction &MF) { |
|
2089 bool MadeChange = false; |
|
2090 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ) { |
|
2091 - MachineBasicBlock *MBB = I++; |
|
2092 + MachineBasicBlock *MBB = &*I++; |
|
2093 MadeChange |= HoistCommonCodeInSuccs(MBB); |
|
2094 } |
|
2095 |
|
2096 --- lib/CodeGen/CodeGenPrepare.cpp 2015-01-12 09:22:43.000000000 -0800 |
|
2097 +++ lib/CodeGen/CodeGenPrepare.cpp 2015-12-06 14:55:51.313203408 -0800 |
|
2098 @@ -245,7 +245,8 @@ |
|
2099 while (MadeChange) { |
|
2100 MadeChange = false; |
|
2101 for (Function::iterator I = F.begin(); I != F.end(); ) { |
|
2102 - BasicBlock *BB = I++; |
|
2103 + BasicBlock *BB = &*I; |
|
2104 + ++I; |
|
2105 bool ModifiedDTOnIteration = false; |
|
2106 MadeChange |= OptimizeBlock(*BB, ModifiedDTOnIteration); |
|
2107 |
|
2108 @@ -311,7 +312,8 @@ |
|
2109 bool Changed = false; |
|
2110 // Scan all of the blocks in the function, except for the entry block. |
|
2111 for (Function::iterator I = std::next(F.begin()), E = F.end(); I != E;) { |
|
2112 - BasicBlock *BB = I++; |
|
2113 + BasicBlock *BB = &*I; |
|
2114 + ++I; |
|
2115 // If the destination block has a single pred, then this is a trivial |
|
2116 // edge, just collapse it. |
|
2117 BasicBlock *SinglePred = BB->getSinglePredecessor(); |
|
2118 @@ -332,7 +334,7 @@ |
|
2119 BB->moveBefore(&BB->getParent()->getEntryBlock()); |
|
2120 |
|
2121 // We have erased a block. Update the iterator. |
|
2122 - I = BB; |
|
2123 + I = BB->getIterator(); |
|
2124 } |
|
2125 } |
|
2126 return Changed; |
|
2127 @@ -347,7 +349,8 @@ |
|
2128 bool MadeChange = false; |
|
2129 // Note that this intentionally skips the entry block. |
|
2130 for (Function::iterator I = std::next(F.begin()), E = F.end(); I != E;) { |
|
2131 - BasicBlock *BB = I++; |
|
2132 + BasicBlock *BB = &*I; |
|
2133 + ++I; |
|
2134 |
|
2135 // If this block doesn't end with an uncond branch, ignore it. |
|
2136 BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()); |
|
2137 @@ -356,7 +359,7 @@ |
|
2138 |
|
2139 // If the instruction before the branch (skipping debug info) isn't a phi |
|
2140 // node, then other stuff is happening here. |
|
2141 - BasicBlock::iterator BBI = BI; |
|
2142 + BasicBlock::iterator BBI(BI); |
|
2143 if (BBI != BB->begin()) { |
|
2144 --BBI; |
|
2145 while (isa<DbgInfoIntrinsic>(BBI)) { |
|
2146 @@ -553,8 +556,8 @@ |
|
2147 if (!InsertedCast) { |
|
2148 BasicBlock::iterator InsertPt = UserBB->getFirstInsertionPt(); |
|
2149 InsertedCast = |
|
2150 - CastInst::Create(CI->getOpcode(), CI->getOperand(0), CI->getType(), "", |
|
2151 - InsertPt); |
|
2152 + CastInst::Create(CI->getOpcode(), CI->getOperand(0), |
|
2153 + CI->getType(), "", &*InsertPt); |
|
2154 MadeChange = true; |
|
2155 } |
|
2156 |
|
2157 @@ -648,7 +651,7 @@ |
|
2158 InsertedCmp = |
|
2159 CmpInst::Create(CI->getOpcode(), |
|
2160 CI->getPredicate(), CI->getOperand(0), |
|
2161 - CI->getOperand(1), "", InsertPt); |
|
2162 + CI->getOperand(1), "", &*InsertPt); |
|
2163 MadeChange = true; |
|
2164 } |
|
2165 |
|
2166 @@ -734,17 +737,17 @@ |
|
2167 // Sink the shift |
|
2168 if (ShiftI->getOpcode() == Instruction::AShr) |
|
2169 InsertedShift = |
|
2170 - BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI, "", InsertPt); |
|
2171 + BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI, "", &*InsertPt); |
|
2172 else |
|
2173 InsertedShift = |
|
2174 - BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI, "", InsertPt); |
|
2175 + BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI, "", &*InsertPt); |
|
2176 |
|
2177 // Sink the trunc |
|
2178 BasicBlock::iterator TruncInsertPt = TruncUserBB->getFirstInsertionPt(); |
|
2179 TruncInsertPt++; |
|
2180 |
|
2181 InsertedTrunc = CastInst::Create(TruncI->getOpcode(), InsertedShift, |
|
2182 - TruncI->getType(), "", TruncInsertPt); |
|
2183 + TruncI->getType(), "", &*TruncInsertPt); |
|
2184 |
|
2185 MadeChange = true; |
|
2186 |
|
2187 @@ -829,10 +832,10 @@ |
|
2188 |
|
2189 if (ShiftI->getOpcode() == Instruction::AShr) |
|
2190 InsertedShift = |
|
2191 - BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI, "", InsertPt); |
|
2192 + BinaryOperator::CreateAShr(ShiftI->getOperand(0), CI, "", &*InsertPt); |
|
2193 else |
|
2194 InsertedShift = |
|
2195 - BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI, "", InsertPt); |
|
2196 + BinaryOperator::CreateLShr(ShiftI->getOperand(0), CI, "", &*InsertPt); |
|
2197 |
|
2198 MadeChange = true; |
|
2199 } |
|
2200 @@ -941,7 +944,7 @@ |
|
2201 // %Elt = load i32* %EltAddr |
|
2202 // VResult = insertelement <16 x i32> VResult, i32 %Elt, i32 Idx |
|
2203 // |
|
2204 - CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.load"); |
|
2205 + CondBlock = IfBlock->splitBasicBlock(InsertPt->getIterator(), "cond.load"); |
|
2206 Builder.SetInsertPoint(InsertPt); |
|
2207 |
|
2208 Value* Gep = Builder.CreateInBoundsGEP(FirstEltPtr, Builder.getInt32(Idx)); |
|
2209 @@ -949,7 +952,8 @@ |
|
2210 VResult = Builder.CreateInsertElement(VResult, Load, Builder.getInt32(Idx)); |
|
2211 |
|
2212 // Create "else" block, fill it in the next iteration |
|
2213 - BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else"); |
|
2214 + BasicBlock *NewIfBlock = |
|
2215 + CondBlock->splitBasicBlock(InsertPt->getIterator(), "else"); |
|
2216 Builder.SetInsertPoint(InsertPt); |
|
2217 Instruction *OldBr = IfBlock->getTerminator(); |
|
2218 BranchInst::Create(CondBlock, NewIfBlock, Cmp, OldBr); |
|
2219 @@ -1024,7 +1028,8 @@ |
|
2220 // %to_store = icmp eq i1 %mask_1, true |
|
2221 // br i1 %to_load, label %cond.store, label %else |
|
2222 // |
|
2223 - Value *Predicate = Builder.CreateExtractElement(Mask, Builder.getInt32(Idx)); |
|
2224 + Value *Predicate = |
|
2225 + Builder.CreateExtractElement(Mask, Builder.getInt32(Idx)); |
|
2226 Value *Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Predicate, |
|
2227 ConstantInt::get(Predicate->getType(), 1)); |
|
2228 |
|
2229 @@ -1034,15 +1039,17 @@ |
|
2230 // %EltAddr = getelementptr i32* %1, i32 0 |
|
2231 // %store i32 %OneElt, i32* %EltAddr |
|
2232 // |
|
2233 - BasicBlock *CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.store"); |
|
2234 + BasicBlock *CondBlock = |
|
2235 + IfBlock->splitBasicBlock(InsertPt->getIterator(), "cond.store"); |
|
2236 Builder.SetInsertPoint(InsertPt); |
|
2237 - |
|
2238 + |
|
2239 Value *OneElt = Builder.CreateExtractElement(Src, Builder.getInt32(Idx)); |
|
2240 Value* Gep = Builder.CreateInBoundsGEP(FirstEltPtr, Builder.getInt32(Idx)); |
|
2241 Builder.CreateStore(OneElt, Gep); |
|
2242 |
|
2243 // Create "else" block, fill it in the next iteration |
|
2244 - BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else"); |
|
2245 + BasicBlock *NewIfBlock = |
|
2246 + CondBlock->splitBasicBlock(InsertPt->getIterator(), "else"); |
|
2247 Builder.SetInsertPoint(InsertPt); |
|
2248 Instruction *OldBr = IfBlock->getTerminator(); |
|
2249 BranchInst::Create(CondBlock, NewIfBlock, Cmp, OldBr); |
|
2250 @@ -1085,7 +1092,7 @@ |
|
2251 // Substituting this can cause recursive simplifications, which can |
|
2252 // invalidate our iterator. Use a WeakVH to hold onto it in case this |
|
2253 // happens. |
|
2254 - WeakVH IterHandle(CurInstIterator); |
|
2255 + WeakVH IterHandle(&*CurInstIterator); |
|
2256 |
|
2257 replaceAndRecursivelySimplify(CI, RetVal, |
|
2258 TLI ? TLI->getDataLayout() : nullptr, |
|
2259 @@ -1093,7 +1100,7 @@ |
|
2260 |
|
2261 // If the iterator instruction was recursively deleted, start over at the |
|
2262 // start of the block. |
|
2263 - if (IterHandle != CurInstIterator) { |
|
2264 + if (IterHandle != CurInstIterator.getNodePtrUnchecked()) { |
|
2265 CurInstIterator = BB->begin(); |
|
2266 SunkAddrs.clear(); |
|
2267 } |
|
2268 @@ -1410,10 +1417,10 @@ |
|
2269 public: |
|
2270 /// \brief Record the position of \p Inst. |
|
2271 InsertionHandler(Instruction *Inst) { |
|
2272 - BasicBlock::iterator It = Inst; |
|
2273 + BasicBlock::iterator It = Inst->getIterator(); |
|
2274 HasPrevInstruction = (It != (Inst->getParent()->begin())); |
|
2275 if (HasPrevInstruction) |
|
2276 - Point.PrevInst = --It; |
|
2277 + Point.PrevInst = &*--It; |
|
2278 else |
|
2279 Point.BB = Inst->getParent(); |
|
2280 } |
|
2281 @@ -1425,7 +1432,7 @@ |
|
2282 Inst->removeFromParent(); |
|
2283 Inst->insertAfter(Point.PrevInst); |
|
2284 } else { |
|
2285 - Instruction *Position = Point.BB->getFirstInsertionPt(); |
|
2286 + Instruction *Position = &*Point.BB->getFirstInsertionPt(); |
|
2287 if (Inst->getParent()) |
|
2288 Inst->moveBefore(Position); |
|
2289 else |
|
2290 @@ -3191,12 +3198,12 @@ |
|
2291 if (Repl->use_empty()) { |
|
2292 // This can cause recursive deletion, which can invalidate our iterator. |
|
2293 // Use a WeakVH to hold onto it in case this happens. |
|
2294 - WeakVH IterHandle(CurInstIterator); |
|
2295 + WeakVH IterHandle(&*CurInstIterator); |
|
2296 BasicBlock *BB = CurInstIterator->getParent(); |
|
2297 |
|
2298 RecursivelyDeleteTriviallyDeadInstructions(Repl, TLInfo); |
|
2299 |
|
2300 - if (IterHandle != CurInstIterator) { |
|
2301 + if (IterHandle != CurInstIterator.getNodePtrUnchecked()) { |
|
2302 // If the iterator instruction was recursively deleted, start over at the |
|
2303 // start of the block. |
|
2304 CurInstIterator = BB->begin(); |
|
2305 @@ -3495,7 +3502,7 @@ |
|
2306 |
|
2307 if (!InsertedTrunc) { |
|
2308 BasicBlock::iterator InsertPt = UserBB->getFirstInsertionPt(); |
|
2309 - InsertedTrunc = new TruncInst(I, Src->getType(), "", InsertPt); |
|
2310 + InsertedTrunc = new TruncInst(I, Src->getType(), "", &*InsertPt); |
|
2311 InsertedTruncsSet.insert(InsertedTrunc); |
|
2312 } |
|
2313 |
|
2314 @@ -3583,7 +3590,8 @@ |
|
2315 BranchInst::Create(NextBlock, SmallBlock, SI->getCondition(), SI); |
|
2316 |
|
2317 // The select itself is replaced with a PHI Node. |
|
2318 - PHINode *PN = PHINode::Create(SI->getType(), 2, "", NextBlock->begin()); |
|
2319 + PHINode *PN = PHINode::Create(SI->getType(), 2, "", |
|
2320 + &NextBlock->front()); |
|
2321 PN->takeName(SI); |
|
2322 PN->addIncoming(SI->getTrueValue(), StartBlock); |
|
2323 PN->addIncoming(SI->getFalseValue(), SmallBlock); |
|
2324 @@ -3646,7 +3654,8 @@ |
|
2325 BasicBlock::iterator InsertPt = UserBB->getFirstInsertionPt(); |
|
2326 InsertedShuffle = new ShuffleVectorInst(SVI->getOperand(0), |
|
2327 SVI->getOperand(1), |
|
2328 - SVI->getOperand(2), "", InsertPt); |
|
2329 + SVI->getOperand(2), "", |
|
2330 + &*InsertPt); |
|
2331 } |
|
2332 |
|
2333 UI->replaceUsesOfWith(SVI, InsertedShuffle); |
|
2334 @@ -3969,148 +3978,6 @@ |
|
2335 Transition->setOperand(getTransitionOriginalValueIdx(), ToBePromoted); |
|
2336 } |
|
2337 |
|
2338 -// See if we can speculate calls to intrinsic cttz/ctlz. |
|
2339 -// |
|
2340 -// Example: |
|
2341 -// entry: |
|
2342 -// ... |
|
2343 -// %cmp = icmp eq i64 %val, 0 |
|
2344 -// br i1 %cmp, label %end.bb, label %then.bb |
|
2345 -// |
|
2346 -// then.bb: |
|
2347 -// %c = tail call i64 @llvm.cttz.i64(i64 %val, i1 true) |
|
2348 -// br label %EndBB |
|
2349 -// |
|
2350 -// end.bb: |
|
2351 -// %cond = phi i64 [ %c, %then.bb ], [ 64, %entry ] |
|
2352 -// |
|
2353 -// ==> |
|
2354 -// |
|
2355 -// entry: |
|
2356 -// ... |
|
2357 -// %c = tail call i64 @llvm.cttz.i64(i64 %val, i1 false) |
|
2358 -// |
|
2359 -static bool OptimizeBranchInst(BranchInst *BrInst, const TargetLowering &TLI) { |
|
2360 - assert(BrInst->isConditional() && "Expected a conditional branch!"); |
|
2361 - BasicBlock *ThenBB = BrInst->getSuccessor(1); |
|
2362 - BasicBlock *EndBB = BrInst->getSuccessor(0); |
|
2363 - |
|
2364 - // See if ThenBB contains only one instruction (excluding the |
|
2365 - // terminator and DbgInfoIntrinsic calls). |
|
2366 - IntrinsicInst *II = nullptr; |
|
2367 - CastInst *CI = nullptr; |
|
2368 - for (BasicBlock::iterator I = ThenBB->begin(), |
|
2369 - E = std::prev(ThenBB->end()); I != E; ++I) { |
|
2370 - // Skip debug info. |
|
2371 - if (isa<DbgInfoIntrinsic>(I)) |
|
2372 - continue; |
|
2373 - |
|
2374 - // Check if this is a zero extension or a truncate of a previously |
|
2375 - // matched call to intrinsic cttz/ctlz. |
|
2376 - if (II) { |
|
2377 - // Early exit if we already found a "free" zero extend/truncate. |
|
2378 - if (CI) |
|
2379 - return false; |
|
2380 - |
|
2381 - Type *SrcTy = II->getType(); |
|
2382 - Type *DestTy = I->getType(); |
|
2383 - Value *V; |
|
2384 - |
|
2385 - if (match(cast<Instruction>(I), m_ZExt(m_Value(V))) && V == II) { |
|
2386 - // Speculate this zero extend only if it is "free" for the target. |
|
2387 - if (TLI.isZExtFree(SrcTy, DestTy)) { |
|
2388 - CI = cast<CastInst>(I); |
|
2389 - continue; |
|
2390 - } |
|
2391 - } else if (match(cast<Instruction>(I), m_Trunc(m_Value(V))) && V == II) { |
|
2392 - // Speculate this truncate only if it is "free" for the target. |
|
2393 - if (TLI.isTruncateFree(SrcTy, DestTy)) { |
|
2394 - CI = cast<CastInst>(I); |
|
2395 - continue; |
|
2396 - } |
|
2397 - } else { |
|
2398 - // Avoid speculating more than one instruction. |
|
2399 - return false; |
|
2400 - } |
|
2401 - } |
|
2402 - |
|
2403 - // See if this is a call to intrinsic cttz/ctlz. |
|
2404 - if (match(cast<Instruction>(I), m_Intrinsic<Intrinsic::cttz>())) { |
|
2405 - // Avoid speculating expensive intrinsic calls. |
|
2406 - if (!TLI.isCheapToSpeculateCttz()) |
|
2407 - return false; |
|
2408 - } |
|
2409 - else if (match(cast<Instruction>(I), m_Intrinsic<Intrinsic::ctlz>())) { |
|
2410 - // Avoid speculating expensive intrinsic calls. |
|
2411 - if (!TLI.isCheapToSpeculateCtlz()) |
|
2412 - return false; |
|
2413 - } else |
|
2414 - return false; |
|
2415 - |
|
2416 - II = cast<IntrinsicInst>(I); |
|
2417 - } |
|
2418 - |
|
2419 - // Look for PHI nodes with 'II' as the incoming value from 'ThenBB'. |
|
2420 - BasicBlock *EntryBB = BrInst->getParent(); |
|
2421 - for (BasicBlock::iterator I = EndBB->begin(); |
|
2422 - PHINode *PN = dyn_cast<PHINode>(I); ++I) { |
|
2423 - Value *ThenV = PN->getIncomingValueForBlock(ThenBB); |
|
2424 - Value *OrigV = PN->getIncomingValueForBlock(EntryBB); |
|
2425 - |
|
2426 - if (!OrigV) |
|
2427 - return false; |
|
2428 - |
|
2429 - if (ThenV != II && (!CI || ThenV != CI)) |
|
2430 - return false; |
|
2431 - |
|
2432 - if (ConstantInt *CInt = dyn_cast<ConstantInt>(OrigV)) { |
|
2433 - unsigned BitWidth = II->getType()->getIntegerBitWidth(); |
|
2434 - |
|
2435 - // Don't try to simplify this phi node if 'ThenV' is a cttz/ctlz |
|
2436 - // intrinsic call, but 'OrigV' is not equal to the 'size-of' in bits |
|
2437 - // of the value in input to the cttz/ctlz. |
|
2438 - if (CInt->getValue() != BitWidth) |
|
2439 - return false; |
|
2440 - |
|
2441 - // Hoist the call to cttz/ctlz from ThenBB into EntryBB. |
|
2442 - EntryBB->getInstList().splice(BrInst, ThenBB->getInstList(), |
|
2443 - ThenBB->begin(), std::prev(ThenBB->end())); |
|
2444 - |
|
2445 - // Update PN setting ThenV as the incoming value from both 'EntryBB' |
|
2446 - // and 'ThenBB'. Eventually, method 'OptimizeInst' will fold this |
|
2447 - // phi node if all the incoming values are the same. |
|
2448 - PN->setIncomingValue(PN->getBasicBlockIndex(EntryBB), ThenV); |
|
2449 - PN->setIncomingValue(PN->getBasicBlockIndex(ThenBB), ThenV); |
|
2450 - |
|
2451 - // Clear the 'undef on zero' flag of the cttz/ctlz intrinsic call. |
|
2452 - if (cast<ConstantInt>(II->getArgOperand(1))->isOne()) { |
|
2453 - Type *Ty = II->getArgOperand(0)->getType(); |
|
2454 - Value *Args[] = { II->getArgOperand(0), |
|
2455 - ConstantInt::getFalse(II->getContext()) }; |
|
2456 - Module *M = EntryBB->getParent()->getParent(); |
|
2457 - Value *IF = Intrinsic::getDeclaration(M, II->getIntrinsicID(), Ty); |
|
2458 - IRBuilder<> Builder(II); |
|
2459 - Instruction *NewI = Builder.CreateCall(IF, Args); |
|
2460 - |
|
2461 - // Replace the old call to cttz/ctlz. |
|
2462 - II->replaceAllUsesWith(NewI); |
|
2463 - II->eraseFromParent(); |
|
2464 - } |
|
2465 - |
|
2466 - // Update BrInst condition so that the branch to EndBB is always taken. |
|
2467 - // Later on, method 'ConstantFoldTerminator' will simplify this branch |
|
2468 - // replacing it with a direct branch to 'EndBB'. |
|
2469 - // As a side effect, CodeGenPrepare will attempt to simplify the control |
|
2470 - // flow graph by deleting basic block 'ThenBB' and merging 'EntryBB' into |
|
2471 - // 'EndBB' (calling method 'EliminateFallThrough'). |
|
2472 - BrInst->setCondition(ConstantInt::getTrue(BrInst->getContext())); |
|
2473 - return true; |
|
2474 - } |
|
2475 - } |
|
2476 - |
|
2477 - return false; |
|
2478 -} |
|
2479 - |
|
2480 /// Some targets can do store(extractelement) with one instruction. |
|
2481 /// Try to push the extractelement towards the stores when the target |
|
2482 /// has this feature and this is profitable. |
|
2483 @@ -4263,34 +4130,6 @@ |
|
2484 if (isa<ExtractElementInst>(I)) |
|
2485 return OptimizeExtractElementInst(I); |
|
2486 |
|
2487 - if (BranchInst *BI = dyn_cast<BranchInst>(I)) { |
|
2488 - if (TLI && BI->isConditional() && BI->getCondition()->hasOneUse()) { |
|
2489 - // Check if the branch condition compares a value agaist zero. |
|
2490 - if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) { |
|
2491 - if (ICI->getPredicate() == ICmpInst::ICMP_EQ && |
|
2492 - match(ICI->getOperand(1), m_Zero())) { |
|
2493 - BasicBlock *ThenBB = BI->getSuccessor(1); |
|
2494 - BasicBlock *EndBB = BI->getSuccessor(0); |
|
2495 - |
|
2496 - // Check if ThenBB is only reachable from this basic block; also, |
|
2497 - // check if EndBB has more than one predecessor. |
|
2498 - if (ThenBB->getSinglePredecessor() && |
|
2499 - !EndBB->getSinglePredecessor()) { |
|
2500 - TerminatorInst *TI = ThenBB->getTerminator(); |
|
2501 - |
|
2502 - if (TI->getNumSuccessors() == 1 && TI->getSuccessor(0) == EndBB && |
|
2503 - // Try to speculate calls to intrinsic cttz/ctlz from 'ThenBB'. |
|
2504 - OptimizeBranchInst(BI, *TLI)) { |
|
2505 - ModifiedDT = true; |
|
2506 - return true; |
|
2507 - } |
|
2508 - } |
|
2509 - } |
|
2510 - } |
|
2511 - } |
|
2512 - return false; |
|
2513 - } |
|
2514 - |
|
2515 return false; |
|
2516 } |
|
2517 |
|
2518 @@ -4303,7 +4142,7 @@ |
|
2519 |
|
2520 CurInstIterator = BB.begin(); |
|
2521 while (CurInstIterator != BB.end()) { |
|
2522 - MadeChange |= OptimizeInst(CurInstIterator++, ModifiedDT); |
|
2523 + MadeChange |= OptimizeInst(&*CurInstIterator++, ModifiedDT); |
|
2524 if (ModifiedDT) |
|
2525 return true; |
|
2526 } |
|
2527 @@ -4320,7 +4159,7 @@ |
|
2528 for (BasicBlock &BB : F) { |
|
2529 Instruction *PrevNonDbgInst = nullptr; |
|
2530 for (BasicBlock::iterator BI = BB.begin(), BE = BB.end(); BI != BE;) { |
|
2531 - Instruction *Insn = BI++; |
|
2532 + Instruction *Insn = &*BI++; |
|
2533 DbgValueInst *DVI = dyn_cast<DbgValueInst>(Insn); |
|
2534 // Leave dbg.values that refer to an alloca alone. These |
|
2535 // instrinsics describe the address of a variable (= the alloca) |
|
2536 @@ -4337,7 +4176,7 @@ |
|
2537 DEBUG(dbgs() << "Moving Debug Value before :\n" << *DVI << ' ' << *VI); |
|
2538 DVI->removeFromParent(); |
|
2539 if (isa<PHINode>(VI)) |
|
2540 - DVI->insertBefore(VI->getParent()->getFirstInsertionPt()); |
|
2541 + DVI->insertBefore(&*VI->getParent()->getFirstInsertionPt()); |
|
2542 else |
|
2543 DVI->insertAfter(VI); |
|
2544 MadeChange = true; |
|
2545 @@ -4361,7 +4200,7 @@ |
|
2546 return false; |
|
2547 bool MadeChange = false; |
|
2548 for (Function::iterator I = F.begin(), E = F.end(); I != E; ) { |
|
2549 - BasicBlock *BB = I++; |
|
2550 + BasicBlock *BB = &*I++; |
|
2551 |
|
2552 // Does this BB end with the following? |
|
2553 // %andVal = and %val, #single-bit-set |
|
2554 --- lib/CodeGen/DFAPacketizer.cpp 2014-10-13 18:03:16.000000000 -0700 |
|
2555 +++ lib/CodeGen/DFAPacketizer.cpp 2015-12-06 18:00:08.967241318 -0800 |
|
2556 @@ -147,7 +147,7 @@ |
|
2557 MachineInstr *MI) { |
|
2558 if (CurrentPacketMIs.size() > 1) { |
|
2559 MachineInstr *MIFirst = CurrentPacketMIs.front(); |
|
2560 - finalizeBundle(*MBB, MIFirst, MI); |
|
2561 + finalizeBundle(*MBB, MIFirst->getIterator(), MI->getIterator()); |
|
2562 } |
|
2563 CurrentPacketMIs.clear(); |
|
2564 ResourceTracker->clearResources(); |
|
2565 --- lib/CodeGen/ExecutionDepsFix.cpp 2014-12-17 11:13:47.000000000 -0800 |
|
2566 +++ lib/CodeGen/ExecutionDepsFix.cpp 2015-12-06 14:03:54.050682968 -0800 |
|
2567 @@ -753,7 +753,7 @@ |
|
2568 AliasMap[*AI].push_back(i); |
|
2569 } |
|
2570 |
|
2571 - MachineBasicBlock *Entry = MF->begin(); |
|
2572 + MachineBasicBlock *Entry = &*MF->begin(); |
|
2573 ReversePostOrderTraversal<MachineBasicBlock*> RPOT(Entry); |
|
2574 SmallVector<MachineBasicBlock*, 16> Loops; |
|
2575 for (ReversePostOrderTraversal<MachineBasicBlock*>::rpo_iterator |
|
2576 --- lib/CodeGen/ExpandISelPseudos.cpp 2014-10-14 00:22:08.000000000 -0700 |
|
2577 +++ lib/CodeGen/ExpandISelPseudos.cpp 2015-12-06 14:17:23.351013837 -0800 |
|
2578 @@ -50,7 +50,7 @@ |
|
2579 |
|
2580 // Iterate through each instruction in the function, looking for pseudos. |
|
2581 for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { |
|
2582 - MachineBasicBlock *MBB = I; |
|
2583 + MachineBasicBlock *MBB = &*I; |
|
2584 for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end(); |
|
2585 MBBI != MBBE; ) { |
|
2586 MachineInstr *MI = MBBI++; |
|
2587 @@ -63,7 +63,7 @@ |
|
2588 // The expansion may involve new basic blocks. |
|
2589 if (NewMBB != MBB) { |
|
2590 MBB = NewMBB; |
|
2591 - I = NewMBB; |
|
2592 + I = NewMBB->getIterator(); |
|
2593 MBBI = NewMBB->begin(); |
|
2594 MBBE = NewMBB->end(); |
|
2595 } |
|
2596 --- lib/CodeGen/ForwardControlFlowIntegrity.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
2597 +++ lib/CodeGen/ForwardControlFlowIntegrity.cpp 2015-12-06 18:01:31.650156258 -0800 |
|
2598 @@ -329,7 +329,7 @@ |
|
2599 Check = TempBuilder.CreateICmpEQ(NewFunPtr, FunPtr); |
|
2600 BasicBlock *InvalidPtrBlock = |
|
2601 BasicBlock::Create(M.getContext(), "invalid.ptr", CurF, 0); |
|
2602 - BasicBlock *ContinuationBB = CurBB->splitBasicBlock(I); |
|
2603 + BasicBlock *ContinuationBB = CurBB->splitBasicBlock(I->getIterator()); |
|
2604 |
|
2605 // Remove the unconditional branch that connects the two blocks. |
|
2606 TerminatorInst *TermInst = CurBB->getTerminator(); |
|
2607 --- lib/CodeGen/GCStrategy.cpp 2015-01-07 11:07:50.000000000 -0800 |
|
2608 +++ lib/CodeGen/GCStrategy.cpp 2015-12-06 18:08:32.675654207 -0800 |
|
2609 @@ -156,12 +156,13 @@ |
|
2610 unsigned Count) { |
|
2611 // Scroll past alloca instructions. |
|
2612 BasicBlock::iterator IP = F.getEntryBlock().begin(); |
|
2613 - while (isa<AllocaInst>(IP)) ++IP; |
|
2614 + while (isa<AllocaInst>(IP)) |
|
2615 + ++IP; |
|
2616 |
|
2617 // Search for initializers in the initial BB. |
|
2618 SmallPtrSet<AllocaInst*,16> InitedRoots; |
|
2619 - for (; !CouldBecomeSafePoint(IP); ++IP) |
|
2620 - if (StoreInst *SI = dyn_cast<StoreInst>(IP)) |
|
2621 + for (; !CouldBecomeSafePoint(&*IP); ++IP) |
|
2622 + if (StoreInst *SI = dyn_cast<StoreInst>(&*IP)) |
|
2623 if (AllocaInst *AI = |
|
2624 dyn_cast<AllocaInst>(SI->getOperand(1)->stripPointerCasts())) |
|
2625 InitedRoots.insert(AI); |
|
2626 --- lib/CodeGen/GlobalMerge.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
2627 +++ lib/CodeGen/GlobalMerge.cpp 2015-12-06 18:44:54.895620825 -0800 |
|
2628 @@ -289,61 +289,61 @@ |
|
2629 setMustKeepGlobalVariables(M); |
|
2630 |
|
2631 // Grab all non-const globals. |
|
2632 - for (Module::global_iterator I = M.global_begin(), |
|
2633 - E = M.global_end(); I != E; ++I) { |
|
2634 + for (auto &I : M.globals()) { |
|
2635 // Merge is safe for "normal" internal or external globals only |
|
2636 - if (I->isDeclaration() || I->isThreadLocal() || I->hasSection()) |
|
2637 + if (I.isDeclaration() || I.isThreadLocal() || I.hasSection()) |
|
2638 continue; |
|
2639 |
|
2640 - if (!(EnableGlobalMergeOnExternal && I->hasExternalLinkage()) && |
|
2641 - !I->hasInternalLinkage()) |
|
2642 + if (!(EnableGlobalMergeOnExternal && I.hasExternalLinkage()) && |
|
2643 + !I.hasInternalLinkage()) |
|
2644 continue; |
|
2645 |
|
2646 - PointerType *PT = dyn_cast<PointerType>(I->getType()); |
|
2647 + PointerType *PT = dyn_cast<PointerType>(I.getType()); |
|
2648 assert(PT && "Global variable is not a pointer!"); |
|
2649 |
|
2650 unsigned AddressSpace = PT->getAddressSpace(); |
|
2651 |
|
2652 // Ignore fancy-aligned globals for now. |
|
2653 - unsigned Alignment = DL->getPreferredAlignment(I); |
|
2654 - Type *Ty = I->getType()->getElementType(); |
|
2655 + unsigned Alignment = DL->getPreferredAlignment(&I); |
|
2656 + Type *Ty = I.getType()->getElementType(); |
|
2657 if (Alignment > DL->getABITypeAlignment(Ty)) |
|
2658 continue; |
|
2659 |
|
2660 // Ignore all 'special' globals. |
|
2661 - if (I->getName().startswith("llvm.") || |
|
2662 - I->getName().startswith(".llvm.")) |
|
2663 + if (I.getName().startswith("llvm.") || |
|
2664 + I.getName().startswith(".llvm.")) |
|
2665 continue; |
|
2666 |
|
2667 // Ignore all "required" globals: |
|
2668 - if (isMustKeepGlobalVariable(I)) |
|
2669 + if (isMustKeepGlobalVariable(&I)) |
|
2670 continue; |
|
2671 |
|
2672 if (DL->getTypeAllocSize(Ty) < MaxOffset) { |
|
2673 - if (TargetLoweringObjectFile::getKindForGlobal(I, *TM).isBSSLocal()) |
|
2674 - BSSGlobals[AddressSpace].push_back(I); |
|
2675 - else if (I->isConstant()) |
|
2676 - ConstGlobals[AddressSpace].push_back(I); |
|
2677 + if (TargetLoweringObjectFile::getKindForGlobal(&I, *TM).isBSSLocal()) |
|
2678 + BSSGlobals[AddressSpace].push_back(&I); |
|
2679 + else if (I.isConstant()) |
|
2680 + ConstGlobals[AddressSpace].push_back(&I); |
|
2681 else |
|
2682 - Globals[AddressSpace].push_back(I); |
|
2683 + Globals[AddressSpace].push_back(&I); |
|
2684 } |
|
2685 } |
|
2686 |
|
2687 - for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator |
|
2688 - I = Globals.begin(), E = Globals.end(); I != E; ++I) |
|
2689 - if (I->second.size() > 1) |
|
2690 - Changed |= doMerge(I->second, M, false, I->first); |
|
2691 - |
|
2692 - for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator |
|
2693 - I = BSSGlobals.begin(), E = BSSGlobals.end(); I != E; ++I) |
|
2694 - if (I->second.size() > 1) |
|
2695 - Changed |= doMerge(I->second, M, false, I->first); |
|
2696 - |
|
2697 - if (EnableGlobalMergeOnConst) |
|
2698 - for (DenseMap<unsigned, SmallVector<GlobalVariable*, 16> >::iterator |
|
2699 - I = ConstGlobals.begin(), E = ConstGlobals.end(); I != E; ++I) |
|
2700 - if (I->second.size() > 1) |
|
2701 - Changed |= doMerge(I->second, M, true, I->first); |
|
2702 + for (auto &G : Globals) { |
|
2703 + if (G.second.size() > 1) |
|
2704 + Changed |= doMerge(G.second, M, false, G.first); |
|
2705 + } |
|
2706 + |
|
2707 + for (auto &G : BSSGlobals) { |
|
2708 + if (G.second.size() > 1) |
|
2709 + Changed |= doMerge(G.second, M, false, G.first); |
|
2710 + } |
|
2711 + |
|
2712 + if (EnableGlobalMergeOnConst) { |
|
2713 + for (auto &G : ConstGlobals) { |
|
2714 + if (G.second.size() > 1) |
|
2715 + Changed |= doMerge(G.second, M, true, G.first); |
|
2716 + } |
|
2717 + } |
|
2718 |
|
2719 return Changed; |
|
2720 } |
|
2721 --- lib/CodeGen/IfConversion.cpp 2014-10-14 00:22:08.000000000 -0700 |
|
2722 +++ lib/CodeGen/IfConversion.cpp 2015-12-06 19:35:07.755981678 -0800 |
|
2723 @@ -460,11 +460,15 @@ |
|
2724 /// getNextBlock - Returns the next block in the function blocks ordering. If |
|
2725 /// it is the end, returns NULL. |
|
2726 static inline MachineBasicBlock *getNextBlock(MachineBasicBlock *BB) { |
|
2727 - MachineFunction::iterator I = BB; |
|
2728 + MachineFunction::iterator I = BB->getIterator(); |
|
2729 MachineFunction::iterator E = BB->getParent()->end(); |
|
2730 + if (I == E) |
|
2731 + return nullptr; |
|
2732 + |
|
2733 if (++I == E) |
|
2734 return nullptr; |
|
2735 - return I; |
|
2736 + |
|
2737 + return &*I; |
|
2738 } |
|
2739 |
|
2740 /// ValidSimple - Returns true if the 'true' block (along with its |
|
2741 @@ -528,12 +532,13 @@ |
|
2742 |
|
2743 MachineBasicBlock *TExit = FalseBranch ? TrueBBI.FalseBB : TrueBBI.TrueBB; |
|
2744 if (!TExit && blockAlwaysFallThrough(TrueBBI)) { |
|
2745 - MachineFunction::iterator I = TrueBBI.BB; |
|
2746 + MachineFunction::iterator I = TrueBBI.BB->getIterator(); |
|
2747 if (++I == TrueBBI.BB->getParent()->end()) |
|
2748 return false; |
|
2749 - TExit = I; |
|
2750 + |
|
2751 + TExit = &*I; |
|
2752 } |
|
2753 - return TExit && TExit == FalseBBI.BB; |
|
2754 + return TExit && (TExit == FalseBBI.BB); |
|
2755 } |
|
2756 |
|
2757 /// ValidDiamond - Returns true if the 'true' and 'false' blocks (along |
|
2758 @@ -910,10 +915,8 @@ |
|
2759 /// candidates. |
|
2760 void IfConverter::AnalyzeBlocks(MachineFunction &MF, |
|
2761 std::vector<IfcvtToken*> &Tokens) { |
|
2762 - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { |
|
2763 - MachineBasicBlock *BB = I; |
|
2764 - AnalyzeBlock(BB, Tokens); |
|
2765 - } |
|
2766 + for (auto &BB : MF) |
|
2767 + AnalyzeBlock(&BB, Tokens); |
|
2768 |
|
2769 // Sort to favor more complex ifcvt scheme. |
|
2770 std::stable_sort(Tokens.begin(), Tokens.end(), IfcvtTokenCmp); |
|
2771 @@ -923,14 +926,14 @@ |
|
2772 /// that all the intervening blocks are empty (given BB can fall through to its |
|
2773 /// next block). |
|
2774 static bool canFallThroughTo(MachineBasicBlock *BB, MachineBasicBlock *ToBB) { |
|
2775 - MachineFunction::iterator PI = BB; |
|
2776 + MachineFunction::iterator PI = BB->getIterator(); |
|
2777 MachineFunction::iterator I = std::next(PI); |
|
2778 - MachineFunction::iterator TI = ToBB; |
|
2779 + MachineFunction::iterator TI = ToBB->getIterator(); |
|
2780 MachineFunction::iterator E = BB->getParent()->end(); |
|
2781 while (I != TI) { |
|
2782 // Check isSuccessor to avoid case where the next block is empty, but |
|
2783 // it's not a successor. |
|
2784 - if (I == E || !I->empty() || !PI->isSuccessor(I)) |
|
2785 + if (I == E || !I->empty() || !PI->isSuccessor(&*I)) |
|
2786 return false; |
|
2787 PI = I++; |
|
2788 } |
|
2789 --- lib/CodeGen/InterferenceCache.cpp 2014-04-21 19:02:50.000000000 -0700 |
|
2790 +++ lib/CodeGen/InterferenceCache.cpp 2015-12-06 19:36:56.386076813 -0800 |
|
2791 @@ -143,7 +143,8 @@ |
|
2792 PrevPos = Start; |
|
2793 } |
|
2794 |
|
2795 - MachineFunction::const_iterator MFI = MF->getBlockNumbered(MBBNum); |
|
2796 + MachineFunction::const_iterator MFI = |
|
2797 + MF->getBlockNumbered(MBBNum)->getIterator(); |
|
2798 BlockInterference *BI = &Blocks[MBBNum]; |
|
2799 ArrayRef<SlotIndex> RegMaskSlots; |
|
2800 ArrayRef<const uint32_t*> RegMaskBits; |
|
2801 --- lib/CodeGen/IntrinsicLowering.cpp 2014-08-30 11:33:35.000000000 -0700 |
|
2802 +++ lib/CodeGen/IntrinsicLowering.cpp 2015-12-06 19:45:17.855570385 -0800 |
|
2803 @@ -75,7 +75,7 @@ |
|
2804 Constant* FCache = M->getOrInsertFunction(NewFn, |
|
2805 FunctionType::get(RetTy, ParamTys, false)); |
|
2806 |
|
2807 - IRBuilder<> Builder(CI->getParent(), CI); |
|
2808 + IRBuilder<> Builder(CI->getParent(), CI->getIterator()); |
|
2809 SmallVector<Value *, 8> Args(ArgBegin, ArgEnd); |
|
2810 CallInst *NewCI = Builder.CreateCall(FCache, Args); |
|
2811 NewCI->setName(CI->getName()); |
|
2812 @@ -94,71 +94,73 @@ |
|
2813 |
|
2814 void IntrinsicLowering::AddPrototypes(Module &M) { |
|
2815 LLVMContext &Context = M.getContext(); |
|
2816 - for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) |
|
2817 - if (I->isDeclaration() && !I->use_empty()) |
|
2818 - switch (I->getIntrinsicID()) { |
|
2819 + for (auto &I : M) { |
|
2820 + if (I.isDeclaration() && !I.use_empty()) { |
|
2821 + switch (I.getIntrinsicID()) { |
|
2822 default: break; |
|
2823 case Intrinsic::setjmp: |
|
2824 - EnsureFunctionExists(M, "setjmp", I->arg_begin(), I->arg_end(), |
|
2825 - Type::getInt32Ty(M.getContext())); |
|
2826 - break; |
|
2827 + EnsureFunctionExists(M, "setjmp", I.arg_begin(), I.arg_end(), |
|
2828 + Type::getInt32Ty(M.getContext())); |
|
2829 + break; |
|
2830 case Intrinsic::longjmp: |
|
2831 - EnsureFunctionExists(M, "longjmp", I->arg_begin(), I->arg_end(), |
|
2832 - Type::getVoidTy(M.getContext())); |
|
2833 - break; |
|
2834 + EnsureFunctionExists(M, "longjmp", I.arg_begin(), I.arg_end(), |
|
2835 + Type::getVoidTy(M.getContext())); |
|
2836 + break; |
|
2837 case Intrinsic::siglongjmp: |
|
2838 - EnsureFunctionExists(M, "abort", I->arg_end(), I->arg_end(), |
|
2839 - Type::getVoidTy(M.getContext())); |
|
2840 - break; |
|
2841 + EnsureFunctionExists(M, "abort", I.arg_end(), I.arg_end(), |
|
2842 + Type::getVoidTy(M.getContext())); |
|
2843 + break; |
|
2844 case Intrinsic::memcpy: |
|
2845 - M.getOrInsertFunction("memcpy", |
|
2846 - Type::getInt8PtrTy(Context), |
|
2847 - Type::getInt8PtrTy(Context), |
|
2848 - Type::getInt8PtrTy(Context), |
|
2849 - DL.getIntPtrType(Context), nullptr); |
|
2850 - break; |
|
2851 + M.getOrInsertFunction("memcpy", |
|
2852 + Type::getInt8PtrTy(Context), |
|
2853 + Type::getInt8PtrTy(Context), |
|
2854 + Type::getInt8PtrTy(Context), |
|
2855 + DL.getIntPtrType(Context), nullptr); |
|
2856 + break; |
|
2857 case Intrinsic::memmove: |
|
2858 - M.getOrInsertFunction("memmove", |
|
2859 - Type::getInt8PtrTy(Context), |
|
2860 - Type::getInt8PtrTy(Context), |
|
2861 - Type::getInt8PtrTy(Context), |
|
2862 - DL.getIntPtrType(Context), nullptr); |
|
2863 - break; |
|
2864 + M.getOrInsertFunction("memmove", |
|
2865 + Type::getInt8PtrTy(Context), |
|
2866 + Type::getInt8PtrTy(Context), |
|
2867 + Type::getInt8PtrTy(Context), |
|
2868 + DL.getIntPtrType(Context), nullptr); |
|
2869 + break; |
|
2870 case Intrinsic::memset: |
|
2871 - M.getOrInsertFunction("memset", |
|
2872 - Type::getInt8PtrTy(Context), |
|
2873 - Type::getInt8PtrTy(Context), |
|
2874 - Type::getInt32Ty(M.getContext()), |
|
2875 - DL.getIntPtrType(Context), nullptr); |
|
2876 - break; |
|
2877 + M.getOrInsertFunction("memset", |
|
2878 + Type::getInt8PtrTy(Context), |
|
2879 + Type::getInt8PtrTy(Context), |
|
2880 + Type::getInt32Ty(M.getContext()), |
|
2881 + DL.getIntPtrType(Context), nullptr); |
|
2882 + break; |
|
2883 case Intrinsic::sqrt: |
|
2884 - EnsureFPIntrinsicsExist(M, I, "sqrtf", "sqrt", "sqrtl"); |
|
2885 - break; |
|
2886 + EnsureFPIntrinsicsExist(M, &I, "sqrtf", "sqrt", "sqrtl"); |
|
2887 + break; |
|
2888 case Intrinsic::sin: |
|
2889 - EnsureFPIntrinsicsExist(M, I, "sinf", "sin", "sinl"); |
|
2890 - break; |
|
2891 + EnsureFPIntrinsicsExist(M, &I, "sinf", "sin", "sinl"); |
|
2892 + break; |
|
2893 case Intrinsic::cos: |
|
2894 - EnsureFPIntrinsicsExist(M, I, "cosf", "cos", "cosl"); |
|
2895 - break; |
|
2896 + EnsureFPIntrinsicsExist(M, &I, "cosf", "cos", "cosl"); |
|
2897 + break; |
|
2898 case Intrinsic::pow: |
|
2899 - EnsureFPIntrinsicsExist(M, I, "powf", "pow", "powl"); |
|
2900 - break; |
|
2901 + EnsureFPIntrinsicsExist(M, &I, "powf", "pow", "powl"); |
|
2902 + break; |
|
2903 case Intrinsic::log: |
|
2904 - EnsureFPIntrinsicsExist(M, I, "logf", "log", "logl"); |
|
2905 - break; |
|
2906 + EnsureFPIntrinsicsExist(M, &I, "logf", "log", "logl"); |
|
2907 + break; |
|
2908 case Intrinsic::log2: |
|
2909 - EnsureFPIntrinsicsExist(M, I, "log2f", "log2", "log2l"); |
|
2910 - break; |
|
2911 + EnsureFPIntrinsicsExist(M, &I, "log2f", "log2", "log2l"); |
|
2912 + break; |
|
2913 case Intrinsic::log10: |
|
2914 - EnsureFPIntrinsicsExist(M, I, "log10f", "log10", "log10l"); |
|
2915 - break; |
|
2916 + EnsureFPIntrinsicsExist(M, &I, "log10f", "log10", "log10l"); |
|
2917 + break; |
|
2918 case Intrinsic::exp: |
|
2919 - EnsureFPIntrinsicsExist(M, I, "expf", "exp", "expl"); |
|
2920 - break; |
|
2921 + EnsureFPIntrinsicsExist(M, &I, "expf", "exp", "expl"); |
|
2922 + break; |
|
2923 case Intrinsic::exp2: |
|
2924 - EnsureFPIntrinsicsExist(M, I, "exp2f", "exp2", "exp2l"); |
|
2925 - break; |
|
2926 + EnsureFPIntrinsicsExist(M, &I, "exp2f", "exp2", "exp2l"); |
|
2927 + break; |
|
2928 } |
|
2929 + } |
|
2930 + } |
|
2931 } |
|
2932 |
|
2933 /// LowerBSWAP - Emit the code to lower bswap of V before the specified |
|
2934 @@ -168,7 +170,7 @@ |
|
2935 |
|
2936 unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); |
|
2937 |
|
2938 - IRBuilder<> Builder(IP->getParent(), IP); |
|
2939 + IRBuilder<> Builder(IP->getParent(), IP->getIterator()); |
|
2940 |
|
2941 switch(BitSize) { |
|
2942 default: llvm_unreachable("Unhandled type size of value to byteswap!"); |
|
2943 @@ -268,7 +270,7 @@ |
|
2944 0x0000FFFF0000FFFFULL, 0x00000000FFFFFFFFULL |
|
2945 }; |
|
2946 |
|
2947 - IRBuilder<> Builder(IP->getParent(), IP); |
|
2948 + IRBuilder<> Builder(IP->getParent(), IP->getIterator()); |
|
2949 |
|
2950 unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); |
|
2951 unsigned WordSize = (BitSize + 63) / 64; |
|
2952 @@ -301,7 +303,7 @@ |
|
2953 /// instruction IP. |
|
2954 static Value *LowerCTLZ(LLVMContext &Context, Value *V, Instruction *IP) { |
|
2955 |
|
2956 - IRBuilder<> Builder(IP->getParent(), IP); |
|
2957 + IRBuilder<> Builder(IP->getParent(), IP->getIterator()); |
|
2958 |
|
2959 unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); |
|
2960 for (unsigned i = 1; i < BitSize; i <<= 1) { |
|
2961 @@ -338,7 +340,7 @@ |
|
2962 } |
|
2963 |
|
2964 void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { |
|
2965 - IRBuilder<> Builder(CI->getParent(), CI); |
|
2966 + IRBuilder<> Builder(CI->getParent(), CI->getIterator()); |
|
2967 LLVMContext &Context = CI->getContext(); |
|
2968 |
|
2969 const Function *Callee = CI->getCalledFunction(); |
|
2970 --- lib/CodeGen/LiveDebugVariables.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
2971 +++ lib/CodeGen/LiveDebugVariables.cpp 2015-12-06 19:51:37.891248865 -0800 |
|
2972 @@ -480,7 +480,7 @@ |
|
2973 bool Changed = false; |
|
2974 for (MachineFunction::iterator MFI = mf.begin(), MFE = mf.end(); MFI != MFE; |
|
2975 ++MFI) { |
|
2976 - MachineBasicBlock *MBB = MFI; |
|
2977 + MachineBasicBlock *MBB = &*MFI; |
|
2978 for (MachineBasicBlock::iterator MBBI = MBB->begin(), MBBE = MBB->end(); |
|
2979 MBBI != MBBE;) { |
|
2980 if (!MBBI->isDebugValue()) { |
|
2981 @@ -974,11 +974,11 @@ |
|
2982 SlotIndex Stop = I.stop(); |
|
2983 unsigned LocNo = I.value(); |
|
2984 DEBUG(dbgs() << "\t[" << Start << ';' << Stop << "):" << LocNo); |
|
2985 - MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start); |
|
2986 - SlotIndex MBBEnd = LIS.getMBBEndIdx(MBB); |
|
2987 + MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start)->getIterator(); |
|
2988 + SlotIndex MBBEnd = LIS.getMBBEndIdx(&*MBB); |
|
2989 |
|
2990 DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd); |
|
2991 - insertDebugValue(MBB, Start, LocNo, LIS, TII); |
|
2992 + insertDebugValue(&*MBB, Start, LocNo, LIS, TII); |
|
2993 // This interval may span multiple basic blocks. |
|
2994 // Insert a DBG_VALUE into each one. |
|
2995 while(Stop > MBBEnd) { |
|
2996 @@ -986,9 +986,9 @@ |
|
2997 Start = MBBEnd; |
|
2998 if (++MBB == MFEnd) |
|
2999 break; |
|
3000 - MBBEnd = LIS.getMBBEndIdx(MBB); |
|
3001 + MBBEnd = LIS.getMBBEndIdx(&*MBB); |
|
3002 DEBUG(dbgs() << " BB#" << MBB->getNumber() << '-' << MBBEnd); |
|
3003 - insertDebugValue(MBB, Start, LocNo, LIS, TII); |
|
3004 + insertDebugValue(&*MBB, Start, LocNo, LIS, TII); |
|
3005 } |
|
3006 DEBUG(dbgs() << '\n'); |
|
3007 if (MBB == MFEnd) |
|
3008 --- lib/CodeGen/LiveIntervalAnalysis.cpp 2014-12-23 18:11:43.000000000 -0800 |
|
3009 +++ lib/CodeGen/LiveIntervalAnalysis.cpp 2015-12-06 19:52:56.875852273 -0800 |
|
3010 @@ -211,7 +211,7 @@ |
|
3011 // Find all instructions with regmask operands. |
|
3012 for (MachineFunction::iterator MBBI = MF->begin(), E = MF->end(); |
|
3013 MBBI != E; ++MBBI) { |
|
3014 - MachineBasicBlock *MBB = MBBI; |
|
3015 + MachineBasicBlock *MBB = &*MBBI; |
|
3016 std::pair<unsigned, unsigned> &RMB = RegMaskBlocks[MBB->getNumber()]; |
|
3017 RMB.first = RegMaskSlots.size(); |
|
3018 for (MachineBasicBlock::iterator MI = MBB->begin(), ME = MBB->end(); |
|
3019 @@ -285,7 +285,7 @@ |
|
3020 // Check all basic blocks for live-ins. |
|
3021 for (MachineFunction::const_iterator MFI = MF->begin(), MFE = MF->end(); |
|
3022 MFI != MFE; ++MFI) { |
|
3023 - const MachineBasicBlock *MBB = MFI; |
|
3024 + const MachineBasicBlock *MBB = &*MFI; |
|
3025 |
|
3026 // We only care about ABI blocks: Entry + landing pads. |
|
3027 if ((MFI != MF->begin() && !MBB->isLandingPad()) || MBB->livein_empty()) |
|
3028 --- lib/CodeGen/LiveVariables.cpp 2014-10-14 00:22:08.000000000 -0700 |
|
3029 +++ lib/CodeGen/LiveVariables.cpp 2015-12-06 19:54:20.348152143 -0800 |
|
3030 @@ -639,7 +639,7 @@ |
|
3031 // function. This guarantees that we will see the definition of a virtual |
|
3032 // register before its uses due to dominance properties of SSA (except for PHI |
|
3033 // nodes, which are treated as a special case). |
|
3034 - MachineBasicBlock *Entry = MF->begin(); |
|
3035 + MachineBasicBlock *Entry = &MF->front(); |
|
3036 SmallPtrSet<MachineBasicBlock*,16> Visited; |
|
3037 |
|
3038 for (MachineBasicBlock *MBB : depth_first_ext(Entry, Visited)) { |
|
3039 --- lib/CodeGen/LocalStackSlotAllocation.cpp 2014-12-01 14:52:56.000000000 -0800 |
|
3040 +++ lib/CodeGen/LocalStackSlotAllocation.cpp 2015-12-06 19:56:09.955965495 -0800 |
|
3041 @@ -324,7 +324,7 @@ |
|
3042 // Sort the frame references by local offset |
|
3043 array_pod_sort(FrameReferenceInsns.begin(), FrameReferenceInsns.end()); |
|
3044 |
|
3045 - MachineBasicBlock *Entry = Fn.begin(); |
|
3046 + MachineBasicBlock *Entry = &Fn.front(); |
|
3047 |
|
3048 unsigned BaseReg = 0; |
|
3049 int64_t BaseOffset = 0; |
|
3050 --- lib/CodeGen/MachineBasicBlock.cpp 2014-12-22 05:00:36.000000000 -0800 |
|
3051 +++ lib/CodeGen/MachineBasicBlock.cpp 2015-12-06 20:28:52.972371805 -0800 |
|
3052 @@ -300,8 +300,8 @@ |
|
3053 |
|
3054 for (const_instr_iterator I = instr_begin(); I != instr_end(); ++I) { |
|
3055 if (Indexes) { |
|
3056 - if (Indexes->hasIndex(I)) |
|
3057 - OS << Indexes->getInstructionIndex(I); |
|
3058 + if (Indexes->hasIndex(&*I)) |
|
3059 + OS << Indexes->getInstructionIndex(&*I); |
|
3060 OS << '\t'; |
|
3061 } |
|
3062 OS << '\t'; |
|
3063 @@ -372,12 +372,11 @@ |
|
3064 } |
|
3065 |
|
3066 void MachineBasicBlock::moveBefore(MachineBasicBlock *NewAfter) { |
|
3067 - getParent()->splice(NewAfter, this); |
|
3068 + getParent()->splice(NewAfter->getIterator(), getIterator()); |
|
3069 } |
|
3070 |
|
3071 void MachineBasicBlock::moveAfter(MachineBasicBlock *NewBefore) { |
|
3072 - MachineFunction::iterator BBI = NewBefore; |
|
3073 - getParent()->splice(++BBI, this); |
|
3074 + getParent()->splice(++NewBefore->getIterator(), getIterator()); |
|
3075 } |
|
3076 |
|
3077 void MachineBasicBlock::updateTerminator() { |
|
3078 @@ -623,14 +622,14 @@ |
|
3079 } |
|
3080 |
|
3081 bool MachineBasicBlock::canFallThrough() { |
|
3082 - MachineFunction::iterator Fallthrough = this; |
|
3083 + MachineFunction::iterator Fallthrough = getIterator(); |
|
3084 ++Fallthrough; |
|
3085 // If FallthroughBlock is off the end of the function, it can't fall through. |
|
3086 if (Fallthrough == getParent()->end()) |
|
3087 return false; |
|
3088 |
|
3089 // If FallthroughBlock isn't a successor, no fallthrough is possible. |
|
3090 - if (!isSuccessor(Fallthrough)) |
|
3091 + if (!isSuccessor(&*Fallthrough)) |
|
3092 return false; |
|
3093 |
|
3094 // Analyze the branches, if any, at the end of the block. |
|
3095 @@ -721,7 +720,7 @@ |
|
3096 if (LV) |
|
3097 for (instr_iterator I = getFirstInstrTerminator(), E = instr_end(); |
|
3098 I != E; ++I) { |
|
3099 - MachineInstr *MI = I; |
|
3100 + MachineInstr *MI = &*I; |
|
3101 for (MachineInstr::mop_iterator OI = MI->operands_begin(), |
|
3102 OE = MI->operands_end(); OI != OE; ++OI) { |
|
3103 if (!OI->isReg() || OI->getReg() == 0 || |
|
3104 @@ -741,7 +740,7 @@ |
|
3105 if (LIS) { |
|
3106 for (instr_iterator I = getFirstInstrTerminator(), E = instr_end(); |
|
3107 I != E; ++I) { |
|
3108 - MachineInstr *MI = I; |
|
3109 + MachineInstr *MI = &*I; |
|
3110 |
|
3111 for (MachineInstr::mop_iterator OI = MI->operands_begin(), |
|
3112 OE = MI->operands_end(); OI != OE; ++OI) { |
|
3113 @@ -763,7 +762,7 @@ |
|
3114 if (Indexes) { |
|
3115 for (instr_iterator I = getFirstInstrTerminator(), E = instr_end(); |
|
3116 I != E; ++I) |
|
3117 - Terminators.push_back(I); |
|
3118 + Terminators.push_back(&*I); |
|
3119 } |
|
3120 |
|
3121 updateTerminator(); |
|
3122 @@ -772,7 +771,7 @@ |
|
3123 SmallVector<MachineInstr*, 4> NewTerminators; |
|
3124 for (instr_iterator I = getFirstInstrTerminator(), E = instr_end(); |
|
3125 I != E; ++I) |
|
3126 - NewTerminators.push_back(I); |
|
3127 + NewTerminators.push_back(&*I); |
|
3128 |
|
3129 for (SmallVectorImpl<MachineInstr*>::iterator I = Terminators.begin(), |
|
3130 E = Terminators.end(); I != E; ++I) { |
|
3131 @@ -794,9 +793,9 @@ |
|
3132 I != E; ++I) { |
|
3133 // Some instructions may have been moved to NMBB by updateTerminator(), |
|
3134 // so we first remove any instruction that already has an index. |
|
3135 - if (Indexes->hasIndex(I)) |
|
3136 - Indexes->removeMachineInstrFromMaps(I); |
|
3137 - Indexes->insertMachineInstrInMaps(I); |
|
3138 + if (Indexes->hasIndex(&*I)) |
|
3139 + Indexes->removeMachineInstrFromMaps(&*I); |
|
3140 + Indexes->insertMachineInstrInMaps(&*I); |
|
3141 } |
|
3142 } |
|
3143 } |
|
3144 @@ -811,7 +810,7 @@ |
|
3145 |
|
3146 // Inherit live-ins from the successor |
|
3147 for (MachineBasicBlock::livein_iterator I = Succ->livein_begin(), |
|
3148 - E = Succ->livein_end(); I != E; ++I) |
|
3149 + E = Succ->livein_end(); I != E; ++I) |
|
3150 NMBB->addLiveIn(*I); |
|
3151 |
|
3152 // Update LiveVariables. |
|
3153 @@ -824,7 +823,7 @@ |
|
3154 if (!(--I)->addRegisterKilled(Reg, TRI, /* addIfNotFound= */ false)) |
|
3155 continue; |
|
3156 if (TargetRegisterInfo::isVirtualRegister(Reg)) |
|
3157 - LV->getVarInfo(Reg).Kills.push_back(I); |
|
3158 + LV->getVarInfo(Reg).Kills.push_back(&*I); |
|
3159 DEBUG(dbgs() << "Restored terminator kill: " << *I); |
|
3160 break; |
|
3161 } |
|
3162 @@ -943,7 +942,7 @@ |
|
3163 |
|
3164 MachineBasicBlock::instr_iterator |
|
3165 MachineBasicBlock::erase(MachineBasicBlock::instr_iterator I) { |
|
3166 - unbundleSingleMI(I); |
|
3167 + unbundleSingleMI(&*I); |
|
3168 return Insts.erase(I); |
|
3169 } |
|
3170 |
|
3171 @@ -1038,12 +1037,12 @@ |
|
3172 |
|
3173 if (!DestA && !DestB) { |
|
3174 // Block falls through to successor. |
|
3175 - DestA = FallThru; |
|
3176 - DestB = FallThru; |
|
3177 + DestA = &*FallThru; |
|
3178 + DestB = &*FallThru; |
|
3179 } else if (DestA && !DestB) { |
|
3180 if (isCond) |
|
3181 // Block ends in conditional jump that falls through to successor. |
|
3182 - DestB = FallThru; |
|
3183 + DestB = &*FallThru; |
|
3184 } else { |
|
3185 assert(DestA && DestB && isCond && |
|
3186 "CFG in a bad state. Cannot correct CFG edges"); |
|
3187 --- lib/CodeGen/MachineBlockFrequencyInfo.cpp 2014-06-26 15:52:05.000000000 -0700 |
|
3188 +++ lib/CodeGen/MachineBlockFrequencyInfo.cpp 2015-12-06 20:30:07.075098190 -0800 |
|
3189 @@ -57,7 +57,7 @@ |
|
3190 |
|
3191 static inline |
|
3192 const NodeType *getEntryNode(const MachineBlockFrequencyInfo *G) { |
|
3193 - return G->getFunction()->begin(); |
|
3194 + return &G->getFunction()->front(); |
|
3195 } |
|
3196 |
|
3197 static ChildIteratorType child_begin(const NodeType *N) { |
|
3198 --- lib/CodeGen/MachineBlockPlacement.cpp 2015-01-03 09:58:24.000000000 -0800 |
|
3199 +++ lib/CodeGen/MachineBlockPlacement.cpp 2015-12-06 20:45:33.550025788 -0800 |
|
3200 @@ -471,14 +471,14 @@ |
|
3201 const BlockFilterSet *BlockFilter) { |
|
3202 for (MachineFunction::iterator I = PrevUnplacedBlockIt, E = F.end(); I != E; |
|
3203 ++I) { |
|
3204 - if (BlockFilter && !BlockFilter->count(I)) |
|
3205 + if (BlockFilter && !BlockFilter->count(&*I)) |
|
3206 continue; |
|
3207 - if (BlockToChain[I] != &PlacedChain) { |
|
3208 + if (BlockToChain[&*I] != &PlacedChain) { |
|
3209 PrevUnplacedBlockIt = I; |
|
3210 // Now select the head of the chain to which the unplaced block belongs |
|
3211 // as the block to place. This will force the entire chain to be placed, |
|
3212 // and satisfies the requirements of merging chains. |
|
3213 - return *BlockToChain[I]->begin(); |
|
3214 + return *BlockToChain[&*I]->begin(); |
|
3215 } |
|
3216 } |
|
3217 return nullptr; |
|
3218 @@ -878,9 +878,9 @@ |
|
3219 // the assumptions of the remaining algorithm. |
|
3220 SmallVector<MachineOperand, 4> Cond; // For AnalyzeBranch. |
|
3221 for (MachineFunction::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) { |
|
3222 - MachineBasicBlock *BB = FI; |
|
3223 - BlockChain *Chain |
|
3224 - = new (ChainAllocator.Allocate()) BlockChain(BlockToChain, BB); |
|
3225 + MachineBasicBlock *BB = &*FI; |
|
3226 + BlockChain *Chain = |
|
3227 + new (ChainAllocator.Allocate()) BlockChain(BlockToChain, BB); |
|
3228 // Also, merge any blocks which we cannot reason about and must preserve |
|
3229 // the exact fallthrough behavior for. |
|
3230 for (;;) { |
|
3231 @@ -890,7 +890,7 @@ |
|
3232 break; |
|
3233 |
|
3234 MachineFunction::iterator NextFI(std::next(FI)); |
|
3235 - MachineBasicBlock *NextBB = NextFI; |
|
3236 + MachineBasicBlock *NextBB = &*NextFI; |
|
3237 // Ensure that the layout successor is a viable block, as we know that |
|
3238 // fallthrough is a possibility. |
|
3239 assert(NextFI != FE && "Can't fallthrough past the last block."); |
|
3240 @@ -944,8 +944,9 @@ |
|
3241 // Crash at the end so we get all of the debugging output first. |
|
3242 bool BadFunc = false; |
|
3243 FunctionBlockSetType FunctionBlockSet; |
|
3244 - for (MachineFunction::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) |
|
3245 - FunctionBlockSet.insert(FI); |
|
3246 + |
|
3247 + for (MachineBasicBlock &MBB : F) |
|
3248 + FunctionBlockSet.insert(&MBB); |
|
3249 |
|
3250 for (BlockChain::iterator BCI = FunctionChain.begin(), |
|
3251 BCE = FunctionChain.end(); |
|
3252 @@ -969,21 +970,19 @@ |
|
3253 |
|
3254 // Splice the blocks into place. |
|
3255 MachineFunction::iterator InsertPos = F.begin(); |
|
3256 - for (BlockChain::iterator BI = FunctionChain.begin(), |
|
3257 - BE = FunctionChain.end(); |
|
3258 - BI != BE; ++BI) { |
|
3259 - DEBUG(dbgs() << (BI == FunctionChain.begin() ? "Placing chain " |
|
3260 + for (MachineBasicBlock *BI : FunctionChain) { |
|
3261 + DEBUG(dbgs() << (BI == *FunctionChain.begin() ? "Placing chain " |
|
3262 : " ... ") |
|
3263 - << getBlockName(*BI) << "\n"); |
|
3264 - if (InsertPos != MachineFunction::iterator(*BI)) |
|
3265 - F.splice(InsertPos, *BI); |
|
3266 + << getBlockName(BI) << "\n"); |
|
3267 + if (InsertPos != MachineFunction::iterator(BI)) |
|
3268 + F.splice(InsertPos, BI->getIterator()); |
|
3269 else |
|
3270 ++InsertPos; |
|
3271 |
|
3272 // Update the terminator of the previous block. |
|
3273 - if (BI == FunctionChain.begin()) |
|
3274 + if (BI == *FunctionChain.begin()) |
|
3275 continue; |
|
3276 - MachineBasicBlock *PrevBB = std::prev(MachineFunction::iterator(*BI)); |
|
3277 + MachineBasicBlock *PrevBB = &*std::prev(MachineFunction::iterator(BI)); |
|
3278 |
|
3279 // FIXME: It would be awesome of updateTerminator would just return rather |
|
3280 // than assert when the branch cannot be analyzed in order to remove this |
|
3281 @@ -1002,7 +1001,7 @@ |
|
3282 // is mistakenly pointing to "*BI". |
|
3283 // |
|
3284 bool needUpdateBr = true; |
|
3285 - if (!Cond.empty() && (!FBB || FBB == *BI)) { |
|
3286 + if (!Cond.empty() && (!FBB || FBB == BI)) { |
|
3287 PrevBB->updateTerminator(); |
|
3288 needUpdateBr = false; |
|
3289 Cond.clear(); |
|
3290 @@ -1050,7 +1049,7 @@ |
|
3291 return; // Empty chain. |
|
3292 |
|
3293 const BranchProbability ColdProb(1, 5); // 20% |
|
3294 - BlockFrequency EntryFreq = MBFI->getBlockFreq(F.begin()); |
|
3295 + BlockFrequency EntryFreq = MBFI->getBlockFreq(&F.front()); |
|
3296 BlockFrequency WeightedEntryFreq = EntryFreq * ColdProb; |
|
3297 for (BlockChain::iterator BI = std::next(FunctionChain.begin()), |
|
3298 BE = FunctionChain.end(); |
|
3299 @@ -1182,7 +1181,7 @@ |
|
3300 MBFI = &getAnalysis<MachineBlockFrequencyInfo>(); |
|
3301 |
|
3302 for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { |
|
3303 - BlockFrequency BlockFreq = MBFI->getBlockFreq(I); |
|
3304 + BlockFrequency BlockFreq = MBFI->getBlockFreq(&*I); |
|
3305 Statistic &NumBranches = (I->succ_size() > 1) ? NumCondBranches |
|
3306 : NumUncondBranches; |
|
3307 Statistic &BranchTakenFreq = (I->succ_size() > 1) ? CondBranchTakenFreq |
|
3308 @@ -1194,7 +1193,8 @@ |
|
3309 if (I->isLayoutSuccessor(*SI)) |
|
3310 continue; |
|
3311 |
|
3312 - BlockFrequency EdgeFreq = BlockFreq * MBPI->getEdgeProbability(I, *SI); |
|
3313 + BlockFrequency EdgeFreq = |
|
3314 + BlockFreq * MBPI->getEdgeProbability(&*I, *SI); |
|
3315 ++NumBranches; |
|
3316 BranchTakenFreq += EdgeFreq.getFrequency(); |
|
3317 } |
|
3318 --- lib/CodeGen/MachineFunction.cpp 2015-01-12 16:48:10.000000000 -0800 |
|
3319 +++ lib/CodeGen/MachineFunction.cpp 2015-12-06 20:48:05.529036618 -0800 |
|
3320 @@ -144,7 +144,7 @@ |
|
3321 if (MBB == nullptr) |
|
3322 MBBI = begin(); |
|
3323 else |
|
3324 - MBBI = MBB; |
|
3325 + MBBI = MBB->getIterator(); |
|
3326 |
|
3327 // Figure out the block number this should have. |
|
3328 unsigned BlockNo = 0; |
|
3329 @@ -164,7 +164,7 @@ |
|
3330 if (MBBNumbering[BlockNo]) |
|
3331 MBBNumbering[BlockNo]->setNumber(-1); |
|
3332 |
|
3333 - MBBNumbering[BlockNo] = MBBI; |
|
3334 + MBBNumbering[BlockNo] = &*MBBI; |
|
3335 MBBI->setNumber(BlockNo); |
|
3336 } |
|
3337 } |
|
3338 --- lib/CodeGen/MachineInstr.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
3339 +++ lib/CodeGen/MachineInstr.cpp 2015-12-06 21:23:40.823649137 -0800 |
|
3340 @@ -825,7 +825,8 @@ |
|
3341 |
|
3342 bool MachineInstr::hasPropertyInBundle(unsigned Mask, QueryType Type) const { |
|
3343 assert(!isBundledWithPred() && "Must be called on bundle header"); |
|
3344 - for (MachineBasicBlock::const_instr_iterator MII = this;; ++MII) { |
|
3345 + for (MachineBasicBlock::const_instr_iterator MII = getIterator(); |
|
3346 + /* empty */ ; ++MII) { |
|
3347 if (MII->getDesc().getFlags() & Mask) { |
|
3348 if (Type == AnyInBundle) |
|
3349 return true; |
|
3350 @@ -849,13 +850,13 @@ |
|
3351 |
|
3352 if (isBundle()) { |
|
3353 // Both instructions are bundles, compare MIs inside the bundle. |
|
3354 - MachineBasicBlock::const_instr_iterator I1 = *this; |
|
3355 + MachineBasicBlock::const_instr_iterator I1 = getIterator(); |
|
3356 MachineBasicBlock::const_instr_iterator E1 = getParent()->instr_end(); |
|
3357 - MachineBasicBlock::const_instr_iterator I2 = *Other; |
|
3358 + MachineBasicBlock::const_instr_iterator I2 = Other->getIterator(); |
|
3359 MachineBasicBlock::const_instr_iterator E2= Other->getParent()->instr_end(); |
|
3360 while (++I1 != E1 && I1->isInsideBundle()) { |
|
3361 ++I2; |
|
3362 - if (I2 == E2 || !I2->isInsideBundle() || !I1->isIdenticalTo(I2, Check)) |
|
3363 + if (I2 == E2 || !I2->isInsideBundle() || !I1->isIdenticalTo(&*I2, Check)) |
|
3364 return false; |
|
3365 } |
|
3366 } |
|
3367 @@ -961,7 +962,7 @@ |
|
3368 void MachineInstr::bundleWithPred() { |
|
3369 assert(!isBundledWithPred() && "MI is already bundled with its predecessor"); |
|
3370 setFlag(BundledPred); |
|
3371 - MachineBasicBlock::instr_iterator Pred = this; |
|
3372 + MachineBasicBlock::instr_iterator Pred = getIterator(); |
|
3373 --Pred; |
|
3374 assert(!Pred->isBundledWithSucc() && "Inconsistent bundle flags"); |
|
3375 Pred->setFlag(BundledSucc); |
|
3376 @@ -970,7 +971,7 @@ |
|
3377 void MachineInstr::bundleWithSucc() { |
|
3378 assert(!isBundledWithSucc() && "MI is already bundled with its successor"); |
|
3379 setFlag(BundledSucc); |
|
3380 - MachineBasicBlock::instr_iterator Succ = this; |
|
3381 + MachineBasicBlock::instr_iterator Succ = getIterator(); |
|
3382 ++Succ; |
|
3383 assert(!Succ->isBundledWithPred() && "Inconsistent bundle flags"); |
|
3384 Succ->setFlag(BundledPred); |
|
3385 @@ -979,7 +980,7 @@ |
|
3386 void MachineInstr::unbundleFromPred() { |
|
3387 assert(isBundledWithPred() && "MI isn't bundled with its predecessor"); |
|
3388 clearFlag(BundledPred); |
|
3389 - MachineBasicBlock::instr_iterator Pred = this; |
|
3390 + MachineBasicBlock::instr_iterator Pred = getIterator(); |
|
3391 --Pred; |
|
3392 assert(Pred->isBundledWithSucc() && "Inconsistent bundle flags"); |
|
3393 Pred->clearFlag(BundledSucc); |
|
3394 @@ -988,7 +989,7 @@ |
|
3395 void MachineInstr::unbundleFromSucc() { |
|
3396 assert(isBundledWithSucc() && "MI isn't bundled with its successor"); |
|
3397 clearFlag(BundledSucc); |
|
3398 - MachineBasicBlock::instr_iterator Succ = this; |
|
3399 + MachineBasicBlock::instr_iterator Succ = getIterator(); |
|
3400 ++Succ; |
|
3401 assert(Succ->isBundledWithPred() && "Inconsistent bundle flags"); |
|
3402 Succ->clearFlag(BundledPred); |
|
3403 @@ -1125,7 +1126,7 @@ |
|
3404 /// Return the number of instructions inside the MI bundle, not counting the |
|
3405 /// header instruction. |
|
3406 unsigned MachineInstr::getBundleSize() const { |
|
3407 - MachineBasicBlock::const_instr_iterator I = this; |
|
3408 + MachineBasicBlock::const_instr_iterator I = getIterator(); |
|
3409 unsigned Size = 0; |
|
3410 while (I->isBundledWithSucc()) |
|
3411 ++Size, ++I; |
|
3412 --- lib/CodeGen/MachineLoopInfo.cpp 2014-03-02 04:27:27.000000000 -0800 |
|
3413 +++ lib/CodeGen/MachineLoopInfo.cpp 2015-12-06 21:26:39.722845395 -0800 |
|
3414 @@ -50,11 +50,11 @@ |
|
3415 MachineBasicBlock *TopMBB = getHeader(); |
|
3416 MachineFunction::iterator Begin = TopMBB->getParent()->begin(); |
|
3417 if (TopMBB != Begin) { |
|
3418 - MachineBasicBlock *PriorMBB = std::prev(MachineFunction::iterator(TopMBB)); |
|
3419 + MachineBasicBlock *PriorMBB = &*std::prev(TopMBB->getIterator()); |
|
3420 while (contains(PriorMBB)) { |
|
3421 TopMBB = PriorMBB; |
|
3422 if (TopMBB == Begin) break; |
|
3423 - PriorMBB = std::prev(MachineFunction::iterator(TopMBB)); |
|
3424 + PriorMBB = &*std::prev(TopMBB->getIterator()); |
|
3425 } |
|
3426 } |
|
3427 return TopMBB; |
|
3428 @@ -64,11 +64,11 @@ |
|
3429 MachineBasicBlock *BotMBB = getHeader(); |
|
3430 MachineFunction::iterator End = BotMBB->getParent()->end(); |
|
3431 if (BotMBB != std::prev(End)) { |
|
3432 - MachineBasicBlock *NextMBB = std::next(MachineFunction::iterator(BotMBB)); |
|
3433 + MachineBasicBlock *NextMBB = &*std::next(BotMBB->getIterator()); |
|
3434 while (contains(NextMBB)) { |
|
3435 BotMBB = NextMBB; |
|
3436 if (BotMBB == std::next(MachineFunction::iterator(BotMBB))) break; |
|
3437 - NextMBB = std::next(MachineFunction::iterator(BotMBB)); |
|
3438 + NextMBB = &*std::next(BotMBB->getIterator()); |
|
3439 } |
|
3440 } |
|
3441 return BotMBB; |
|
3442 --- lib/CodeGen/MachineScheduler.cpp 2014-12-12 20:52:04.000000000 -0800 |
|
3443 +++ lib/CodeGen/MachineScheduler.cpp 2015-12-06 21:37:05.936122225 -0800 |
|
3444 @@ -391,7 +391,7 @@ |
|
3445 for (MachineFunction::iterator MBB = MF->begin(), MBBEnd = MF->end(); |
|
3446 MBB != MBBEnd; ++MBB) { |
|
3447 |
|
3448 - Scheduler.startBlock(MBB); |
|
3449 + Scheduler.startBlock(&*MBB); |
|
3450 |
|
3451 #ifndef NDEBUG |
|
3452 if (SchedOnlyFunc.getNumOccurrences() && SchedOnlyFunc != MF->getName()) |
|
3453 @@ -420,7 +420,7 @@ |
|
3454 |
|
3455 // Avoid decrementing RegionEnd for blocks with no terminator. |
|
3456 if (RegionEnd != MBB->end() || |
|
3457 - isSchedBoundary(std::prev(RegionEnd), MBB, MF, TII, IsPostRA)) { |
|
3458 + isSchedBoundary(std::prev(RegionEnd), &*MBB, MF, TII, IsPostRA)) { |
|
3459 --RegionEnd; |
|
3460 // Count the boundary instruction. |
|
3461 --RemainingInstrs; |
|
3462 @@ -431,14 +431,14 @@ |
|
3463 unsigned NumRegionInstrs = 0; |
|
3464 MachineBasicBlock::iterator I = RegionEnd; |
|
3465 for(;I != MBB->begin(); --I, --RemainingInstrs) { |
|
3466 - if (isSchedBoundary(std::prev(I), MBB, MF, TII, IsPostRA)) |
|
3467 + if (isSchedBoundary(std::prev(I), &*MBB, MF, TII, IsPostRA)) |
|
3468 break; |
|
3469 if (!I->isDebugValue()) |
|
3470 ++NumRegionInstrs; |
|
3471 } |
|
3472 // Notify the scheduler of the region, even if we may skip scheduling |
|
3473 // it. Perhaps it still needs to be bundled. |
|
3474 - Scheduler.enterRegion(MBB, I, RegionEnd, NumRegionInstrs); |
|
3475 + Scheduler.enterRegion(&*MBB, I, RegionEnd, NumRegionInstrs); |
|
3476 |
|
3477 // Skip empty scheduling regions (0 or 1 schedulable instructions). |
|
3478 if (I == RegionEnd || I == std::prev(RegionEnd)) { |
|
3479 @@ -478,7 +478,7 @@ |
|
3480 if (Scheduler.isPostRA()) { |
|
3481 // FIXME: Ideally, no further passes should rely on kill flags. However, |
|
3482 // thumb2 size reduction is currently an exception. |
|
3483 - Scheduler.fixupKills(MBB); |
|
3484 + Scheduler.fixupKills(&*MBB); |
|
3485 } |
|
3486 } |
|
3487 Scheduler.finalizeSchedule(); |
|
3488 --- lib/CodeGen/MachineVerifier.cpp 2014-12-11 11:41:51.000000000 -0800 |
|
3489 +++ lib/CodeGen/MachineVerifier.cpp 2015-12-06 22:06:08.770556953 -0800 |
|
3490 @@ -317,7 +317,7 @@ |
|
3491 visitMachineFunctionBefore(); |
|
3492 for (MachineFunction::const_iterator MFI = MF.begin(), MFE = MF.end(); |
|
3493 MFI!=MFE; ++MFI) { |
|
3494 - visitMachineBasicBlockBefore(MFI); |
|
3495 + visitMachineBasicBlockBefore(&*MFI); |
|
3496 // Keep track of the current bundle header. |
|
3497 const MachineInstr *CurBundle = nullptr; |
|
3498 // Do we expect the next instruction to be part of the same bundle? |
|
3499 @@ -325,8 +325,8 @@ |
|
3500 |
|
3501 for (MachineBasicBlock::const_instr_iterator MBBI = MFI->instr_begin(), |
|
3502 MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) { |
|
3503 - if (MBBI->getParent() != MFI) { |
|
3504 - report("Bad instruction parent pointer", MFI); |
|
3505 + if (MBBI->getParent() != &*MFI) { |
|
3506 + report("Bad instruction parent pointer", &*MFI); |
|
3507 *OS << "Instruction: " << *MBBI; |
|
3508 continue; |
|
3509 } |
|
3510 @@ -334,33 +334,44 @@ |
|
3511 // Check for consistent bundle flags. |
|
3512 if (InBundle && !MBBI->isBundledWithPred()) |
|
3513 report("Missing BundledPred flag, " |
|
3514 - "BundledSucc was set on predecessor", MBBI); |
|
3515 + "BundledSucc was set on predecessor", &*MBBI); |
|
3516 if (!InBundle && MBBI->isBundledWithPred()) |
|
3517 report("BundledPred flag is set, " |
|
3518 - "but BundledSucc not set on predecessor", MBBI); |
|
3519 + "but BundledSucc not set on predecessor", &*MBBI); |
|
3520 |
|
3521 // Is this a bundle header? |
|
3522 if (!MBBI->isInsideBundle()) { |
|
3523 if (CurBundle) |
|
3524 visitMachineBundleAfter(CurBundle); |
|
3525 - CurBundle = MBBI; |
|
3526 + CurBundle = &*MBBI; |
|
3527 visitMachineBundleBefore(CurBundle); |
|
3528 } else if (!CurBundle) |
|
3529 - report("No bundle header", MBBI); |
|
3530 - visitMachineInstrBefore(MBBI); |
|
3531 - for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I) |
|
3532 - visitMachineOperand(&MBBI->getOperand(I), I); |
|
3533 - visitMachineInstrAfter(MBBI); |
|
3534 + report("No bundle header", &*MBBI); |
|
3535 + |
|
3536 + visitMachineInstrBefore(&*MBBI); |
|
3537 + |
|
3538 + for (unsigned I = 0, E = MBBI->getNumOperands(); I != E; ++I) { |
|
3539 + const MachineInstr &MI = *MBBI; |
|
3540 + const MachineOperand &Op = MI.getOperand(I); |
|
3541 + if (Op.getParent() != &MI) |
|
3542 + report("Instruction has operand with wrong parent set", &MI); |
|
3543 + |
|
3544 + visitMachineOperand(&Op, I); |
|
3545 + } |
|
3546 + |
|
3547 + visitMachineInstrAfter(&*MBBI); |
|
3548 |
|
3549 // Was this the last bundled instruction? |
|
3550 InBundle = MBBI->isBundledWithSucc(); |
|
3551 } |
|
3552 + |
|
3553 if (CurBundle) |
|
3554 visitMachineBundleAfter(CurBundle); |
|
3555 if (InBundle) |
|
3556 report("BundledSucc flag set on last instruction in block", &MFI->back()); |
|
3557 - visitMachineBasicBlockAfter(MFI); |
|
3558 + visitMachineBasicBlockAfter(&*MFI); |
|
3559 } |
|
3560 + |
|
3561 visitMachineFunctionAfter(); |
|
3562 |
|
3563 if (OutFile) |
|
3564 @@ -573,7 +584,7 @@ |
|
3565 // check whether its answers match up with reality. |
|
3566 if (!TBB && !FBB) { |
|
3567 // Block falls through to its successor. |
|
3568 - MachineFunction::const_iterator MBBI = MBB; |
|
3569 + MachineFunction::const_iterator MBBI = MBB->getIterator(); |
|
3570 ++MBBI; |
|
3571 if (MBBI == MF->end()) { |
|
3572 // It's possible that the block legitimately ends with a noreturn |
|
3573 @@ -586,7 +597,7 @@ |
|
3574 } else if (MBB->succ_size() != 1+LandingPadSuccs.size()) { |
|
3575 report("MBB exits via unconditional fall-through but doesn't have " |
|
3576 "exactly one CFG successor!", MBB); |
|
3577 - } else if (!MBB->isSuccessor(MBBI)) { |
|
3578 + } else if (!MBB->isSuccessor(&*MBBI)) { |
|
3579 report("MBB exits via unconditional fall-through but its successor " |
|
3580 "differs from its CFG successor!", MBB); |
|
3581 } |
|
3582 @@ -624,7 +635,7 @@ |
|
3583 } |
|
3584 } else if (TBB && !FBB && !Cond.empty()) { |
|
3585 // Block conditionally branches somewhere, otherwise falls through. |
|
3586 - MachineFunction::const_iterator MBBI = MBB; |
|
3587 + MachineFunction::const_iterator MBBI = MBB->getIterator(); |
|
3588 ++MBBI; |
|
3589 if (MBBI == MF->end()) { |
|
3590 report("MBB conditionally falls through out of function!", MBB); |
|
3591 @@ -639,7 +650,7 @@ |
|
3592 } else if (MBB->succ_size() != 2) { |
|
3593 report("MBB exits via conditional branch/fall-through but doesn't have " |
|
3594 "exactly two CFG successors!", MBB); |
|
3595 - } else if (!matchPair(MBB->succ_begin(), TBB, MBBI)) { |
|
3596 + } else if (!matchPair(MBB->succ_begin(), TBB, &*MBBI)) { |
|
3597 report("MBB exits via conditional branch/fall-through but the CFG " |
|
3598 "successors don't match the actual successors!", MBB); |
|
3599 } |
|
3600 @@ -1585,7 +1596,7 @@ |
|
3601 } |
|
3602 |
|
3603 // Now check all the basic blocks in this live segment. |
|
3604 - MachineFunction::const_iterator MFI = MBB; |
|
3605 + MachineFunction::const_iterator MFI = MBB->getIterator(); |
|
3606 // Is this live segment the beginning of a non-PHIDef VN? |
|
3607 if (S.start == VNI->def && !VNI->isPHIDef()) { |
|
3608 // Not live-in to any blocks. |
|
3609 @@ -1595,7 +1606,7 @@ |
|
3610 ++MFI; |
|
3611 } |
|
3612 for (;;) { |
|
3613 - assert(LiveInts->isLiveInToMBB(LR, MFI)); |
|
3614 + assert(LiveInts->isLiveInToMBB(LR, &*MFI)); |
|
3615 // We don't know how to track physregs into a landing pad. |
|
3616 if (!TargetRegisterInfo::isVirtualRegister(Reg) && |
|
3617 MFI->isLandingPad()) { |
|
3618 @@ -1607,7 +1618,7 @@ |
|
3619 |
|
3620 // Is VNI a PHI-def in the current block? |
|
3621 bool IsPHI = VNI->isPHIDef() && |
|
3622 - VNI->def == LiveInts->getMBBStartIdx(MFI); |
|
3623 + VNI->def == LiveInts->getMBBStartIdx(&*MFI); |
|
3624 |
|
3625 // Check that VNI is live-out of all predecessors. |
|
3626 for (MachineBasicBlock::const_pred_iterator PI = MFI->pred_begin(), |
|
3627 @@ -1620,7 +1631,7 @@ |
|
3628 report("Register not marked live out of predecessor", *PI, LR, Reg, |
|
3629 LaneMask); |
|
3630 *OS << "Valno #" << VNI->id << " live into BB#" << MFI->getNumber() |
|
3631 - << '@' << LiveInts->getMBBStartIdx(MFI) << ", not live before " |
|
3632 + << '@' << LiveInts->getMBBStartIdx(&*MFI) << ", not live before " |
|
3633 << PEnd << '\n'; |
|
3634 continue; |
|
3635 } |
|
3636 @@ -1632,7 +1643,7 @@ |
|
3637 *OS << "Valno #" << PVNI->id << " live out of BB#" |
|
3638 << (*PI)->getNumber() << '@' << PEnd |
|
3639 << "\nValno #" << VNI->id << " live into BB#" << MFI->getNumber() |
|
3640 - << '@' << LiveInts->getMBBStartIdx(MFI) << '\n'; |
|
3641 + << '@' << LiveInts->getMBBStartIdx(&*MFI) << '\n'; |
|
3642 } |
|
3643 } |
|
3644 if (&*MFI == EndMBB) |
|
3645 --- lib/CodeGen/Passes.cpp 2015-02-11 16:29:01.000000000 -0800 |
|
3646 +++ lib/CodeGen/Passes.cpp 2016-01-23 20:25:56.000000000 -0800 |
|
3647 @@ -83,10 +83,13 @@ |
|
3648 static cl::opt<bool> VerifyMachineCode("verify-machineinstrs", cl::Hidden, |
|
3649 cl::desc("Verify generated machine code"), |
|
3650 cl::init(getenv("LLVM_VERIFY_MACHINEINSTRS")!=nullptr)); |
|
3651 + |
|
3652 +static std::string PMIInitString("option-unspecified"); |
|
3653 static cl::opt<std::string> |
|
3654 PrintMachineInstrs("print-machineinstrs", cl::ValueOptional, |
|
3655 cl::desc("Print machine instrs"), |
|
3656 - cl::value_desc("pass-name"), cl::init("option-unspecified")); |
|
3657 + cl::value_desc("pass-name"), |
|
3658 + cl::init(PMIInitString)); |
|
3659 |
|
3660 // Temporary option to allow experimenting with MachineScheduler as a post-RA |
|
3661 // scheduler. Targets can "properly" enable this with |
|
3662 --- lib/CodeGen/PostRASchedulerList.cpp 2014-10-29 08:23:11.000000000 -0700 |
|
3663 +++ lib/CodeGen/PostRASchedulerList.cpp 2016-01-23 20:26:45.000000000 -0800 |
|
3664 @@ -58,11 +58,13 @@ |
|
3665 EnablePostRAScheduler("post-RA-scheduler", |
|
3666 cl::desc("Enable scheduling after register allocation"), |
|
3667 cl::init(false), cl::Hidden); |
|
3668 + |
|
3669 +static std::string NoneString("none"); |
|
3670 static cl::opt<std::string> |
|
3671 EnableAntiDepBreaking("break-anti-dependencies", |
|
3672 cl::desc("Break post-RA scheduling anti-dependencies: " |
|
3673 "\"critical\", \"all\", or \"none\""), |
|
3674 - cl::init("none"), cl::Hidden); |
|
3675 + cl::init(NoneString), cl::Hidden); |
|
3676 |
|
3677 // If DebugDiv > 0 then only schedule MBB with (ID % DebugDiv) == DebugMod |
|
3678 static cl::opt<int> |
|
3679 @@ -318,7 +320,7 @@ |
|
3680 #endif |
|
3681 |
|
3682 // Initialize register live-range state for scheduling in this block. |
|
3683 - Scheduler.startBlock(MBB); |
|
3684 + Scheduler.startBlock(&*MBB); |
|
3685 |
|
3686 // Schedule each sequence of instructions not interrupted by a label |
|
3687 // or anything else that effectively needs to shut down scheduling. |
|
3688 @@ -330,8 +332,8 @@ |
|
3689 // Calls are not scheduling boundaries before register allocation, but |
|
3690 // post-ra we don't gain anything by scheduling across calls since we |
|
3691 // don't need to worry about register pressure. |
|
3692 - if (MI->isCall() || TII->isSchedulingBoundary(MI, MBB, Fn)) { |
|
3693 - Scheduler.enterRegion(MBB, I, Current, CurrentCount - Count); |
|
3694 + if (MI->isCall() || TII->isSchedulingBoundary(MI, &*MBB, Fn)) { |
|
3695 + Scheduler.enterRegion(&*MBB, I, Current, CurrentCount - Count); |
|
3696 Scheduler.setEndIndex(CurrentCount); |
|
3697 Scheduler.schedule(); |
|
3698 Scheduler.exitRegion(); |
|
3699 @@ -347,7 +349,7 @@ |
|
3700 assert(Count == 0 && "Instruction count mismatch!"); |
|
3701 assert((MBB->begin() == Current || CurrentCount != 0) && |
|
3702 "Instruction count mismatch!"); |
|
3703 - Scheduler.enterRegion(MBB, MBB->begin(), Current, CurrentCount); |
|
3704 + Scheduler.enterRegion(&*MBB, MBB->begin(), Current, CurrentCount); |
|
3705 Scheduler.setEndIndex(CurrentCount); |
|
3706 Scheduler.schedule(); |
|
3707 Scheduler.exitRegion(); |
|
3708 @@ -357,7 +359,7 @@ |
|
3709 Scheduler.finishBlock(); |
|
3710 |
|
3711 // Update register kills |
|
3712 - Scheduler.fixupKills(MBB); |
|
3713 + Scheduler.fixupKills(&*MBB); |
|
3714 } |
|
3715 |
|
3716 return true; |
|
3717 --- lib/CodeGen/ProcessImplicitDefs.cpp 2014-08-04 19:39:49.000000000 -0700 |
|
3718 +++ lib/CodeGen/ProcessImplicitDefs.cpp 2015-12-07 06:32:25.399048598 -0800 |
|
3719 @@ -96,11 +96,11 @@ |
|
3720 |
|
3721 // This is a physreg implicit-def. |
|
3722 // Look for the first instruction to use or define an alias. |
|
3723 - MachineBasicBlock::instr_iterator UserMI = MI; |
|
3724 + MachineBasicBlock::instr_iterator UserMI = MI->getIterator(); |
|
3725 MachineBasicBlock::instr_iterator UserE = MI->getParent()->instr_end(); |
|
3726 bool Found = false; |
|
3727 for (++UserMI; UserMI != UserE; ++UserMI) { |
|
3728 - for (MIOperands MO(UserMI); MO.isValid(); ++MO) { |
|
3729 + for (MIOperands MO(&*UserMI); MO.isValid(); ++MO) { |
|
3730 if (!MO->isReg()) |
|
3731 continue; |
|
3732 unsigned UserReg = MO->getReg(); |
|
3733 @@ -151,7 +151,7 @@ |
|
3734 for (MachineBasicBlock::instr_iterator MBBI = MFI->instr_begin(), |
|
3735 MBBE = MFI->instr_end(); MBBI != MBBE; ++MBBI) |
|
3736 if (MBBI->isImplicitDef()) |
|
3737 - WorkList.insert(MBBI); |
|
3738 + WorkList.insert(&*MBBI); |
|
3739 |
|
3740 if (WorkList.empty()) |
|
3741 continue; |
|
3742 --- lib/CodeGen/PrologEpilogInserter.cpp 2015-01-12 16:48:10.000000000 -0800 |
|
3743 +++ lib/CodeGen/PrologEpilogInserter.cpp 2015-12-07 06:37:25.905435777 -0800 |
|
3744 @@ -94,13 +94,11 @@ |
|
3745 return; |
|
3746 |
|
3747 // Save refs to entry and return blocks. |
|
3748 - EntryBlock = Fn.begin(); |
|
3749 - for (MachineFunction::iterator MBB = Fn.begin(), E = Fn.end(); |
|
3750 - MBB != E; ++MBB) |
|
3751 - if (isReturnBlock(MBB)) |
|
3752 - ReturnBlocks.push_back(MBB); |
|
3753 - |
|
3754 - return; |
|
3755 + EntryBlock = &Fn.front(); |
|
3756 + for (MachineBasicBlock &MBB : Fn) { |
|
3757 + if (isReturnBlock(&MBB)) |
|
3758 + ReturnBlocks.push_back(&MBB); |
|
3759 + } |
|
3760 } |
|
3761 |
|
3762 /// StackObjSet - A set of stack object indexes |
|
3763 @@ -728,11 +726,11 @@ |
|
3764 |
|
3765 // Handle the unreachable blocks. |
|
3766 for (MachineFunction::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { |
|
3767 - if (Reachable.count(BB)) |
|
3768 + if (Reachable.count(&*BB)) |
|
3769 // Already handled in DFS traversal. |
|
3770 continue; |
|
3771 int SPAdj = 0; |
|
3772 - replaceFrameIndices(BB, Fn, SPAdj); |
|
3773 + replaceFrameIndices(&*BB, Fn, SPAdj); |
|
3774 } |
|
3775 } |
|
3776 |
|
3777 @@ -873,7 +871,7 @@ |
|
3778 // Run through the instructions and find any virtual registers. |
|
3779 for (MachineFunction::iterator BB = Fn.begin(), |
|
3780 E = Fn.end(); BB != E; ++BB) { |
|
3781 - RS->enterBasicBlock(BB); |
|
3782 + RS->enterBasicBlock(&*BB); |
|
3783 |
|
3784 int SPAdj = 0; |
|
3785 |
|
3786 @@ -922,7 +920,7 @@ |
|
3787 assert (ScratchReg && "Missing scratch register!"); |
|
3788 MachineRegisterInfo &MRI = Fn.getRegInfo(); |
|
3789 Fn.getRegInfo().replaceRegWith(Reg, ScratchReg); |
|
3790 - |
|
3791 + |
|
3792 // Make sure MRI now accounts this register as used. |
|
3793 MRI.setPhysRegUsed(ScratchReg); |
|
3794 |
|
3795 @@ -938,7 +936,7 @@ |
|
3796 // problem because we need the spill code before I: Move I to just |
|
3797 // prior to J. |
|
3798 if (I != std::prev(J)) { |
|
3799 - BB->splice(J, BB, I); |
|
3800 + BB->splice(J, &*BB, I); |
|
3801 |
|
3802 // Before we move I, we need to prepare the RS to visit I again. |
|
3803 // Specifically, RS will assert if it sees uses of registers that |
|
3804 --- lib/CodeGen/RegisterCoalescer.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
3805 +++ lib/CodeGen/RegisterCoalescer.cpp 2015-12-07 06:39:22.414657202 -0800 |
|
3806 @@ -2669,7 +2669,7 @@ |
|
3807 std::vector<MBBPriorityInfo> MBBs; |
|
3808 MBBs.reserve(MF->size()); |
|
3809 for (MachineFunction::iterator I = MF->begin(), E = MF->end();I != E;++I){ |
|
3810 - MachineBasicBlock *MBB = I; |
|
3811 + MachineBasicBlock *MBB = &*I; |
|
3812 MBBs.push_back(MBBPriorityInfo(MBB, Loops->getLoopDepth(MBB), |
|
3813 JoinSplitEdges && isSplitEdge(MBB))); |
|
3814 } |
|
3815 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp 2015-04-01 17:15:35.000000000 -0700 |
|
3816 +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp 2015-12-07 08:35:37.075981457 -0800 |
|
3817 @@ -1163,7 +1163,7 @@ |
|
3818 // Add all the dag nodes to the worklist. |
|
3819 for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), |
|
3820 E = DAG.allnodes_end(); I != E; ++I) |
|
3821 - AddToWorklist(I); |
|
3822 + AddToWorklist(&*I); |
|
3823 |
|
3824 // Create a dummy node (which is not added to allnodes), that adds a reference |
|
3825 // to the root node, preventing it from being deleted, and tracking any |
|
3826 --- lib/CodeGen/SelectionDAG/FastISel.cpp 2015-04-29 07:54:57.000000000 -0700 |
|
3827 +++ lib/CodeGen/SelectionDAG/FastISel.cpp 2015-12-07 08:37:53.997786920 -0800 |
|
3828 @@ -116,9 +116,9 @@ |
|
3829 for (Function::const_arg_iterator I = FuncInfo.Fn->arg_begin(), |
|
3830 E = FuncInfo.Fn->arg_end(); |
|
3831 I != E; ++I) { |
|
3832 - DenseMap<const Value *, unsigned>::iterator VI = LocalValueMap.find(I); |
|
3833 + DenseMap<const Value *, unsigned>::iterator VI = LocalValueMap.find(&*I); |
|
3834 assert(VI != LocalValueMap.end() && "Missed an argument?"); |
|
3835 - FuncInfo.ValueMap[I] = VI->second; |
|
3836 + FuncInfo.ValueMap[&*I] = VI->second; |
|
3837 } |
|
3838 return true; |
|
3839 } |
|
3840 --- lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp 2014-12-02 10:50:36.000000000 -0800 |
|
3841 +++ lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp 2015-12-07 08:44:06.691399075 -0800 |
|
3842 @@ -130,7 +130,7 @@ |
|
3843 |
|
3844 // Look for inline asm that clobbers the SP register. |
|
3845 if (isa<CallInst>(I) || isa<InvokeInst>(I)) { |
|
3846 - ImmutableCallSite CS(I); |
|
3847 + ImmutableCallSite CS(&*I); |
|
3848 if (isa<InlineAsm>(CS.getCalledValue())) { |
|
3849 unsigned SP = TLI->getStackPointerRegisterToSaveRestore(); |
|
3850 std::vector<TargetLowering::AsmOperandInfo> Ops = |
|
3851 @@ -167,10 +167,10 @@ |
|
3852 |
|
3853 // Mark values used outside their block as exported, by allocating |
|
3854 // a virtual register for them. |
|
3855 - if (isUsedOutsideOfDefiningBlock(I)) |
|
3856 + if (isUsedOutsideOfDefiningBlock(&*I)) |
|
3857 if (!isa<AllocaInst>(I) || |
|
3858 !StaticAllocaMap.count(cast<AllocaInst>(I))) |
|
3859 - InitializeRegForValue(I); |
|
3860 + InitializeRegForValue(&*I); |
|
3861 |
|
3862 // Collect llvm.dbg.declare information. This is done now instead of |
|
3863 // during the initial isel pass through the IR so that it is done |
|
3864 @@ -204,15 +204,15 @@ |
|
3865 } |
|
3866 |
|
3867 // Decide the preferred extend type for a value. |
|
3868 - PreferredExtendType[I] = getPreferredExtendForValue(I); |
|
3869 + PreferredExtendType[&*I] = getPreferredExtendForValue(&*I); |
|
3870 } |
|
3871 |
|
3872 // Create an initial MachineBasicBlock for each LLVM BasicBlock in F. This |
|
3873 // also creates the initial PHI MachineInstrs, though none of the input |
|
3874 // operands are populated. |
|
3875 for (BB = Fn->begin(); BB != EB; ++BB) { |
|
3876 - MachineBasicBlock *MBB = mf.CreateMachineBasicBlock(BB); |
|
3877 - MBBMap[BB] = MBB; |
|
3878 + MachineBasicBlock *MBB = mf.CreateMachineBasicBlock(&*BB); |
|
3879 + MBBMap[&*BB] = MBB; |
|
3880 MF->push_back(MBB); |
|
3881 |
|
3882 // Transfer the address-taken flag. This is necessary because there could |
|
3883 --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 2015-01-13 17:35:17.000000000 -0800 |
|
3884 +++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 2015-12-07 08:49:07.697376637 -0800 |
|
3885 @@ -4326,7 +4326,7 @@ |
|
3886 for (auto NI = allnodes_end(); NI != allnodes_begin();) { |
|
3887 --NI; |
|
3888 |
|
3889 - SDNode *N = NI; |
|
3890 + SDNode *N = &*NI; |
|
3891 if (N->use_empty() && N != getRoot().getNode()) { |
|
3892 ++NI; |
|
3893 DeleteNode(N); |
|
3894 --- lib/CodeGen/SelectionDAG/LegalizeTypes.cpp 2014-12-02 14:01:00.000000000 -0800 |
|
3895 +++ lib/CodeGen/SelectionDAG/LegalizeTypes.cpp 2015-12-07 08:56:21.562944470 -0800 |
|
3896 @@ -77,10 +77,10 @@ |
|
3897 E = DAG.allnodes_end(); I != E; ++I) { |
|
3898 // Remember nodes marked NewNode - they are subject to extra checking below. |
|
3899 if (I->getNodeId() == NewNode) |
|
3900 - NewNodes.push_back(I); |
|
3901 + NewNodes.push_back(&*I); |
|
3902 |
|
3903 for (unsigned i = 0, e = I->getNumValues(); i != e; ++i) { |
|
3904 - SDValue Res(I, i); |
|
3905 + SDValue Res(&*I, i); |
|
3906 bool Failed = false; |
|
3907 |
|
3908 unsigned Mapped = 0; |
|
3909 @@ -128,7 +128,7 @@ |
|
3910 dbgs() << "Unprocessed value in a map!"; |
|
3911 Failed = true; |
|
3912 } |
|
3913 - } else if (isTypeLegal(Res.getValueType()) || IgnoreNodeResults(I)) { |
|
3914 + } else if (isTypeLegal(Res.getValueType()) || IgnoreNodeResults(&*I)) { |
|
3915 if (Mapped > 1) { |
|
3916 dbgs() << "Value with legal type was transformed!"; |
|
3917 Failed = true; |
|
3918 @@ -198,7 +198,7 @@ |
|
3919 E = DAG.allnodes_end(); I != E; ++I) { |
|
3920 if (I->getNumOperands() == 0) { |
|
3921 I->setNodeId(ReadyToProcess); |
|
3922 - Worklist.push_back(I); |
|
3923 + Worklist.push_back(&*I); |
|
3924 } else { |
|
3925 I->setNodeId(Unanalyzed); |
|
3926 } |
|
3927 @@ -406,7 +406,7 @@ |
|
3928 bool Failed = false; |
|
3929 |
|
3930 // Check that all result types are legal. |
|
3931 - if (!IgnoreNodeResults(I)) |
|
3932 + if (!IgnoreNodeResults(&*I)) |
|
3933 for (unsigned i = 0, NumVals = I->getNumValues(); i < NumVals; ++i) |
|
3934 if (!isTypeLegal(I->getValueType(i))) { |
|
3935 dbgs() << "Result type " << i << " illegal!\n"; |
|
3936 --- lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp 2015-02-12 15:51:24.000000000 -0800 |
|
3937 +++ lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp 2015-12-07 09:08:20.015507523 -0800 |
|
3938 @@ -159,7 +159,7 @@ |
|
3939 DAG.AssignTopologicalOrder(); |
|
3940 for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), |
|
3941 E = std::prev(DAG.allnodes_end()); I != std::next(E); ++I) |
|
3942 - LegalizeOp(SDValue(I, 0)); |
|
3943 + LegalizeOp(SDValue(&*I, 0)); |
|
3944 |
|
3945 // Finally, it's possible the root changed. Get the new root. |
|
3946 SDValue OldRoot = DAG.getRoot(); |
|
3947 --- lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
3948 +++ lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp 2015-12-07 09:09:27.427273648 -0800 |
|
3949 @@ -728,7 +728,7 @@ |
|
3950 unsigned DAGSize = 0; |
|
3951 for (SelectionDAG::allnodes_iterator I = DAG->allnodes_begin(), |
|
3952 E = DAG->allnodes_end(); I != E; ++I) { |
|
3953 - SDNode *N = I; |
|
3954 + SDNode *N = &*I; |
|
3955 |
|
3956 // Use node id to record degree. |
|
3957 unsigned Degree = N->use_size(); |
|
3958 --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 2015-05-08 07:13:47.000000000 -0700 |
|
3959 +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp 2015-12-07 10:48:44.168405053 -0800 |
|
3960 @@ -1460,7 +1460,7 @@ |
|
3961 } |
|
3962 |
|
3963 // Create TmpBB after CurBB. |
|
3964 - MachineFunction::iterator BBI = CurBB; |
|
3965 + MachineFunction::iterator BBI(CurBB); |
|
3966 MachineFunction &MF = DAG.getMachineFunction(); |
|
3967 MachineBasicBlock *TmpBB = MF.CreateMachineBasicBlock(CurBB->getBasicBlock()); |
|
3968 CurBB->getParent()->insert(++BBI, TmpBB); |
|
3969 @@ -1575,9 +1575,9 @@ |
|
3970 |
|
3971 // Figure out which block is immediately after the current one. |
|
3972 MachineBasicBlock *NextBlock = nullptr; |
|
3973 - MachineFunction::iterator BBI = BrMBB; |
|
3974 + MachineFunction::iterator BBI(BrMBB); |
|
3975 if (++BBI != FuncInfo.MF->end()) |
|
3976 - NextBlock = BBI; |
|
3977 + NextBlock = &*BBI; |
|
3978 |
|
3979 if (I.isUnconditional()) { |
|
3980 // Update machine-CFG edges. |
|
3981 @@ -1708,9 +1708,9 @@ |
|
3982 // Set NextBlock to be the MBB immediately after the current one, if any. |
|
3983 // This is used to avoid emitting unnecessary branches to the next block. |
|
3984 MachineBasicBlock *NextBlock = nullptr; |
|
3985 - MachineFunction::iterator BBI = SwitchBB; |
|
3986 + MachineFunction::iterator BBI(SwitchBB); |
|
3987 if (++BBI != FuncInfo.MF->end()) |
|
3988 - NextBlock = BBI; |
|
3989 + NextBlock = &*BBI; |
|
3990 |
|
3991 // If the lhs block is the next block, invert the condition so that we can |
|
3992 // fall through to the lhs instead of the rhs block. |
|
3993 @@ -1784,10 +1784,10 @@ |
|
3994 // Set NextBlock to be the MBB immediately after the current one, if any. |
|
3995 // This is used to avoid emitting unnecessary branches to the next block. |
|
3996 MachineBasicBlock *NextBlock = nullptr; |
|
3997 - MachineFunction::iterator BBI = SwitchBB; |
|
3998 + MachineFunction::iterator BBI(SwitchBB); |
|
3999 |
|
4000 if (++BBI != FuncInfo.MF->end()) |
|
4001 - NextBlock = BBI; |
|
4002 + NextBlock = &*BBI; |
|
4003 |
|
4004 SDValue BrCond = DAG.getNode(ISD::BRCOND, getCurSDLoc(), |
|
4005 MVT::Other, CopyTo, CMP, |
|
4006 @@ -1925,9 +1925,9 @@ |
|
4007 // Set NextBlock to be the MBB immediately after the current one, if any. |
|
4008 // This is used to avoid emitting unnecessary branches to the next block. |
|
4009 MachineBasicBlock *NextBlock = nullptr; |
|
4010 - MachineFunction::iterator BBI = SwitchBB; |
|
4011 + MachineFunction::iterator BBI(SwitchBB); |
|
4012 if (++BBI != FuncInfo.MF->end()) |
|
4013 - NextBlock = BBI; |
|
4014 + NextBlock = &*BBI; |
|
4015 |
|
4016 MachineBasicBlock* MBB = B.Cases[0].ThisBB; |
|
4017 |
|
4018 @@ -1994,9 +1994,9 @@ |
|
4019 // Set NextBlock to be the MBB immediately after the current one, if any. |
|
4020 // This is used to avoid emitting unnecessary branches to the next block. |
|
4021 MachineBasicBlock *NextBlock = nullptr; |
|
4022 - MachineFunction::iterator BBI = SwitchBB; |
|
4023 + MachineFunction::iterator BBI(SwitchBB); |
|
4024 if (++BBI != FuncInfo.MF->end()) |
|
4025 - NextBlock = BBI; |
|
4026 + NextBlock = &*BBI; |
|
4027 |
|
4028 if (NextMBB != NextBlock) |
|
4029 BrAnd = DAG.getNode(ISD::BR, getCurSDLoc(), MVT::Other, BrAnd, |
|
4030 @@ -2104,10 +2104,10 @@ |
|
4031 |
|
4032 // Figure out which block is immediately after the current one. |
|
4033 MachineBasicBlock *NextBlock = nullptr; |
|
4034 - MachineFunction::iterator BBI = CR.CaseBB; |
|
4035 + MachineFunction::iterator BBI(CR.CaseBB); |
|
4036 |
|
4037 if (++BBI != FuncInfo.MF->end()) |
|
4038 - NextBlock = BBI; |
|
4039 + NextBlock = &*BBI; |
|
4040 |
|
4041 BranchProbabilityInfo *BPI = FuncInfo.BPI; |
|
4042 // If any two of the cases has the same destination, and if one value |
|
4043 @@ -2291,7 +2291,7 @@ |
|
4044 MachineFunction *CurMF = FuncInfo.MF; |
|
4045 |
|
4046 // Figure out which block is immediately after the current one. |
|
4047 - MachineFunction::iterator BBI = CR.CaseBB; |
|
4048 + MachineFunction::iterator BBI(CR.CaseBB); |
|
4049 ++BBI; |
|
4050 |
|
4051 const BasicBlock *LLVMBB = CR.CaseBB->getBasicBlock(); |
|
4052 @@ -2377,7 +2377,7 @@ |
|
4053 MachineFunction *CurMF = FuncInfo.MF; |
|
4054 |
|
4055 // Figure out which block is immediately after the current one. |
|
4056 - MachineFunction::iterator BBI = CR.CaseBB; |
|
4057 + MachineFunction::iterator BBI(CR.CaseBB); |
|
4058 ++BBI; |
|
4059 |
|
4060 Case& FrontCase = *CR.Range.first; |
|
4061 @@ -2600,7 +2600,7 @@ |
|
4062 BitTestInfo BTC; |
|
4063 |
|
4064 // Figure out which block is immediately after the current one. |
|
4065 - MachineFunction::iterator BBI = CR.CaseBB; |
|
4066 + MachineFunction::iterator BBI(CR.CaseBB); |
|
4067 ++BBI; |
|
4068 |
|
4069 const BasicBlock *LLVMBB = CR.CaseBB->getBasicBlock(); |
|
4070 @@ -7614,7 +7614,7 @@ |
|
4071 if (FastISel) |
|
4072 return A->use_empty(); |
|
4073 |
|
4074 - const BasicBlock *Entry = A->getParent()->begin(); |
|
4075 + const BasicBlock *Entry = &A->getParent()->front(); |
|
4076 for (const User *U : A->users()) |
|
4077 if (cast<Instruction>(U)->getParent() != Entry || isa<SwitchInst>(U)) |
|
4078 return false; // Use not in entry block. |
|
4079 @@ -7779,12 +7779,12 @@ |
|
4080 // If this argument is unused then remember its value. It is used to generate |
|
4081 // debugging information. |
|
4082 if (I->use_empty() && NumValues) { |
|
4083 - SDB->setUnusedArgValue(I, InVals[i]); |
|
4084 + SDB->setUnusedArgValue(&*I, InVals[i]); |
|
4085 |
|
4086 // Also remember any frame index for use in FastISel. |
|
4087 if (FrameIndexSDNode *FI = |
|
4088 dyn_cast<FrameIndexSDNode>(InVals[i].getNode())) |
|
4089 - FuncInfo->setArgumentFrameIndex(I, FI->getIndex()); |
|
4090 + FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex()); |
|
4091 } |
|
4092 |
|
4093 for (unsigned Val = 0; Val != NumValues; ++Val) { |
|
4094 @@ -7814,18 +7814,18 @@ |
|
4095 // Note down frame index. |
|
4096 if (FrameIndexSDNode *FI = |
|
4097 dyn_cast<FrameIndexSDNode>(ArgValues[0].getNode())) |
|
4098 - FuncInfo->setArgumentFrameIndex(I, FI->getIndex()); |
|
4099 + FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex()); |
|
4100 |
|
4101 SDValue Res = DAG.getMergeValues(makeArrayRef(ArgValues.data(), NumValues), |
|
4102 SDB->getCurSDLoc()); |
|
4103 |
|
4104 - SDB->setValue(I, Res); |
|
4105 + SDB->setValue(&*I, Res); |
|
4106 if (!TM.Options.EnableFastISel && Res.getOpcode() == ISD::BUILD_PAIR) { |
|
4107 if (LoadSDNode *LNode = |
|
4108 dyn_cast<LoadSDNode>(Res.getOperand(0).getNode())) |
|
4109 if (FrameIndexSDNode *FI = |
|
4110 dyn_cast<FrameIndexSDNode>(LNode->getBasePtr().getNode())) |
|
4111 - FuncInfo->setArgumentFrameIndex(I, FI->getIndex()); |
|
4112 + FuncInfo->setArgumentFrameIndex(&*I, FI->getIndex()); |
|
4113 } |
|
4114 |
|
4115 // If this argument is live outside of the entry block, insert a copy from |
|
4116 @@ -7837,13 +7837,13 @@ |
|
4117 // uses with vregs. |
|
4118 unsigned Reg = cast<RegisterSDNode>(Res.getOperand(1))->getReg(); |
|
4119 if (TargetRegisterInfo::isVirtualRegister(Reg)) { |
|
4120 - FuncInfo->ValueMap[I] = Reg; |
|
4121 + FuncInfo->ValueMap[&*I] = Reg; |
|
4122 continue; |
|
4123 } |
|
4124 } |
|
4125 - if (!isOnlyUsedInEntryBlock(I, TM.Options.EnableFastISel)) { |
|
4126 - FuncInfo->InitializeRegForValue(I); |
|
4127 - SDB->CopyToExportRegsIfNeeded(I); |
|
4128 + if (!isOnlyUsedInEntryBlock(&*I, TM.Options.EnableFastISel)) { |
|
4129 + FuncInfo->InitializeRegForValue(&*I); |
|
4130 + SDB->CopyToExportRegsIfNeeded(&*I); |
|
4131 } |
|
4132 } |
|
4133 |
|
4134 @@ -7946,7 +7946,7 @@ |
|
4135 // If SuccBB has not been created yet, create it. |
|
4136 if (!SuccMBB) { |
|
4137 MachineFunction *MF = ParentMBB->getParent(); |
|
4138 - MachineFunction::iterator BBI = ParentMBB; |
|
4139 + MachineFunction::iterator BBI(ParentMBB); |
|
4140 SuccMBB = MF->CreateMachineBasicBlock(BB); |
|
4141 MF->insert(++BBI, SuccMBB); |
|
4142 } |
|
4143 --- lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp 2014-12-04 01:40:44.000000000 -0800 |
|
4144 +++ lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp 2015-12-07 11:02:44.434678105 -0800 |
|
4145 @@ -554,7 +554,7 @@ |
|
4146 |
|
4147 for (allnodes_const_iterator I = allnodes_begin(), E = allnodes_end(); |
|
4148 I != E; ++I) { |
|
4149 - const SDNode *N = I; |
|
4150 + const SDNode *N = &*I; |
|
4151 if (!N->hasOneUse() && N != getRoot().getNode()) |
|
4152 DumpNodes(N, 2, this); |
|
4153 } |
|
4154 --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2015-06-14 08:38:10.000000000 -0700 |
|
4155 +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 2015-12-07 11:43:29.120419077 -0800 |
|
4156 @@ -401,7 +401,7 @@ |
|
4157 |
|
4158 // Okay, we have to split this edge. |
|
4159 SplitCriticalEdge(Pred->getTerminator(), |
|
4160 - GetSuccessorNumber(Pred, BB), SDISel, true); |
|
4161 + GetSuccessorNumber(Pred, &*BB), SDISel, true); |
|
4162 goto ReprocessBlock; |
|
4163 } |
|
4164 } |
|
4165 @@ -457,7 +457,7 @@ |
|
4166 // If the first basic block in the function has live ins that need to be |
|
4167 // copied into vregs, emit the copies into the top of the block before |
|
4168 // emitting the code for the block. |
|
4169 - MachineBasicBlock *EntryMBB = MF->begin(); |
|
4170 + MachineBasicBlock *EntryMBB = &MF->front(); |
|
4171 const TargetRegisterInfo &TRI = *MF->getSubtarget().getRegisterInfo(); |
|
4172 RegInfo->EmitLiveInCopies(EntryMBB, TRI, *TII); |
|
4173 |
|
4174 @@ -868,7 +868,7 @@ |
|
4175 // graph) and preceding back toward the beginning (the entry |
|
4176 // node). |
|
4177 while (ISelPosition != CurDAG->allnodes_begin()) { |
|
4178 - SDNode *Node = --ISelPosition; |
|
4179 + SDNode *Node = &*--ISelPosition; |
|
4180 // Skip dead nodes. DAGCombiner is expected to eliminate all dead nodes, |
|
4181 // but there are currently some corner cases that it misses. Also, this |
|
4182 // makes it theoretically possible to disable the DAGCombiner. |
|
4183 @@ -1085,7 +1085,8 @@ |
|
4184 FuncInfo->VisitedBBs.insert(LLVMBB); |
|
4185 } |
|
4186 |
|
4187 - BasicBlock::const_iterator const Begin = LLVMBB->getFirstNonPHI(); |
|
4188 + BasicBlock::const_iterator const Begin = |
|
4189 + LLVMBB->getFirstNonPHI()->getIterator(); |
|
4190 BasicBlock::const_iterator const End = LLVMBB->end(); |
|
4191 BasicBlock::const_iterator BI = End; |
|
4192 |
|
4193 @@ -1133,7 +1134,7 @@ |
|
4194 unsigned NumFastIselRemaining = std::distance(Begin, End); |
|
4195 // Do FastISel on as many instructions as possible. |
|
4196 for (; BI != Begin; --BI) { |
|
4197 - const Instruction *Inst = std::prev(BI); |
|
4198 + const Instruction *Inst = &*std::prev(BI); |
|
4199 |
|
4200 // If we no longer require this instruction, skip it. |
|
4201 if (isFoldedOrDeadInstruction(Inst, FuncInfo)) { |
|
4202 @@ -1154,7 +1155,7 @@ |
|
4203 // Try to fold the load if so. |
|
4204 const Instruction *BeforeInst = Inst; |
|
4205 while (BeforeInst != Begin) { |
|
4206 - BeforeInst = std::prev(BasicBlock::const_iterator(BeforeInst)); |
|
4207 + BeforeInst = &*std::prev(BasicBlock::const_iterator(BeforeInst)); |
|
4208 if (!isFoldedOrDeadInstruction(BeforeInst, FuncInfo)) |
|
4209 break; |
|
4210 } |
|
4211 @@ -1190,7 +1191,7 @@ |
|
4212 |
|
4213 bool HadTailCall = false; |
|
4214 MachineBasicBlock::iterator SavedInsertPt = FuncInfo->InsertPt; |
|
4215 - SelectBasicBlock(Inst, BI, HadTailCall); |
|
4216 + SelectBasicBlock(Inst->getIterator(), BI, HadTailCall); |
|
4217 |
|
4218 // If the call was emitted as a tail call, we're done with the block. |
|
4219 // We also need to delete any previously emitted instructions. |
|
4220 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp 2015-02-17 13:57:20.000000000 -0800 |
|
4221 +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp 2015-12-07 09:14:05.327228003 -0800 |
|
4222 @@ -618,7 +618,7 @@ |
|
4223 // Add all obviously-dead nodes to the DeadNodes worklist. |
|
4224 for (allnodes_iterator I = allnodes_begin(), E = allnodes_end(); I != E; ++I) |
|
4225 if (I->use_empty()) |
|
4226 - DeadNodes.push_back(I); |
|
4227 + DeadNodes.push_back(&*I); |
|
4228 |
|
4229 RemoveDeadNodes(DeadNodes); |
|
4230 |
|
4231 @@ -937,7 +937,7 @@ |
|
4232 assert(&*AllNodes.begin() == &EntryNode); |
|
4233 AllNodes.remove(AllNodes.begin()); |
|
4234 while (!AllNodes.empty()) |
|
4235 - DeallocateNode(AllNodes.begin()); |
|
4236 + DeallocateNode(&AllNodes.front()); |
|
4237 } |
|
4238 |
|
4239 BinarySDNode *SelectionDAG::GetBinarySDNode(unsigned Opcode, SDLoc DL, |
|
4240 @@ -6139,13 +6139,15 @@ |
|
4241 // Node Id fields for nodes At SortedPos and after will contain the |
|
4242 // count of outstanding operands. |
|
4243 for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ) { |
|
4244 - SDNode *N = I++; |
|
4245 + SDNode *N = &*I; |
|
4246 + ++I; |
|
4247 + |
|
4248 checkForCycles(N, this); |
|
4249 unsigned Degree = N->getNumOperands(); |
|
4250 if (Degree == 0) { |
|
4251 // A node with no uses, add it to the result array immediately. |
|
4252 N->setNodeId(DAGSize++); |
|
4253 - allnodes_iterator Q = N; |
|
4254 + allnodes_iterator Q(N); |
|
4255 if (Q != SortedPos) |
|
4256 SortedPos = AllNodes.insert(SortedPos, AllNodes.remove(Q)); |
|
4257 assert(SortedPos != AllNodes.end() && "Overran node list"); |
|
4258 @@ -6159,7 +6161,7 @@ |
|
4259 // Visit all the nodes. As we iterate, move nodes into sorted order, |
|
4260 // such that by the time the end is reached all nodes will be sorted. |
|
4261 for (allnodes_iterator I = allnodes_begin(),E = allnodes_end(); I != E; ++I) { |
|
4262 - SDNode *N = I; |
|
4263 + SDNode *N = &*I; |
|
4264 checkForCycles(N, this); |
|
4265 // N is in sorted position, so all its uses have one less operand |
|
4266 // that needs to be sorted. |
|
4267 @@ -6183,7 +6185,7 @@ |
|
4268 } |
|
4269 if (I == SortedPos) { |
|
4270 #ifndef NDEBUG |
|
4271 - SDNode *S = ++I; |
|
4272 + SDNode *S = &*++I; |
|
4273 dbgs() << "Overran sorted position:\n"; |
|
4274 S->dumprFull(this); dbgs() << "\n"; |
|
4275 dbgs() << "Checking if this is due to cycles\n"; |
|
4276 --- lib/CodeGen/ShadowStackGC.cpp 2014-11-13 14:55:19.000000000 -0800 |
|
4277 +++ lib/CodeGen/ShadowStackGC.cpp 2015-12-07 06:47:52.372680302 -0800 |
|
4278 @@ -112,7 +112,8 @@ |
|
4279 case 1: |
|
4280 // Find all 'return', 'resume', and 'unwind' instructions. |
|
4281 while (StateBB != StateE) { |
|
4282 - BasicBlock *CurBB = StateBB++; |
|
4283 + BasicBlock *CurBB = &*StateBB; |
|
4284 + ++StateBB; |
|
4285 |
|
4286 // Branches and invokes do not escape, only unwind, resume, and return |
|
4287 // do. |
|
4288 @@ -120,7 +121,7 @@ |
|
4289 if (!isa<ReturnInst>(TI) && !isa<ResumeInst>(TI)) |
|
4290 continue; |
|
4291 |
|
4292 - Builder.SetInsertPoint(TI->getParent(), TI); |
|
4293 + Builder.SetInsertPoint(TI); |
|
4294 return &Builder; |
|
4295 } |
|
4296 |
|
4297 @@ -164,7 +165,8 @@ |
|
4298 // Split the basic block containing the function call. |
|
4299 BasicBlock *CallBB = CI->getParent(); |
|
4300 BasicBlock *NewBB = |
|
4301 - CallBB->splitBasicBlock(CI, CallBB->getName() + ".cont"); |
|
4302 + CallBB->splitBasicBlock(CI->getIterator(), |
|
4303 + CallBB->getName() + ".cont"); |
|
4304 |
|
4305 // Remove the unconditional branch inserted at the end of CallBB. |
|
4306 CallBB->getInstList().pop_back(); |
|
4307 @@ -184,7 +186,7 @@ |
|
4308 delete CI; |
|
4309 } |
|
4310 |
|
4311 - Builder.SetInsertPoint(RI->getParent(), RI); |
|
4312 + Builder.SetInsertPoint(RI); |
|
4313 return &Builder; |
|
4314 } |
|
4315 } |
|
4316 --- lib/CodeGen/SjLjEHPrepare.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
4317 +++ lib/CodeGen/SjLjEHPrepare.cpp 2015-12-07 06:54:48.366220128 -0800 |
|
4318 @@ -174,8 +174,8 @@ |
|
4319 // values and replace the LPI with that aggregate. |
|
4320 Type *LPadType = LPI->getType(); |
|
4321 Value *LPadVal = UndefValue::get(LPadType); |
|
4322 - IRBuilder<> Builder( |
|
4323 - std::next(BasicBlock::iterator(cast<Instruction>(SelVal)))); |
|
4324 + auto *SelI = cast<Instruction>(SelVal); |
|
4325 + IRBuilder<> Builder(SelI->getParent(), std::next(SelI->getIterator())); |
|
4326 LPadVal = Builder.CreateInsertValue(LPadVal, ExnVal, 0, "lpad.val"); |
|
4327 LPadVal = Builder.CreateInsertValue(LPadVal, SelVal, 1, "lpad.val"); |
|
4328 |
|
4329 @@ -186,7 +186,7 @@ |
|
4330 /// it with all of the data that we know at this point. |
|
4331 Value *SjLjEHPrepare::setupFunctionContext(Function &F, |
|
4332 ArrayRef<LandingPadInst *> LPads) { |
|
4333 - BasicBlock *EntryBB = F.begin(); |
|
4334 + BasicBlock *EntryBB = &F.front(); |
|
4335 |
|
4336 // Create an alloca for the incoming jump buffer ptr and the new jump buffer |
|
4337 // that needs to be restored on all exits from the function. This is an alloca |
|
4338 @@ -195,12 +195,13 @@ |
|
4339 unsigned Align = |
|
4340 TLI->getDataLayout()->getPrefTypeAlignment(FunctionContextTy); |
|
4341 FuncCtx = new AllocaInst(FunctionContextTy, nullptr, Align, "fn_context", |
|
4342 - EntryBB->begin()); |
|
4343 + &EntryBB->front()); |
|
4344 |
|
4345 // Fill in the function context structure. |
|
4346 for (unsigned I = 0, E = LPads.size(); I != E; ++I) { |
|
4347 LandingPadInst *LPI = LPads[I]; |
|
4348 - IRBuilder<> Builder(LPI->getParent()->getFirstInsertionPt()); |
|
4349 + IRBuilder<> Builder(LPI->getParent(), |
|
4350 + LPI->getParent()->getFirstInsertionPt()); |
|
4351 |
|
4352 // Reference the __data field. |
|
4353 Value *FCData = Builder.CreateConstGEP2_32(FuncCtx, 0, 2, "__data"); |
|
4354 @@ -253,13 +254,13 @@ |
|
4355 // Use 'select i8 true, %arg, undef' to simulate a 'no-op' instruction. |
|
4356 Value *TrueValue = ConstantInt::getTrue(F.getContext()); |
|
4357 Value *UndefValue = UndefValue::get(Ty); |
|
4358 - Instruction *SI = SelectInst::Create(TrueValue, AI, UndefValue, |
|
4359 + Instruction *SI = SelectInst::Create(TrueValue, &*AI, UndefValue, |
|
4360 AI->getName() + ".tmp", |
|
4361 - AfterAllocaInsPt); |
|
4362 + &*AfterAllocaInsPt); |
|
4363 AI->replaceAllUsesWith(SI); |
|
4364 |
|
4365 // Reset the operand, because it was clobbered by the RAUW above. |
|
4366 - SI->setOperand(1, AI); |
|
4367 + SI->setOperand(1, &*AI); |
|
4368 } |
|
4369 } |
|
4370 |
|
4371 @@ -274,7 +275,7 @@ |
|
4372 // Ignore obvious cases we don't have to handle. In particular, most |
|
4373 // instructions either have no uses or only have a single use inside the |
|
4374 // current block. Ignore them quickly. |
|
4375 - Instruction *Inst = II; |
|
4376 + Instruction *Inst = &*II; |
|
4377 if (Inst->use_empty()) |
|
4378 continue; |
|
4379 if (Inst->hasOneUse() && |
|
4380 @@ -355,7 +356,7 @@ |
|
4381 DemotePHIToStack(PN); |
|
4382 |
|
4383 // Move the landingpad instruction back to the top of the landing pad block. |
|
4384 - LPI->moveBefore(UnwindBlock->begin()); |
|
4385 + LPI->moveBefore(&UnwindBlock->front()); |
|
4386 } |
|
4387 } |
|
4388 |
|
4389 @@ -395,7 +396,7 @@ |
|
4390 |
|
4391 Value *FuncCtx = |
|
4392 setupFunctionContext(F, makeArrayRef(LPads.begin(), LPads.end())); |
|
4393 - BasicBlock *EntryBB = F.begin(); |
|
4394 + BasicBlock *EntryBB = &F.front(); |
|
4395 IRBuilder<> Builder(EntryBB->getTerminator()); |
|
4396 |
|
4397 // Get a reference to the jump buffer. |
|
4398 @@ -467,7 +468,7 @@ |
|
4399 continue; |
|
4400 } |
|
4401 Instruction *StackAddr = CallInst::Create(StackAddrFn, "sp"); |
|
4402 - StackAddr->insertAfter(I); |
|
4403 + StackAddr->insertAfter(&*I); |
|
4404 Instruction *StoreStackAddr = new StoreInst(StackAddr, StackPtr, true); |
|
4405 StoreStackAddr->insertAfter(StackAddr); |
|
4406 } |
|
4407 --- lib/CodeGen/SlotIndexes.cpp 2014-04-21 19:02:50.000000000 -0700 |
|
4408 +++ lib/CodeGen/SlotIndexes.cpp 2015-12-07 07:32:28.357221215 -0800 |
|
4409 @@ -172,8 +172,8 @@ |
|
4410 // optionally includes an additional position prior to MBB->begin(), indicated |
|
4411 // by the includeStart flag. This is done so that we can iterate MIs in a MBB |
|
4412 // in parallel with SlotIndexes, but there should be a better way to do this. |
|
4413 - IndexList::iterator ListB = startIdx.listEntry(); |
|
4414 - IndexList::iterator ListI = endIdx.listEntry(); |
|
4415 + IndexList::iterator ListB = startIdx.listEntry()->getIterator(); |
|
4416 + IndexList::iterator ListI = endIdx.listEntry()->getIterator(); |
|
4417 MachineBasicBlock::iterator MBBI = End; |
|
4418 bool pastStart = false; |
|
4419 while (ListI != ListB || MBBI != Begin || (includeStart && !pastStart)) { |
|
4420 --- lib/CodeGen/SpillPlacement.cpp 2014-10-02 15:23:14.000000000 -0700 |
|
4421 +++ lib/CodeGen/SpillPlacement.cpp 2015-12-07 07:33:14.076165375 -0800 |
|
4422 @@ -190,7 +190,7 @@ |
|
4423 setThreshold(MBFI->getEntryFreq()); |
|
4424 for (MachineFunction::iterator I = mf.begin(), E = mf.end(); I != E; ++I) { |
|
4425 unsigned Num = I->getNumber(); |
|
4426 - BlockFrequencies[Num] = MBFI->getBlockFreq(I); |
|
4427 + BlockFrequencies[Num] = MBFI->getBlockFreq(&*I); |
|
4428 } |
|
4429 |
|
4430 // We never change the function. |
|
4431 --- lib/CodeGen/SplitKit.cpp 2014-12-10 15:07:54.000000000 -0800 |
|
4432 +++ lib/CodeGen/SplitKit.cpp 2015-12-07 07:59:47.837252063 -0800 |
|
4433 @@ -176,10 +176,11 @@ |
|
4434 UseE = UseSlots.end(); |
|
4435 |
|
4436 // Loop over basic blocks where CurLI is live. |
|
4437 - MachineFunction::iterator MFI = LIS.getMBBFromIndex(LVI->start); |
|
4438 + MachineFunction::iterator MFI = |
|
4439 + LIS.getMBBFromIndex(LVI->start)->getIterator(); |
|
4440 for (;;) { |
|
4441 BlockInfo BI; |
|
4442 - BI.MBB = MFI; |
|
4443 + BI.MBB = &*MFI; |
|
4444 SlotIndex Start, Stop; |
|
4445 std::tie(Start, Stop) = LIS.getSlotIndexes()->getMBBRange(BI.MBB); |
|
4446 |
|
4447 @@ -259,7 +260,7 @@ |
|
4448 if (LVI->start < Stop) |
|
4449 ++MFI; |
|
4450 else |
|
4451 - MFI = LIS.getMBBFromIndex(LVI->start); |
|
4452 + MFI = LIS.getMBBFromIndex(LVI->start)->getIterator(); |
|
4453 } |
|
4454 |
|
4455 assert(getNumLiveBlocks() == countLiveBlocks(CurLI) && "Bad block count"); |
|
4456 @@ -275,8 +276,9 @@ |
|
4457 unsigned Count = 0; |
|
4458 |
|
4459 // Loop over basic blocks where li is live. |
|
4460 - MachineFunction::const_iterator MFI = LIS.getMBBFromIndex(LVI->start); |
|
4461 - SlotIndex Stop = LIS.getMBBEndIdx(MFI); |
|
4462 + MachineFunction::const_iterator MFI = |
|
4463 + LIS.getMBBFromIndex(LVI->start)->getIterator(); |
|
4464 + SlotIndex Stop = LIS.getMBBEndIdx(&*MFI); |
|
4465 for (;;) { |
|
4466 ++Count; |
|
4467 LVI = li->advanceTo(LVI, Stop); |
|
4468 @@ -284,7 +286,7 @@ |
|
4469 return Count; |
|
4470 do { |
|
4471 ++MFI; |
|
4472 - Stop = LIS.getMBBEndIdx(MFI); |
|
4473 + Stop = LIS.getMBBEndIdx(&*MFI); |
|
4474 } while (Stop <= LVI->start); |
|
4475 } |
|
4476 } |
|
4477 @@ -866,9 +868,11 @@ |
|
4478 // This value has multiple defs in RegIdx, but it wasn't rematerialized, |
|
4479 // so the live range is accurate. Add live-in blocks in [Start;End) to the |
|
4480 // LiveInBlocks. |
|
4481 - MachineFunction::iterator MBB = LIS.getMBBFromIndex(Start); |
|
4482 + MachineFunction::iterator MBB = |
|
4483 + LIS.getMBBFromIndex(Start)->getIterator(); |
|
4484 SlotIndex BlockStart, BlockEnd; |
|
4485 - std::tie(BlockStart, BlockEnd) = LIS.getSlotIndexes()->getMBBRange(MBB); |
|
4486 + std::tie(BlockStart, BlockEnd) = |
|
4487 + LIS.getSlotIndexes()->getMBBRange(&*MBB); |
|
4488 |
|
4489 // The first block may be live-in, or it may have its own def. |
|
4490 if (Start != BlockStart) { |
|
4491 @@ -877,7 +881,7 @@ |
|
4492 DEBUG(dbgs() << ':' << VNI->id << "*BB#" << MBB->getNumber()); |
|
4493 // MBB has its own def. Is it also live-out? |
|
4494 if (BlockEnd <= End) |
|
4495 - LRC.setLiveOutValue(MBB, VNI); |
|
4496 + LRC.setLiveOutValue(&*MBB, VNI); |
|
4497 |
|
4498 // Skip to the next block for live-in. |
|
4499 ++MBB; |
|
4500 @@ -888,23 +892,23 @@ |
|
4501 assert(Start <= BlockStart && "Expected live-in block"); |
|
4502 while (BlockStart < End) { |
|
4503 DEBUG(dbgs() << ">BB#" << MBB->getNumber()); |
|
4504 - BlockEnd = LIS.getMBBEndIdx(MBB); |
|
4505 + BlockEnd = LIS.getMBBEndIdx(&*MBB); |
|
4506 if (BlockStart == ParentVNI->def) { |
|
4507 // This block has the def of a parent PHI, so it isn't live-in. |
|
4508 assert(ParentVNI->isPHIDef() && "Non-phi defined at block start?"); |
|
4509 VNInfo *VNI = LR.extendInBlock(BlockStart, std::min(BlockEnd, End)); |
|
4510 assert(VNI && "Missing def for complex mapped parent PHI"); |
|
4511 if (End >= BlockEnd) |
|
4512 - LRC.setLiveOutValue(MBB, VNI); // Live-out as well. |
|
4513 + LRC.setLiveOutValue(&*MBB, VNI); // Live-out as well. |
|
4514 } else { |
|
4515 // This block needs a live-in value. The last block covered may not |
|
4516 // be live-out. |
|
4517 if (End < BlockEnd) |
|
4518 - LRC.addLiveInBlock(LR, MDT[MBB], End); |
|
4519 + LRC.addLiveInBlock(LR, MDT[&*MBB], End); |
|
4520 else { |
|
4521 // Live-through, and we don't know the value. |
|
4522 - LRC.addLiveInBlock(LR, MDT[MBB]); |
|
4523 - LRC.setLiveOutValue(MBB, nullptr); |
|
4524 + LRC.addLiveInBlock(LR, MDT[&*MBB]); |
|
4525 + LRC.setLiveOutValue(&*MBB, nullptr); |
|
4526 } |
|
4527 } |
|
4528 BlockStart = BlockEnd; |
|
4529 --- lib/CodeGen/StackMapLivenessAnalysis.cpp 2015-01-13 09:47:59.000000000 -0800 |
|
4530 +++ lib/CodeGen/StackMapLivenessAnalysis.cpp 2015-12-07 08:03:47.966214485 -0800 |
|
4531 @@ -86,7 +86,7 @@ |
|
4532 MBBI != MBBE; ++MBBI) { |
|
4533 DEBUG(dbgs() << "****** BB " << MBBI->getName() << " ******\n"); |
|
4534 LiveRegs.init(TRI); |
|
4535 - LiveRegs.addLiveOuts(MBBI); |
|
4536 + LiveRegs.addLiveOuts(&*MBBI); |
|
4537 bool HasStackMap = false; |
|
4538 // Reverse iterate over all instructions and add the current live register |
|
4539 // set to an instruction if we encounter a patchpoint instruction. |
|
4540 --- lib/CodeGen/StackProtector.cpp 2014-12-21 13:52:38.000000000 -0800 |
|
4541 +++ lib/CodeGen/StackProtector.cpp 2015-12-07 08:06:06.725425403 -0800 |
|
4542 @@ -377,7 +377,8 @@ |
|
4543 Value *StackGuardVar = nullptr; // The stack guard variable. |
|
4544 |
|
4545 for (Function::iterator I = F->begin(), E = F->end(); I != E;) { |
|
4546 - BasicBlock *BB = I++; |
|
4547 + BasicBlock *BB = &*I; |
|
4548 + ++I; |
|
4549 ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator()); |
|
4550 if (!RI) |
|
4551 continue; |
|
4552 @@ -437,7 +438,7 @@ |
|
4553 BasicBlock *FailBB = CreateFailBB(); |
|
4554 |
|
4555 // Split the basic block before the return instruction. |
|
4556 - BasicBlock *NewBB = BB->splitBasicBlock(RI, "SP_return"); |
|
4557 + BasicBlock *NewBB = BB->splitBasicBlock(RI->getIterator(), "SP_return"); |
|
4558 |
|
4559 // Update the dominator tree if we need to. |
|
4560 if (DT && DT->isReachableFromEntry(BB)) { |
|
4561 --- lib/CodeGen/TailDuplication.cpp 2014-08-04 19:39:49.000000000 -0700 |
|
4562 +++ lib/CodeGen/TailDuplication.cpp 2015-12-07 08:11:12.192736388 -0800 |
|
4563 @@ -161,7 +161,7 @@ |
|
4564 |
|
4565 static void VerifyPHIs(MachineFunction &MF, bool CheckExtra) { |
|
4566 for (MachineFunction::iterator I = ++MF.begin(), E = MF.end(); I != E; ++I) { |
|
4567 - MachineBasicBlock *MBB = I; |
|
4568 + MachineBasicBlock *MBB = &*I; |
|
4569 SmallSetVector<MachineBasicBlock*, 8> Preds(MBB->pred_begin(), |
|
4570 MBB->pred_end()); |
|
4571 MachineBasicBlock::iterator MI = MBB->begin(); |
|
4572 @@ -322,7 +322,8 @@ |
|
4573 } |
|
4574 |
|
4575 for (MachineFunction::iterator I = ++MF.begin(), E = MF.end(); I != E; ) { |
|
4576 - MachineBasicBlock *MBB = I++; |
|
4577 + MachineBasicBlock *MBB = &*I; |
|
4578 + ++I; |
|
4579 |
|
4580 if (NumTails == TailDupLimit) |
|
4581 break; |
|
4582 @@ -697,7 +698,7 @@ |
|
4583 << "From simple Succ: " << *TailBB); |
|
4584 |
|
4585 MachineBasicBlock *NewTarget = *TailBB->succ_begin(); |
|
4586 - MachineBasicBlock *NextBB = std::next(MachineFunction::iterator(PredBB)); |
|
4587 + MachineBasicBlock *NextBB = &*std::next(PredBB->getIterator()); |
|
4588 |
|
4589 // Make PredFBB explicit. |
|
4590 if (PredCond.empty()) |
|
4591 @@ -855,7 +856,7 @@ |
|
4592 // If TailBB was duplicated into all its predecessors except for the prior |
|
4593 // block, which falls through unconditionally, move the contents of this |
|
4594 // block into the prior block. |
|
4595 - MachineBasicBlock *PrevBB = std::prev(MachineFunction::iterator(TailBB)); |
|
4596 + MachineBasicBlock *PrevBB = &*std::prev(TailBB->getIterator()); |
|
4597 MachineBasicBlock *PriorTBB = nullptr, *PriorFBB = nullptr; |
|
4598 SmallVector<MachineOperand, 4> PriorCond; |
|
4599 // This has to check PrevBB->succ_size() because EH edges are ignored by |
|
4600 --- lib/CodeGen/TwoAddressInstructionPass.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
4601 +++ lib/CodeGen/TwoAddressInstructionPass.cpp 2015-12-07 08:24:37.706267592 -0800 |
|
4602 @@ -634,7 +634,7 @@ |
|
4603 unsigned RegA, unsigned RegB, |
|
4604 unsigned Dist) { |
|
4605 // FIXME: Why does convertToThreeAddress() need an iterator reference? |
|
4606 - MachineFunction::iterator MFI = MBB; |
|
4607 + MachineFunction::iterator MFI = MBB->getIterator(); |
|
4608 MachineInstr *NewMI = TII->convertToThreeAddress(MFI, mi, LV); |
|
4609 assert(MBB == MFI && "convertToThreeAddress changed iterator reference"); |
|
4610 if (!NewMI) |
|
4611 @@ -1535,7 +1535,7 @@ |
|
4612 TiedOperandMap TiedOperands; |
|
4613 for (MachineFunction::iterator MBBI = MF->begin(), MBBE = MF->end(); |
|
4614 MBBI != MBBE; ++MBBI) { |
|
4615 - MBB = MBBI; |
|
4616 + MBB = &*MBBI; |
|
4617 unsigned Dist = 0; |
|
4618 DistanceMap.clear(); |
|
4619 SrcRegMap.clear(); |
|
4620 --- lib/CodeGen/UnreachableBlockElim.cpp 2014-08-24 16:23:06.000000000 -0700 |
|
4621 +++ lib/CodeGen/UnreachableBlockElim.cpp 2015-12-07 08:28:10.169471890 -0800 |
|
4622 @@ -71,8 +71,8 @@ |
|
4623 // in them. |
|
4624 std::vector<BasicBlock*> DeadBlocks; |
|
4625 for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) |
|
4626 - if (!Reachable.count(I)) { |
|
4627 - BasicBlock *BB = I; |
|
4628 + if (!Reachable.count(&*I)) { |
|
4629 + BasicBlock *BB = &*I; |
|
4630 DeadBlocks.push_back(BB); |
|
4631 while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) { |
|
4632 PN->replaceAllUsesWith(Constant::getNullValue(PN->getType())); |
|
4633 @@ -131,7 +131,7 @@ |
|
4634 // in them. |
|
4635 std::vector<MachineBasicBlock*> DeadBlocks; |
|
4636 for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { |
|
4637 - MachineBasicBlock *BB = I; |
|
4638 + MachineBasicBlock *BB = &*I; |
|
4639 |
|
4640 // Test for deadness. |
|
4641 if (!Reachable.count(BB)) { |
|
4642 @@ -167,7 +167,7 @@ |
|
4643 |
|
4644 // Cleanup PHI nodes. |
|
4645 for (MachineFunction::iterator I = F.begin(), E = F.end(); I != E; ++I) { |
|
4646 - MachineBasicBlock *BB = I; |
|
4647 + MachineBasicBlock *BB = &*I; |
|
4648 // Prune unneeded PHI entries. |
|
4649 SmallPtrSet<MachineBasicBlock*, 8> preds(BB->pred_begin(), |
|
4650 BB->pred_end()); |
|
4651 --- lib/CodeGen/VirtRegMap.cpp 2014-12-10 16:59:06.000000000 -0800 |
|
4652 +++ lib/CodeGen/VirtRegMap.cpp 2015-12-07 08:29:40.895828212 -0800 |
|
4653 @@ -312,7 +312,7 @@ |
|
4654 bool IsExitBB = MBBI->succ_empty(); |
|
4655 for (MachineBasicBlock::instr_iterator |
|
4656 MII = MBBI->instr_begin(), MIE = MBBI->instr_end(); MII != MIE;) { |
|
4657 - MachineInstr *MI = MII; |
|
4658 + MachineInstr *MI = &*MII; |
|
4659 ++MII; |
|
4660 |
|
4661 // Check if this instruction is a call to a noreturn function. If this |
|
4662 --- lib/ExecutionEngine/ExecutionEngine.cpp 2014-12-02 16:51:19.000000000 -0800 |
|
4663 +++ lib/ExecutionEngine/ExecutionEngine.cpp 2015-12-07 12:04:19.264547988 -0800 |
|
4664 @@ -190,10 +190,10 @@ |
|
4665 MutexGuard locked(lock); |
|
4666 |
|
4667 for (Module::iterator FI = M->begin(), FE = M->end(); FI != FE; ++FI) |
|
4668 - EEState.RemoveMapping(FI); |
|
4669 + EEState.RemoveMapping(&*FI); |
|
4670 for (Module::global_iterator GI = M->global_begin(), GE = M->global_end(); |
|
4671 GI != GE; ++GI) |
|
4672 - EEState.RemoveMapping(GI); |
|
4673 + EEState.RemoveMapping(&*GI); |
|
4674 } |
|
4675 |
|
4676 void *ExecutionEngine::updateGlobalMapping(const GlobalValue *GV, void *Addr) { |
|
4677 --- lib/ExecutionEngine/Interpreter/Execution.cpp 2014-04-27 21:05:08.000000000 -0700 |
|
4678 +++ lib/ExecutionEngine/Interpreter/Execution.cpp 2015-12-07 12:10:37.392666513 -0800 |
|
4679 @@ -2091,7 +2091,7 @@ |
|
4680 } |
|
4681 |
|
4682 // Get pointers to first LLVM BB & Instruction in function. |
|
4683 - StackFrame.CurBB = F->begin(); |
|
4684 + StackFrame.CurBB = &F->front(); |
|
4685 StackFrame.CurInst = StackFrame.CurBB->begin(); |
|
4686 |
|
4687 // Run through the function arguments and initialize their values... |
|
4688 @@ -2103,7 +2103,7 @@ |
|
4689 unsigned i = 0; |
|
4690 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); |
|
4691 AI != E; ++AI, ++i) |
|
4692 - SetValue(AI, ArgVals[i], StackFrame); |
|
4693 + SetValue(&*AI, ArgVals[i], StackFrame); |
|
4694 |
|
4695 // Handle varargs arguments... |
|
4696 StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end()); |
|
4697 --- lib/IR/AsmWriter.cpp 2015-01-14 19:59:43.000000000 -0800 |
|
4698 +++ lib/IR/AsmWriter.cpp 2015-11-24 08:43:48.354963500 -0800 |
|
4699 @@ -674,14 +674,14 @@ |
|
4700 for (Module::const_global_iterator I = TheModule->global_begin(), |
|
4701 E = TheModule->global_end(); I != E; ++I) { |
|
4702 if (!I->hasName()) |
|
4703 - CreateModuleSlot(I); |
|
4704 + CreateModuleSlot(&(*I)); |
|
4705 } |
|
4706 |
|
4707 // Add metadata used by named metadata. |
|
4708 for (Module::const_named_metadata_iterator |
|
4709 I = TheModule->named_metadata_begin(), |
|
4710 E = TheModule->named_metadata_end(); I != E; ++I) { |
|
4711 - const NamedMDNode *NMD = I; |
|
4712 + const NamedMDNode *NMD = &(*I); |
|
4713 for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) |
|
4714 CreateMetadataSlot(NMD->getOperand(i)); |
|
4715 } |
|
4716 @@ -690,7 +690,7 @@ |
|
4717 I != E; ++I) { |
|
4718 if (!I->hasName()) |
|
4719 // Add all the unnamed functions to the table. |
|
4720 - CreateModuleSlot(I); |
|
4721 + CreateModuleSlot(&(*I)); |
|
4722 |
|
4723 // Add all the function attributes to the table. |
|
4724 // FIXME: Add attributes of other objects? |
|
4725 @@ -711,7 +711,7 @@ |
|
4726 for(Function::const_arg_iterator AI = TheFunction->arg_begin(), |
|
4727 AE = TheFunction->arg_end(); AI != AE; ++AI) |
|
4728 if (!AI->hasName()) |
|
4729 - CreateFunctionSlot(AI); |
|
4730 + CreateFunctionSlot(&(*AI)); |
|
4731 |
|
4732 ST_DEBUG("Inserting Instructions:\n"); |
|
4733 |
|
4734 @@ -721,12 +721,12 @@ |
|
4735 for (Function::const_iterator BB = TheFunction->begin(), |
|
4736 E = TheFunction->end(); BB != E; ++BB) { |
|
4737 if (!BB->hasName()) |
|
4738 - CreateFunctionSlot(BB); |
|
4739 + CreateFunctionSlot(&(*BB)); |
|
4740 |
|
4741 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; |
|
4742 ++I) { |
|
4743 if (!I->getType()->isVoidTy() && !I->hasName()) |
|
4744 - CreateFunctionSlot(I); |
|
4745 + CreateFunctionSlot(&(*I)); |
|
4746 |
|
4747 // Intrinsics can directly use metadata. We allow direct calls to any |
|
4748 // llvm.foo function here, because the target may not be linked into the |
|
4749 @@ -1607,21 +1607,22 @@ |
|
4750 if (!M->global_empty()) Out << '\n'; |
|
4751 for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); |
|
4752 I != E; ++I) { |
|
4753 - printGlobal(I); Out << '\n'; |
|
4754 + printGlobal(&(*I)); |
|
4755 + Out << '\n'; |
|
4756 } |
|
4757 |
|
4758 // Output all aliases. |
|
4759 if (!M->alias_empty()) Out << "\n"; |
|
4760 for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); |
|
4761 I != E; ++I) |
|
4762 - printAlias(I); |
|
4763 + printAlias(&(*I)); |
|
4764 |
|
4765 // Output global use-lists. |
|
4766 printUseLists(nullptr); |
|
4767 |
|
4768 // Output all of the functions. |
|
4769 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) |
|
4770 - printFunction(I); |
|
4771 + printFunction(&(*I)); |
|
4772 assert(UseListOrders.empty() && "All use-lists should have been consumed"); |
|
4773 |
|
4774 // Output all attribute groups. |
|
4775 @@ -1635,7 +1636,7 @@ |
|
4776 |
|
4777 for (Module::const_named_metadata_iterator I = M->named_metadata_begin(), |
|
4778 E = M->named_metadata_end(); I != E; ++I) |
|
4779 - printNamedMDNode(I); |
|
4780 + printNamedMDNode(&(*I)); |
|
4781 |
|
4782 // Output metadata. |
|
4783 if (!Machine.mdn_empty()) { |
|
4784 @@ -1936,7 +1937,7 @@ |
|
4785 I != E; ++I) { |
|
4786 // Insert commas as we go... the first arg doesn't get a comma |
|
4787 if (I != F->arg_begin()) Out << ", "; |
|
4788 - printArgument(I, Attrs, Idx); |
|
4789 + printArgument(&(*I), Attrs, Idx); |
|
4790 Idx++; |
|
4791 } |
|
4792 } else { |
|
4793 @@ -1988,7 +1989,7 @@ |
|
4794 Out << " {"; |
|
4795 // Output all of the function's basic blocks. |
|
4796 for (Function::const_iterator I = F->begin(), E = F->end(); I != E; ++I) |
|
4797 - printBasicBlock(I); |
|
4798 + printBasicBlock(&(*I)); |
|
4799 |
|
4800 // Output the function's use-lists. |
|
4801 printUseLists(F); |
|
4802 --- lib/IR/AutoUpgrade.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
4803 +++ lib/IR/AutoUpgrade.cpp 2015-11-24 09:08:05.216149050 -0800 |
|
4804 @@ -278,7 +278,7 @@ |
|
4805 Function *F = CI->getCalledFunction(); |
|
4806 LLVMContext &C = CI->getContext(); |
|
4807 IRBuilder<> Builder(C); |
|
4808 - Builder.SetInsertPoint(CI->getParent(), CI); |
|
4809 + Builder.SetInsertPoint(CI->getParent(), CI->getIterator()); |
|
4810 |
|
4811 assert(F && "Intrinsic call is not direct?"); |
|
4812 |
|
4813 @@ -304,7 +304,7 @@ |
|
4814 Name == "llvm.x86.avx.movnt.ps.256" || |
|
4815 Name == "llvm.x86.avx.movnt.pd.256") { |
|
4816 IRBuilder<> Builder(C); |
|
4817 - Builder.SetInsertPoint(CI->getParent(), CI); |
|
4818 + Builder.SetInsertPoint(CI->getParent(), CI->getIterator()); |
|
4819 |
|
4820 Module *M = F->getParent(); |
|
4821 SmallVector<Metadata *, 1> Elts; |
|
4822 --- lib/IR/BasicBlock.cpp 2014-12-22 05:00:36.000000000 -0800 |
|
4823 +++ lib/IR/BasicBlock.cpp 2015-11-24 09:18:34.413275013 -0800 |
|
4824 @@ -60,7 +60,7 @@ |
|
4825 assert(!Parent && "Already has a parent"); |
|
4826 |
|
4827 if (InsertBefore) |
|
4828 - NewParent->getBasicBlockList().insert(InsertBefore, this); |
|
4829 + NewParent->getBasicBlockList().insert(InsertBefore->getIterator(), this); |
|
4830 else |
|
4831 NewParent->getBasicBlockList().push_back(this); |
|
4832 } |
|
4833 @@ -95,26 +95,28 @@ |
|
4834 } |
|
4835 |
|
4836 void BasicBlock::removeFromParent() { |
|
4837 - getParent()->getBasicBlockList().remove(this); |
|
4838 + getParent()->getBasicBlockList().remove(getIterator()); |
|
4839 } |
|
4840 |
|
4841 void BasicBlock::eraseFromParent() { |
|
4842 - getParent()->getBasicBlockList().erase(this); |
|
4843 + getParent()->getBasicBlockList().erase(getIterator()); |
|
4844 } |
|
4845 |
|
4846 /// moveBefore - Unlink this basic block from its current function and |
|
4847 /// insert it into the function that MovePos lives in, right before MovePos. |
|
4848 void BasicBlock::moveBefore(BasicBlock *MovePos) { |
|
4849 - MovePos->getParent()->getBasicBlockList().splice(MovePos, |
|
4850 - getParent()->getBasicBlockList(), this); |
|
4851 + MovePos->getParent()->getBasicBlockList().splice(MovePos->getIterator(), |
|
4852 + getParent()->getBasicBlockList(), getIterator()); |
|
4853 } |
|
4854 |
|
4855 /// moveAfter - Unlink this basic block from its current function and |
|
4856 /// insert it into the function that MovePos lives in, right after MovePos. |
|
4857 void BasicBlock::moveAfter(BasicBlock *MovePos) { |
|
4858 - Function::iterator I = MovePos; |
|
4859 - MovePos->getParent()->getBasicBlockList().splice(++I, |
|
4860 - getParent()->getBasicBlockList(), this); |
|
4861 + Function::iterator I = MovePos->getIterator(); |
|
4862 + Function::iterator II = ++I; |
|
4863 + MovePos->getParent()->getBasicBlockList().splice(II, |
|
4864 + getParent()->getBasicBlockList(), |
|
4865 + getIterator()); |
|
4866 } |
|
4867 |
|
4868 |
|
4869 @@ -200,7 +202,7 @@ |
|
4870 } |
|
4871 |
|
4872 BasicBlock::iterator BasicBlock::getFirstInsertionPt() { |
|
4873 - iterator InsertPt = getFirstNonPHI(); |
|
4874 + iterator InsertPt = getFirstNonPHI()->getIterator(); |
|
4875 if (isa<LandingPadInst>(InsertPt)) ++InsertPt; |
|
4876 return InsertPt; |
|
4877 } |
|
4878 --- lib/IR/Core.cpp 2015-01-29 09:33:19.000000000 -0800 |
|
4879 +++ lib/IR/Core.cpp 2015-11-24 20:09:32.108977930 -0800 |
|
4880 @@ -1517,7 +1517,8 @@ |
|
4881 Module::global_iterator I = Mod->global_begin(); |
|
4882 if (I == Mod->global_end()) |
|
4883 return nullptr; |
|
4884 - return wrap(I); |
|
4885 + |
|
4886 + return wrap(&(*I)); |
|
4887 } |
|
4888 |
|
4889 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M) { |
|
4890 @@ -1525,23 +1526,28 @@ |
|
4891 Module::global_iterator I = Mod->global_end(); |
|
4892 if (I == Mod->global_begin()) |
|
4893 return nullptr; |
|
4894 - return wrap(--I); |
|
4895 + |
|
4896 + --I; |
|
4897 + return wrap(&(*I)); |
|
4898 } |
|
4899 |
|
4900 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar) { |
|
4901 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar); |
|
4902 - Module::global_iterator I = GV; |
|
4903 + Module::global_iterator I(GV); |
|
4904 if (++I == GV->getParent()->global_end()) |
|
4905 return nullptr; |
|
4906 - return wrap(I); |
|
4907 + |
|
4908 + return wrap(&(*I)); |
|
4909 } |
|
4910 |
|
4911 LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar) { |
|
4912 GlobalVariable *GV = unwrap<GlobalVariable>(GlobalVar); |
|
4913 - Module::global_iterator I = GV; |
|
4914 + Module::global_iterator I(GV); |
|
4915 if (I == GV->getParent()->global_begin()) |
|
4916 return nullptr; |
|
4917 - return wrap(--I); |
|
4918 + |
|
4919 + --I; |
|
4920 + return wrap(&(*I)); |
|
4921 } |
|
4922 |
|
4923 void LLVMDeleteGlobal(LLVMValueRef GlobalVar) { |
|
4924 @@ -1550,8 +1556,9 @@ |
|
4925 |
|
4926 LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar) { |
|
4927 GlobalVariable* GV = unwrap<GlobalVariable>(GlobalVar); |
|
4928 - if ( !GV->hasInitializer() ) |
|
4929 + if (!GV->hasInitializer()) |
|
4930 return nullptr; |
|
4931 + |
|
4932 return wrap(GV->getInitializer()); |
|
4933 } |
|
4934 |
|
4935 @@ -1650,7 +1657,8 @@ |
|
4936 Module::iterator I = Mod->begin(); |
|
4937 if (I == Mod->end()) |
|
4938 return nullptr; |
|
4939 - return wrap(I); |
|
4940 + |
|
4941 + return wrap(&(*I)); |
|
4942 } |
|
4943 |
|
4944 LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M) { |
|
4945 @@ -1658,23 +1666,28 @@ |
|
4946 Module::iterator I = Mod->end(); |
|
4947 if (I == Mod->begin()) |
|
4948 return nullptr; |
|
4949 - return wrap(--I); |
|
4950 + |
|
4951 + --I; |
|
4952 + return wrap(&(*I)); |
|
4953 } |
|
4954 |
|
4955 LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn) { |
|
4956 Function *Func = unwrap<Function>(Fn); |
|
4957 - Module::iterator I = Func; |
|
4958 + Module::iterator I(Func); |
|
4959 if (++I == Func->getParent()->end()) |
|
4960 return nullptr; |
|
4961 - return wrap(I); |
|
4962 + |
|
4963 + return wrap(&(*I)); |
|
4964 } |
|
4965 |
|
4966 LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn) { |
|
4967 Function *Func = unwrap<Function>(Fn); |
|
4968 - Module::iterator I = Func; |
|
4969 + Module::iterator I(Func); |
|
4970 if (I == Func->getParent()->begin()) |
|
4971 return nullptr; |
|
4972 - return wrap(--I); |
|
4973 + |
|
4974 + --I; |
|
4975 + return wrap(&(*I)); |
|
4976 } |
|
4977 |
|
4978 void LLVMDeleteFunction(LLVMValueRef Fn) { |
|
4979 @@ -1684,6 +1697,7 @@ |
|
4980 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn) { |
|
4981 if (Function *F = dyn_cast<Function>(unwrap(Fn))) |
|
4982 return F->getIntrinsicID(); |
|
4983 + |
|
4984 return 0; |
|
4985 } |
|
4986 |
|
4987 @@ -1698,7 +1712,7 @@ |
|
4988 |
|
4989 const char *LLVMGetGC(LLVMValueRef Fn) { |
|
4990 Function *F = unwrap<Function>(Fn); |
|
4991 - return F->hasGC()? F->getGC() : nullptr; |
|
4992 + return F->hasGC() ? F->getGC() : nullptr; |
|
4993 } |
|
4994 |
|
4995 void LLVMSetGC(LLVMValueRef Fn, const char *GC) { |
|
4996 @@ -1761,14 +1775,15 @@ |
|
4997 Function *Fn = unwrap<Function>(FnRef); |
|
4998 for (Function::arg_iterator I = Fn->arg_begin(), |
|
4999 E = Fn->arg_end(); I != E; I++) |
|
5000 - *ParamRefs++ = wrap(I); |
|
5001 + *ParamRefs++ = wrap(&(*I)); |
|
5002 } |
|
5003 |
|
5004 LLVMValueRef LLVMGetParam(LLVMValueRef FnRef, unsigned index) { |
|
5005 Function::arg_iterator AI = unwrap<Function>(FnRef)->arg_begin(); |
|
5006 while (index --> 0) |
|
5007 AI++; |
|
5008 - return wrap(AI); |
|
5009 + |
|
5010 + return wrap(&(*AI)); |
|
5011 } |
|
5012 |
|
5013 LLVMValueRef LLVMGetParamParent(LLVMValueRef V) { |
|
5014 @@ -1780,7 +1795,8 @@ |
|
5015 Function::arg_iterator I = Func->arg_begin(); |
|
5016 if (I == Func->arg_end()) |
|
5017 return nullptr; |
|
5018 - return wrap(I); |
|
5019 + |
|
5020 + return wrap(&(*I)); |
|
5021 } |
|
5022 |
|
5023 LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn) { |
|
5024 @@ -1788,23 +1804,28 @@ |
|
5025 Function::arg_iterator I = Func->arg_end(); |
|
5026 if (I == Func->arg_begin()) |
|
5027 return nullptr; |
|
5028 - return wrap(--I); |
|
5029 + |
|
5030 + --I; |
|
5031 + return wrap(&(*I)); |
|
5032 } |
|
5033 |
|
5034 LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg) { |
|
5035 Argument *A = unwrap<Argument>(Arg); |
|
5036 - Function::arg_iterator I = A; |
|
5037 + Function::arg_iterator I(A); |
|
5038 if (++I == A->getParent()->arg_end()) |
|
5039 return nullptr; |
|
5040 - return wrap(I); |
|
5041 + |
|
5042 + return wrap(&(*I)); |
|
5043 } |
|
5044 |
|
5045 LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg) { |
|
5046 Argument *A = unwrap<Argument>(Arg); |
|
5047 - Function::arg_iterator I = A; |
|
5048 + Function::arg_iterator I(A); |
|
5049 if (I == A->getParent()->arg_begin()) |
|
5050 return nullptr; |
|
5051 - return wrap(--I); |
|
5052 + |
|
5053 + --I; |
|
5054 + return wrap(&(*I)); |
|
5055 } |
|
5056 |
|
5057 void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA) { |
|
5058 @@ -1862,7 +1883,7 @@ |
|
5059 void LLVMGetBasicBlocks(LLVMValueRef FnRef, LLVMBasicBlockRef *BasicBlocksRefs){ |
|
5060 Function *Fn = unwrap<Function>(FnRef); |
|
5061 for (Function::iterator I = Fn->begin(), E = Fn->end(); I != E; I++) |
|
5062 - *BasicBlocksRefs++ = wrap(I); |
|
5063 + *BasicBlocksRefs++ = wrap(&(*I)); |
|
5064 } |
|
5065 |
|
5066 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn) { |
|
5067 @@ -1874,7 +1895,8 @@ |
|
5068 Function::iterator I = Func->begin(); |
|
5069 if (I == Func->end()) |
|
5070 return nullptr; |
|
5071 - return wrap(I); |
|
5072 + |
|
5073 + return wrap(&(*I)); |
|
5074 } |
|
5075 |
|
5076 LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn) { |
|
5077 @@ -1882,23 +1904,28 @@ |
|
5078 Function::iterator I = Func->end(); |
|
5079 if (I == Func->begin()) |
|
5080 return nullptr; |
|
5081 - return wrap(--I); |
|
5082 + |
|
5083 + --I; |
|
5084 + return wrap(&(*I)); |
|
5085 } |
|
5086 |
|
5087 LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB) { |
|
5088 BasicBlock *Block = unwrap(BB); |
|
5089 - Function::iterator I = Block; |
|
5090 + Function::iterator I(Block); |
|
5091 if (++I == Block->getParent()->end()) |
|
5092 return nullptr; |
|
5093 - return wrap(I); |
|
5094 + |
|
5095 + return wrap(&(*I)); |
|
5096 } |
|
5097 |
|
5098 LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB) { |
|
5099 BasicBlock *Block = unwrap(BB); |
|
5100 - Function::iterator I = Block; |
|
5101 + Function::iterator I(Block); |
|
5102 if (I == Block->getParent()->begin()) |
|
5103 return nullptr; |
|
5104 - return wrap(--I); |
|
5105 + |
|
5106 + --I; |
|
5107 + return wrap(&(*I)); |
|
5108 } |
|
5109 |
|
5110 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C, |
|
5111 @@ -1950,7 +1977,8 @@ |
|
5112 BasicBlock::iterator I = Block->begin(); |
|
5113 if (I == Block->end()) |
|
5114 return nullptr; |
|
5115 - return wrap(I); |
|
5116 + |
|
5117 + return wrap(&(*I)); |
|
5118 } |
|
5119 |
|
5120 LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB) { |
|
5121 @@ -1958,23 +1986,28 @@ |
|
5122 BasicBlock::iterator I = Block->end(); |
|
5123 if (I == Block->begin()) |
|
5124 return nullptr; |
|
5125 - return wrap(--I); |
|
5126 + |
|
5127 + --I; |
|
5128 + return wrap(&(*I)); |
|
5129 } |
|
5130 |
|
5131 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst) { |
|
5132 Instruction *Instr = unwrap<Instruction>(Inst); |
|
5133 - BasicBlock::iterator I = Instr; |
|
5134 + BasicBlock::iterator I(Instr); |
|
5135 if (++I == Instr->getParent()->end()) |
|
5136 return nullptr; |
|
5137 - return wrap(I); |
|
5138 + |
|
5139 + return wrap(&(*I)); |
|
5140 } |
|
5141 |
|
5142 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst) { |
|
5143 Instruction *Instr = unwrap<Instruction>(Inst); |
|
5144 - BasicBlock::iterator I = Instr; |
|
5145 + BasicBlock::iterator I(Instr); |
|
5146 if (I == Instr->getParent()->begin()) |
|
5147 return nullptr; |
|
5148 - return wrap(--I); |
|
5149 + |
|
5150 + --I; |
|
5151 + return wrap(&(*I)); |
|
5152 } |
|
5153 |
|
5154 void LLVMInstructionEraseFromParent(LLVMValueRef Inst) { |
|
5155 @@ -2142,12 +2175,12 @@ |
|
5156 LLVMValueRef Instr) { |
|
5157 BasicBlock *BB = unwrap(Block); |
|
5158 Instruction *I = Instr? unwrap<Instruction>(Instr) : (Instruction*) BB->end(); |
|
5159 - unwrap(Builder)->SetInsertPoint(BB, I); |
|
5160 + unwrap(Builder)->SetInsertPoint(BB, I->getIterator()); |
|
5161 } |
|
5162 |
|
5163 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr) { |
|
5164 Instruction *I = unwrap<Instruction>(Instr); |
|
5165 - unwrap(Builder)->SetInsertPoint(I->getParent(), I); |
|
5166 + unwrap(Builder)->SetInsertPoint(I->getParent(), I->getIterator()); |
|
5167 } |
|
5168 |
|
5169 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block) { |
|
5170 --- lib/IR/DebugInfo.cpp 2015-02-12 15:46:59.000000000 -0800 |
|
5171 +++ lib/IR/DebugInfo.cpp 2015-11-24 20:11:47.916206795 -0800 |
|
5172 @@ -1485,7 +1485,7 @@ |
|
5173 |
|
5174 for (Module::named_metadata_iterator NMI = M.named_metadata_begin(), |
|
5175 NME = M.named_metadata_end(); NMI != NME;) { |
|
5176 - NamedMDNode *NMD = NMI; |
|
5177 + NamedMDNode *NMD = &(*NMI); |
|
5178 ++NMI; |
|
5179 if (NMD->getName().startswith("llvm.dbg.")) { |
|
5180 NMD->eraseFromParent(); |
|
5181 --- lib/IR/Function.cpp 2014-12-24 23:49:20.000000000 -0800 |
|
5182 +++ lib/IR/Function.cpp 2015-11-27 09:29:07.971979862 -0800 |
|
5183 @@ -228,11 +228,11 @@ |
|
5184 } |
|
5185 |
|
5186 void Function::removeFromParent() { |
|
5187 - getParent()->getFunctionList().remove(this); |
|
5188 + getParent()->getFunctionList().remove(getIterator()); |
|
5189 } |
|
5190 |
|
5191 void Function::eraseFromParent() { |
|
5192 - getParent()->getFunctionList().erase(this); |
|
5193 + getParent()->getFunctionList().erase(getIterator()); |
|
5194 } |
|
5195 |
|
5196 //===----------------------------------------------------------------------===// |
|
5197 --- lib/IR/Globals.cpp 2014-12-22 05:00:36.000000000 -0800 |
|
5198 +++ lib/IR/Globals.cpp 2015-11-27 06:06:12.109691445 -0800 |
|
5199 @@ -178,7 +178,7 @@ |
|
5200 } |
|
5201 |
|
5202 if (Before) |
|
5203 - Before->getParent()->getGlobalList().insert(Before, this); |
|
5204 + Before->getParent()->getGlobalList().insert(Before->getIterator(), this); |
|
5205 else |
|
5206 M.getGlobalList().push_back(this); |
|
5207 } |
|
5208 @@ -188,11 +188,11 @@ |
|
5209 } |
|
5210 |
|
5211 void GlobalVariable::removeFromParent() { |
|
5212 - getParent()->getGlobalList().remove(this); |
|
5213 + getParent()->getGlobalList().remove(getIterator()); |
|
5214 } |
|
5215 |
|
5216 void GlobalVariable::eraseFromParent() { |
|
5217 - getParent()->getGlobalList().erase(this); |
|
5218 + getParent()->getGlobalList().erase(getIterator()); |
|
5219 } |
|
5220 |
|
5221 void GlobalVariable::replaceUsesOfWithOnConstant(Value *From, Value *To, |
|
5222 @@ -290,11 +290,11 @@ |
|
5223 } |
|
5224 |
|
5225 void GlobalAlias::removeFromParent() { |
|
5226 - getParent()->getAliasList().remove(this); |
|
5227 + getParent()->getAliasList().remove(getIterator()); |
|
5228 } |
|
5229 |
|
5230 void GlobalAlias::eraseFromParent() { |
|
5231 - getParent()->getAliasList().erase(this); |
|
5232 + getParent()->getAliasList().erase(getIterator()); |
|
5233 } |
|
5234 |
|
5235 void GlobalAlias::setAliasee(Constant *Aliasee) { |
|
5236 --- lib/IR/Instruction.cpp 2014-12-22 05:00:36.000000000 -0800 |
|
5237 +++ lib/IR/Instruction.cpp 2015-11-27 07:26:46.480147123 -0800 |
|
5238 @@ -26,9 +26,9 @@ |
|
5239 |
|
5240 // If requested, insert this instruction into a basic block... |
|
5241 if (InsertBefore) { |
|
5242 - assert(InsertBefore->getParent() && |
|
5243 - "Instruction to insert before is not in a basic block!"); |
|
5244 - InsertBefore->getParent()->getInstList().insert(InsertBefore, this); |
|
5245 + BasicBlock *BB = InsertBefore->getParent(); |
|
5246 + assert(BB && "Instruction to insert before is not in a basic block!"); |
|
5247 + BB->getInstList().insert(InsertBefore->getIterator(), this); |
|
5248 } |
|
5249 } |
|
5250 |
|
5251 @@ -59,31 +59,33 @@ |
|
5252 } |
|
5253 |
|
5254 void Instruction::removeFromParent() { |
|
5255 - getParent()->getInstList().remove(this); |
|
5256 + getParent()->getInstList().remove(getIterator()); |
|
5257 } |
|
5258 |
|
5259 void Instruction::eraseFromParent() { |
|
5260 - getParent()->getInstList().erase(this); |
|
5261 + getParent()->getInstList().erase(getIterator()); |
|
5262 } |
|
5263 |
|
5264 /// insertBefore - Insert an unlinked instructions into a basic block |
|
5265 /// immediately before the specified instruction. |
|
5266 void Instruction::insertBefore(Instruction *InsertPos) { |
|
5267 - InsertPos->getParent()->getInstList().insert(InsertPos, this); |
|
5268 + InsertPos->getParent()->getInstList().insert(InsertPos->getIterator(), this); |
|
5269 } |
|
5270 |
|
5271 /// insertAfter - Insert an unlinked instructions into a basic block |
|
5272 /// immediately after the specified instruction. |
|
5273 void Instruction::insertAfter(Instruction *InsertPos) { |
|
5274 - InsertPos->getParent()->getInstList().insertAfter(InsertPos, this); |
|
5275 + InsertPos->getParent()->getInstList().insertAfter(InsertPos->getIterator(), |
|
5276 + this); |
|
5277 } |
|
5278 |
|
5279 /// moveBefore - Unlink this instruction from its current basic block and |
|
5280 /// insert it into the basic block that MovePos lives in, right before |
|
5281 /// MovePos. |
|
5282 void Instruction::moveBefore(Instruction *MovePos) { |
|
5283 - MovePos->getParent()->getInstList().splice(MovePos,getParent()->getInstList(), |
|
5284 - this); |
|
5285 + MovePos->getParent()->getInstList().splice(MovePos->getIterator(), |
|
5286 + getParent()->getInstList(), |
|
5287 + getIterator()); |
|
5288 } |
|
5289 |
|
5290 /// Set or clear the unsafe-algebra flag on this instruction, which must be an |
|
5291 --- lib/IR/Module.cpp 2014-12-22 05:00:36.000000000 -0800 |
|
5292 +++ lib/IR/Module.cpp 2015-11-27 09:30:00.064132788 -0800 |
|
5293 @@ -274,7 +274,7 @@ |
|
5294 /// delete it. |
|
5295 void Module::eraseNamedMetadata(NamedMDNode *NMD) { |
|
5296 static_cast<StringMap<NamedMDNode *> *>(NamedMDSymTab)->erase(NMD->getName()); |
|
5297 - NamedMDList.erase(NMD); |
|
5298 + NamedMDList.erase(NMD->getIterator()); |
|
5299 } |
|
5300 |
|
5301 bool Module::isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB) { |
|
5302 --- lib/IR/SymbolTableListTraitsImpl.h 2014-08-13 09:26:38.000000000 -0700 |
|
5303 +++ lib/IR/SymbolTableListTraitsImpl.h 2015-11-24 12:37:36.693556920 -0800 |
|
5304 @@ -57,7 +57,7 @@ |
|
5305 for (typename iplist<ValueSubClass>::iterator I = ItemList.begin(); |
|
5306 I != ItemList.end(); ++I) |
|
5307 if (I->hasName()) |
|
5308 - NewST->reinsertValue(I); |
|
5309 + NewST->reinsertValue(&(*I)); |
|
5310 } |
|
5311 |
|
5312 } |
|
5313 --- lib/IR/TypeFinder.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
5314 +++ lib/IR/TypeFinder.cpp 2015-11-27 07:40:03.669762910 -0800 |
|
5315 @@ -53,7 +53,7 @@ |
|
5316 // First incorporate the arguments. |
|
5317 for (Function::const_arg_iterator AI = FI->arg_begin(), |
|
5318 AE = FI->arg_end(); AI != AE; ++AI) |
|
5319 - incorporateValue(AI); |
|
5320 + incorporateValue(&(*AI)); |
|
5321 |
|
5322 for (Function::const_iterator BB = FI->begin(), E = FI->end(); |
|
5323 BB != E;++BB) |
|
5324 @@ -82,7 +82,7 @@ |
|
5325 |
|
5326 for (Module::const_named_metadata_iterator I = M.named_metadata_begin(), |
|
5327 E = M.named_metadata_end(); I != E; ++I) { |
|
5328 - const NamedMDNode *NMD = I; |
|
5329 + const NamedMDNode *NMD = &(*I); |
|
5330 for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) |
|
5331 incorporateMDNode(NMD->getOperand(i)); |
|
5332 } |
|
5333 --- lib/IR/Verifier.cpp 2015-01-12 19:46:47.000000000 -0800 |
|
5334 +++ lib/IR/Verifier.cpp 2015-11-27 09:27:19.724275928 -0800 |
|
5335 @@ -81,7 +81,8 @@ |
|
5336 static cl::opt<bool> VerifyDebugInfo("verify-debug-info", cl::init(false)); |
|
5337 |
|
5338 namespace { |
|
5339 -struct VerifierSupport { |
|
5340 +class VerifierSupport { |
|
5341 +public: |
|
5342 raw_ostream &OS; |
|
5343 const Module *M; |
|
5344 |
|
5345 @@ -89,11 +90,15 @@ |
|
5346 bool Broken; |
|
5347 |
|
5348 explicit VerifierSupport(raw_ostream &OS) |
|
5349 - : OS(OS), M(nullptr), Broken(false) {} |
|
5350 + : OS(OS), M(nullptr), Broken(false) { } |
|
5351 + |
|
5352 + ~VerifierSupport() { } |
|
5353 |
|
5354 - void WriteValue(const Value *V) { |
|
5355 +private: |
|
5356 + void Write(const Value *V) { |
|
5357 if (!V) |
|
5358 return; |
|
5359 + |
|
5360 if (isa<Instruction>(V)) { |
|
5361 OS << *V << '\n'; |
|
5362 } else { |
|
5363 @@ -102,81 +107,69 @@ |
|
5364 } |
|
5365 } |
|
5366 |
|
5367 - void WriteMetadata(const Metadata *MD) { |
|
5368 + void Write(const Metadata *MD) { |
|
5369 if (!MD) |
|
5370 return; |
|
5371 + |
|
5372 MD->printAsOperand(OS, true, M); |
|
5373 OS << '\n'; |
|
5374 } |
|
5375 |
|
5376 - void WriteType(Type *T) { |
|
5377 + void Write(Type *T) { |
|
5378 if (!T) |
|
5379 return; |
|
5380 + |
|
5381 OS << ' ' << *T; |
|
5382 } |
|
5383 |
|
5384 - void WriteComdat(const Comdat *C) { |
|
5385 + void Write(const Comdat *C) { |
|
5386 if (!C) |
|
5387 return; |
|
5388 + |
|
5389 OS << *C; |
|
5390 } |
|
5391 |
|
5392 - // CheckFailed - A check failed, so print out the condition and the message |
|
5393 - // that failed. This provides a nice place to put a breakpoint if you want |
|
5394 - // to see why something is not correct. |
|
5395 - void CheckFailed(const Twine &Message, const Value *V1 = nullptr, |
|
5396 - const Value *V2 = nullptr, const Value *V3 = nullptr, |
|
5397 - const Value *V4 = nullptr) { |
|
5398 - OS << Message.str() << "\n"; |
|
5399 - WriteValue(V1); |
|
5400 - WriteValue(V2); |
|
5401 - WriteValue(V3); |
|
5402 - WriteValue(V4); |
|
5403 - Broken = true; |
|
5404 - } |
|
5405 + void Write(const NamedMDNode *NMD) { |
|
5406 + if (!NMD) |
|
5407 + return; |
|
5408 |
|
5409 - void CheckFailed(const Twine &Message, const Metadata *V1, const Metadata *V2, |
|
5410 - const Metadata *V3 = nullptr, const Metadata *V4 = nullptr) { |
|
5411 - OS << Message.str() << "\n"; |
|
5412 - WriteMetadata(V1); |
|
5413 - WriteMetadata(V2); |
|
5414 - WriteMetadata(V3); |
|
5415 - WriteMetadata(V4); |
|
5416 - Broken = true; |
|
5417 + NMD->print(OS); |
|
5418 + OS << "\n"; |
|
5419 } |
|
5420 |
|
5421 - void CheckFailed(const Twine &Message, const Metadata *V1, |
|
5422 - const Value *V2 = nullptr) { |
|
5423 - OS << Message.str() << "\n"; |
|
5424 - WriteMetadata(V1); |
|
5425 - WriteValue(V2); |
|
5426 - Broken = true; |
|
5427 + template<class T> |
|
5428 + void Write(const MDTupleTypedArrayWrapper<T> &MD) { |
|
5429 + Write(MD.get()); |
|
5430 } |
|
5431 |
|
5432 - void CheckFailed(const Twine &Message, const Value *V1, Type *T2, |
|
5433 - const Value *V3 = nullptr) { |
|
5434 - OS << Message.str() << "\n"; |
|
5435 - WriteValue(V1); |
|
5436 - WriteType(T2); |
|
5437 - WriteValue(V3); |
|
5438 - Broken = true; |
|
5439 + template<class NodeTy> void Write(const ilist_iterator<NodeTy> &I) { |
|
5440 + Write(&(*I)); |
|
5441 } |
|
5442 |
|
5443 - void CheckFailed(const Twine &Message, Type *T1, Type *T2 = nullptr, |
|
5444 - Type *T3 = nullptr) { |
|
5445 - OS << Message.str() << "\n"; |
|
5446 - WriteType(T1); |
|
5447 - WriteType(T2); |
|
5448 - WriteType(T3); |
|
5449 + template <typename T1, typename... Ts> |
|
5450 + void WriteTs(const T1 &V1, const Ts &... Vs) { |
|
5451 + Write(V1); |
|
5452 + WriteTs(Vs...); |
|
5453 + } |
|
5454 + |
|
5455 + template <typename... Ts> void WriteTs() {} |
|
5456 + |
|
5457 +public: |
|
5458 + // CheckFailed - A check failed, so print out the condition and the message |
|
5459 + // that failed. This provides a nice place to put a breakpoint if you want |
|
5460 + // to see why something is not correct. |
|
5461 + void CheckFailed(const Twine &Message) { |
|
5462 + OS << Message << '\n'; |
|
5463 Broken = true; |
|
5464 } |
|
5465 |
|
5466 - void CheckFailed(const Twine &Message, const Comdat *C) { |
|
5467 - OS << Message.str() << "\n"; |
|
5468 - WriteComdat(C); |
|
5469 - Broken = true; |
|
5470 + template <typename T1, typename... Ts> |
|
5471 + void CheckFailed(const Twine &Message, const T1 &V1, const Ts &... Vs) { |
|
5472 + CheckFailed(Message); |
|
5473 + WriteTs(V1, Vs...); |
|
5474 } |
|
5475 }; |
|
5476 + |
|
5477 class Verifier : public InstVisitor<Verifier>, VerifierSupport { |
|
5478 friend class InstVisitor<Verifier>; |
|
5479 |
|
5480 @@ -204,8 +197,10 @@ |
|
5481 |
|
5482 public: |
|
5483 explicit Verifier(raw_ostream &OS = dbgs()) |
|
5484 - : VerifierSupport(OS), Context(nullptr), PersonalityFn(nullptr), |
|
5485 - SawFrameAllocate(false) {} |
|
5486 + : InstVisitor<Verifier>(), |
|
5487 + VerifierSupport(OS), Context(nullptr), DT(), |
|
5488 + InstsInThisBlock(), MDNodes(), |
|
5489 + PersonalityFn(nullptr), SawFrameAllocate(false) { } |
|
5490 |
|
5491 bool verify(const Function &F) { |
|
5492 M = F.getParent(); |
|
5493 @@ -538,8 +533,6 @@ |
|
5494 void Verifier::visitAliaseeSubExpr(SmallPtrSetImpl<const GlobalAlias*> &Visited, |
|
5495 const GlobalAlias &GA, const Constant &C) { |
|
5496 if (const auto *GV = dyn_cast<GlobalValue>(&C)) { |
|
5497 - Assert1(!GV->isDeclaration(), "Alias must point to a definition", &GA); |
|
5498 - |
|
5499 if (const auto *GA2 = dyn_cast<GlobalAlias>(GV)) { |
|
5500 Assert1(Visited.insert(GA2).second, "Aliases cannot form a cycle", &GA); |
|
5501 |
|
5502 --- lib/Linker/LinkModules.cpp 2015-02-24 18:00:21.000000000 -0800 |
|
5503 +++ lib/Linker/LinkModules.cpp 2015-12-07 12:26:23.891323205 -0800 |
|
5504 @@ -1194,7 +1194,7 @@ |
|
5505 DI->setName(Arg.getName()); // Copy the name over. |
|
5506 |
|
5507 // Add a mapping to our mapping. |
|
5508 - ValueMap[&Arg] = DI; |
|
5509 + ValueMap[&Arg] = &*DI; |
|
5510 ++DI; |
|
5511 } |
|
5512 |
|
5513 @@ -1518,7 +1518,7 @@ |
|
5514 // initializers (which could refer to functions not yet mapped over). |
|
5515 for (Module::global_iterator I = SrcM->global_begin(), |
|
5516 E = SrcM->global_end(); I != E; ++I) |
|
5517 - if (linkGlobalValueProto(I)) |
|
5518 + if (linkGlobalValueProto(&*I)) |
|
5519 return true; |
|
5520 |
|
5521 // Link the functions together between the two modules, without doing function |
|
5522 @@ -1527,13 +1527,13 @@ |
|
5523 // all of the global values that may be referenced are available in our |
|
5524 // ValueMap. |
|
5525 for (Module::iterator I = SrcM->begin(), E = SrcM->end(); I != E; ++I) |
|
5526 - if (linkGlobalValueProto(I)) |
|
5527 + if (linkGlobalValueProto(&*I)) |
|
5528 return true; |
|
5529 |
|
5530 // If there were any aliases, link them now. |
|
5531 for (Module::alias_iterator I = SrcM->alias_begin(), |
|
5532 E = SrcM->alias_end(); I != E; ++I) |
|
5533 - if (linkGlobalValueProto(I)) |
|
5534 + if (linkGlobalValueProto(&*I)) |
|
5535 return true; |
|
5536 |
|
5537 for (unsigned i = 0, e = AppendingVars.size(); i != e; ++i) |
|
5538 --- lib/MC/MCAssembler.cpp 2015-01-16 16:38:54.000000000 -0800 |
|
5539 +++ lib/MC/MCAssembler.cpp 2015-12-07 12:37:47.486088108 -0800 |
|
5540 @@ -315,11 +315,13 @@ |
|
5541 if (ExactMatch) |
|
5542 ++MI; |
|
5543 } |
|
5544 + |
|
5545 iterator IP; |
|
5546 if (MI == SubsectionFragmentMap.end()) |
|
5547 IP = end(); |
|
5548 else |
|
5549 - IP = MI->second; |
|
5550 + IP = MI->second->getIterator(); |
|
5551 + |
|
5552 if (!ExactMatch && Subsection != 0) { |
|
5553 // The GNU as documentation claims that subsections have an alignment of 4, |
|
5554 // although this appears not to be the case. |
|
5555 @@ -892,7 +894,7 @@ |
|
5556 // Create dummy fragments to eliminate any empty sections, this simplifies |
|
5557 // layout. |
|
5558 if (it->getFragmentList().empty()) |
|
5559 - new MCDataFragment(it); |
|
5560 + new MCDataFragment(&*it); |
|
5561 |
|
5562 it->setOrdinal(SectionIndex++); |
|
5563 } |
|
5564 @@ -1091,7 +1093,7 @@ |
|
5565 break; |
|
5566 } |
|
5567 if (RelaxedFrag && !FirstRelaxedFragment) |
|
5568 - FirstRelaxedFragment = I; |
|
5569 + FirstRelaxedFragment = &*I; |
|
5570 } |
|
5571 if (FirstRelaxedFragment) { |
|
5572 Layout.invalidateFragmentsFrom(FirstRelaxedFragment); |
|
5573 --- lib/MC/MCMachOStreamer.cpp 2014-09-17 02:25:36.000000000 -0700 |
|
5574 +++ lib/MC/MCMachOStreamer.cpp 2015-12-07 12:41:51.654959723 -0800 |
|
5575 @@ -444,7 +444,7 @@ |
|
5576 MCSymbolData *CurrentAtom = nullptr; |
|
5577 for (MCSectionData::iterator it2 = it->begin(), |
|
5578 ie2 = it->end(); it2 != ie2; ++it2) { |
|
5579 - if (MCSymbolData *SD = DefiningSymbolMap.lookup(it2)) |
|
5580 + if (MCSymbolData *SD = DefiningSymbolMap.lookup(&*it2)) |
|
5581 CurrentAtom = SD; |
|
5582 it2->setAtom(CurrentAtom); |
|
5583 } |
|
5584 --- lib/MC/MCObjectStreamer.cpp 2014-12-12 13:48:03.000000000 -0800 |
|
5585 +++ lib/MC/MCObjectStreamer.cpp 2015-12-07 12:52:20.758780735 -0800 |
|
5586 @@ -83,7 +83,7 @@ |
|
5587 assert(getCurrentSectionData() && "No current section!"); |
|
5588 |
|
5589 if (CurInsertionPoint != getCurrentSectionData()->getFragmentList().begin()) |
|
5590 - return std::prev(CurInsertionPoint); |
|
5591 + return &*std::prev(CurInsertionPoint); |
|
5592 |
|
5593 return nullptr; |
|
5594 } |
|
5595 --- lib/MC/MachObjectWriter.cpp 2015-01-16 16:38:54.000000000 -0800 |
|
5596 +++ lib/MC/MachObjectWriter.cpp 2015-12-07 13:28:29.179917460 -0800 |
|
5597 @@ -839,9 +839,9 @@ |
|
5598 uint64_t RelocTableEnd = SectionDataStart + SectionDataFileSize; |
|
5599 for (MCAssembler::const_iterator it = Asm.begin(), |
|
5600 ie = Asm.end(); it != ie; ++it) { |
|
5601 - std::vector<MachO::any_relocation_info> &Relocs = Relocations[it]; |
|
5602 + std::vector<MachO::any_relocation_info> &Relocs = Relocations[&*it]; |
|
5603 unsigned NumRelocs = Relocs.size(); |
|
5604 - uint64_t SectionStart = SectionDataStart + getSectionAddress(it); |
|
5605 + uint64_t SectionStart = SectionDataStart + getSectionAddress(&*it); |
|
5606 WriteSection(Asm, Layout, *it, SectionStart, RelocTableEnd, NumRelocs); |
|
5607 RelocTableEnd += NumRelocs * sizeof(MachO::any_relocation_info); |
|
5608 } |
|
5609 @@ -918,9 +918,9 @@ |
|
5610 // Write the actual section data. |
|
5611 for (MCAssembler::const_iterator it = Asm.begin(), |
|
5612 ie = Asm.end(); it != ie; ++it) { |
|
5613 - Asm.writeSectionData(it, Layout); |
|
5614 + Asm.writeSectionData(&*it, Layout); |
|
5615 |
|
5616 - uint64_t Pad = getPaddingSize(it, Layout); |
|
5617 + uint64_t Pad = getPaddingSize(&*it, Layout); |
|
5618 for (unsigned int i = 0; i < Pad; ++i) |
|
5619 Write8(0); |
|
5620 } |
|
5621 @@ -933,7 +933,7 @@ |
|
5622 ie = Asm.end(); it != ie; ++it) { |
|
5623 // Write the section relocation entries, in reverse order to match 'as' |
|
5624 // (approximately, the exact algorithm is more complicated than this). |
|
5625 - std::vector<MachO::any_relocation_info> &Relocs = Relocations[it]; |
|
5626 + std::vector<MachO::any_relocation_info> &Relocs = Relocations[&*it]; |
|
5627 for (unsigned i = 0, e = Relocs.size(); i != e; ++i) { |
|
5628 Write32(Relocs[e - i - 1].r_word0); |
|
5629 Write32(Relocs[e - i - 1].r_word1); |
|
5630 --- lib/MC/WinCOFFObjectWriter.cpp 2015-02-09 19:52:36.000000000 -0800 |
|
5631 +++ lib/MC/WinCOFFObjectWriter.cpp 2015-12-07 14:55:13.070245970 -0800 |
|
5632 @@ -1015,7 +1015,7 @@ |
|
5633 assert(OS.tell() == (*i)->Header.PointerToRawData && |
|
5634 "Section::PointerToRawData is insane!"); |
|
5635 |
|
5636 - Asm.writeSectionData(j, Layout); |
|
5637 + Asm.writeSectionData(&*j, Layout); |
|
5638 } |
|
5639 |
|
5640 if ((*i)->Relocations.size() > 0) { |
|
5641 --- lib/Support/YAMLParser.cpp 2014-08-30 09:48:02.000000000 -0700 |
|
5642 +++ lib/Support/YAMLParser.cpp 2015-11-27 18:09:35.106421600 -0800 |
|
5643 @@ -393,9 +393,10 @@ |
|
5644 bool isBlankOrBreak(StringRef::iterator Position); |
|
5645 |
|
5646 /// @brief If IsSimpleKeyAllowed, create and push_back a new SimpleKey. |
|
5647 - void saveSimpleKeyCandidate( TokenQueueT::iterator Tok |
|
5648 - , unsigned AtColumn |
|
5649 - , bool IsRequired); |
|
5650 + /// Please cut the comma placement bullshit. Thank you. |
|
5651 + void saveSimpleKeyCandidate(TokenQueueT::iterator Tok, |
|
5652 + unsigned AtColumn, |
|
5653 + bool IsRequired); |
|
5654 |
|
5655 /// @brief Remove simple keys that can no longer be valid simple keys. |
|
5656 /// |
|
5657 @@ -742,7 +743,7 @@ |
|
5658 |
|
5659 removeStaleSimpleKeyCandidates(); |
|
5660 SimpleKey SK; |
|
5661 - SK.Tok = TokenQueue.front(); |
|
5662 + SK.Tok = TokenQueue.begin(); |
|
5663 if (std::find(SimpleKeys.begin(), SimpleKeys.end(), SK) |
|
5664 == SimpleKeys.end()) |
|
5665 break; |
|
5666 @@ -896,9 +897,9 @@ |
|
5667 return false; |
|
5668 } |
|
5669 |
|
5670 -void Scanner::saveSimpleKeyCandidate( TokenQueueT::iterator Tok |
|
5671 - , unsigned AtColumn |
|
5672 - , bool IsRequired) { |
|
5673 +void Scanner::saveSimpleKeyCandidate(TokenQueueT::iterator Tok, |
|
5674 + unsigned AtColumn, |
|
5675 + bool IsRequired) { |
|
5676 if (IsSimpleKeyAllowed) { |
|
5677 SimpleKey SK; |
|
5678 SK.Tok = Tok; |
|
5679 @@ -1078,7 +1079,7 @@ |
|
5680 TokenQueue.push_back(T); |
|
5681 |
|
5682 // [ and { may begin a simple key. |
|
5683 - saveSimpleKeyCandidate(TokenQueue.back(), Column - 1, false); |
|
5684 + saveSimpleKeyCandidate(--TokenQueue.end(), Column - 1, false); |
|
5685 |
|
5686 // And may also be followed by a simple key. |
|
5687 IsSimpleKeyAllowed = true; |
|
5688 @@ -1241,7 +1242,7 @@ |
|
5689 T.Range = StringRef(Start, Current - Start); |
|
5690 TokenQueue.push_back(T); |
|
5691 |
|
5692 - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); |
|
5693 + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); |
|
5694 |
|
5695 IsSimpleKeyAllowed = false; |
|
5696 |
|
5697 @@ -1319,7 +1320,7 @@ |
|
5698 TokenQueue.push_back(T); |
|
5699 |
|
5700 // Plain scalars can be simple keys. |
|
5701 - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); |
|
5702 + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); |
|
5703 |
|
5704 IsSimpleKeyAllowed = false; |
|
5705 |
|
5706 @@ -1354,7 +1355,7 @@ |
|
5707 TokenQueue.push_back(T); |
|
5708 |
|
5709 // Alias and anchors can be simple keys. |
|
5710 - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); |
|
5711 + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); |
|
5712 |
|
5713 IsSimpleKeyAllowed = false; |
|
5714 |
|
5715 @@ -1418,7 +1419,7 @@ |
|
5716 TokenQueue.push_back(T); |
|
5717 |
|
5718 // Tags can be simple keys. |
|
5719 - saveSimpleKeyCandidate(TokenQueue.back(), ColStart, false); |
|
5720 + saveSimpleKeyCandidate(--TokenQueue.end(), ColStart, false); |
|
5721 |
|
5722 IsSimpleKeyAllowed = false; |
|
5723 |
|
5724 --- lib/Target/Sparc/SparcAsmPrinter.cpp 2014-08-04 14:25:23.000000000 -0700 |
|
5725 +++ lib/Target/Sparc/SparcAsmPrinter.cpp 2015-12-07 11:54:08.441400090 -0800 |
|
5726 @@ -267,11 +267,11 @@ |
|
5727 LowerGETPCXAndEmitMCInsts(MI, getSubtargetInfo()); |
|
5728 return; |
|
5729 } |
|
5730 - MachineBasicBlock::const_instr_iterator I = MI; |
|
5731 + MachineBasicBlock::const_instr_iterator I = MI->getIterator(); |
|
5732 MachineBasicBlock::const_instr_iterator E = MI->getParent()->instr_end(); |
|
5733 do { |
|
5734 MCInst TmpInst; |
|
5735 - LowerSparcMachineInstrToMCInst(I, TmpInst, *this); |
|
5736 + LowerSparcMachineInstrToMCInst(&*I, TmpInst, *this); |
|
5737 EmitToStreamer(OutStreamer, TmpInst); |
|
5738 } while ((++I != E) && I->isInsideBundle()); // Delay slot check. |
|
5739 } |
|
5740 --- lib/Target/Sparc/SparcISelLowering.cpp 2015-01-07 16:51:32.000000000 -0800 |
|
5741 +++ lib/Target/Sparc/SparcISelLowering.cpp 2015-12-07 11:59:14.697760005 -0800 |
|
5742 @@ -2916,8 +2916,7 @@ |
|
5743 // to set, the condition code register to branch on, the true/false values to |
|
5744 // select between, and a branch opcode to use. |
|
5745 const BasicBlock *LLVM_BB = BB->getBasicBlock(); |
|
5746 - MachineFunction::iterator It = BB; |
|
5747 - ++It; |
|
5748 + MachineFunction::iterator It = ++BB->getIterator(); |
|
5749 |
|
5750 // thisMBB: |
|
5751 // ... |
|
5752 @@ -3003,7 +3002,7 @@ |
|
5753 .addReg(AddrReg).addImm(0); |
|
5754 |
|
5755 // Split the basic block MBB before MI and insert the loop block in the hole. |
|
5756 - MachineFunction::iterator MFI = MBB; |
|
5757 + MachineFunction::iterator MFI = MBB->getIterator(); |
|
5758 const BasicBlock *LLVM_BB = MBB->getBasicBlock(); |
|
5759 MachineFunction *MF = MBB->getParent(); |
|
5760 MachineBasicBlock *LoopMBB = MF->CreateMachineBasicBlock(LLVM_BB); |
|
5761 --- lib/Target/Sparc/SparcTargetObjectFile.cpp 2014-04-24 22:30:21.000000000 -0700 |
|
5762 +++ lib/Target/Sparc/SparcTargetObjectFile.cpp 2015-12-15 12:44:57.569902985 -0800 |
|
5763 @@ -15,6 +15,17 @@ |
|
5764 |
|
5765 using namespace llvm; |
|
5766 |
|
5767 +void SparcELFTargetObjectFile::Initialize(MCContext &CTX, |
|
5768 + const TargetMachine &TM) { |
|
5769 + TargetLoweringObjectFile::Initialize(CTX, TM); |
|
5770 + std::string OS = TM.getTargetTriple().str(); |
|
5771 + |
|
5772 + if (OS.find("solaris") != std::string::npos) |
|
5773 + InitializeELF(true); |
|
5774 + else |
|
5775 + InitializeELF(TM.Options.UseInitArray); |
|
5776 +} |
|
5777 + |
|
5778 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference( |
|
5779 const GlobalValue *GV, unsigned Encoding, Mangler &Mang, |
|
5780 const TargetMachine &TM, MachineModuleInfo *MMI, |
|
5781 --- lib/Target/Sparc/SparcTargetObjectFile.h 2014-08-13 09:26:38.000000000 -0700 |
|
5782 +++ lib/Target/Sparc/SparcTargetObjectFile.h 2015-12-15 12:37:54.653197100 -0800 |
|
5783 @@ -19,11 +19,11 @@ |
|
5784 |
|
5785 class SparcELFTargetObjectFile : public TargetLoweringObjectFileELF { |
|
5786 public: |
|
5787 - SparcELFTargetObjectFile() : |
|
5788 - TargetLoweringObjectFileELF() |
|
5789 - {} |
|
5790 + SparcELFTargetObjectFile() : TargetLoweringObjectFileELF() { } |
|
5791 |
|
5792 - const MCExpr * |
|
5793 + virtual void Initialize(MCContext &CTX, const TargetMachine &TM) override; |
|
5794 + |
|
5795 + const MCExpr* |
|
5796 getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding, |
|
5797 Mangler &Mang, const TargetMachine &TM, |
|
5798 MachineModuleInfo *MMI, |
|
5799 --- lib/Target/X86/X86FastISel.cpp 2015-01-05 23:35:50.000000000 -0800 |
|
5800 +++ lib/Target/X86/X86FastISel.cpp 2016-01-23 08:58:44.000000000 -0800 |
|
5801 @@ -275,8 +275,8 @@ |
|
5802 return false; |
|
5803 |
|
5804 // Make sure nothing is in the way |
|
5805 - BasicBlock::const_iterator Start = I; |
|
5806 - BasicBlock::const_iterator End = II; |
|
5807 + BasicBlock::const_iterator Start(I); |
|
5808 + BasicBlock::const_iterator End(II); |
|
5809 for (auto Itr = std::prev(Start); Itr != End; --Itr) { |
|
5810 // We only expect extractvalue instructions between the intrinsic and the |
|
5811 // instruction to be selected. |
|
5812 --- lib/Target/X86/X86FixupLEAs.cpp 2015-01-05 02:15:49.000000000 -0800 |
|
5813 +++ lib/Target/X86/X86FixupLEAs.cpp 2016-01-23 08:57:43.000000000 -0800 |
|
5814 @@ -190,7 +190,7 @@ |
|
5815 static inline bool getPreviousInstr(MachineBasicBlock::iterator &I, |
|
5816 MachineFunction::iterator MFI) { |
|
5817 if (I == MFI->begin()) { |
|
5818 - if (MFI->isPredecessor(MFI)) { |
|
5819 + if (MFI->isPredecessor(&*MFI)) { |
|
5820 I = --MFI->end(); |
|
5821 return true; |
|
5822 } else |
|
5823 --- lib/Target/X86/X86FloatingPoint.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
5824 +++ lib/Target/X86/X86FloatingPoint.cpp 2016-01-23 09:03:48.000000000 -0800 |
|
5825 @@ -321,7 +321,7 @@ |
|
5826 // Process the function in depth first order so that we process at least one |
|
5827 // of the predecessors for every reachable block in the function. |
|
5828 SmallPtrSet<MachineBasicBlock*, 8> Processed; |
|
5829 - MachineBasicBlock *Entry = MF.begin(); |
|
5830 + MachineBasicBlock *Entry = &MF.front(); |
|
5831 |
|
5832 bool Changed = false; |
|
5833 for (MachineBasicBlock *BB : depth_first_ext(Entry, Processed)) |
|
5834 @@ -329,9 +329,9 @@ |
|
5835 |
|
5836 // Process any unreachable blocks in arbitrary order now. |
|
5837 if (MF.size() != Processed.size()) |
|
5838 - for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); BB != E; ++BB) |
|
5839 - if (Processed.insert(BB).second) |
|
5840 - Changed |= processBasicBlock(MF, *BB); |
|
5841 + for (MachineBasicBlock &BB : MF) |
|
5842 + if (Processed.insert(&BB).second) |
|
5843 + Changed |= processBasicBlock(MF, BB); |
|
5844 |
|
5845 LiveBundles.clear(); |
|
5846 |
|
5847 @@ -348,13 +348,12 @@ |
|
5848 LiveBundles.resize(Bundles->getNumBundles()); |
|
5849 |
|
5850 // Gather the actual live-in masks for all MBBs. |
|
5851 - for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { |
|
5852 - MachineBasicBlock *MBB = I; |
|
5853 - const unsigned Mask = calcLiveInMask(MBB); |
|
5854 + for (MachineBasicBlock &MBB : MF) { |
|
5855 + const unsigned Mask = calcLiveInMask(&MBB); |
|
5856 if (!Mask) |
|
5857 continue; |
|
5858 // Update MBB ingoing bundle mask. |
|
5859 - LiveBundles[Bundles->getBundle(MBB->getNumber(), false)].Mask |= Mask; |
|
5860 + LiveBundles[Bundles->getBundle(MBB.getNumber(), false)].Mask |= Mask; |
|
5861 } |
|
5862 } |
|
5863 |
|
5864 --- lib/Target/X86/X86ISelDAGToDAG.cpp 2015-01-05 20:23:53.000000000 -0800 |
|
5865 +++ lib/Target/X86/X86ISelDAGToDAG.cpp 2016-01-23 09:08:15.000000000 -0800 |
|
5866 @@ -458,7 +458,8 @@ |
|
5867 |
|
5868 for (SelectionDAG::allnodes_iterator I = CurDAG->allnodes_begin(), |
|
5869 E = CurDAG->allnodes_end(); I != E; ) { |
|
5870 - SDNode *N = I++; // Preincrement iterator to avoid invalidation issues. |
|
5871 + SDNode *N = &*I; // Preincrement iterator to avoid invalidation issues. |
|
5872 + ++I; |
|
5873 |
|
5874 if (OptLevel != CodeGenOpt::None && |
|
5875 // Only does this when target favors doesn't favor register indirect |
|
5876 @@ -586,7 +587,7 @@ |
|
5877 // If this is main, emit special code for main. |
|
5878 if (const Function *Fn = MF->getFunction()) |
|
5879 if (Fn->hasExternalLinkage() && Fn->getName() == "main") |
|
5880 - EmitSpecialCodeForMain(MF->begin(), MF->getFrameInfo()); |
|
5881 + EmitSpecialCodeForMain(&MF->front(), MF->getFrameInfo()); |
|
5882 } |
|
5883 |
|
5884 static bool isDispSafeForFrameIndex(int64_t Val) { |
|
5885 @@ -778,7 +779,7 @@ |
|
5886 static void InsertDAGNode(SelectionDAG &DAG, SDValue Pos, SDValue N) { |
|
5887 if (N.getNode()->getNodeId() == -1 || |
|
5888 N.getNode()->getNodeId() > Pos.getNode()->getNodeId()) { |
|
5889 - DAG.RepositionNode(Pos.getNode(), N.getNode()); |
|
5890 + DAG.RepositionNode(Pos.getNode()->getIterator(), N.getNode()); |
|
5891 N.getNode()->setNodeId(Pos.getNode()->getNodeId()); |
|
5892 } |
|
5893 } |
|
5894 --- lib/Target/X86/X86ISelLowering.cpp 2015-05-01 21:17:29.000000000 -0700 |
|
5895 +++ lib/Target/X86/X86ISelLowering.cpp 2016-01-23 10:03:26.000000000 -0800 |
|
5896 @@ -20363,8 +20363,7 @@ |
|
5897 DebugLoc DL = MI->getDebugLoc(); |
|
5898 |
|
5899 const BasicBlock *BB = MBB->getBasicBlock(); |
|
5900 - MachineFunction::iterator I = MBB; |
|
5901 - ++I; |
|
5902 + MachineFunction::iterator I = ++MBB->getIterator(); |
|
5903 |
|
5904 // For the v = xbegin(), we generate |
|
5905 // |
|
5906 @@ -20613,7 +20612,7 @@ |
|
5907 offsetMBB = MF->CreateMachineBasicBlock(LLVM_BB); |
|
5908 endMBB = MF->CreateMachineBasicBlock(LLVM_BB); |
|
5909 |
|
5910 - MachineFunction::iterator MBBIter = MBB; |
|
5911 + MachineFunction::iterator MBBIter = ++MBB->getIterator(); |
|
5912 ++MBBIter; |
|
5913 |
|
5914 // Insert the new basic blocks |
|
5915 @@ -20784,8 +20783,7 @@ |
|
5916 // stores were performed. |
|
5917 const BasicBlock *LLVM_BB = MBB->getBasicBlock(); |
|
5918 MachineFunction *F = MBB->getParent(); |
|
5919 - MachineFunction::iterator MBBIter = MBB; |
|
5920 - ++MBBIter; |
|
5921 + MachineFunction::iterator MBBIter = ++MBB->getIterator(); |
|
5922 MachineBasicBlock *XMMSaveMBB = F->CreateMachineBasicBlock(LLVM_BB); |
|
5923 MachineBasicBlock *EndMBB = F->CreateMachineBasicBlock(LLVM_BB); |
|
5924 F->insert(MBBIter, XMMSaveMBB); |
|
5925 @@ -20893,8 +20891,7 @@ |
|
5926 // destination vreg to set, the condition code register to branch on, the |
|
5927 // true/false values to select between, and a branch opcode to use. |
|
5928 const BasicBlock *LLVM_BB = BB->getBasicBlock(); |
|
5929 - MachineFunction::iterator It = BB; |
|
5930 - ++It; |
|
5931 + MachineFunction::iterator It = ++BB->getIterator(); |
|
5932 |
|
5933 // thisMBB: |
|
5934 // ... |
|
5935 @@ -20997,8 +20994,7 @@ |
|
5936 sizeVReg = MI->getOperand(1).getReg(), |
|
5937 physSPReg = IsLP64 || Subtarget->isTargetNaCl64() ? X86::RSP : X86::ESP; |
|
5938 |
|
5939 - MachineFunction::iterator MBBIter = BB; |
|
5940 - ++MBBIter; |
|
5941 + MachineFunction::iterator MBBIter = ++BB->getIterator(); |
|
5942 |
|
5943 MF->insert(MBBIter, bumpMBB); |
|
5944 MF->insert(MBBIter, mallocMBB); |
|
5945 @@ -21168,8 +21164,7 @@ |
|
5946 MachineRegisterInfo &MRI = MF->getRegInfo(); |
|
5947 |
|
5948 const BasicBlock *BB = MBB->getBasicBlock(); |
|
5949 - MachineFunction::iterator I = MBB; |
|
5950 - ++I; |
|
5951 + MachineFunction::iterator I = ++MBB->getIterator(); |
|
5952 |
|
5953 // Memory Reference |
|
5954 MachineInstr::mmo_iterator MMOBegin = MI->memoperands_begin(); |
|
5955 --- lib/Target/X86/X86PadShortFunction.cpp 2014-08-04 14:25:23.000000000 -0700 |
|
5956 +++ lib/Target/X86/X86PadShortFunction.cpp 2016-01-23 10:05:38.000000000 -0800 |
|
5957 @@ -110,7 +110,7 @@ |
|
5958 // Search through basic blocks and mark the ones that have early returns |
|
5959 ReturnBBs.clear(); |
|
5960 VisitedBBs.clear(); |
|
5961 - findReturns(MF.begin()); |
|
5962 + findReturns(&MF.front()); |
|
5963 |
|
5964 bool MadeChange = false; |
|
5965 |
|
5966 --- lib/Transforms/IPO/ArgumentPromotion.cpp 2014-12-15 06:09:53.000000000 -0800 |
|
5967 +++ lib/Transforms/IPO/ArgumentPromotion.cpp 2015-11-29 18:37:06.014532943 -0800 |
|
5968 @@ -214,7 +214,8 @@ |
|
5969 SmallVector<Argument*, 16> PointerArgs; |
|
5970 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) |
|
5971 if (I->getType()->isPointerTy()) |
|
5972 - PointerArgs.push_back(I); |
|
5973 + PointerArgs.push_back(&*I); |
|
5974 + |
|
5975 if (PointerArgs.empty()) return nullptr; |
|
5976 |
|
5977 // Second check: make sure that all callers are direct callers. We can't |
|
5978 @@ -435,7 +436,8 @@ |
|
5979 |
|
5980 // First, iterate the entry block and mark loads of (geps of) arguments as |
|
5981 // safe. |
|
5982 - BasicBlock *EntryBlock = Arg->getParent()->begin(); |
|
5983 + BasicBlock *EntryBlock = &Arg->getParent()->front(); |
|
5984 + |
|
5985 // Declare this here so we can reuse it |
|
5986 IndicesVector Indices; |
|
5987 for (BasicBlock::iterator I = EntryBlock->begin(), E = EntryBlock->end(); |
|
5988 @@ -620,14 +622,14 @@ |
|
5989 unsigned ArgIndex = 1; |
|
5990 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; |
|
5991 ++I, ++ArgIndex) { |
|
5992 - if (ByValArgsToTransform.count(I)) { |
|
5993 + if (ByValArgsToTransform.count(&*I)) { |
|
5994 // Simple byval argument? Just add all the struct element types. |
|
5995 Type *AgTy = cast<PointerType>(I->getType())->getElementType(); |
|
5996 StructType *STy = cast<StructType>(AgTy); |
|
5997 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) |
|
5998 Params.push_back(STy->getElementType(i)); |
|
5999 ++NumByValArgsPromoted; |
|
6000 - } else if (!ArgsToPromote.count(I)) { |
|
6001 + } else if (!ArgsToPromote.count(&*I)) { |
|
6002 // Unchanged argument |
|
6003 Params.push_back(I->getType()); |
|
6004 AttributeSet attrs = PAL.getParamAttributes(ArgIndex); |
|
6005 @@ -645,7 +647,7 @@ |
|
6006 |
|
6007 // In this table, we will track which indices are loaded from the argument |
|
6008 // (where direct loads are tracked as no indices). |
|
6009 - ScalarizeTable &ArgIndices = ScalarizedElements[I]; |
|
6010 + ScalarizeTable &ArgIndices = ScalarizedElements[&*I]; |
|
6011 for (User *U : I->users()) { |
|
6012 Instruction *UI = cast<Instruction>(U); |
|
6013 assert(isa<LoadInst>(UI) || isa<GetElementPtrInst>(UI)); |
|
6014 @@ -667,7 +669,7 @@ |
|
6015 else |
|
6016 // Take any load, we will use it only to update Alias Analysis |
|
6017 OrigLoad = cast<LoadInst>(UI->user_back()); |
|
6018 - OriginalLoads[std::make_pair(I, Indices)] = OrigLoad; |
|
6019 + OriginalLoads[std::make_pair(&*I, Indices)] = OrigLoad; |
|
6020 } |
|
6021 |
|
6022 // Add a parameter to the function for each element passed in. |
|
6023 @@ -712,19 +714,15 @@ |
|
6024 |
|
6025 DEBUG(dbgs() << "ARG PROMOTION: Promoting to:" << *NF << "\n" |
|
6026 << "From: " << *F); |
|
6027 - |
|
6028 + |
|
6029 // Recompute the parameter attributes list based on the new arguments for |
|
6030 // the function. |
|
6031 NF->setAttributes(AttributeSet::get(F->getContext(), AttributesVec)); |
|
6032 AttributesVec.clear(); |
|
6033 |
|
6034 - F->getParent()->getFunctionList().insert(F, NF); |
|
6035 + F->getParent()->getFunctionList().insert(F->getIterator(), NF); |
|
6036 NF->takeName(F); |
|
6037 |
|
6038 - // Get the alias analysis information that we need to update to reflect our |
|
6039 - // changes. |
|
6040 - AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); |
|
6041 - |
|
6042 // Get the callgraph information that we need to update to reflect our |
|
6043 // changes. |
|
6044 CallGraph &CG = getAnalysis<CallGraphWrapperPass>().getCallGraph(); |
|
6045 @@ -753,7 +751,7 @@ |
|
6046 ArgIndex = 1; |
|
6047 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); |
|
6048 I != E; ++I, ++AI, ++ArgIndex) |
|
6049 - if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) { |
|
6050 + if (!ArgsToPromote.count(&*I) && !ByValArgsToTransform.count(&*I)) { |
|
6051 Args.push_back(*AI); // Unmodified argument |
|
6052 |
|
6053 if (CallPAL.hasAttributes(ArgIndex)) { |
|
6054 @@ -761,7 +759,7 @@ |
|
6055 AttributesVec. |
|
6056 push_back(AttributeSet::get(F->getContext(), Args.size(), B)); |
|
6057 } |
|
6058 - } else if (ByValArgsToTransform.count(I)) { |
|
6059 + } else if (ByValArgsToTransform.count(&*I)) { |
|
6060 // Emit a GEP and load for each element of the struct. |
|
6061 Type *AgTy = cast<PointerType>(I->getType())->getElementType(); |
|
6062 StructType *STy = cast<StructType>(AgTy); |
|
6063 @@ -777,14 +775,14 @@ |
|
6064 } |
|
6065 } else if (!I->use_empty()) { |
|
6066 // Non-dead argument: insert GEPs and loads as appropriate. |
|
6067 - ScalarizeTable &ArgIndices = ScalarizedElements[I]; |
|
6068 + ScalarizeTable &ArgIndices = ScalarizedElements[&*I]; |
|
6069 // Store the Value* version of the indices in here, but declare it now |
|
6070 // for reuse. |
|
6071 std::vector<Value*> Ops; |
|
6072 for (ScalarizeTable::iterator SI = ArgIndices.begin(), |
|
6073 E = ArgIndices.end(); SI != E; ++SI) { |
|
6074 Value *V = *AI; |
|
6075 - LoadInst *OrigLoad = OriginalLoads[std::make_pair(I, *SI)]; |
|
6076 + LoadInst *OrigLoad = OriginalLoads[std::make_pair(&*I, *SI)]; |
|
6077 if (!SI->empty()) { |
|
6078 Ops.reserve(SI->size()); |
|
6079 Type *ElTy = V->getType(); |
|
6080 @@ -793,7 +791,7 @@ |
|
6081 // Use i32 to index structs, and i64 for others (pointers/arrays). |
|
6082 // This satisfies GEP constraints. |
|
6083 Type *IdxTy = (ElTy->isStructTy() ? |
|
6084 - Type::getInt32Ty(F->getContext()) : |
|
6085 + Type::getInt32Ty(F->getContext()) : |
|
6086 Type::getInt64Ty(F->getContext())); |
|
6087 Ops.push_back(ConstantInt::get(IdxTy, *II)); |
|
6088 // Keep track of the type we're currently indexing. |
|
6089 @@ -802,8 +800,8 @@ |
|
6090 // And create a GEP to extract those indices. |
|
6091 V = GetElementPtrInst::Create(V, Ops, V->getName()+".idx", Call); |
|
6092 Ops.clear(); |
|
6093 - AA.copyValue(OrigLoad->getOperand(0), V); |
|
6094 } |
|
6095 + |
|
6096 // Since we're replacing a load make sure we take the alignment |
|
6097 // of the previous load. |
|
6098 LoadInst *newLoad = new LoadInst(V, V->getName()+".val", Call); |
|
6099 @@ -814,7 +812,6 @@ |
|
6100 newLoad->setAAMetadata(AAInfo); |
|
6101 |
|
6102 Args.push_back(newLoad); |
|
6103 - AA.copyValue(OrigLoad, Args.back()); |
|
6104 } |
|
6105 } |
|
6106 |
|
6107 @@ -852,10 +849,6 @@ |
|
6108 Args.clear(); |
|
6109 AttributesVec.clear(); |
|
6110 |
|
6111 - // Update the alias analysis implementation to know that we are replacing |
|
6112 - // the old call with a new one. |
|
6113 - AA.replaceWithNewValue(Call, New); |
|
6114 - |
|
6115 // Update the callgraph to know that the callsite has been transformed. |
|
6116 CallGraphNode *CalleeNode = CG[Call->getParent()->getParent()]; |
|
6117 CalleeNode->replaceCallEdge(Call, New, NF_CGN); |
|
6118 @@ -877,23 +870,21 @@ |
|
6119 |
|
6120 // Loop over the argument list, transferring uses of the old arguments over to |
|
6121 // the new arguments, also transferring over the names as well. |
|
6122 - // |
|
6123 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), |
|
6124 I2 = NF->arg_begin(); I != E; ++I) { |
|
6125 - if (!ArgsToPromote.count(I) && !ByValArgsToTransform.count(I)) { |
|
6126 + if (!ArgsToPromote.count(&*I) && !ByValArgsToTransform.count(&*I)) { |
|
6127 // If this is an unmodified argument, move the name and users over to the |
|
6128 // new version. |
|
6129 - I->replaceAllUsesWith(I2); |
|
6130 - I2->takeName(I); |
|
6131 - AA.replaceWithNewValue(I, I2); |
|
6132 + I->replaceAllUsesWith(&*I2); |
|
6133 + I2->takeName(&*I); |
|
6134 ++I2; |
|
6135 continue; |
|
6136 } |
|
6137 |
|
6138 - if (ByValArgsToTransform.count(I)) { |
|
6139 + if (ByValArgsToTransform.count(&*I)) { |
|
6140 // In the callee, we create an alloca, and store each of the new incoming |
|
6141 // arguments into the alloca. |
|
6142 - Instruction *InsertPt = NF->begin()->begin(); |
|
6143 + Instruction *InsertPt = &NF->begin()->front(); |
|
6144 |
|
6145 // Just add all the struct element types. |
|
6146 Type *AgTy = cast<PointerType>(I->getType())->getElementType(); |
|
6147 @@ -904,18 +895,17 @@ |
|
6148 |
|
6149 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { |
|
6150 Idxs[1] = ConstantInt::get(Type::getInt32Ty(F->getContext()), i); |
|
6151 - Value *Idx = |
|
6152 + Value *Idx = |
|
6153 GetElementPtrInst::Create(TheAlloca, Idxs, |
|
6154 - TheAlloca->getName()+"."+Twine(i), |
|
6155 + TheAlloca->getName() + "." + Twine(i), |
|
6156 InsertPt); |
|
6157 - I2->setName(I->getName()+"."+Twine(i)); |
|
6158 - new StoreInst(I2++, Idx, InsertPt); |
|
6159 + I2->setName(I->getName() + "." +Twine(i)); |
|
6160 + new StoreInst(&*I2++, Idx, InsertPt); |
|
6161 } |
|
6162 |
|
6163 // Anything that used the arg should now use the alloca. |
|
6164 I->replaceAllUsesWith(TheAlloca); |
|
6165 - TheAlloca->takeName(I); |
|
6166 - AA.replaceWithNewValue(I, TheAlloca); |
|
6167 + TheAlloca->takeName(&*I); |
|
6168 |
|
6169 // If the alloca is used in a call, we must clear the tail flag since |
|
6170 // the callee now uses an alloca from the caller. |
|
6171 @@ -928,23 +918,20 @@ |
|
6172 continue; |
|
6173 } |
|
6174 |
|
6175 - if (I->use_empty()) { |
|
6176 - AA.deleteValue(I); |
|
6177 + if (I->use_empty()) |
|
6178 continue; |
|
6179 - } |
|
6180 |
|
6181 // Otherwise, if we promoted this argument, then all users are load |
|
6182 // instructions (or GEPs with only load users), and all loads should be |
|
6183 // using the new argument that we added. |
|
6184 - ScalarizeTable &ArgIndices = ScalarizedElements[I]; |
|
6185 + ScalarizeTable &ArgIndices = ScalarizedElements[&*I]; |
|
6186 |
|
6187 while (!I->use_empty()) { |
|
6188 if (LoadInst *LI = dyn_cast<LoadInst>(I->user_back())) { |
|
6189 assert(ArgIndices.begin()->empty() && |
|
6190 "Load element should sort to front!"); |
|
6191 I2->setName(I->getName()+".val"); |
|
6192 - LI->replaceAllUsesWith(I2); |
|
6193 - AA.replaceWithNewValue(LI, I2); |
|
6194 + LI->replaceAllUsesWith(&*I2); |
|
6195 LI->eraseFromParent(); |
|
6196 DEBUG(dbgs() << "*** Promoted load of argument '" << I->getName() |
|
6197 << "' in function '" << F->getName() << "'\n"); |
|
6198 @@ -980,11 +967,10 @@ |
|
6199 // the argument specified by ArgNo. |
|
6200 while (!GEP->use_empty()) { |
|
6201 LoadInst *L = cast<LoadInst>(GEP->user_back()); |
|
6202 - L->replaceAllUsesWith(TheArg); |
|
6203 - AA.replaceWithNewValue(L, TheArg); |
|
6204 + L->replaceAllUsesWith(&*TheArg); |
|
6205 L->eraseFromParent(); |
|
6206 } |
|
6207 - AA.deleteValue(GEP); |
|
6208 + |
|
6209 GEP->eraseFromParent(); |
|
6210 } |
|
6211 } |
|
6212 @@ -993,12 +979,9 @@ |
|
6213 std::advance(I2, ArgIndices.size()); |
|
6214 } |
|
6215 |
|
6216 - // Tell the alias analysis that the old function is about to disappear. |
|
6217 - AA.replaceWithNewValue(F, NF); |
|
6218 |
|
6219 - |
|
6220 NF_CGN->stealCalledFunctionsFrom(CG[F]); |
|
6221 - |
|
6222 + |
|
6223 // Now that the old function is dead, delete it. If there is a dangling |
|
6224 // reference to the CallgraphNode, just leave the dead function around for |
|
6225 // someone else to nuke. |
|
6226 @@ -1007,7 +990,7 @@ |
|
6227 delete CG.removeFunctionFromModule(CGN); |
|
6228 else |
|
6229 F->setLinkage(Function::ExternalLinkage); |
|
6230 - |
|
6231 + |
|
6232 return NF_CGN; |
|
6233 } |
|
6234 |
|
6235 --- lib/Transforms/IPO/ConstantMerge.cpp 2014-08-20 22:55:13.000000000 -0700 |
|
6236 +++ lib/Transforms/IPO/ConstantMerge.cpp 2015-11-29 18:38:45.961868975 -0800 |
|
6237 @@ -130,7 +130,8 @@ |
|
6238 // First: Find the canonical constants others will be merged with. |
|
6239 for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); |
|
6240 GVI != E; ) { |
|
6241 - GlobalVariable *GV = GVI++; |
|
6242 + GlobalVariable *GV = &*GVI; |
|
6243 + ++GVI; |
|
6244 |
|
6245 // If this GV is dead, remove it. |
|
6246 GV->removeDeadConstantUsers(); |
|
6247 @@ -172,7 +173,8 @@ |
|
6248 // invalidating the Constant* pointers in CMap. |
|
6249 for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); |
|
6250 GVI != E; ) { |
|
6251 - GlobalVariable *GV = GVI++; |
|
6252 + GlobalVariable *GV = &*GVI; |
|
6253 + ++GVI; |
|
6254 |
|
6255 // Only process constants with initializers in the default address space. |
|
6256 if (!GV->isConstant() || !GV->hasDefinitiveInitializer() || |
|
6257 --- lib/Transforms/IPO/DeadArgumentElimination.cpp 2014-10-07 08:10:23.000000000 -0700 |
|
6258 +++ lib/Transforms/IPO/DeadArgumentElimination.cpp 2015-11-29 18:53:45.446590015 -0800 |
|
6259 @@ -229,7 +229,7 @@ |
|
6260 // Create the new function body and insert it into the module... |
|
6261 Function *NF = Function::Create(NFTy, Fn.getLinkage()); |
|
6262 NF->copyAttributesFrom(&Fn); |
|
6263 - Fn.getParent()->getFunctionList().insert(&Fn, NF); |
|
6264 + Fn.getParent()->getFunctionList().insert(Fn.getIterator(), NF); |
|
6265 NF->takeName(&Fn); |
|
6266 |
|
6267 // Loop over all of the callers of the function, transforming the call sites |
|
6268 @@ -296,8 +296,8 @@ |
|
6269 for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(), |
|
6270 I2 = NF->arg_begin(); I != E; ++I, ++I2) { |
|
6271 // Move the name and users over to the new version. |
|
6272 - I->replaceAllUsesWith(I2); |
|
6273 - I2->takeName(I); |
|
6274 + I->replaceAllUsesWith(&*I2); |
|
6275 + I2->takeName(&*I); |
|
6276 } |
|
6277 |
|
6278 // Patch the pointer to LLVM function in debug info descriptor. |
|
6279 @@ -351,12 +351,10 @@ |
|
6280 return false; |
|
6281 |
|
6282 SmallVector<unsigned, 8> UnusedArgs; |
|
6283 - for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); |
|
6284 - I != E; ++I) { |
|
6285 - Argument *Arg = I; |
|
6286 |
|
6287 - if (Arg->use_empty() && !Arg->hasByValOrInAllocaAttr()) |
|
6288 - UnusedArgs.push_back(Arg->getArgNo()); |
|
6289 + for (Argument &Arg : Fn.args()) { |
|
6290 + if (Arg.use_empty() && !Arg.hasByValOrInAllocaAttr()) |
|
6291 + UnusedArgs.push_back(Arg.getArgNo()); |
|
6292 } |
|
6293 |
|
6294 if (UnusedArgs.empty()) |
|
6295 @@ -617,7 +615,7 @@ |
|
6296 } else { |
|
6297 // See what the effect of this use is (recording any uses that cause |
|
6298 // MaybeLive in MaybeLiveArgUses). |
|
6299 - Result = SurveyUses(AI, MaybeLiveArgUses); |
|
6300 + Result = SurveyUses(&*AI, MaybeLiveArgUses); |
|
6301 } |
|
6302 |
|
6303 // Mark the result. |
|
6304 @@ -862,7 +860,7 @@ |
|
6305 NF->setAttributes(NewPAL); |
|
6306 // Insert the new function before the old function, so we won't be processing |
|
6307 // it again. |
|
6308 - F->getParent()->getFunctionList().insert(F, NF); |
|
6309 + F->getParent()->getFunctionList().insert(F->getIterator(), NF); |
|
6310 NF->takeName(F); |
|
6311 |
|
6312 // Loop over all of the callers of the function, transforming the call sites |
|
6313 @@ -966,7 +964,7 @@ |
|
6314 if (InvokeInst *II = dyn_cast<InvokeInst>(Call)) { |
|
6315 BasicBlock::iterator IP = II->getNormalDest()->begin(); |
|
6316 while (isa<PHINode>(IP)) ++IP; |
|
6317 - InsertPt = IP; |
|
6318 + InsertPt = &*IP; |
|
6319 } |
|
6320 |
|
6321 // We used to return a struct. Instead of doing smart stuff with all the |
|
6322 @@ -1014,8 +1012,8 @@ |
|
6323 if (ArgAlive[i]) { |
|
6324 // If this is a live argument, move the name and users over to the new |
|
6325 // version. |
|
6326 - I->replaceAllUsesWith(I2); |
|
6327 - I2->takeName(I); |
|
6328 + I->replaceAllUsesWith(&*I2); |
|
6329 + I2->takeName(&*I); |
|
6330 ++I2; |
|
6331 } else { |
|
6332 // If this argument is dead, replace any uses of it with null constants |
|
6333 @@ -1107,7 +1105,8 @@ |
|
6334 for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { |
|
6335 // Increment now, because the function will probably get removed (ie. |
|
6336 // replaced by a new one). |
|
6337 - Function *F = I++; |
|
6338 + Function *F = &*I; |
|
6339 + ++I; |
|
6340 Changed |= RemoveDeadStuffFromFunction(F); |
|
6341 } |
|
6342 |
|
6343 --- lib/Transforms/IPO/ExtractGV.cpp 2014-10-28 04:54:52.000000000 -0700 |
|
6344 +++ lib/Transforms/IPO/ExtractGV.cpp 2015-11-29 18:57:50.191073612 -0800 |
|
6345 @@ -83,7 +83,7 @@ |
|
6346 for (Module::global_iterator I = M.global_begin(), E = M.global_end(); |
|
6347 I != E; ++I) { |
|
6348 bool Delete = |
|
6349 - deleteStuff == (bool)Named.count(I) && !I->isDeclaration(); |
|
6350 + deleteStuff == (bool) Named.count(&*I) && !I->isDeclaration(); |
|
6351 if (!Delete) { |
|
6352 if (I->hasAvailableExternallyLinkage()) |
|
6353 continue; |
|
6354 @@ -100,7 +100,7 @@ |
|
6355 // Visit the Functions. |
|
6356 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { |
|
6357 bool Delete = |
|
6358 - deleteStuff == (bool)Named.count(I) && !I->isDeclaration(); |
|
6359 + deleteStuff == (bool) Named.count(&*I) && !I->isDeclaration(); |
|
6360 if (!Delete) { |
|
6361 if (I->hasAvailableExternallyLinkage()) |
|
6362 continue; |
|
6363 @@ -108,8 +108,10 @@ |
|
6364 |
|
6365 makeVisible(*I, Delete); |
|
6366 |
|
6367 - if (Delete) |
|
6368 + if (Delete) { |
|
6369 I->deleteBody(); |
|
6370 + I->setComdat(nullptr); |
|
6371 + } |
|
6372 } |
|
6373 |
|
6374 // Visit the Aliases. |
|
6375 @@ -118,7 +120,7 @@ |
|
6376 Module::alias_iterator CurI = I; |
|
6377 ++I; |
|
6378 |
|
6379 - bool Delete = deleteStuff == (bool)Named.count(CurI); |
|
6380 + bool Delete = deleteStuff == (bool) Named.count(&*CurI); |
|
6381 makeVisible(*CurI, Delete); |
|
6382 |
|
6383 if (Delete) { |
|
6384 @@ -136,8 +138,9 @@ |
|
6385 nullptr, CurI->getName()); |
|
6386 |
|
6387 } |
|
6388 + |
|
6389 CurI->replaceAllUsesWith(Declaration); |
|
6390 - delete CurI; |
|
6391 + delete &*CurI; |
|
6392 } |
|
6393 } |
|
6394 |
|
6395 --- lib/Transforms/IPO/FunctionAttrs.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
6396 +++ lib/Transforms/IPO/FunctionAttrs.cpp 2015-11-29 19:01:30.757096968 -0800 |
|
6397 @@ -365,7 +365,7 @@ |
|
6398 return true; |
|
6399 } |
|
6400 if (PI == U) { |
|
6401 - Uses.push_back(AI); |
|
6402 + Uses.push_back(&*AI); |
|
6403 Found = true; |
|
6404 break; |
|
6405 } |
|
6406 @@ -489,15 +489,19 @@ |
|
6407 "More params than args in non-varargs call."); |
|
6408 return Attribute::None; |
|
6409 } |
|
6410 + |
|
6411 Captures &= !CS.doesNotCapture(A - B); |
|
6412 - if (SCCNodes.count(AI)) |
|
6413 + if (SCCNodes.count(&*AI)) |
|
6414 continue; |
|
6415 + |
|
6416 if (!CS.onlyReadsMemory() && !CS.onlyReadsMemory(A - B)) |
|
6417 return Attribute::None; |
|
6418 + |
|
6419 if (!CS.doesNotAccessMemory(A - B)) |
|
6420 IsRead = true; |
|
6421 } |
|
6422 } |
|
6423 + |
|
6424 AddUsersToWorklistIfCapturing(); |
|
6425 break; |
|
6426 } |
|
6427 @@ -574,7 +578,7 @@ |
|
6428 bool HasNonLocalUses = false; |
|
6429 if (!A->hasNoCaptureAttr()) { |
|
6430 ArgumentUsesTracker Tracker(SCCNodes); |
|
6431 - PointerMayBeCaptured(A, &Tracker); |
|
6432 + PointerMayBeCaptured(&*A, &Tracker); |
|
6433 if (!Tracker.Captured) { |
|
6434 if (Tracker.Uses.empty()) { |
|
6435 // If it's trivially not captured, mark it nocapture now. |
|
6436 @@ -585,7 +589,7 @@ |
|
6437 // If it's not trivially captured and not trivially not captured, |
|
6438 // then it must be calling into another function in our SCC. Save |
|
6439 // its particulars for Argument-SCC analysis later. |
|
6440 - ArgumentGraphNode *Node = AG[A]; |
|
6441 + ArgumentGraphNode *Node = AG[&*A]; |
|
6442 for (SmallVectorImpl<Argument*>::iterator UI = Tracker.Uses.begin(), |
|
6443 UE = Tracker.Uses.end(); UI != UE; ++UI) { |
|
6444 Node->Uses.push_back(AG[*UI]); |
|
6445 @@ -602,8 +606,8 @@ |
|
6446 // will be dependent on the iteration order through the functions in the |
|
6447 // SCC. |
|
6448 SmallPtrSet<Argument*, 8> Self; |
|
6449 - Self.insert(A); |
|
6450 - Attribute::AttrKind R = determinePointerReadAttrs(A, Self); |
|
6451 + Self.insert(&*A); |
|
6452 + Attribute::AttrKind R = determinePointerReadAttrs(&*A, Self); |
|
6453 if (R != Attribute::None) { |
|
6454 AttrBuilder B; |
|
6455 B.addAttribute(R); |
|
6456 --- lib/Transforms/IPO/GlobalDCE.cpp 2014-12-02 18:08:38.000000000 -0800 |
|
6457 +++ lib/Transforms/IPO/GlobalDCE.cpp 2015-11-29 19:08:57.774680942 -0800 |
|
6458 @@ -84,7 +84,7 @@ |
|
6459 // Functions with external linkage are needed if they have a body |
|
6460 if (!I->isDeclaration() && !I->hasAvailableExternallyLinkage()) { |
|
6461 if (!I->isDiscardableIfUnused()) |
|
6462 - GlobalIsNeeded(I); |
|
6463 + GlobalIsNeeded(&*I); |
|
6464 } |
|
6465 } |
|
6466 |
|
6467 @@ -95,7 +95,7 @@ |
|
6468 // initializer. |
|
6469 if (!I->isDeclaration() && !I->hasAvailableExternallyLinkage()) { |
|
6470 if (!I->isDiscardableIfUnused()) |
|
6471 - GlobalIsNeeded(I); |
|
6472 + GlobalIsNeeded(&*I); |
|
6473 } |
|
6474 } |
|
6475 |
|
6476 @@ -104,7 +104,7 @@ |
|
6477 Changed |= RemoveUnusedGlobalValue(*I); |
|
6478 // Externally visible aliases are needed. |
|
6479 if (!I->isDiscardableIfUnused()) { |
|
6480 - GlobalIsNeeded(I); |
|
6481 + GlobalIsNeeded(&*I); |
|
6482 } |
|
6483 } |
|
6484 |
|
6485 @@ -116,8 +116,8 @@ |
|
6486 std::vector<GlobalVariable*> DeadGlobalVars; // Keep track of dead globals |
|
6487 for (Module::global_iterator I = M.global_begin(), E = M.global_end(); |
|
6488 I != E; ++I) |
|
6489 - if (!AliveGlobals.count(I)) { |
|
6490 - DeadGlobalVars.push_back(I); // Keep track of dead globals |
|
6491 + if (!AliveGlobals.count(&*I)) { |
|
6492 + DeadGlobalVars.push_back(&*I); // Keep track of dead globals |
|
6493 if (I->hasInitializer()) { |
|
6494 Constant *Init = I->getInitializer(); |
|
6495 I->setInitializer(nullptr); |
|
6496 @@ -129,8 +129,8 @@ |
|
6497 // The second pass drops the bodies of functions which are dead... |
|
6498 std::vector<Function*> DeadFunctions; |
|
6499 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) |
|
6500 - if (!AliveGlobals.count(I)) { |
|
6501 - DeadFunctions.push_back(I); // Keep track of dead globals |
|
6502 + if (!AliveGlobals.count(&*I)) { |
|
6503 + DeadFunctions.push_back(&*I); // Keep track of dead globals |
|
6504 if (!I->isDeclaration()) |
|
6505 I->deleteBody(); |
|
6506 } |
|
6507 @@ -139,8 +139,8 @@ |
|
6508 std::vector<GlobalAlias*> DeadAliases; |
|
6509 for (Module::alias_iterator I = M.alias_begin(), E = M.alias_end(); I != E; |
|
6510 ++I) |
|
6511 - if (!AliveGlobals.count(I)) { |
|
6512 - DeadAliases.push_back(I); |
|
6513 + if (!AliveGlobals.count(&*I)) { |
|
6514 + DeadAliases.push_back(&*I); |
|
6515 I->setAliasee(nullptr); |
|
6516 } |
|
6517 |
|
6518 --- lib/Transforms/IPO/GlobalOpt.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
6519 +++ lib/Transforms/IPO/GlobalOpt.cpp 2015-11-29 19:20:51.649538813 -0800 |
|
6520 @@ -493,12 +493,13 @@ |
|
6521 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { |
|
6522 Constant *In = Init->getAggregateElement(i); |
|
6523 assert(In && "Couldn't get element of initializer?"); |
|
6524 - GlobalVariable *NGV = new GlobalVariable(STy->getElementType(i), false, |
|
6525 - GlobalVariable::InternalLinkage, |
|
6526 - In, GV->getName()+"."+Twine(i), |
|
6527 - GV->getThreadLocalMode(), |
|
6528 - GV->getType()->getAddressSpace()); |
|
6529 - Globals.insert(GV, NGV); |
|
6530 + GlobalVariable *NGV = |
|
6531 + new GlobalVariable(STy->getElementType(i), false, |
|
6532 + GlobalVariable::InternalLinkage, |
|
6533 + In, GV->getName()+"."+Twine(i), |
|
6534 + GV->getThreadLocalMode(), |
|
6535 + GV->getType()->getAddressSpace()); |
|
6536 + Globals.insert(GV->getIterator(), NGV); |
|
6537 NewGlobals.push_back(NGV); |
|
6538 |
|
6539 // Calculate the known alignment of the field. If theinal aggregate |
|
6540 @@ -526,12 +527,13 @@ |
|
6541 Constant *In = Init->getAggregateElement(i); |
|
6542 assert(In && "Couldn't get element of initializer?"); |
|
6543 |
|
6544 - GlobalVariable *NGV = new GlobalVariable(STy->getElementType(), false, |
|
6545 - GlobalVariable::InternalLinkage, |
|
6546 - In, GV->getName()+"."+Twine(i), |
|
6547 - GV->getThreadLocalMode(), |
|
6548 - GV->getType()->getAddressSpace()); |
|
6549 - Globals.insert(GV, NGV); |
|
6550 + GlobalVariable *NGV = |
|
6551 + new GlobalVariable(STy->getElementType(), false, |
|
6552 + GlobalVariable::InternalLinkage, |
|
6553 + In, GV->getName()+"."+Twine(i), |
|
6554 + GV->getThreadLocalMode(), |
|
6555 + GV->getType()->getAddressSpace()); |
|
6556 + Globals.insert(GV->getIterator(), NGV); |
|
6557 NewGlobals.push_back(NGV); |
|
6558 |
|
6559 // Calculate the known alignment of the field. If theinal aggregate |
|
6560 @@ -936,7 +938,7 @@ |
|
6561 cast<StoreInst>(InitBool->user_back())->eraseFromParent(); |
|
6562 delete InitBool; |
|
6563 } else |
|
6564 - GV->getParent()->getGlobalList().insert(GV, InitBool); |
|
6565 + GV->getParent()->getGlobalList().insert(GV->getIterator(), InitBool); |
|
6566 |
|
6567 // Now the GV is dead, nuke it and the malloc.. |
|
6568 GV->eraseFromParent(); |
|
6569 @@ -1338,7 +1340,8 @@ |
|
6570 |
|
6571 // Split the basic block at the old malloc. |
|
6572 BasicBlock *OrigBB = CI->getParent(); |
|
6573 - BasicBlock *ContBB = OrigBB->splitBasicBlock(CI, "malloc_cont"); |
|
6574 + BasicBlock *ContBB = |
|
6575 + OrigBB->splitBasicBlock(CI->getIterator(), "malloc_cont"); |
|
6576 |
|
6577 // Create the block to check the first condition. Put all these blocks at the |
|
6578 // end of the function as they are unlikely to be executed. |
|
6579 @@ -1505,7 +1508,8 @@ |
|
6580 // (2048 bytes currently), as we don't want to introduce a 16M global or |
|
6581 // something. |
|
6582 if (NElements->getZExtValue() * DL->getTypeAllocSize(AllocTy) < 2048) { |
|
6583 - GVI = OptimizeGlobalAddressOfMalloc(GV, CI, AllocTy, NElements, DL, TLI); |
|
6584 + GVI = OptimizeGlobalAddressOfMalloc(GV, CI, AllocTy, |
|
6585 + NElements, DL, TLI)->getIterator(); |
|
6586 return true; |
|
6587 } |
|
6588 |
|
6589 @@ -1551,7 +1555,7 @@ |
|
6590 } |
|
6591 |
|
6592 GVI = PerformHeapAllocSRoA(GV, CI, getMallocArraySize(CI, DL, TLI, true), |
|
6593 - DL, TLI); |
|
6594 + DL, TLI)->getIterator(); |
|
6595 return true; |
|
6596 } |
|
6597 |
|
6598 @@ -1626,7 +1630,7 @@ |
|
6599 GV->getName()+".b", |
|
6600 GV->getThreadLocalMode(), |
|
6601 GV->getType()->getAddressSpace()); |
|
6602 - GV->getParent()->getGlobalList().insert(GV, NewGV); |
|
6603 + GV->getParent()->getGlobalList().insert(GV->getIterator(), NewGV); |
|
6604 |
|
6605 Constant *InitVal = GV->getInitializer(); |
|
6606 assert(InitVal->getType() != Type::getInt1Ty(GV->getContext()) && |
|
6607 @@ -1807,7 +1811,7 @@ |
|
6608 if (DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>()) { |
|
6609 const DataLayout &DL = DLP->getDataLayout(); |
|
6610 if (GlobalVariable *FirstNewGV = SRAGlobal(GV, DL)) { |
|
6611 - GVI = FirstNewGV; // Don't skip the newly produced globals! |
|
6612 + GVI = FirstNewGV->getIterator(); // Don't skip the newly produced globals! |
|
6613 return true; |
|
6614 } |
|
6615 } |
|
6616 @@ -1830,7 +1834,7 @@ |
|
6617 GV->eraseFromParent(); |
|
6618 ++NumDeleted; |
|
6619 } else { |
|
6620 - GVI = GV; |
|
6621 + GVI = GV->getIterator(); |
|
6622 } |
|
6623 ++NumSubstitute; |
|
6624 return true; |
|
6625 @@ -1905,7 +1909,7 @@ |
|
6626 bool Changed = false; |
|
6627 // Optimize functions. |
|
6628 for (Module::iterator FI = M.begin(), E = M.end(); FI != E; ) { |
|
6629 - Function *F = FI++; |
|
6630 + Function *F = &*FI++; |
|
6631 // Functions without names cannot be referenced outside this module. |
|
6632 if (!F->hasName() && !F->isDeclaration() && !F->hasLocalLinkage()) |
|
6633 F->setLinkage(GlobalValue::InternalLinkage); |
|
6634 @@ -1947,7 +1951,7 @@ |
|
6635 |
|
6636 for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); |
|
6637 GVI != E; ) { |
|
6638 - GlobalVariable *GV = GVI++; |
|
6639 + GlobalVariable *GV = &*GVI++; |
|
6640 // Global variables without names cannot be referenced outside this module. |
|
6641 if (!GV->hasName() && !GV->isDeclaration() && !GV->hasLocalLinkage()) |
|
6642 GV->setLinkage(GlobalValue::InternalLinkage); |
|
6643 @@ -2446,7 +2450,7 @@ |
|
6644 InstResult = AllocaTmps.back().get(); |
|
6645 DEBUG(dbgs() << "Found an alloca. Result: " << *InstResult << "\n"); |
|
6646 } else if (isa<CallInst>(CurInst) || isa<InvokeInst>(CurInst)) { |
|
6647 - CallSite CS(CurInst); |
|
6648 + CallSite CS(&*CurInst); |
|
6649 |
|
6650 // Debug info can safely be ignored here. |
|
6651 if (isa<DbgInfoIntrinsic>(CS.getInstruction())) { |
|
6652 @@ -2608,7 +2612,7 @@ |
|
6653 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(InstResult)) |
|
6654 InstResult = ConstantFoldConstantExpression(CE, DL, TLI); |
|
6655 |
|
6656 - setVal(CurInst, InstResult); |
|
6657 + setVal(&*CurInst, InstResult); |
|
6658 } |
|
6659 |
|
6660 // If we just processed an invoke, we finished evaluating the block. |
|
6661 @@ -2639,7 +2643,7 @@ |
|
6662 unsigned ArgNo = 0; |
|
6663 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; |
|
6664 ++AI, ++ArgNo) |
|
6665 - setVal(AI, ActualArgs[ArgNo]); |
|
6666 + setVal(&*AI, ActualArgs[ArgNo]); |
|
6667 |
|
6668 // ExecutedBlocks - We only handle non-looping, non-recursive code. As such, |
|
6669 // we can only evaluate any one basic block at most once. This set keeps |
|
6670 @@ -2647,7 +2651,7 @@ |
|
6671 SmallPtrSet<BasicBlock*, 32> ExecutedBlocks; |
|
6672 |
|
6673 // CurBB - The current basic block we're evaluating. |
|
6674 - BasicBlock *CurBB = F->begin(); |
|
6675 + BasicBlock *CurBB = &F->front(); |
|
6676 |
|
6677 BasicBlock::iterator CurInst = CurBB->begin(); |
|
6678 |
|
6679 @@ -2897,15 +2901,15 @@ |
|
6680 |
|
6681 if (RenameTarget) { |
|
6682 // Give the aliasee the name, linkage and other attributes of the alias. |
|
6683 - Target->takeName(J); |
|
6684 + Target->takeName(&*J); |
|
6685 Target->setLinkage(J->getLinkage()); |
|
6686 Target->setVisibility(J->getVisibility()); |
|
6687 Target->setDLLStorageClass(J->getDLLStorageClass()); |
|
6688 |
|
6689 - if (Used.usedErase(J)) |
|
6690 + if (Used.usedErase(&*J)) |
|
6691 Used.usedInsert(Target); |
|
6692 |
|
6693 - if (Used.compilerUsedErase(J)) |
|
6694 + if (Used.compilerUsedErase(&*J)) |
|
6695 Used.compilerUsedInsert(Target); |
|
6696 } else if (mayHaveOtherReferences(*J, Used)) |
|
6697 continue; |
|
6698 --- lib/Transforms/IPO/Internalize.cpp 2014-08-24 16:23:06.000000000 -0700 |
|
6699 +++ lib/Transforms/IPO/Internalize.cpp 2015-11-29 19:22:14.785278600 -0800 |
|
6700 @@ -162,7 +162,7 @@ |
|
6701 |
|
6702 if (ExternalNode) |
|
6703 // Remove a callgraph edge from the external node to this function. |
|
6704 - ExternalNode->removeOneAbstractEdgeTo((*CG)[I]); |
|
6705 + ExternalNode->removeOneAbstractEdgeTo((*CG)[&*I]); |
|
6706 |
|
6707 Changed = true; |
|
6708 ++NumFunctions; |
|
6709 --- lib/Transforms/IPO/LoopExtractor.cpp 2014-07-21 10:06:51.000000000 -0700 |
|
6710 +++ lib/Transforms/IPO/LoopExtractor.cpp 2015-11-29 19:23:56.327652268 -0800 |
|
6711 @@ -259,7 +259,7 @@ |
|
6712 // Figure out which index the basic block is in its function. |
|
6713 Function::iterator BBI = MF->begin(); |
|
6714 std::advance(BBI, std::distance(F->begin(), Function::iterator(BB))); |
|
6715 - TranslatedBlocksToNotExtract.insert(BBI); |
|
6716 + TranslatedBlocksToNotExtract.insert(&*BBI); |
|
6717 } |
|
6718 |
|
6719 while (!BlocksToNotExtractByName.empty()) { |
|
6720 @@ -278,7 +278,7 @@ |
|
6721 BasicBlock &BB = *BI; |
|
6722 if (BB.getName() != BlockName) continue; |
|
6723 |
|
6724 - TranslatedBlocksToNotExtract.insert(BI); |
|
6725 + TranslatedBlocksToNotExtract.insert(&*BI); |
|
6726 } |
|
6727 } |
|
6728 |
|
6729 @@ -291,8 +291,8 @@ |
|
6730 for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
|
6731 SplitLandingPadPreds(&*F); |
|
6732 for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) |
|
6733 - if (!TranslatedBlocksToNotExtract.count(BB)) |
|
6734 - BlocksToExtract.push_back(BB); |
|
6735 + if (!TranslatedBlocksToNotExtract.count(&*BB)) |
|
6736 + BlocksToExtract.push_back(&*BB); |
|
6737 } |
|
6738 |
|
6739 for (unsigned i = 0, e = BlocksToExtract.size(); i != e; ++i) { |
|
6740 --- lib/Transforms/IPO/MergeFunctions.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
6741 +++ lib/Transforms/IPO/MergeFunctions.cpp 2015-11-29 19:32:19.065098905 -0800 |
|
6742 @@ -929,7 +929,7 @@ |
|
6743 BasicBlock::const_iterator InstR = BBR->begin(), InstRE = BBR->end(); |
|
6744 |
|
6745 do { |
|
6746 - if (int Res = cmpValues(InstL, InstR)) |
|
6747 + if (int Res = cmpValues(&*InstL, &*InstR)) |
|
6748 return Res; |
|
6749 |
|
6750 const GetElementPtrInst *GEPL = dyn_cast<GetElementPtrInst>(InstL); |
|
6751 @@ -947,7 +947,7 @@ |
|
6752 if (int Res = cmpGEPs(GEPL, GEPR)) |
|
6753 return Res; |
|
6754 } else { |
|
6755 - if (int Res = cmpOperations(InstL, InstR)) |
|
6756 + if (int Res = cmpOperations(&*InstL, &*InstR)) |
|
6757 return Res; |
|
6758 assert(InstL->getNumOperands() == InstR->getNumOperands()); |
|
6759 |
|
6760 @@ -1019,7 +1019,7 @@ |
|
6761 ArgRI = FnR->arg_begin(), |
|
6762 ArgLE = FnL->arg_end(); |
|
6763 ArgLI != ArgLE; ++ArgLI, ++ArgRI) { |
|
6764 - if (cmpValues(ArgLI, ArgRI) != 0) |
|
6765 + if (cmpValues(&*ArgLI, &*ArgRI) != 0) |
|
6766 llvm_unreachable("Arguments repeat!"); |
|
6767 } |
|
6768 |
|
6769 @@ -1217,7 +1217,7 @@ |
|
6770 |
|
6771 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { |
|
6772 if (!I->isDeclaration() && !I->hasAvailableExternallyLinkage()) |
|
6773 - Deferred.push_back(WeakVH(I)); |
|
6774 + Deferred.push_back(WeakVH(&*I)); |
|
6775 } |
|
6776 |
|
6777 do { |
|
6778 @@ -1342,7 +1342,7 @@ |
|
6779 FunctionType *FFTy = F->getFunctionType(); |
|
6780 for (Function::arg_iterator AI = NewG->arg_begin(), AE = NewG->arg_end(); |
|
6781 AI != AE; ++AI) { |
|
6782 - Args.push_back(createCast(Builder, (Value*)AI, FFTy->getParamType(i))); |
|
6783 + Args.push_back(createCast(Builder, &*AI, FFTy->getParamType(i))); |
|
6784 ++i; |
|
6785 } |
|
6786 |
|
6787 --- lib/Transforms/IPO/PartialInlining.cpp 2014-07-21 10:06:51.000000000 -0700 |
|
6788 +++ lib/Transforms/IPO/PartialInlining.cpp 2015-11-30 05:52:13.004988742 -0800 |
|
6789 @@ -50,7 +50,7 @@ |
|
6790 |
|
6791 Function* PartialInliner::unswitchFunction(Function* F) { |
|
6792 // First, verify that this function is an unswitching candidate... |
|
6793 - BasicBlock* entryBlock = F->begin(); |
|
6794 + BasicBlock* entryBlock = &F->front(); |
|
6795 BranchInst *BR = dyn_cast<BranchInst>(entryBlock->getTerminator()); |
|
6796 if (!BR || BR->isUnconditional()) |
|
6797 return nullptr; |
|
6798 @@ -88,10 +88,10 @@ |
|
6799 // sequence of PHIs, some of which will go in the extracted region, and some |
|
6800 // of which will go outside. |
|
6801 BasicBlock* preReturn = newReturnBlock; |
|
6802 - newReturnBlock = newReturnBlock->splitBasicBlock( |
|
6803 - newReturnBlock->getFirstNonPHI()); |
|
6804 + newReturnBlock = |
|
6805 + newReturnBlock->splitBasicBlock(newReturnBlock->getFirstNonPHI()->getIterator()); |
|
6806 BasicBlock::iterator I = preReturn->begin(); |
|
6807 - BasicBlock::iterator Ins = newReturnBlock->begin(); |
|
6808 + Instruction *Ins = &newReturnBlock->front(); |
|
6809 while (I != preReturn->end()) { |
|
6810 PHINode* OldPhi = dyn_cast<PHINode>(I); |
|
6811 if (!OldPhi) break; |
|
6812 @@ -100,7 +100,7 @@ |
|
6813 OldPhi->replaceAllUsesWith(retPhi); |
|
6814 Ins = newReturnBlock->getFirstNonPHI(); |
|
6815 |
|
6816 - retPhi->addIncoming(I, preReturn); |
|
6817 + retPhi->addIncoming(&*I, preReturn); |
|
6818 retPhi->addIncoming(OldPhi->getIncomingValueForBlock(newEntryBlock), |
|
6819 newEntryBlock); |
|
6820 OldPhi->removeIncomingValue(newEntryBlock); |
|
6821 @@ -116,7 +116,7 @@ |
|
6822 FE = duplicateFunction->end(); FI != FE; ++FI) |
|
6823 if (&*FI != newEntryBlock && &*FI != newReturnBlock && |
|
6824 &*FI != newNonReturnBlock) |
|
6825 - toExtract.push_back(FI); |
|
6826 + toExtract.push_back(&*FI); |
|
6827 |
|
6828 // The CodeExtractor needs a dominator tree. |
|
6829 DominatorTree DT; |
|
6830 --- lib/Transforms/IPO/PruneEH.cpp 2015-01-12 19:46:47.000000000 -0800 |
|
6831 +++ lib/Transforms/IPO/PruneEH.cpp 2015-11-30 05:53:43.868963013 -0800 |
|
6832 @@ -218,7 +218,7 @@ |
|
6833 |
|
6834 // Remove the uncond branch and add an unreachable. |
|
6835 BB->getInstList().pop_back(); |
|
6836 - new UnreachableInst(BB->getContext(), BB); |
|
6837 + new UnreachableInst(BB->getContext(), &*BB); |
|
6838 |
|
6839 DeleteBasicBlock(New); // Delete the new BB. |
|
6840 MadeChange = true; |
|
6841 --- lib/Transforms/IPO/StripDeadPrototypes.cpp 2014-04-21 19:55:47.000000000 -0700 |
|
6842 +++ lib/Transforms/IPO/StripDeadPrototypes.cpp 2015-11-30 05:54:57.769272028 -0800 |
|
6843 @@ -47,7 +47,9 @@ |
|
6844 |
|
6845 // Erase dead function prototypes. |
|
6846 for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { |
|
6847 - Function *F = I++; |
|
6848 + Function *F = &*I; |
|
6849 + ++I; |
|
6850 + |
|
6851 // Function must be a prototype and unused. |
|
6852 if (F->isDeclaration() && F->use_empty()) { |
|
6853 F->eraseFromParent(); |
|
6854 @@ -59,7 +61,9 @@ |
|
6855 // Erase dead global var prototypes. |
|
6856 for (Module::global_iterator I = M.global_begin(), E = M.global_end(); |
|
6857 I != E; ) { |
|
6858 - GlobalVariable *GV = I++; |
|
6859 + GlobalVariable *GV = &*I; |
|
6860 + ++I; |
|
6861 + |
|
6862 // Global must be a prototype and unused. |
|
6863 if (GV->isDeclaration() && GV->use_empty()) |
|
6864 GV->eraseFromParent(); |
|
6865 --- lib/Transforms/IPO/StripSymbols.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
6866 +++ lib/Transforms/IPO/StripSymbols.cpp 2015-11-30 06:01:52.193630900 -0800 |
|
6867 @@ -211,13 +211,13 @@ |
|
6868 |
|
6869 for (Module::global_iterator I = M.global_begin(), E = M.global_end(); |
|
6870 I != E; ++I) { |
|
6871 - if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0) |
|
6872 + if (I->hasLocalLinkage() && llvmUsedValues.count(&*I) == 0) |
|
6873 if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg")) |
|
6874 I->setName(""); // Internal symbols can't participate in linkage |
|
6875 } |
|
6876 |
|
6877 for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { |
|
6878 - if (I->hasLocalLinkage() && llvmUsedValues.count(I) == 0) |
|
6879 + if (I->hasLocalLinkage() && llvmUsedValues.count(&*I) == 0) |
|
6880 if (!PreserveDbgInfo || !I->getName().startswith("llvm.dbg")) |
|
6881 I->setName(""); // Internal symbols can't participate in linkage |
|
6882 StripSymtab(I->getValueSymbolTable(), PreserveDbgInfo); |
|
6883 --- lib/Transforms/InstCombine/InstCombineCalls.cpp 2015-01-22 11:40:47.000000000 -0800 |
|
6884 +++ lib/Transforms/InstCombine/InstCombineCalls.cpp 2015-11-30 06:53:40.815329138 -0800 |
|
6885 @@ -1010,15 +1010,14 @@ |
|
6886 // happen when variable allocas are DCE'd. |
|
6887 if (IntrinsicInst *SS = dyn_cast<IntrinsicInst>(II->getArgOperand(0))) { |
|
6888 if (SS->getIntrinsicID() == Intrinsic::stacksave) { |
|
6889 - BasicBlock::iterator BI = SS; |
|
6890 - if (&*++BI == II) |
|
6891 + if (&*++SS->getIterator() == II) |
|
6892 return EraseInstFromFunction(CI); |
|
6893 } |
|
6894 } |
|
6895 |
|
6896 // Scan down this block to see if there is another stack restore in the |
|
6897 // same block without an intervening call/alloca. |
|
6898 - BasicBlock::iterator BI = II; |
|
6899 + BasicBlock::iterator BI(II); |
|
6900 TerminatorInst *TI = II->getParent()->getTerminator(); |
|
6901 bool CannotRemove = false; |
|
6902 for (++BI; &*BI != TI; ++BI) { |
|
6903 @@ -1235,9 +1234,9 @@ |
|
6904 Value *TrampMem) { |
|
6905 // Visit all the previous instructions in the basic block, and try to find a |
|
6906 // init.trampoline which has a direct path to the adjust.trampoline. |
|
6907 - for (BasicBlock::iterator I = AdjustTramp, |
|
6908 + for (BasicBlock::iterator I = AdjustTramp->getIterator(), |
|
6909 E = AdjustTramp->getParent()->begin(); I != E; ) { |
|
6910 - Instruction *Inst = --I; |
|
6911 + Instruction *Inst = &*--I; |
|
6912 if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) |
|
6913 if (II->getIntrinsicID() == Intrinsic::init_trampoline && |
|
6914 II->getOperand(0) == TrampMem) |
|
6915 --- lib/Transforms/InstCombine/InstCombineCasts.cpp 2014-12-12 10:48:37.000000000 -0800 |
|
6916 +++ lib/Transforms/InstCombine/InstCombineCasts.cpp 2015-11-30 07:19:19.812837233 -0800 |
|
6917 @@ -86,7 +86,7 @@ |
|
6918 PointerType *PTy = cast<PointerType>(CI.getType()); |
|
6919 |
|
6920 BuilderTy AllocaBuilder(*Builder); |
|
6921 - AllocaBuilder.SetInsertPoint(AI.getParent(), &AI); |
|
6922 + AllocaBuilder.SetInsertPoint(&AI); |
|
6923 |
|
6924 // Get the type really allocated and the type casted to. |
|
6925 Type *AllocElTy = AI.getAllocatedType(); |
|
6926 --- lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 2015-02-12 19:19:15.000000000 -0800 |
|
6927 +++ lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp 2015-11-30 07:27:36.109476800 -0800 |
|
6928 @@ -187,8 +187,9 @@ |
|
6929 // Scan to the end of the allocation instructions, to skip over a block of |
|
6930 // allocas if possible...also skip interleaved debug info |
|
6931 // |
|
6932 - BasicBlock::iterator It = New; |
|
6933 - while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It)) ++It; |
|
6934 + BasicBlock::iterator It(New); |
|
6935 + while (isa<AllocaInst>(*It) || isa<DbgInfoIntrinsic>(*It)) |
|
6936 + ++It; |
|
6937 |
|
6938 // Now that I is pointing to the first non-allocation-inst in the block, |
|
6939 // insert our getelementptr instruction... |
|
6940 @@ -419,7 +420,7 @@ |
|
6941 // Do really simple store-to-load forwarding and load CSE, to catch cases |
|
6942 // where there are several consecutive memory accesses to the same location, |
|
6943 // separated by a few arithmetic operations. |
|
6944 - BasicBlock::iterator BBI = &LI; |
|
6945 + BasicBlock::iterator BBI(LI); |
|
6946 if (Value *AvailableVal = FindAvailableLoadedValue(Op, LI.getParent(), BBI,6)) |
|
6947 return ReplaceInstUsesWith( |
|
6948 LI, Builder->CreateBitOrPointerCast(AvailableVal, LI.getType(), |
|
6949 @@ -644,7 +645,7 @@ |
|
6950 // Do really simple DSE, to catch cases where there are several consecutive |
|
6951 // stores to the same location, separated by a few arithmetic operations. This |
|
6952 // situation often occurs with bitfield accesses. |
|
6953 - BasicBlock::iterator BBI = &SI; |
|
6954 + BasicBlock::iterator BBI(SI); |
|
6955 for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts; |
|
6956 --ScanInsts) { |
|
6957 --BBI; |
|
6958 @@ -703,7 +704,7 @@ |
|
6959 // If this store is the last instruction in the basic block (possibly |
|
6960 // excepting debug info instructions), and if the block ends with an |
|
6961 // unconditional branch, try to move it to the successor block. |
|
6962 - BBI = &SI; |
|
6963 + BBI = SI.getIterator(); |
|
6964 do { |
|
6965 ++BBI; |
|
6966 } while (isa<DbgInfoIntrinsic>(BBI) || |
|
6967 @@ -759,7 +760,7 @@ |
|
6968 return false; |
|
6969 |
|
6970 // Verify that the other block ends in a branch and is not otherwise empty. |
|
6971 - BasicBlock::iterator BBI = OtherBB->getTerminator(); |
|
6972 + BasicBlock::iterator BBI(OtherBB->getTerminator()); |
|
6973 BranchInst *OtherBr = dyn_cast<BranchInst>(BBI); |
|
6974 if (!OtherBr || BBI == OtherBB->begin()) |
|
6975 return false; |
|
6976 --- lib/Transforms/InstCombine/InstCombineMulDivRem.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
6977 +++ lib/Transforms/InstCombine/InstCombineMulDivRem.cpp 2015-11-30 07:30:31.455813053 -0800 |
|
6978 @@ -736,7 +736,7 @@ |
|
6979 return true; |
|
6980 |
|
6981 // Scan the current block backward, looking for other uses of SI. |
|
6982 - BasicBlock::iterator BBI = &I, BBFront = I.getParent()->begin(); |
|
6983 + BasicBlock::iterator BBI = I.getIterator(), BBFront = I.getParent()->begin(); |
|
6984 |
|
6985 while (BBI != BBFront) { |
|
6986 --BBI; |
|
6987 @@ -750,10 +750,10 @@ |
|
6988 I != E; ++I) { |
|
6989 if (*I == SI) { |
|
6990 *I = SI->getOperand(NonNullOperand); |
|
6991 - Worklist.Add(BBI); |
|
6992 + Worklist.Add(&*BBI); |
|
6993 } else if (*I == SelectCond) { |
|
6994 *I = Builder->getInt1(NonNullOperand == 1); |
|
6995 - Worklist.Add(BBI); |
|
6996 + Worklist.Add(&*BBI); |
|
6997 } |
|
6998 } |
|
6999 |
|
7000 --- lib/Transforms/InstCombine/InstCombinePHI.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
7001 +++ lib/Transforms/InstCombine/InstCombinePHI.cpp 2015-11-30 07:32:38.250246960 -0800 |
|
7002 @@ -247,7 +247,7 @@ |
|
7003 /// non-address-taken alloca. Doing so will cause us to not promote the alloca |
|
7004 /// to a register. |
|
7005 static bool isSafeAndProfitableToSinkLoad(LoadInst *L) { |
|
7006 - BasicBlock::iterator BBI = L, E = L->getParent()->end(); |
|
7007 + BasicBlock::iterator BBI = L->getIterator(), E = L->getParent()->end(); |
|
7008 |
|
7009 for (++BBI; BBI != E; ++BBI) |
|
7010 if (BBI->mayWriteToMemory()) |
|
7011 @@ -744,7 +744,7 @@ |
|
7012 } |
|
7013 |
|
7014 // Otherwise, do an extract in the predecessor. |
|
7015 - Builder->SetInsertPoint(Pred, Pred->getTerminator()); |
|
7016 + Builder->SetInsertPoint(Pred->getTerminator()); |
|
7017 Value *Res = InVal; |
|
7018 if (Offset) |
|
7019 Res = Builder->CreateLShr(Res, ConstantInt::get(InVal->getType(), |
|
7020 --- lib/Transforms/InstCombine/InstCombineVectorOps.cpp 2014-07-07 15:13:58.000000000 -0700 |
|
7021 +++ lib/Transforms/InstCombine/InstCombineVectorOps.cpp 2015-11-30 07:47:54.223248158 -0800 |
|
7022 @@ -162,8 +162,7 @@ |
|
7023 Instruction *pos = dyn_cast<Instruction>(PHIInVal); |
|
7024 BasicBlock::iterator InsertPos; |
|
7025 if (pos && !isa<PHINode>(pos)) { |
|
7026 - InsertPos = pos; |
|
7027 - ++InsertPos; |
|
7028 + InsertPos = ++pos->getIterator(); |
|
7029 } else { |
|
7030 InsertPos = inBB->getFirstInsertionPt(); |
|
7031 } |
|
7032 --- lib/Transforms/InstCombine/InstCombine.h 2015-01-06 16:39:50.000000000 -0800 |
|
7033 +++ lib/Transforms/InstCombine/InstCombine.h 2015-11-30 06:47:44.140493020 -0800 |
|
7034 @@ -297,7 +297,7 @@ |
|
7035 assert(New && !New->getParent() && |
|
7036 "New instruction already inserted into a basic block!"); |
|
7037 BasicBlock *BB = Old.getParent(); |
|
7038 - BB->getInstList().insert(&Old, New); // Insert inst |
|
7039 + BB->getInstList().insert(Old.getIterator(), New); // Insert inst |
|
7040 Worklist.Add(New); |
|
7041 return New; |
|
7042 } |
|
7043 --- lib/Transforms/InstCombine/InstructionCombining.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
7044 +++ lib/Transforms/InstCombine/InstructionCombining.cpp 2015-11-30 09:32:37.959104590 -0800 |
|
7045 @@ -1417,13 +1417,13 @@ |
|
7046 if (DI == -1) { |
|
7047 // All the GEPs feeding the PHI are identical. Clone one down into our |
|
7048 // BB so that it can be merged with the current GEP. |
|
7049 - GEP.getParent()->getInstList().insert(GEP.getParent()->getFirstNonPHI(), |
|
7050 - NewGEP); |
|
7051 + GEP.getParent()->getInstList().insert( |
|
7052 + GEP.getParent()->getFirstNonPHI()->getIterator(), NewGEP); |
|
7053 } else { |
|
7054 // All the GEPs feeding the PHI differ at a single offset. Clone a GEP |
|
7055 // into the current block so it can be merged, and create a new PHI to |
|
7056 // set that index. |
|
7057 - Instruction *InsertPt = Builder->GetInsertPoint(); |
|
7058 + Instruction *InsertPt = &*Builder->GetInsertPoint(); |
|
7059 Builder->SetInsertPoint(PN); |
|
7060 PHINode *NewPN = Builder->CreatePHI(Op1->getOperand(DI)->getType(), |
|
7061 PN->getNumOperands()); |
|
7062 @@ -1434,8 +1434,8 @@ |
|
7063 PN->getIncomingBlock(I)); |
|
7064 |
|
7065 NewGEP->setOperand(DI, NewPN); |
|
7066 - GEP.getParent()->getInstList().insert(GEP.getParent()->getFirstNonPHI(), |
|
7067 - NewGEP); |
|
7068 + GEP.getParent()->getInstList().insert( |
|
7069 + GEP.getParent()->getFirstNonPHI()->getIterator(), NewGEP); |
|
7070 NewGEP->setOperand(DI, NewPN); |
|
7071 } |
|
7072 |
|
7073 @@ -1768,7 +1768,7 @@ |
|
7074 if (Instruction *I = visitBitCast(*BCI)) { |
|
7075 if (I != BCI) { |
|
7076 I->takeName(BCI); |
|
7077 - BCI->getParent()->getInstList().insert(BCI, I); |
|
7078 + BCI->getParent()->getInstList().insert(BCI->getIterator(), I); |
|
7079 ReplaceInstUsesWith(*BCI, I); |
|
7080 } |
|
7081 return &GEP; |
|
7082 @@ -2269,7 +2269,7 @@ |
|
7083 |
|
7084 // We need to insert these at the location of the old load, not at that of |
|
7085 // the extractvalue. |
|
7086 - Builder->SetInsertPoint(L->getParent(), L); |
|
7087 + Builder->SetInsertPoint(L); |
|
7088 Value *GEP = Builder->CreateInBoundsGEP(L->getPointerOperand(), Indices); |
|
7089 // Returning the load directly will cause the main loop to insert it in |
|
7090 // the wrong spot, so use ReplaceInstUsesWith(). |
|
7091 @@ -2648,14 +2648,14 @@ |
|
7092 // We can only sink load instructions if there is nothing between the load and |
|
7093 // the end of block that could change the value. |
|
7094 if (I->mayReadFromMemory()) { |
|
7095 - for (BasicBlock::iterator Scan = I, E = I->getParent()->end(); |
|
7096 - Scan != E; ++Scan) |
|
7097 + for (BasicBlock::iterator Scan = I->getIterator(), |
|
7098 + E = I->getParent()->end(); Scan != E; ++Scan) |
|
7099 if (Scan->mayWriteToMemory()) |
|
7100 return false; |
|
7101 } |
|
7102 |
|
7103 BasicBlock::iterator InsertPos = DestBlock->getFirstInsertionPt(); |
|
7104 - I->moveBefore(InsertPos); |
|
7105 + I->moveBefore(&*InsertPos); |
|
7106 ++NumSunkInst; |
|
7107 return true; |
|
7108 } |
|
7109 @@ -2690,7 +2690,8 @@ |
|
7110 continue; |
|
7111 |
|
7112 for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { |
|
7113 - Instruction *Inst = BBI++; |
|
7114 + Instruction *Inst = &*BBI; |
|
7115 + ++BBI; |
|
7116 |
|
7117 // DCE instruction if trivially dead. |
|
7118 if (isInstructionTriviallyDead(Inst, TLI)) { |
|
7119 @@ -2787,22 +2788,21 @@ |
|
7120 // the reachable instructions. Ignore blocks that are not reachable. Keep |
|
7121 // track of which blocks we visit. |
|
7122 SmallPtrSet<BasicBlock*, 64> Visited; |
|
7123 - MadeIRChange |= AddReachableCodeToWorklist(F.begin(), Visited, *this, DL, |
|
7124 + MadeIRChange |= AddReachableCodeToWorklist(&F.front(), Visited, *this, DL, |
|
7125 TLI); |
|
7126 |
|
7127 // Do a quick scan over the function. If we find any blocks that are |
|
7128 // unreachable, remove any instructions inside of them. This prevents |
|
7129 // the instcombine code from having to deal with some bad special cases. |
|
7130 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { |
|
7131 - if (Visited.count(BB)) continue; |
|
7132 + if (Visited.count(&*BB)) continue; |
|
7133 |
|
7134 // Delete the instructions backwards, as it has a reduced likelihood of |
|
7135 // having to update as many def-use and use-def chains. |
|
7136 Instruction *EndInst = BB->getTerminator(); // Last not to be deleted. |
|
7137 while (EndInst != BB->begin()) { |
|
7138 // Delete the next to last instruction. |
|
7139 - BasicBlock::iterator I = EndInst; |
|
7140 - Instruction *Inst = --I; |
|
7141 + Instruction *Inst = &*--EndInst->getIterator(); |
|
7142 if (!Inst->use_empty()) |
|
7143 Inst->replaceAllUsesWith(UndefValue::get(Inst->getType())); |
|
7144 if (isa<LandingPadInst>(Inst)) { |
|
7145 @@ -2884,7 +2884,7 @@ |
|
7146 } |
|
7147 |
|
7148 // Now that we have an instruction, try combining it to simplify it. |
|
7149 - Builder->SetInsertPoint(I->getParent(), I); |
|
7150 + Builder->SetInsertPoint(I); |
|
7151 Builder->SetCurrentDebugLocation(I->getDebugLoc()); |
|
7152 |
|
7153 #ifndef NDEBUG |
|
7154 @@ -2914,7 +2914,7 @@ |
|
7155 |
|
7156 // Insert the new instruction into the basic block... |
|
7157 BasicBlock *InstParent = I->getParent(); |
|
7158 - BasicBlock::iterator InsertPos = I; |
|
7159 + BasicBlock::iterator InsertPos = I->getIterator(); |
|
7160 |
|
7161 // If we replace a PHI with something that isn't a PHI, fix up the |
|
7162 // insertion point. |
|
7163 --- lib/Transforms/Instrumentation/AddressSanitizer.cpp 2015-02-03 10:58:33.000000000 -0800 |
|
7164 +++ lib/Transforms/Instrumentation/AddressSanitizer.cpp 2016-01-23 20:36:01.000000000 -0800 |
|
7165 @@ -158,10 +158,11 @@ |
|
7166 "this number of memory accesses, use callbacks instead of " |
|
7167 "inline checks (-1 means never use callbacks)."), |
|
7168 cl::Hidden, cl::init(7000)); |
|
7169 +static std::string AsanInitString("__asan_"); |
|
7170 static cl::opt<std::string> ClMemoryAccessCallbackPrefix( |
|
7171 "asan-memory-access-callback-prefix", |
|
7172 cl::desc("Prefix for memory access callbacks"), cl::Hidden, |
|
7173 - cl::init("__asan_")); |
|
7174 + cl::init(AsanInitString)); |
|
7175 static cl::opt<bool> ClInstrumentAllocas("asan-instrument-allocas", |
|
7176 cl::desc("instrument dynamic allocas"), cl::Hidden, cl::init(false)); |
|
7177 |
|
7178 @@ -1007,7 +1008,8 @@ |
|
7179 void AddressSanitizerModule::poisonOneInitializer(Function &GlobalInit, |
|
7180 GlobalValue *ModuleName) { |
|
7181 // Set up the arguments to our poison/unpoison functions. |
|
7182 - IRBuilder<> IRB(GlobalInit.begin()->getFirstInsertionPt()); |
|
7183 + IRBuilder<> IRB(&GlobalInit.front(), |
|
7184 + GlobalInit.front().getFirstInsertionPt()); |
|
7185 |
|
7186 // Add a call to poison all external globals before the given function starts. |
|
7187 Value *ModuleNameAddr = ConstantExpr::getPointerCast(ModuleName, IntptrTy); |
|
7188 @@ -1402,7 +1404,7 @@ |
|
7189 // We cannot just ignore these methods, because they may call other |
|
7190 // instrumented functions. |
|
7191 if (F.getName().find(" load]") != std::string::npos) { |
|
7192 - IRBuilder<> IRB(F.begin()->begin()); |
|
7193 + IRBuilder<> IRB(&F.front(), F.front().begin()); |
|
7194 IRB.CreateCall(AsanInitFunction); |
|
7195 return true; |
|
7196 } |
|
7197 --- lib/Transforms/Instrumentation/BoundsChecking.cpp 2014-04-24 22:29:35.000000000 -0700 |
|
7198 +++ lib/Transforms/Instrumentation/BoundsChecking.cpp 2015-11-30 11:29:13.966151410 -0800 |
|
7199 @@ -108,7 +108,7 @@ |
|
7200 } |
|
7201 ++ChecksAdded; |
|
7202 |
|
7203 - Instruction *Inst = Builder->GetInsertPoint(); |
|
7204 + BasicBlock::iterator Inst = Builder->GetInsertPoint(); |
|
7205 BasicBlock *OldBB = Inst->getParent(); |
|
7206 BasicBlock *Cont = OldBB->splitBasicBlock(Inst); |
|
7207 OldBB->getTerminator()->eraseFromParent(); |
|
7208 --- lib/Transforms/Instrumentation/DataFlowSanitizer.cpp 2014-12-05 13:22:32.000000000 -0800 |
|
7209 +++ lib/Transforms/Instrumentation/DataFlowSanitizer.cpp 2015-11-30 13:39:14.566562460 -0800 |
|
7210 @@ -580,7 +580,7 @@ |
|
7211 DFSanFunction DFSF(*this, F, /*IsNativeABI=*/true); |
|
7212 Function::arg_iterator ValAI = F->arg_begin(), ShadowAI = AI; ++ValAI; |
|
7213 for (unsigned N = FT->getNumParams(); N != 0; ++ValAI, ++ShadowAI, --N) |
|
7214 - DFSF.ValShadowMap[ValAI] = ShadowAI; |
|
7215 + DFSF.ValShadowMap[&*ValAI] = &*ShadowAI; |
|
7216 DFSanVisitor(DFSF).visitCallInst(*CI); |
|
7217 if (!FT->getReturnType()->isVoidTy()) |
|
7218 new StoreInst(DFSF.getShadow(RI->getReturnValue()), |
|
7219 @@ -648,16 +648,16 @@ |
|
7220 |
|
7221 std::vector<Function *> FnsToInstrument; |
|
7222 llvm::SmallPtrSet<Function *, 2> FnsWithNativeABI; |
|
7223 - for (Module::iterator i = M.begin(), e = M.end(); i != e; ++i) { |
|
7224 - if (!i->isIntrinsic() && |
|
7225 - i != DFSanUnionFn && |
|
7226 - i != DFSanCheckedUnionFn && |
|
7227 - i != DFSanUnionLoadFn && |
|
7228 - i != DFSanUnimplementedFn && |
|
7229 - i != DFSanSetLabelFn && |
|
7230 - i != DFSanNonzeroLabelFn && |
|
7231 - i != DFSanVarargWrapperFn) |
|
7232 - FnsToInstrument.push_back(&*i); |
|
7233 + for (Function &i : M) { |
|
7234 + if (!i.isIntrinsic() && |
|
7235 + &i != DFSanUnionFn && |
|
7236 + &i != DFSanCheckedUnionFn && |
|
7237 + &i != DFSanUnionLoadFn && |
|
7238 + &i != DFSanUnimplementedFn && |
|
7239 + &i != DFSanSetLabelFn && |
|
7240 + &i != DFSanNonzeroLabelFn && |
|
7241 + &i != DFSanVarargWrapperFn) |
|
7242 + FnsToInstrument.push_back(&i); |
|
7243 } |
|
7244 |
|
7245 // Give function aliases prefixes when necessary, and build wrappers where the |
|
7246 @@ -715,7 +715,7 @@ |
|
7247 NewFArg = NewF->arg_begin(), |
|
7248 FArgEnd = F.arg_end(); |
|
7249 FArg != FArgEnd; ++FArg, ++NewFArg) { |
|
7250 - FArg->replaceAllUsesWith(NewFArg); |
|
7251 + FArg->replaceAllUsesWith(&*NewFArg); |
|
7252 } |
|
7253 NewF->getBasicBlockList().splice(NewF->begin(), F.getBasicBlockList()); |
|
7254 |
|
7255 @@ -847,7 +847,7 @@ |
|
7256 if (Instruction *I = dyn_cast<Instruction>(V)) |
|
7257 Pos = I->getNextNode(); |
|
7258 else |
|
7259 - Pos = DFSF.F->getEntryBlock().begin(); |
|
7260 + Pos = &DFSF.F->getEntryBlock().front(); |
|
7261 while (isa<PHINode>(Pos) || isa<AllocaInst>(Pos)) |
|
7262 Pos = Pos->getNextNode(); |
|
7263 IRBuilder<> IRB(Pos); |
|
7264 @@ -869,7 +869,7 @@ |
|
7265 if (DFS.ArgTLS) |
|
7266 return ArgTLSPtr = DFS.ArgTLS; |
|
7267 |
|
7268 - IRBuilder<> IRB(F->getEntryBlock().begin()); |
|
7269 + IRBuilder<> IRB(&F->getEntryBlock().front()); |
|
7270 return ArgTLSPtr = IRB.CreateCall(DFS.GetArgTLS); |
|
7271 } |
|
7272 |
|
7273 @@ -879,7 +879,7 @@ |
|
7274 if (DFS.RetvalTLS) |
|
7275 return RetvalTLSPtr = DFS.RetvalTLS; |
|
7276 |
|
7277 - IRBuilder<> IRB(F->getEntryBlock().begin()); |
|
7278 + IRBuilder<> IRB(&F->getEntryBlock().front()); |
|
7279 return RetvalTLSPtr = IRB.CreateCall(DFS.GetRetvalTLS); |
|
7280 } |
|
7281 |
|
7282 @@ -911,7 +911,7 @@ |
|
7283 Function::arg_iterator i = F->arg_begin(); |
|
7284 while (ArgIdx--) |
|
7285 ++i; |
|
7286 - Shadow = i; |
|
7287 + Shadow = &*i; |
|
7288 assert(Shadow->getType() == DFS.ShadowTy); |
|
7289 break; |
|
7290 } |
|
7291 @@ -996,7 +996,7 @@ |
|
7292 Call->addAttribute(2, Attribute::ZExt); |
|
7293 |
|
7294 BasicBlock *Tail = BI->getSuccessor(0); |
|
7295 - PHINode *Phi = PHINode::Create(DFS.ShadowTy, 2, "", Tail->begin()); |
|
7296 + PHINode *Phi = PHINode::Create(DFS.ShadowTy, 2, "", &Tail->front()); |
|
7297 Phi->addIncoming(Call, Call->getParent()); |
|
7298 Phi->addIncoming(V1, Head); |
|
7299 |
|
7300 @@ -1109,7 +1109,7 @@ |
|
7301 Value *ShadowsEq = IRB.CreateICmpEQ(WideShadow, RotShadow); |
|
7302 |
|
7303 BasicBlock *Head = Pos->getParent(); |
|
7304 - BasicBlock *Tail = Head->splitBasicBlock(Pos); |
|
7305 + BasicBlock *Tail = Head->splitBasicBlock(Pos->getIterator()); |
|
7306 |
|
7307 if (DomTreeNode *OldNode = DT.getNode(Head)) { |
|
7308 std::vector<DomTreeNode *> Children(OldNode->begin(), OldNode->end()); |
|
7309 @@ -1476,7 +1476,7 @@ |
|
7310 auto LabelVAAlloca = |
|
7311 new AllocaInst(ArrayType::get(DFSF.DFS.ShadowTy, |
|
7312 CS.arg_size() - FT->getNumParams()), |
|
7313 - "labelva", DFSF.F->getEntryBlock().begin()); |
|
7314 + "labelva", &DFSF.F->getEntryBlock().front()); |
|
7315 |
|
7316 for (unsigned n = 0; i != CS.arg_end(); ++i, ++n) { |
|
7317 auto LabelVAPtr = IRB.CreateStructGEP(LabelVAAlloca, n); |
|
7318 @@ -1490,7 +1490,7 @@ |
|
7319 if (!DFSF.LabelReturnAlloca) { |
|
7320 DFSF.LabelReturnAlloca = |
|
7321 new AllocaInst(DFSF.DFS.ShadowTy, "labelreturn", |
|
7322 - DFSF.F->getEntryBlock().begin()); |
|
7323 + &DFSF.F->getEntryBlock().front()); |
|
7324 } |
|
7325 Args.push_back(DFSF.LabelReturnAlloca); |
|
7326 } |
|
7327 @@ -1529,11 +1529,11 @@ |
|
7328 if (!CS.getType()->isVoidTy()) { |
|
7329 if (InvokeInst *II = dyn_cast<InvokeInst>(CS.getInstruction())) { |
|
7330 if (II->getNormalDest()->getSinglePredecessor()) { |
|
7331 - Next = II->getNormalDest()->begin(); |
|
7332 + Next = &II->getNormalDest()->front(); |
|
7333 } else { |
|
7334 BasicBlock *NewBB = |
|
7335 SplitEdge(II->getParent(), II->getNormalDest(), &DFSF.DFS); |
|
7336 - Next = NewBB->begin(); |
|
7337 + Next = &NewBB->front(); |
|
7338 } |
|
7339 } else { |
|
7340 Next = CS->getNextNode(); |
|
7341 @@ -1568,7 +1568,7 @@ |
|
7342 unsigned VarArgSize = CS.arg_size() - FT->getNumParams(); |
|
7343 ArrayType *VarArgArrayTy = ArrayType::get(DFSF.DFS.ShadowTy, VarArgSize); |
|
7344 AllocaInst *VarArgShadow = |
|
7345 - new AllocaInst(VarArgArrayTy, "", DFSF.F->getEntryBlock().begin()); |
|
7346 + new AllocaInst(VarArgArrayTy, "", &DFSF.F->getEntryBlock().front()); |
|
7347 Args.push_back(IRB.CreateConstGEP2_32(VarArgShadow, 0, 0)); |
|
7348 for (unsigned n = 0; i != e; ++i, ++n) { |
|
7349 IRB.CreateStore(DFSF.getShadow(*i), |
|
7350 --- lib/Transforms/Instrumentation/GCOVProfiling.cpp 2015-05-04 12:18:18.000000000 -0700 |
|
7351 +++ lib/Transforms/Instrumentation/GCOVProfiling.cpp 2016-01-23 20:38:11.000000000 -0800 |
|
7352 @@ -44,8 +44,10 @@ |
|
7353 |
|
7354 #define DEBUG_TYPE "insert-gcov-profiling" |
|
7355 |
|
7356 +static std::string VersionInitString("402*"); |
|
7357 static cl::opt<std::string> |
|
7358 -DefaultGCOVVersion("default-gcov-version", cl::init("402*"), cl::Hidden, |
|
7359 +DefaultGCOVVersion("default-gcov-version", |
|
7360 + cl::init(VersionInitString), cl::Hidden, |
|
7361 cl::ValueRequired); |
|
7362 static cl::opt<bool> DefaultExitBlockBeforeBody("gcov-exit-block-before-body", |
|
7363 cl::init(false), cl::Hidden); |
|
7364 @@ -351,8 +353,8 @@ |
|
7365 std::string EdgeDestinations; |
|
7366 raw_string_ostream EDOS(EdgeDestinations); |
|
7367 Function *F = Blocks.begin()->first->getParent(); |
|
7368 - for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { |
|
7369 - GCOVBlock &Block = getBlock(I); |
|
7370 + for (BasicBlock &I : *F) { |
|
7371 + GCOVBlock &Block = getBlock(&I); |
|
7372 for (int i = 0, e = Block.OutEdges.size(); i != e; ++i) |
|
7373 EDOS << Block.OutEdges[i]->Number; |
|
7374 } |
|
7375 @@ -393,8 +395,8 @@ |
|
7376 // Emit edges between blocks. |
|
7377 if (Blocks.empty()) return; |
|
7378 Function *F = Blocks.begin()->first->getParent(); |
|
7379 - for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { |
|
7380 - GCOVBlock &Block = getBlock(I); |
|
7381 + for (BasicBlock &I : *F) { |
|
7382 + GCOVBlock &Block = getBlock(&I); |
|
7383 if (Block.OutEdges.empty()) continue; |
|
7384 |
|
7385 writeBytes(EdgeTag, 4); |
|
7386 @@ -409,8 +411,8 @@ |
|
7387 } |
|
7388 |
|
7389 // Emit lines for each block. |
|
7390 - for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) { |
|
7391 - getBlock(I).writeOut(); |
|
7392 + for (BasicBlock &I : *F) { |
|
7393 + getBlock(&I).writeOut(); |
|
7394 } |
|
7395 } |
|
7396 |
|
7397 @@ -522,7 +524,7 @@ |
|
7398 GCOVFunction &Func = *Funcs.back(); |
|
7399 |
|
7400 for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |
|
7401 - GCOVBlock &Block = Func.getBlock(BB); |
|
7402 + GCOVBlock &Block = Func.getBlock(&*BB); |
|
7403 TerminatorInst *TI = BB->getTerminator(); |
|
7404 if (int successors = TI->getNumSuccessors()) { |
|
7405 for (int i = 0; i != successors; ++i) { |
|
7406 @@ -618,7 +620,7 @@ |
|
7407 int Successors = isa<ReturnInst>(TI) ? 1 : TI->getNumSuccessors(); |
|
7408 if (Successors) { |
|
7409 if (Successors == 1) { |
|
7410 - IRBuilder<> Builder(BB->getFirstInsertionPt()); |
|
7411 + IRBuilder<> Builder(&*BB->getFirstInsertionPt()); |
|
7412 Value *Counter = Builder.CreateConstInBoundsGEP2_64(Counters, 0, |
|
7413 Edge); |
|
7414 Value *Count = Builder.CreateLoad(Counter); |
|
7415 @@ -637,7 +639,7 @@ |
|
7416 Count = Builder.CreateAdd(Count, Builder.getInt64(1)); |
|
7417 Builder.CreateStore(Count, Counter); |
|
7418 } else { |
|
7419 - ComplexEdgePreds.insert(BB); |
|
7420 + ComplexEdgePreds.insert(&*BB); |
|
7421 for (int i = 0; i != Successors; ++i) |
|
7422 ComplexEdgeSuccs.insert(TI->getSuccessor(i)); |
|
7423 } |
|
7424 @@ -653,13 +655,13 @@ |
|
7425 GlobalVariable *EdgeState = getEdgeStateValue(); |
|
7426 |
|
7427 for (int i = 0, e = ComplexEdgePreds.size(); i != e; ++i) { |
|
7428 - IRBuilder<> Builder(ComplexEdgePreds[i + 1]->getFirstInsertionPt()); |
|
7429 + IRBuilder<> Builder(&*ComplexEdgePreds[i + 1]->getFirstInsertionPt()); |
|
7430 Builder.CreateStore(Builder.getInt32(i), EdgeState); |
|
7431 } |
|
7432 |
|
7433 for (int i = 0, e = ComplexEdgeSuccs.size(); i != e; ++i) { |
|
7434 // Call runtime to perform increment. |
|
7435 - IRBuilder<> Builder(ComplexEdgeSuccs[i+1]->getFirstInsertionPt()); |
|
7436 + IRBuilder<> Builder(&*ComplexEdgeSuccs[i + 1]->getFirstInsertionPt()); |
|
7437 Value *CounterPtrArray = |
|
7438 Builder.CreateConstInBoundsGEP2_64(EdgeTable, 0, |
|
7439 i * ComplexEdgePreds.size()); |
|
7440 @@ -743,8 +745,8 @@ |
|
7441 IRBuilder<> Builder(Succ); |
|
7442 Value *Counter = Builder.CreateConstInBoundsGEP2_64(Counters, 0, |
|
7443 Edge + i); |
|
7444 - EdgeTable[((Succs.idFor(Succ)-1) * Preds.size()) + |
|
7445 - (Preds.idFor(BB)-1)] = cast<Constant>(Counter); |
|
7446 + EdgeTable[((Succs.idFor(Succ) - 1) * Preds.size()) + |
|
7447 + (Preds.idFor(&*BB) - 1)] = cast<Constant>(Counter); |
|
7448 } |
|
7449 } |
|
7450 Edge += Successors; |
|
7451 @@ -913,7 +915,7 @@ |
|
7452 |
|
7453 // uint32_t pred = *predecessor; |
|
7454 // if (pred == 0xffffffff) return; |
|
7455 - Argument *Arg = Fn->arg_begin(); |
|
7456 + Argument *Arg = &*Fn->arg_begin(); |
|
7457 Arg->setName("predecessor"); |
|
7458 Value *Pred = Builder.CreateLoad(Arg, "pred"); |
|
7459 Value *Cond = Builder.CreateICmpEQ(Pred, Builder.getInt32(0xffffffff)); |
|
7460 @@ -924,7 +926,7 @@ |
|
7461 // uint64_t *counter = counters[pred]; |
|
7462 // if (!counter) return; |
|
7463 Value *ZExtPred = Builder.CreateZExt(Pred, Builder.getInt64Ty()); |
|
7464 - Arg = std::next(Fn->arg_begin()); |
|
7465 + Arg = &*std::next(Fn->arg_begin()); |
|
7466 Arg->setName("counters"); |
|
7467 Value *GEP = Builder.CreateGEP(Arg, ZExtPred); |
|
7468 Value *Counter = Builder.CreateLoad(GEP, "counter"); |
|
7469 --- lib/Transforms/Instrumentation/InstrProfiling.cpp 2015-02-10 20:41:09.000000000 -0800 |
|
7470 +++ lib/Transforms/Instrumentation/InstrProfiling.cpp 2015-11-30 19:51:07.408467787 -0800 |
|
7471 @@ -143,7 +143,7 @@ |
|
7472 void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) { |
|
7473 GlobalVariable *Counters = getOrCreateRegionCounters(Inc); |
|
7474 |
|
7475 - IRBuilder<> Builder(Inc->getParent(), *Inc); |
|
7476 + IRBuilder<> Builder(Inc); |
|
7477 uint64_t Index = Inc->getIndex()->getZExtValue(); |
|
7478 llvm::Value *Addr = Builder.CreateConstInBoundsGEP2_64(Counters, 0, Index); |
|
7479 llvm::Value *Count = Builder.CreateLoad(Addr, "pgocount"); |
|
7480 --- lib/Transforms/Instrumentation/MemorySanitizer.cpp 2015-02-06 14:06:43.000000000 -0800 |
|
7481 +++ lib/Transforms/Instrumentation/MemorySanitizer.cpp 2015-11-30 19:55:19.370562015 -0800 |
|
7482 @@ -603,7 +603,7 @@ |
|
7483 Value *Cmp = IRB.CreateICmpNE( |
|
7484 ConvertedShadow, getCleanShadow(ConvertedShadow), "_mscmp"); |
|
7485 Instruction *CheckTerm = SplitBlockAndInsertIfThen( |
|
7486 - Cmp, IRB.GetInsertPoint(), false, MS.OriginStoreWeights); |
|
7487 + Cmp, &*IRB.GetInsertPoint(), false, MS.OriginStoreWeights); |
|
7488 IRBuilder<> IRBNew(CheckTerm); |
|
7489 IRBNew.CreateAlignedStore(updateOrigin(Origin, IRBNew), |
|
7490 getOriginPtr(Addr, IRBNew, Alignment), |
|
7491 @@ -2396,9 +2396,10 @@ |
|
7492 // Until we have full dynamic coverage, make sure the retval shadow is 0. |
|
7493 Value *Base = getShadowPtrForRetval(&I, IRBBefore); |
|
7494 IRBBefore.CreateAlignedStore(getCleanShadow(&I), Base, kShadowTLSAlignment); |
|
7495 - Instruction *NextInsn = nullptr; |
|
7496 + BasicBlock::iterator NextInsn; |
|
7497 if (CS.isCall()) { |
|
7498 - NextInsn = I.getNextNode(); |
|
7499 + NextInsn = ++I.getIterator(); |
|
7500 + assert(NextInsn != I.getParent()->end()); |
|
7501 } else { |
|
7502 BasicBlock *NormalDest = cast<InvokeInst>(&I)->getNormalDest(); |
|
7503 if (!NormalDest->getSinglePredecessor()) { |
|
7504 @@ -2410,10 +2411,10 @@ |
|
7505 return; |
|
7506 } |
|
7507 NextInsn = NormalDest->getFirstInsertionPt(); |
|
7508 - assert(NextInsn && |
|
7509 + assert(NextInsn != NormalDest->end() && |
|
7510 "Could not find insertion point for retval shadow load"); |
|
7511 } |
|
7512 - IRBuilder<> IRBAfter(NextInsn); |
|
7513 + IRBuilder<> IRBAfter(&*NextInsn); |
|
7514 Value *RetvalShadow = |
|
7515 IRBAfter.CreateAlignedLoad(getShadowPtrForRetval(&I, IRBAfter), |
|
7516 kShadowTLSAlignment, "_msret"); |
|
7517 --- lib/Transforms/Instrumentation/SanitizerCoverage.cpp 2015-01-02 16:54:43.000000000 -0800 |
|
7518 +++ lib/Transforms/Instrumentation/SanitizerCoverage.cpp 2015-11-30 19:58:56.426390313 -0800 |
|
7519 @@ -275,7 +275,8 @@ |
|
7520 bool IsEntryBB = &BB == &F.getEntryBlock(); |
|
7521 DebugLoc EntryLoc = |
|
7522 IsEntryBB ? IP->getDebugLoc().getFnDebugLoc(*C) : IP->getDebugLoc(); |
|
7523 - IRBuilder<> IRB(IP); |
|
7524 + |
|
7525 + IRBuilder<> IRB(&*IP); |
|
7526 IRB.SetCurrentDebugLocation(EntryLoc); |
|
7527 SmallVector<Value *, 1> Indices; |
|
7528 Value *GuardP = IRB.CreateAdd( |
|
7529 @@ -290,7 +291,7 @@ |
|
7530 MDNode::get(*C, None)); |
|
7531 Value *Cmp = IRB.CreateICmpSGE(Constant::getNullValue(Load->getType()), Load); |
|
7532 Instruction *Ins = SplitBlockAndInsertIfThen( |
|
7533 - Cmp, IP, false, MDBuilder(*C).createBranchWeights(1, 100000)); |
|
7534 + Cmp, &*IP, false, MDBuilder(*C).createBranchWeights(1, 100000)); |
|
7535 IRB.SetInsertPoint(Ins); |
|
7536 IRB.SetCurrentDebugLocation(EntryLoc); |
|
7537 // __sanitizer_cov gets the PC of the instruction using GET_CALLER_PC. |
|
7538 @@ -300,7 +301,7 @@ |
|
7539 if (ClExperimentalTracing) { |
|
7540 // Experimental support for tracing. |
|
7541 // Insert a callback with the same guard variable as used for coverage. |
|
7542 - IRB.SetInsertPoint(IP); |
|
7543 + IRB.SetInsertPoint(&*IP); |
|
7544 IRB.CreateCall(IsEntryBB ? SanCovTraceEnter : SanCovTraceBB, GuardP); |
|
7545 } |
|
7546 } |
|
7547 --- lib/Transforms/ObjCARC/DependencyAnalysis.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
7548 +++ lib/Transforms/ObjCARC/DependencyAnalysis.cpp 2015-11-30 20:05:22.864307715 -0800 |
|
7549 @@ -209,7 +209,7 @@ |
|
7550 SmallPtrSetImpl<Instruction *> &DependingInsts, |
|
7551 SmallPtrSetImpl<const BasicBlock *> &Visited, |
|
7552 ProvenanceAnalysis &PA) { |
|
7553 - BasicBlock::iterator StartPos = StartInst; |
|
7554 + BasicBlock::iterator StartPos = StartInst->getIterator(); |
|
7555 |
|
7556 SmallVector<std::pair<BasicBlock *, BasicBlock::iterator>, 4> Worklist; |
|
7557 Worklist.push_back(std::make_pair(StartBB, StartPos)); |
|
7558 @@ -235,7 +235,7 @@ |
|
7559 break; |
|
7560 } |
|
7561 |
|
7562 - Instruction *Inst = --LocalStartPos; |
|
7563 + Instruction *Inst = &*--LocalStartPos; |
|
7564 if (Depends(Flavor, Inst, Arg, PA)) { |
|
7565 DependingInsts.insert(Inst); |
|
7566 break; |
|
7567 --- lib/Transforms/ObjCARC/ObjCARCAPElim.cpp 2014-05-16 13:39:27.000000000 -0700 |
|
7568 +++ lib/Transforms/ObjCARC/ObjCARCAPElim.cpp 2015-11-30 20:09:20.487861680 -0800 |
|
7569 @@ -72,12 +72,9 @@ |
|
7570 if (const Function *Callee = CS.getCalledFunction()) { |
|
7571 if (Callee->isDeclaration() || Callee->mayBeOverridden()) |
|
7572 return true; |
|
7573 - for (Function::const_iterator I = Callee->begin(), E = Callee->end(); |
|
7574 - I != E; ++I) { |
|
7575 - const BasicBlock *BB = I; |
|
7576 - for (BasicBlock::const_iterator J = BB->begin(), F = BB->end(); |
|
7577 - J != F; ++J) |
|
7578 - if (ImmutableCallSite JCS = ImmutableCallSite(J)) |
|
7579 + for (const BasicBlock &BB : *Callee) { |
|
7580 + for (const Instruction &I : BB) |
|
7581 + if (ImmutableCallSite JCS = ImmutableCallSite(&I)) |
|
7582 // This recursion depth limit is arbitrary. It's just great |
|
7583 // enough to cover known interesting testcases. |
|
7584 if (Depth < 3 && |
|
7585 @@ -96,7 +93,7 @@ |
|
7586 |
|
7587 Instruction *Push = nullptr; |
|
7588 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { |
|
7589 - Instruction *Inst = I++; |
|
7590 + Instruction *Inst = &*I++; |
|
7591 switch (GetBasicInstructionClass(Inst)) { |
|
7592 case IC_AutoreleasepoolPush: |
|
7593 Push = Inst; |
|
7594 @@ -169,7 +166,7 @@ |
|
7595 if (std::next(F->begin()) != F->end()) |
|
7596 continue; |
|
7597 // Ok, a single-block constructor function definition. Try to optimize it. |
|
7598 - Changed |= OptimizeBB(F->begin()); |
|
7599 + Changed |= OptimizeBB(&F->front()); |
|
7600 } |
|
7601 |
|
7602 return Changed; |
|
7603 --- lib/Transforms/ObjCARC/ObjCARCContract.cpp 2014-11-11 13:30:22.000000000 -0800 |
|
7604 +++ lib/Transforms/ObjCARC/ObjCARCContract.cpp 2015-12-01 09:48:41.817465473 -0800 |
|
7605 @@ -123,9 +123,10 @@ |
|
7606 return false; |
|
7607 |
|
7608 // Check that the call is next to the retain. |
|
7609 - BasicBlock::const_iterator I = Call; |
|
7610 + BasicBlock::const_iterator I = ++Call->getIterator(); |
|
7611 + while (IsNoopInstruction(&*I)) |
|
7612 ++I; |
|
7613 - while (IsNoopInstruction(I)) ++I; |
|
7614 + |
|
7615 if (&*I != Retain) |
|
7616 return false; |
|
7617 |
|
7618 @@ -202,69 +203,166 @@ |
|
7619 return true; |
|
7620 } |
|
7621 |
|
7622 -/// Attempt to merge an objc_release with a store, load, and objc_retain to form |
|
7623 -/// an objc_storeStrong. This can be a little tricky because the instructions |
|
7624 -/// don't always appear in order, and there may be unrelated intervening |
|
7625 -/// instructions. |
|
7626 -void ObjCARCContract::ContractRelease(Instruction *Release, |
|
7627 - inst_iterator &Iter) { |
|
7628 - LoadInst *Load = dyn_cast<LoadInst>(GetObjCArg(Release)); |
|
7629 - if (!Load || !Load->isSimple()) return; |
|
7630 - |
|
7631 - // For now, require everything to be in one basic block. |
|
7632 - BasicBlock *BB = Release->getParent(); |
|
7633 - if (Load->getParent() != BB) return; |
|
7634 |
|
7635 - // Walk down to find the store and the release, which may be in either order. |
|
7636 - BasicBlock::iterator I = Load, End = BB->end(); |
|
7637 - ++I; |
|
7638 - AliasAnalysis::Location Loc = AA->getLocation(Load); |
|
7639 +static StoreInst* findSafeStoreForStoreStrongContraction(LoadInst *Load, |
|
7640 + Instruction *Release, |
|
7641 + ProvenanceAnalysis &PA, |
|
7642 + AliasAnalysis *AA) { |
|
7643 StoreInst *Store = nullptr; |
|
7644 bool SawRelease = false; |
|
7645 - for (; !Store || !SawRelease; ++I) { |
|
7646 - if (I == End) |
|
7647 - return; |
|
7648 |
|
7649 - Instruction *Inst = I; |
|
7650 + // Get the location associated with Load. |
|
7651 + AliasAnalysis::Location Loc = AA->getLocation(Load); |
|
7652 + |
|
7653 + // Walk down to find the store and the release, which may be in either order. |
|
7654 + for (auto I = std::next(BasicBlock::iterator(Load)), |
|
7655 + E = Load->getParent()->end(); |
|
7656 + I != E; ++I) { |
|
7657 + // If we found the store we were looking for and saw the release, |
|
7658 + // break. There is no more work to be done. |
|
7659 + if (Store && SawRelease) |
|
7660 + break; |
|
7661 + |
|
7662 + // Now we know that we have not seen either the store or the release. If I |
|
7663 + // is the release, mark that we saw the release and continue. |
|
7664 + Instruction *Inst = &*I; |
|
7665 if (Inst == Release) { |
|
7666 SawRelease = true; |
|
7667 continue; |
|
7668 } |
|
7669 |
|
7670 - InstructionClass Class = GetBasicInstructionClass(Inst); |
|
7671 - |
|
7672 - // Unrelated retains are harmless. |
|
7673 - if (IsRetain(Class)) |
|
7674 + // Otherwise, we check if Inst is a "good" store. Grab the instruction class |
|
7675 + // of Inst. |
|
7676 + InstructionClass IC = GetBasicInstructionClass(Inst); |
|
7677 + |
|
7678 + // If Inst is an unrelated retain, we don't care about it. |
|
7679 + // |
|
7680 + // TODO: This is one area where the optimization could be made more |
|
7681 + // aggressive. |
|
7682 + if (IsRetain(IC)) |
|
7683 continue; |
|
7684 |
|
7685 + // If we have seen the store, but not the release... |
|
7686 if (Store) { |
|
7687 - // The store is the point where we're going to put the objc_storeStrong, |
|
7688 - // so make sure there are no uses after it. |
|
7689 - if (CanUse(Inst, Load, PA, Class)) |
|
7690 - return; |
|
7691 - } else if (AA->getModRefInfo(Inst, Loc) & AliasAnalysis::Mod) { |
|
7692 - // We are moving the load down to the store, so check for anything |
|
7693 - // else which writes to the memory between the load and the store. |
|
7694 - Store = dyn_cast<StoreInst>(Inst); |
|
7695 - if (!Store || !Store->isSimple()) return; |
|
7696 - if (Store->getPointerOperand() != Loc.Ptr) return; |
|
7697 + // We need to make sure that it is safe to move the release from its |
|
7698 + // current position to the store. This implies proving that any |
|
7699 + // instruction in between Store and the Release conservatively can not use |
|
7700 + // the RCIdentityRoot of Release. If we can prove we can ignore Inst, so |
|
7701 + // continue... |
|
7702 + if (!CanUse(Inst, Load, PA, IC)) { |
|
7703 + continue; |
|
7704 + } |
|
7705 + |
|
7706 + // Otherwise, be conservative and return nullptr. |
|
7707 + return nullptr; |
|
7708 } |
|
7709 + |
|
7710 + // Ok, now we know we have not seen a store yet. See if Inst can write to |
|
7711 + // our load location, if it can not, just ignore the instruction. |
|
7712 + if (!(AA->getModRefInfo(Inst, Loc) & AliasAnalysis::Mod)) |
|
7713 + continue; |
|
7714 + |
|
7715 + Store = dyn_cast<StoreInst>(Inst); |
|
7716 + |
|
7717 + // If Inst can, then check if Inst is a simple store. If Inst is not a |
|
7718 + // store or a store that is not simple, then we have some we do not |
|
7719 + // understand writing to this memory implying we can not move the load |
|
7720 + // over the write to any subsequent store that we may find. |
|
7721 + if (!Store || !Store->isSimple()) |
|
7722 + return nullptr; |
|
7723 + |
|
7724 + // Then make sure that the pointer we are storing to is Ptr. If so, we |
|
7725 + // found our Store! |
|
7726 + if (Store->getPointerOperand() == Loc.Ptr) |
|
7727 + continue; |
|
7728 + |
|
7729 + // Otherwise, we have an unknown store to some other ptr that clobbers |
|
7730 + // Loc.Ptr. Bail! |
|
7731 + return nullptr; |
|
7732 } |
|
7733 |
|
7734 - Value *New = StripPointerCastsAndObjCCalls(Store->getValueOperand()); |
|
7735 + // If we did not find the store or did not see the release, fail. |
|
7736 + if (!Store || !SawRelease) |
|
7737 + return nullptr; |
|
7738 + |
|
7739 + // We succeeded! |
|
7740 + return Store; |
|
7741 +} |
|
7742 + |
|
7743 +static Instruction* |
|
7744 +findRetainForStoreStrongContraction(Value *New, StoreInst *Store, |
|
7745 + Instruction *Release, |
|
7746 + ProvenanceAnalysis &PA) { |
|
7747 + // Walk up from the Store to find the retain. |
|
7748 + BasicBlock::iterator I = Store->getIterator(); |
|
7749 + BasicBlock::iterator Begin = Store->getParent()->begin(); |
|
7750 + while ((I != Begin) && (GetBasicInstructionClass(&*I) != IC_Retain)) { |
|
7751 + Instruction *Inst = &*I; |
|
7752 + |
|
7753 + // This is not exactly correct, but it's non-portable to 3.6.2. |
|
7754 + if (Inst != Release) |
|
7755 + return nullptr; |
|
7756 |
|
7757 - // Walk up to find the retain. |
|
7758 - I = Store; |
|
7759 - BasicBlock::iterator Begin = BB->begin(); |
|
7760 - while (I != Begin && GetBasicInstructionClass(I) != IC_Retain) |
|
7761 --I; |
|
7762 - Instruction *Retain = I; |
|
7763 - if (GetBasicInstructionClass(Retain) != IC_Retain) return; |
|
7764 - if (GetObjCArg(Retain) != New) return; |
|
7765 + } |
|
7766 + |
|
7767 + Instruction *Retain = &*I; |
|
7768 + if (GetBasicInstructionClass(Retain) != IC_Retain) |
|
7769 + return nullptr; |
|
7770 + |
|
7771 + if (GetObjCArg(Retain) != New) |
|
7772 + return nullptr; |
|
7773 + |
|
7774 + return Retain; |
|
7775 +} |
|
7776 + |
|
7777 +/// Attempt to merge an objc_release with a store, load, and objc_retain to form |
|
7778 +/// an objc_storeStrong. This can be a little tricky because the instructions |
|
7779 +/// don't always appear in order, and there may be unrelated intervening |
|
7780 +/// instructions. |
|
7781 +void ObjCARCContract::ContractRelease(Instruction *Release, |
|
7782 + inst_iterator &Iter) { |
|
7783 + // See if we are releasing something that we just loaded. |
|
7784 + auto *Load = dyn_cast<LoadInst>(GetObjCArg(Release)); |
|
7785 + if (!Load || !Load->isSimple()) |
|
7786 + return; |
|
7787 + |
|
7788 + // For now, require everything to be in one basic block. |
|
7789 + BasicBlock *BB = Release->getParent(); |
|
7790 + if (Load->getParent() != BB) |
|
7791 + return; |
|
7792 + |
|
7793 + // First scan down the BB from Load, looking for a store of the RCIdentityRoot |
|
7794 + // of Load's |
|
7795 + StoreInst *Store = |
|
7796 + findSafeStoreForStoreStrongContraction(Load, Release, PA, AA); |
|
7797 + // If we fail, bail. |
|
7798 + if (!Store) |
|
7799 + return; |
|
7800 + |
|
7801 + // Then find what new_value's RCIdentity Root is. |
|
7802 + Value *New = StripPointerCastsAndObjCCalls(Store->getValueOperand()); |
|
7803 + |
|
7804 + // Then walk up the BB and look for a retain on New without any intervening |
|
7805 + // instructions which conservatively might decrement ref counts. |
|
7806 + Instruction *Retain = |
|
7807 + findRetainForStoreStrongContraction(New, Store, Release, PA); |
|
7808 + |
|
7809 + // If we fail, bail. |
|
7810 + if (!Retain) |
|
7811 + return; |
|
7812 |
|
7813 Changed = true; |
|
7814 ++NumStoreStrongs; |
|
7815 |
|
7816 + DEBUG( |
|
7817 + llvm::dbgs() << " Contracting retain, release into objc_storeStrong.\n" |
|
7818 + << " Old:\n" |
|
7819 + << " Store: " << *Store << "\n" |
|
7820 + << " Release: " << *Release << "\n" |
|
7821 + << " Retain: " << *Retain << "\n" |
|
7822 + << " Load: " << *Load << "\n"); |
|
7823 + |
|
7824 LLVMContext &C = Release->getContext(); |
|
7825 Type *I8X = PointerType::getUnqual(Type::getInt8Ty(C)); |
|
7826 Type *I8XX = PointerType::getUnqual(I8X); |
|
7827 @@ -274,6 +372,7 @@ |
|
7828 Args[0] = new BitCastInst(Args[0], I8XX, "", Store); |
|
7829 if (Args[1]->getType() != I8X) |
|
7830 Args[1] = new BitCastInst(Args[1], I8X, "", Store); |
|
7831 + |
|
7832 Constant *Decl = EP.get(ARCRuntimeEntryPoints::EPT_StoreStrong); |
|
7833 CallInst *StoreStrong = CallInst::Create(Decl, Args, "", Store); |
|
7834 StoreStrong->setDoesNotThrow(); |
|
7835 @@ -284,7 +383,11 @@ |
|
7836 // we can set the tail flag once we know it's safe. |
|
7837 StoreStrongCalls.insert(StoreStrong); |
|
7838 |
|
7839 - if (&*Iter == Store) ++Iter; |
|
7840 + DEBUG(llvm::dbgs() << " New Store Strong: " << *StoreStrong << "\n"); |
|
7841 + |
|
7842 + if (&*Iter == Store) |
|
7843 + ++Iter; |
|
7844 + |
|
7845 Store->eraseFromParent(); |
|
7846 Release->eraseFromParent(); |
|
7847 EraseInstruction(Retain); |
|
7848 @@ -371,7 +474,8 @@ |
|
7849 // insert it now. |
|
7850 if (!RetainRVMarker) |
|
7851 break; |
|
7852 - BasicBlock::iterator BBI = Inst; |
|
7853 + |
|
7854 + BasicBlock::iterator BBI = Inst->getIterator(); |
|
7855 BasicBlock *InstParent = Inst->getParent(); |
|
7856 |
|
7857 // Step up to see if the call immediately precedes the RetainRV call. |
|
7858 @@ -382,11 +486,11 @@ |
|
7859 BasicBlock *Pred = InstParent->getSinglePredecessor(); |
|
7860 if (!Pred) |
|
7861 goto decline_rv_optimization; |
|
7862 - BBI = Pred->getTerminator(); |
|
7863 + BBI = Pred->getTerminator()->getIterator(); |
|
7864 break; |
|
7865 } |
|
7866 --BBI; |
|
7867 - } while (IsNoopInstruction(BBI)); |
|
7868 + } while (IsNoopInstruction(&*BBI)); |
|
7869 |
|
7870 if (&*BBI == GetObjCArg(Inst)) { |
|
7871 DEBUG(dbgs() << "ObjCARCContract: Adding inline asm marker for " |
|
7872 --- lib/Transforms/ObjCARC/ObjCARCOpts.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
7873 +++ lib/Transforms/ObjCARC/ObjCARCOpts.cpp 2016-01-23 21:53:49.000000000 -0800 |
|
7874 @@ -798,19 +798,22 @@ |
|
7875 |
|
7876 /// Enable/disable ARC sequence annotations. |
|
7877 static cl::opt<bool> |
|
7878 -EnableARCAnnotations("enable-objc-arc-annotations", cl::init(false), |
|
7879 +EnableARCAnnotations("enable-objc-arc-annotations", |
|
7880 cl::desc("Enable emission of arc data flow analysis " |
|
7881 - "annotations")); |
|
7882 + "annotations"), |
|
7883 + cl::init(false)); |
|
7884 static cl::opt<bool> |
|
7885 -DisableCheckForCFGHazards("disable-objc-arc-checkforcfghazards", cl::init(false), |
|
7886 +DisableCheckForCFGHazards("disable-objc-arc-checkforcfghazards", |
|
7887 cl::desc("Disable check for cfg hazards when " |
|
7888 - "annotating")); |
|
7889 + "annotating"), |
|
7890 + cl::init(false)); |
|
7891 +static std::string EmptyInitString(""); |
|
7892 static cl::opt<std::string> |
|
7893 ARCAnnotationTargetIdentifier("objc-arc-annotation-target-identifier", |
|
7894 - cl::init(""), |
|
7895 cl::desc("filter out all data flow annotations " |
|
7896 "but those that apply to the given " |
|
7897 - "target llvm identifier.")); |
|
7898 + "target llvm identifier."), |
|
7899 + cl::init(EmptyInitString)); |
|
7900 |
|
7901 /// This function appends a unique ARCAnnotationProvenanceSourceMDKind id to an |
|
7902 /// instruction so that we can track backwards when post processing via the llvm |
|
7903 @@ -1195,16 +1198,17 @@ |
|
7904 ImmutableCallSite CS(Arg); |
|
7905 if (const Instruction *Call = CS.getInstruction()) { |
|
7906 if (Call->getParent() == RetainRV->getParent()) { |
|
7907 - BasicBlock::const_iterator I = Call; |
|
7908 + BasicBlock::const_iterator I(Call); |
|
7909 ++I; |
|
7910 - while (IsNoopInstruction(I)) ++I; |
|
7911 + while (IsNoopInstruction(&*I)) ++I; |
|
7912 if (&*I == RetainRV) |
|
7913 return false; |
|
7914 } else if (const InvokeInst *II = dyn_cast<InvokeInst>(Call)) { |
|
7915 BasicBlock *RetainRVParent = RetainRV->getParent(); |
|
7916 if (II->getNormalDest() == RetainRVParent) { |
|
7917 BasicBlock::const_iterator I = RetainRVParent->begin(); |
|
7918 - while (IsNoopInstruction(I)) ++I; |
|
7919 + while (IsNoopInstruction(&*I)) |
|
7920 + ++I; |
|
7921 if (&*I == RetainRV) |
|
7922 return false; |
|
7923 } |
|
7924 @@ -1213,18 +1217,21 @@ |
|
7925 |
|
7926 // Check for being preceded by an objc_autoreleaseReturnValue on the same |
|
7927 // pointer. In this case, we can delete the pair. |
|
7928 - BasicBlock::iterator I = RetainRV, Begin = RetainRV->getParent()->begin(); |
|
7929 + BasicBlock::iterator I = RetainRV->getIterator(), |
|
7930 + Begin = RetainRV->getParent()->begin(); |
|
7931 if (I != Begin) { |
|
7932 - do --I; while (I != Begin && IsNoopInstruction(I)); |
|
7933 - if (GetBasicInstructionClass(I) == IC_AutoreleaseRV && |
|
7934 - GetObjCArg(I) == Arg) { |
|
7935 + do |
|
7936 + --I; |
|
7937 + while (I != Begin && IsNoopInstruction(&*I)); |
|
7938 + if (GetBasicInstructionClass(&*I) == IC_AutoreleaseRV && |
|
7939 + GetObjCArg(&*I) == Arg) { |
|
7940 Changed = true; |
|
7941 ++NumPeeps; |
|
7942 |
|
7943 DEBUG(dbgs() << "Erasing autoreleaseRV,retainRV pair: " << *I << "\n" |
|
7944 << "Erasing " << *RetainRV << "\n"); |
|
7945 |
|
7946 - EraseInstruction(I); |
|
7947 + EraseInstruction(&*I); |
|
7948 EraseInstruction(RetainRV); |
|
7949 return true; |
|
7950 } |
|
7951 @@ -1861,9 +1868,9 @@ |
|
7952 // one of its successor blocks, since we can't insert code after it |
|
7953 // in its own block, and we don't want to split critical edges. |
|
7954 if (isa<InvokeInst>(Inst)) |
|
7955 - S.InsertReverseInsertPt(BB->getFirstInsertionPt()); |
|
7956 + S.InsertReverseInsertPt(&*BB->getFirstInsertionPt()); |
|
7957 else |
|
7958 - S.InsertReverseInsertPt(std::next(BasicBlock::iterator(Inst))); |
|
7959 + S.InsertReverseInsertPt(&*++Inst->getIterator()); |
|
7960 S.SetSeq(S_Use); |
|
7961 ANNOTATE_BOTTOMUP(Inst, Ptr, Seq, S_Use); |
|
7962 } else if (Seq == S_Release && IsUser(Class)) { |
|
7963 @@ -1875,9 +1882,9 @@ |
|
7964 assert(!S.HasReverseInsertPts()); |
|
7965 // As above; handle invoke specially. |
|
7966 if (isa<InvokeInst>(Inst)) |
|
7967 - S.InsertReverseInsertPt(BB->getFirstInsertionPt()); |
|
7968 + S.InsertReverseInsertPt(&*BB->getFirstInsertionPt()); |
|
7969 else |
|
7970 - S.InsertReverseInsertPt(std::next(BasicBlock::iterator(Inst))); |
|
7971 + S.InsertReverseInsertPt(&*++Inst->getIterator()); |
|
7972 } |
|
7973 break; |
|
7974 case S_Stop: |
|
7975 @@ -1934,7 +1941,7 @@ |
|
7976 |
|
7977 // Visit all the instructions, bottom-up. |
|
7978 for (BasicBlock::iterator I = BB->end(), E = BB->begin(); I != E; --I) { |
|
7979 - Instruction *Inst = std::prev(I); |
|
7980 + Instruction *Inst = &*std::prev(I); |
|
7981 |
|
7982 // Invoke instructions are visited as part of their successors (below). |
|
7983 if (isa<InvokeInst>(Inst)) |
|
7984 @@ -2144,7 +2151,7 @@ |
|
7985 |
|
7986 // Visit all the instructions, top-down. |
|
7987 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { |
|
7988 - Instruction *Inst = I; |
|
7989 + Instruction *Inst = &*I; |
|
7990 |
|
7991 DEBUG(dbgs() << "Visiting " << *Inst << "\n"); |
|
7992 |
|
7993 @@ -2219,7 +2226,7 @@ |
|
7994 // as exits due to ignored edges. |
|
7995 SmallVector<std::pair<BasicBlock *, BBState::edge_iterator>, 16> PredStack; |
|
7996 for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { |
|
7997 - BasicBlock *ExitBB = I; |
|
7998 + BasicBlock *ExitBB = &*I; |
|
7999 BBState &MyStates = BBStates[ExitBB]; |
|
8000 if (!MyStates.isExit()) |
|
8001 continue; |
|
8002 @@ -2655,7 +2662,7 @@ |
|
8003 // analysis too, but that would want caching. A better approach would be to |
|
8004 // use the technique that EarlyCSE uses. |
|
8005 inst_iterator Current = std::prev(I); |
|
8006 - BasicBlock *CurrentBB = Current.getBasicBlockIterator(); |
|
8007 + BasicBlock *CurrentBB = &*Current.getBasicBlockIterator(); |
|
8008 for (BasicBlock::iterator B = CurrentBB->begin(), |
|
8009 J = Current.getInstructionIterator(); |
|
8010 J != B; --J) { |
|
8011 @@ -2910,9 +2917,8 @@ |
|
8012 |
|
8013 SmallPtrSet<Instruction *, 4> DependingInstructions; |
|
8014 SmallPtrSet<const BasicBlock *, 4> Visited; |
|
8015 - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) { |
|
8016 - BasicBlock *BB = FI; |
|
8017 - ReturnInst *Ret = dyn_cast<ReturnInst>(&BB->back()); |
|
8018 + for (BasicBlock &BB: F) { |
|
8019 + ReturnInst *Ret = dyn_cast<ReturnInst>(&BB.back()); |
|
8020 |
|
8021 DEBUG(dbgs() << "Visiting: " << *Ret << "\n"); |
|
8022 |
|
8023 @@ -2925,7 +2931,7 @@ |
|
8024 // dependent on Arg such that there are no instructions dependent on Arg |
|
8025 // that need a positive ref count in between the autorelease and Ret. |
|
8026 CallInst *Autorelease = |
|
8027 - FindPredecessorAutoreleaseWithSafePath(Arg, BB, Ret, |
|
8028 + FindPredecessorAutoreleaseWithSafePath(Arg, &BB, Ret, |
|
8029 DependingInstructions, Visited, |
|
8030 PA); |
|
8031 DependingInstructions.clear(); |
|
8032 @@ -2935,7 +2941,7 @@ |
|
8033 continue; |
|
8034 |
|
8035 CallInst *Retain = |
|
8036 - FindPredecessorRetainWithSafePath(Arg, BB, Autorelease, |
|
8037 + FindPredecessorRetainWithSafePath(Arg, &BB, Autorelease, |
|
8038 DependingInstructions, Visited, PA); |
|
8039 DependingInstructions.clear(); |
|
8040 Visited.clear(); |
|
8041 --- lib/Transforms/ObjCARC/ObjCARCUtil.cpp 2013-07-10 11:49:00.000000000 -0700 |
|
8042 +++ lib/Transforms/ObjCARC/ObjCARCUtil.cpp 2015-12-06 09:20:57.733406625 -0800 |
|
8043 @@ -91,7 +91,9 @@ |
|
8044 .Default(IC_CallOrUser); |
|
8045 |
|
8046 // One argument. |
|
8047 - const Argument *A0 = AI++; |
|
8048 + const Argument *A0 = &*AI; |
|
8049 + ++AI; |
|
8050 + |
|
8051 if (AI == AE) |
|
8052 // Argument is a pointer. |
|
8053 if (PointerType *PTy = dyn_cast<PointerType>(A0->getType())) { |
|
8054 @@ -127,7 +129,9 @@ |
|
8055 } |
|
8056 |
|
8057 // Two arguments, first is i8**. |
|
8058 - const Argument *A1 = AI++; |
|
8059 + const Argument *A1 = &*AI; |
|
8060 + ++AI; |
|
8061 + |
|
8062 if (AI == AE) |
|
8063 if (PointerType *PTy = dyn_cast<PointerType>(A0->getType())) |
|
8064 if (PointerType *Pte = dyn_cast<PointerType>(PTy->getElementType())) |
|
8065 --- lib/Transforms/Scalar/ADCE.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
8066 +++ lib/Transforms/Scalar/ADCE.cpp 2015-11-28 19:38:59.304881103 -0800 |
|
8067 @@ -63,8 +63,8 @@ |
|
8068 isa<DbgInfoIntrinsic>(I.getInstructionIterator()) || |
|
8069 isa<LandingPadInst>(I.getInstructionIterator()) || |
|
8070 I->mayHaveSideEffects()) { |
|
8071 - alive.insert(I.getInstructionIterator()); |
|
8072 - worklist.push_back(I.getInstructionIterator()); |
|
8073 + alive.insert(&*I); |
|
8074 + worklist.push_back(&*I); |
|
8075 } |
|
8076 |
|
8077 // Propagate liveness backwards to operands. |
|
8078 @@ -82,8 +82,8 @@ |
|
8079 // value of the function, and may therefore be deleted safely. |
|
8080 // NOTE: We reuse the worklist vector here for memory efficiency. |
|
8081 for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) |
|
8082 - if (!alive.count(I.getInstructionIterator())) { |
|
8083 - worklist.push_back(I.getInstructionIterator()); |
|
8084 + if (!alive.count(&*I)) { |
|
8085 + worklist.push_back(&*I); |
|
8086 I->dropAllReferences(); |
|
8087 } |
|
8088 |
|
8089 --- lib/Transforms/Scalar/ConstantHoisting.cpp 2014-10-04 09:55:56.000000000 -0700 |
|
8090 +++ lib/Transforms/Scalar/ConstantHoisting.cpp 2015-11-28 19:44:37.366065720 -0800 |
|
8091 @@ -361,9 +361,9 @@ |
|
8092 /// into an instruction itself. |
|
8093 void ConstantHoisting::collectConstantCandidates(Function &Fn) { |
|
8094 ConstCandMapType ConstCandMap; |
|
8095 - for (Function::iterator BB : Fn) |
|
8096 - for (BasicBlock::iterator Inst : *BB) |
|
8097 - collectConstantCandidates(ConstCandMap, Inst); |
|
8098 + for (BasicBlock &BB : Fn) |
|
8099 + for (Instruction &Inst : BB) |
|
8100 + collectConstantCandidates(ConstCandMap, &Inst); |
|
8101 } |
|
8102 |
|
8103 /// \brief Find the base constant within the given range and rebase all other |
|
8104 --- lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 2014-09-07 13:29:59.000000000 -0700 |
|
8105 +++ lib/Transforms/Scalar/CorrelatedValuePropagation.cpp 2015-11-28 19:45:51.045707253 -0800 |
|
8106 @@ -296,7 +296,8 @@ |
|
8107 for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) { |
|
8108 bool BBChanged = false; |
|
8109 for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ) { |
|
8110 - Instruction *II = BI++; |
|
8111 + Instruction *II = &*BI; |
|
8112 + ++BI; |
|
8113 switch (II->getOpcode()) { |
|
8114 case Instruction::Select: |
|
8115 BBChanged |= processSelect(cast<SelectInst>(II)); |
|
8116 --- lib/Transforms/Scalar/DCE.cpp 2014-04-21 19:55:47.000000000 -0700 |
|
8117 +++ lib/Transforms/Scalar/DCE.cpp 2015-11-28 19:46:43.738032658 -0800 |
|
8118 @@ -45,7 +45,8 @@ |
|
8119 TargetLibraryInfo *TLI = getAnalysisIfAvailable<TargetLibraryInfo>(); |
|
8120 bool Changed = false; |
|
8121 for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); ) { |
|
8122 - Instruction *Inst = DI++; |
|
8123 + Instruction *Inst = &*DI; |
|
8124 + ++DI; |
|
8125 if (isInstructionTriviallyDead(Inst, TLI)) { |
|
8126 Inst->eraseFromParent(); |
|
8127 Changed = true; |
|
8128 --- lib/Transforms/Scalar/DeadStoreElimination.cpp 2014-10-17 04:56:00.000000000 -0700 |
|
8129 +++ lib/Transforms/Scalar/DeadStoreElimination.cpp 2015-11-28 20:06:21.344415630 -0800 |
|
8130 @@ -64,11 +64,11 @@ |
|
8131 TLI = AA->getTargetLibraryInfo(); |
|
8132 |
|
8133 bool Changed = false; |
|
8134 - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) |
|
8135 + for (BasicBlock &I : F) |
|
8136 // Only check non-dead blocks. Dead blocks may have strange pointer |
|
8137 // cycles that will confuse alias analysis. |
|
8138 - if (DT->isReachableFromEntry(I)) |
|
8139 - Changed |= runOnBasicBlock(*I); |
|
8140 + if (DT->isReachableFromEntry(&I)) |
|
8141 + Changed |= runOnBasicBlock(I); |
|
8142 |
|
8143 AA = nullptr; MD = nullptr; DT = nullptr; |
|
8144 return Changed; |
|
8145 @@ -488,7 +488,8 @@ |
|
8146 |
|
8147 // Do a top-down walk on the BB. |
|
8148 for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); BBI != BBE; ) { |
|
8149 - Instruction *Inst = BBI++; |
|
8150 + Instruction *Inst = &*BBI; |
|
8151 + ++BBI; |
|
8152 |
|
8153 // Handle 'free' calls specially. |
|
8154 if (CallInst *F = isFreeCall(Inst, TLI)) { |
|
8155 @@ -518,7 +519,7 @@ |
|
8156 |
|
8157 // DeleteDeadInstruction can delete the current instruction. Save BBI |
|
8158 // in case we need it. |
|
8159 - WeakVH NextInst(BBI); |
|
8160 + WeakVH NextInst(&*BBI); |
|
8161 |
|
8162 DeleteDeadInstruction(SI, *MD, TLI); |
|
8163 |
|
8164 @@ -573,7 +574,7 @@ |
|
8165 |
|
8166 // DeleteDeadInstruction can delete the current instruction in loop |
|
8167 // cases, reset BBI. |
|
8168 - BBI = Inst; |
|
8169 + BBI = Inst->getIterator(); |
|
8170 if (BBI != BB.begin()) |
|
8171 --BBI; |
|
8172 break; |
|
8173 @@ -619,7 +620,8 @@ |
|
8174 if (AA->getModRefInfo(DepWrite, Loc) & AliasAnalysis::Ref) |
|
8175 break; |
|
8176 |
|
8177 - InstDep = MD->getPointerDependencyFrom(Loc, false, DepWrite, &BB); |
|
8178 + InstDep = MD->getPointerDependencyFrom(Loc, false, |
|
8179 + DepWrite->getIterator(), &BB); |
|
8180 } |
|
8181 } |
|
8182 |
|
8183 @@ -661,7 +663,8 @@ |
|
8184 Instruction *InstPt = BB->getTerminator(); |
|
8185 if (BB == F->getParent()) InstPt = F; |
|
8186 |
|
8187 - MemDepResult Dep = MD->getPointerDependencyFrom(Loc, false, InstPt, BB); |
|
8188 + MemDepResult Dep = MD->getPointerDependencyFrom(Loc, false, |
|
8189 + InstPt->getIterator(), BB); |
|
8190 while (Dep.isDef() || Dep.isClobber()) { |
|
8191 Instruction *Dependency = Dep.getInst(); |
|
8192 if (!hasMemoryWrite(Dependency, TLI) || !isRemovable(Dependency)) |
|
8193 @@ -674,7 +677,7 @@ |
|
8194 if (!AA->isMustAlias(F->getArgOperand(0), DepPointer)) |
|
8195 break; |
|
8196 |
|
8197 - Instruction *Next = std::next(BasicBlock::iterator(Dependency)); |
|
8198 + Instruction *Next = &*std::next(BasicBlock::iterator(Dependency)); |
|
8199 |
|
8200 // DCE instructions only used to calculate that store |
|
8201 DeleteDeadInstruction(Dependency, *MD, TLI); |
|
8202 @@ -686,7 +689,7 @@ |
|
8203 // s[0] = 0; |
|
8204 // s[1] = 0; // This has just been deleted. |
|
8205 // free(s); |
|
8206 - Dep = MD->getPointerDependencyFrom(Loc, false, Next, BB); |
|
8207 + Dep = MD->getPointerDependencyFrom(Loc, false, Next->getIterator(), BB); |
|
8208 } |
|
8209 |
|
8210 if (Dep.isNonLocal()) |
|
8211 @@ -710,33 +713,32 @@ |
|
8212 SmallSetVector<Value*, 16> DeadStackObjects; |
|
8213 |
|
8214 // Find all of the alloca'd pointers in the entry block. |
|
8215 - BasicBlock *Entry = BB.getParent()->begin(); |
|
8216 - for (BasicBlock::iterator I = Entry->begin(), E = Entry->end(); I != E; ++I) { |
|
8217 - if (isa<AllocaInst>(I)) |
|
8218 - DeadStackObjects.insert(I); |
|
8219 + BasicBlock &Entry = BB.getParent()->front(); |
|
8220 + for (Instruction &I : Entry) { |
|
8221 + if (isa<AllocaInst>(&I)) |
|
8222 + DeadStackObjects.insert(&I); |
|
8223 |
|
8224 // Okay, so these are dead heap objects, but if the pointer never escapes |
|
8225 // then it's leaked by this function anyways. |
|
8226 - else if (isAllocLikeFn(I, TLI) && !PointerMayBeCaptured(I, true, true)) |
|
8227 - DeadStackObjects.insert(I); |
|
8228 + else if (isAllocLikeFn(&I, TLI) && !PointerMayBeCaptured(&I, true, true)) |
|
8229 + DeadStackObjects.insert(&I); |
|
8230 } |
|
8231 |
|
8232 // Treat byval or inalloca arguments the same, stores to them are dead at the |
|
8233 // end of the function. |
|
8234 - for (Function::arg_iterator AI = BB.getParent()->arg_begin(), |
|
8235 - AE = BB.getParent()->arg_end(); AI != AE; ++AI) |
|
8236 - if (AI->hasByValOrInAllocaAttr()) |
|
8237 - DeadStackObjects.insert(AI); |
|
8238 + for (Argument &AI : BB.getParent()->args()) |
|
8239 + if (AI.hasByValOrInAllocaAttr()) |
|
8240 + DeadStackObjects.insert(&AI); |
|
8241 |
|
8242 // Scan the basic block backwards |
|
8243 for (BasicBlock::iterator BBI = BB.end(); BBI != BB.begin(); ){ |
|
8244 --BBI; |
|
8245 |
|
8246 // If we find a store, check to see if it points into a dead stack value. |
|
8247 - if (hasMemoryWrite(BBI, TLI) && isRemovable(BBI)) { |
|
8248 + if (hasMemoryWrite(&*BBI, TLI) && isRemovable(&*BBI)) { |
|
8249 // See through pointer-to-pointer bitcasts |
|
8250 SmallVector<Value *, 4> Pointers; |
|
8251 - GetUnderlyingObjects(getStoredPointerOperand(BBI), Pointers); |
|
8252 + GetUnderlyingObjects(getStoredPointerOperand(&*BBI), Pointers); |
|
8253 |
|
8254 // Stores to stack values are valid candidates for removal. |
|
8255 bool AllDead = true; |
|
8256 @@ -748,7 +750,8 @@ |
|
8257 } |
|
8258 |
|
8259 if (AllDead) { |
|
8260 - Instruction *Dead = BBI++; |
|
8261 + Instruction *Dead = &*BBI; |
|
8262 + ++BBI; |
|
8263 |
|
8264 DEBUG(dbgs() << "DSE: Dead Store at End of Block:\n DEAD: " |
|
8265 << *Dead << "\n Objects: "; |
|
8266 @@ -769,8 +772,9 @@ |
|
8267 } |
|
8268 |
|
8269 // Remove any dead non-memory-mutating instructions. |
|
8270 - if (isInstructionTriviallyDead(BBI, TLI)) { |
|
8271 - Instruction *Inst = BBI++; |
|
8272 + if (isInstructionTriviallyDead(&*BBI, TLI)) { |
|
8273 + Instruction *Inst = &*BBI; |
|
8274 + ++BBI; |
|
8275 DeleteDeadInstruction(Inst, *MD, TLI, &DeadStackObjects); |
|
8276 ++NumFastOther; |
|
8277 MadeChange = true; |
|
8278 @@ -780,15 +784,15 @@ |
|
8279 if (isa<AllocaInst>(BBI)) { |
|
8280 // Remove allocas from the list of dead stack objects; there can't be |
|
8281 // any references before the definition. |
|
8282 - DeadStackObjects.remove(BBI); |
|
8283 + DeadStackObjects.remove(&*BBI); |
|
8284 continue; |
|
8285 } |
|
8286 |
|
8287 if (CallSite CS = cast<Value>(BBI)) { |
|
8288 // Remove allocation function calls from the list of dead stack objects; |
|
8289 // there can't be any references before the definition. |
|
8290 - if (isAllocLikeFn(BBI, TLI)) |
|
8291 - DeadStackObjects.remove(BBI); |
|
8292 + if (isAllocLikeFn(&*BBI, TLI)) |
|
8293 + DeadStackObjects.remove(&*BBI); |
|
8294 |
|
8295 // If this call does not access memory, it can't be loading any of our |
|
8296 // pointers. |
|
8297 --- lib/Transforms/Scalar/EarlyCSE.cpp 2015-02-10 18:23:00.000000000 -0800 |
|
8298 +++ lib/Transforms/Scalar/EarlyCSE.cpp 2015-11-28 20:08:04.692689072 -0800 |
|
8299 @@ -427,7 +427,8 @@ |
|
8300 // See if any instructions in the block can be eliminated. If so, do it. If |
|
8301 // not, add them to AvailableValues. |
|
8302 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { |
|
8303 - Instruction *Inst = I++; |
|
8304 + Instruction *Inst = &*I; |
|
8305 + ++I; |
|
8306 |
|
8307 // Dead instructions should just be removed. |
|
8308 if (isInstructionTriviallyDead(Inst, TLI)) { |
|
8309 --- lib/Transforms/Scalar/FlattenCFGPass.cpp 2014-04-21 19:55:47.000000000 -0700 |
|
8310 +++ lib/Transforms/Scalar/FlattenCFGPass.cpp 2015-11-28 20:09:20.884486852 -0800 |
|
8311 @@ -59,7 +59,7 @@ |
|
8312 // Loop over all of the basic blocks and remove them if they are unneeded... |
|
8313 // |
|
8314 for (Function::iterator BBIt = F.begin(); BBIt != F.end();) { |
|
8315 - if (FlattenCFG(BBIt++, AA)) { |
|
8316 + if (FlattenCFG(&*BBIt++, AA)) { |
|
8317 LocalChange = true; |
|
8318 } |
|
8319 } |
|
8320 --- lib/Transforms/Scalar/GVN.cpp 2015-05-05 07:43:00.000000000 -0700 |
|
8321 +++ lib/Transforms/Scalar/GVN.cpp 2015-11-28 20:13:21.312881435 -0800 |
|
8322 @@ -1123,7 +1123,7 @@ |
|
8323 uint64_t StoreSize = (DL.getTypeSizeInBits(SrcVal->getType()) + 7) / 8; |
|
8324 uint64_t LoadSize = (DL.getTypeSizeInBits(LoadTy) + 7) / 8; |
|
8325 |
|
8326 - IRBuilder<> Builder(InsertPt->getParent(), InsertPt); |
|
8327 + IRBuilder<> Builder(InsertPt); |
|
8328 |
|
8329 // Compute which bits of the stored value are being used by the load. Convert |
|
8330 // to an integer type to start with. |
|
8331 @@ -1220,7 +1220,7 @@ |
|
8332 LLVMContext &Ctx = LoadTy->getContext(); |
|
8333 uint64_t LoadSize = DL.getTypeSizeInBits(LoadTy)/8; |
|
8334 |
|
8335 - IRBuilder<> Builder(InsertPt->getParent(), InsertPt); |
|
8336 + IRBuilder<> Builder(InsertPt); |
|
8337 |
|
8338 // We know that this method is only called when the mem transfer fully |
|
8339 // provides the bits for the load. |
|
8340 @@ -2372,7 +2372,8 @@ |
|
8341 // Merge unconditional branches, allowing PRE to catch more |
|
8342 // optimization opportunities. |
|
8343 for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ) { |
|
8344 - BasicBlock *BB = FI++; |
|
8345 + BasicBlock *BB = &*FI; |
|
8346 + ++FI; |
|
8347 |
|
8348 bool removedBlock = MergeBlockIntoPredecessor(BB, this); |
|
8349 if (removedBlock) ++NumGVNBlocks; |
|
8350 @@ -2425,7 +2426,7 @@ |
|
8351 |
|
8352 for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); |
|
8353 BI != BE;) { |
|
8354 - ChangedFunction |= processInstruction(BI); |
|
8355 + ChangedFunction |= processInstruction(&*BI); |
|
8356 if (InstrsToErase.empty()) { |
|
8357 ++BI; |
|
8358 continue; |
|
8359 @@ -2580,7 +2581,8 @@ |
|
8360 // Create a PHI to make the value available in this block. |
|
8361 PHINode *Phi = |
|
8362 PHINode::Create(CurInst->getType(), predMap.size(), |
|
8363 - CurInst->getName() + ".pre-phi", CurrentBlock->begin()); |
|
8364 + CurInst->getName() + ".pre-phi", |
|
8365 + &CurrentBlock->front()); |
|
8366 for (unsigned i = 0, e = predMap.size(); i != e; ++i) { |
|
8367 if (Value *V = predMap[i].first) |
|
8368 Phi->addIncoming(V, predMap[i].second); |
|
8369 @@ -2631,7 +2633,8 @@ |
|
8370 for (BasicBlock::iterator BI = CurrentBlock->begin(), |
|
8371 BE = CurrentBlock->end(); |
|
8372 BI != BE;) { |
|
8373 - Instruction *CurInst = BI++; |
|
8374 + Instruction *CurInst = &*BI; |
|
8375 + ++BI; |
|
8376 Changed = performScalarPRE(CurInst); |
|
8377 } |
|
8378 } |
|
8379 --- lib/Transforms/Scalar/IndVarSimplify.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
8380 +++ lib/Transforms/Scalar/IndVarSimplify.cpp 2015-11-29 07:09:51.854588965 -0800 |
|
8381 @@ -435,7 +435,7 @@ |
|
8382 // platforms. |
|
8383 if (WeakPH) { |
|
8384 Value *Conv = new SIToFPInst(NewPHI, PN->getType(), "indvar.conv", |
|
8385 - PN->getParent()->getFirstInsertionPt()); |
|
8386 + &*PN->getParent()->getFirstInsertionPt()); |
|
8387 PN->replaceAllUsesWith(Conv); |
|
8388 RecursivelyDeleteTriviallyDeadInstructions(PN, TLI); |
|
8389 } |
|
8390 @@ -998,7 +998,7 @@ |
|
8391 PHINode::Create(DU.WideDef->getType(), 1, UsePhi->getName() + ".wide", |
|
8392 UsePhi); |
|
8393 WidePhi->addIncoming(DU.WideDef, UsePhi->getIncomingBlock(0)); |
|
8394 - IRBuilder<> Builder(WidePhi->getParent()->getFirstInsertionPt()); |
|
8395 + IRBuilder<> Builder(&*WidePhi->getParent()->getFirstInsertionPt()); |
|
8396 Value *Trunc = Builder.CreateTrunc(WidePhi, DU.NarrowDef->getType()); |
|
8397 UsePhi->replaceAllUsesWith(Trunc); |
|
8398 DeadInsts.push_back(UsePhi); |
|
8399 @@ -1149,7 +1149,7 @@ |
|
8400 // either find an existing phi or materialize a new one. Either way, we |
|
8401 // expect a well-formed cyclic phi-with-increments. i.e. any operand not part |
|
8402 // of the phi-SCC dominates the loop entry. |
|
8403 - Instruction *InsertPt = L->getHeader()->begin(); |
|
8404 + Instruction *InsertPt = &L->getHeader()->front(); |
|
8405 WidePhi = cast<PHINode>(Rewriter.expandCodeFor(AddRec, WideType, InsertPt)); |
|
8406 |
|
8407 // Remembering the WideIV increment generated by SCEVExpander allows |
|
8408 @@ -1835,8 +1835,8 @@ |
|
8409 BasicBlock *Preheader = L->getLoopPreheader(); |
|
8410 if (!Preheader) return; |
|
8411 |
|
8412 - Instruction *InsertPt = ExitBlock->getFirstInsertionPt(); |
|
8413 - BasicBlock::iterator I = Preheader->getTerminator(); |
|
8414 + Instruction *InsertPt = &*ExitBlock->getFirstInsertionPt(); |
|
8415 + BasicBlock::iterator I(Preheader->getTerminator()); |
|
8416 while (I != Preheader->begin()) { |
|
8417 --I; |
|
8418 // New instructions were inserted at the end of the preheader. |
|
8419 @@ -1889,7 +1889,7 @@ |
|
8420 continue; |
|
8421 |
|
8422 // Otherwise, sink it to the exit block. |
|
8423 - Instruction *ToMove = I; |
|
8424 + Instruction *ToMove = &*I; |
|
8425 bool Done = false; |
|
8426 |
|
8427 if (I != Preheader->begin()) { |
|
8428 --- lib/Transforms/Scalar/JumpThreading.cpp 2015-01-12 19:46:47.000000000 -0800 |
|
8429 +++ lib/Transforms/Scalar/JumpThreading.cpp 2015-11-29 07:18:33.215512385 -0800 |
|
8430 @@ -179,7 +179,7 @@ |
|
8431 do { |
|
8432 Changed = false; |
|
8433 for (Function::iterator I = F.begin(), E = F.end(); I != E;) { |
|
8434 - BasicBlock *BB = I; |
|
8435 + BasicBlock *BB = &*I; |
|
8436 // Thread all of the branches we can over this block. |
|
8437 while (ProcessBlock(BB)) |
|
8438 Changed = true; |
|
8439 @@ -242,7 +242,7 @@ |
|
8440 static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB, |
|
8441 unsigned Threshold) { |
|
8442 /// Ignore PHI nodes, these will be flattened when duplication happens. |
|
8443 - BasicBlock::const_iterator I = BB->getFirstNonPHI(); |
|
8444 + BasicBlock::const_iterator I(BB->getFirstNonPHI()); |
|
8445 |
|
8446 // FIXME: THREADING will delete values that are just used to compute the |
|
8447 // branch, so they shouldn't count against the duplication cost. |
|
8448 @@ -890,7 +890,7 @@ |
|
8449 |
|
8450 // Scan a few instructions up from the load, to see if it is obviously live at |
|
8451 // the entry to its block. |
|
8452 - BasicBlock::iterator BBIt = LI; |
|
8453 + BasicBlock::iterator BBIt(LI); |
|
8454 |
|
8455 if (Value *AvailableVal = |
|
8456 FindAvailableLoadedValue(LoadedPtr, LoadBB, BBIt, 6)) { |
|
8457 @@ -1019,7 +1019,7 @@ |
|
8458 // Create a PHI node at the start of the block for the PRE'd load value. |
|
8459 pred_iterator PB = pred_begin(LoadBB), PE = pred_end(LoadBB); |
|
8460 PHINode *PN = PHINode::Create(LI->getType(), std::distance(PB, PE), "", |
|
8461 - LoadBB->begin()); |
|
8462 + &LoadBB->front()); |
|
8463 PN->takeName(LI); |
|
8464 PN->setDebugLoc(LI->getDebugLoc()); |
|
8465 |
|
8466 @@ -1449,7 +1449,7 @@ |
|
8467 Instruction *New = BI->clone(); |
|
8468 New->setName(BI->getName()); |
|
8469 NewBB->getInstList().push_back(New); |
|
8470 - ValueMapping[BI] = New; |
|
8471 + ValueMapping[&*BI] = New; |
|
8472 |
|
8473 // Remap operands to patch up intra-block references. |
|
8474 for (unsigned i = 0, e = New->getNumOperands(); i != e; ++i) |
|
8475 @@ -1499,8 +1499,8 @@ |
|
8476 // its block to be uses of the appropriate PHI node etc. See ValuesInBlocks |
|
8477 // with the two values we know. |
|
8478 SSAUpdate.Initialize(I->getType(), I->getName()); |
|
8479 - SSAUpdate.AddAvailableValue(BB, I); |
|
8480 - SSAUpdate.AddAvailableValue(NewBB, ValueMapping[I]); |
|
8481 + SSAUpdate.AddAvailableValue(BB, &*I); |
|
8482 + SSAUpdate.AddAvailableValue(NewBB, ValueMapping[&*I]); |
|
8483 |
|
8484 while (!UsesToRename.empty()) |
|
8485 SSAUpdate.RewriteUse(*UsesToRename.pop_back_val()); |
|
8486 @@ -1605,12 +1605,12 @@ |
|
8487 // phi translation. |
|
8488 if (Value *IV = SimplifyInstruction(New, DL)) { |
|
8489 delete New; |
|
8490 - ValueMapping[BI] = IV; |
|
8491 + ValueMapping[&*BI] = IV; |
|
8492 } else { |
|
8493 // Otherwise, insert the new instruction into the block. |
|
8494 New->setName(BI->getName()); |
|
8495 - PredBB->getInstList().insert(OldPredBranch, New); |
|
8496 - ValueMapping[BI] = New; |
|
8497 + PredBB->getInstList().insert(OldPredBranch->getIterator(), New); |
|
8498 + ValueMapping[&*BI] = New; |
|
8499 } |
|
8500 } |
|
8501 |
|
8502 @@ -1652,8 +1652,8 @@ |
|
8503 // its block to be uses of the appropriate PHI node etc. See ValuesInBlocks |
|
8504 // with the two values we know. |
|
8505 SSAUpdate.Initialize(I->getType(), I->getName()); |
|
8506 - SSAUpdate.AddAvailableValue(BB, I); |
|
8507 - SSAUpdate.AddAvailableValue(PredBB, ValueMapping[I]); |
|
8508 + SSAUpdate.AddAvailableValue(BB, &*I); |
|
8509 + SSAUpdate.AddAvailableValue(PredBB, ValueMapping[&*I]); |
|
8510 |
|
8511 while (!UsesToRename.empty()) |
|
8512 SSAUpdate.RewriteUse(*UsesToRename.pop_back_val()); |
|
8513 --- lib/Transforms/Scalar/LICM.cpp 2014-12-29 15:00:57.000000000 -0800 |
|
8514 +++ lib/Transforms/Scalar/LICM.cpp 2015-11-27 19:41:29.442793583 -0800 |
|
8515 @@ -573,7 +573,7 @@ |
|
8516 if (!OLoop->contains(&PN)) { |
|
8517 PHINode *OpPN = |
|
8518 PHINode::Create(OInst->getType(), PN.getNumIncomingValues(), |
|
8519 - OInst->getName() + ".lcssa", ExitBlock.begin()); |
|
8520 + OInst->getName() + ".lcssa", &ExitBlock.front()); |
|
8521 for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) |
|
8522 OpPN->addIncoming(OInst, PN.getIncomingBlock(i)); |
|
8523 *OI = OpPN; |
|
8524 @@ -720,7 +720,7 @@ |
|
8525 // store that. |
|
8526 PHINode *PN = PHINode::Create( |
|
8527 I->getType(), PredCache.GetNumPreds(BB), |
|
8528 - I->getName() + ".lcssa", BB->begin()); |
|
8529 + I->getName() + ".lcssa", &BB->front()); |
|
8530 for (BasicBlock **PI = PredCache.GetPreds(BB); *PI; ++PI) |
|
8531 PN->addIncoming(I, *PI); |
|
8532 return PN; |
|
8533 @@ -916,7 +916,7 @@ |
|
8534 CurLoop->getUniqueExitBlocks(ExitBlocks); |
|
8535 InsertPts.resize(ExitBlocks.size()); |
|
8536 for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) |
|
8537 - InsertPts[i] = ExitBlocks[i]->getFirstInsertionPt(); |
|
8538 + InsertPts[i] = &*ExitBlocks[i]->getFirstInsertionPt(); |
|
8539 } |
|
8540 |
|
8541 // We use the SSAUpdater interface to insert phi nodes as required. |
|
8542 --- lib/Transforms/Scalar/LoopIdiomRecognize.cpp 2014-06-13 20:48:29.000000000 -0700 |
|
8543 +++ lib/Transforms/Scalar/LoopIdiomRecognize.cpp 2015-11-29 07:21:21.325412485 -0800 |
|
8544 @@ -441,9 +441,9 @@ |
|
8545 // step 4: Find the instruction which count the population: cnt2 = cnt1 + 1 |
|
8546 { |
|
8547 CountInst = nullptr; |
|
8548 - for (BasicBlock::iterator Iter = LoopEntry->getFirstNonPHI(), |
|
8549 + for (BasicBlock::iterator Iter = LoopEntry->getFirstNonPHI()->getIterator(), |
|
8550 IterE = LoopEntry->end(); Iter != IterE; Iter++) { |
|
8551 - Instruction *Inst = Iter; |
|
8552 + Instruction *Inst = &*Iter; |
|
8553 if (Inst->getOpcode() != Instruction::Add) |
|
8554 continue; |
|
8555 |
|
8556 @@ -571,7 +571,7 @@ |
|
8557 ICmpInst *LbCond = cast<ICmpInst>(LbBr->getCondition()); |
|
8558 Type *Ty = TripCnt->getType(); |
|
8559 |
|
8560 - PHINode *TcPhi = PHINode::Create(Ty, 2, "tcphi", Body->begin()); |
|
8561 + PHINode *TcPhi = PHINode::Create(Ty, 2, "tcphi", &(Body->front())); |
|
8562 |
|
8563 Builder.SetInsertPoint(LbCond); |
|
8564 Value *Opnd1 = cast<Value>(TcPhi); |
|
8565 @@ -736,10 +736,12 @@ |
|
8566 |
|
8567 bool MadeChange = false; |
|
8568 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { |
|
8569 - Instruction *Inst = I++; |
|
8570 + Instruction *Inst = &*I; |
|
8571 + ++I; |
|
8572 + |
|
8573 // Look for store instructions, which may be optimized to memset/memcpy. |
|
8574 if (StoreInst *SI = dyn_cast<StoreInst>(Inst)) { |
|
8575 - WeakVH InstPtr(I); |
|
8576 + WeakVH InstPtr(&*I); |
|
8577 if (!processLoopStore(SI, BECount)) continue; |
|
8578 MadeChange = true; |
|
8579 |
|
8580 @@ -752,7 +754,7 @@ |
|
8581 |
|
8582 // Look for memset instructions, which may be optimized to a larger memset. |
|
8583 if (MemSetInst *MSI = dyn_cast<MemSetInst>(Inst)) { |
|
8584 - WeakVH InstPtr(I); |
|
8585 + WeakVH InstPtr(&*I); |
|
8586 if (!processLoopMemSet(MSI, BECount)) continue; |
|
8587 MadeChange = true; |
|
8588 |
|
8589 @@ -891,8 +893,7 @@ |
|
8590 for (Loop::block_iterator BI = L->block_begin(), E = L->block_end(); BI != E; |
|
8591 ++BI) |
|
8592 for (BasicBlock::iterator I = (*BI)->begin(), E = (*BI)->end(); I != E; ++I) |
|
8593 - if (&*I != IgnoredStore && |
|
8594 - (AA.getModRefInfo(I, StoreLoc) & Access)) |
|
8595 + if (&*I != IgnoredStore && (AA.getModRefInfo(&*I, StoreLoc) & Access)) |
|
8596 return true; |
|
8597 |
|
8598 return false; |
|
8599 --- lib/Transforms/Scalar/LoopInstSimplify.cpp 2015-01-28 09:35:18.000000000 -0800 |
|
8600 +++ lib/Transforms/Scalar/LoopInstSimplify.cpp 2015-11-28 15:26:59.128054267 -0800 |
|
8601 @@ -112,7 +112,8 @@ |
|
8602 |
|
8603 // Simplify instructions in the current basic block. |
|
8604 for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { |
|
8605 - Instruction *I = BI++; |
|
8606 + Instruction *I = &*BI; |
|
8607 + BI++; |
|
8608 |
|
8609 // The first time through the loop ToSimplify is empty and we try to |
|
8610 // simplify all instructions. On later iterations ToSimplify is not |
|
8611 --- lib/Transforms/Scalar/LoopRerollPass.cpp 2014-10-28 04:54:52.000000000 -0700 |
|
8612 +++ lib/Transforms/Scalar/LoopRerollPass.cpp 2015-11-29 07:34:50.826695128 -0800 |
|
8613 @@ -373,7 +373,7 @@ |
|
8614 continue; |
|
8615 |
|
8616 if (const SCEVAddRecExpr *PHISCEV = |
|
8617 - dyn_cast<SCEVAddRecExpr>(SE->getSCEV(I))) { |
|
8618 + dyn_cast<SCEVAddRecExpr>(SE->getSCEV(&*I))) { |
|
8619 if (PHISCEV->getLoop() != L) |
|
8620 continue; |
|
8621 if (!PHISCEV->isAffine()) |
|
8622 @@ -387,7 +387,7 @@ |
|
8623 |
|
8624 DEBUG(dbgs() << "LRR: Possible IV: " << *I << " = " << |
|
8625 *PHISCEV << "\n"); |
|
8626 - PossibleIVs.push_back(I); |
|
8627 + PossibleIVs.push_back(&*I); |
|
8628 } |
|
8629 } |
|
8630 } |
|
8631 @@ -445,7 +445,7 @@ |
|
8632 if (!I->getType()->isSingleValueType()) |
|
8633 continue; |
|
8634 |
|
8635 - SimpleLoopReduction SLR(I, L); |
|
8636 + SimpleLoopReduction SLR(&*I, L); |
|
8637 if (!SLR.valid()) |
|
8638 continue; |
|
8639 |
|
8640 @@ -856,35 +856,36 @@ |
|
8641 continue; |
|
8642 if (cast<Instruction>(J1) == IV) |
|
8643 continue; |
|
8644 - if (!BaseUseSet.count(J1)) |
|
8645 + if (!BaseUseSet.count(&*J1)) |
|
8646 continue; |
|
8647 - if (PossibleRedPHISet.count(J1)) // Skip reduction PHIs. |
|
8648 + if (PossibleRedPHISet.count(&*J1)) // Skip reduction PHIs. |
|
8649 continue; |
|
8650 |
|
8651 - while (J2 != JE && (!RootUseSet.count(J2) || |
|
8652 + while (J2 != JE && (!RootUseSet.count(&*J2) || |
|
8653 std::find(Roots[i].begin(), Roots[i].end(), J2) != |
|
8654 Roots[i].end())) { |
|
8655 // As we iterate through the instructions, instructions that don't |
|
8656 // belong to previous iterations (or the base case), must belong to |
|
8657 // future iterations. We want to track the alias set of writes from |
|
8658 // previous iterations. |
|
8659 - if (!isa<PHINode>(J2) && !BaseUseSet.count(J2) && |
|
8660 - !AllRootUses.count(J2)) { |
|
8661 + if (!isa<PHINode>(J2) && !BaseUseSet.count(&*J2) && |
|
8662 + !AllRootUses.count(&*J2)) { |
|
8663 if (J2->mayWriteToMemory()) |
|
8664 - AST.add(J2); |
|
8665 + AST.add(&*J2); |
|
8666 |
|
8667 // Note: This is specifically guarded by a check on isa<PHINode>, |
|
8668 // which while a valid (somewhat arbitrary) micro-optimization, is |
|
8669 // needed because otherwise isSafeToSpeculativelyExecute returns |
|
8670 // false on PHI nodes. |
|
8671 - if (!isSimpleLoadStore(J2) && !isSafeToSpeculativelyExecute(J2, DL)) |
|
8672 + if (!isSimpleLoadStore(&*J2) && |
|
8673 + !isSafeToSpeculativelyExecute(&*J2, DL)) |
|
8674 FutureSideEffects = true; |
|
8675 } |
|
8676 |
|
8677 ++J2; |
|
8678 } |
|
8679 |
|
8680 - if (!J1->isSameOperationAs(J2)) { |
|
8681 + if (!J1->isSameOperationAs(&*J2)) { |
|
8682 DEBUG(dbgs() << "LRR: iteration root match failed at " << *J1 << |
|
8683 " vs. " << *J2 << "\n"); |
|
8684 MatchFailed = true; |
|
8685 @@ -894,7 +895,7 @@ |
|
8686 // Make sure that this instruction, which is in the use set of this |
|
8687 // root instruction, does not also belong to the base set or the set of |
|
8688 // some previous root instruction. |
|
8689 - if (BaseUseSet.count(J2) || AllRootUses.count(J2)) { |
|
8690 + if (BaseUseSet.count(&*J2) || AllRootUses.count(&*J2)) { |
|
8691 DEBUG(dbgs() << "LRR: iteration root match failed at " << *J1 << |
|
8692 " vs. " << *J2 << " (prev. case overlap)\n"); |
|
8693 MatchFailed = true; |
|
8694 @@ -907,7 +908,7 @@ |
|
8695 if (J2->mayReadFromMemory()) { |
|
8696 for (AliasSetTracker::iterator K = AST.begin(), KE = AST.end(); |
|
8697 K != KE && !MatchFailed; ++K) { |
|
8698 - if (K->aliasesUnknownInst(J2, *AA)) { |
|
8699 + if (K->aliasesUnknownInst(&*J2, *AA)) { |
|
8700 DEBUG(dbgs() << "LRR: iteration root match failed at " << *J1 << |
|
8701 " vs. " << *J2 << " (depends on future store)\n"); |
|
8702 MatchFailed = true; |
|
8703 @@ -921,10 +922,10 @@ |
|
8704 // them, and this matching fails. As an exception, we allow the alias |
|
8705 // set tracker to handle regular (simple) load/store dependencies. |
|
8706 if (FutureSideEffects && |
|
8707 - ((!isSimpleLoadStore(J1) && |
|
8708 - !isSafeToSpeculativelyExecute(J1, DL)) || |
|
8709 - (!isSimpleLoadStore(J2) && |
|
8710 - !isSafeToSpeculativelyExecute(J2, DL)))) { |
|
8711 + ((!isSimpleLoadStore(&*J1) && |
|
8712 + !isSafeToSpeculativelyExecute(&*J1, &*DL)) || |
|
8713 + (!isSimpleLoadStore(&*J2) && |
|
8714 + !isSafeToSpeculativelyExecute(&*J2, &*DL)))) { |
|
8715 DEBUG(dbgs() << "LRR: iteration root match failed at " << *J1 << |
|
8716 " vs. " << *J2 << |
|
8717 " (side effects prevent reordering)\n"); |
|
8718 @@ -942,7 +943,7 @@ |
|
8719 // x += a[i]; x += b[i]; |
|
8720 // x += a[i+1]; x += b[i+1]; |
|
8721 // x += b[i+2]; x += a[i+2]; |
|
8722 - bool InReduction = Reductions.isPairInSame(J1, J2); |
|
8723 + bool InReduction = Reductions.isPairInSame(&*J1, &*J2); |
|
8724 |
|
8725 if (!(InReduction && J1->isAssociative())) { |
|
8726 bool Swapped = false, SomeOpMatched = false; |
|
8727 @@ -954,7 +955,7 @@ |
|
8728 // part of the reduction. |
|
8729 if (InReduction) |
|
8730 if (Instruction *Op2I = dyn_cast<Instruction>(Op2)) |
|
8731 - if (Reductions.isPairInSame(J2, Op2I)) |
|
8732 + if (Reductions.isPairInSame(&*J2, Op2I)) |
|
8733 continue; |
|
8734 |
|
8735 DenseMap<Value *, Value *>::iterator BMI = BaseMap.find(Op2); |
|
8736 @@ -985,8 +986,8 @@ |
|
8737 } |
|
8738 } |
|
8739 |
|
8740 - if ((!PossibleRedLastSet.count(J1) && hasUsesOutsideLoop(J1, L)) || |
|
8741 - (!PossibleRedLastSet.count(J2) && hasUsesOutsideLoop(J2, L))) { |
|
8742 + if ((!PossibleRedLastSet.count(&*J1) && hasUsesOutsideLoop(&*J1, L)) || |
|
8743 + (!PossibleRedLastSet.count(&*J2) && hasUsesOutsideLoop(&*J2, L))) { |
|
8744 DEBUG(dbgs() << "LRR: iteration root match failed at " << *J1 << |
|
8745 " vs. " << *J2 << " (uses outside loop)\n"); |
|
8746 MatchFailed = true; |
|
8747 @@ -994,10 +995,10 @@ |
|
8748 } |
|
8749 |
|
8750 if (!MatchFailed) |
|
8751 - BaseMap.insert(std::pair<Value *, Value *>(J2, J1)); |
|
8752 + BaseMap.insert(std::pair<Value *, Value *>(&*J2, &*J1)); |
|
8753 |
|
8754 - AllRootUses.insert(J2); |
|
8755 - Reductions.recordPair(J1, J2, i+1); |
|
8756 + AllRootUses.insert(&*J2); |
|
8757 + Reductions.recordPair(&*J1, &*J2, i+1); |
|
8758 |
|
8759 ++J2; |
|
8760 } |
|
8761 @@ -1025,15 +1026,15 @@ |
|
8762 continue; |
|
8763 if (cast<Instruction>(J) == IV) |
|
8764 continue; |
|
8765 - if (BaseUseSet.count(J) || AllRootUses.count(J) || |
|
8766 - (LoopIncUseSet.count(J) && (J->isTerminator() || |
|
8767 - isSafeToSpeculativelyExecute(J, DL)))) |
|
8768 + if (BaseUseSet.count(&*J) || AllRootUses.count(&*J) || |
|
8769 + (LoopIncUseSet.count(&*J) && (J->isTerminator() || |
|
8770 + isSafeToSpeculativelyExecute(&*J, &*DL)))) |
|
8771 continue; |
|
8772 |
|
8773 - if (AllRoots.count(J)) |
|
8774 + if (AllRoots.count(&*J)) |
|
8775 continue; |
|
8776 |
|
8777 - if (Reductions.isSelectedPHI(J)) |
|
8778 + if (Reductions.isSelectedPHI(&*J)) |
|
8779 continue; |
|
8780 |
|
8781 DEBUG(dbgs() << "LRR: aborting reroll based on " << *RealIV << |
|
8782 @@ -1080,7 +1081,7 @@ |
|
8783 L, SCEV::FlagAnyWrap)); |
|
8784 { // Limit the lifetime of SCEVExpander. |
|
8785 SCEVExpander Expander(*SE, "reroll"); |
|
8786 - Value *NewIV = Expander.expandCodeFor(H, IV->getType(), Header->begin()); |
|
8787 + Value *NewIV = Expander.expandCodeFor(H, IV->getType(), &(Header->front())); |
|
8788 |
|
8789 for (DenseSet<Instruction *>::iterator J = BaseUseSet.begin(), |
|
8790 JE = BaseUseSet.end(); J != JE; ++J) |
|
8791 --- lib/Transforms/Scalar/LoopRotation.cpp 2015-03-09 13:26:36.000000000 -0700 |
|
8792 +++ lib/Transforms/Scalar/LoopRotation.cpp 2015-11-29 08:53:24.120179108 -0800 |
|
8793 @@ -141,7 +141,7 @@ |
|
8794 // as necessary. |
|
8795 SSAUpdater SSA; |
|
8796 for (I = OrigHeader->begin(); I != E; ++I) { |
|
8797 - Value *OrigHeaderVal = I; |
|
8798 + Value *OrigHeaderVal = &*I; |
|
8799 |
|
8800 // If there are no uses of the value (e.g. because it returns void), there |
|
8801 // is nothing to rewrite. |
|
8802 @@ -203,8 +203,7 @@ |
|
8803 MultiExitLoop = true; |
|
8804 |
|
8805 for (BasicBlock::iterator I = Begin; I != End; ++I) { |
|
8806 - |
|
8807 - if (!isSafeToSpeculativelyExecute(I)) |
|
8808 + if (!isSafeToSpeculativelyExecute(&*I)) |
|
8809 return false; |
|
8810 |
|
8811 if (isa<DbgInfoIntrinsic>(I)) |
|
8812 @@ -287,14 +286,15 @@ |
|
8813 if (!BI) |
|
8814 return false; |
|
8815 |
|
8816 - if (!shouldSpeculateInstrs(Latch->begin(), Jmp, L)) |
|
8817 + if (!shouldSpeculateInstrs(Latch->begin(), Jmp->getIterator(), L)) |
|
8818 return false; |
|
8819 |
|
8820 DEBUG(dbgs() << "Folding loop latch " << Latch->getName() << " into " |
|
8821 << LastExit->getName() << "\n"); |
|
8822 |
|
8823 // Hoist the instructions from Latch into LastExit. |
|
8824 - LastExit->getInstList().splice(BI, Latch->getInstList(), Latch->begin(), Jmp); |
|
8825 + LastExit->getInstList().splice(BI->getIterator(), Latch->getInstList(), |
|
8826 + Latch->begin(), Jmp->getIterator()); |
|
8827 |
|
8828 unsigned FallThruPath = BI->getSuccessor(0) == Latch ? 0 : 1; |
|
8829 BasicBlock *Header = Jmp->getSuccessor(0); |
|
8830 @@ -416,7 +416,8 @@ |
|
8831 // possible or create a clone in the OldPreHeader if not. |
|
8832 TerminatorInst *LoopEntryBranch = OrigPreheader->getTerminator(); |
|
8833 while (I != E) { |
|
8834 - Instruction *Inst = I++; |
|
8835 + Instruction *Inst = &*I; |
|
8836 + ++I; |
|
8837 |
|
8838 // If the instruction's operands are invariant and it doesn't read or write |
|
8839 // memory, then it is safe to hoist. Doing this doesn't change the order of |
|
8840 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
8841 +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp 2015-11-29 08:54:51.641136545 -0800 |
|
8842 @@ -1933,9 +1933,10 @@ |
|
8843 // NOTE: we could handle setcc instructions with multiple uses here, but |
|
8844 // InstCombine does it as well for simple uses, it's not clear that it |
|
8845 // occurs enough in real life to handle. |
|
8846 - CondUse = UI; |
|
8847 + CondUse = &*UI; |
|
8848 return true; |
|
8849 } |
|
8850 + |
|
8851 return false; |
|
8852 } |
|
8853 |
|
8854 @@ -2203,7 +2204,7 @@ |
|
8855 ICmpInst *OldCond = Cond; |
|
8856 Cond = cast<ICmpInst>(Cond->clone()); |
|
8857 Cond->setName(L->getHeader()->getName() + ".termcond"); |
|
8858 - ExitingBlock->getInstList().insert(TermBr, Cond); |
|
8859 + ExitingBlock->getInstList().insert(TermBr->getIterator(), Cond); |
|
8860 |
|
8861 // Clone the IVUse, as the old use still exists! |
|
8862 CondUse = &IU.AddUser(Cond, CondUse->getOperandValToReplace()); |
|
8863 @@ -2782,20 +2783,21 @@ |
|
8864 for (BasicBlock::iterator I = (*BBIter)->begin(), E = (*BBIter)->end(); |
|
8865 I != E; ++I) { |
|
8866 // Skip instructions that weren't seen by IVUsers analysis. |
|
8867 - if (isa<PHINode>(I) || !IU.isIVUserOrOperand(I)) |
|
8868 + if (isa<PHINode>(I) || !IU.isIVUserOrOperand(&*I)) |
|
8869 continue; |
|
8870 |
|
8871 // Ignore users that are part of a SCEV expression. This way we only |
|
8872 // consider leaf IV Users. This effectively rediscovers a portion of |
|
8873 // IVUsers analysis but in program order this time. |
|
8874 - if (SE.isSCEVable(I->getType()) && !isa<SCEVUnknown>(SE.getSCEV(I))) |
|
8875 + if (SE.isSCEVable(I->getType()) && !isa<SCEVUnknown>(SE.getSCEV(&*I))) |
|
8876 continue; |
|
8877 |
|
8878 // Remove this instruction from any NearUsers set it may be in. |
|
8879 for (unsigned ChainIdx = 0, NChains = IVChainVec.size(); |
|
8880 ChainIdx < NChains; ++ChainIdx) { |
|
8881 - ChainUsersVec[ChainIdx].NearUsers.erase(I); |
|
8882 + ChainUsersVec[ChainIdx].NearUsers.erase(&*I); |
|
8883 } |
|
8884 + |
|
8885 // Search for operands that can be chained. |
|
8886 SmallPtrSet<Instruction*, 4> UniqueOperands; |
|
8887 User::op_iterator IVOpEnd = I->op_end(); |
|
8888 @@ -2803,7 +2805,7 @@ |
|
8889 while (IVOpIter != IVOpEnd) { |
|
8890 Instruction *IVOpInst = cast<Instruction>(*IVOpIter); |
|
8891 if (UniqueOperands.insert(IVOpInst).second) |
|
8892 - ChainInstruction(I, IVOpInst, ChainUsersVec); |
|
8893 + ChainInstruction(&*I, IVOpInst, ChainUsersVec); |
|
8894 IVOpIter = findIVOperand(std::next(IVOpIter), IVOpEnd, L, SE); |
|
8895 } |
|
8896 } // Continue walking down the instructions. |
|
8897 @@ -4437,14 +4439,14 @@ |
|
8898 // instead of at the end, so that it can be used for other expansions. |
|
8899 if (IDom == Inst->getParent() && |
|
8900 (!BetterPos || !DT.dominates(Inst, BetterPos))) |
|
8901 - BetterPos = std::next(BasicBlock::iterator(Inst)); |
|
8902 + BetterPos = &(*std::next(BasicBlock::iterator(Inst))); |
|
8903 } |
|
8904 if (!AllDominate) |
|
8905 break; |
|
8906 if (BetterPos) |
|
8907 - IP = BetterPos; |
|
8908 + IP = BetterPos->getIterator(); |
|
8909 else |
|
8910 - IP = Tentative; |
|
8911 + IP = Tentative->getIterator(); |
|
8912 } |
|
8913 |
|
8914 return IP; |
|
8915 @@ -4511,7 +4513,8 @@ |
|
8916 // Set IP below instructions recently inserted by SCEVExpander. This keeps the |
|
8917 // IP consistent across expansions and allows the previously inserted |
|
8918 // instructions to be reused by subsequent expansion. |
|
8919 - while (Rewriter.isInsertedInstruction(IP) && IP != LowestIP) ++IP; |
|
8920 + while (Rewriter.isInsertedInstruction(&*IP) && IP != LowestIP) |
|
8921 + ++IP; |
|
8922 |
|
8923 return IP; |
|
8924 } |
|
8925 @@ -4563,7 +4566,7 @@ |
|
8926 LF.UserInst, LF.OperandValToReplace, |
|
8927 Loops, SE, DT); |
|
8928 |
|
8929 - Ops.push_back(SE.getUnknown(Rewriter.expandCodeFor(Reg, nullptr, IP))); |
|
8930 + Ops.push_back(SE.getUnknown(Rewriter.expandCodeFor(Reg, nullptr, &*IP))); |
|
8931 } |
|
8932 |
|
8933 // Expand the ScaledReg portion. |
|
8934 @@ -4581,14 +4584,14 @@ |
|
8935 // Expand ScaleReg as if it was part of the base regs. |
|
8936 if (F.Scale == 1) |
|
8937 Ops.push_back( |
|
8938 - SE.getUnknown(Rewriter.expandCodeFor(ScaledS, nullptr, IP))); |
|
8939 + SE.getUnknown(Rewriter.expandCodeFor(ScaledS, nullptr, &*IP))); |
|
8940 else { |
|
8941 // An interesting way of "folding" with an icmp is to use a negated |
|
8942 // scale, which we'll implement by inserting it into the other operand |
|
8943 // of the icmp. |
|
8944 assert(F.Scale == -1 && |
|
8945 "The only scale supported by ICmpZero uses is -1!"); |
|
8946 - ICmpScaledV = Rewriter.expandCodeFor(ScaledS, nullptr, IP); |
|
8947 + ICmpScaledV = Rewriter.expandCodeFor(ScaledS, nullptr, &*IP); |
|
8948 } |
|
8949 } else { |
|
8950 // Otherwise just expand the scaled register and an explicit scale, |
|
8951 @@ -4598,11 +4601,11 @@ |
|
8952 // Unless the addressing mode will not be folded. |
|
8953 if (!Ops.empty() && LU.Kind == LSRUse::Address && |
|
8954 isAMCompletelyFolded(TTI, LU, F)) { |
|
8955 - Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP); |
|
8956 + Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, &*IP); |
|
8957 Ops.clear(); |
|
8958 Ops.push_back(SE.getUnknown(FullV)); |
|
8959 } |
|
8960 - ScaledS = SE.getUnknown(Rewriter.expandCodeFor(ScaledS, nullptr, IP)); |
|
8961 + ScaledS = SE.getUnknown(Rewriter.expandCodeFor(ScaledS, nullptr, &*IP)); |
|
8962 if (F.Scale != 1) |
|
8963 ScaledS = |
|
8964 SE.getMulExpr(ScaledS, SE.getConstant(ScaledS->getType(), F.Scale)); |
|
8965 @@ -4614,7 +4617,7 @@ |
|
8966 if (F.BaseGV) { |
|
8967 // Flush the operand list to suppress SCEVExpander hoisting. |
|
8968 if (!Ops.empty()) { |
|
8969 - Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP); |
|
8970 + Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, &*IP); |
|
8971 Ops.clear(); |
|
8972 Ops.push_back(SE.getUnknown(FullV)); |
|
8973 } |
|
8974 @@ -4624,7 +4627,7 @@ |
|
8975 // Flush the operand list to suppress SCEVExpander hoisting of both folded and |
|
8976 // unfolded offsets. LSR assumes they both live next to their uses. |
|
8977 if (!Ops.empty()) { |
|
8978 - Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, IP); |
|
8979 + Value *FullV = Rewriter.expandCodeFor(SE.getAddExpr(Ops), Ty, &*IP); |
|
8980 Ops.clear(); |
|
8981 Ops.push_back(SE.getUnknown(FullV)); |
|
8982 } |
|
8983 @@ -4636,7 +4639,7 @@ |
|
8984 // The other interesting way of "folding" with an ICmpZero is to use a |
|
8985 // negated immediate. |
|
8986 if (!ICmpScaledV) |
|
8987 - ICmpScaledV = ConstantInt::get(IntTy, -(uint64_t)Offset); |
|
8988 + ICmpScaledV = ConstantInt::get(IntTy, -((uint64_t) Offset)); |
|
8989 else { |
|
8990 Ops.push_back(SE.getUnknown(ICmpScaledV)); |
|
8991 ICmpScaledV = ConstantInt::get(IntTy, Offset); |
|
8992 @@ -4660,7 +4663,7 @@ |
|
8993 const SCEV *FullS = Ops.empty() ? |
|
8994 SE.getConstant(IntTy, 0) : |
|
8995 SE.getAddExpr(Ops); |
|
8996 - Value *FullV = Rewriter.expandCodeFor(FullS, Ty, IP); |
|
8997 + Value *FullV = Rewriter.expandCodeFor(FullS, Ty, &*IP); |
|
8998 |
|
8999 // We're done expanding now, so reset the rewriter. |
|
9000 Rewriter.clearPostInc(); |
|
9001 @@ -4759,7 +4762,8 @@ |
|
9002 if (!Pair.second) |
|
9003 PN->setIncomingValue(i, Pair.first->second); |
|
9004 else { |
|
9005 - Value *FullV = Expand(LF, F, BB->getTerminator(), Rewriter, DeadInsts); |
|
9006 + Value *FullV = Expand(LF, F, BB->getTerminator()->getIterator(), |
|
9007 + Rewriter, DeadInsts); |
|
9008 |
|
9009 // If this is reuse-by-noop-cast, insert the noop cast. |
|
9010 Type *OpTy = LF.OperandValToReplace->getType(); |
|
9011 @@ -4789,7 +4793,8 @@ |
|
9012 if (PHINode *PN = dyn_cast<PHINode>(LF.UserInst)) { |
|
9013 RewriteForPHI(PN, LF, F, Rewriter, DeadInsts, P); |
|
9014 } else { |
|
9015 - Value *FullV = Expand(LF, F, LF.UserInst, Rewriter, DeadInsts); |
|
9016 + Value *FullV = |
|
9017 + Expand(LF, F, LF.UserInst->getIterator(), Rewriter, DeadInsts); |
|
9018 |
|
9019 // If this is reuse-by-noop-cast, insert the noop cast. |
|
9020 Type *OpTy = LF.OperandValToReplace->getType(); |
|
9021 --- lib/Transforms/Scalar/LoopUnswitch.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
9022 +++ lib/Transforms/Scalar/LoopUnswitch.cpp 2015-11-28 17:55:30.857922905 -0800 |
|
9023 @@ -737,7 +737,7 @@ |
|
9024 // without actually branching to it (the exit block should be dominated by the |
|
9025 // loop header, not the preheader). |
|
9026 assert(!L->contains(ExitBlock) && "Exit block is in the loop?"); |
|
9027 - BasicBlock *NewExit = SplitBlock(ExitBlock, ExitBlock->begin(), this); |
|
9028 + BasicBlock *NewExit = SplitBlock(ExitBlock, &(ExitBlock->front()), this); |
|
9029 |
|
9030 // Okay, now we have a position to branch from and a position to branch to, |
|
9031 // insert the new conditional branch. |
|
9032 @@ -832,8 +832,9 @@ |
|
9033 |
|
9034 // Splice the newly inserted blocks into the function right before the |
|
9035 // original preheader. |
|
9036 - F->getBasicBlockList().splice(NewPreheader, F->getBasicBlockList(), |
|
9037 - NewBlocks[0], F->end()); |
|
9038 + F->getBasicBlockList().splice(NewPreheader->getIterator(), |
|
9039 + F->getBasicBlockList(), |
|
9040 + NewBlocks[0]->getIterator(), F->end()); |
|
9041 |
|
9042 // FIXME: We could register any cloned assumptions instead of clearing the |
|
9043 // whole function's cache. |
|
9044 @@ -875,7 +876,7 @@ |
|
9045 |
|
9046 if (LandingPadInst *LPad = NewExit->getLandingPadInst()) { |
|
9047 PHINode *PN = PHINode::Create(LPad->getType(), 0, "", |
|
9048 - ExitSucc->getFirstInsertionPt()); |
|
9049 + &*ExitSucc->getFirstInsertionPt()); |
|
9050 |
|
9051 for (pred_iterator I = pred_begin(ExitSucc), E = pred_end(ExitSucc); |
|
9052 I != E; ++I) { |
|
9053 @@ -891,7 +892,8 @@ |
|
9054 for (unsigned i = 0, e = NewBlocks.size(); i != e; ++i) |
|
9055 for (BasicBlock::iterator I = NewBlocks[i]->begin(), |
|
9056 E = NewBlocks[i]->end(); I != E; ++I) |
|
9057 - RemapInstruction(I, VMap,RF_NoModuleLevelChanges|RF_IgnoreMissingEntries); |
|
9058 + RemapInstruction(&*I, VMap, |
|
9059 + RF_NoModuleLevelChanges | RF_IgnoreMissingEntries); |
|
9060 |
|
9061 // Rewrite the original preheader to select between versions of the loop. |
|
9062 BranchInst *OldBR = cast<BranchInst>(loopPreheader->getTerminator()); |
|
9063 @@ -1136,8 +1138,9 @@ |
|
9064 Succ->replaceAllUsesWith(Pred); |
|
9065 |
|
9066 // Move all of the successor contents from Succ to Pred. |
|
9067 - Pred->getInstList().splice(BI, Succ->getInstList(), Succ->begin(), |
|
9068 - Succ->end()); |
|
9069 + Pred->getInstList().splice(BI->getIterator(), |
|
9070 + Succ->getInstList(), |
|
9071 + Succ->begin(), Succ->end()); |
|
9072 LPM->deleteSimpleAnalysisValue(BI, L); |
|
9073 BI->eraseFromParent(); |
|
9074 RemoveFromWorklist(BI, Worklist); |
|
9075 --- lib/Transforms/Scalar/LowerAtomic.cpp 2014-06-13 07:24:07.000000000 -0700 |
|
9076 +++ lib/Transforms/Scalar/LowerAtomic.cpp 2015-11-28 17:57:32.665949990 -0800 |
|
9077 @@ -22,7 +22,7 @@ |
|
9078 #define DEBUG_TYPE "loweratomic" |
|
9079 |
|
9080 static bool LowerAtomicCmpXchgInst(AtomicCmpXchgInst *CXI) { |
|
9081 - IRBuilder<> Builder(CXI->getParent(), CXI); |
|
9082 + IRBuilder<> Builder(CXI); |
|
9083 Value *Ptr = CXI->getPointerOperand(); |
|
9084 Value *Cmp = CXI->getCompareOperand(); |
|
9085 Value *Val = CXI->getNewValOperand(); |
|
9086 @@ -41,7 +41,7 @@ |
|
9087 } |
|
9088 |
|
9089 static bool LowerAtomicRMWInst(AtomicRMWInst *RMWI) { |
|
9090 - IRBuilder<> Builder(RMWI->getParent(), RMWI); |
|
9091 + IRBuilder<> Builder(RMWI); |
|
9092 Value *Ptr = RMWI->getPointerOperand(); |
|
9093 Value *Val = RMWI->getValOperand(); |
|
9094 |
|
9095 @@ -120,7 +120,8 @@ |
|
9096 return false; |
|
9097 bool Changed = false; |
|
9098 for (BasicBlock::iterator DI = BB.begin(), DE = BB.end(); DI != DE; ) { |
|
9099 - Instruction *Inst = DI++; |
|
9100 + Instruction *Inst = &*DI; |
|
9101 + ++DI; |
|
9102 if (FenceInst *FI = dyn_cast<FenceInst>(Inst)) |
|
9103 Changed |= LowerFenceInst(FI); |
|
9104 else if (AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(Inst)) |
|
9105 --- lib/Transforms/Scalar/MemCpyOptimizer.cpp 2015-02-07 11:39:14.000000000 -0800 |
|
9106 +++ lib/Transforms/Scalar/MemCpyOptimizer.cpp 2015-11-28 18:08:18.813257513 -0800 |
|
9107 @@ -385,7 +385,7 @@ |
|
9108 // are stored. |
|
9109 MemsetRanges Ranges(*DL); |
|
9110 |
|
9111 - BasicBlock::iterator BI = StartInst; |
|
9112 + BasicBlock::iterator BI(StartInst); |
|
9113 for (++BI; !isa<TerminatorInst>(BI); ++BI) { |
|
9114 if (!isa<StoreInst>(BI) && !isa<MemSetInst>(BI)) { |
|
9115 // If the instruction is readnone, ignore it, otherwise bail out. We |
|
9116 @@ -440,7 +440,7 @@ |
|
9117 // If we create any memsets, we put it right before the first instruction that |
|
9118 // isn't part of the memset block. This ensure that the memset is dominated |
|
9119 // by any addressing instruction needed by the start of the block. |
|
9120 - IRBuilder<> Builder(BI); |
|
9121 + IRBuilder<> Builder(&*BI); |
|
9122 |
|
9123 // Now that we have full information about ranges, loop over the ranges and |
|
9124 // emit memset's for anything big enough to be worthwhile. |
|
9125 @@ -513,8 +513,8 @@ |
|
9126 // the call and the store. |
|
9127 AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); |
|
9128 AliasAnalysis::Location StoreLoc = AA.getLocation(SI); |
|
9129 - for (BasicBlock::iterator I = --BasicBlock::iterator(SI), |
|
9130 - E = C; I != E; --I) { |
|
9131 + for (BasicBlock::iterator I = --SI->getIterator(), |
|
9132 + E = C->getIterator(); I != E; --I) { |
|
9133 if (AA.getModRefInfo(&*I, StoreLoc) != AliasAnalysis::NoModRef) { |
|
9134 C = nullptr; |
|
9135 break; |
|
9136 @@ -556,7 +556,7 @@ |
|
9137 if (Value *ByteVal = isBytewiseValue(SI->getOperand(0))) |
|
9138 if (Instruction *I = tryMergingIntoMemset(SI, SI->getPointerOperand(), |
|
9139 ByteVal)) { |
|
9140 - BBI = I; // Don't invalidate iterator. |
|
9141 + BBI = I->getIterator(); // Don't invalidate iterator. |
|
9142 return true; |
|
9143 } |
|
9144 |
|
9145 @@ -569,7 +569,7 @@ |
|
9146 if (isa<ConstantInt>(MSI->getLength()) && !MSI->isVolatile()) |
|
9147 if (Instruction *I = tryMergingIntoMemset(MSI, MSI->getDest(), |
|
9148 MSI->getValue())) { |
|
9149 - BBI = I; // Don't invalidate iterator. |
|
9150 + BBI = I->getIterator(); // Don't invalidate iterator. |
|
9151 return true; |
|
9152 } |
|
9153 return false; |
|
9154 @@ -808,8 +808,8 @@ |
|
9155 // NOTE: This is conservative, it will stop on any read from the source loc, |
|
9156 // not just the defining memcpy. |
|
9157 MemDepResult SourceDep = |
|
9158 - MD->getPointerDependencyFrom(AA.getLocationForSource(MDep), |
|
9159 - false, M, M->getParent()); |
|
9160 + MD->getPointerDependencyFrom(AA.getLocationForSource(MDep), false, |
|
9161 + M->getIterator(), M->getParent()); |
|
9162 if (!SourceDep.isClobber() || SourceDep.getInst() != MDep) |
|
9163 return false; |
|
9164 |
|
9165 @@ -898,8 +898,9 @@ |
|
9166 } |
|
9167 |
|
9168 AliasAnalysis::Location SrcLoc = AliasAnalysis::getLocationForSource(M); |
|
9169 - MemDepResult SrcDepInfo = MD->getPointerDependencyFrom(SrcLoc, true, |
|
9170 - M, M->getParent()); |
|
9171 + MemDepResult SrcDepInfo = |
|
9172 + MD->getPointerDependencyFrom(SrcLoc, true, |
|
9173 + M->getIterator(), M->getParent()); |
|
9174 if (SrcDepInfo.isClobber()) { |
|
9175 if (MemCpyInst *MDep = dyn_cast<MemCpyInst>(SrcDepInfo.getInst())) |
|
9176 return processMemCpyMemCpyDependence(M, MDep, CopySize->getZExtValue()); |
|
9177 @@ -967,7 +968,8 @@ |
|
9178 uint64_t ByValSize = DL->getTypeAllocSize(ByValTy); |
|
9179 MemDepResult DepInfo = |
|
9180 MD->getPointerDependencyFrom(AliasAnalysis::Location(ByValArg, ByValSize), |
|
9181 - true, CS.getInstruction(), |
|
9182 + true, |
|
9183 + CS.getInstruction()->getIterator(), |
|
9184 CS.getInstruction()->getParent()); |
|
9185 if (!DepInfo.isClobber()) |
|
9186 return false; |
|
9187 @@ -1012,7 +1014,9 @@ |
|
9188 // not just the defining memcpy. |
|
9189 MemDepResult SourceDep = |
|
9190 MD->getPointerDependencyFrom(AliasAnalysis::getLocationForSource(MDep), |
|
9191 - false, CS.getInstruction(), MDep->getParent()); |
|
9192 + false, |
|
9193 + CS.getInstruction()->getIterator(), |
|
9194 + MDep->getParent()); |
|
9195 if (!SourceDep.isClobber() || SourceDep.getInst() != MDep) |
|
9196 return false; |
|
9197 |
|
9198 @@ -1039,7 +1043,8 @@ |
|
9199 for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) { |
|
9200 for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { |
|
9201 // Avoid invalidating the iterator. |
|
9202 - Instruction *I = BI++; |
|
9203 + Instruction *I = &*BI; |
|
9204 + ++BI; |
|
9205 |
|
9206 bool RepeatInstruction = false; |
|
9207 |
|
9208 --- lib/Transforms/Scalar/MergedLoadStoreMotion.cpp 2015-02-17 14:03:58.000000000 -0800 |
|
9209 +++ lib/Transforms/Scalar/MergedLoadStoreMotion.cpp 2015-11-28 18:11:58.690419443 -0800 |
|
9210 @@ -256,7 +256,7 @@ |
|
9211 |
|
9212 for (BasicBlock::iterator BBI = BB1->begin(), BBE = BB1->end(); BBI != BBE; |
|
9213 ++BBI) { |
|
9214 - Instruction *Inst = BBI; |
|
9215 + Instruction *Inst = &*BBI; |
|
9216 |
|
9217 // Only merge and hoist loads when their result in used only in BB |
|
9218 if (!isa<LoadInst>(Inst) || Inst->isUsedOutsideOfBlock(BB1)) |
|
9219 @@ -367,8 +367,7 @@ |
|
9220 int NLoads = 0; |
|
9221 for (BasicBlock::iterator BBI = Succ0->begin(), BBE = Succ0->end(); |
|
9222 BBI != BBE;) { |
|
9223 - |
|
9224 - Instruction *I = BBI; |
|
9225 + Instruction *I = &*BBI; |
|
9226 ++BBI; |
|
9227 |
|
9228 // Only move non-simple (atomic, volatile) loads. |
|
9229 @@ -448,7 +447,7 @@ |
|
9230 Value *Opd2 = S1->getValueOperand(); |
|
9231 if (Opd1 != Opd2) { |
|
9232 NewPN = PHINode::Create(Opd1->getType(), 2, Opd2->getName() + ".sink", |
|
9233 - BB->begin()); |
|
9234 + &BB->front()); |
|
9235 NewPN->addIncoming(Opd1, S0->getParent()); |
|
9236 NewPN->addIncoming(Opd2, S1->getParent()); |
|
9237 if (NewPN->getType()->getScalarType()->isPointerTy()) { |
|
9238 @@ -493,7 +492,7 @@ |
|
9239 StoreInst *SNew = (StoreInst *)(S0->clone()); |
|
9240 Instruction *ANew = A0->clone(); |
|
9241 AA->copyValue(S0, SNew); |
|
9242 - SNew->insertBefore(InsertPt); |
|
9243 + SNew->insertBefore(&*InsertPt); |
|
9244 ANew->insertBefore(SNew); |
|
9245 |
|
9246 assert(S0->getParent() == A0->getParent()); |
|
9247 @@ -588,7 +587,8 @@ |
|
9248 // Merge unconditional branches, allowing PRE to catch more |
|
9249 // optimization opportunities. |
|
9250 for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE;) { |
|
9251 - BasicBlock *BB = FI++; |
|
9252 + BasicBlock *BB = &*FI; |
|
9253 + ++FI; |
|
9254 |
|
9255 // Hoist equivalent loads and sink stores |
|
9256 // outside diamonds when possible |
|
9257 --- lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp 2014-08-01 16:21:21.000000000 -0700 |
|
9258 +++ lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp 2015-11-28 18:13:26.025414765 -0800 |
|
9259 @@ -152,7 +152,7 @@ |
|
9260 Phi->addIncoming(Call, &CurrBB); |
|
9261 Phi->addIncoming(LibCall, LibCallBB); |
|
9262 |
|
9263 - BB = JoinBB; |
|
9264 + BB = JoinBB->getIterator(); |
|
9265 return true; |
|
9266 } |
|
9267 |
|
9268 --- lib/Transforms/Scalar/Reassociate.cpp 2014-12-12 06:44:12.000000000 -0800 |
|
9269 +++ lib/Transforms/Scalar/Reassociate.cpp 2015-11-29 08:56:09.229859750 -0800 |
|
9270 @@ -295,7 +295,7 @@ |
|
9271 // we cannot move. This ensures that the ranks for these instructions are |
|
9272 // all different in the block. |
|
9273 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) |
|
9274 - if (isUnmovableInstruction(I)) |
|
9275 + if (isUnmovableInstruction(&*I)) |
|
9276 ValueRankMap[&*I] = ++BBRank; |
|
9277 } |
|
9278 } |
|
9279 @@ -968,14 +968,14 @@ |
|
9280 if (InvokeInst *II = dyn_cast<InvokeInst>(InstInput)) { |
|
9281 InsertPt = II->getNormalDest()->begin(); |
|
9282 } else { |
|
9283 - InsertPt = InstInput; |
|
9284 - ++InsertPt; |
|
9285 + InsertPt = ++InstInput->getIterator(); |
|
9286 } |
|
9287 while (isa<PHINode>(InsertPt)) ++InsertPt; |
|
9288 } else { |
|
9289 InsertPt = TheNeg->getParent()->getParent()->getEntryBlock().begin(); |
|
9290 } |
|
9291 - TheNeg->moveBefore(InsertPt); |
|
9292 + |
|
9293 + TheNeg->moveBefore(&*InsertPt); |
|
9294 return TheNeg; |
|
9295 } |
|
9296 |
|
9297 @@ -1160,7 +1160,7 @@ |
|
9298 return nullptr; |
|
9299 } |
|
9300 |
|
9301 - BasicBlock::iterator InsertPt = BO; ++InsertPt; |
|
9302 + BasicBlock::iterator InsertPt = ++BO->getIterator(); |
|
9303 |
|
9304 // If this was just a single multiply, remove the multiply and return the only |
|
9305 // remaining operand. |
|
9306 @@ -1173,7 +1173,7 @@ |
|
9307 } |
|
9308 |
|
9309 if (NeedsNegate) |
|
9310 - V = CreateNeg(V, "neg", InsertPt, BO); |
|
9311 + V = CreateNeg(V, "neg", &*InsertPt, BO); |
|
9312 |
|
9313 return V; |
|
9314 } |
|
9315 @@ -2262,10 +2262,10 @@ |
|
9316 for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; ++BI) { |
|
9317 // Optimize every instruction in the basic block. |
|
9318 for (BasicBlock::iterator II = BI->begin(), IE = BI->end(); II != IE; ) |
|
9319 - if (isInstructionTriviallyDead(II)) { |
|
9320 - EraseInst(II++); |
|
9321 + if (isInstructionTriviallyDead(&*II)) { |
|
9322 + EraseInst(&*II++); |
|
9323 } else { |
|
9324 - OptimizeInst(II); |
|
9325 + OptimizeInst(&*II); |
|
9326 assert(II->getParent() == BI && "Moved to a different block!"); |
|
9327 ++II; |
|
9328 } |
|
9329 --- lib/Transforms/Scalar/Reg2Mem.cpp 2015-01-12 19:46:47.000000000 -0800 |
|
9330 +++ lib/Transforms/Scalar/Reg2Mem.cpp 2015-11-28 18:22:35.790368260 -0800 |
|
9331 @@ -85,7 +85,7 @@ |
|
9332 CastInst *AllocaInsertionPoint = |
|
9333 new BitCastInst(Constant::getNullValue(Type::getInt32Ty(F.getContext())), |
|
9334 Type::getInt32Ty(F.getContext()), |
|
9335 - "reg2mem alloca point", I); |
|
9336 + "reg2mem alloca point", &*I); |
|
9337 |
|
9338 // Find the escaped instructions. But don't create stack slots for |
|
9339 // allocas in entry block. |
|
9340 @@ -95,7 +95,7 @@ |
|
9341 for (BasicBlock::iterator iib = ibb->begin(), iie = ibb->end(); |
|
9342 iib != iie; ++iib) { |
|
9343 if (!(isa<AllocaInst>(iib) && iib->getParent() == BBEntry) && |
|
9344 - valueEscapes(iib)) { |
|
9345 + valueEscapes(&*iib)) { |
|
9346 WorkList.push_front(&*iib); |
|
9347 } |
|
9348 } |
|
9349 --- lib/Transforms/Scalar/SCCP.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
9350 +++ lib/Transforms/Scalar/SCCP.cpp 2015-11-28 19:12:24.103813993 -0800 |
|
9351 @@ -1125,7 +1125,7 @@ |
|
9352 // entry block executable and merge in the actual arguments to the call into |
|
9353 // the formal arguments of the function. |
|
9354 if (!TrackingIncomingArguments.empty() && TrackingIncomingArguments.count(F)){ |
|
9355 - MarkBlockExecutable(F->begin()); |
|
9356 + MarkBlockExecutable(&F->front()); |
|
9357 |
|
9358 // Propagate information from this call site into the callee. |
|
9359 CallSite::arg_iterator CAI = CS.arg_begin(); |
|
9360 @@ -1134,17 +1134,17 @@ |
|
9361 // If this argument is byval, and if the function is not readonly, there |
|
9362 // will be an implicit copy formed of the input aggregate. |
|
9363 if (AI->hasByValAttr() && !F->onlyReadsMemory()) { |
|
9364 - markOverdefined(AI); |
|
9365 + markOverdefined(&*AI); |
|
9366 continue; |
|
9367 } |
|
9368 |
|
9369 if (StructType *STy = dyn_cast<StructType>(AI->getType())) { |
|
9370 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { |
|
9371 LatticeVal CallArg = getStructValueState(*CAI, i); |
|
9372 - mergeInValue(getStructValueState(AI, i), AI, CallArg); |
|
9373 + mergeInValue(getStructValueState(&*AI, i), &*AI, CallArg); |
|
9374 } |
|
9375 } else { |
|
9376 - mergeInValue(AI, getValueState(*CAI)); |
|
9377 + mergeInValue(&*AI, getValueState(*CAI)); |
|
9378 } |
|
9379 } |
|
9380 } |
|
9381 @@ -1245,18 +1245,18 @@ |
|
9382 /// even if X isn't defined. |
|
9383 bool SCCPSolver::ResolvedUndefsIn(Function &F) { |
|
9384 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { |
|
9385 - if (!BBExecutable.count(BB)) |
|
9386 + if (!BBExecutable.count(&*BB)) |
|
9387 continue; |
|
9388 |
|
9389 - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { |
|
9390 + for (Instruction &I : *BB) { |
|
9391 // Look for instructions which produce undef values. |
|
9392 - if (I->getType()->isVoidTy()) continue; |
|
9393 + if (I.getType()->isVoidTy()) continue; |
|
9394 |
|
9395 - if (StructType *STy = dyn_cast<StructType>(I->getType())) { |
|
9396 + if (StructType *STy = dyn_cast<StructType>(I.getType())) { |
|
9397 // Only a few things that can be structs matter for undef. |
|
9398 |
|
9399 // Tracked calls must never be marked overdefined in ResolvedUndefsIn. |
|
9400 - if (CallSite CS = CallSite(I)) |
|
9401 + if (CallSite CS = CallSite(&I)) |
|
9402 if (Function *F = CS.getCalledFunction()) |
|
9403 if (MRVFunctionsTracked.count(F)) |
|
9404 continue; |
|
9405 @@ -1269,14 +1269,14 @@ |
|
9406 // Send the results of everything else to overdefined. We could be |
|
9407 // more precise than this but it isn't worth bothering. |
|
9408 for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) { |
|
9409 - LatticeVal &LV = getStructValueState(I, i); |
|
9410 + LatticeVal &LV = getStructValueState(&I, i); |
|
9411 if (LV.isUndefined()) |
|
9412 - markOverdefined(LV, I); |
|
9413 + markOverdefined(LV, &I); |
|
9414 } |
|
9415 continue; |
|
9416 } |
|
9417 |
|
9418 - LatticeVal &LV = getValueState(I); |
|
9419 + LatticeVal &LV = getValueState(&I); |
|
9420 if (!LV.isUndefined()) continue; |
|
9421 |
|
9422 // extractvalue is safe; check here because the argument is a struct. |
|
9423 @@ -1286,24 +1286,24 @@ |
|
9424 // Compute the operand LatticeVals, for convenience below. |
|
9425 // Anything taking a struct is conservatively assumed to require |
|
9426 // overdefined markings. |
|
9427 - if (I->getOperand(0)->getType()->isStructTy()) { |
|
9428 - markOverdefined(I); |
|
9429 + if (I.getOperand(0)->getType()->isStructTy()) { |
|
9430 + markOverdefined(&I); |
|
9431 return true; |
|
9432 } |
|
9433 - LatticeVal Op0LV = getValueState(I->getOperand(0)); |
|
9434 + LatticeVal Op0LV = getValueState(I.getOperand(0)); |
|
9435 LatticeVal Op1LV; |
|
9436 - if (I->getNumOperands() == 2) { |
|
9437 - if (I->getOperand(1)->getType()->isStructTy()) { |
|
9438 - markOverdefined(I); |
|
9439 + if (I.getNumOperands() == 2) { |
|
9440 + if (I.getOperand(1)->getType()->isStructTy()) { |
|
9441 + markOverdefined(&I); |
|
9442 return true; |
|
9443 } |
|
9444 |
|
9445 - Op1LV = getValueState(I->getOperand(1)); |
|
9446 + Op1LV = getValueState(I.getOperand(1)); |
|
9447 } |
|
9448 // If this is an instructions whose result is defined even if the input is |
|
9449 // not fully defined, propagate the information. |
|
9450 - Type *ITy = I->getType(); |
|
9451 - switch (I->getOpcode()) { |
|
9452 + Type *ITy = I.getType(); |
|
9453 + switch (I.getOpcode()) { |
|
9454 case Instruction::Add: |
|
9455 case Instruction::Sub: |
|
9456 case Instruction::Trunc: |
|
9457 @@ -1317,9 +1317,9 @@ |
|
9458 case Instruction::FRem: |
|
9459 // Floating-point binary operation: be conservative. |
|
9460 if (Op0LV.isUndefined() && Op1LV.isUndefined()) |
|
9461 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9462 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9463 else |
|
9464 - markOverdefined(I); |
|
9465 + markOverdefined(&I); |
|
9466 return true; |
|
9467 case Instruction::ZExt: |
|
9468 case Instruction::SExt: |
|
9469 @@ -1331,7 +1331,7 @@ |
|
9470 case Instruction::SIToFP: |
|
9471 case Instruction::UIToFP: |
|
9472 // undef -> 0; some outputs are impossible |
|
9473 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9474 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9475 return true; |
|
9476 case Instruction::Mul: |
|
9477 case Instruction::And: |
|
9478 @@ -1340,7 +1340,7 @@ |
|
9479 break; |
|
9480 // undef * X -> 0. X could be zero. |
|
9481 // undef & X -> 0. X could be zero. |
|
9482 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9483 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9484 return true; |
|
9485 |
|
9486 case Instruction::Or: |
|
9487 @@ -1348,7 +1348,7 @@ |
|
9488 if (Op0LV.isUndefined() && Op1LV.isUndefined()) |
|
9489 break; |
|
9490 // undef | X -> -1. X could be -1. |
|
9491 - markForcedConstant(I, Constant::getAllOnesValue(ITy)); |
|
9492 + markForcedConstant(&I, Constant::getAllOnesValue(ITy)); |
|
9493 return true; |
|
9494 |
|
9495 case Instruction::Xor: |
|
9496 @@ -1356,7 +1356,7 @@ |
|
9497 // necessary, but we try to be nice to people who expect this |
|
9498 // behavior in simple cases |
|
9499 if (Op0LV.isUndefined() && Op1LV.isUndefined()) { |
|
9500 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9501 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9502 return true; |
|
9503 } |
|
9504 // undef ^ X -> undef |
|
9505 @@ -1372,7 +1372,7 @@ |
|
9506 |
|
9507 // undef / X -> 0. X could be maxint. |
|
9508 // undef % X -> 0. X could be 1. |
|
9509 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9510 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9511 return true; |
|
9512 |
|
9513 case Instruction::AShr: |
|
9514 @@ -1380,7 +1380,7 @@ |
|
9515 if (Op1LV.isUndefined()) break; |
|
9516 |
|
9517 // undef >>a X -> all ones |
|
9518 - markForcedConstant(I, Constant::getAllOnesValue(ITy)); |
|
9519 + markForcedConstant(&I, Constant::getAllOnesValue(ITy)); |
|
9520 return true; |
|
9521 case Instruction::LShr: |
|
9522 case Instruction::Shl: |
|
9523 @@ -1390,17 +1390,17 @@ |
|
9524 |
|
9525 // undef << X -> 0 |
|
9526 // undef >> X -> 0 |
|
9527 - markForcedConstant(I, Constant::getNullValue(ITy)); |
|
9528 + markForcedConstant(&I, Constant::getNullValue(ITy)); |
|
9529 return true; |
|
9530 case Instruction::Select: |
|
9531 - Op1LV = getValueState(I->getOperand(1)); |
|
9532 + Op1LV = getValueState(I.getOperand(1)); |
|
9533 // undef ? X : Y -> X or Y. There could be commonality between X/Y. |
|
9534 if (Op0LV.isUndefined()) { |
|
9535 if (!Op1LV.isConstant()) // Pick the constant one if there is any. |
|
9536 - Op1LV = getValueState(I->getOperand(2)); |
|
9537 + Op1LV = getValueState(I.getOperand(2)); |
|
9538 } else if (Op1LV.isUndefined()) { |
|
9539 // c ? undef : undef -> undef. No change. |
|
9540 - Op1LV = getValueState(I->getOperand(2)); |
|
9541 + Op1LV = getValueState(I.getOperand(2)); |
|
9542 if (Op1LV.isUndefined()) |
|
9543 break; |
|
9544 // Otherwise, c ? undef : x -> x. |
|
9545 @@ -1409,9 +1409,9 @@ |
|
9546 } |
|
9547 |
|
9548 if (Op1LV.isConstant()) |
|
9549 - markForcedConstant(I, Op1LV.getConstant()); |
|
9550 + markForcedConstant(&I, Op1LV.getConstant()); |
|
9551 else |
|
9552 - markOverdefined(I); |
|
9553 + markOverdefined(&I); |
|
9554 return true; |
|
9555 case Instruction::Load: |
|
9556 // A load here means one of two things: a load of undef from a global, |
|
9557 @@ -1420,9 +1420,9 @@ |
|
9558 break; |
|
9559 case Instruction::ICmp: |
|
9560 // X == undef -> undef. Other comparisons get more complicated. |
|
9561 - if (cast<ICmpInst>(I)->isEquality()) |
|
9562 + if (cast<ICmpInst>(&I)->isEquality()) |
|
9563 break; |
|
9564 - markOverdefined(I); |
|
9565 + markOverdefined(&I); |
|
9566 return true; |
|
9567 case Instruction::Call: |
|
9568 case Instruction::Invoke: { |
|
9569 @@ -1431,19 +1431,19 @@ |
|
9570 // 2. It could be constant-foldable. |
|
9571 // Because of the way we solve return values, tracked calls must |
|
9572 // never be marked overdefined in ResolvedUndefsIn. |
|
9573 - if (Function *F = CallSite(I).getCalledFunction()) |
|
9574 + if (Function *F = CallSite(&I).getCalledFunction()) |
|
9575 if (TrackedRetVals.count(F)) |
|
9576 break; |
|
9577 |
|
9578 // If the call is constant-foldable, we mark it overdefined because |
|
9579 // we do not know what return values are valid. |
|
9580 - markOverdefined(I); |
|
9581 + markOverdefined(&I); |
|
9582 return true; |
|
9583 } |
|
9584 default: |
|
9585 // If we don't know what should happen here, conservatively mark it |
|
9586 // overdefined. |
|
9587 - markOverdefined(I); |
|
9588 + markOverdefined(&I); |
|
9589 return true; |
|
9590 } |
|
9591 } |
|
9592 @@ -1461,7 +1461,7 @@ |
|
9593 // false. |
|
9594 if (isa<UndefValue>(BI->getCondition())) { |
|
9595 BI->setCondition(ConstantInt::getFalse(BI->getContext())); |
|
9596 - markEdgeExecutable(BB, TI->getSuccessor(1)); |
|
9597 + markEdgeExecutable(&*BB, TI->getSuccessor(1)); |
|
9598 return true; |
|
9599 } |
|
9600 |
|
9601 @@ -1483,7 +1483,7 @@ |
|
9602 // the first constant. |
|
9603 if (isa<UndefValue>(SI->getCondition())) { |
|
9604 SI->setCondition(SI->case_begin().getCaseValue()); |
|
9605 - markEdgeExecutable(BB, SI->case_begin().getCaseSuccessor()); |
|
9606 + markEdgeExecutable(&*BB, SI->case_begin().getCaseSuccessor()); |
|
9607 return true; |
|
9608 } |
|
9609 |
|
9610 @@ -1540,8 +1540,7 @@ |
|
9611 Instruction *EndInst = BB->getTerminator(); // Last not to be deleted. |
|
9612 while (EndInst != BB->begin()) { |
|
9613 // Delete the next to last instruction. |
|
9614 - BasicBlock::iterator I = EndInst; |
|
9615 - Instruction *Inst = --I; |
|
9616 + Instruction *Inst = &*--EndInst->getIterator(); |
|
9617 if (!Inst->use_empty()) |
|
9618 Inst->replaceAllUsesWith(UndefValue::get(Inst->getType())); |
|
9619 if (isa<LandingPadInst>(Inst)) { |
|
9620 @@ -1567,11 +1566,11 @@ |
|
9621 SCCPSolver Solver(DL, TLI); |
|
9622 |
|
9623 // Mark the first block of the function as being executable. |
|
9624 - Solver.MarkBlockExecutable(F.begin()); |
|
9625 + Solver.MarkBlockExecutable(&F.front()); |
|
9626 |
|
9627 // Mark all arguments to the function as being overdefined. |
|
9628 - for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E;++AI) |
|
9629 - Solver.markAnythingOverdefined(AI); |
|
9630 + for (Argument &AI : F.args()) |
|
9631 + Solver.markAnythingOverdefined(&AI); |
|
9632 |
|
9633 // Solve for constants. |
|
9634 bool ResolvedUndefs = true; |
|
9635 @@ -1588,8 +1587,8 @@ |
|
9636 // as we cannot modify the CFG of the function. |
|
9637 |
|
9638 for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { |
|
9639 - if (!Solver.isBlockExecutable(BB)) { |
|
9640 - DeleteInstructionInBlock(BB); |
|
9641 + if (!Solver.isBlockExecutable(&*BB)) { |
|
9642 + DeleteInstructionInBlock(&*BB); |
|
9643 MadeChanges = true; |
|
9644 continue; |
|
9645 } |
|
9646 @@ -1598,7 +1597,7 @@ |
|
9647 // constants if we have found them to be of constant values. |
|
9648 // |
|
9649 for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { |
|
9650 - Instruction *Inst = BI++; |
|
9651 + Instruction *Inst = &*BI++; |
|
9652 if (Inst->getType()->isVoidTy() || isa<TerminatorInst>(Inst)) |
|
9653 continue; |
|
9654 |
|
9655 @@ -1712,36 +1711,34 @@ |
|
9656 // If this is a strong or ODR definition of this function, then we can |
|
9657 // propagate information about its result into callsites of it. |
|
9658 if (!F->mayBeOverridden()) |
|
9659 - Solver.AddTrackedFunction(F); |
|
9660 + Solver.AddTrackedFunction(&*F); |
|
9661 |
|
9662 // If this function only has direct calls that we can see, we can track its |
|
9663 // arguments and return value aggressively, and can assume it is not called |
|
9664 // unless we see evidence to the contrary. |
|
9665 if (F->hasLocalLinkage()) { |
|
9666 - if (AddressIsTaken(F)) |
|
9667 - AddressTakenFunctions.insert(F); |
|
9668 + if (AddressIsTaken(&*F)) |
|
9669 + AddressTakenFunctions.insert(&*F); |
|
9670 else { |
|
9671 - Solver.AddArgumentTrackedFunction(F); |
|
9672 + Solver.AddArgumentTrackedFunction(&*F); |
|
9673 continue; |
|
9674 } |
|
9675 } |
|
9676 |
|
9677 // Assume the function is called. |
|
9678 - Solver.MarkBlockExecutable(F->begin()); |
|
9679 + Solver.MarkBlockExecutable(&F->front()); |
|
9680 |
|
9681 // Assume nothing about the incoming arguments. |
|
9682 - for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); |
|
9683 - AI != E; ++AI) |
|
9684 - Solver.markAnythingOverdefined(AI); |
|
9685 + for (Argument &AI : F->args()) |
|
9686 + Solver.markAnythingOverdefined(&AI); |
|
9687 } |
|
9688 |
|
9689 // Loop over global variables. We inform the solver about any internal global |
|
9690 // variables that do not have their 'addresses taken'. If they don't have |
|
9691 // their addresses taken, we can propagate constants through them. |
|
9692 - for (Module::global_iterator G = M.global_begin(), E = M.global_end(); |
|
9693 - G != E; ++G) |
|
9694 - if (!G->isConstant() && G->hasLocalLinkage() && !AddressIsTaken(G)) |
|
9695 - Solver.TrackValueOfGlobalVariable(G); |
|
9696 + for (GlobalVariable &G : M.globals()) |
|
9697 + if (!G.isConstant() && G.hasLocalLinkage() && !AddressIsTaken(&G)) |
|
9698 + Solver.TrackValueOfGlobalVariable(&G); |
|
9699 |
|
9700 // Solve for constants. |
|
9701 bool ResolvedUndefs = true; |
|
9702 @@ -1762,7 +1759,10 @@ |
|
9703 SmallVector<BasicBlock*, 512> BlocksToErase; |
|
9704 |
|
9705 for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { |
|
9706 - if (Solver.isBlockExecutable(F->begin())) { |
|
9707 + if (F->isDeclaration()) |
|
9708 + continue; |
|
9709 + |
|
9710 + if (Solver.isBlockExecutable(&F->front())) { |
|
9711 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); |
|
9712 AI != E; ++AI) { |
|
9713 if (AI->use_empty() || AI->getType()->isStructTy()) continue; |
|
9714 @@ -1770,7 +1770,7 @@ |
|
9715 // TODO: Could use getStructLatticeValueFor to find out if the entire |
|
9716 // result is a constant and replace it entirely if so. |
|
9717 |
|
9718 - LatticeVal IV = Solver.getLatticeValueFor(AI); |
|
9719 + LatticeVal IV = Solver.getLatticeValueFor(&*AI); |
|
9720 if (IV.isOverdefined()) continue; |
|
9721 |
|
9722 Constant *CST = IV.isConstant() ? |
|
9723 @@ -1785,29 +1785,29 @@ |
|
9724 } |
|
9725 |
|
9726 for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { |
|
9727 - if (!Solver.isBlockExecutable(BB)) { |
|
9728 - DeleteInstructionInBlock(BB); |
|
9729 + if (!Solver.isBlockExecutable(&*BB)) { |
|
9730 + DeleteInstructionInBlock(&*BB); |
|
9731 MadeChanges = true; |
|
9732 |
|
9733 TerminatorInst *TI = BB->getTerminator(); |
|
9734 for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) { |
|
9735 BasicBlock *Succ = TI->getSuccessor(i); |
|
9736 if (!Succ->empty() && isa<PHINode>(Succ->begin())) |
|
9737 - TI->getSuccessor(i)->removePredecessor(BB); |
|
9738 + TI->getSuccessor(i)->removePredecessor(&*BB); |
|
9739 } |
|
9740 + |
|
9741 if (!TI->use_empty()) |
|
9742 TI->replaceAllUsesWith(UndefValue::get(TI->getType())); |
|
9743 TI->eraseFromParent(); |
|
9744 + new UnreachableInst(M.getContext(), &*BB); |
|
9745 |
|
9746 if (&*BB != &F->front()) |
|
9747 - BlocksToErase.push_back(BB); |
|
9748 - else |
|
9749 - new UnreachableInst(M.getContext(), BB); |
|
9750 + BlocksToErase.push_back(&*BB); |
|
9751 continue; |
|
9752 } |
|
9753 |
|
9754 for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { |
|
9755 - Instruction *Inst = BI++; |
|
9756 + Instruction *Inst = &*BI++; |
|
9757 if (Inst->getType()->isVoidTy() || Inst->getType()->isStructTy()) |
|
9758 continue; |
|
9759 |
|
9760 --- lib/Transforms/Scalar/SROA.cpp 2015-01-07 18:02:00.000000000 -0800 |
|
9761 +++ lib/Transforms/Scalar/SROA.cpp 2015-11-28 19:22:34.615193007 -0800 |
|
9762 @@ -1370,7 +1370,7 @@ |
|
9763 |
|
9764 // Ensure that there are no instructions between the PHI and the load that |
|
9765 // could store. |
|
9766 - for (BasicBlock::iterator BBI = &PN; &*BBI != LI; ++BBI) |
|
9767 + for (BasicBlock::iterator BBI(PN); &*BBI != LI; ++BBI) |
|
9768 if (BBI->mayWriteToMemory()) |
|
9769 return false; |
|
9770 |
|
9771 @@ -2607,7 +2607,8 @@ |
|
9772 DL.getTypeStoreSizeInBits(LI.getType()) && |
|
9773 "Non-byte-multiple bit width"); |
|
9774 // Move the insertion point just past the load so that we can refer to it. |
|
9775 - IRB.SetInsertPoint(std::next(BasicBlock::iterator(&LI))); |
|
9776 + IRB.SetInsertPoint(&*std::next(BasicBlock::iterator(&LI))); |
|
9777 + |
|
9778 // Create a placeholder value with the same type as LI to use as the |
|
9779 // basis for the new value. This allows us to replace the uses of LI with |
|
9780 // the computed value, and then replace the placeholder with LI, leaving |
|
9781 @@ -3069,7 +3070,7 @@ |
|
9782 // dominate the PHI. |
|
9783 IRBuilderTy PtrBuilder(IRB); |
|
9784 if (isa<PHINode>(OldPtr)) |
|
9785 - PtrBuilder.SetInsertPoint(OldPtr->getParent()->getFirstInsertionPt()); |
|
9786 + PtrBuilder.SetInsertPoint(&*OldPtr->getParent()->getFirstInsertionPt()); |
|
9787 else |
|
9788 PtrBuilder.SetInsertPoint(OldPtr); |
|
9789 PtrBuilder.SetCurrentDebugLocation(OldPtr->getDebugLoc()); |
|
9790 @@ -3714,7 +3715,7 @@ |
|
9791 "Cannot represent alloca access size using 64-bit integers!"); |
|
9792 |
|
9793 Instruction *BasePtr = cast<Instruction>(LI->getPointerOperand()); |
|
9794 - IRB.SetInsertPoint(BasicBlock::iterator(LI)); |
|
9795 + IRB.SetInsertPoint(LI); |
|
9796 |
|
9797 DEBUG(dbgs() << " Splitting load: " << *LI << "\n"); |
|
9798 |
|
9799 @@ -3766,7 +3767,7 @@ |
|
9800 } |
|
9801 |
|
9802 Value *StoreBasePtr = SI->getPointerOperand(); |
|
9803 - IRB.SetInsertPoint(BasicBlock::iterator(SI)); |
|
9804 + IRB.SetInsertPoint(SI); |
|
9805 |
|
9806 DEBUG(dbgs() << " Splitting store of load: " << *SI << "\n"); |
|
9807 |
|
9808 @@ -3855,7 +3856,7 @@ |
|
9809 if (SplitLoads) { |
|
9810 PLoad = (*SplitLoads)[Idx]; |
|
9811 } else { |
|
9812 - IRB.SetInsertPoint(BasicBlock::iterator(LI)); |
|
9813 + IRB.SetInsertPoint(LI); |
|
9814 PLoad = IRB.CreateAlignedLoad( |
|
9815 getAdjustedPtr(IRB, *DL, LoadBasePtr, |
|
9816 APInt(DL->getPointerSizeInBits(), PartOffset), |
|
9817 @@ -3865,7 +3866,7 @@ |
|
9818 } |
|
9819 |
|
9820 // And store this partition. |
|
9821 - IRB.SetInsertPoint(BasicBlock::iterator(SI)); |
|
9822 + IRB.SetInsertPoint(SI); |
|
9823 StoreInst *PStore = IRB.CreateAlignedStore( |
|
9824 PLoad, getAdjustedPtr(IRB, *DL, StoreBasePtr, |
|
9825 APInt(DL->getPointerSizeInBits(), PartOffset), |
|
9826 --- lib/Transforms/Scalar/SampleProfile.cpp 2014-11-18 23:49:26.000000000 -0800 |
|
9827 +++ lib/Transforms/Scalar/SampleProfile.cpp 2016-01-23 20:40:41.000000000 -0800 |
|
9828 @@ -54,8 +54,10 @@ |
|
9829 |
|
9830 // Command line option to specify the file to read samples from. This is |
|
9831 // mainly used for debugging. |
|
9832 -static cl::opt<std::string> SampleProfileFile( |
|
9833 - "sample-profile-file", cl::init(""), cl::value_desc("filename"), |
|
9834 +static std::string EmptyInitString(""); |
|
9835 +static cl::opt<std::string> |
|
9836 +SampleProfileFile("sample-profile-file", cl::init(EmptyInitString), |
|
9837 + cl::value_desc("filename"), |
|
9838 cl::desc("Profile file loaded by -sample-profile"), cl::Hidden); |
|
9839 static cl::opt<unsigned> SampleProfileMaxPropagateIterations( |
|
9840 "sample-profile-max-propagate-iterations", cl::init(100), |
|
9841 --- lib/Transforms/Scalar/ScalarReplAggregates.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
9842 +++ lib/Transforms/Scalar/ScalarReplAggregates.cpp 2015-11-28 18:31:24.445308022 -0800 |
|
9843 @@ -382,8 +382,9 @@ |
|
9844 // Create and insert the integer alloca. |
|
9845 NewTy = IntegerType::get(AI->getContext(), BitWidth); |
|
9846 } |
|
9847 + |
|
9848 AllocaInst *NewAI = new AllocaInst(NewTy, nullptr, "", |
|
9849 - AI->getParent()->begin()); |
|
9850 + &AI->getParent()->front()); |
|
9851 ConvertUsesToScalar(AI, NewAI, 0, nullptr); |
|
9852 return NewAI; |
|
9853 } |
|
9854 @@ -1202,7 +1203,7 @@ |
|
9855 |
|
9856 // Ensure that there are no instructions between the PHI and the load that |
|
9857 // could store. |
|
9858 - for (BasicBlock::iterator BBI = PN; &*BBI != LI; ++BBI) |
|
9859 + for (BasicBlock::iterator BBI(PN); &*BBI != LI; ++BBI) |
|
9860 if (BBI->mayWriteToMemory()) |
|
9861 return false; |
|
9862 |
|
9863 --- lib/Transforms/Scalar/Scalarizer.cpp 2014-11-11 13:30:22.000000000 -0800 |
|
9864 +++ lib/Transforms/Scalar/Scalarizer.cpp 2015-11-29 08:58:18.947961675 -0800 |
|
9865 @@ -250,10 +250,9 @@ |
|
9866 bool Scalarizer::runOnFunction(Function &F) { |
|
9867 DataLayoutPass *DLP = getAnalysisIfAvailable<DataLayoutPass>(); |
|
9868 DL = DLP ? &DLP->getDataLayout() : nullptr; |
|
9869 - for (Function::iterator BBI = F.begin(), BBE = F.end(); BBI != BBE; ++BBI) { |
|
9870 - BasicBlock *BB = BBI; |
|
9871 - for (BasicBlock::iterator II = BB->begin(), IE = BB->end(); II != IE;) { |
|
9872 - Instruction *I = II; |
|
9873 + for (BasicBlock &BB : F) { |
|
9874 + for (BasicBlock::iterator II = BB.begin(), IE = BB.end(); II != IE;) { |
|
9875 + Instruction *I = &*II; |
|
9876 bool Done = visit(I); |
|
9877 ++II; |
|
9878 if (Done && I->getType()->isVoidTy()) |
|
9879 @@ -282,7 +281,7 @@ |
|
9880 } |
|
9881 // In the fallback case, just put the scattered before Point and |
|
9882 // keep the result local to Point. |
|
9883 - return Scatterer(Point->getParent(), Point, V); |
|
9884 + return Scatterer(Point->getParent(), Point->getIterator(), V); |
|
9885 } |
|
9886 |
|
9887 // Replace Op with the gathered form of the components in CV. Defer the |
|
9888 @@ -377,7 +376,7 @@ |
|
9889 return false; |
|
9890 |
|
9891 unsigned NumElems = VT->getNumElements(); |
|
9892 - IRBuilder<> Builder(I.getParent(), &I); |
|
9893 + IRBuilder<> Builder(&I); |
|
9894 Scatterer Op0 = scatter(&I, I.getOperand(0)); |
|
9895 Scatterer Op1 = scatter(&I, I.getOperand(1)); |
|
9896 assert(Op0.size() == NumElems && "Mismatched binary operation"); |
|
9897 @@ -397,7 +396,7 @@ |
|
9898 return false; |
|
9899 |
|
9900 unsigned NumElems = VT->getNumElements(); |
|
9901 - IRBuilder<> Builder(SI.getParent(), &SI); |
|
9902 + IRBuilder<> Builder(&SI); |
|
9903 Scatterer Op1 = scatter(&SI, SI.getOperand(1)); |
|
9904 Scatterer Op2 = scatter(&SI, SI.getOperand(2)); |
|
9905 assert(Op1.size() == NumElems && "Mismatched select"); |
|
9906 @@ -438,7 +437,7 @@ |
|
9907 if (!VT) |
|
9908 return false; |
|
9909 |
|
9910 - IRBuilder<> Builder(GEPI.getParent(), &GEPI); |
|
9911 + IRBuilder<> Builder(&GEPI); |
|
9912 unsigned NumElems = VT->getNumElements(); |
|
9913 unsigned NumIndices = GEPI.getNumIndices(); |
|
9914 |
|
9915 @@ -472,7 +471,7 @@ |
|
9916 return false; |
|
9917 |
|
9918 unsigned NumElems = VT->getNumElements(); |
|
9919 - IRBuilder<> Builder(CI.getParent(), &CI); |
|
9920 + IRBuilder<> Builder(&CI); |
|
9921 Scatterer Op0 = scatter(&CI, CI.getOperand(0)); |
|
9922 assert(Op0.size() == NumElems && "Mismatched cast"); |
|
9923 ValueVector Res; |
|
9924 @@ -492,7 +491,7 @@ |
|
9925 |
|
9926 unsigned DstNumElems = DstVT->getNumElements(); |
|
9927 unsigned SrcNumElems = SrcVT->getNumElements(); |
|
9928 - IRBuilder<> Builder(BCI.getParent(), &BCI); |
|
9929 + IRBuilder<> Builder(&BCI); |
|
9930 Scatterer Op0 = scatter(&BCI, BCI.getOperand(0)); |
|
9931 ValueVector Res; |
|
9932 Res.resize(DstNumElems); |
|
9933 @@ -569,7 +568,7 @@ |
|
9934 return false; |
|
9935 |
|
9936 unsigned NumElems = VT->getNumElements(); |
|
9937 - IRBuilder<> Builder(PHI.getParent(), &PHI); |
|
9938 + IRBuilder<> Builder(&PHI); |
|
9939 ValueVector Res; |
|
9940 Res.resize(NumElems); |
|
9941 |
|
9942 @@ -599,7 +598,7 @@ |
|
9943 return false; |
|
9944 |
|
9945 unsigned NumElems = Layout.VecTy->getNumElements(); |
|
9946 - IRBuilder<> Builder(LI.getParent(), &LI); |
|
9947 + IRBuilder<> Builder(&LI); |
|
9948 Scatterer Ptr = scatter(&LI, LI.getPointerOperand()); |
|
9949 ValueVector Res; |
|
9950 Res.resize(NumElems); |
|
9951 @@ -623,7 +622,7 @@ |
|
9952 return false; |
|
9953 |
|
9954 unsigned NumElems = Layout.VecTy->getNumElements(); |
|
9955 - IRBuilder<> Builder(SI.getParent(), &SI); |
|
9956 + IRBuilder<> Builder(&SI); |
|
9957 Scatterer Ptr = scatter(&SI, SI.getPointerOperand()); |
|
9958 Scatterer Val = scatter(&SI, FullValue); |
|
9959 |
|
9960 @@ -653,7 +652,7 @@ |
|
9961 Value *Res = UndefValue::get(Ty); |
|
9962 BasicBlock *BB = Op->getParent(); |
|
9963 unsigned Count = Ty->getVectorNumElements(); |
|
9964 - IRBuilder<> Builder(BB, Op); |
|
9965 + IRBuilder<> Builder(Op); |
|
9966 if (isa<PHINode>(Op)) |
|
9967 Builder.SetInsertPoint(BB, BB->getFirstInsertionPt()); |
|
9968 for (unsigned I = 0; I < Count; ++I) |
|
9969 --- lib/Transforms/Scalar/SimplifyCFGPass.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
9970 +++ lib/Transforms/Scalar/SimplifyCFGPass.cpp 2015-11-28 19:16:00.355459043 -0800 |
|
9971 @@ -96,7 +96,7 @@ |
|
9972 // single PHI node that is the operand to the return. |
|
9973 if (Ret != &BB.front()) { |
|
9974 // Check for something else in the block. |
|
9975 - BasicBlock::iterator I = Ret; |
|
9976 + BasicBlock::iterator I(Ret); |
|
9977 --I; |
|
9978 // Skip over debug info. |
|
9979 while (isa<DbgInfoIntrinsic>(I) && I != BB.begin()) |
|
9980 @@ -104,7 +104,7 @@ |
|
9981 if (!isa<DbgInfoIntrinsic>(I) && |
|
9982 (!isa<PHINode>(I) || I != BB.begin() || |
|
9983 Ret->getNumOperands() == 0 || |
|
9984 - Ret->getOperand(0) != I)) |
|
9985 + Ret->getOperand(0) != &*I)) |
|
9986 continue; |
|
9987 } |
|
9988 |
|
9989 @@ -166,7 +166,7 @@ |
|
9990 // Loop over all of the basic blocks and remove them if they are unneeded... |
|
9991 // |
|
9992 for (Function::iterator BBIt = F.begin(); BBIt != F.end(); ) { |
|
9993 - if (SimplifyCFG(BBIt++, TTI, BonusInstThreshold, DL, AC)) { |
|
9994 + if (SimplifyCFG(&*BBIt++, TTI, BonusInstThreshold, DL, AC)) { |
|
9995 LocalChange = true; |
|
9996 ++NumSimpl; |
|
9997 } |
|
9998 --- lib/Transforms/Scalar/Sink.cpp 2014-08-24 16:23:06.000000000 -0700 |
|
9999 +++ lib/Transforms/Scalar/Sink.cpp 2015-11-28 19:17:12.178518993 -0800 |
|
10000 @@ -136,7 +136,7 @@ |
|
10001 bool ProcessedBegin = false; |
|
10002 SmallPtrSet<Instruction *, 8> Stores; |
|
10003 do { |
|
10004 - Instruction *Inst = I; // The instruction to sink. |
|
10005 + Instruction *Inst = &*I; // The instruction to sink. |
|
10006 |
|
10007 // Predecrement I (if it's not begin) so that it isn't invalidated by |
|
10008 // sinking. |
|
10009 @@ -274,6 +274,6 @@ |
|
10010 dbgs() << ")\n"); |
|
10011 |
|
10012 // Move the instruction. |
|
10013 - Inst->moveBefore(SuccToSinkTo->getFirstInsertionPt()); |
|
10014 + Inst->moveBefore(&*SuccToSinkTo->getFirstInsertionPt()); |
|
10015 return true; |
|
10016 } |
|
10017 --- lib/Transforms/Scalar/StructurizeCFG.cpp 2014-12-02 20:28:32.000000000 -0800 |
|
10018 +++ lib/Transforms/Scalar/StructurizeCFG.cpp 2015-11-28 19:23:41.808228788 -0800 |
|
10019 @@ -842,14 +842,14 @@ |
|
10020 continue; |
|
10021 } |
|
10022 |
|
10023 - if (DT->dominates(II, User)) |
|
10024 + if (DT->dominates(&*II, User)) |
|
10025 continue; |
|
10026 |
|
10027 if (!Initialized) { |
|
10028 Value *Undef = UndefValue::get(II->getType()); |
|
10029 Updater.Initialize(II->getType(), ""); |
|
10030 Updater.AddAvailableValue(&Func->getEntryBlock(), Undef); |
|
10031 - Updater.AddAvailableValue(BB, II); |
|
10032 + Updater.AddAvailableValue(BB, &*II); |
|
10033 Initialized = true; |
|
10034 } |
|
10035 Updater.RewriteUseAfterInsertions(U); |
|
10036 --- lib/Transforms/Scalar/TailRecursionElimination.cpp 2014-11-19 05:32:51.000000000 -0800 |
|
10037 +++ lib/Transforms/Scalar/TailRecursionElimination.cpp 2015-11-28 19:32:29.223858053 -0800 |
|
10038 @@ -404,28 +404,22 @@ |
|
10039 // alloca' is changed from being a static alloca to being a dynamic alloca. |
|
10040 // Until this is resolved, disable this transformation if that would ever |
|
10041 // happen. This bug is PR962. |
|
10042 - SmallVector<BasicBlock*, 8> BBToErase; |
|
10043 - for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) { |
|
10044 + for (Function::iterator BBI = F.begin(), E = F.end(); BBI != E; |
|
10045 + /* inside loop */) { |
|
10046 + BasicBlock *BB = &*BBI; |
|
10047 + ++BBI; |
|
10048 + |
|
10049 if (ReturnInst *Ret = dyn_cast<ReturnInst>(BB->getTerminator())) { |
|
10050 bool Change = ProcessReturningBlock(Ret, OldEntry, TailCallsAreMarkedTail, |
|
10051 ArgumentPHIs, !CanTRETailMarkedCall); |
|
10052 - if (!Change && BB->getFirstNonPHIOrDbg() == Ret) { |
|
10053 + if (!Change && BB->getFirstNonPHIOrDbg() == Ret) |
|
10054 Change = FoldReturnAndProcessPred(BB, Ret, OldEntry, |
|
10055 TailCallsAreMarkedTail, ArgumentPHIs, |
|
10056 !CanTRETailMarkedCall); |
|
10057 - // FoldReturnAndProcessPred may have emptied some BB. Remember to |
|
10058 - // erase them. |
|
10059 - if (Change && BB->empty()) |
|
10060 - BBToErase.push_back(BB); |
|
10061 - |
|
10062 - } |
|
10063 MadeChange |= Change; |
|
10064 } |
|
10065 } |
|
10066 |
|
10067 - for (auto BB: BBToErase) |
|
10068 - BB->eraseFromParent(); |
|
10069 - |
|
10070 // If we eliminated any tail recursions, it's possible that we inserted some |
|
10071 // silly PHI nodes which just merge an initial value (the incoming operand) |
|
10072 // with themselves. Check to see if we did and clean up our mess if so. This |
|
10073 @@ -588,7 +582,7 @@ |
|
10074 // Scan backwards from the return, checking to see if there is a tail call in |
|
10075 // this block. If so, set CI to it. |
|
10076 CallInst *CI = nullptr; |
|
10077 - BasicBlock::iterator BBI = TI; |
|
10078 + BasicBlock::iterator BBI(TI); |
|
10079 while (true) { |
|
10080 CI = dyn_cast<CallInst>(BBI); |
|
10081 if (CI && CI->getCalledFunction() == F) |
|
10082 @@ -609,9 +603,8 @@ |
|
10083 // and disable this xform in this case, because the code generator will |
|
10084 // lower the call to fabs into inline code. |
|
10085 if (BB == &F->getEntryBlock() && |
|
10086 - FirstNonDbg(BB->front()) == CI && |
|
10087 - FirstNonDbg(std::next(BB->begin())) == TI && |
|
10088 - CI->getCalledFunction() && |
|
10089 + FirstNonDbg(BB->front().getIterator()) == CI && |
|
10090 + FirstNonDbg(std::next(BB->begin())) == TI && CI->getCalledFunction() && |
|
10091 !TTI->isLoweredToCall(CI->getCalledFunction())) { |
|
10092 // A single-block function with just a call and a return. Check that |
|
10093 // the arguments match. |
|
10094 @@ -650,19 +643,19 @@ |
|
10095 // tail call if all of the instructions between the call and the return are |
|
10096 // movable to above the call itself, leaving the call next to the return. |
|
10097 // Check that this is the case now. |
|
10098 - BasicBlock::iterator BBI = CI; |
|
10099 + BasicBlock::iterator BBI(CI); |
|
10100 for (++BBI; &*BBI != Ret; ++BBI) { |
|
10101 - if (CanMoveAboveCall(BBI, CI)) continue; |
|
10102 + if (CanMoveAboveCall(&*BBI, CI)) continue; |
|
10103 |
|
10104 // If we can't move the instruction above the call, it might be because it |
|
10105 // is an associative and commutative operation that could be transformed |
|
10106 // using accumulator recursion elimination. Check to see if this is the |
|
10107 // case, and if so, remember the initial accumulator value for later. |
|
10108 if ((AccumulatorRecursionEliminationInitVal = |
|
10109 - CanTransformAccumulatorRecursion(BBI, CI))) { |
|
10110 + CanTransformAccumulatorRecursion(&*BBI, CI))) { |
|
10111 // Yes, this is accumulator recursion. Remember which instruction |
|
10112 // accumulates. |
|
10113 - AccumulatorRecursionInstr = BBI; |
|
10114 + AccumulatorRecursionInstr = &*BBI; |
|
10115 } else { |
|
10116 return false; // Otherwise, we cannot eliminate the tail recursion! |
|
10117 } |
|
10118 @@ -712,19 +705,19 @@ |
|
10119 NEBI = NewEntry->begin(); OEBI != E; ) |
|
10120 if (AllocaInst *AI = dyn_cast<AllocaInst>(OEBI++)) |
|
10121 if (isa<ConstantInt>(AI->getArraySize())) |
|
10122 - AI->moveBefore(NEBI); |
|
10123 + AI->moveBefore(&*NEBI); |
|
10124 |
|
10125 // Now that we have created a new block, which jumps to the entry |
|
10126 // block, insert a PHI node for each argument of the function. |
|
10127 // For now, we initialize each PHI to only have the real arguments |
|
10128 // which are passed in. |
|
10129 - Instruction *InsertPos = OldEntry->begin(); |
|
10130 + Instruction *InsertPos = &OldEntry->front(); |
|
10131 for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); |
|
10132 I != E; ++I) { |
|
10133 PHINode *PN = PHINode::Create(I->getType(), 2, |
|
10134 I->getName() + ".tr", InsertPos); |
|
10135 I->replaceAllUsesWith(PN); // Everyone use the PHI node now! |
|
10136 - PN->addIncoming(I, NewEntry); |
|
10137 + PN->addIncoming(&*I, NewEntry); |
|
10138 ArgumentPHIs.push_back(PN); |
|
10139 } |
|
10140 } |
|
10141 @@ -753,10 +746,9 @@ |
|
10142 Instruction *AccRecInstr = AccumulatorRecursionInstr; |
|
10143 // Start by inserting a new PHI node for the accumulator. |
|
10144 pred_iterator PB = pred_begin(OldEntry), PE = pred_end(OldEntry); |
|
10145 - PHINode *AccPN = |
|
10146 - PHINode::Create(AccumulatorRecursionEliminationInitVal->getType(), |
|
10147 - std::distance(PB, PE) + 1, |
|
10148 - "accumulator.tr", OldEntry->begin()); |
|
10149 + PHINode *AccPN = PHINode::Create( |
|
10150 + AccumulatorRecursionEliminationInitVal->getType(), |
|
10151 + std::distance(PB, PE) + 1, "accumulator.tr", &OldEntry->front()); |
|
10152 |
|
10153 // Loop over all of the predecessors of the tail recursion block. For the |
|
10154 // real entry into the function we seed the PHI with the initial value, |
|
10155 --- lib/Transforms/Utils/AddDiscriminators.cpp 2014-12-09 10:38:53.000000000 -0800 |
|
10156 +++ lib/Transforms/Utils/AddDiscriminators.cpp 2015-11-29 09:01:43.033905645 -0800 |
|
10157 @@ -172,7 +172,7 @@ |
|
10158 // Traverse all the blocks looking for instructions in different |
|
10159 // blocks that are at the same file:line location. |
|
10160 for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { |
|
10161 - BasicBlock *B = I; |
|
10162 + BasicBlock *B = &*I; |
|
10163 TerminatorInst *Last = B->getTerminator(); |
|
10164 DebugLoc LastLoc = Last->getDebugLoc(); |
|
10165 if (LastLoc.isUnknown()) continue; |
|
10166 --- lib/Transforms/Utils/BasicBlockUtils.cpp 2014-11-18 16:17:31.000000000 -0800 |
|
10167 +++ lib/Transforms/Utils/BasicBlockUtils.cpp 2015-11-29 09:05:35.763274502 -0800 |
|
10168 @@ -255,7 +255,7 @@ |
|
10169 // block. |
|
10170 assert(SP == BB && "CFG broken"); |
|
10171 SP = nullptr; |
|
10172 - return SplitBlock(Succ, Succ->begin(), P); |
|
10173 + return SplitBlock(Succ, &Succ->front(), P); |
|
10174 } |
|
10175 |
|
10176 // Otherwise, if BB has a single successor, split it at the bottom of the |
|
10177 @@ -283,7 +283,7 @@ |
|
10178 /// the loop info is updated. |
|
10179 /// |
|
10180 BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) { |
|
10181 - BasicBlock::iterator SplitIt = SplitPt; |
|
10182 + BasicBlock::iterator SplitIt = SplitPt->getIterator(); |
|
10183 while (isa<PHINode>(SplitIt) || isa<LandingPadInst>(SplitIt)) |
|
10184 ++SplitIt; |
|
10185 BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); |
|
10186 @@ -642,7 +642,7 @@ |
|
10187 // return instruction. |
|
10188 V = BCI->getOperand(0); |
|
10189 NewBC = BCI->clone(); |
|
10190 - Pred->getInstList().insert(NewRet, NewBC); |
|
10191 + Pred->getInstList().insert(NewRet->getIterator(), NewBC); |
|
10192 *i = NewBC; |
|
10193 } |
|
10194 if (PHINode *PN = dyn_cast<PHINode>(V)) { |
|
10195 @@ -688,7 +688,7 @@ |
|
10196 MDNode *BranchWeights, |
|
10197 DominatorTree *DT) { |
|
10198 BasicBlock *Head = SplitBefore->getParent(); |
|
10199 - BasicBlock *Tail = Head->splitBasicBlock(SplitBefore); |
|
10200 + BasicBlock *Tail = Head->splitBasicBlock(SplitBefore->getIterator()); |
|
10201 TerminatorInst *HeadOldTerm = Head->getTerminator(); |
|
10202 LLVMContext &C = Head->getContext(); |
|
10203 BasicBlock *ThenBlock = BasicBlock::Create(C, "", Head->getParent(), Tail); |
|
10204 @@ -739,7 +739,7 @@ |
|
10205 TerminatorInst **ElseTerm, |
|
10206 MDNode *BranchWeights) { |
|
10207 BasicBlock *Head = SplitBefore->getParent(); |
|
10208 - BasicBlock *Tail = Head->splitBasicBlock(SplitBefore); |
|
10209 + BasicBlock *Tail = Head->splitBasicBlock(SplitBefore->getIterator()); |
|
10210 TerminatorInst *HeadOldTerm = Head->getTerminator(); |
|
10211 LLVMContext &C = Head->getContext(); |
|
10212 BasicBlock *ThenBlock = BasicBlock::Create(C, "", Head->getParent(), Tail); |
|
10213 --- lib/Transforms/Utils/BreakCriticalEdges.cpp 2014-11-18 16:17:31.000000000 -0800 |
|
10214 +++ lib/Transforms/Utils/BreakCriticalEdges.cpp 2015-11-29 09:07:57.703524612 -0800 |
|
10215 @@ -98,7 +98,7 @@ |
|
10216 PHINode *NewPN = |
|
10217 PHINode::Create(PN->getType(), Preds.size(), "split", |
|
10218 SplitBB->isLandingPad() ? |
|
10219 - SplitBB->begin() : SplitBB->getTerminator()); |
|
10220 + &SplitBB->front() : SplitBB->getTerminator()); |
|
10221 for (unsigned i = 0, e = Preds.size(); i != e; ++i) |
|
10222 NewPN->addIncoming(V, Preds[i]); |
|
10223 |
|
10224 @@ -152,7 +152,7 @@ |
|
10225 |
|
10226 // Insert the block into the function... right after the block TI lives in. |
|
10227 Function &F = *TIBB->getParent(); |
|
10228 - Function::iterator FBBI = TIBB; |
|
10229 + Function::iterator FBBI = TIBB->getIterator(); |
|
10230 F.getBasicBlockList().insert(++FBBI, NewBB); |
|
10231 |
|
10232 // If there are any PHI nodes in DestBB, we need to update them so that they |
|
10233 --- lib/Transforms/Utils/BypassSlowDivision.cpp 2014-04-24 22:29:35.000000000 -0700 |
|
10234 +++ lib/Transforms/Utils/BypassSlowDivision.cpp 2015-11-29 09:10:30.545799550 -0800 |
|
10235 @@ -82,7 +82,7 @@ |
|
10236 bool UseSignedOp, |
|
10237 DivCacheTy &PerBBDivCache) { |
|
10238 // Get instruction operands |
|
10239 - Instruction *Instr = J; |
|
10240 + Instruction *Instr = &*J; |
|
10241 Value *Dividend = Instr->getOperand(0); |
|
10242 Value *Divisor = Instr->getOperand(1); |
|
10243 |
|
10244 @@ -94,7 +94,7 @@ |
|
10245 } |
|
10246 |
|
10247 // Basic Block is split before divide |
|
10248 - BasicBlock *MainBB = I; |
|
10249 + BasicBlock *MainBB = &*I; |
|
10250 BasicBlock *SuccessorBB = I->splitBasicBlock(J); |
|
10251 ++I; //advance iterator I to successorBB |
|
10252 |
|
10253 @@ -190,7 +190,7 @@ |
|
10254 bool UseSignedOp, |
|
10255 DivCacheTy &PerBBDivCache) { |
|
10256 // Get instruction operands |
|
10257 - Instruction *Instr = J; |
|
10258 + Instruction *Instr = &*J; |
|
10259 DivOpInfo Key(UseSignedOp, Instr->getOperand(0), Instr->getOperand(1)); |
|
10260 DivCacheTy::iterator CacheI = PerBBDivCache.find(Key); |
|
10261 |
|
10262 --- lib/Transforms/Utils/CloneFunction.cpp 2014-12-18 22:06:18.000000000 -0800 |
|
10263 +++ lib/Transforms/Utils/CloneFunction.cpp 2015-11-29 09:27:19.893077178 -0800 |
|
10264 @@ -51,7 +51,7 @@ |
|
10265 if (II->hasName()) |
|
10266 NewInst->setName(II->getName()+NameSuffix); |
|
10267 NewBB->getInstList().push_back(NewInst); |
|
10268 - VMap[II] = NewInst; // Add instruction map to value. |
|
10269 + VMap[&*II] = NewInst; // Add instruction map to value. |
|
10270 |
|
10271 hasCalls |= (isa<CallInst>(II) && !isa<DbgInfoIntrinsic>(II)); |
|
10272 if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) { |
|
10273 @@ -86,7 +86,7 @@ |
|
10274 #ifndef NDEBUG |
|
10275 for (Function::const_arg_iterator I = OldFunc->arg_begin(), |
|
10276 E = OldFunc->arg_end(); I != E; ++I) |
|
10277 - assert(VMap.count(I) && "No mapping from source argument specified!"); |
|
10278 + assert(VMap.count(&*I) && "No mapping from source argument specified!"); |
|
10279 #endif |
|
10280 |
|
10281 // Copy all attributes other than those stored in the AttributeSet. We need |
|
10282 @@ -145,11 +145,12 @@ |
|
10283 |
|
10284 // Loop over all of the instructions in the function, fixing up operand |
|
10285 // references as we go. This uses VMap to do all the hard work. |
|
10286 - for (Function::iterator BB = cast<BasicBlock>(VMap[OldFunc->begin()]), |
|
10287 - BE = NewFunc->end(); BB != BE; ++BB) |
|
10288 + for (Function::iterator BB = |
|
10289 + cast<BasicBlock>(VMap[&OldFunc->front()])->getIterator(), |
|
10290 + BE = NewFunc->end(); BB != BE; ++BB) |
|
10291 // Loop over all instructions, fixing each one as we find it... |
|
10292 - for (BasicBlock::iterator II = BB->begin(); II != BB->end(); ++II) |
|
10293 - RemapInstruction(II, VMap, |
|
10294 + for (Instruction &II : *BB) |
|
10295 + RemapInstruction(&II, VMap, |
|
10296 ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges, |
|
10297 TypeMapper, Materializer); |
|
10298 } |
|
10299 @@ -220,7 +221,7 @@ |
|
10300 // |
|
10301 for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); |
|
10302 I != E; ++I) |
|
10303 - if (VMap.count(I) == 0) // Haven't mapped the argument to anything yet? |
|
10304 + if (VMap.count(&*I) == 0) // Haven't mapped the argument to anything yet? |
|
10305 ArgTypes.push_back(I->getType()); |
|
10306 |
|
10307 // Create a new function type... |
|
10308 @@ -234,9 +235,9 @@ |
|
10309 Function::arg_iterator DestI = NewF->arg_begin(); |
|
10310 for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); |
|
10311 I != E; ++I) |
|
10312 - if (VMap.count(I) == 0) { // Is this argument preserved? |
|
10313 - DestI->setName(I->getName()); // Copy the name over... |
|
10314 - VMap[I] = DestI++; // Add mapping to VMap |
|
10315 + if (VMap.count(&*I) == 0) { // Is this argument preserved? |
|
10316 + DestI->setName(I->getName()); // Copy the name over... |
|
10317 + VMap[&*I] = &*DestI++; // Add mapping to VMap |
|
10318 } |
|
10319 |
|
10320 if (ModuleLevelChanges) |
|
10321 @@ -332,7 +333,7 @@ |
|
10322 if (Value *MappedV = VMap.lookup(V)) |
|
10323 V = MappedV; |
|
10324 |
|
10325 - VMap[II] = V; |
|
10326 + VMap[&*II] = V; |
|
10327 delete NewInst; |
|
10328 continue; |
|
10329 } |
|
10330 @@ -340,9 +341,10 @@ |
|
10331 |
|
10332 if (II->hasName()) |
|
10333 NewInst->setName(II->getName()+NameSuffix); |
|
10334 - VMap[II] = NewInst; // Add instruction map to value. |
|
10335 + VMap[&*II] = NewInst; // Add instruction map to value. |
|
10336 NewBB->getInstList().push_back(NewInst); |
|
10337 hasCalls |= (isa<CallInst>(II) && !isa<DbgInfoIntrinsic>(II)); |
|
10338 + |
|
10339 if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) { |
|
10340 if (isa<ConstantInt>(AI->getArraySize())) |
|
10341 hasStaticAllocas = true; |
|
10342 @@ -429,7 +431,7 @@ |
|
10343 #ifndef NDEBUG |
|
10344 for (Function::const_arg_iterator II = OldFunc->arg_begin(), |
|
10345 E = OldFunc->arg_end(); II != E; ++II) |
|
10346 - assert(VMap.count(II) && "No mapping from source argument specified!"); |
|
10347 + assert(VMap.count(&*II) && "No mapping from source argument specified!"); |
|
10348 #endif |
|
10349 |
|
10350 PruningFunctionCloner PFC(NewFunc, OldFunc, VMap, ModuleLevelChanges, |
|
10351 @@ -452,7 +454,7 @@ |
|
10352 SmallVector<const PHINode*, 16> PHIToResolve; |
|
10353 for (Function::const_iterator BI = OldFunc->begin(), BE = OldFunc->end(); |
|
10354 BI != BE; ++BI) { |
|
10355 - Value *V = VMap[BI]; |
|
10356 + Value *V = VMap[&*BI]; |
|
10357 BasicBlock *NewBB = cast_or_null<BasicBlock>(V); |
|
10358 if (!NewBB) continue; // Dead block. |
|
10359 |
|
10360 @@ -546,8 +548,8 @@ |
|
10361 while ((PN = dyn_cast<PHINode>(I++))) { |
|
10362 Value *NV = UndefValue::get(PN->getType()); |
|
10363 PN->replaceAllUsesWith(NV); |
|
10364 - assert(VMap[OldI] == PN && "VMap mismatch"); |
|
10365 - VMap[OldI] = NV; |
|
10366 + assert(VMap[&*OldI] == PN && "VMap mismatch"); |
|
10367 + VMap[&*OldI] = NV; |
|
10368 PN->eraseFromParent(); |
|
10369 ++OldI; |
|
10370 } |
|
10371 @@ -569,15 +571,16 @@ |
|
10372 // and zap unconditional fall-through branches. This happen all the time when |
|
10373 // specializing code: code specialization turns conditional branches into |
|
10374 // uncond branches, and this code folds them. |
|
10375 - Function::iterator Begin = cast<BasicBlock>(VMap[&OldFunc->getEntryBlock()]); |
|
10376 + Function::iterator Begin = |
|
10377 + cast<BasicBlock>(VMap[&OldFunc->getEntryBlock()])->getIterator(); |
|
10378 Function::iterator I = Begin; |
|
10379 while (I != NewFunc->end()) { |
|
10380 // Check if this block has become dead during inlining or other |
|
10381 // simplifications. Note that the first block will appear dead, as it has |
|
10382 // not yet been wired up properly. |
|
10383 - if (I != Begin && (pred_begin(I) == pred_end(I) || |
|
10384 - I->getSinglePredecessor() == I)) { |
|
10385 - BasicBlock *DeadBB = I++; |
|
10386 + if ((I != Begin) && (pred_begin(&*I) == pred_end(&*I) || |
|
10387 + I->getSinglePredecessor() == &*I)) { |
|
10388 + BasicBlock *DeadBB = &*I++; |
|
10389 DeleteDeadBlock(DeadBB); |
|
10390 continue; |
|
10391 } |
|
10392 @@ -587,7 +590,7 @@ |
|
10393 // simplification required looking through PHI nodes, those are only |
|
10394 // available after forming the full basic block. That may leave some here, |
|
10395 // and we still want to prune the dead code as early as possible. |
|
10396 - ConstantFoldTerminator(I); |
|
10397 + ConstantFoldTerminator(&*I); |
|
10398 |
|
10399 BranchInst *BI = dyn_cast<BranchInst>(I->getTerminator()); |
|
10400 if (!BI || BI->isConditional()) { ++I; continue; } |
|
10401 @@ -606,7 +609,7 @@ |
|
10402 BI->eraseFromParent(); |
|
10403 |
|
10404 // Make all PHI nodes that referred to Dest now refer to I as their source. |
|
10405 - Dest->replaceAllUsesWith(I); |
|
10406 + Dest->replaceAllUsesWith(&*I); |
|
10407 |
|
10408 // Move all the instructions in the succ to the pred. |
|
10409 I->getInstList().splice(I->end(), Dest->getInstList()); |
|
10410 @@ -620,9 +623,9 @@ |
|
10411 // Make a final pass over the basic blocks from theh old function to gather |
|
10412 // any return instructions which survived folding. We have to do this here |
|
10413 // because we can iteratively remove and merge returns above. |
|
10414 - for (Function::iterator I = cast<BasicBlock>(VMap[&OldFunc->getEntryBlock()]), |
|
10415 - E = NewFunc->end(); |
|
10416 - I != E; ++I) |
|
10417 + for (Function::iterator I = |
|
10418 + cast<BasicBlock>(VMap[&OldFunc->getEntryBlock()])->getIterator(), |
|
10419 + E = NewFunc->end(); I != E; ++I) |
|
10420 if (ReturnInst *RI = dyn_cast<ReturnInst>(I->getTerminator())) |
|
10421 Returns.push_back(RI); |
|
10422 } |
|
10423 --- lib/Transforms/Utils/CloneModule.cpp 2014-12-23 00:23:45.000000000 -0800 |
|
10424 +++ lib/Transforms/Utils/CloneModule.cpp 2015-11-29 10:05:42.438731638 -0800 |
|
10425 @@ -45,15 +45,15 @@ |
|
10426 // |
|
10427 for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); |
|
10428 I != E; ++I) { |
|
10429 - GlobalVariable *GV = new GlobalVariable(*New, |
|
10430 + GlobalVariable *GV = new GlobalVariable(*New, |
|
10431 I->getType()->getElementType(), |
|
10432 I->isConstant(), I->getLinkage(), |
|
10433 (Constant*) nullptr, I->getName(), |
|
10434 (GlobalVariable*) nullptr, |
|
10435 I->getThreadLocalMode(), |
|
10436 I->getType()->getAddressSpace()); |
|
10437 - GV->copyAttributesFrom(I); |
|
10438 - VMap[I] = GV; |
|
10439 + GV->copyAttributesFrom(&*I); |
|
10440 + VMap[&*I] = GV; |
|
10441 } |
|
10442 |
|
10443 // Loop over the functions in the module, making external functions as before |
|
10444 @@ -61,8 +61,8 @@ |
|
10445 Function *NF = |
|
10446 Function::Create(cast<FunctionType>(I->getType()->getElementType()), |
|
10447 I->getLinkage(), I->getName(), New); |
|
10448 - NF->copyAttributesFrom(I); |
|
10449 - VMap[I] = NF; |
|
10450 + NF->copyAttributesFrom(&*I); |
|
10451 + VMap[&*I] = NF; |
|
10452 } |
|
10453 |
|
10454 // Loop over the aliases in the module |
|
10455 @@ -72,8 +72,8 @@ |
|
10456 auto *GA = |
|
10457 GlobalAlias::create(PTy->getElementType(), PTy->getAddressSpace(), |
|
10458 I->getLinkage(), I->getName(), New); |
|
10459 - GA->copyAttributesFrom(I); |
|
10460 - VMap[I] = GA; |
|
10461 + GA->copyAttributesFrom(&*I); |
|
10462 + VMap[&*I] = GA; |
|
10463 } |
|
10464 |
|
10465 // Now that all of the things that global variable initializer can refer to |
|
10466 @@ -82,7 +82,7 @@ |
|
10467 // |
|
10468 for (Module::const_global_iterator I = M->global_begin(), E = M->global_end(); |
|
10469 I != E; ++I) { |
|
10470 - GlobalVariable *GV = cast<GlobalVariable>(VMap[I]); |
|
10471 + GlobalVariable *GV = cast<GlobalVariable>(VMap[&*I]); |
|
10472 if (I->hasInitializer()) |
|
10473 GV->setInitializer(MapValue(I->getInitializer(), VMap)); |
|
10474 } |
|
10475 @@ -90,24 +90,24 @@ |
|
10476 // Similarly, copy over function bodies now... |
|
10477 // |
|
10478 for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) { |
|
10479 - Function *F = cast<Function>(VMap[I]); |
|
10480 + Function *F = cast<Function>(VMap[&*I]); |
|
10481 if (!I->isDeclaration()) { |
|
10482 Function::arg_iterator DestI = F->arg_begin(); |
|
10483 for (Function::const_arg_iterator J = I->arg_begin(); J != I->arg_end(); |
|
10484 ++J) { |
|
10485 DestI->setName(J->getName()); |
|
10486 - VMap[J] = DestI++; |
|
10487 + VMap[&*J] = &*DestI++; |
|
10488 } |
|
10489 |
|
10490 SmallVector<ReturnInst*, 8> Returns; // Ignore returns cloned. |
|
10491 - CloneFunctionInto(F, I, VMap, /*ModuleLevelChanges=*/true, Returns); |
|
10492 + CloneFunctionInto(F, &*I, VMap, /*ModuleLevelChanges=*/true, Returns); |
|
10493 } |
|
10494 } |
|
10495 |
|
10496 // And aliases |
|
10497 for (Module::const_alias_iterator I = M->alias_begin(), E = M->alias_end(); |
|
10498 I != E; ++I) { |
|
10499 - GlobalAlias *GA = cast<GlobalAlias>(VMap[I]); |
|
10500 + GlobalAlias *GA = cast<GlobalAlias>(VMap[&*I]); |
|
10501 if (const Constant *C = I->getAliasee()) |
|
10502 GA->setAliasee(MapValue(C, VMap)); |
|
10503 } |
|
10504 --- lib/Transforms/Utils/CodeExtractor.cpp 2014-07-21 10:06:51.000000000 -0700 |
|
10505 +++ lib/Transforms/Utils/CodeExtractor.cpp 2015-11-29 10:25:40.506775548 -0800 |
|
10506 @@ -175,7 +175,7 @@ |
|
10507 |
|
10508 for (User *U : II->users()) |
|
10509 if (!definedInRegion(Blocks, U)) { |
|
10510 - Outputs.insert(II); |
|
10511 + Outputs.insert(&*II); |
|
10512 break; |
|
10513 } |
|
10514 } |
|
10515 @@ -211,7 +211,7 @@ |
|
10516 // containing PHI nodes merging values from outside of the region, and a |
|
10517 // second that contains all of the code for the block and merges back any |
|
10518 // incoming values from inside of the region. |
|
10519 - BasicBlock::iterator AfterPHIs = Header->getFirstNonPHI(); |
|
10520 + BasicBlock::iterator AfterPHIs = Header->getFirstNonPHI()->getIterator(); |
|
10521 BasicBlock *NewBB = Header->splitBasicBlock(AfterPHIs, |
|
10522 Header->getName()+".ce"); |
|
10523 |
|
10524 @@ -246,7 +246,7 @@ |
|
10525 // Create a new PHI node in the new region, which has an incoming value |
|
10526 // from OldPred of PN. |
|
10527 PHINode *NewPN = PHINode::Create(PN->getType(), 1 + NumPredsFromRegion, |
|
10528 - PN->getName()+".ce", NewBB->begin()); |
|
10529 + PN->getName()+".ce", &NewBB->front()); |
|
10530 NewPN->addIncoming(PN, OldPred); |
|
10531 |
|
10532 // Loop over all of the incoming value in PN, moving them to NewPN if they |
|
10533 @@ -266,14 +266,15 @@ |
|
10534 for (SetVector<BasicBlock *>::iterator I = Blocks.begin(), E = Blocks.end(); |
|
10535 I != E; ++I) |
|
10536 if (ReturnInst *RI = dyn_cast<ReturnInst>((*I)->getTerminator())) { |
|
10537 - BasicBlock *New = (*I)->splitBasicBlock(RI, (*I)->getName()+".ret"); |
|
10538 + BasicBlock *New = |
|
10539 + (*I)->splitBasicBlock(RI->getIterator(), (*I)->getName() + ".ret"); |
|
10540 if (DT) { |
|
10541 // Old dominates New. New node dominates all other nodes dominated |
|
10542 // by Old. |
|
10543 DomTreeNode *OldNode = DT->getNode(*I); |
|
10544 SmallVector<DomTreeNode*, 8> Children; |
|
10545 for (DomTreeNode::iterator DI = OldNode->begin(), DE = OldNode->end(); |
|
10546 - DI != DE; ++DI) |
|
10547 + DI != DE; ++DI) |
|
10548 Children.push_back(*DI); |
|
10549 |
|
10550 DomTreeNode *NewNode = DT->addNewBlock(New, *I); |
|
10551 @@ -364,11 +365,11 @@ |
|
10552 Idx[0] = Constant::getNullValue(Type::getInt32Ty(header->getContext())); |
|
10553 Idx[1] = ConstantInt::get(Type::getInt32Ty(header->getContext()), i); |
|
10554 TerminatorInst *TI = newFunction->begin()->getTerminator(); |
|
10555 - GetElementPtrInst *GEP = |
|
10556 - GetElementPtrInst::Create(AI, Idx, "gep_" + inputs[i]->getName(), TI); |
|
10557 + GetElementPtrInst *GEP = |
|
10558 + GetElementPtrInst::Create(&*AI, Idx, "gep_" + inputs[i]->getName(), TI); |
|
10559 RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI); |
|
10560 } else |
|
10561 - RewriteVal = AI++; |
|
10562 + RewriteVal = &*AI++; |
|
10563 |
|
10564 std::vector<User*> Users(inputs[i]->user_begin(), inputs[i]->user_end()); |
|
10565 for (std::vector<User*>::iterator use = Users.begin(), useE = Users.end(); |
|
10566 @@ -441,7 +442,7 @@ |
|
10567 } else { |
|
10568 AllocaInst *alloca = |
|
10569 new AllocaInst((*i)->getType(), nullptr, (*i)->getName()+".loc", |
|
10570 - codeReplacer->getParent()->begin()->begin()); |
|
10571 + &codeReplacer->getParent()->front().front()); |
|
10572 ReloadOutputs.push_back(alloca); |
|
10573 params.push_back(alloca); |
|
10574 } |
|
10575 @@ -458,7 +459,7 @@ |
|
10576 Type *StructArgTy = StructType::get(newFunction->getContext(), ArgTypes); |
|
10577 Struct = |
|
10578 new AllocaInst(StructArgTy, nullptr, "structArg", |
|
10579 - codeReplacer->getParent()->begin()->begin()); |
|
10580 + &codeReplacer->getParent()->front().front()); |
|
10581 params.push_back(Struct); |
|
10582 |
|
10583 for (unsigned i = 0, e = inputs.size(); i != e; ++i) { |
|
10584 @@ -607,12 +608,12 @@ |
|
10585 Idx[1] = ConstantInt::get(Type::getInt32Ty(Context), |
|
10586 FirstOut+out); |
|
10587 GetElementPtrInst *GEP = |
|
10588 - GetElementPtrInst::Create(OAI, Idx, |
|
10589 + GetElementPtrInst::Create(&*OAI, Idx, |
|
10590 "gep_" + outputs[out]->getName(), |
|
10591 NTRet); |
|
10592 new StoreInst(outputs[out], GEP, NTRet); |
|
10593 } else { |
|
10594 - new StoreInst(outputs[out], OAI, NTRet); |
|
10595 + new StoreInst(outputs[out], &*OAI, NTRet); |
|
10596 } |
|
10597 } |
|
10598 // Advance output iterator even if we don't emit a store |
|
10599 --- lib/Transforms/Utils/CtorUtils.cpp 2014-09-23 15:33:01.000000000 -0700 |
|
10600 +++ lib/Transforms/Utils/CtorUtils.cpp 2015-11-29 10:27:14.531198062 -0800 |
|
10601 @@ -49,7 +49,7 @@ |
|
10602 GlobalVariable *NGV = |
|
10603 new GlobalVariable(CA->getType(), GCL->isConstant(), GCL->getLinkage(), |
|
10604 CA, "", GCL->getThreadLocalMode()); |
|
10605 - GCL->getParent()->getGlobalList().insert(GCL, NGV); |
|
10606 + GCL->getParent()->getGlobalList().insert(GCL->getIterator(), NGV); |
|
10607 NGV->takeName(GCL); |
|
10608 |
|
10609 // Nuke the old list, replacing any uses with the new one. |
|
10610 --- lib/Transforms/Utils/DemoteRegToStack.cpp 2014-04-24 22:29:35.000000000 -0700 |
|
10611 +++ lib/Transforms/Utils/DemoteRegToStack.cpp 2015-11-29 10:33:53.846940110 -0800 |
|
10612 @@ -36,7 +36,7 @@ |
|
10613 } else { |
|
10614 Function *F = I.getParent()->getParent(); |
|
10615 Slot = new AllocaInst(I.getType(), nullptr, I.getName()+".reg2mem", |
|
10616 - F->getEntryBlock().begin()); |
|
10617 + &F->getEntryBlock().front()); |
|
10618 } |
|
10619 |
|
10620 // Change all of the users of the instruction to read from the stack slot. |
|
10621 @@ -77,30 +77,15 @@ |
|
10622 // AFTER the terminator instruction. |
|
10623 BasicBlock::iterator InsertPt; |
|
10624 if (!isa<TerminatorInst>(I)) { |
|
10625 - InsertPt = &I; |
|
10626 - ++InsertPt; |
|
10627 + InsertPt = ++I.getIterator(); |
|
10628 + for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); |
|
10629 + ++InsertPt); |
|
10630 } else { |
|
10631 InvokeInst &II = cast<InvokeInst>(I); |
|
10632 - if (II.getNormalDest()->getSinglePredecessor()) |
|
10633 - InsertPt = II.getNormalDest()->getFirstInsertionPt(); |
|
10634 - else { |
|
10635 - // We cannot demote invoke instructions to the stack if their normal edge |
|
10636 - // is critical. Therefore, split the critical edge and insert the store |
|
10637 - // in the newly created basic block. |
|
10638 - unsigned SuccNum = GetSuccessorNumber(I.getParent(), II.getNormalDest()); |
|
10639 - TerminatorInst *TI = &cast<TerminatorInst>(I); |
|
10640 - assert (isCriticalEdge(TI, SuccNum) && |
|
10641 - "Expected a critical edge!"); |
|
10642 - BasicBlock *BB = SplitCriticalEdge(TI, SuccNum); |
|
10643 - assert (BB && "Unable to split critical edge."); |
|
10644 - InsertPt = BB->getFirstInsertionPt(); |
|
10645 - } |
|
10646 + InsertPt = II.getNormalDest()->getFirstInsertionPt(); |
|
10647 } |
|
10648 |
|
10649 - for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); ++InsertPt) |
|
10650 - /* empty */; // Don't insert before PHI nodes or landingpad instrs. |
|
10651 - |
|
10652 - new StoreInst(&I, Slot, InsertPt); |
|
10653 + new StoreInst(&I, Slot, &*InsertPt); |
|
10654 return Slot; |
|
10655 } |
|
10656 |
|
10657 @@ -121,7 +106,7 @@ |
|
10658 } else { |
|
10659 Function *F = P->getParent()->getParent(); |
|
10660 Slot = new AllocaInst(P->getType(), nullptr, P->getName()+".reg2mem", |
|
10661 - F->getEntryBlock().begin()); |
|
10662 + &F->getEntryBlock().front()); |
|
10663 } |
|
10664 |
|
10665 // Iterate over each operand inserting a store in each predecessor. |
|
10666 @@ -135,12 +120,12 @@ |
|
10667 } |
|
10668 |
|
10669 // Insert a load in place of the PHI and replace all uses. |
|
10670 - BasicBlock::iterator InsertPt = P; |
|
10671 + BasicBlock::iterator InsertPt = P->getIterator(); |
|
10672 |
|
10673 for (; isa<PHINode>(InsertPt) || isa<LandingPadInst>(InsertPt); ++InsertPt) |
|
10674 /* empty */; // Don't insert before PHI nodes or landingpad instrs. |
|
10675 |
|
10676 - Value *V = new LoadInst(Slot, P->getName()+".reload", InsertPt); |
|
10677 + Value *V = new LoadInst(Slot, P->getName()+".reload", &*InsertPt); |
|
10678 P->replaceAllUsesWith(V); |
|
10679 |
|
10680 // Delete PHI. |
|
10681 --- lib/Transforms/Utils/FlattenCFG.cpp 2014-08-13 13:31:53.000000000 -0700 |
|
10682 +++ lib/Transforms/Utils/FlattenCFG.cpp 2015-11-29 10:42:20.827355223 -0800 |
|
10683 @@ -177,8 +177,9 @@ |
|
10684 |
|
10685 // Instructions in the internal condition blocks should be safe |
|
10686 // to hoist up. |
|
10687 - for (BasicBlock::iterator BI = Pred->begin(), BE = PBI; BI != BE;) { |
|
10688 - Instruction *CI = BI++; |
|
10689 + for (BasicBlock::iterator BI = Pred->begin(), BE = PBI->getIterator(); |
|
10690 + BI != BE;) { |
|
10691 + Instruction *CI = &*BI++; |
|
10692 if (isa<PHINode>(CI) || !isSafeToSpeculativelyExecute(CI)) |
|
10693 return false; |
|
10694 } |
|
10695 @@ -315,7 +316,7 @@ |
|
10696 BasicBlock *Block1, |
|
10697 BasicBlock *Block2) { |
|
10698 TerminatorInst *PTI2 = Head2->getTerminator(); |
|
10699 - Instruction *PBI2 = Head2->begin(); |
|
10700 + Instruction *PBI2 = &Head2->front(); |
|
10701 |
|
10702 bool eq1 = (Block1 == Head1); |
|
10703 bool eq2 = (Block2 == Head2); |
|
10704 @@ -327,9 +328,9 @@ |
|
10705 // Check whether instructions in Block1 and Block2 are identical |
|
10706 // and do not alias with instructions in Head2. |
|
10707 BasicBlock::iterator iter1 = Block1->begin(); |
|
10708 - BasicBlock::iterator end1 = Block1->getTerminator(); |
|
10709 + BasicBlock::iterator end1 = Block1->getTerminator()->getIterator(); |
|
10710 BasicBlock::iterator iter2 = Block2->begin(); |
|
10711 - BasicBlock::iterator end2 = Block2->getTerminator(); |
|
10712 + BasicBlock::iterator end2 = Block2->getTerminator()->getIterator(); |
|
10713 |
|
10714 while (1) { |
|
10715 if (iter1 == end1) { |
|
10716 @@ -338,7 +339,7 @@ |
|
10717 break; |
|
10718 } |
|
10719 |
|
10720 - if (!iter1->isIdenticalTo(iter2)) |
|
10721 + if (!iter1->isIdenticalTo(&*iter2)) |
|
10722 return false; |
|
10723 |
|
10724 // Illegal to remove instructions with side effects except |
|
10725 @@ -356,10 +357,10 @@ |
|
10726 return false; |
|
10727 |
|
10728 if (iter1->mayWriteToMemory()) { |
|
10729 - for (BasicBlock::iterator BI = PBI2, BE = PTI2; BI != BE; ++BI) { |
|
10730 + for (BasicBlock::iterator BI(PBI2), BE(PTI2); BI != BE; ++BI) { |
|
10731 if (BI->mayReadFromMemory() || BI->mayWriteToMemory()) { |
|
10732 // Check alias with Head2. |
|
10733 - if (!AA || AA->alias(iter1, BI)) |
|
10734 + if (!AA || AA->alias(&*iter1, &*BI)) |
|
10735 return false; |
|
10736 } |
|
10737 } |
|
10738 @@ -413,7 +414,7 @@ |
|
10739 return false; |
|
10740 |
|
10741 TerminatorInst *PTI2 = SecondEntryBlock->getTerminator(); |
|
10742 - Instruction *PBI2 = SecondEntryBlock->begin(); |
|
10743 + Instruction *PBI2 = &SecondEntryBlock->front(); |
|
10744 |
|
10745 if (!CompareIfRegionBlock(FirstEntryBlock, SecondEntryBlock, IfTrue1, |
|
10746 IfTrue2)) |
|
10747 @@ -425,8 +426,8 @@ |
|
10748 |
|
10749 // Check whether \param SecondEntryBlock has side-effect and is safe to |
|
10750 // speculate. |
|
10751 - for (BasicBlock::iterator BI = PBI2, BE = PTI2; BI != BE; ++BI) { |
|
10752 - Instruction *CI = BI; |
|
10753 + for (BasicBlock::iterator BI(PBI2), BE(PTI2); BI != BE; ++BI) { |
|
10754 + Instruction *CI = &*BI; |
|
10755 if (isa<PHINode>(CI) || CI->mayHaveSideEffects() || |
|
10756 !isSafeToSpeculativelyExecute(CI)) |
|
10757 return false; |
|
10758 --- lib/Transforms/Utils/InlineFunction.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
10759 +++ lib/Transforms/Utils/InlineFunction.cpp 2015-11-29 12:31:32.233733995 -0800 |
|
10760 @@ -128,7 +128,7 @@ |
|
10761 if (InnerResumeDest) return InnerResumeDest; |
|
10762 |
|
10763 // Split the landing pad. |
|
10764 - BasicBlock::iterator SplitPoint = CallerLPad; ++SplitPoint; |
|
10765 + BasicBlock::iterator SplitPoint = ++CallerLPad->getIterator(); |
|
10766 InnerResumeDest = |
|
10767 OuterResumeDest->splitBasicBlock(SplitPoint, |
|
10768 OuterResumeDest->getName() + ".body"); |
|
10769 @@ -137,7 +137,7 @@ |
|
10770 const unsigned PHICapacity = 2; |
|
10771 |
|
10772 // Create corresponding new PHIs for all the PHIs in the outer landing pad. |
|
10773 - BasicBlock::iterator InsertPoint = InnerResumeDest->begin(); |
|
10774 + Instruction *InsertPoint = &InnerResumeDest->front(); |
|
10775 BasicBlock::iterator I = OuterResumeDest->begin(); |
|
10776 for (unsigned i = 0, e = UnwindDestPHIValues.size(); i != e; ++i, ++I) { |
|
10777 PHINode *OuterPHI = cast<PHINode>(I); |
|
10778 @@ -185,7 +185,8 @@ |
|
10779 static void HandleCallsInBlockInlinedThroughInvoke(BasicBlock *BB, |
|
10780 InvokeInliningInfo &Invoke) { |
|
10781 for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { |
|
10782 - Instruction *I = BBI++; |
|
10783 + Instruction *I = &*BBI; |
|
10784 + ++BBI; |
|
10785 |
|
10786 // We only need to check for function calls: inlined invoke |
|
10787 // instructions require no special handling. |
|
10788 @@ -198,7 +199,8 @@ |
|
10789 |
|
10790 // Convert this function call into an invoke instruction. First, split the |
|
10791 // basic block. |
|
10792 - BasicBlock *Split = BB->splitBasicBlock(CI, CI->getName()+".noexc"); |
|
10793 + BasicBlock *Split = |
|
10794 + BB->splitBasicBlock(CI->getIterator(), CI->getName() + ".noexc"); |
|
10795 |
|
10796 // Delete the unconditional branch inserted by splitBasicBlock |
|
10797 BB->getInstList().pop_back(); |
|
10798 @@ -246,7 +248,8 @@ |
|
10799 |
|
10800 // Get all of the inlined landing pad instructions. |
|
10801 SmallPtrSet<LandingPadInst*, 16> InlinedLPads; |
|
10802 - for (Function::iterator I = FirstNewBlock, E = Caller->end(); I != E; ++I) |
|
10803 + for (Function::iterator I = FirstNewBlock->getIterator(), E = Caller->end(); |
|
10804 + I != E; ++I) |
|
10805 if (InvokeInst *II = dyn_cast<InvokeInst>(I->getTerminator())) |
|
10806 InlinedLPads.insert(II->getLandingPadInst()); |
|
10807 |
|
10808 @@ -262,9 +265,10 @@ |
|
10809 InlinedLPad->setCleanup(true); |
|
10810 } |
|
10811 |
|
10812 - for (Function::iterator BB = FirstNewBlock, E = Caller->end(); BB != E; ++BB){ |
|
10813 + for (Function::iterator BB = FirstNewBlock->getIterator(), E = Caller->end(); |
|
10814 + BB != E; ++BB){ |
|
10815 if (InlinedCodeInfo.ContainsCalls) |
|
10816 - HandleCallsInBlockInlinedThroughInvoke(BB, Invoke); |
|
10817 + HandleCallsInBlockInlinedThroughInvoke(&*BB, Invoke); |
|
10818 |
|
10819 // Forward any resumes that are remaining here. |
|
10820 if (ResumeInst *RI = dyn_cast<ResumeInst>(BB->getTerminator())) |
|
10821 @@ -406,10 +410,9 @@ |
|
10822 const Function *CalledFunc = CS.getCalledFunction(); |
|
10823 SmallVector<const Argument *, 4> NoAliasArgs; |
|
10824 |
|
10825 - for (Function::const_arg_iterator I = CalledFunc->arg_begin(), |
|
10826 - E = CalledFunc->arg_end(); I != E; ++I) { |
|
10827 - if (I->hasNoAliasAttr() && !I->hasNUses(0)) |
|
10828 - NoAliasArgs.push_back(I); |
|
10829 + for (const Argument &A : CalledFunc->args()) { |
|
10830 + if (A.hasNoAliasAttr() && !A.hasNUses(0)) |
|
10831 + NoAliasArgs.push_back(&A); |
|
10832 } |
|
10833 |
|
10834 if (NoAliasArgs.empty()) |
|
10835 @@ -727,7 +730,7 @@ |
|
10836 BasicBlock *InsertBlock, |
|
10837 InlineFunctionInfo &IFI) { |
|
10838 Type *AggTy = cast<PointerType>(Src->getType())->getElementType(); |
|
10839 - IRBuilder<> Builder(InsertBlock->begin()); |
|
10840 + IRBuilder<> Builder(InsertBlock, InsertBlock->begin()); |
|
10841 |
|
10842 Value *Size; |
|
10843 if (IFI.DL == nullptr) |
|
10844 @@ -962,7 +965,7 @@ |
|
10845 |
|
10846 // Get an iterator to the last basic block in the function, which will have |
|
10847 // the new function inlined after it. |
|
10848 - Function::iterator LastBlock = &Caller->back(); |
|
10849 + Function::iterator LastBlock = --Caller->end(); |
|
10850 |
|
10851 // Make sure to capture all of the return instructions from the cloned |
|
10852 // function. |
|
10853 @@ -997,7 +1000,7 @@ |
|
10854 ByValInit.push_back(std::make_pair(ActualArg, (Value*) *AI)); |
|
10855 } |
|
10856 |
|
10857 - VMap[I] = ActualArg; |
|
10858 + VMap[&*I] = ActualArg; |
|
10859 } |
|
10860 |
|
10861 // Add alignment assumptions if necessary. We do this before the inlined |
|
10862 @@ -1014,12 +1017,13 @@ |
|
10863 &InlinedFunctionInfo, IFI.DL, TheCall); |
|
10864 |
|
10865 // Remember the first block that is newly cloned over. |
|
10866 - FirstNewBlock = LastBlock; ++FirstNewBlock; |
|
10867 + FirstNewBlock = LastBlock; |
|
10868 + ++FirstNewBlock; |
|
10869 |
|
10870 // Inject byval arguments initialization. |
|
10871 for (std::pair<Value*, Value*> &Init : ByValInit) |
|
10872 HandleByValArgumentInit(Init.first, Init.second, Caller->getParent(), |
|
10873 - FirstNewBlock, IFI); |
|
10874 + &*FirstNewBlock, IFI); |
|
10875 |
|
10876 // Update the callgraph if requested. |
|
10877 if (IFI.CG) |
|
10878 @@ -1077,7 +1081,7 @@ |
|
10879 // reinserted. |
|
10880 Caller->getEntryBlock().getInstList().splice(InsertPoint, |
|
10881 FirstNewBlock->getInstList(), |
|
10882 - AI, I); |
|
10883 + AI->getIterator(), I); |
|
10884 } |
|
10885 } |
|
10886 |
|
10887 @@ -1123,7 +1127,7 @@ |
|
10888 // Leave lifetime markers for the static alloca's, scoping them to the |
|
10889 // function we just inlined. |
|
10890 if (InsertLifetime && !IFI.StaticAllocas.empty()) { |
|
10891 - IRBuilder<> builder(FirstNewBlock->begin()); |
|
10892 + IRBuilder<> builder(&FirstNewBlock->front()); |
|
10893 for (unsigned ai = 0, ae = IFI.StaticAllocas.size(); ai != ae; ++ai) { |
|
10894 AllocaInst *AI = IFI.StaticAllocas[ai]; |
|
10895 |
|
10896 @@ -1172,8 +1176,9 @@ |
|
10897 Function *StackRestore=Intrinsic::getDeclaration(M,Intrinsic::stackrestore); |
|
10898 |
|
10899 // Insert the llvm.stacksave. |
|
10900 - CallInst *SavedPtr = IRBuilder<>(FirstNewBlock, FirstNewBlock->begin()) |
|
10901 - .CreateCall(StackSave, "savedstack"); |
|
10902 + CallInst *SavedPtr = |
|
10903 + IRBuilder<>(&*FirstNewBlock, |
|
10904 + FirstNewBlock->begin()).CreateCall(StackSave, "savedstack"); |
|
10905 |
|
10906 // Insert a call to llvm.stackrestore before any return instructions in the |
|
10907 // inlined function. |
|
10908 @@ -1189,7 +1194,7 @@ |
|
10909 // If we are inlining for an invoke instruction, we must make sure to rewrite |
|
10910 // any call instructions into invoke instructions. |
|
10911 if (InvokeInst *II = dyn_cast<InvokeInst>(TheCall)) |
|
10912 - HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo); |
|
10913 + HandleInlinedInvoke(II, &*FirstNewBlock, InlinedFunctionInfo); |
|
10914 |
|
10915 // Handle any inlined musttail call sites. In order for a new call site to be |
|
10916 // musttail, the source of the clone and the inlined call site must have been |
|
10917 @@ -1233,8 +1238,10 @@ |
|
10918 // the calling basic block. |
|
10919 if (Returns.size() == 1 && std::distance(FirstNewBlock, Caller->end()) == 1) { |
|
10920 // Move all of the instructions right before the call. |
|
10921 - OrigBB->getInstList().splice(TheCall, FirstNewBlock->getInstList(), |
|
10922 - FirstNewBlock->begin(), FirstNewBlock->end()); |
|
10923 + OrigBB->getInstList().splice(TheCall->getIterator(), |
|
10924 + FirstNewBlock->getInstList(), |
|
10925 + FirstNewBlock->begin(), |
|
10926 + FirstNewBlock->end()); |
|
10927 // Remove the cloned basic block. |
|
10928 Caller->getBasicBlockList().pop_back(); |
|
10929 |
|
10930 @@ -1280,14 +1287,15 @@ |
|
10931 // Split the basic block. This guarantees that no PHI nodes will have to be |
|
10932 // updated due to new incoming edges, and make the invoke case more |
|
10933 // symmetric to the call case. |
|
10934 - AfterCallBB = OrigBB->splitBasicBlock(CreatedBranchToNormalDest, |
|
10935 - CalledFunc->getName()+".exit"); |
|
10936 + AfterCallBB = |
|
10937 + OrigBB->splitBasicBlock(CreatedBranchToNormalDest->getIterator(), |
|
10938 + CalledFunc->getName() + ".exit"); |
|
10939 |
|
10940 } else { // It's a call |
|
10941 // If this is a call instruction, we need to split the basic block that |
|
10942 // the call lives in. |
|
10943 // |
|
10944 - AfterCallBB = OrigBB->splitBasicBlock(TheCall, |
|
10945 + AfterCallBB = OrigBB->splitBasicBlock(TheCall->getIterator(), |
|
10946 CalledFunc->getName()+".exit"); |
|
10947 } |
|
10948 |
|
10949 @@ -1297,13 +1305,14 @@ |
|
10950 TerminatorInst *Br = OrigBB->getTerminator(); |
|
10951 assert(Br && Br->getOpcode() == Instruction::Br && |
|
10952 "splitBasicBlock broken!"); |
|
10953 - Br->setOperand(0, FirstNewBlock); |
|
10954 + Br->setOperand(0, &*FirstNewBlock); |
|
10955 |
|
10956 |
|
10957 // Now that the function is correct, make it a little bit nicer. In |
|
10958 // particular, move the basic blocks inserted from the end of the function |
|
10959 // into the space made by splitting the source basic block. |
|
10960 - Caller->getBasicBlockList().splice(AfterCallBB, Caller->getBasicBlockList(), |
|
10961 + Caller->getBasicBlockList().splice(AfterCallBB->getIterator(), |
|
10962 + Caller->getBasicBlockList(), |
|
10963 FirstNewBlock, Caller->end()); |
|
10964 |
|
10965 // Handle all of the return instructions that we just cloned in, and eliminate |
|
10966 @@ -1316,7 +1325,7 @@ |
|
10967 // possible incoming values. |
|
10968 if (!TheCall->use_empty()) { |
|
10969 PHI = PHINode::Create(RTy, Returns.size(), TheCall->getName(), |
|
10970 - AfterCallBB->begin()); |
|
10971 + &AfterCallBB->front()); |
|
10972 // Anything that used the result of the function call should now use the |
|
10973 // PHI node as their operand. |
|
10974 TheCall->replaceAllUsesWith(PHI); |
|
10975 @@ -1396,7 +1405,7 @@ |
|
10976 // Splice the code entry block into calling block, right before the |
|
10977 // unconditional branch. |
|
10978 CalleeEntry->replaceAllUsesWith(OrigBB); // Update PHI nodes |
|
10979 - OrigBB->getInstList().splice(Br, CalleeEntry->getInstList()); |
|
10980 + OrigBB->getInstList().splice(Br->getIterator(), CalleeEntry->getInstList()); |
|
10981 |
|
10982 // Remove the unconditional branch. |
|
10983 OrigBB->getInstList().erase(Br); |
|
10984 --- lib/Transforms/Utils/IntegerDivision.cpp 2014-11-05 13:28:24.000000000 -0800 |
|
10985 +++ lib/Transforms/Utils/IntegerDivision.cpp 2015-11-29 12:34:15.372349168 -0800 |
|
10986 @@ -401,7 +401,7 @@ |
|
10987 // If we didn't actually generate an urem instruction, we're done |
|
10988 // This happens for example if the input were constant. In this case the |
|
10989 // Builder insertion point was unchanged |
|
10990 - if (Rem == Builder.GetInsertPoint()) |
|
10991 + if (Rem == Builder.GetInsertPoint().getNodePtrUnchecked()) |
|
10992 return true; |
|
10993 |
|
10994 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint()); |
|
10995 @@ -461,7 +461,7 @@ |
|
10996 // If we didn't actually generate an udiv instruction, we're done |
|
10997 // This happens for example if the input were constant. In this case the |
|
10998 // Builder insertion point was unchanged |
|
10999 - if (Div == Builder.GetInsertPoint()) |
|
11000 + if (Div == Builder.GetInsertPoint().getNodePtrUnchecked()) |
|
11001 return true; |
|
11002 |
|
11003 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint()); |
|
11004 --- lib/Transforms/Utils/LCSSA.cpp 2014-12-22 14:35:46.000000000 -0800 |
|
11005 +++ lib/Transforms/Utils/LCSSA.cpp 2015-11-29 12:35:57.149304063 -0800 |
|
11006 @@ -113,7 +113,8 @@ |
|
11007 continue; |
|
11008 |
|
11009 PHINode *PN = PHINode::Create(Inst.getType(), PredCache.GetNumPreds(ExitBB), |
|
11010 - Inst.getName() + ".lcssa", ExitBB->begin()); |
|
11011 + Inst.getName() + ".lcssa", |
|
11012 + &ExitBB->front()); |
|
11013 |
|
11014 // Add inputs from inside the loop for this PHI. |
|
11015 for (BasicBlock **PI = PredCache.GetPreds(ExitBB); *PI; ++PI) { |
|
11016 @@ -161,8 +162,9 @@ |
|
11017 if (isa<PHINode>(UserBB->begin()) && isExitBlock(UserBB, ExitBlocks)) { |
|
11018 // Tell the VHs that the uses changed. This updates SCEV's caches. |
|
11019 if (UsesToRewrite[i]->get()->hasValueHandle()) |
|
11020 - ValueHandleBase::ValueIsRAUWd(*UsesToRewrite[i], UserBB->begin()); |
|
11021 - UsesToRewrite[i]->set(UserBB->begin()); |
|
11022 + ValueHandleBase::ValueIsRAUWd(*UsesToRewrite[i], |
|
11023 + &UserBB->front()); |
|
11024 + UsesToRewrite[i]->set(&UserBB->front()); |
|
11025 continue; |
|
11026 } |
|
11027 |
|
11028 --- lib/Transforms/Utils/Local.cpp 2015-02-08 19:35:35.000000000 -0800 |
|
11029 +++ lib/Transforms/Utils/Local.cpp 2015-11-29 12:57:42.322148975 -0800 |
|
11030 @@ -419,23 +419,24 @@ |
|
11031 // or deleted by these simplifications. The idea of simplification is that it |
|
11032 // cannot introduce new instructions, and there is no way to replace the |
|
11033 // terminator of a block without introducing a new instruction. |
|
11034 - AssertingVH<Instruction> TerminatorVH(--BB->end()); |
|
11035 + AssertingVH<Instruction> TerminatorVH(&BB->back()); |
|
11036 #endif |
|
11037 |
|
11038 for (BasicBlock::iterator BI = BB->begin(), E = --BB->end(); BI != E; ) { |
|
11039 assert(!BI->isTerminator()); |
|
11040 - Instruction *Inst = BI++; |
|
11041 + Instruction *Inst = &*BI; |
|
11042 + ++BI; |
|
11043 |
|
11044 - WeakVH BIHandle(BI); |
|
11045 + WeakVH BIHandle(&*BI); |
|
11046 if (recursivelySimplifyInstruction(Inst, TD, TLI)) { |
|
11047 MadeChange = true; |
|
11048 - if (BIHandle != BI) |
|
11049 + if (BIHandle != &*BI) |
|
11050 BI = BB->begin(); |
|
11051 continue; |
|
11052 } |
|
11053 |
|
11054 MadeChange |= RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI); |
|
11055 - if (BIHandle != BI) |
|
11056 + if (BIHandle != &*BI) |
|
11057 BI = BB->begin(); |
|
11058 } |
|
11059 return MadeChange; |
|
11060 @@ -804,7 +805,8 @@ |
|
11061 |
|
11062 // Copy over any phi, debug or lifetime instruction. |
|
11063 BB->getTerminator()->eraseFromParent(); |
|
11064 - Succ->getInstList().splice(Succ->getFirstNonPHI(), BB->getInstList()); |
|
11065 + Succ->getInstList().splice(Succ->getFirstNonPHI()->getIterator(), |
|
11066 + BB->getInstList()); |
|
11067 } else { |
|
11068 while (PHINode *PN = dyn_cast<PHINode>(&BB->front())) { |
|
11069 // We explicitly check for such uses in CanPropagatePredecessorsForPHIs. |
|
11070 @@ -1054,8 +1056,8 @@ |
|
11071 DIBuilder DIB(*F.getParent(), /*AllowUnresolved*/ false); |
|
11072 SmallVector<DbgDeclareInst *, 4> Dbgs; |
|
11073 for (auto &FI : F) |
|
11074 - for (BasicBlock::iterator BI : FI) |
|
11075 - if (auto DDI = dyn_cast<DbgDeclareInst>(BI)) |
|
11076 + for (Instruction &BI : FI) |
|
11077 + if (auto DDI = dyn_cast<DbgDeclareInst>(&BI)) |
|
11078 Dbgs.push_back(DDI); |
|
11079 |
|
11080 if (Dbgs.empty()) |
|
11081 @@ -1154,7 +1156,7 @@ |
|
11082 new UnreachableInst(I->getContext(), I); |
|
11083 |
|
11084 // All instructions after this are dead. |
|
11085 - BasicBlock::iterator BBI = I, BBE = BB->end(); |
|
11086 + BasicBlock::iterator BBI = I->getIterator(), BBE = BB->end(); |
|
11087 while (BBI != BBE) { |
|
11088 if (!BBI->use_empty()) |
|
11089 BBI->replaceAllUsesWith(UndefValue::get(BBI->getType())); |
|
11090 @@ -1208,7 +1210,7 @@ |
|
11091 |
|
11092 if (MakeUnreachable) { |
|
11093 // Don't insert a call to llvm.trap right before the unreachable. |
|
11094 - changeToUnreachable(BBI, false); |
|
11095 + changeToUnreachable(&*BBI, false); |
|
11096 Changed = true; |
|
11097 break; |
|
11098 } |
|
11099 @@ -1222,7 +1224,7 @@ |
|
11100 ++BBI; |
|
11101 if (!isa<UnreachableInst>(BBI)) { |
|
11102 // Don't insert a call to llvm.trap right before the unreachable. |
|
11103 - changeToUnreachable(BBI, false); |
|
11104 + changeToUnreachable(&*BBI, false); |
|
11105 Changed = true; |
|
11106 } |
|
11107 break; |
|
11108 @@ -1279,7 +1281,7 @@ |
|
11109 /// otherwise. |
|
11110 bool llvm::removeUnreachableBlocks(Function &F) { |
|
11111 SmallPtrSet<BasicBlock*, 128> Reachable; |
|
11112 - bool Changed = markAliveBlocks(F.begin(), Reachable); |
|
11113 + bool Changed = markAliveBlocks(&F.front(), Reachable); |
|
11114 |
|
11115 // If there are unreachable blocks in the CFG... |
|
11116 if (Reachable.size() == F.size()) |
|
11117 @@ -1291,17 +1293,18 @@ |
|
11118 // Loop over all of the basic blocks that are not reachable, dropping all of |
|
11119 // their internal references... |
|
11120 for (Function::iterator BB = ++F.begin(), E = F.end(); BB != E; ++BB) { |
|
11121 - if (Reachable.count(BB)) |
|
11122 + if (Reachable.count(&*BB)) |
|
11123 continue; |
|
11124 |
|
11125 - for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) |
|
11126 + for (succ_iterator SI = succ_begin(&*BB), SE = succ_end(&*BB); |
|
11127 + SI != SE; ++SI) |
|
11128 if (Reachable.count(*SI)) |
|
11129 - (*SI)->removePredecessor(BB); |
|
11130 + (*SI)->removePredecessor(&*BB); |
|
11131 BB->dropAllReferences(); |
|
11132 } |
|
11133 |
|
11134 for (Function::iterator I = ++F.begin(); I != F.end();) |
|
11135 - if (!Reachable.count(I)) |
|
11136 + if (!Reachable.count(&*I)) |
|
11137 I = F.getBasicBlockList().erase(I); |
|
11138 else |
|
11139 ++I; |
|
11140 --- lib/Transforms/Utils/LoopSimplify.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
11141 +++ lib/Transforms/Utils/LoopSimplify.cpp 2015-11-29 13:04:06.563171833 -0800 |
|
11142 @@ -76,7 +76,7 @@ |
|
11143 SmallVectorImpl<BasicBlock *> &SplitPreds, |
|
11144 Loop *L) { |
|
11145 // Check to see if NewBB is already well placed. |
|
11146 - Function::iterator BBI = NewBB; --BBI; |
|
11147 + Function::iterator BBI = --NewBB->getIterator(); |
|
11148 for (unsigned i = 0, e = SplitPreds.size(); i != e; ++i) { |
|
11149 if (&*BBI == SplitPreds[i]) |
|
11150 return; |
|
11151 @@ -90,9 +90,8 @@ |
|
11152 // block that neighbors a BB actually in the loop. |
|
11153 BasicBlock *FoundBB = nullptr; |
|
11154 for (unsigned i = 0, e = SplitPreds.size(); i != e; ++i) { |
|
11155 - Function::iterator BBI = SplitPreds[i]; |
|
11156 - if (++BBI != NewBB->getParent()->end() && |
|
11157 - L->contains(BBI)) { |
|
11158 + Function::iterator BBI = SplitPreds[i]->getIterator(); |
|
11159 + if (++BBI != NewBB->getParent()->end() && L->contains(&*BBI)) { |
|
11160 FoundBB = SplitPreds[i]; |
|
11161 break; |
|
11162 } |
|
11163 @@ -392,7 +391,7 @@ |
|
11164 << BEBlock->getName() << "\n"); |
|
11165 |
|
11166 // Move the new backedge block to right after the last backedge block. |
|
11167 - Function::iterator InsertPos = BackedgeBlocks.back(); ++InsertPos; |
|
11168 + Function::iterator InsertPos = ++BackedgeBlocks.back()->getIterator(); |
|
11169 F->getBasicBlockList().splice(InsertPos, F->getBasicBlockList(), BEBlock); |
|
11170 |
|
11171 // Now that the block has been inserted into the function, create PHI nodes in |
|
11172 @@ -651,7 +650,7 @@ |
|
11173 bool AllInvariant = true; |
|
11174 bool AnyInvariant = false; |
|
11175 for (BasicBlock::iterator I = ExitingBlock->begin(); &*I != BI; ) { |
|
11176 - Instruction *Inst = I++; |
|
11177 + Instruction *Inst = &*I++; |
|
11178 // Skip debug info intrinsics. |
|
11179 if (isa<DbgInfoIntrinsic>(Inst)) |
|
11180 continue; |
|
11181 --- lib/Transforms/Utils/LoopUnrollRuntime.cpp 2015-02-18 14:51:15.000000000 -0800 |
|
11182 +++ lib/Transforms/Utils/LoopUnrollRuntime.cpp 2015-11-29 13:08:21.195493550 -0800 |
|
11183 @@ -207,9 +207,9 @@ |
|
11184 // Change the incoming values to the ones defined in the preheader or |
|
11185 // cloned loop. |
|
11186 for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) { |
|
11187 - PHINode *NewPHI = cast<PHINode>(VMap[I]); |
|
11188 + PHINode *NewPHI = cast<PHINode>(VMap[&*I]); |
|
11189 if (UnrollProlog) { |
|
11190 - VMap[I] = NewPHI->getIncomingValueForBlock(Preheader); |
|
11191 + VMap[&*I] = NewPHI->getIncomingValueForBlock(Preheader); |
|
11192 cast<BasicBlock>(VMap[Header])->getInstList().erase(NewPHI); |
|
11193 } else { |
|
11194 unsigned idx = NewPHI->getBasicBlockIndex(Preheader); |
|
11195 @@ -390,8 +390,8 @@ |
|
11196 VMap, LI); |
|
11197 |
|
11198 // Insert the cloned blocks into function just before the original loop |
|
11199 - F->getBasicBlockList().splice(PEnd, F->getBasicBlockList(), NewBlocks[0], |
|
11200 - F->end()); |
|
11201 + F->getBasicBlockList().splice(PEnd->getIterator(), F->getBasicBlockList(), |
|
11202 + NewBlocks[0]->getIterator(), F->end()); |
|
11203 |
|
11204 // Rewrite the cloned instruction operands to use the values |
|
11205 // created when the clone is created. |
|
11206 @@ -399,7 +399,7 @@ |
|
11207 for (BasicBlock::iterator I = NewBlocks[i]->begin(), |
|
11208 E = NewBlocks[i]->end(); |
|
11209 I != E; ++I) { |
|
11210 - RemapInstruction(I, VMap, |
|
11211 + RemapInstruction(&*I, VMap, |
|
11212 RF_NoModuleLevelChanges | RF_IgnoreMissingEntries); |
|
11213 } |
|
11214 } |
|
11215 --- lib/Transforms/Utils/LoopUnroll.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
11216 +++ lib/Transforms/Utils/LoopUnroll.cpp 2015-11-29 13:06:17.558243110 -0800 |
|
11217 @@ -383,7 +383,7 @@ |
|
11218 for (unsigned i = 0; i < NewBlocks.size(); ++i) |
|
11219 for (BasicBlock::iterator I = NewBlocks[i]->begin(), |
|
11220 E = NewBlocks[i]->end(); I != E; ++I) |
|
11221 - ::RemapInstruction(I, LastValueMap); |
|
11222 + ::RemapInstruction(&*I, LastValueMap); |
|
11223 } |
|
11224 |
|
11225 // Loop over the PHI nodes in theinal block, setting incoming values. |
|
11226 @@ -504,7 +504,7 @@ |
|
11227 for (std::vector<BasicBlock*>::const_iterator BB = NewLoopBlocks.begin(), |
|
11228 BBE = NewLoopBlocks.end(); BB != BBE; ++BB) |
|
11229 for (BasicBlock::iterator I = (*BB)->begin(), E = (*BB)->end(); I != E; ) { |
|
11230 - Instruction *Inst = I++; |
|
11231 + Instruction *Inst = &*I++; |
|
11232 |
|
11233 if (isInstructionTriviallyDead(Inst)) |
|
11234 (*BB)->getInstList().erase(Inst); |
|
11235 --- lib/Transforms/Utils/LowerExpectIntrinsic.cpp 2014-04-21 19:55:47.000000000 -0700 |
|
11236 +++ lib/Transforms/Utils/LowerExpectIntrinsic.cpp 2015-11-29 13:09:35.298686663 -0800 |
|
11237 @@ -148,7 +148,7 @@ |
|
11238 |
|
11239 bool LowerExpectIntrinsic::runOnFunction(Function &F) { |
|
11240 for (Function::iterator I = F.begin(), E = F.end(); I != E;) { |
|
11241 - BasicBlock *BB = I++; |
|
11242 + BasicBlock *BB = &*I++; |
|
11243 |
|
11244 // Create "block_weights" metadata. |
|
11245 if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) { |
|
11246 --- lib/Transforms/Utils/LowerInvoke.cpp 2014-04-21 19:55:47.000000000 -0700 |
|
11247 +++ lib/Transforms/Utils/LowerInvoke.cpp 2015-11-29 13:18:52.019842685 -0800 |
|
11248 @@ -69,7 +69,7 @@ |
|
11249 BranchInst::Create(II->getNormalDest(), II); |
|
11250 |
|
11251 // Remove any PHI node entries from the exception destination. |
|
11252 - II->getUnwindDest()->removePredecessor(BB); |
|
11253 + II->getUnwindDest()->removePredecessor(&*BB); |
|
11254 |
|
11255 // Remove the invoke instruction now. |
|
11256 BB->getInstList().erase(II); |
|
11257 --- lib/Transforms/Utils/LowerSwitch.cpp 2015-01-28 09:35:18.000000000 -0800 |
|
11258 +++ lib/Transforms/Utils/LowerSwitch.cpp 2015-11-29 13:39:46.489837410 -0800 |
|
11259 @@ -101,7 +101,8 @@ |
|
11260 bool Changed = false; |
|
11261 |
|
11262 for (Function::iterator I = F.begin(), E = F.end(); I != E; ) { |
|
11263 - BasicBlock *Cur = I++; // Advance over block so we don't traverse new blocks |
|
11264 + BasicBlock *Cur = &*I; // Advance over block so we don't traverse new blocks |
|
11265 + ++I; |
|
11266 |
|
11267 if (SwitchInst *SI = dyn_cast<SwitchInst>(Cur->getTerminator())) { |
|
11268 Changed = true; |
|
11269 @@ -142,7 +143,8 @@ |
|
11270 // number of phi values equal to the number of branches to SuccBB. |
|
11271 static void fixPhis(BasicBlock *SuccBB, BasicBlock *OrigBB, BasicBlock *NewBB, |
|
11272 unsigned NumMergedCases) { |
|
11273 - for (BasicBlock::iterator I = SuccBB->begin(), IE = SuccBB->getFirstNonPHI(); |
|
11274 + for (BasicBlock::iterator I = SuccBB->begin(), |
|
11275 + IE = SuccBB->getFirstNonPHI()->getIterator(); |
|
11276 I != IE; ++I) { |
|
11277 PHINode *PN = cast<PHINode>(I); |
|
11278 |
|
11279 @@ -256,8 +258,7 @@ |
|
11280 UpperBound, Val, NewNode, OrigBlock, |
|
11281 Default); |
|
11282 |
|
11283 - Function::iterator FI = OrigBlock; |
|
11284 - F->getBasicBlockList().insert(++FI, NewNode); |
|
11285 + F->getBasicBlockList().insert(++OrigBlock->getIterator(), NewNode); |
|
11286 NewNode->getInstList().push_back(Comp); |
|
11287 |
|
11288 BranchInst::Create(LBranch, RBranch, Comp, NewNode); |
|
11289 @@ -276,8 +277,7 @@ |
|
11290 { |
|
11291 Function* F = OrigBlock->getParent(); |
|
11292 BasicBlock* NewLeaf = BasicBlock::Create(Val->getContext(), "LeafBlock"); |
|
11293 - Function::iterator FI = OrigBlock; |
|
11294 - F->getBasicBlockList().insert(++FI, NewLeaf); |
|
11295 + F->getBasicBlockList().insert(++OrigBlock->getIterator(), NewLeaf); |
|
11296 |
|
11297 // Emit comparison |
|
11298 ICmpInst* Comp = nullptr; |
|
11299 @@ -395,8 +395,7 @@ |
|
11300 BasicBlock *NewDefault = nullptr; |
|
11301 if (!DefaultIsUnreachable) { |
|
11302 NewDefault = BasicBlock::Create(SI->getContext(), "NewDefault"); |
|
11303 - F->getBasicBlockList().insert(Default, NewDefault); |
|
11304 - |
|
11305 + F->getBasicBlockList().insert(Default->getIterator(), NewDefault); |
|
11306 BranchInst::Create(Default, NewDefault); |
|
11307 } |
|
11308 // If there is an entry in any PHI nodes for the default edge, make sure |
|
11309 --- lib/Transforms/Utils/PromoteMemoryToRegister.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
11310 +++ lib/Transforms/Utils/PromoteMemoryToRegister.cpp 2015-11-29 13:44:30.613019495 -0800 |
|
11311 @@ -214,10 +214,11 @@ |
|
11312 // avoid gratuitus rescans. |
|
11313 const BasicBlock *BB = I->getParent(); |
|
11314 unsigned InstNo = 0; |
|
11315 - for (BasicBlock::const_iterator BBI = BB->begin(), E = BB->end(); BBI != E; |
|
11316 - ++BBI) |
|
11317 - if (isInterestingInstruction(BBI)) |
|
11318 - InstNumbers[BBI] = InstNo++; |
|
11319 + |
|
11320 + for (const Instruction &BBI : *BB) |
|
11321 + if (isInterestingInstruction(&BBI)) |
|
11322 + InstNumbers[&BBI] = InstNo++; |
|
11323 + |
|
11324 It = InstNumbers.find(I); |
|
11325 |
|
11326 assert(It != InstNumbers.end() && "Didn't insert instruction?"); |
|
11327 @@ -602,7 +603,7 @@ |
|
11328 if (BBNumbers.empty()) { |
|
11329 unsigned ID = 0; |
|
11330 for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) |
|
11331 - BBNumbers[I] = ID++; |
|
11332 + BBNumbers[&*I] = ID++; |
|
11333 } |
|
11334 |
|
11335 // If we have an AST to keep updated, remember some pointer value that is |
|
11336 @@ -641,7 +642,7 @@ |
|
11337 // and inserting the phi nodes we marked as necessary |
|
11338 // |
|
11339 std::vector<RenamePassData> RenamePassWorkList; |
|
11340 - RenamePassWorkList.push_back(RenamePassData(F.begin(), nullptr, Values)); |
|
11341 + RenamePassWorkList.push_back(RenamePassData(&F.front(), nullptr, Values)); |
|
11342 do { |
|
11343 RenamePassData RPD; |
|
11344 RPD.swap(RenamePassWorkList.back()); |
|
11345 @@ -946,7 +947,7 @@ |
|
11346 // BasicBlock. |
|
11347 PN = PHINode::Create(Allocas[AllocaNo]->getAllocatedType(), getNumPreds(BB), |
|
11348 Allocas[AllocaNo]->getName() + "." + Twine(Version++), |
|
11349 - BB->begin()); |
|
11350 + &BB->front()); |
|
11351 ++NumPHIInsert; |
|
11352 PhiToAllocaMap[PN] = AllocaNo; |
|
11353 |
|
11354 @@ -1011,7 +1012,8 @@ |
|
11355 return; |
|
11356 |
|
11357 for (BasicBlock::iterator II = BB->begin(); !isa<TerminatorInst>(II);) { |
|
11358 - Instruction *I = II++; // get the instruction, increment iterator |
|
11359 + Instruction *I = &*II; // get the instruction, increment iterator |
|
11360 + ++II; |
|
11361 |
|
11362 if (LoadInst *LI = dyn_cast<LoadInst>(I)) { |
|
11363 AllocaInst *Src = dyn_cast<AllocaInst>(LI->getPointerOperand()); |
|
11364 --- lib/Transforms/Utils/SimplifyCFG.cpp 2015-01-12 20:17:47.000000000 -0800 |
|
11365 +++ lib/Transforms/Utils/SimplifyCFG.cpp 2015-11-29 15:07:34.912976680 -0800 |
|
11366 @@ -1091,15 +1091,15 @@ |
|
11367 BasicBlock::iterator BB1_Itr = BB1->begin(); |
|
11368 BasicBlock::iterator BB2_Itr = BB2->begin(); |
|
11369 |
|
11370 - Instruction *I1 = BB1_Itr++, *I2 = BB2_Itr++; |
|
11371 + Instruction *I1 = &*BB1_Itr++, *I2 = &*BB2_Itr++; |
|
11372 // Skip debug info if it is not identical. |
|
11373 DbgInfoIntrinsic *DBI1 = dyn_cast<DbgInfoIntrinsic>(I1); |
|
11374 DbgInfoIntrinsic *DBI2 = dyn_cast<DbgInfoIntrinsic>(I2); |
|
11375 if (!DBI1 || !DBI2 || !DBI1->isIdenticalToWhenDefined(DBI2)) { |
|
11376 while (isa<DbgInfoIntrinsic>(I1)) |
|
11377 - I1 = BB1_Itr++; |
|
11378 + I1 = &*BB1_Itr++; |
|
11379 while (isa<DbgInfoIntrinsic>(I2)) |
|
11380 - I2 = BB2_Itr++; |
|
11381 + I2 = &*BB2_Itr++; |
|
11382 } |
|
11383 if (isa<PHINode>(I1) || !I1->isIdenticalToWhenDefined(I2) || |
|
11384 (isa<InvokeInst>(I1) && !isSafeToHoistInvoke(BB1, BB2, I1, I2))) |
|
11385 @@ -1117,7 +1117,7 @@ |
|
11386 // For a normal instruction, we just move one to right before the branch, |
|
11387 // then replace all uses of the other with the first. Finally, we remove |
|
11388 // the now redundant second instruction. |
|
11389 - BIParent->getInstList().splice(BI, BB1->getInstList(), I1); |
|
11390 + BIParent->getInstList().splice(BI->getIterator(), BB1->getInstList(), I1); |
|
11391 if (!I2->use_empty()) |
|
11392 I2->replaceAllUsesWith(I1); |
|
11393 I1->intersectOptionalDataWith(I2); |
|
11394 @@ -1132,16 +1132,16 @@ |
|
11395 I2->eraseFromParent(); |
|
11396 Changed = true; |
|
11397 |
|
11398 - I1 = BB1_Itr++; |
|
11399 - I2 = BB2_Itr++; |
|
11400 + I1 = &*BB1_Itr++; |
|
11401 + I2 = &*BB2_Itr++; |
|
11402 // Skip debug info if it is not identical. |
|
11403 DbgInfoIntrinsic *DBI1 = dyn_cast<DbgInfoIntrinsic>(I1); |
|
11404 DbgInfoIntrinsic *DBI2 = dyn_cast<DbgInfoIntrinsic>(I2); |
|
11405 if (!DBI1 || !DBI2 || !DBI1->isIdenticalToWhenDefined(DBI2)) { |
|
11406 while (isa<DbgInfoIntrinsic>(I1)) |
|
11407 - I1 = BB1_Itr++; |
|
11408 + I1 = &*BB1_Itr++; |
|
11409 while (isa<DbgInfoIntrinsic>(I2)) |
|
11410 - I2 = BB2_Itr++; |
|
11411 + I2 = &*BB2_Itr++; |
|
11412 } |
|
11413 } while (I1->isIdenticalToWhenDefined(I2)); |
|
11414 |
|
11415 @@ -1176,7 +1176,7 @@ |
|
11416 |
|
11417 // Okay, it is safe to hoist the terminator. |
|
11418 Instruction *NT = I1->clone(); |
|
11419 - BIParent->getInstList().insert(BI, NT); |
|
11420 + BIParent->getInstList().insert(BI->getIterator(), NT); |
|
11421 if (!NT->getType()->isVoidTy()) { |
|
11422 I1->replaceAllUsesWith(NT); |
|
11423 I2->replaceAllUsesWith(NT); |
|
11424 @@ -1353,7 +1353,7 @@ |
|
11425 if (!NewPN) { |
|
11426 NewPN = |
|
11427 PHINode::Create(DifferentOp1->getType(), 2, |
|
11428 - DifferentOp1->getName() + ".sink", BBEnd->begin()); |
|
11429 + DifferentOp1->getName() + ".sink", &BBEnd->front()); |
|
11430 NewPN->addIncoming(DifferentOp1, BB1); |
|
11431 NewPN->addIncoming(DifferentOp2, BB2); |
|
11432 DEBUG(dbgs() << "Create PHI node " << *NewPN << "\n";); |
|
11433 @@ -1368,7 +1368,8 @@ |
|
11434 // instruction in the basic block down. |
|
11435 bool UpdateRE1 = (I1 == BB1->begin()), UpdateRE2 = (I2 == BB2->begin()); |
|
11436 // Sink the instruction. |
|
11437 - BBEnd->getInstList().splice(FirstNonPhiInBBEnd, BB1->getInstList(), I1); |
|
11438 + BBEnd->getInstList().splice(FirstNonPhiInBBEnd->getIterator(), |
|
11439 + BB1->getInstList(), I1); |
|
11440 if (!OldPN->use_empty()) |
|
11441 OldPN->replaceAllUsesWith(I1); |
|
11442 OldPN->eraseFromParent(); |
|
11443 @@ -1520,7 +1521,7 @@ |
|
11444 for (BasicBlock::iterator BBI = ThenBB->begin(), |
|
11445 BBE = std::prev(ThenBB->end()); |
|
11446 BBI != BBE; ++BBI) { |
|
11447 - Instruction *I = BBI; |
|
11448 + Instruction *I = &*BBI; |
|
11449 // Skip debug info. |
|
11450 if (isa<DbgInfoIntrinsic>(I)) |
|
11451 continue; |
|
11452 @@ -1632,8 +1633,8 @@ |
|
11453 } |
|
11454 |
|
11455 // Hoist the instructions. |
|
11456 - BB->getInstList().splice(BI, ThenBB->getInstList(), ThenBB->begin(), |
|
11457 - std::prev(ThenBB->end())); |
|
11458 + BB->getInstList().splice(BI->getIterator(), ThenBB->getInstList(), |
|
11459 + ThenBB->begin(), std::prev(ThenBB->end())); |
|
11460 |
|
11461 // Insert selects and rewrite the PHI operands. |
|
11462 IRBuilder<true, NoFolder> Builder(BI); |
|
11463 @@ -1776,13 +1777,13 @@ |
|
11464 |
|
11465 // Check for trivial simplification. |
|
11466 if (Value *V = SimplifyInstruction(N, DL)) { |
|
11467 - TranslateMap[BBI] = V; |
|
11468 + TranslateMap[&*BBI] = V; |
|
11469 delete N; // Instruction folded away, don't need actual inst |
|
11470 } else { |
|
11471 // Insert the new instruction into its new home. |
|
11472 EdgeBB->getInstList().insert(InsertPt, N); |
|
11473 if (!BBI->use_empty()) |
|
11474 - TranslateMap[BBI] = N; |
|
11475 + TranslateMap[&*BBI] = N; |
|
11476 } |
|
11477 } |
|
11478 |
|
11479 @@ -1875,8 +1876,9 @@ |
|
11480 IfBlock1 = nullptr; |
|
11481 } else { |
|
11482 DomBlock = *pred_begin(IfBlock1); |
|
11483 - for (BasicBlock::iterator I = IfBlock1->begin();!isa<TerminatorInst>(I);++I) |
|
11484 - if (!AggressiveInsts.count(I) && !isa<DbgInfoIntrinsic>(I)) { |
|
11485 + for (BasicBlock::iterator I = IfBlock1->begin(); |
|
11486 + !isa<TerminatorInst>(I); ++I) |
|
11487 + if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) { |
|
11488 // This is not an aggressive instruction that we can promote. |
|
11489 // Because of this, we won't be able to get rid of the control |
|
11490 // flow, so the xform is not worth it. |
|
11491 @@ -1888,8 +1890,9 @@ |
|
11492 IfBlock2 = nullptr; |
|
11493 } else { |
|
11494 DomBlock = *pred_begin(IfBlock2); |
|
11495 - for (BasicBlock::iterator I = IfBlock2->begin();!isa<TerminatorInst>(I);++I) |
|
11496 - if (!AggressiveInsts.count(I) && !isa<DbgInfoIntrinsic>(I)) { |
|
11497 + for (BasicBlock::iterator I = IfBlock2->begin(); |
|
11498 + !isa<TerminatorInst>(I); ++I) |
|
11499 + if (!AggressiveInsts.count(&*I) && !isa<DbgInfoIntrinsic>(I)) { |
|
11500 // This is not an aggressive instruction that we can promote. |
|
11501 // Because of this, we won't be able to get rid of the control |
|
11502 // flow, so the xform is not worth it. |
|
11503 @@ -1908,13 +1911,13 @@ |
|
11504 // Move all 'aggressive' instructions, which are defined in the |
|
11505 // conditional parts of the if's up to the dominating block. |
|
11506 if (IfBlock1) |
|
11507 - DomBlock->getInstList().splice(InsertPt, |
|
11508 + DomBlock->getInstList().splice(InsertPt->getIterator(), |
|
11509 IfBlock1->getInstList(), IfBlock1->begin(), |
|
11510 - IfBlock1->getTerminator()); |
|
11511 + IfBlock1->getTerminator()->getIterator()); |
|
11512 if (IfBlock2) |
|
11513 - DomBlock->getInstList().splice(InsertPt, |
|
11514 + DomBlock->getInstList().splice(InsertPt->getIterator(), |
|
11515 IfBlock2->getInstList(), IfBlock2->begin(), |
|
11516 - IfBlock2->getTerminator()); |
|
11517 + IfBlock2->getTerminator()->getIterator()); |
|
11518 |
|
11519 while (PHINode *PN = dyn_cast<PHINode>(BB->begin())) { |
|
11520 // Change the PHI node into a select instruction. |
|
11521 @@ -2086,7 +2089,8 @@ |
|
11522 BI->getSuccessor(0) == PBI->getSuccessor(1))) { |
|
11523 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); |
|
11524 I != E; ) { |
|
11525 - Instruction *Curr = I++; |
|
11526 + Instruction *Curr = &*I; |
|
11527 + ++I; |
|
11528 if (isa<CmpInst>(Curr)) { |
|
11529 Cond = Curr; |
|
11530 break; |
|
11531 @@ -2106,7 +2110,7 @@ |
|
11532 return false; |
|
11533 |
|
11534 // Make sure the instruction after the condition is the cond branch. |
|
11535 - BasicBlock::iterator CondIt = Cond; ++CondIt; |
|
11536 + BasicBlock::iterator CondIt = ++Cond->getIterator(); |
|
11537 |
|
11538 // Ignore dbg intrinsics. |
|
11539 while (isa<DbgInfoIntrinsic>(CondIt)) ++CondIt; |
|
11540 @@ -2124,7 +2128,7 @@ |
|
11541 // Ignore dbg intrinsics. |
|
11542 if (isa<DbgInfoIntrinsic>(I)) |
|
11543 continue; |
|
11544 - if (!I->hasOneUse() || !isSafeToSpeculativelyExecute(I, DL)) |
|
11545 + if (!I->hasOneUse() || !isSafeToSpeculativelyExecute(&*I, DL)) |
|
11546 return false; |
|
11547 // I has only one use and can be executed unconditionally. |
|
11548 Instruction *User = dyn_cast<Instruction>(I->user_back()); |
|
11549 @@ -2221,7 +2225,7 @@ |
|
11550 Instruction *NewBonusInst = BonusInst->clone(); |
|
11551 RemapInstruction(NewBonusInst, VMap, |
|
11552 RF_NoModuleLevelChanges | RF_IgnoreMissingEntries); |
|
11553 - VMap[BonusInst] = NewBonusInst; |
|
11554 + VMap[&*BonusInst] = NewBonusInst; |
|
11555 |
|
11556 // If we moved a load, we cannot any longer claim any knowledge about |
|
11557 // its potential value. The previous information might have been valid |
|
11558 @@ -2230,8 +2234,8 @@ |
|
11559 // semantics we don't understand. |
|
11560 NewBonusInst->dropUnknownMetadata(LLVMContext::MD_dbg); |
|
11561 |
|
11562 - PredBlock->getInstList().insert(PBI, NewBonusInst); |
|
11563 - NewBonusInst->takeName(BonusInst); |
|
11564 + PredBlock->getInstList().insert(PBI->getIterator(), NewBonusInst); |
|
11565 + NewBonusInst->takeName(&*BonusInst); |
|
11566 BonusInst->setName(BonusInst->getName() + ".old"); |
|
11567 } |
|
11568 |
|
11569 @@ -2240,7 +2244,7 @@ |
|
11570 Instruction *New = Cond->clone(); |
|
11571 RemapInstruction(New, VMap, |
|
11572 RF_NoModuleLevelChanges | RF_IgnoreMissingEntries); |
|
11573 - PredBlock->getInstList().insert(PBI, New); |
|
11574 + PredBlock->getInstList().insert(PBI->getIterator(), New); |
|
11575 New->takeName(Cond); |
|
11576 Cond->setName(New->getName() + ".old"); |
|
11577 |
|
11578 @@ -2392,7 +2396,7 @@ |
|
11579 PHINode *NewPN = PHINode::Create(Type::getInt1Ty(BB->getContext()), |
|
11580 std::distance(PB, PE), |
|
11581 BI->getCondition()->getName() + ".pr", |
|
11582 - BB->begin()); |
|
11583 + &BB->front()); |
|
11584 // Okay, we're going to insert the PHI node. Since PBI is not the only |
|
11585 // predecessor, compute the PHI'd conditional value for all of the preds. |
|
11586 // Any predecessor where the condition is not computable we keep symbolic. |
|
11587 @@ -2877,7 +2881,9 @@ |
|
11588 // then we evaluate them with an explicit branch first. Split the block |
|
11589 // right before the condbr to handle it. |
|
11590 if (ExtraCase) { |
|
11591 - BasicBlock *NewBB = BB->splitBasicBlock(BI, "switch.early.test"); |
|
11592 + BasicBlock *NewBB = |
|
11593 + BB->splitBasicBlock(BI->getIterator(), "switch.early.test"); |
|
11594 + |
|
11595 // Remove the uncond branch added to the old block. |
|
11596 TerminatorInst *OldTI = BB->getTerminator(); |
|
11597 Builder.SetInsertPoint(OldTI); |
|
11598 @@ -2943,7 +2949,7 @@ |
|
11599 return false; |
|
11600 |
|
11601 // Check that there are no other instructions except for debug intrinsics. |
|
11602 - BasicBlock::iterator I = LPInst, E = RI; |
|
11603 + BasicBlock::iterator I = LPInst->getIterator(), E = RI->getIterator(); |
|
11604 while (++I != E) |
|
11605 if (!isa<DbgInfoIntrinsic>(I)) |
|
11606 return false; |
|
11607 @@ -3049,8 +3055,8 @@ |
|
11608 |
|
11609 // If there are any instructions immediately before the unreachable that can |
|
11610 // be removed, do so. |
|
11611 - while (UI != BB->begin()) { |
|
11612 - BasicBlock::iterator BBI = UI; |
|
11613 + while (UI->getIterator() != BB->begin()) { |
|
11614 + BasicBlock::iterator BBI = UI->getIterator(); |
|
11615 --BBI; |
|
11616 // Do not delete instructions that can have side effects which might cause |
|
11617 // the unreachable to not be reachable; specifically, calls and volatile |
|
11618 @@ -3484,7 +3490,7 @@ |
|
11619 } else if (isa<DbgInfoIntrinsic>(I)) { |
|
11620 // Skip debug intrinsic. |
|
11621 continue; |
|
11622 - } else if (Constant *C = ConstantFold(I, ConstantPool, DL)) { |
|
11623 + } else if (Constant *C = ConstantFold(&*I, ConstantPool, DL)) { |
|
11624 // Instruction is side-effect free and constant. |
|
11625 |
|
11626 // If the instruction has uses outside this block or a phi node slot for |
|
11627 @@ -3501,7 +3507,7 @@ |
|
11628 return false; |
|
11629 } |
|
11630 |
|
11631 - ConstantPool.insert(std::make_pair(I, C)); |
|
11632 + ConstantPool.insert(std::make_pair(&*I, C)); |
|
11633 } else { |
|
11634 break; |
|
11635 } |
|
11636 @@ -4399,7 +4405,7 @@ |
|
11637 return true; |
|
11638 |
|
11639 // If the Terminator is the only non-phi instruction, simplify the block. |
|
11640 - BasicBlock::iterator I = BB->getFirstNonPHIOrDbg(); |
|
11641 + BasicBlock::iterator I = BB->getFirstNonPHIOrDbg()->getIterator(); |
|
11642 if (I->isTerminator() && BB != &BB->getParent()->getEntryBlock() && |
|
11643 TryToSimplifyUncondBranchFromEmptyBlock(BB)) |
|
11644 return true; |
|
11645 --- lib/Transforms/Utils/SimplifyInstructions.cpp 2015-01-04 04:03:27.000000000 -0800 |
|
11646 +++ lib/Transforms/Utils/SimplifyInstructions.cpp 2015-11-29 15:09:24.682261310 -0800 |
|
11647 @@ -63,8 +63,11 @@ |
|
11648 for (BasicBlock *BB : depth_first(&F.getEntryBlock())) |
|
11649 // Here be subtlety: the iterator must be incremented before the loop |
|
11650 // body (not sure why), so a range-for loop won't work here. |
|
11651 - for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); BI != BE;) { |
|
11652 - Instruction *I = BI++; |
|
11653 + for (BasicBlock::iterator BI = BB->begin(), BE = BB->end(); |
|
11654 + BI != BE; /* inside loop */) { |
|
11655 + Instruction *I = &*BI; |
|
11656 + ++BI; |
|
11657 + |
|
11658 // The first time through the loop ToSimplify is empty and we try to |
|
11659 // simplify all instructions. On later iterations ToSimplify is not |
|
11660 // empty and we only bother simplifying instructions that are in it. |
|
11661 --- lib/Transforms/Utils/SimplifyLibCalls.cpp 2015-01-28 11:15:34.000000000 -0800 |
|
11662 +++ lib/Transforms/Utils/SimplifyLibCalls.cpp 2015-11-29 15:11:56.561911410 -0800 |
|
11663 @@ -1338,8 +1338,7 @@ |
|
11664 if (Instruction *ArgInst = dyn_cast<Instruction>(Arg)) { |
|
11665 // If the argument is an instruction, it must dominate all uses so put our |
|
11666 // sincos call there. |
|
11667 - BasicBlock::iterator Loc = ArgInst; |
|
11668 - B.SetInsertPoint(ArgInst->getParent(), ++Loc); |
|
11669 + B.SetInsertPoint(ArgInst->getParent(), ++ArgInst->getIterator()); |
|
11670 } else { |
|
11671 // Otherwise (e.g. for a constant) the beginning of the function is as |
|
11672 // good a place as any. |
|
11673 --- lib/Transforms/Utils/UnifyFunctionExitNodes.cpp 2015-01-28 09:35:18.000000000 -0800 |
|
11674 +++ lib/Transforms/Utils/UnifyFunctionExitNodes.cpp 2015-11-29 15:14:01.147224983 -0800 |
|
11675 @@ -50,11 +50,12 @@ |
|
11676 // |
|
11677 std::vector<BasicBlock*> ReturningBlocks; |
|
11678 std::vector<BasicBlock*> UnreachableBlocks; |
|
11679 - for(Function::iterator I = F.begin(), E = F.end(); I != E; ++I) |
|
11680 - if (isa<ReturnInst>(I->getTerminator())) |
|
11681 - ReturningBlocks.push_back(I); |
|
11682 - else if (isa<UnreachableInst>(I->getTerminator())) |
|
11683 - UnreachableBlocks.push_back(I); |
|
11684 + |
|
11685 + for (BasicBlock &I : F) |
|
11686 + if (isa<ReturnInst>(I.getTerminator())) |
|
11687 + ReturningBlocks.push_back(&I); |
|
11688 + else if (isa<UnreachableInst>(I.getTerminator())) |
|
11689 + UnreachableBlocks.push_back(&I); |
|
11690 |
|
11691 // Then unreachable blocks. |
|
11692 if (UnreachableBlocks.empty()) { |
|
11693 --- lib/Transforms/Vectorize/BBVectorize.cpp 2014-12-19 09:21:38.000000000 -0800 |
|
11694 +++ lib/Transforms/Vectorize/BBVectorize.cpp 2015-12-06 09:35:21.191615227 -0800 |
|
11695 @@ -1243,12 +1243,13 @@ |
|
11696 if (I == Start) IAfterStart = true; |
|
11697 |
|
11698 bool IsSimpleLoadStore; |
|
11699 - if (!isInstVectorizable(I, IsSimpleLoadStore)) continue; |
|
11700 + if (!isInstVectorizable(&*I, IsSimpleLoadStore)) continue; |
|
11701 |
|
11702 // Look for an instruction with which to pair instruction *I... |
|
11703 DenseSet<Value *> Users; |
|
11704 AliasSetTracker WriteSet(*AA); |
|
11705 - if (I->mayWriteToMemory()) WriteSet.add(I); |
|
11706 + if (I->mayWriteToMemory()) |
|
11707 + WriteSet.add(&*I); |
|
11708 |
|
11709 bool JAfterStart = IAfterStart; |
|
11710 BasicBlock::iterator J = std::next(I); |
|
11711 @@ -1256,7 +1257,7 @@ |
|
11712 if (J == Start) JAfterStart = true; |
|
11713 |
|
11714 // Determine if J uses I, if so, exit the loop. |
|
11715 - bool UsesI = trackUsesOfI(Users, WriteSet, I, J, !Config.FastDep); |
|
11716 + bool UsesI = trackUsesOfI(Users, WriteSet, &*I, &*J, !Config.FastDep); |
|
11717 if (Config.FastDep) { |
|
11718 // Note: For this heuristic to be effective, independent operations |
|
11719 // must tend to be intermixed. This is likely to be true from some |
|
11720 @@ -1273,25 +1274,26 @@ |
|
11721 // J does not use I, and comes before the first use of I, so it can be |
|
11722 // merged with I if the instructions are compatible. |
|
11723 int CostSavings, FixedOrder; |
|
11724 - if (!areInstsCompatible(I, J, IsSimpleLoadStore, NonPow2Len, |
|
11725 - CostSavings, FixedOrder)) continue; |
|
11726 + if (!areInstsCompatible(&*I, &*J, IsSimpleLoadStore, NonPow2Len, |
|
11727 + CostSavings, FixedOrder)) |
|
11728 + continue; |
|
11729 |
|
11730 // J is a candidate for merging with I. |
|
11731 if (!PairableInsts.size() || |
|
11732 - PairableInsts[PairableInsts.size()-1] != I) { |
|
11733 - PairableInsts.push_back(I); |
|
11734 + PairableInsts[PairableInsts.size()-1] != &*I) { |
|
11735 + PairableInsts.push_back(&*I); |
|
11736 } |
|
11737 |
|
11738 - CandidatePairs[I].push_back(J); |
|
11739 + CandidatePairs[&*I].push_back(&*J); |
|
11740 ++TotalPairs; |
|
11741 if (TTI) |
|
11742 - CandidatePairCostSavings.insert(ValuePairWithCost(ValuePair(I, J), |
|
11743 - CostSavings)); |
|
11744 + CandidatePairCostSavings.insert( |
|
11745 + ValuePairWithCost(ValuePair(&*I, &*J), CostSavings)); |
|
11746 |
|
11747 if (FixedOrder == 1) |
|
11748 - FixedOrderPairs.insert(ValuePair(I, J)); |
|
11749 + FixedOrderPairs.insert(ValuePair(&*I, &*J)); |
|
11750 else if (FixedOrder == -1) |
|
11751 - FixedOrderPairs.insert(ValuePair(J, I)); |
|
11752 + FixedOrderPairs.insert(ValuePair(&*J, &*I)); |
|
11753 |
|
11754 // The next call to this function must start after the last instruction |
|
11755 // selected during this invocation. |
|
11756 @@ -1472,14 +1474,15 @@ |
|
11757 BasicBlock::iterator E = BB.end(), EL = |
|
11758 BasicBlock::iterator(cast<Instruction>(PairableInsts.back())); |
|
11759 for (BasicBlock::iterator I = BB.getFirstInsertionPt(); I != E; ++I) { |
|
11760 - if (IsInPair.find(I) == IsInPair.end()) continue; |
|
11761 + if (IsInPair.find(&*I) == IsInPair.end()) |
|
11762 + continue; |
|
11763 |
|
11764 DenseSet<Value *> Users; |
|
11765 AliasSetTracker WriteSet(*AA); |
|
11766 - if (I->mayWriteToMemory()) WriteSet.add(I); |
|
11767 + if (I->mayWriteToMemory()) WriteSet.add(&*I); |
|
11768 |
|
11769 for (BasicBlock::iterator J = std::next(I); J != E; ++J) { |
|
11770 - (void) trackUsesOfI(Users, WriteSet, I, J); |
|
11771 + (void) trackUsesOfI(Users, WriteSet, &*I, &*J); |
|
11772 |
|
11773 if (J == EL) |
|
11774 break; |
|
11775 @@ -1488,7 +1491,7 @@ |
|
11776 for (DenseSet<Value *>::iterator U = Users.begin(), E = Users.end(); |
|
11777 U != E; ++U) { |
|
11778 if (IsInPair.find(*U) == IsInPair.end()) continue; |
|
11779 - PairableInstUsers.insert(ValuePair(I, *U)); |
|
11780 + PairableInstUsers.insert(ValuePair(&*I, *U)); |
|
11781 } |
|
11782 |
|
11783 if (I == EL) |
|
11784 @@ -2873,7 +2876,7 @@ |
|
11785 if (I->mayWriteToMemory()) WriteSet.add(I); |
|
11786 |
|
11787 for (; cast<Instruction>(L) != J; ++L) |
|
11788 - (void) trackUsesOfI(Users, WriteSet, I, L, true, &LoadMoveSetPairs); |
|
11789 + (void) trackUsesOfI(Users, WriteSet, I, &*L, true, &LoadMoveSetPairs); |
|
11790 |
|
11791 assert(cast<Instruction>(L) == J && |
|
11792 "Tracking has not proceeded far enough to check for dependencies"); |
|
11793 @@ -2895,9 +2898,10 @@ |
|
11794 if (I->mayWriteToMemory()) WriteSet.add(I); |
|
11795 |
|
11796 for (; cast<Instruction>(L) != J;) { |
|
11797 - if (trackUsesOfI(Users, WriteSet, I, L, true, &LoadMoveSetPairs)) { |
|
11798 + if (trackUsesOfI(Users, WriteSet, I, &*L, true, &LoadMoveSetPairs)) { |
|
11799 // Move this instruction |
|
11800 - Instruction *InstToMove = L; ++L; |
|
11801 + Instruction *InstToMove = &*L; |
|
11802 + ++L; |
|
11803 |
|
11804 DEBUG(dbgs() << "BBV: moving: " << *InstToMove << |
|
11805 " to after " << *InsertionPt << "\n"); |
|
11806 @@ -2929,10 +2933,10 @@ |
|
11807 // farther down the use chain by another instruction pairing. Also, J |
|
11808 // could be before I if this is an inverted input. |
|
11809 for (BasicBlock::iterator E = BB.end(); cast<Instruction>(L) != E; ++L) { |
|
11810 - if (trackUsesOfI(Users, WriteSet, I, L)) { |
|
11811 + if (trackUsesOfI(Users, WriteSet, I, &*L)) { |
|
11812 if (L->mayReadFromMemory()) { |
|
11813 - LoadMoveSet[L].push_back(I); |
|
11814 - LoadMoveSetPairs.insert(ValuePair(L, I)); |
|
11815 + LoadMoveSet[&*L].push_back(I); |
|
11816 + LoadMoveSetPairs.insert(ValuePair(&*L, I)); |
|
11817 } |
|
11818 } |
|
11819 } |
|
11820 @@ -2995,7 +2999,7 @@ |
|
11821 DEBUG(dbgs() << "BBV: initial: \n" << BB << "\n"); |
|
11822 |
|
11823 for (BasicBlock::iterator PI = BB.getFirstInsertionPt(); PI != BB.end();) { |
|
11824 - DenseMap<Value *, Value *>::iterator P = ChosenPairs.find(PI); |
|
11825 + DenseMap<Value *, Value *>::iterator P = ChosenPairs.find(&*PI); |
|
11826 if (P == ChosenPairs.end()) { |
|
11827 ++PI; |
|
11828 continue; |
|
11829 --- lib/Transforms/Vectorize/LoopVectorize.cpp 2015-02-17 13:53:25.000000000 -0800 |
|
11830 +++ lib/Transforms/Vectorize/LoopVectorize.cpp 2015-12-06 11:41:36.696287648 -0800 |
|
11831 @@ -462,6 +462,10 @@ |
|
11832 Value *ExtendedIdx; |
|
11833 /// Maps scalars to widened vectors. |
|
11834 ValueMap WidenMap; |
|
11835 + /// Store instructions that should be predicated, as a pair |
|
11836 + /// <StoreInst, Predicate> |
|
11837 + SmallVector<std::pair<StoreInst*,Value*>, 4> PredicatedStores; |
|
11838 + |
|
11839 EdgeMaskCache MaskCache; |
|
11840 |
|
11841 LoopVectorizationLegality *Legal; |
|
11842 @@ -1965,36 +1969,31 @@ |
|
11843 // Create a new entry in the WidenMap and initialize it to Undef or Null. |
|
11844 VectorParts &VecResults = WidenMap.splat(Instr, UndefVec); |
|
11845 |
|
11846 - Instruction *InsertPt = Builder.GetInsertPoint(); |
|
11847 - BasicBlock *IfBlock = Builder.GetInsertBlock(); |
|
11848 - BasicBlock *CondBlock = nullptr; |
|
11849 + // Instruction *InsertPt = Builder.GetInsertPoint(); |
|
11850 + // BasicBlock *IfBlock = Builder.GetInsertBlock(); |
|
11851 + // BasicBlock *CondBlock = nullptr; |
|
11852 |
|
11853 VectorParts Cond; |
|
11854 - Loop *VectorLp = nullptr; |
|
11855 + // Loop *VectorLp = nullptr; |
|
11856 if (IfPredicateStore) { |
|
11857 assert(Instr->getParent()->getSinglePredecessor() && |
|
11858 "Only support single predecessor blocks"); |
|
11859 Cond = createEdgeMask(Instr->getParent()->getSinglePredecessor(), |
|
11860 Instr->getParent()); |
|
11861 - VectorLp = LI->getLoopFor(IfBlock); |
|
11862 - assert(VectorLp && "Must have a loop for this block"); |
|
11863 + // VectorLp = LI->getLoopFor(IfBlock); |
|
11864 + // assert(VectorLp && "Must have a loop for this block"); |
|
11865 } |
|
11866 |
|
11867 // For each vector unroll 'part': |
|
11868 for (unsigned Part = 0; Part < UF; ++Part) { |
|
11869 // For each scalar that we create: |
|
11870 for (unsigned Width = 0; Width < VF; ++Width) { |
|
11871 - |
|
11872 // Start if-block. |
|
11873 Value *Cmp = nullptr; |
|
11874 if (IfPredicateStore) { |
|
11875 Cmp = Builder.CreateExtractElement(Cond[Part], Builder.getInt32(Width)); |
|
11876 - Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Cmp, ConstantInt::get(Cmp->getType(), 1)); |
|
11877 - CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.store"); |
|
11878 - LoopVectorBody.push_back(CondBlock); |
|
11879 - VectorLp->addBasicBlockToLoop(CondBlock, LI->getBase()); |
|
11880 - // Update Builder with newly created basic block. |
|
11881 - Builder.SetInsertPoint(InsertPt); |
|
11882 + Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Cmp, |
|
11883 + ConstantInt::get(Cmp->getType(), 1)); |
|
11884 } |
|
11885 |
|
11886 Instruction *Cloned = Instr->clone(); |
|
11887 @@ -2019,6 +2018,7 @@ |
|
11888 Builder.getInt32(Width)); |
|
11889 // End if-block. |
|
11890 if (IfPredicateStore) { |
|
11891 +#if 0 |
|
11892 BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else"); |
|
11893 LoopVectorBody.push_back(NewIfBlock); |
|
11894 VectorLp->addBasicBlockToLoop(NewIfBlock, LI->getBase()); |
|
11895 @@ -2027,6 +2027,9 @@ |
|
11896 BranchInst::Create(CondBlock, NewIfBlock, Cmp, OldBr); |
|
11897 OldBr->eraseFromParent(); |
|
11898 IfBlock = NewIfBlock; |
|
11899 +#endif |
|
11900 + PredicatedStores.push_back(std::make_pair(cast<StoreInst>(Cloned), |
|
11901 + Cmp)); |
|
11902 } |
|
11903 } |
|
11904 } |
|
11905 @@ -2283,13 +2286,17 @@ |
|
11906 |
|
11907 // Split the single block loop into the two loop structure described above. |
|
11908 BasicBlock *VectorPH = |
|
11909 - BypassBlock->splitBasicBlock(BypassBlock->getTerminator(), "vector.ph"); |
|
11910 + BypassBlock->splitBasicBlock(BypassBlock->getTerminator()->getIterator(), |
|
11911 + "vector.ph"); |
|
11912 BasicBlock *VecBody = |
|
11913 - VectorPH->splitBasicBlock(VectorPH->getTerminator(), "vector.body"); |
|
11914 + VectorPH->splitBasicBlock(VectorPH->getTerminator()->getIterator(), |
|
11915 + "vector.body"); |
|
11916 BasicBlock *MiddleBlock = |
|
11917 - VecBody->splitBasicBlock(VecBody->getTerminator(), "middle.block"); |
|
11918 + VecBody->splitBasicBlock(VecBody->getTerminator()->getIterator(), |
|
11919 + "middle.block"); |
|
11920 BasicBlock *ScalarPH = |
|
11921 - MiddleBlock->splitBasicBlock(MiddleBlock->getTerminator(), "scalar.ph"); |
|
11922 + MiddleBlock->splitBasicBlock(MiddleBlock->getTerminator()->getIterator(), |
|
11923 + "scalar.ph"); |
|
11924 |
|
11925 // Create and register the new vector loop. |
|
11926 Loop* Lp = new Loop(); |
|
11927 @@ -2378,7 +2385,8 @@ |
|
11928 if (StrideCheck) { |
|
11929 // Create a new block containing the stride check. |
|
11930 BasicBlock *CheckBlock = |
|
11931 - LastBypassBlock->splitBasicBlock(FirstCheckInst, "vector.stridecheck"); |
|
11932 + LastBypassBlock->splitBasicBlock(FirstCheckInst->getIterator(), |
|
11933 + "vector.stridecheck"); |
|
11934 if (ParentLoop) |
|
11935 ParentLoop->addBasicBlockToLoop(CheckBlock, LI->getBase()); |
|
11936 LoopBypassBlocks.push_back(CheckBlock); |
|
11937 @@ -2402,7 +2410,8 @@ |
|
11938 if (MemRuntimeCheck) { |
|
11939 // Create a new block containing the memory check. |
|
11940 BasicBlock *CheckBlock = |
|
11941 - LastBypassBlock->splitBasicBlock(MemRuntimeCheck, "vector.memcheck"); |
|
11942 + LastBypassBlock->splitBasicBlock(MemRuntimeCheck->getIterator(), |
|
11943 + "vector.memcheck"); |
|
11944 if (ParentLoop) |
|
11945 ParentLoop->addBasicBlockToLoop(CheckBlock, LI->getBase()); |
|
11946 LoopBypassBlocks.push_back(CheckBlock); |
|
11947 @@ -2590,7 +2599,7 @@ |
|
11948 VecBody->getTerminator()->eraseFromParent(); |
|
11949 |
|
11950 // Get ready to start creating new instructions into the vectorized body. |
|
11951 - Builder.SetInsertPoint(VecBody->getFirstInsertionPt()); |
|
11952 + Builder.SetInsertPoint(&*VecBody->getFirstInsertionPt()); |
|
11953 |
|
11954 // Save the state. |
|
11955 LoopVectorPreHeader = VectorPH; |
|
11956 @@ -2739,7 +2748,8 @@ |
|
11957 for (unsigned i = 0, e = BBs.size(); i != e; ++i) { |
|
11958 BasicBlock *BB = BBs[i]; |
|
11959 for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E;) { |
|
11960 - Instruction *In = I++; |
|
11961 + Instruction *In = &*I; |
|
11962 + ++I; |
|
11963 |
|
11964 if (!CSEDenseMapInfo::canHandle(In)) |
|
11965 continue; |
|
11966 @@ -2890,7 +2900,7 @@ |
|
11967 // the PHIs and the values we are going to write. |
|
11968 // This allows us to write both PHINodes and the extractelement |
|
11969 // instructions. |
|
11970 - Builder.SetInsertPoint(LoopMiddleBlock->getFirstInsertionPt()); |
|
11971 + Builder.SetInsertPoint(&*LoopMiddleBlock->getFirstInsertionPt()); |
|
11972 |
|
11973 VectorParts RdxParts; |
|
11974 setDebugLocFromInst(Builder, RdxDesc.LoopExitInstr); |
|
11975 @@ -3000,6 +3010,9 @@ |
|
11976 |
|
11977 fixLCSSAPHIs(); |
|
11978 |
|
11979 + // Make sure DomTree is updated. |
|
11980 + updateAnalysis(); |
|
11981 + |
|
11982 // Remove redundant induction instructions. |
|
11983 cse(LoopVectorBody); |
|
11984 } |
|
11985 @@ -3084,8 +3097,9 @@ |
|
11986 // This is phase one of vectorizing PHIs. |
|
11987 Type *VecTy = (VF == 1) ? PN->getType() : |
|
11988 VectorType::get(PN->getType(), VF); |
|
11989 - Entry[part] = PHINode::Create(VecTy, 2, "vec.phi", |
|
11990 - LoopVectorBody.back()-> getFirstInsertionPt()); |
|
11991 + Entry[part] = |
|
11992 + PHINode::Create(VecTy, 2, "vec.phi", |
|
11993 + &*LoopVectorBody.back()->getFirstInsertionPt()); |
|
11994 } |
|
11995 PV->push_back(P); |
|
11996 return; |
|
11997 @@ -3240,7 +3254,7 @@ |
|
11998 void InnerLoopVectorizer::vectorizeBlockInLoop(BasicBlock *BB, PhiVector *PV) { |
|
11999 // For each instruction in the old loop. |
|
12000 for (BasicBlock::iterator it = BB->begin(), e = BB->end(); it != e; ++it) { |
|
12001 - VectorParts &Entry = WidenMap.get(it); |
|
12002 + VectorParts &Entry = WidenMap.get(&*it); |
|
12003 switch (it->getOpcode()) { |
|
12004 case Instruction::Br: |
|
12005 // Nothing to do for PHIs and BR, since we already took care of the |
|
12006 @@ -3248,7 +3262,7 @@ |
|
12007 continue; |
|
12008 case Instruction::PHI:{ |
|
12009 // Vectorize PHINodes. |
|
12010 - widenPHIInstruction(it, Entry, UF, VF, PV); |
|
12011 + widenPHIInstruction(&*it, Entry, UF, VF, PV); |
|
12012 continue; |
|
12013 }// End of PHI. |
|
12014 |
|
12015 @@ -3286,7 +3300,7 @@ |
|
12016 Entry[Part] = V; |
|
12017 } |
|
12018 |
|
12019 - propagateMetadata(Entry, it); |
|
12020 + propagateMetadata(Entry, &*it); |
|
12021 break; |
|
12022 } |
|
12023 case Instruction::Select: { |
|
12024 @@ -3295,7 +3309,7 @@ |
|
12025 // instruction with a scalar condition. Otherwise, use vector-select. |
|
12026 bool InvariantCond = SE->isLoopInvariant(SE->getSCEV(it->getOperand(0)), |
|
12027 OrigLoop); |
|
12028 - setDebugLocFromInst(Builder, it); |
|
12029 + setDebugLocFromInst(Builder, &*it); |
|
12030 |
|
12031 // The condition can be loop invariant but still defined inside the |
|
12032 // loop. This means that we can't just use theinal 'cond' value. |
|
12033 @@ -3315,7 +3329,7 @@ |
|
12034 Op1[Part]); |
|
12035 } |
|
12036 |
|
12037 - propagateMetadata(Entry, it); |
|
12038 + propagateMetadata(Entry, &*it); |
|
12039 break; |
|
12040 } |
|
12041 |
|
12042 @@ -3324,7 +3338,7 @@ |
|
12043 // Widen compares. Generate vector compares. |
|
12044 bool FCmp = (it->getOpcode() == Instruction::FCmp); |
|
12045 CmpInst *Cmp = dyn_cast<CmpInst>(it); |
|
12046 - setDebugLocFromInst(Builder, it); |
|
12047 + setDebugLocFromInst(Builder, &*it); |
|
12048 VectorParts &A = getVectorValue(it->getOperand(0)); |
|
12049 VectorParts &B = getVectorValue(it->getOperand(1)); |
|
12050 for (unsigned Part = 0; Part < UF; ++Part) { |
|
12051 @@ -3336,13 +3350,13 @@ |
|
12052 Entry[Part] = C; |
|
12053 } |
|
12054 |
|
12055 - propagateMetadata(Entry, it); |
|
12056 + propagateMetadata(Entry, &*it); |
|
12057 break; |
|
12058 } |
|
12059 |
|
12060 case Instruction::Store: |
|
12061 case Instruction::Load: |
|
12062 - vectorizeMemoryInstruction(it); |
|
12063 + vectorizeMemoryInstruction(&*it); |
|
12064 break; |
|
12065 case Instruction::ZExt: |
|
12066 case Instruction::SExt: |
|
12067 @@ -3357,7 +3371,7 @@ |
|
12068 case Instruction::FPTrunc: |
|
12069 case Instruction::BitCast: { |
|
12070 CastInst *CI = dyn_cast<CastInst>(it); |
|
12071 - setDebugLocFromInst(Builder, it); |
|
12072 + setDebugLocFromInst(Builder, &*it); |
|
12073 /// Optimize the special case where the source is the induction |
|
12074 /// variable. Notice that we can only optimize the 'trunc' case |
|
12075 /// because: a. FP conversions lose precision, b. sext/zext may wrap, |
|
12076 @@ -3369,7 +3383,7 @@ |
|
12077 Value *Broadcasted = getBroadcastInstrs(ScalarCast); |
|
12078 for (unsigned Part = 0; Part < UF; ++Part) |
|
12079 Entry[Part] = getConsecutiveVector(Broadcasted, VF * Part, false); |
|
12080 - propagateMetadata(Entry, it); |
|
12081 + propagateMetadata(Entry, &*it); |
|
12082 break; |
|
12083 } |
|
12084 /// Vectorize casts. |
|
12085 @@ -3379,7 +3393,7 @@ |
|
12086 VectorParts &A = getVectorValue(it->getOperand(0)); |
|
12087 for (unsigned Part = 0; Part < UF; ++Part) |
|
12088 Entry[Part] = Builder.CreateCast(CI->getOpcode(), A[Part], DestTy); |
|
12089 - propagateMetadata(Entry, it); |
|
12090 + propagateMetadata(Entry, &*it); |
|
12091 break; |
|
12092 } |
|
12093 |
|
12094 @@ -3387,7 +3401,7 @@ |
|
12095 // Ignore dbg intrinsics. |
|
12096 if (isa<DbgInfoIntrinsic>(it)) |
|
12097 break; |
|
12098 - setDebugLocFromInst(Builder, it); |
|
12099 + setDebugLocFromInst(Builder, &*it); |
|
12100 |
|
12101 Module *M = BB->getParent()->getParent(); |
|
12102 CallInst *CI = cast<CallInst>(it); |
|
12103 @@ -3397,7 +3411,7 @@ |
|
12104 case Intrinsic::assume: |
|
12105 case Intrinsic::lifetime_end: |
|
12106 case Intrinsic::lifetime_start: |
|
12107 - scalarizeInstruction(it); |
|
12108 + scalarizeInstruction(&*it); |
|
12109 break; |
|
12110 default: |
|
12111 bool HasScalarOpd = hasVectorInstrinsicScalarOpd(ID, 1); |
|
12112 @@ -3419,7 +3433,7 @@ |
|
12113 Entry[Part] = Builder.CreateCall(F, Args); |
|
12114 } |
|
12115 |
|
12116 - propagateMetadata(Entry, it); |
|
12117 + propagateMetadata(Entry, &*it); |
|
12118 break; |
|
12119 } |
|
12120 break; |
|
12121 @@ -3427,7 +3441,7 @@ |
|
12122 |
|
12123 default: |
|
12124 // All other instructions are unsupported. Scalarize them. |
|
12125 - scalarizeInstruction(it); |
|
12126 + scalarizeInstruction(&*it); |
|
12127 break; |
|
12128 }// end of switch. |
|
12129 }// end of for_each instr. |
|
12130 @@ -3686,7 +3700,7 @@ |
|
12131 if (!PhiTy->isIntegerTy() && |
|
12132 !PhiTy->isFloatingPointTy() && |
|
12133 !PhiTy->isPointerTy()) { |
|
12134 - emitAnalysis(Report(it) |
|
12135 + emitAnalysis(Report(&*it) |
|
12136 << "loop control flow is not understood by vectorizer"); |
|
12137 DEBUG(dbgs() << "LV: Found an non-int non-pointer PHI.\n"); |
|
12138 return false; |
|
12139 @@ -3698,16 +3712,17 @@ |
|
12140 if (*bb != Header) { |
|
12141 // Check that this instruction has no outside users or is an |
|
12142 // identified reduction value with an outside user. |
|
12143 - if (!hasOutsideLoopUser(TheLoop, it, AllowedExit)) |
|
12144 + if (!hasOutsideLoopUser(TheLoop, &*it, AllowedExit)) |
|
12145 continue; |
|
12146 - emitAnalysis(Report(it) << "value could not be identified as " |
|
12147 - "an induction or reduction variable"); |
|
12148 + emitAnalysis(Report(&*it) |
|
12149 + << "value could not be identified as " |
|
12150 + "an induction or reduction variable"); |
|
12151 return false; |
|
12152 } |
|
12153 |
|
12154 // We only allow if-converted PHIs with exactly two incoming values. |
|
12155 if (Phi->getNumIncomingValues() != 2) { |
|
12156 - emitAnalysis(Report(it) |
|
12157 + emitAnalysis(Report(&*it) |
|
12158 << "control flow not understood by vectorizer"); |
|
12159 DEBUG(dbgs() << "LV: Found an invalid PHI.\n"); |
|
12160 return false; |
|
12161 @@ -3739,9 +3754,10 @@ |
|
12162 |
|
12163 // Until we explicitly handle the case of an induction variable with |
|
12164 // an outside loop user we have to give up vectorizing this loop. |
|
12165 - if (hasOutsideLoopUser(TheLoop, it, AllowedExit)) { |
|
12166 - emitAnalysis(Report(it) << "use of induction value outside of the " |
|
12167 - "loop is not handled by vectorizer"); |
|
12168 + if (hasOutsideLoopUser(TheLoop, &*it, AllowedExit)) { |
|
12169 + emitAnalysis(Report(&*it) << |
|
12170 + "use of induction value outside of the " |
|
12171 + "loop is not handled by vectorizer"); |
|
12172 return false; |
|
12173 } |
|
12174 |
|
12175 @@ -3786,8 +3802,8 @@ |
|
12176 continue; |
|
12177 } |
|
12178 |
|
12179 - emitAnalysis(Report(it) << "value that could not be identified as " |
|
12180 - "reduction is used outside the loop"); |
|
12181 + emitAnalysis(Report(&*it) << "value that could not be identified as " |
|
12182 + "reduction is used outside the loop"); |
|
12183 DEBUG(dbgs() << "LV: Found an unidentified PHI."<< *Phi <<"\n"); |
|
12184 return false; |
|
12185 }// end of PHI handling |
|
12186 @@ -3796,7 +3812,7 @@ |
|
12187 // calls and we do handle certain intrinsic and libm functions. |
|
12188 CallInst *CI = dyn_cast<CallInst>(it); |
|
12189 if (CI && !getIntrinsicIDForCall(CI, TLI) && !isa<DbgInfoIntrinsic>(CI)) { |
|
12190 - emitAnalysis(Report(it) << "call instruction cannot be vectorized"); |
|
12191 + emitAnalysis(Report(&*it) << "call instruction cannot be vectorized"); |
|
12192 DEBUG(dbgs() << "LV: Found a call site.\n"); |
|
12193 return false; |
|
12194 } |
|
12195 @@ -3806,7 +3822,7 @@ |
|
12196 if (CI && |
|
12197 hasVectorInstrinsicScalarOpd(getIntrinsicIDForCall(CI, TLI), 1)) { |
|
12198 if (!SE->isLoopInvariant(SE->getSCEV(CI->getOperand(1)), TheLoop)) { |
|
12199 - emitAnalysis(Report(it) |
|
12200 + emitAnalysis(Report(&*it) |
|
12201 << "intrinsic instruction cannot be vectorized"); |
|
12202 DEBUG(dbgs() << "LV: Found unvectorizable intrinsic " << *CI << "\n"); |
|
12203 return false; |
|
12204 @@ -3817,7 +3833,7 @@ |
|
12205 // Also, we can't vectorize extractelement instructions. |
|
12206 if ((!VectorType::isValidElementType(it->getType()) && |
|
12207 !it->getType()->isVoidTy()) || isa<ExtractElementInst>(it)) { |
|
12208 - emitAnalysis(Report(it) |
|
12209 + emitAnalysis(Report(&*it) |
|
12210 << "instruction return type cannot be vectorized"); |
|
12211 DEBUG(dbgs() << "LV: Found unvectorizable type.\n"); |
|
12212 return false; |
|
12213 @@ -3840,8 +3856,8 @@ |
|
12214 |
|
12215 // Reduction instructions are allowed to have exit users. |
|
12216 // All other instructions must not have external users. |
|
12217 - if (hasOutsideLoopUser(TheLoop, it, AllowedExit)) { |
|
12218 - emitAnalysis(Report(it) << "value cannot be used outside the loop"); |
|
12219 + if (hasOutsideLoopUser(TheLoop, &*it, AllowedExit)) { |
|
12220 + emitAnalysis(Report(&*it) << "value cannot be used outside the loop"); |
|
12221 return false; |
|
12222 } |
|
12223 |
|
12224 @@ -4009,7 +4025,7 @@ |
|
12225 BE = TheLoop->block_end(); B != BE; ++B) |
|
12226 for (BasicBlock::iterator I = (*B)->begin(), IE = (*B)->end(); |
|
12227 I != IE; ++I) |
|
12228 - if (I->getType()->isPointerTy() && isConsecutivePtr(I)) |
|
12229 + if (I->getType()->isPointerTy() && isConsecutivePtr(&*I)) |
|
12230 Worklist.insert(Worklist.end(), I->op_begin(), I->op_end()); |
|
12231 |
|
12232 while (Worklist.size()) { |
|
12233 @@ -4800,7 +4816,7 @@ |
|
12234 if (it->mayWriteToMemory()) { |
|
12235 StoreInst *St = dyn_cast<StoreInst>(it); |
|
12236 if (!St) { |
|
12237 - emitAnalysis(Report(it) << "instruction cannot be vectorized"); |
|
12238 + emitAnalysis(Report(&*it) << "instruction cannot be vectorized"); |
|
12239 return false; |
|
12240 } |
|
12241 if (!St->isSimple() && !IsAnnotatedParallel) { |
|
12242 @@ -5543,7 +5559,7 @@ |
|
12243 Type *T = it->getType(); |
|
12244 |
|
12245 // Ignore ephemeral values. |
|
12246 - if (EphValues.count(it)) |
|
12247 + if (EphValues.count(&*it)) |
|
12248 continue; |
|
12249 |
|
12250 // Only examine Loads, Stores and PHINodes. |
|
12251 @@ -5562,7 +5578,7 @@ |
|
12252 // Ignore loaded pointer types and stored pointer types that are not |
|
12253 // consecutive. However, we do want to take consecutive stores/loads of |
|
12254 // pointer vectors into account. |
|
12255 - if (T->isPointerTy() && !isConsecutiveLoadOrStore(it)) |
|
12256 + if (T->isPointerTy() && !isConsecutiveLoadOrStore(&*it)) |
|
12257 continue; |
|
12258 |
|
12259 MaxWidth = std::max(MaxWidth, |
|
12260 @@ -5765,7 +5781,7 @@ |
|
12261 R.NumInstructions += (*bb)->size(); |
|
12262 for (BasicBlock::iterator it = (*bb)->begin(), e = (*bb)->end(); it != e; |
|
12263 ++it) { |
|
12264 - Instruction *I = it; |
|
12265 + Instruction *I = &*it; |
|
12266 IdxToInstr[Index++] = I; |
|
12267 |
|
12268 // Save the end location of each USE. |
|
12269 @@ -5853,10 +5869,10 @@ |
|
12270 continue; |
|
12271 |
|
12272 // Ignore ephemeral values. |
|
12273 - if (EphValues.count(it)) |
|
12274 + if (EphValues.count(&*it)) |
|
12275 continue; |
|
12276 |
|
12277 - unsigned C = getInstructionCost(it, VF); |
|
12278 + unsigned C = getInstructionCost(&*it, VF); |
|
12279 |
|
12280 // Check if we should override the cost. |
|
12281 if (ForceTargetInstructionCost.getNumOccurrences() > 0) |
|
12282 @@ -6230,19 +6246,12 @@ |
|
12283 // Create a new entry in the WidenMap and initialize it to Undef or Null. |
|
12284 VectorParts &VecResults = WidenMap.splat(Instr, UndefVec); |
|
12285 |
|
12286 - Instruction *InsertPt = Builder.GetInsertPoint(); |
|
12287 - BasicBlock *IfBlock = Builder.GetInsertBlock(); |
|
12288 - BasicBlock *CondBlock = nullptr; |
|
12289 - |
|
12290 VectorParts Cond; |
|
12291 - Loop *VectorLp = nullptr; |
|
12292 if (IfPredicateStore) { |
|
12293 assert(Instr->getParent()->getSinglePredecessor() && |
|
12294 "Only support single predecessor blocks"); |
|
12295 Cond = createEdgeMask(Instr->getParent()->getSinglePredecessor(), |
|
12296 Instr->getParent()); |
|
12297 - VectorLp = LI->getLoopFor(IfBlock); |
|
12298 - assert(VectorLp && "Must have a loop for this block"); |
|
12299 } |
|
12300 |
|
12301 // For each vector unroll 'part': |
|
12302 @@ -6257,11 +6266,6 @@ |
|
12303 Builder.CreateExtractElement(Cond[Part], Builder.getInt32(0)); |
|
12304 Cmp = Builder.CreateICmp(ICmpInst::ICMP_EQ, Cond[Part], |
|
12305 ConstantInt::get(Cond[Part]->getType(), 1)); |
|
12306 - CondBlock = IfBlock->splitBasicBlock(InsertPt, "cond.store"); |
|
12307 - LoopVectorBody.push_back(CondBlock); |
|
12308 - VectorLp->addBasicBlockToLoop(CondBlock, LI->getBase()); |
|
12309 - // Update Builder with newly created basic block. |
|
12310 - Builder.SetInsertPoint(InsertPt); |
|
12311 } |
|
12312 |
|
12313 Instruction *Cloned = Instr->clone(); |
|
12314 @@ -6282,16 +6286,9 @@ |
|
12315 VecResults[Part] = Cloned; |
|
12316 |
|
12317 // End if-block. |
|
12318 - if (IfPredicateStore) { |
|
12319 - BasicBlock *NewIfBlock = CondBlock->splitBasicBlock(InsertPt, "else"); |
|
12320 - LoopVectorBody.push_back(NewIfBlock); |
|
12321 - VectorLp->addBasicBlockToLoop(NewIfBlock, LI->getBase()); |
|
12322 - Builder.SetInsertPoint(InsertPt); |
|
12323 - Instruction *OldBr = IfBlock->getTerminator(); |
|
12324 - BranchInst::Create(CondBlock, NewIfBlock, Cmp, OldBr); |
|
12325 - OldBr->eraseFromParent(); |
|
12326 - IfBlock = NewIfBlock; |
|
12327 - } |
|
12328 + if (IfPredicateStore) |
|
12329 + PredicatedStores.push_back(std::make_pair(cast<StoreInst>(Cloned), |
|
12330 + Cmp)); |
|
12331 } |
|
12332 } |
|
12333 |
|
12334 --- lib/Transforms/Vectorize/SLPVectorizer.cpp 2015-02-12 09:51:17.000000000 -0800 |
|
12335 +++ lib/Transforms/Vectorize/SLPVectorizer.cpp 2015-12-06 11:52:23.656576722 -0800 |
|
12336 @@ -1742,7 +1742,8 @@ |
|
12337 } |
|
12338 |
|
12339 // Now find the sequence of instructions between PrevInst and Inst. |
|
12340 - BasicBlock::reverse_iterator InstIt(Inst), PrevInstIt(PrevInst); |
|
12341 + BasicBlock::reverse_iterator InstIt(Inst->getIterator()), |
|
12342 + PrevInstIt(PrevInst->getIterator()); |
|
12343 --PrevInstIt; |
|
12344 while (InstIt != PrevInstIt) { |
|
12345 if (PrevInstIt == PrevInst->getParent()->rend()) { |
|
12346 @@ -1890,7 +1891,7 @@ |
|
12347 |
|
12348 void BoUpSLP::setInsertPointAfterBundle(ArrayRef<Value *> VL) { |
|
12349 Instruction *VL0 = cast<Instruction>(VL[0]); |
|
12350 - BasicBlock::iterator NextInst = VL0; |
|
12351 + BasicBlock::iterator NextInst(VL0); |
|
12352 ++NextInst; |
|
12353 Builder.SetInsertPoint(VL0->getParent(), NextInst); |
|
12354 Builder.SetCurrentDebugLocation(VL0->getDebugLoc()); |
|
12355 @@ -2346,7 +2347,7 @@ |
|
12356 scheduleBlock(BSIter.second.get()); |
|
12357 } |
|
12358 |
|
12359 - Builder.SetInsertPoint(F->getEntryBlock().begin()); |
|
12360 + Builder.SetInsertPoint(&F->getEntryBlock().front()); |
|
12361 vectorizeTree(&VectorizableTree[0]); |
|
12362 |
|
12363 DEBUG(dbgs() << "SLP: Extracting " << ExternalUses.size() << " values .\n"); |
|
12364 @@ -2391,7 +2392,7 @@ |
|
12365 User->replaceUsesOfWith(Scalar, Ex); |
|
12366 } |
|
12367 } else { |
|
12368 - Builder.SetInsertPoint(F->getEntryBlock().begin()); |
|
12369 + Builder.SetInsertPoint(&F->getEntryBlock().front()); |
|
12370 Value *Ex = Builder.CreateExtractElement(Vec, Lane); |
|
12371 CSEBlocks.insert(&F->getEntryBlock()); |
|
12372 User->replaceUsesOfWith(Scalar, Ex); |
|
12373 @@ -2500,7 +2501,9 @@ |
|
12374 BasicBlock *BB = (*I)->getBlock(); |
|
12375 // For all instructions in blocks containing gather sequences: |
|
12376 for (BasicBlock::iterator it = BB->begin(), e = BB->end(); it != e;) { |
|
12377 - Instruction *In = it++; |
|
12378 + Instruction *In = &*it; |
|
12379 + ++it; |
|
12380 + |
|
12381 if (!isa<InsertElementInst>(In) && !isa<ExtractElementInst>(In)) |
|
12382 continue; |
|
12383 |
|
12384 @@ -2648,7 +2651,7 @@ |
|
12385 } |
|
12386 // Search up and down at the same time, because we don't know if the new |
|
12387 // instruction is above or below the existing scheduling region. |
|
12388 - BasicBlock::reverse_iterator UpIter(ScheduleStart); |
|
12389 + BasicBlock::reverse_iterator UpIter(ScheduleStart->getIterator()); |
|
12390 BasicBlock::reverse_iterator UpperEnd = BB->rend(); |
|
12391 BasicBlock::iterator DownIter(ScheduleEnd); |
|
12392 BasicBlock::iterator LowerEnd = BB->end(); |
|
12393 @@ -2860,7 +2863,8 @@ |
|
12394 Instruction *pickedInst = BundleMember->Inst; |
|
12395 if (LastScheduledInst->getNextNode() != pickedInst) { |
|
12396 BS->BB->getInstList().remove(pickedInst); |
|
12397 - BS->BB->getInstList().insert(LastScheduledInst, pickedInst); |
|
12398 + BS->BB->getInstList().insert(LastScheduledInst->getIterator(), |
|
12399 + pickedInst); |
|
12400 } |
|
12401 LastScheduledInst = pickedInst; |
|
12402 BundleMember = BundleMember->NextInBundle; |
|
12403 @@ -3243,8 +3247,8 @@ |
|
12404 Instruction *InsertAfter = cast<Instruction>(BuildVectorSlice.back()); |
|
12405 unsigned VecIdx = 0; |
|
12406 for (auto &V : BuildVectorSlice) { |
|
12407 - IRBuilder<true, NoFolder> Builder( |
|
12408 - ++BasicBlock::iterator(InsertAfter)); |
|
12409 + IRBuilder<true, NoFolder> Builder(InsertAfter->getParent(), |
|
12410 + ++BasicBlock::iterator(InsertAfter)); |
|
12411 InsertElementInst *IE = cast<InsertElementInst>(V); |
|
12412 Instruction *Extract = cast<Instruction>(Builder.CreateExtractElement( |
|
12413 VectorizedRoot, Builder.getInt32(VecIdx++))); |
|
12414 @@ -3695,10 +3699,10 @@ |
|
12415 |
|
12416 for (BasicBlock::iterator it = BB->begin(), e = BB->end(); it != e; it++) { |
|
12417 // We may go through BB multiple times so skip the one we have checked. |
|
12418 - if (!VisitedInstrs.insert(it).second) |
|
12419 + if (!VisitedInstrs.insert(&*it).second) |
|
12420 continue; |
|
12421 |
|
12422 - if (isa<DbgInfoIntrinsic>(it)) |
|
12423 + if (isa<DbgInfoIntrinsic>(&*it)) |
|
12424 continue; |
|
12425 |
|
12426 // Try to vectorize reductions that use PHINodes. |
|
12427 --- tools/bugpoint/CrashDebugger.cpp 2014-08-26 10:19:03.000000000 -0700 |
|
12428 +++ tools/bugpoint/CrashDebugger.cpp 2015-12-08 17:47:24.061167860 -0800 |
|
12429 @@ -148,7 +148,7 @@ |
|
12430 // playing with... |
|
12431 for (Module::global_iterator I = M->global_begin(), E = M->global_end(); |
|
12432 I != E; ++I) |
|
12433 - if (I->hasInitializer() && !GVSet.count(I)) { |
|
12434 + if (I->hasInitializer() && !GVSet.count(&*I)) { |
|
12435 I->setInitializer(nullptr); |
|
12436 I->setLinkage(GlobalValue::ExternalLinkage); |
|
12437 } |
|
12438 @@ -222,8 +222,8 @@ |
|
12439 // Loop over and delete any functions which we aren't supposed to be playing |
|
12440 // with... |
|
12441 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) |
|
12442 - if (!I->isDeclaration() && !Functions.count(I)) |
|
12443 - DeleteFunctionBody(I); |
|
12444 + if (!I->isDeclaration() && !Functions.count(&*I)) |
|
12445 + DeleteFunctionBody(&*I); |
|
12446 |
|
12447 // Try running the hacked up program... |
|
12448 if (TestFn(BD, M)) { |
|
12449 @@ -289,11 +289,12 @@ |
|
12450 // Loop over and delete any hack up any blocks that are not listed... |
|
12451 for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) |
|
12452 for (Function::iterator BB = I->begin(), E = I->end(); BB != E; ++BB) |
|
12453 - if (!Blocks.count(BB) && BB->getTerminator()->getNumSuccessors()) { |
|
12454 + if (!Blocks.count(&*BB) && BB->getTerminator()->getNumSuccessors()) { |
|
12455 // Loop over all of the successors of this block, deleting any PHI nodes |
|
12456 // that might include it. |
|
12457 - for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) |
|
12458 - (*SI)->removePredecessor(BB); |
|
12459 + for (succ_iterator SI = succ_begin(&*BB), E = succ_end(&*BB); |
|
12460 + SI != E; ++SI) |
|
12461 + (*SI)->removePredecessor(&*BB); |
|
12462 |
|
12463 TerminatorInst *BBTerm = BB->getTerminator(); |
|
12464 |
|
12465 @@ -302,7 +303,7 @@ |
|
12466 |
|
12467 // Replace the old terminator instruction. |
|
12468 BB->getInstList().pop_back(); |
|
12469 - new UnreachableInst(BB->getContext(), BB); |
|
12470 + new UnreachableInst(BB->getContext(), &*BB); |
|
12471 } |
|
12472 |
|
12473 // The CFG Simplifier pass may delete one of the basic blocks we are |
|
12474 @@ -397,7 +398,8 @@ |
|
12475 for (Module::iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) |
|
12476 for (Function::iterator FI = MI->begin(), FE = MI->end(); FI != FE; ++FI) |
|
12477 for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E;) { |
|
12478 - Instruction *Inst = I++; |
|
12479 + Instruction *Inst = &*I; |
|
12480 + ++I; |
|
12481 if (!Instructions.count(Inst) && !isa<TerminatorInst>(Inst) && |
|
12482 !isa<LandingPadInst>(Inst)) { |
|
12483 if (!Inst->getType()->isVoidTy()) |
|
12484 @@ -468,7 +470,7 @@ |
|
12485 for (Module::global_iterator I = BD.getProgram()->global_begin(), |
|
12486 E = BD.getProgram()->global_end(); I != E; ++I) |
|
12487 if (I->hasInitializer()) |
|
12488 - GVs.push_back(I); |
|
12489 + GVs.push_back(&*I); |
|
12490 |
|
12491 if (GVs.size() > 1 && !BugpointIsInterrupted) { |
|
12492 outs() << "\n*** Attempting to reduce the number of global " |
|
12493 @@ -491,7 +493,7 @@ |
|
12494 for (Module::iterator I = BD.getProgram()->begin(), |
|
12495 E = BD.getProgram()->end(); I != E; ++I) |
|
12496 if (!I->isDeclaration()) |
|
12497 - Functions.push_back(I); |
|
12498 + Functions.push_back(&*I); |
|
12499 |
|
12500 if (Functions.size() > 1 && !BugpointIsInterrupted) { |
|
12501 outs() << "\n*** Attempting to reduce the number of functions " |
|
12502 @@ -511,10 +513,11 @@ |
|
12503 // |
|
12504 if (!DisableSimplifyCFG && !BugpointIsInterrupted) { |
|
12505 std::vector<const BasicBlock*> Blocks; |
|
12506 - for (Module::const_iterator I = BD.getProgram()->begin(), |
|
12507 - E = BD.getProgram()->end(); I != E; ++I) |
|
12508 - for (Function::const_iterator FI = I->begin(), E = I->end(); FI !=E; ++FI) |
|
12509 - Blocks.push_back(FI); |
|
12510 + for (Function &F : *BD.getProgram()) { |
|
12511 + for (BasicBlock &BB : F) |
|
12512 + Blocks.push_back(&BB); |
|
12513 + } |
|
12514 + |
|
12515 unsigned OldSize = Blocks.size(); |
|
12516 ReduceCrashingBlocks(BD, TestFn).reduceList(Blocks, Error); |
|
12517 if (Blocks.size() < OldSize) |
|
12518 @@ -525,14 +528,11 @@ |
|
12519 // cases with large basic blocks where the problem is at one end. |
|
12520 if (!BugpointIsInterrupted) { |
|
12521 std::vector<const Instruction*> Insts; |
|
12522 - for (Module::const_iterator MI = BD.getProgram()->begin(), |
|
12523 - ME = BD.getProgram()->end(); MI != ME; ++MI) |
|
12524 - for (Function::const_iterator FI = MI->begin(), FE = MI->end(); FI != FE; |
|
12525 - ++FI) |
|
12526 - for (BasicBlock::const_iterator I = FI->begin(), E = FI->end(); |
|
12527 - I != E; ++I) |
|
12528 - if (!isa<TerminatorInst>(I)) |
|
12529 - Insts.push_back(I); |
|
12530 + for (const Function &F : *BD.getProgram()) |
|
12531 + for (const BasicBlock &BB : F) |
|
12532 + for (const Instruction &I : BB) |
|
12533 + if (!isa<TerminatorInst>(&I)) |
|
12534 + Insts.push_back(&I); |
|
12535 |
|
12536 ReduceCrashingInstructions(BD, TestFn).reduceList(Insts, Error); |
|
12537 } |
|
12538 @@ -577,7 +577,7 @@ |
|
12539 |
|
12540 outs() << "Checking instruction: " << *I; |
|
12541 std::unique_ptr<Module> M = |
|
12542 - BD.deleteInstructionFromProgram(I, Simplification); |
|
12543 + BD.deleteInstructionFromProgram(&*I, Simplification); |
|
12544 |
|
12545 // Find out if the pass still crashes on this pass... |
|
12546 if (TestFn(BD, M.get())) { |
|
12547 --- tools/bugpoint/ExtractFunction.cpp 2014-08-26 10:19:03.000000000 -0700 |
|
12548 +++ tools/bugpoint/ExtractFunction.cpp 2015-12-08 17:53:34.720329668 -0800 |
|
12549 @@ -100,7 +100,7 @@ |
|
12550 |
|
12551 BasicBlock::iterator RI = RBI->begin(); // Get iterator to corresponding inst |
|
12552 std::advance(RI, std::distance(PBB->begin(), BasicBlock::const_iterator(I))); |
|
12553 - Instruction *TheInst = RI; // Got the corresponding instruction! |
|
12554 + Instruction *TheInst = &*RI; // Got the corresponding instruction! |
|
12555 |
|
12556 // If this instruction produces a value, replace any users with null values |
|
12557 if (!TheInst->getType()->isVoidTy()) |
|
12558 @@ -307,15 +307,15 @@ |
|
12559 |
|
12560 // Remove the Safe functions from the Test module |
|
12561 for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I) |
|
12562 - if (!TestFunctions.count(I)) |
|
12563 - DeleteFunctionBody(I); |
|
12564 + if (!TestFunctions.count(&*I)) |
|
12565 + DeleteFunctionBody(&*I); |
|
12566 |
|
12567 |
|
12568 // Try to split the global initializers evenly |
|
12569 for (Module::global_iterator I = M->global_begin(), E = M->global_end(); |
|
12570 I != E; ++I) { |
|
12571 - GlobalVariable *GV = cast<GlobalVariable>(NewVMap[I]); |
|
12572 - if (Function *TestFn = globalInitUsesExternalBA(I)) { |
|
12573 + GlobalVariable *GV = cast<GlobalVariable>(NewVMap[&*I]); |
|
12574 + if (Function *TestFn = globalInitUsesExternalBA(&*I)) { |
|
12575 if (Function *SafeFn = globalInitUsesExternalBA(GV)) { |
|
12576 errs() << "*** Error: when reducing functions, encountered " |
|
12577 "the global '"; |
|
12578 --- tools/bugpoint/Miscompilation.cpp 2014-10-27 17:24:16.000000000 -0700 |
|
12579 +++ tools/bugpoint/Miscompilation.cpp 2015-12-08 17:55:31.425007898 -0800 |
|
12580 @@ -550,7 +550,7 @@ |
|
12581 for (unsigned i = 0, e = MiscompiledFunctions.size(); i != e; ++i) |
|
12582 for (Function::iterator I = MiscompiledFunctions[i]->begin(), |
|
12583 E = MiscompiledFunctions[i]->end(); I != E; ++I) |
|
12584 - Blocks.push_back(I); |
|
12585 + Blocks.push_back(&*I); |
|
12586 |
|
12587 // Use the list reducer to identify blocks that can be extracted without |
|
12588 // obscuring the bug. The Blocks list will end up containing blocks that must |
|
12589 @@ -634,7 +634,7 @@ |
|
12590 Module *Prog = BD.getProgram(); |
|
12591 for (Module::iterator I = Prog->begin(), E = Prog->end(); I != E; ++I) |
|
12592 if (!I->isDeclaration()) |
|
12593 - MiscompiledFunctions.push_back(I); |
|
12594 + MiscompiledFunctions.push_back(&*I); |
|
12595 |
|
12596 // Do the reduction... |
|
12597 if (!BugpointIsInterrupted) |
|
12598 @@ -806,7 +806,7 @@ |
|
12599 I = newMain->arg_begin(), E = newMain->arg_end(), |
|
12600 OI = oldMain->arg_begin(); I != E; ++I, ++OI) { |
|
12601 I->setName(OI->getName()); // Copy argument names from oldMain |
|
12602 - args.push_back(I); |
|
12603 + args.push_back(&*I); |
|
12604 } |
|
12605 |
|
12606 // Call the old main function and return its result |
|
12607 @@ -910,7 +910,7 @@ |
|
12608 std::vector<Value*> Args; |
|
12609 for (Function::arg_iterator i = FuncWrapper->arg_begin(), |
|
12610 e = FuncWrapper->arg_end(); i != e; ++i) |
|
12611 - Args.push_back(i); |
|
12612 + Args.push_back(&*i); |
|
12613 |
|
12614 // Pass on the arguments to the real function, return its result |
|
12615 if (F->getReturnType()->isVoidTy()) { |
|
12616 --- tools/clang/include/clang/Analysis/CFG.h 2015-10-05 11:01:32.409005315 -0700 |
|
12617 +++ tools/clang/include/clang/Analysis/CFG.h 2015-12-08 08:12:46.482439723 -0800 |
|
12618 @@ -322,7 +322,7 @@ |
|
12619 Stmt &operator*() { return *getStmt(); } |
|
12620 const Stmt &operator*() const { return *getStmt(); } |
|
12621 |
|
12622 - LLVM_EXPLICIT operator bool() const { return getStmt(); } |
|
12623 + explicit operator bool() const { return getStmt(); } |
|
12624 }; |
|
12625 |
|
12626 /// CFGBlock - Represents a single basic block in a source-level CFG. |
|
12627 @@ -432,7 +432,7 @@ |
|
12628 public: |
|
12629 /// Construct an AdjacentBlock with a possibly unreachable block. |
|
12630 AdjacentBlock(CFGBlock *B, bool IsReachable); |
|
12631 - |
|
12632 + |
|
12633 /// Construct an AdjacentBlock with a reachable block and an alternate |
|
12634 /// unreachable block. |
|
12635 AdjacentBlock(CFGBlock *B, CFGBlock *AlternateBlock); |
|
12636 @@ -694,7 +694,7 @@ |
|
12637 iterator beginAutomaticObjDtorsInsert(iterator I, size_t Cnt, |
|
12638 BumpVectorContext &C) { |
|
12639 return iterator(Elements.insert(I.base(), Cnt, |
|
12640 - CFGAutomaticObjDtor(nullptr, 0), C)); |
|
12641 + CFGAutomaticObjDtor(nullptr, nullptr), C)); |
|
12642 } |
|
12643 iterator insertAutomaticObjDtor(iterator I, VarDecl *VD, Stmt *S) { |
|
12644 *I = CFGAutomaticObjDtor(VD, S); |
|
12645 @@ -767,7 +767,7 @@ |
|
12646 /// (not a pointer to CFGBlock). |
|
12647 class graph_iterator { |
|
12648 public: |
|
12649 - typedef const CFGBlock value_type; |
|
12650 + typedef CFGBlock value_type; |
|
12651 typedef value_type& reference; |
|
12652 typedef value_type* pointer; |
|
12653 typedef BumpVector<CFGBlock*>::iterator ImplTy; |
|
12654 --- tools/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp 2015-10-05 11:01:32.364932580 -0700 |
|
12655 +++ tools/clang/lib/Frontend/Rewrite/InclusionRewriter.cpp 2015-10-12 22:15:59.378584335 -0700 |
|
12656 @@ -285,16 +285,11 @@ |
|
12657 do { |
|
12658 DirectiveLex.LexFromRawLexer(DirectiveToken); |
|
12659 } while (!DirectiveToken.is(tok::eod) && DirectiveToken.isNot(tok::eof)); |
|
12660 + |
|
12661 if (&FromFile == PredefinesBuffer) { |
|
12662 // OutputContentUpTo() would not output anything anyway. |
|
12663 return; |
|
12664 } |
|
12665 - OS << "#if 0 /* expanded by -frewrite-includes */" << MainEOL; |
|
12666 - OutputContentUpTo(FromFile, NextToWrite, |
|
12667 - SM.getFileOffset(DirectiveToken.getLocation()) + |
|
12668 - DirectiveToken.getLength(), |
|
12669 - LocalEOL, Line, true); |
|
12670 - OS << "#endif /* expanded by -frewrite-includes */" << MainEOL; |
|
12671 } |
|
12672 |
|
12673 /// Find the next identifier in the pragma directive specified by \p RawToken. |
|
12674 --- tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp 2015-10-05 11:01:32.334095518 -0700 |
|
12675 +++ tools/clang/lib/StaticAnalyzer/Core/BugReporter.cpp 2015-12-08 09:02:55.503942822 -0800 |
|
12676 @@ -3295,11 +3295,11 @@ |
|
12677 // post-dominated by a sink, simply add all the nodes in the equivalence class |
|
12678 // to 'Nodes'. Any of the reports will serve as a "representative" report. |
|
12679 if (!BT.isSuppressOnSink()) { |
|
12680 - BugReport *R = I; |
|
12681 + BugReport *R = &*I; |
|
12682 for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I) { |
|
12683 const ExplodedNode *N = I->getErrorNode(); |
|
12684 if (N) { |
|
12685 - R = I; |
|
12686 + R = &*I; |
|
12687 bugReports.push_back(R); |
|
12688 } |
|
12689 } |
|
12690 @@ -3325,35 +3325,35 @@ |
|
12691 } |
|
12692 // No successors? By definition this nodes isn't post-dominated by a sink. |
|
12693 if (errorNode->succ_empty()) { |
|
12694 - bugReports.push_back(I); |
|
12695 + bugReports.push_back(&*I); |
|
12696 if (!exampleReport) |
|
12697 - exampleReport = I; |
|
12698 + exampleReport = &*I; |
|
12699 continue; |
|
12700 } |
|
12701 |
|
12702 // At this point we know that 'N' is not a sink and it has at least one |
|
12703 - // successor. Use a DFS worklist to find a non-sink end-of-path node. |
|
12704 + // successor. Use a DFS worklist to find a non-sink end-of-path node. |
|
12705 typedef FRIEC_WLItem WLItem; |
|
12706 typedef SmallVector<WLItem, 10> DFSWorkList; |
|
12707 llvm::DenseMap<const ExplodedNode *, unsigned> Visited; |
|
12708 - |
|
12709 + |
|
12710 DFSWorkList WL; |
|
12711 WL.push_back(errorNode); |
|
12712 Visited[errorNode] = 1; |
|
12713 - |
|
12714 + |
|
12715 while (!WL.empty()) { |
|
12716 WLItem &WI = WL.back(); |
|
12717 assert(!WI.N->succ_empty()); |
|
12718 - |
|
12719 + |
|
12720 for (; WI.I != WI.E; ++WI.I) { |
|
12721 - const ExplodedNode *Succ = *WI.I; |
|
12722 + const ExplodedNode *Succ = *WI.I; |
|
12723 // End-of-path node? |
|
12724 if (Succ->succ_empty()) { |
|
12725 // If we found an end-of-path node that is not a sink. |
|
12726 if (!Succ->isSink()) { |
|
12727 - bugReports.push_back(I); |
|
12728 + bugReports.push_back(&*I); |
|
12729 if (!exampleReport) |
|
12730 - exampleReport = I; |
|
12731 + exampleReport = &*I; |
|
12732 WL.clear(); |
|
12733 break; |
|
12734 } |
|
12735 --- tools/llvm-diff/DifferenceEngine.cpp 2014-07-21 10:06:51.000000000 -0700 |
|
12736 +++ tools/llvm-diff/DifferenceEngine.cpp 2015-12-08 13:51:00.260552197 -0800 |
|
12737 @@ -599,7 +599,7 @@ |
|
12738 TerminatorInst *RTerm = RStart->getParent()->getTerminator(); |
|
12739 if (isa<BranchInst>(LTerm) && isa<InvokeInst>(RTerm)) { |
|
12740 if (cast<BranchInst>(LTerm)->isConditional()) return; |
|
12741 - BasicBlock::iterator I = LTerm; |
|
12742 + BasicBlock::iterator I = LTerm->getIterator(); |
|
12743 if (I == LStart->getParent()->begin()) return; |
|
12744 --I; |
|
12745 if (!isa<CallInst>(*I)) return; |
|
12746 @@ -612,7 +612,7 @@ |
|
12747 tryUnify(LTerm->getSuccessor(0), RInvoke->getNormalDest()); |
|
12748 } else if (isa<InvokeInst>(LTerm) && isa<BranchInst>(RTerm)) { |
|
12749 if (cast<BranchInst>(RTerm)->isConditional()) return; |
|
12750 - BasicBlock::iterator I = RTerm; |
|
12751 + BasicBlock::iterator I = RTerm->getIterator(); |
|
12752 if (I == RStart->getParent()->begin()) return; |
|
12753 --I; |
|
12754 if (!isa<CallInst>(*I)) return; |
|
12755 --- tools/llvm-stress/llvm-stress.cpp 2014-08-25 11:16:47.000000000 -0700 |
|
12756 +++ tools/llvm-stress/llvm-stress.cpp 2015-12-08 17:59:08.743284003 -0800 |
|
12757 @@ -622,7 +622,7 @@ |
|
12758 // Consider arguments as legal values. |
|
12759 for (Function::arg_iterator it = F->arg_begin(), e = F->arg_end(); |
|
12760 it != e; ++it) |
|
12761 - PT.push_back(it); |
|
12762 + PT.push_back(&*it); |
|
12763 |
|
12764 // List of modifiers which add new random instructions. |
|
12765 std::vector<Modifier*> Modifiers; |
|
12766 @@ -663,16 +663,15 @@ |
|
12767 for (BasicBlock::iterator it = F->begin()->begin(), |
|
12768 e = F->begin()->end(); it != e; ++it) { |
|
12769 if (it->getType() == IntegerType::getInt1Ty(F->getContext())) |
|
12770 - BoolInst.push_back(it); |
|
12771 + BoolInst.push_back(&*it); |
|
12772 } |
|
12773 |
|
12774 std::random_shuffle(BoolInst.begin(), BoolInst.end(), R); |
|
12775 |
|
12776 - for (std::vector<Instruction*>::iterator it = BoolInst.begin(), |
|
12777 - e = BoolInst.end(); it != e; ++it) { |
|
12778 - Instruction *Instr = *it; |
|
12779 + |
|
12780 + for (auto *Instr : BoolInst) { |
|
12781 BasicBlock *Curr = Instr->getParent(); |
|
12782 - BasicBlock::iterator Loc= Instr; |
|
12783 + BasicBlock::iterator Loc = Instr->getIterator(); |
|
12784 BasicBlock *Next = Curr->splitBasicBlock(Loc, "CF"); |
|
12785 Instr->moveBefore(Curr->getTerminator()); |
|
12786 if (Curr != &F->getEntryBlock()) { |
|
12787 --- unittests/ADT/ilistTest.cpp 2014-06-08 15:29:17.000000000 -0700 |
|
12788 +++ unittests/ADT/ilistTest.cpp 2016-01-23 11:05:55.000000000 -0800 |
|
12789 @@ -80,7 +80,7 @@ |
|
12790 // List with contents. |
|
12791 List.push_back(1); |
|
12792 ASSERT_EQ(1u, List.size()); |
|
12793 - Node *N = List.begin(); |
|
12794 + Node *N = &*List.begin(); |
|
12795 EXPECT_EQ(1, N->Value); |
|
12796 List.clearAndLeakNodesUnsafely(); |
|
12797 EXPECT_EQ(0u, List.size()); |
|
12798 --- unittests/Analysis/CFGTest.cpp 2014-08-19 09:58:54.000000000 -0700 |
|
12799 +++ unittests/Analysis/CFGTest.cpp 2016-01-23 11:08:10.000000000 -0800 |
|
12800 @@ -378,7 +378,7 @@ |
|
12801 TEST_F(IsPotentiallyReachableTest, ModifyTest) { |
|
12802 ParseAssembly(BranchInsideLoopIR); |
|
12803 |
|
12804 - succ_iterator S = succ_begin(++M->getFunction("test")->begin()); |
|
12805 + succ_iterator S = succ_begin(&*++M->getFunction("test")->begin()); |
|
12806 BasicBlock *OldBB = S[0]; |
|
12807 S[0] = S[1]; |
|
12808 ExpectPath(false); |
|
12809 --- unittests/ExecutionEngine/MCJIT/MCJITTestBase.h 2014-12-02 16:51:19.000000000 -0800 |
|
12810 +++ unittests/ExecutionEngine/MCJIT/MCJITTestBase.h 2016-01-23 11:13:10.000000000 -0800 |
|
12811 @@ -71,8 +71,8 @@ |
|
12812 SmallVector<Value*, 1> CallArgs; |
|
12813 |
|
12814 Function::arg_iterator arg_iter = Result->arg_begin(); |
|
12815 - for(;arg_iter != Result->arg_end(); ++arg_iter) |
|
12816 - CallArgs.push_back(arg_iter); |
|
12817 + for (Argument &A : Result->args()) |
|
12818 + CallArgs.push_back(&A); |
|
12819 |
|
12820 Value *ReturnCode = Builder.CreateCall(Callee, CallArgs); |
|
12821 Builder.CreateRet(ReturnCode); |
|
12822 @@ -98,8 +98,8 @@ |
|
12823 Function *Result = startFunction<int32_t(int32_t, int32_t)>(M, Name); |
|
12824 |
|
12825 Function::arg_iterator args = Result->arg_begin(); |
|
12826 - Value *Arg1 = args; |
|
12827 - Value *Arg2 = ++args; |
|
12828 + Value *Arg1 = &*args; |
|
12829 + Value *Arg2 = &*++args; |
|
12830 Value *AddResult = Builder.CreateAdd(Arg1, Arg2); |
|
12831 |
|
12832 endFunctionWithRet(Result, AddResult); |
|
12833 @@ -170,7 +170,7 @@ |
|
12834 BasicBlock *RecursiveCase = BasicBlock::Create(Context, "", Result); |
|
12835 |
|
12836 // if (num == 0) |
|
12837 - Value *Param = Result->arg_begin(); |
|
12838 + Value *Param = &*Result->arg_begin(); |
|
12839 Value *Zero = ConstantInt::get(Context, APInt(32, 0)); |
|
12840 Builder.CreateCondBr(Builder.CreateICmpEQ(Param, Zero), |
|
12841 BaseCase, RecursiveCase); |
|
12842 --- unittests/IR/DominatorTreeTest.cpp 2014-08-19 09:58:54.000000000 -0700 |
|
12843 +++ unittests/IR/DominatorTreeTest.cpp 2016-01-23 11:18:36.000000000 -0800 |
|
12844 @@ -31,29 +31,29 @@ |
|
12845 PostDominatorTree *PDT = &getAnalysis<PostDominatorTree>(); |
|
12846 Function::iterator FI = F.begin(); |
|
12847 |
|
12848 - BasicBlock *BB0 = FI++; |
|
12849 + BasicBlock *BB0 = &*FI++; |
|
12850 BasicBlock::iterator BBI = BB0->begin(); |
|
12851 - Instruction *Y1 = BBI++; |
|
12852 - Instruction *Y2 = BBI++; |
|
12853 - Instruction *Y3 = BBI++; |
|
12854 + Instruction *Y1 = &*BBI++; |
|
12855 + Instruction *Y2 = &*BBI++; |
|
12856 + Instruction *Y3 = &*BBI++; |
|
12857 |
|
12858 - BasicBlock *BB1 = FI++; |
|
12859 + BasicBlock *BB1 = &*FI++; |
|
12860 BBI = BB1->begin(); |
|
12861 - Instruction *Y4 = BBI++; |
|
12862 + Instruction *Y4 = &*BBI++; |
|
12863 |
|
12864 - BasicBlock *BB2 = FI++; |
|
12865 + BasicBlock *BB2 = &*FI++; |
|
12866 BBI = BB2->begin(); |
|
12867 - Instruction *Y5 = BBI++; |
|
12868 + Instruction *Y5 = &*BBI++; |
|
12869 |
|
12870 - BasicBlock *BB3 = FI++; |
|
12871 + BasicBlock *BB3 = &*FI++; |
|
12872 BBI = BB3->begin(); |
|
12873 - Instruction *Y6 = BBI++; |
|
12874 - Instruction *Y7 = BBI++; |
|
12875 + Instruction *Y6 = &*BBI++; |
|
12876 + Instruction *Y7 = &*BBI++; |
|
12877 |
|
12878 - BasicBlock *BB4 = FI++; |
|
12879 + BasicBlock *BB4 = &*FI++; |
|
12880 BBI = BB4->begin(); |
|
12881 - Instruction *Y8 = BBI++; |
|
12882 - Instruction *Y9 = BBI++; |
|
12883 + Instruction *Y8 = &*BBI++; |
|
12884 + Instruction *Y9 = &*BBI++; |
|
12885 |
|
12886 // Reachability |
|
12887 EXPECT_TRUE(DT->isReachableFromEntry(BB0)); |
|
12888 --- unittests/IR/IRBuilderTest.cpp 2014-09-02 13:03:00.000000000 -0700 |
|
12889 +++ unittests/IR/IRBuilderTest.cpp 2016-01-23 11:19:43.000000000 -0800 |
|
12890 @@ -280,7 +280,7 @@ |
|
12891 { |
|
12892 IRBuilder<>::InsertPointGuard Guard(Builder); |
|
12893 Builder.SetInsertPoint(cast<Instruction>(F)); |
|
12894 - EXPECT_EQ(F, Builder.GetInsertPoint()); |
|
12895 + EXPECT_EQ(F, &*Builder.GetInsertPoint()); |
|
12896 } |
|
12897 |
|
12898 EXPECT_EQ(BB->end(), Builder.GetInsertPoint()); |
|
12899 --- unittests/IR/LegacyPassManagerTest.cpp 2014-09-10 14:27:43.000000000 -0700 |
|
12900 +++ unittests/IR/LegacyPassManagerTest.cpp 2016-01-23 11:21:26.000000000 -0800 |
|
12901 @@ -521,7 +521,7 @@ |
|
12902 // Function: test4 (func_test4) |
|
12903 { |
|
12904 Function::arg_iterator args = func_test4->arg_begin(); |
|
12905 - Value* int1_f = args++; |
|
12906 + Value* int1_f = &*args++; |
|
12907 int1_f->setName("f"); |
|
12908 |
|
12909 BasicBlock* label_entry_11 = BasicBlock::Create(getGlobalContext(), "entry",func_test4,nullptr); |
|
12910 --- unittests/IR/ValueTest.cpp 2014-10-23 07:45:19.000000000 -0700 |
|
12911 +++ unittests/IR/ValueTest.cpp 2016-01-23 11:23:38.000000000 -0800 |
|
12912 @@ -38,9 +38,9 @@ |
|
12913 |
|
12914 Function *F = M->getFunction("f"); |
|
12915 |
|
12916 - EXPECT_FALSE(F->isUsedInBasicBlock(F->begin())); |
|
12917 - EXPECT_TRUE((++F->arg_begin())->isUsedInBasicBlock(F->begin())); |
|
12918 - EXPECT_TRUE(F->arg_begin()->isUsedInBasicBlock(F->begin())); |
|
12919 + EXPECT_FALSE(F->isUsedInBasicBlock(&F->front())); |
|
12920 + EXPECT_TRUE((++F->arg_begin())->isUsedInBasicBlock(&F->front())); |
|
12921 + EXPECT_TRUE(F->arg_begin()->isUsedInBasicBlock(&F->front())); |
|
12922 } |
|
12923 |
|
12924 TEST(GlobalTest, CreateAddressSpace) { |
|
12925 --- unittests/Linker/LinkModulesTest.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
12926 +++ unittests/Linker/LinkModulesTest.cpp 2016-01-23 11:25:17.000000000 -0800 |
|
12927 @@ -73,7 +73,7 @@ |
|
12928 |
|
12929 std::vector<Value *> GEPIndices; |
|
12930 GEPIndices.push_back(ConstantInt::get(Type::getInt32Ty(Ctx), 0)); |
|
12931 - GEPIndices.push_back(F->arg_begin()); |
|
12932 + GEPIndices.push_back(&*F->arg_begin()); |
|
12933 |
|
12934 Value *GEP = Builder.CreateGEP(GV, GEPIndices, "switch.gep"); |
|
12935 Value *Load = Builder.CreateLoad(GEP, "switch.load"); |
|
12936 --- unittests/Support/Makefile 2013-08-01 11:42:28.000000000 -0700 |
|
12937 +++ unittests/Support/Makefile 2016-01-27 11:20:22.000000000 -0800 |
|
12938 @@ -13,3 +13,7 @@ |
|
12939 |
|
12940 include $(LEVEL)/Makefile.config |
|
12941 include $(LLVM_SRC_ROOT)/unittests/Makefile.unittest |
|
12942 + |
|
12943 +C.Flags += -DALIAS_WITH_ARGUMENT_TESTS_ARE_BROKEN |
|
12944 +CXX.Flags += -DALIAS_WITH_ARGUMENT_TESTS_ARE_BROKEN |
|
12945 + |
|
12946 --- unittests/Transforms/Utils/Cloning.cpp 2015-01-14 03:23:27.000000000 -0800 |
|
12947 +++ unittests/Transforms/Utils/Cloning.cpp 2016-01-23 11:29:52.000000000 -0800 |
|
12948 @@ -165,7 +165,7 @@ |
|
12949 |
|
12950 Attribute::AttrKind AK[] = { Attribute::NoCapture }; |
|
12951 AttributeSet AS = AttributeSet::get(context, 0, AK); |
|
12952 - Argument *A = F1->arg_begin(); |
|
12953 + Argument *A = &*F1->arg_begin(); |
|
12954 A->addAttr(AS); |
|
12955 |
|
12956 SmallVector<ReturnInst*, 4> Returns; |
|
12957 @@ -193,7 +193,7 @@ |
|
12958 |
|
12959 SmallVector<ReturnInst*, 4> Returns; |
|
12960 ValueToValueMapTy VMap; |
|
12961 - VMap[F1->arg_begin()] = F2->arg_begin(); |
|
12962 + VMap[&*F1->arg_begin()] = &*F2->arg_begin(); |
|
12963 |
|
12964 CloneFunctionInto(F2, F1, VMap, false, Returns); |
|
12965 EXPECT_EQ(CallingConv::Cold, F2->getCallingConv()); |
|
12966 --- unittests/Transforms/Utils/IntegerDivision.cpp 2013-11-18 22:54:19.000000000 -0800 |
|
12967 +++ unittests/Transforms/Utils/IntegerDivision.cpp 2016-01-23 11:32:46.000000000 -0800 |
|
12968 @@ -35,8 +35,8 @@ |
|
12969 Builder.SetInsertPoint(BB); |
|
12970 |
|
12971 Function::arg_iterator AI = F->arg_begin(); |
|
12972 - Value *A = AI++; |
|
12973 - Value *B = AI++; |
|
12974 + Value *A = &*AI++; |
|
12975 + Value *B = &*AI++; |
|
12976 |
|
12977 Value *Div = Builder.CreateSDiv(A, B); |
|
12978 EXPECT_TRUE(BB->front().getOpcode() == Instruction::SDiv); |
|
12979 @@ -65,8 +65,8 @@ |
|
12980 Builder.SetInsertPoint(BB); |
|
12981 |
|
12982 Function::arg_iterator AI = F->arg_begin(); |
|
12983 - Value *A = AI++; |
|
12984 - Value *B = AI++; |
|
12985 + Value *A = &*AI++; |
|
12986 + Value *B = &*AI++; |
|
12987 |
|
12988 Value *Div = Builder.CreateUDiv(A, B); |
|
12989 EXPECT_TRUE(BB->front().getOpcode() == Instruction::UDiv); |
|
12990 @@ -95,8 +95,8 @@ |
|
12991 Builder.SetInsertPoint(BB); |
|
12992 |
|
12993 Function::arg_iterator AI = F->arg_begin(); |
|
12994 - Value *A = AI++; |
|
12995 - Value *B = AI++; |
|
12996 + Value *A = &*AI++; |
|
12997 + Value *B = &*AI++; |
|
12998 |
|
12999 Value *Rem = Builder.CreateSRem(A, B); |
|
13000 EXPECT_TRUE(BB->front().getOpcode() == Instruction::SRem); |
|
13001 @@ -125,8 +125,8 @@ |
|
13002 Builder.SetInsertPoint(BB); |
|
13003 |
|
13004 Function::arg_iterator AI = F->arg_begin(); |
|
13005 - Value *A = AI++; |
|
13006 - Value *B = AI++; |
|
13007 + Value *A = &*AI++; |
|
13008 + Value *B = &*AI++; |
|
13009 |
|
13010 Value *Rem = Builder.CreateURem(A, B); |
|
13011 EXPECT_TRUE(BB->front().getOpcode() == Instruction::URem); |
|
13012 @@ -156,8 +156,8 @@ |
|
13013 Builder.SetInsertPoint(BB); |
|
13014 |
|
13015 Function::arg_iterator AI = F->arg_begin(); |
|
13016 - Value *A = AI++; |
|
13017 - Value *B = AI++; |
|
13018 + Value *A = &*AI++; |
|
13019 + Value *B = &*AI++; |
|
13020 |
|
13021 Value *Div = Builder.CreateSDiv(A, B); |
|
13022 EXPECT_TRUE(BB->front().getOpcode() == Instruction::SDiv); |
|
13023 @@ -186,8 +186,8 @@ |
|
13024 Builder.SetInsertPoint(BB); |
|
13025 |
|
13026 Function::arg_iterator AI = F->arg_begin(); |
|
13027 - Value *A = AI++; |
|
13028 - Value *B = AI++; |
|
13029 + Value *A = &*AI++; |
|
13030 + Value *B = &*AI++; |
|
13031 |
|
13032 Value *Div = Builder.CreateUDiv(A, B); |
|
13033 EXPECT_TRUE(BB->front().getOpcode() == Instruction::UDiv); |
|
13034 @@ -216,8 +216,8 @@ |
|
13035 Builder.SetInsertPoint(BB); |
|
13036 |
|
13037 Function::arg_iterator AI = F->arg_begin(); |
|
13038 - Value *A = AI++; |
|
13039 - Value *B = AI++; |
|
13040 + Value *A = &*AI++; |
|
13041 + Value *B = &*AI++; |
|
13042 |
|
13043 Value *Rem = Builder.CreateSRem(A, B); |
|
13044 EXPECT_TRUE(BB->front().getOpcode() == Instruction::SRem); |
|
13045 @@ -246,8 +246,8 @@ |
|
13046 Builder.SetInsertPoint(BB); |
|
13047 |
|
13048 Function::arg_iterator AI = F->arg_begin(); |
|
13049 - Value *A = AI++; |
|
13050 - Value *B = AI++; |
|
13051 + Value *A = &*AI++; |
|
13052 + Value *B = &*AI++; |
|
13053 |
|
13054 Value *Rem = Builder.CreateURem(A, B); |
|
13055 EXPECT_TRUE(BB->front().getOpcode() == Instruction::URem); |
|