[llvm] 18eae33 - [SCEV] Fix usage of invalid IP with FoldingSet
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 09:38:17 PDT 2020
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
More information about the llvm-commits
mailing list