[PATCH] D23396: [Assumptions] Make collecting ephemeral values not quadratic in the number of assume intrinsics.
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 19:55:50 PDT 2016
chandlerc marked an inline comment as done.
================
Comment at: lib/Analysis/CodeMetrics.cpp:54
@@ +53,3 @@
+ // worklist forever.
+ for (int i = 0; i < (int)Worklist.size(); ++i) {
+ const Value *V = Worklist[i];
----------------
hfinkel wrote:
> Is there a reason to use the index here? Why not write this as:
>
> for (auto I = Worklist.begin(); I != Worklist.end(); ++I) {
> const Value *V = *I;
>
Because that isn't valid.
When you grow the worklist you invalidate all iterators (because the iterators are just pointers and its a vector that may have to re-allocate).
https://reviews.llvm.org/D23396
More information about the llvm-commits
mailing list