]> granicus.if.org Git - llvm/commit
[LV] Fix an issue where forming LCSSA in the place that we did would
authorChandler Carruth <chandlerc@gmail.com>
Thu, 26 Jan 2017 10:41:09 +0000 (10:41 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 26 Jan 2017 10:41:09 +0000 (10:41 +0000)
commitfaae5327defae7cffed829fb956b9d5d4d15aed2
tree08ebdfe316704572906f36ca241d6eea122d19b4
parent40f771f0731cf1bd1ad2189dcf30fc59dc684f12
[LV] Fix an issue where forming LCSSA in the place that we did would
change the set of uniform instructions in the loop causing an assert
failure.

The problem is that the legalization checking also builds data
structures mapping various facts about the loop body. The immediate
cause was the set of uniform instructions. If these then change when
LCSSA is formed, the data structures would already have been built and
become stale. The included test case triggered an assert in loop
vectorize that was reduced out of the new PM's pipeline.

The solution is to form LCSSA early enough that no information is cached
across the changes made. The only really obvious position is outside of
the main logic to vectorize the loop. This also has the advantage of
removing one case where forming LCSSA could mutate the loop but we
wouldn't track that as a "Changed" state.

If it is significantly advantageous to do some legalization checking
prior to this, we can do a more careful positioning but it seemed best
to just back off to a safe position first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293168 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Vectorize/LoopVectorize.cpp
test/Transforms/LoopVectorize/lcssa-crash.ll