projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fcc54e7
)
tcg/optimize: Fold movcond with true and false values identical
author
Richard Henderson
<richard.henderson@linaro.org>
Sat, 7 Sep 2024 04:00:10 +0000
(21:00 -0700)
committer
Richard Henderson
<richard.henderson@linaro.org>
Sun, 22 Sep 2024 04:54:49 +0000
(06:54 +0200)
Fold "x = cond ? y : y" to "x = y".
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
tcg/optimize.c
patch
|
blob
|
history
diff --git
a/tcg/optimize.c
b/tcg/optimize.c
index ba16ec27e243b682b22d747adf005255ce3c69c9..cf311790e058840f2a5ca148a3f1c2af42d12bc0 100644
(file)
--- a/
tcg/optimize.c
+++ b/
tcg/optimize.c
@@
-1851,6
+1851,11
@@
static bool fold_movcond(OptContext *ctx, TCGOp *op)
{
int i;
+ /* If true and false values are the same, eliminate the cmp. */
+ if (args_are_copies(op->args[3], op->args[4])) {
+ return tcg_opt_gen_mov(ctx, op, op->args[0], op->args[3]);
+ }
+
/*
* Canonicalize the "false" input reg to match the destination reg so
* that the tcg backend can implement a "move if true" operation.