public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3085] [PR tree-optimization/107052] range-ops: Pass nonzero masks through cast.
@ 2022-10-05 12:22 Aldy Hernandez
0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2022-10-05 12:22 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:ae56d600d223e996054483d7d7033ec8e258d39d
commit r13-3085-gae56d600d223e996054483d7d7033ec8e258d39d
Author: Aldy Hernandez <aldyh@redhat.com>
Date: Tue Oct 4 17:03:54 2022 +0200
[PR tree-optimization/107052] range-ops: Pass nonzero masks through cast.
Track nonzero masks through a cast in range-ops.
PR tree-optimization/107052
gcc/ChangeLog:
* range-op.cc (operator_cast::fold_range): Set nonzero mask.
Diff:
---
gcc/range-op.cc | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/gcc/range-op.cc b/gcc/range-op.cc
index 4f647abd91c..6fa27a8904e 100644
--- a/gcc/range-op.cc
+++ b/gcc/range-op.cc
@@ -2515,6 +2515,14 @@ operator_cast::fold_range (irange &r, tree type ATTRIBUTE_UNUSED,
if (r.varying_p ())
return true;
}
+
+ // Pass nonzero mask through the cast.
+ if (!truncating_cast_p (inner, outer))
+ {
+ wide_int nz = inner.get_nonzero_bits ();
+ nz = wide_int::from (nz, TYPE_PRECISION (type), TYPE_SIGN (inner.type ()));
+ r.set_nonzero_bits (nz);
+ }
return true;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-05 12:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-05 12:22 [gcc r13-3085] [PR tree-optimization/107052] range-ops: Pass nonzero masks through cast Aldy Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).