[SI] Fix a potential use-after-free
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 16 Nov 2017 16:35:19 +0000 (16:35 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 16 Nov 2017 16:35:19 +0000 (16:35 +0000)
commit8dd0f479e89e73354d936b93ef5ee4490d18df50
treeb488fc599480ea522e036b0b38baacf16a58adcd
parentabf5b27f7a77531d19cb59e6d78aa074a81c315f
[SI] Fix a potential use-after-free

Summary:
There is a potential use-after-free bug in Scop::buildSchedule(Region *,
LoopStackTy &, LoopInfo &).  Before, we took a reference to LoopStack.back()
which is a use after free, since back is popped off further below. This didn't
crash before by pure chance, since LoopStack is actually a vector, and the
memory isn't freed upon pop. I turned this into an iterator-based algorithm.

Reviewers: grosser, bollu, Meinersbur

Reviewed By: Meinersbur

Subscribers: llvm-commits, pollydev

Differential Revision: https://reviews.llvm.org/D39979

llvm-svn: 318415
polly/lib/Analysis/ScopInfo.cpp