summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-11 18:57:25 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-11 18:57:25 +0000
commit8e65ec8ada64174c858ba2d65dbba194464d9a69 (patch)
treebd3f256f9532dd32e0b470b34c5b165d836cdf7d /gcc/expmed.c
parenta86feb4c3acf0323659d9c003171ec3c933241a4 (diff)
downloadgcc-8e65ec8ada64174c858ba2d65dbba194464d9a69.tar.gz
PR middle-end/59049
* expmed.c (emit_store_flag): Fail for const-const comparison. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204682 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 59f81df5adf..1617bc05aa1 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -5401,6 +5401,13 @@ emit_store_flag (rtx target, enum rtx_code code, rtx op0, rtx op1,
rtx subtarget;
rtx tem, last, trueval;
+ /* If we compare constants, we shouldn't use a store-flag operation,
+ but a constant load. We can get there via the vanilla route that
+ usually generates a compare-branch sequence, but will in this case
+ fold the comparison to a constant, and thus elide the branch. */
+ if (CONSTANT_P (op0) && CONSTANT_P (op1))
+ return NULL_RTX;
+
tem = emit_store_flag_1 (target, code, op0, op1, mode, unsignedp, normalizep,
target_mode);
if (tem)