Skip to content
  • Dan Gohman's avatar
    When LSR is replacing an instruction, call · e62632e0
    Dan Gohman authored
    ScalarEvolution::deleteValueFromRecords on it before doing the
    replaceAllUsesWith, because ScalarEvolution looks at the instruction's
    users to find SCEV references to the instruction's SCEV object in its
    internal maps.
    
    Move all of LSR's loop-related state clearing after processing the loop
    and before cleaning up dead PHI nodes. This eliminates all of LSR's SCEV
    references just before the calls to ScalarEvolution::deleteValueFromRecords
    so that when ScalarEvolution drops its own SCEV references, the reference
    counts will reach zero and the SCEVs will be deleted immediately.
    
    These changes fix some compiler aborts involving ScalarEvolution holding
    onto and reusing SCEV objects for instructions that have been deleted.
    No regression test unfortunately; because the symptoms were due to
    dangling pointers, reduced testcases ended up being fairly arbitrary.
    
    llvm-svn: 51359
    e62632e0
Loading