[PATCH] D41380: [SCEV] Do not insert if it is already in cache

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 01:44:56 PST 2017


skatkov created this revision.
skatkov added reviewers: sanjoy, mkazantsev, craig.topper.

This is fix for the crash caused by ScalarEvolution::getTruncateExpr.

It expects that if it checked the condition that SCEV is not in UniqueSCEVs cache in
the beginning that it will not be there inside this method.

However during recursion and transformation/simplification for sub expression,
it is possible that these modifications will end up with the same SCEV as we started from.

So we must always check whether SCEV is in cache and do not insert item if it is already there.


https://reviews.llvm.org/D41380

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/truncate.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41380.127472.patch
Type: text/x-patch
Size: 4704 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171219/29824498/attachment.bin>


More information about the llvm-commits mailing list