summaryrefslogtreecommitdiff
path: root/gcc/peel-last-iteration.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/peel-last-iteration.c')
-rw-r--r--gcc/peel-last-iteration.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/gcc/peel-last-iteration.c b/gcc/peel-last-iteration.c
index 7d6333a7e079..d18c01f1a3df 100644
--- a/gcc/peel-last-iteration.c
+++ b/gcc/peel-last-iteration.c
@@ -53,6 +53,8 @@
#include "dumpfile.h"
#include "tree-pass.h"
+static const char *uninlined_function_postfix = "loop";
+
gcond *
get_loop_exit_condition (const struct loop *loop);
@@ -112,28 +114,13 @@ peel_in_fn (void)
unsigned j;
unsigned num_nodes;
- const char * fun_to_uninline;
- int fun_to_uninline_len;
-
- int uninlined_function_postfix_len;
-
gimple *return_stmt;
- char fun_to_peel[256];
-
int k;
entry_edge = NULL;
copied_def_stmt = NULL;
- fun_to_uninline = noalias;
- fun_to_uninline_len = strlen (fun_to_uninline);
- uninlined_function_postfix_len = strlen (uninlined_function_postfix);
-
- /* FIXME Make this more safe. */
- snprintf(fun_to_peel, sizeof fun_to_peel, "%s.%s", fun_to_uninline,
- uninlined_function_postfix);
-
loop_optimizer_init (LOOPS_HAVE_SIMPLE_LATCHES | LOOPS_HAVE_PREHEADERS);
record_loop_exits ();
@@ -142,14 +129,6 @@ peel_in_fn (void)
FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
{
k++;
- if (strncmp (function_name (cfun), fun_to_peel, fun_to_uninline_len + 1 + uninlined_function_postfix_len) != 0)
- {
- if (dump_file)
- fprintf (dump_file, "%s:%d (%s): wrong function %s\n",
- __FILE__, __LINE__, __func__,
- function_name (cfun));
- continue;
- }
if (k != 0)
{
if (dump_file)
@@ -401,8 +380,11 @@ peel_in_fn (void)
static bool
gate_peel_last_iteration (void)
{
- /* Run this only as a post processing step for the uninlining pass. */
- return noalias != 0;
+ const char* cfun_name = function_name (cfun);
+ char needle[strlen (uninlined_function_postfix) + 2];
+ snprintf (needle, sizeof (needle), ".%s", uninlined_function_postfix);
+ const char* result = strstr (cfun_name, needle);
+ return result != NULL;
}
namespace {