[SI] Fix a potential use-after-free
commit0b225a2a6263bc061202d84fcaec275f75c52c6d
authorPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 16 Nov 2017 16:35:19 +0000 (16 16:35 +0000)
committerPhilip Pfaffe <philip.pfaffe@gmail.com>
Thu, 16 Nov 2017 16:35:19 +0000 (16 16:35 +0000)
treec7e9dfa1843ab4b48f7ae86e8debfa9426b0c4e5
parent85a162035cecee97a8e35e5a2cb1f651132dc49b
[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

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@318415 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ScopInfo.cpp