Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
94e85e0a
Commit
94e85e0a
authored
Apr 20, 2010
by
Xinliang David Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new folding rule
From-SVN: r158567
parent
54fb1ae0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
2 deletions
+63
-2
gcc/ChangeLog
+5
-0
gcc/fold-const.c
+26
-2
gcc/testsuite/ChangeLog
+4
-0
gcc/testsuite/g++.dg/tree-ssa/fold-compare.C
+28
-0
No files found.
gcc/ChangeLog
View file @
94e85e0a
2010-04-20 Xinliang David Li <davidxl@gcc.gnu.org>
PR middle-end/41952
* fold-const.c (fold_comparison): New folding rule.
2010-04-20 Anatoly Sokolov <aesok@post.ru
2010-04-20 Anatoly Sokolov <aesok@post.ru
* double-int.h (double_int_setbit): Declare.
* double-int.h (double_int_setbit): Declare.
...
...
gcc/fold-const.c
View file @
94e85e0a
...
@@ -8643,9 +8643,33 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
...
@@ -8643,9 +8643,33 @@ fold_comparison (location_t loc, enum tree_code code, tree type,
offset1
=
TREE_OPERAND
(
arg1
,
1
);
offset1
=
TREE_OPERAND
(
arg1
,
1
);
}
}
/* A local variable can never be pointed to by
the default SSA name of an incoming parameter. */
if
((
TREE_CODE
(
arg0
)
==
ADDR_EXPR
&&
indirect_base0
&&
TREE_CODE
(
base0
)
==
VAR_DECL
&&
auto_var_in_fn_p
(
base0
,
current_function_decl
)
&&
!
indirect_base1
&&
TREE_CODE
(
base1
)
==
SSA_NAME
&&
TREE_CODE
(
SSA_NAME_VAR
(
base1
))
==
PARM_DECL
&&
SSA_NAME_IS_DEFAULT_DEF
(
base1
))
||
(
TREE_CODE
(
arg1
)
==
ADDR_EXPR
&&
indirect_base1
&&
TREE_CODE
(
base1
)
==
VAR_DECL
&&
auto_var_in_fn_p
(
base1
,
current_function_decl
)
&&
!
indirect_base0
&&
TREE_CODE
(
base0
)
==
SSA_NAME
&&
TREE_CODE
(
SSA_NAME_VAR
(
base0
))
==
PARM_DECL
&&
SSA_NAME_IS_DEFAULT_DEF
(
base0
)))
{
if
(
code
==
NE_EXPR
)
return
constant_boolean_node
(
1
,
type
);
else
if
(
code
==
EQ_EXPR
)
return
constant_boolean_node
(
0
,
type
);
}
/* If we have equivalent bases we might be able to simplify. */
/* If we have equivalent bases we might be able to simplify. */
if
(
indirect_base0
==
indirect_base1
else
if
(
indirect_base0
==
indirect_base1
&&
operand_equal_p
(
base0
,
base1
,
0
))
&&
operand_equal_p
(
base0
,
base1
,
0
))
{
{
/* We can fold this expression to a constant if the non-constant
/* We can fold this expression to a constant if the non-constant
offset parts are equal. */
offset parts are equal. */
...
...
gcc/testsuite/ChangeLog
View file @
94e85e0a
2010-04-20 Xinliang David Li <davidxl@google.com>
* g++.dg/tree-ssa/fold-compare.C: New.
2010-04-20 Richard Guenther <rguenther@suse.de>
2010-04-20 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39417
PR tree-optimization/39417
...
...
gcc/testsuite/g++.dg/tree-ssa/fold-compare.C
0 → 100644
View file @
94e85e0a
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
struct
ExtentsBase
{
ExtentsBase
()
:
startx_
(),
endx_
()
{
}
ExtentsBase
(
const
ExtentsBase
&
b
)
{
*
this
=
b
;
}
const
ExtentsBase
&
operator
=
(
const
ExtentsBase
&
b
)
{
if
(
this
!=
&
b
)
{
startx_
=
b
.
startx_
;
}
return
*
this
;
}
int
startx_
;
int
endx_
;
};
int
f
(
const
ExtentsBase
&
e1
)
{
ExtentsBase
my_extents
=
e1
;
return
my_extents
.
startx_
;
}
/* { dg-final { scan-tree-dump-not "&my_extents" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment