[llvm] 18eae33 - [SCEV] Fix usage of invalid IP with FoldingSet

Ehud Katz via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 09:45:38 PDT 2020


This is actually to fix a regression caused by
rGfcc2238b8bfb9498b46a48d219193de8c00a25a0.
These lines of code actually existed before the change, but removed
incorrectly.

On Fri, Mar 13, 2020 at 6:38 PM Roman Lebedev <lebedev.ri at gmail.com> wrote:

> Any chance for a test for this?
>
> On Fri, Mar 13, 2020 at 7:37 PM Ehud Katz via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
> >
> >
> > Author: Ehud Katz
> > Date: 2020-03-13T18:36:58+02:00
> > New Revision: 18eae3312297cb197a3131f3ad9ca2bebb217415
> >
> > URL:
> https://github.com/llvm/llvm-project/commit/18eae3312297cb197a3131f3ad9ca2bebb217415
> > DIFF:
> https://github.com/llvm/llvm-project/commit/18eae3312297cb197a3131f3ad9ca2bebb217415.diff
> >
> > LOG: [SCEV] Fix usage of invalid IP with FoldingSet
> >
> > Fix the use of invalid Insertion Point pointer with the UniqueSCEVs
> FoldingSet,
> > which caused memory corruption.
> >
> > Added:
> >
> >
> > Modified:
> >     llvm/lib/Analysis/ScalarEvolution.cpp
> >
> > Removed:
> >
> >
> >
> >
> ################################################################################
> > diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp
> b/llvm/lib/Analysis/ScalarEvolution.cpp
> > index debd03bf47b8..030de8cf90b7 100644
> > --- a/llvm/lib/Analysis/ScalarEvolution.cpp
> > +++ b/llvm/lib/Analysis/ScalarEvolution.cpp
> > @@ -3339,6 +3339,10 @@ const SCEV *ScalarEvolution::getUDivExpr(const
> SCEV *LHS,
> >      }
> >    }
> >
> > +  // The Insertion Point (IP) might be invalid by now (due to
> UniqueSCEVs
> > +  // changes). Make sure we get a new one.
> > +  IP = nullptr;
> > +  if (const SCEV *S = UniqueSCEVs.FindNodeOrInsertPos(ID, IP)) return S;
> >    SCEV *S = new (SCEVAllocator) SCEVUDivExpr(ID.Intern(SCEVAllocator),
> >                                               LHS, RHS);
> >    UniqueSCEVs.InsertNode(S, IP);
> >
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200313/0e4762b0/attachment.html>


More information about the llvm-commits mailing list