ssa2, src))
r2.intersect (tmp2);
}
+ // If the same name is specified in the condition and COND_EXPR,
+ // combine the calculated condition range and the other one provided. ie:
+ // c_1 = b_2 < 10
+ // f_3 = c_1 ? 0 : b_2
+ // With b_2 providing the false value, the value of f_3 will be
+ // either 0 UNION (0 = b_2 < 10), which is [-INF, 9].
+ // COND_EXPR is
+ if (ssa1 && cond_name == ssa1)
+ r1 = cond_true;
+ else if (ssa2 && cond_name == ssa2)
+ r2 = cond_false;
return true;
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options " -O3 -std=gnu++17 -ffinite-math-only -fdump-tree-optimized" } */
+
+#include <algorithm>
+#include <stdexcept>
+
+#define AINLINE
+
+class TestClass
+{
+public:
+ AINLINE void SetValue(float value);
+
+private:
+ float m_Value;
+};
+
+AINLINE
+void TestClass::SetValue(float value)
+{
+ if (value >= 0.0f && value <= 100.0f) {
+ m_Value = value;
+ }
+ else {
+ throw std::out_of_range("Value must be [0, 100].");
+ }
+}
+
+void TestFunc(TestClass& t, float value)
+{
+ value = std::clamp(value, 30.0f, 50.0f);
+ // When TestClass::SetValue is inlined, the exception throwing code is not eliminated.
+ // Given that at this point we can prove that 'value' lies in the range [30.0f, 50.0f] well within the range required by the setter function, we can rid the not taken paths of code.
+ t.SetValue(value);
+}
+
+
+/* { dg-final { scan-tree-dump-times "std::out_of_range::out_of_range" 1 "optimized" } } */
+