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
6ee86466
Commit
6ee86466
authored
Nov 14, 2019
by
Aldy Hernandez
Committed by
Aldy Hernandez
Nov 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make normalize_addresses and normalize_symbolics work on THIS, instead
of returning by value. From-SVN: r278196
parent
9773f69c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
37 deletions
+80
-37
gcc/ChangeLog
+15
-0
gcc/tree-vrp.c
+13
-8
gcc/value-range.cc
+50
-27
gcc/value-range.h
+2
-2
No files found.
gcc/ChangeLog
View file @
6ee86466
2019-11-14 Aldy Hernandez <aldyh@redhat.com>
* tree-vrp.c (range_fold_binary_symbolics_p): Adapt for
normalize_symbolics and normalize_addresses working in place.
(range_fold_unary_symbolics_p): Same.
(range_fold_unary_symbolics_p): Same.
* value-range.cc (num_pairs): Same.
(lower_bound): Same.
(upper_bound): Same.
(contains_p): Same.
(normalize_addresses): Same.
(normalize_symbolics): Same.
* value-range.h (normalize_symbolics): Same.
(normalize_addresses): Same.
2019-11-14 Feng Xue <fxue@os.amperecomputing.com>
PR ipa/91682
gcc/tree-vrp.c
View file @
6ee86466
...
...
@@ -1182,8 +1182,10 @@ range_fold_binary_symbolics_p (value_range *vr,
return
true
;
}
const
range_operator
*
op
=
get_range_op_handler
(
vr
,
code
,
expr_type
);
op
->
fold_range
(
*
vr
,
expr_type
,
vr0
->
normalize_symbolics
(),
vr1
->
normalize_symbolics
());
value_range
vr0_cst
(
*
vr0
),
vr1_cst
(
*
vr1
);
vr0_cst
.
normalize_symbolics
();
vr1_cst
.
normalize_symbolics
();
op
->
fold_range
(
*
vr
,
expr_type
,
vr0_cst
,
vr1_cst
);
return
true
;
}
return
false
;
...
...
@@ -1217,8 +1219,9 @@ range_fold_unary_symbolics_p (value_range *vr,
return
true
;
}
const
range_operator
*
op
=
get_range_op_handler
(
vr
,
code
,
expr_type
);
op
->
fold_range
(
*
vr
,
expr_type
,
vr0
->
normalize_symbolics
(),
value_range
(
expr_type
));
value_range
vr0_cst
(
*
vr0
);
vr0_cst
.
normalize_symbolics
();
op
->
fold_range
(
*
vr
,
expr_type
,
vr0_cst
,
value_range
(
expr_type
));
return
true
;
}
return
false
;
...
...
@@ -1245,8 +1248,9 @@ range_fold_binary_expr (value_range *vr,
if
(
range_fold_binary_symbolics_p
(
vr
,
code
,
expr_type
,
&
vr0
,
&
vr1
))
return
;
op
->
fold_range
(
*
vr
,
expr_type
,
vr0
.
normalize_addresses
(),
vr1
.
normalize_addresses
());
vr0
.
normalize_addresses
();
vr1
.
normalize_addresses
();
op
->
fold_range
(
*
vr
,
expr_type
,
vr0
,
vr1
);
}
/* Perform a unary operation on a range. */
...
...
@@ -1267,8 +1271,9 @@ range_fold_unary_expr (value_range *vr,
if
(
range_fold_unary_symbolics_p
(
vr
,
code
,
expr_type
,
vr0
))
return
;
op
->
fold_range
(
*
vr
,
expr_type
,
vr0
->
normalize_addresses
(),
value_range
(
expr_type
));
value_range
vr0_cst
(
*
vr0
);
vr0_cst
.
normalize_addresses
();
op
->
fold_range
(
*
vr
,
expr_type
,
vr0_cst
,
value_range
(
expr_type
));
}
/* Given a COND_EXPR COND of the form 'V OP W', and an SSA name V,
...
...
gcc/value-range.cc
View file @
6ee86466
...
...
@@ -305,7 +305,11 @@ value_range::num_pairs () const
if
(
varying_p
())
return
1
;
if
(
symbolic_p
())
return
normalize_symbolics
().
num_pairs
();
{
value_range
numeric_range
(
*
this
);
numeric_range
.
normalize_symbolics
();
return
numeric_range
.
num_pairs
();
}
if
(
m_kind
==
VR_ANTI_RANGE
)
{
// ~[MIN, X] has one sub-range of [X+1, MAX], and
...
...
@@ -324,7 +328,11 @@ wide_int
value_range
::
lower_bound
(
unsigned
pair
)
const
{
if
(
symbolic_p
())
return
normalize_symbolics
().
lower_bound
(
pair
);
{
value_range
numeric_range
(
*
this
);
numeric_range
.
normalize_symbolics
();
return
numeric_range
.
lower_bound
(
pair
);
}
gcc_checking_assert
(
!
undefined_p
());
gcc_checking_assert
(
pair
+
1
<=
num_pairs
());
...
...
@@ -349,7 +357,11 @@ wide_int
value_range
::
upper_bound
(
unsigned
pair
)
const
{
if
(
symbolic_p
())
return
normalize_symbolics
().
upper_bound
(
pair
);
{
value_range
numeric_range
(
*
this
);
numeric_range
.
normalize_symbolics
();
return
numeric_range
.
upper_bound
(
pair
);
}
gcc_checking_assert
(
!
undefined_p
());
gcc_checking_assert
(
pair
+
1
<=
num_pairs
());
...
...
@@ -505,57 +517,69 @@ value_range::contains_p (tree cst) const
{
gcc_checking_assert
(
TREE_CODE
(
cst
)
==
INTEGER_CST
);
if
(
symbolic_p
())
return
normalize_symbolics
().
contains_p
(
cst
);
{
value_range
numeric_range
(
*
this
);
numeric_range
.
normalize_symbolics
();
return
numeric_range
.
contains_p
(
cst
);
}
return
value_inside_range
(
cst
)
==
1
;
}
/* Normalize addresses into constants. */
v
alue_range
value_range
::
normalize_addresses
()
const
v
oid
value_range
::
normalize_addresses
()
{
if
(
undefined_p
())
return
*
this
;
return
;
if
(
!
POINTER_TYPE_P
(
type
())
||
range_has_numeric_bounds_p
(
this
))
return
*
this
;
return
;
if
(
!
range_includes_zero_p
(
this
))
{
gcc_checking_assert
(
TREE_CODE
(
m_min
)
==
ADDR_EXPR
||
TREE_CODE
(
m_max
)
==
ADDR_EXPR
);
return
range_nonzero
(
type
());
set_nonzero
(
type
());
return
;
}
return
value_range
(
type
());
set_varying
(
type
());
}
/* Normalize symbolics and addresses into constants. */
v
alue_range
value_range
::
normalize_symbolics
()
const
v
oid
value_range
::
normalize_symbolics
()
{
if
(
varying_p
()
||
undefined_p
())
return
*
this
;
return
;
tree
ttype
=
type
();
bool
min_symbolic
=
!
is_gimple_min_invariant
(
min
());
bool
max_symbolic
=
!
is_gimple_min_invariant
(
max
());
if
(
!
min_symbolic
&&
!
max_symbolic
)
return
normalize_addresses
();
{
normalize_addresses
();
return
;
}
// [SYM, SYM] -> VARYING
if
(
min_symbolic
&&
max_symbolic
)
{
value_range
var
;
var
.
set_varying
(
ttype
);
return
var
;
set_varying
(
ttype
);
return
;
}
if
(
kind
()
==
VR_RANGE
)
{
// [SYM, NUM] -> [-MIN, NUM]
if
(
min_symbolic
)
return
value_range
(
vrp_val_min
(
ttype
),
max
());
{
set
(
vrp_val_min
(
ttype
),
max
());
return
;
}
// [NUM, SYM] -> [NUM, +MAX]
return
value_range
(
min
(),
vrp_val_max
(
ttype
));
set
(
min
(),
vrp_val_max
(
ttype
));
return
;
}
gcc_checking_assert
(
kind
()
==
VR_ANTI_RANGE
);
// ~[SYM, NUM] -> [NUM + 1, +MAX]
...
...
@@ -564,21 +588,20 @@ value_range::normalize_symbolics () const
if
(
!
vrp_val_is_max
(
max
()))
{
tree
n
=
wide_int_to_tree
(
ttype
,
wi
::
to_wide
(
max
())
+
1
);
return
value_range
(
n
,
vrp_val_max
(
ttype
));
set
(
n
,
vrp_val_max
(
ttype
));
return
;
}
value_range
var
;
var
.
set_varying
(
ttype
);
return
var
;
set_varying
(
ttype
);
return
;
}
// ~[NUM, SYM] -> [-MIN, NUM - 1]
if
(
!
vrp_val_is_min
(
min
()))
{
tree
n
=
wide_int_to_tree
(
ttype
,
wi
::
to_wide
(
min
())
-
1
);
return
value_range
(
vrp_val_min
(
ttype
),
n
);
set
(
vrp_val_min
(
ttype
),
n
);
return
;
}
value_range
var
;
var
.
set_varying
(
ttype
);
return
var
;
set_varying
(
ttype
);
}
/* Intersect the two value-ranges { *VR0TYPE, *VR0MIN, *VR0MAX } and
...
...
gcc/value-range.h
View file @
6ee86466
...
...
@@ -83,8 +83,8 @@ public:
void
dump
()
const
;
static
bool
supports_type_p
(
tree
);
v
alue_range
normalize_symbolics
()
const
;
v
alue_range
normalize_addresses
()
const
;
v
oid
normalize_symbolics
()
;
v
oid
normalize_addresses
()
;
static
const
unsigned
int
m_max_pairs
=
2
;
bool
contains_p
(
tree
)
const
;
...
...
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