E = L->begin() in LoopVectorize


I'm studying loop vectorizer. I don't understand the code yet. But
it looks not right to assign L->begin() to E. Is it a typo?


diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp
index 435c005..87b5d79 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -1067,7 +1067,7 @@ struct LoopVectorize : public FunctionPass {
     // We only handle inner loops, so if there are children just recurse.
     if (!L->empty()) {
       bool Changed = false;
- for (Loop::iterator I = L->begin(), E = L->begin(); I != E; ++I)
+ for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
         Changed |= processLoop(*I);
       return Changed;

Almost certainly, yes. Nice catch!

Looking at it now, curious why no tests failed.

From: "Chandler Carruth" <chandlerc@google.com>
To: "Jim Grosbach" <grosbach@apple.com>
Cc: "LLVM Developers Mailing List" <llvmdev@cs.uiuc.edu>
Sent: Tuesday, March 18, 2014 4:49:14 PM
Subject: Re: [LLVMdev] E = L->begin() in LoopVectorize

Looking at it now, curious why no tests failed.

Likely we have no tests with nested loops where the loop to vectorize is not the first child of the parent loop.


No, we do. There is no bug here, just dead code left over (harmlessly) from when i was half way through implementing this.

I’m tidying it up.

Apologies, this was dead code left over from the first half of a refactoring I did. I’ve tidied it up and clarified matters with an assert in r204184. Sorry for any confusion.

And by r204184, I actually mean r204187 because I misfired my git client. Sorry.

Got it. Thanks.