aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-range-fold.cc
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2021-11-01 16:20:59 -0400
committerAndrew MacLeod <amacleod@redhat.com>2021-11-03 10:13:32 -0400
commitb18394ce15639489a91a502d3b9db30d73898191 (patch)
tree618bb961f99b0105d1835292c9e99e8a661f3d3b /gcc/gimple-range-fold.cc
parent309bb7ff6e2807ecd849c133c3639705f20e5894 (diff)
downloadgcc-b18394ce15639489a91a502d3b9db30d73898191.zip
gcc-b18394ce15639489a91a502d3b9db30d73898191.tar.gz
gcc-b18394ce15639489a91a502d3b9db30d73898191.tar.bz2
Check for constant builtin value first.
The original code imported from EVRP for evaluating built_in_constant_p didn't check to see if the value was a constant before checking the inlining flag. Now we check for a constant first. * gimple-range-fold.cc (fold_using_range::range_of_builtin_call): Test for constant before any other processing.
Diffstat (limited to 'gcc/gimple-range-fold.cc')
-rw-r--r--gcc/gimple-range-fold.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/gimple-range-fold.cc b/gcc/gimple-range-fold.cc
index 2fab904..6cc7753 100644
--- a/gcc/gimple-range-fold.cc
+++ b/gcc/gimple-range-fold.cc
@@ -960,18 +960,18 @@ fold_using_range::range_of_builtin_call (irange &r, gcall *call,
switch (func)
{
case CFN_BUILT_IN_CONSTANT_P:
- if (cfun->after_inlining)
- {
- r.set_zero (type);
- // r.equiv_clear ();
- return true;
- }
arg = gimple_call_arg (call, 0);
if (src.get_operand (r, arg) && r.singleton_p ())
{
r.set (build_one_cst (type), build_one_cst (type));
return true;
}
+ if (cfun->after_inlining)
+ {
+ r.set_zero (type);
+ // r.equiv_clear ();
+ return true;
+ }
break;
case CFN_BUILT_IN_TOUPPER: