SlideShare a Scribd company logo
1 of 17
Download to read offline
Aldy Hernandez <aldyh@redhat.com>
Project Ranger update (GCC 13)
September 2022
Ranger Intro
• On-demand property propagation engine.
• a.k.a. 6 month project turned into 10 person years.
Outline
1. Type agnostic ranger.
2. Floating point ranges.
3. Enhancing ranger for fun and profit.
4. Upcoming work.
(vrange) Type agnostic ranger (1)
class vrange
{
public:
virtual void set (tree, tree, value_range_kind = VR_RANGE);
virtual tree type () const;
virtual bool supports_type_p (const_tree type) const;
virtual void set_varying (tree type);
virtual void set_undefined ();
virtual bool union_ (const vrange &);
virtual bool intersect (const vrange &);
virtual bool singleton_p (tree *result = NULL) const;
virtual bool contains_p (tree cst) const;
virtual bool zero_p () const;
virtual bool nonzero_p () const;
virtual void set_nonzero (tree type);
virtual void set_zero (tree type);
virtual void set_nonnegative (tree type);
virtual bool fits_p (const vrange &r) const;
};
(vrange) Temporaries (1)
class Value_Range
{
public:
bool varying_p () const;
bool undefined_p () const;
bool union_ (const vrange &r);
bool intersect (const vrange &r);
<etc>
<etc>
operator vrange &();
private:
vrange *m_vrange; // Pointer to active temporary.
int_range_max m_irange; // Integer temporary.
frange m_frange; // Floating point temporary.
unsupported_range m_unsupported; // Unsupported temporary.
};
value_range temp; // old world
Value_Range temp (some_type); // new world
(vrange) Global range storage (1)
• Can store full resolution ranges.
• Never loses information (*).
• As efficient as we want to make it
• Uses same set_range_info() API.
Floating point ranges (frange) (2)
“I told you it would be complicated, and hard and take
forever, but no… you insisted we needed float support.”
Andrew MacLeod
Floating point ranges (frange) (2)
// Symbolic relational operators.
if (x > y) {
if (x == y)
link_error ();
}
Floating point ranges (frange) (2)
// Propagation of NANs and INFs.
if (x > y) {
// x is not a NAN
// y is not a NAN
// x is not -INF
// y is not +INF
}
Floating point ranges (frange) (2)
// Intervals for ranges.
if (x >= 5.0) {
// x is not a NAN
// x is [5.0, +INF]
} else {
// x is [-INF, 5.0] U [NAN]
}
Floating point ranges (frange) (2)
// Signed zeros.
if (x == 0.0) {
if (__builtin_sign (x))
y = x; // y = -0.0
else
z = x; // z = +0.0
}
(frange) fpclassify-like API (2)
bool maybe_isinf () const;
bool known_isinf () const;
bool known_isfinite () const;
bool maybe_isnan () const;
bool known_isnan () const;
bool signbit_p (bool &signbit) const;
bool known_normal () const;
bool maybe_normal () const;
(enhancing) Solving a 17 year old PR (24021) (3)
<bb 2>:
i_17 = 2.100000029802322476513154470012523233890533447265625e-1;
i_22 = i_17 + 1.00000001490116119384765625e-1;
i_27 = i_22 + 1.00000001490116119384765625e-1;
i_32 = i_27 + 1.00000001490116119384765625e-1;
i_37 = i_32 + 1.00000001490116119384765625e-1;
i_42 = i_37 + 1.00000001490116119384765625e-1;
i_47 = i_42 + 1.00000001490116119384765625e-1;
i_52 = i_47 + 1.00000001490116119384765625e-1;
if (i_52 == 0.0)
goto <bb 4>;
else
goto <bb 3>;
(enhancing) Template for new operators (3)
class foperator_plus : public range_operator_float
{
public:
// r = op1 .op. op2
bool fold_range (frange &r, tree type,
const frange &op1,
const frange &op2,
relation_kind rel) const final override
{
r.set_varying (type);
return true;
}
} fop_plus;
floating_op_table::floating_op_table ()
{
set (EQ_EXPR, fop_equal);
set (NE_EXPR, fop_not_equal);
// etc
// etc
set (PLUS_EXPR, fop_plus);
}
(enhancing) PLUS_EXPR implementation (3)
bool
foperator_plus::fold_range (frange &r, tree type, const frange &op1,
const frange &op2, relation_kind) const
{
// Propagate known NANs.
if (op1.known_isnan () || op2.known_isnan ()) {
r.set_nan (type);
return true;
}
// [a, b] + [c, d] = [a+c, b+d]
REAL_VALUE_TYPE min, max;
frange_arithmetic (PLUS_EXPR, type, min, op1.lower_bound (), op2.lower_bound (), ninf);
frange_arithmetic (PLUS_EXPR, type, max, op1.upper_bound (), op2.upper_bound (), inf);
// Adjust for possible NANs.
bool maybe_nan = drop_nan (min, ninf);
maybe_nan |= drop_nan (max, inf);
r.set (type, min, max);
// Clear NAN bit if neither the result nor the operands are NAN.
if (!HONOR_NANS (type)
|| (!maybe_nan && !op1.maybe_nan () && !op2.maybe_nan ()))
r.clear_nan ();
return true;
}
Future ranger work (4)
• Frange improvements (GCC 13/14 ops, subranges, builtins, libs).
• Final VRP replacement with ranger (GCC13/14).
• irange conversion to wide-ints (GCC13/14).
• prange: pointer ranges (GCC13/14).
• Fast -O0 ranger (GCC14).
• One threader to rule them all (GCC14).
• DOM replacement with FRE (GCC14).
QUESTIONS

