[llvm-commits] [PATCH] Avoid use after free in ScalarEvolution

Török Edwin edwintorok at gmail.com
Fri May 22 03:41:48 PDT 2009


When running ScalarEvolution on-the-fly (from a ModulePass), and using
getSCEVAtScope I get use-after-free errors.
This is because nobody calls releaseMemory() for ScalarEvolution before
running it again, and LoopInfo has already been run for the new function
, hence freeing the loopinfo of the previous function.  But
ScalarEvolution still has Loop* in ValuesAtScopes (and other maps),
which cause use-after-free errors.

The attached patch simply adds a call to releaseMemory().
OK to commit?

Or should the on-the-fly passmanager call releaseMemory before rerunning
the pass?

Best regards,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scev.patch
Type: text/x-diff
Size: 420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090522/733bc94e/attachment.patch>

More information about the llvm-commits mailing list