Skip to content

Commit c17c7d6

Browse files
committed
Attempt gcc-mirror#2.
1 parent 1e5e314 commit c17c7d6

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

gcc/profile.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see
6464
#include "tree-cfg.h"
6565
#include "dumpfile.h"
6666
#include "cfgloop.h"
67+
#include "gimple-predict.h"
6768

6869
#include "profile.h"
6970

@@ -1271,9 +1272,30 @@ branch_prob (void)
12711272
&offset, bb);
12721273
}
12731274

1274-
/* Notice that explicit GOTO expression that are in original source
1275-
code will be represented in GIMPLE with GIMPLE_PREDICT
1276-
of GOTO_PRED type. */
1275+
/* Notice GOTO expressions eliminated while constructing the CFG. */
1276+
if (single_succ_p (bb)
1277+
&& !RESERVED_LOCATION_P (single_succ_edge (bb)->goto_locus))
1278+
{
1279+
bool add = true;
1280+
gsi = gsi_last_bb (bb);
1281+
if (!gsi_end_p (gsi))
1282+
{
1283+
gsi_prev (&gsi);
1284+
1285+
if (!gsi_end_p (gsi)
1286+
&& gimple_code (gsi_stmt (gsi)) == GIMPLE_PREDICT
1287+
&& gimple_predict_predictor (gsi_stmt (gsi)) == PRED_GOTO)
1288+
add = false;
1289+
}
1290+
1291+
if (add)
1292+
{
1293+
expanded_location curr_location
1294+
= expand_location (single_succ_edge (bb)->goto_locus);
1295+
output_location (curr_location.file, curr_location.line,
1296+
&offset, bb);
1297+
}
1298+
}
12771299

12781300
if (offset)
12791301
{

0 commit comments

Comments
 (0)