More Related Content

Similar to 2022-ranger-update-Cauldron for gcc versions

Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macros
univalence
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
Yekmer Simsek
 

Similar to 2022-ranger-update-Cauldron for gcc versions (20)

Java
JavaJava
Java
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Workshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScriptWorkshop 1: Good practices in JavaScript
Workshop 1: Good practices in JavaScript
 
Clojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVMClojure: Practical functional approach on JVM
Clojure: Practical functional approach on JVM
 
Rust for professionals.pdf
Rust for professionals.pdfRust for professionals.pdf
Rust for professionals.pdf
 
Code Generation in PHP - PHPConf 2015
Code Generation in PHP - PHPConf 2015Code Generation in PHP - PHPConf 2015
Code Generation in PHP - PHPConf 2015
 
Pune Clojure Course Outline
Pune Clojure Course OutlinePune Clojure Course Outline
Pune Clojure Course Outline
 
C programming language tutorial
C programming language tutorial C programming language tutorial
C programming language tutorial
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
Beyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic AnalysisBeyond Breakpoints: A Tour of Dynamic Analysis
Beyond Breakpoints: A Tour of Dynamic Analysis
 
COLLADA & WebGL
COLLADA & WebGLCOLLADA & WebGL
COLLADA & WebGL
 
Writing Macros
Writing MacrosWriting Macros
Writing Macros
 
My favorite slides
My favorite slidesMy favorite slides
My favorite slides
 
Introduction aux Macros
Introduction aux MacrosIntroduction aux Macros
Introduction aux Macros
 
Spark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with SparkSpark 4th Meetup Londond - Building a Product with Spark
Spark 4th Meetup Londond - Building a Product with Spark
 
Developing High Performance Websites and Modern Apps with JavaScript and HTML5
Developing High Performance Websites and Modern Apps with JavaScript and HTML5Developing High Performance Websites and Modern Apps with JavaScript and HTML5
Developing High Performance Websites and Modern Apps with JavaScript and HTML5
 
Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0Intro to OpenGL ES 2.0
Intro to OpenGL ES 2.0
 
Addressing Scenario
Addressing ScenarioAddressing Scenario
Addressing Scenario
 
Kamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, codeKamil witecki asynchronous, yet readable, code
Kamil witecki asynchronous, yet readable, code
 
Android Best Practices
Android Best PracticesAndroid Best Practices
Android Best Practices
 

More from ssuser866937

More from ssuser866937 (11)

GNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldronGNU Toolchain Infrastructure at gcc cauldron
GNU Toolchain Infrastructure at gcc cauldron
 
Ctrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in pragueCtrl-C redesign for gcc cauldron in 2022 in prague
Ctrl-C redesign for gcc cauldron in 2022 in prague
 
cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022cauldron-2022-docs-bof at gcc cauldron in 2022
cauldron-2022-docs-bof at gcc cauldron in 2022
 
Cauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in pragueCauldron_2022_ctf_frame at gcc cauldron 2022 in prague
Cauldron_2022_ctf_frame at gcc cauldron 2022 in prague
 
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdfBoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
BoF-OpenMP-OpenACC-Offloading-Cauldron2022.pdf
 
Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022Anatomy of ROCgdb presentation at gcc cauldron 2022
Anatomy of ROCgdb presentation at gcc cauldron 2022
 
2022 Cauldron Value Numbering for gcc versions
2022 Cauldron Value Numbering for gcc versions2022 Cauldron Value Numbering for gcc versions
2022 Cauldron Value Numbering for gcc versions
 
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
2022-Cauldron-If-Conversion-for-a-Partially-Predicated-VLIW-Architecture.pdf
 
2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolm2022 Cauldron analyzer talk from david malcolm
2022 Cauldron analyzer talk from david malcolm
 
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdfOpenMP-OpenACC-Offload-Cauldron2022-1.pdf
OpenMP-OpenACC-Offload-Cauldron2022-1.pdf
 
cs.ds-2211.13454.pdf
cs.ds-2211.13454.pdfcs.ds-2211.13454.pdf
cs.ds-2211.13454.pdf
 

Recently uploaded

( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 

Recently uploaded (20)

Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 

2022-ranger-update-Cauldron for gcc versions

  • 1. Aldy Hernandez <aldyh@redhat.com> Project Ranger update (GCC 13) September 2022
  • 2. Ranger Intro • On-demand property propagation engine. • a.k.a. 6 month project turned into 10 person years.
  • 3. Outline 1. Type agnostic ranger. 2. Floating point ranges. 3. Enhancing ranger for fun and profit. 4. Upcoming work.
  • 4. (vrange) Type agnostic ranger (1) class vrange { public: virtual void set (tree, tree, value_range_kind = VR_RANGE); virtual tree type () const; virtual bool supports_type_p (const_tree type) const; virtual void set_varying (tree type); virtual void set_undefined (); virtual bool union_ (const vrange &); virtual bool intersect (const vrange &); virtual bool singleton_p (tree *result = NULL) const; virtual bool contains_p (tree cst) const; virtual bool zero_p () const; virtual bool nonzero_p () const; virtual void set_nonzero (tree type); virtual void set_zero (tree type); virtual void set_nonnegative (tree type); virtual bool fits_p (const vrange &r) const; };
  • 5. (vrange) Temporaries (1) class Value_Range { public: bool varying_p () const; bool undefined_p () const; bool union_ (const vrange &r); bool intersect (const vrange &r); <etc> <etc> operator vrange &(); private: vrange *m_vrange; // Pointer to active temporary. int_range_max m_irange; // Integer temporary. frange m_frange; // Floating point temporary. unsupported_range m_unsupported; // Unsupported temporary. }; value_range temp; // old world Value_Range temp (some_type); // new world
  • 6. (vrange) Global range storage (1) • Can store full resolution ranges. • Never loses information (*). • As efficient as we want to make it • Uses same set_range_info() API.
  • 7. Floating point ranges (frange) (2) “I told you it would be complicated, and hard and take forever, but no… you insisted we needed float support.” Andrew MacLeod
  • 8. Floating point ranges (frange) (2) // Symbolic relational operators. if (x > y) { if (x == y) link_error (); }
  • 9. Floating point ranges (frange) (2) // Propagation of NANs and INFs. if (x > y) { // x is not a NAN // y is not a NAN // x is not -INF // y is not +INF }
  • 10. Floating point ranges (frange) (2) // Intervals for ranges. if (x >= 5.0) { // x is not a NAN // x is [5.0, +INF] } else { // x is [-INF, 5.0] U [NAN] }
  • 11. Floating point ranges (frange) (2) // Signed zeros. if (x == 0.0) { if (__builtin_sign (x)) y = x; // y = -0.0 else z = x; // z = +0.0 }
  • 12. (frange) fpclassify-like API (2) bool maybe_isinf () const; bool known_isinf () const; bool known_isfinite () const; bool maybe_isnan () const; bool known_isnan () const; bool signbit_p (bool &signbit) const; bool known_normal () const; bool maybe_normal () const;
  • 13. (enhancing) Solving a 17 year old PR (24021) (3) <bb 2>: i_17 = 2.100000029802322476513154470012523233890533447265625e-1; i_22 = i_17 + 1.00000001490116119384765625e-1; i_27 = i_22 + 1.00000001490116119384765625e-1; i_32 = i_27 + 1.00000001490116119384765625e-1; i_37 = i_32 + 1.00000001490116119384765625e-1; i_42 = i_37 + 1.00000001490116119384765625e-1; i_47 = i_42 + 1.00000001490116119384765625e-1; i_52 = i_47 + 1.00000001490116119384765625e-1; if (i_52 == 0.0) goto <bb 4>; else goto <bb 3>;
  • 14. (enhancing) Template for new operators (3) class foperator_plus : public range_operator_float { public: // r = op1 .op. op2 bool fold_range (frange &r, tree type, const frange &op1, const frange &op2, relation_kind rel) const final override { r.set_varying (type); return true; } } fop_plus; floating_op_table::floating_op_table () { set (EQ_EXPR, fop_equal); set (NE_EXPR, fop_not_equal); // etc // etc set (PLUS_EXPR, fop_plus); }
  • 15. (enhancing) PLUS_EXPR implementation (3) bool foperator_plus::fold_range (frange &r, tree type, const frange &op1, const frange &op2, relation_kind) const { // Propagate known NANs. if (op1.known_isnan () || op2.known_isnan ()) { r.set_nan (type); return true; } // [a, b] + [c, d] = [a+c, b+d] REAL_VALUE_TYPE min, max; frange_arithmetic (PLUS_EXPR, type, min, op1.lower_bound (), op2.lower_bound (), ninf); frange_arithmetic (PLUS_EXPR, type, max, op1.upper_bound (), op2.upper_bound (), inf); // Adjust for possible NANs. bool maybe_nan = drop_nan (min, ninf); maybe_nan |= drop_nan (max, inf); r.set (type, min, max); // Clear NAN bit if neither the result nor the operands are NAN. if (!HONOR_NANS (type) || (!maybe_nan && !op1.maybe_nan () && !op2.maybe_nan ())) r.clear_nan (); return true; }
  • 16. Future ranger work (4) • Frange improvements (GCC 13/14 ops, subranges, builtins, libs). • Final VRP replacement with ranger (GCC13/14). • irange conversion to wide-ints (GCC13/14). • prange: pointer ranges (GCC13/14). • Fast -O0 ranger (GCC14). • One threader to rule them all (GCC14). • DOM replacement with FRE (GCC14).