diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-10 19:22:58 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-02-10 19:22:58 +0000 |
commit | 2a5af6bfe776fbcd5d4e5de33072bd8a36d1bcea (patch) | |
tree | 5d6054da917dffe6c192e92e66570bbe9eaddf9d /gcc/tree-ssa-threadedge.c | |
parent | e4789c62da13878e04eb224b5b058ac00271b7ae (diff) | |
download | gcc-2a5af6bfe776fbcd5d4e5de33072bd8a36d1bcea.tar.gz |
PR tree-optimization/26213
* tree-ssa-threadedge.c (simplify_control_stmt_condition): Do not
loop trying to follow SSA_NAME_VALUE chains.
* gcc.c-torture/compile/pr26213.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110846 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-threadedge.c')
-rw-r--r-- | gcc/tree-ssa-threadedge.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/tree-ssa-threadedge.c b/gcc/tree-ssa-threadedge.c index b8d4b1301c6..cc98867b6ec 100644 --- a/gcc/tree-ssa-threadedge.c +++ b/gcc/tree-ssa-threadedge.c @@ -441,10 +441,14 @@ simplify_control_stmt_condition (edge e, { cached_lhs = cond; - /* Get the variable's current value from the equivalency chains. */ - while (cached_lhs - && TREE_CODE (cached_lhs) == SSA_NAME - && SSA_NAME_VALUE (cached_lhs)) + /* Get the variable's current value from the equivalency chains. + + It is possible to get loops in the SSA_NAME_VALUE chains + (consider threading the backedge of a loop where we have + a loop invariant SSA_NAME used in the condition. */ + if (cached_lhs + && TREE_CODE (cached_lhs) == SSA_NAME + && SSA_NAME_VALUE (cached_lhs)) cached_lhs = SSA_NAME_VALUE (cached_lhs); /* If we're dominated by a suitable ASSERT_EXPR, then |