This is an archive of the discontinued LLVM Phabricator instance.

[PeepholeOptimizer] Fix infinite recusion in CopyRewriter.
AbandonedPublic

Authored by efriedma on Mar 27 2018, 2:16 PM.

Details

Summary

CopyRewriter::getNewSource calls itself, with no obvious limit to the amount of allowed recursion. Limit it to recursing once, which should catch the obvious cases without the potential infinite recursion.

Arbitrarily limiting the recursion to one isn't ideal, but I'm not sure what the intended limit is, and there aren't any regression tests for more complicated cases.

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Mar 27 2018, 2:16 PM
efriedma planned changes to this revision.Mar 27 2018, 2:28 PM

Err, sorry, there's something wrong with my testcase... used the wrong version or something? Looking into it.

efriedma abandoned this revision.Mar 27 2018, 2:37 PM

Nevermind, we actually don't need this, I think. (I only managed to reproduce the issue on the 6.0 branch; I think the underlying problem might have been fixed in https://reviews.llvm.org/D40763 .)