diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 16:58:50 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-03 16:58:50 +0000 |
commit | 056af3180b4d26254277a9304dc0c271032532f0 (patch) | |
tree | 756fef625111fa096ec9607e576ddffab7337f47 /gcc/predict.c | |
parent | beb5789560529ced4884864ad6a739776cd3188e (diff) | |
download | gcc-056af3180b4d26254277a9304dc0c271032532f0.tar.gz |
2010-11-03 Richard Guenther <rguenther@suse.de>
PR middle-end/46288
* predict.c (strip_predict_hints): Simply DCE builtin expect if
the result is unused.
* gcc.dg/pr46288.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166258 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index eb91b87819d..beceb0f2680 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -1329,9 +1329,17 @@ strip_predict_hints (void) && gimple_call_num_args (stmt) == 2) { var = gimple_call_lhs (stmt); - ass_stmt = gimple_build_assign (var, gimple_call_arg (stmt, 0)); - - gsi_replace (&bi, ass_stmt, true); + if (var) + { + ass_stmt + = gimple_build_assign (var, gimple_call_arg (stmt, 0)); + gsi_replace (&bi, ass_stmt, true); + } + else + { + gsi_remove (&bi, true); + continue; + } } } gsi_next (&bi); |