aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/expr.y
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/expr.y')
-rw-r--r--tools/perf/util/expr.y10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
index 5b878f044f22..ba7d3b667fcb 100644
--- a/tools/perf/util/expr.y
+++ b/tools/perf/util/expr.y
@@ -142,6 +142,16 @@ if_expr: expr IF expr ELSE expr
$$.ids = $1.ids;
ids__free($3.ids);
ids__free($5.ids);
+ } else if ($1.val == $5.val) {
+ /*
+ * LHS == RHS, so both are an identical constant. No need to
+ * evaluate any events.
+ */
+ $$.val = $1.val;
+ $$.ids = NULL;
+ ids__free($1.ids);
+ ids__free($3.ids);
+ ids__free($5.ids);
} else {
/*
* Value is either the LHS or RHS and we need the IF expression