|| TYPE_PRECISION (type) > 1)
&& wi::leu_p (tree_nonzero_bits (@1), 1))))
+/* VCE<bool>(zero_one) ==/!= false -> zero_one ==/!= 0.
+ This is done as SRA likes to create VCE for boolean accesses
+ and it helps code gneration and uninitialized variable warnings. */
+(for neeq (ne eq)
+ (simplify
+ (neeq (view_convert@0 zero_one_valued_p@1) integer_zerop)
+ (if (TREE_CODE (TREE_TYPE (@0)) == BOOLEAN_TYPE
+ && TYPE_PRECISION (TREE_TYPE (@0)) == 1
+ && TYPE_UNSIGNED (TREE_TYPE (@0)))
+ (neeq @1 { build_zero_cst (TREE_TYPE (@1)); } ))))
+
/* Transform { 0 or 1 } * { 0 or 1 } into { 0 or 1 } & { 0 or 1 }. */
(simplify
(mult zero_one_valued_p@0 zero_one_valued_p@1)
--- /dev/null
+// PR tree-optimization/80635
+// { dg-do compile { target c++11 } }
+// { dg-options "-O1 -Wmaybe-uninitialized" }
+
+using size_t = decltype (sizeof (1));
+inline void *operator new (size_t, void *p) { return p; }
+template<typename T>
+struct optional
+{
+ optional () : m_dummy (), live (false) {}
+ void emplace () { new (&m_item) T (); live = true; }
+ ~optional () { if (live) m_item.~T (); }
+
+ union
+ {
+ struct {} m_dummy;
+ T m_item;
+ };
+ bool live;
+};
+
+extern int get ();
+extern void set (int);
+
+struct A
+{
+ A () : m (get ()) {}
+ ~A () { set (m); } // { dg-bogus "may be used uninitialized in this function" }
+
+ int m;
+};
+
+struct B
+{
+ B ();
+ ~B ();
+};
+
+void func ()
+{
+ optional<A> maybe_a;
+ optional<B> maybe_b;
+
+ maybe_a.emplace ();
+ maybe_b.emplace ();
+}
--- /dev/null
+// PR tree-optimization/80635
+// { dg-do compile { target c++17 } }
+// { dg-options "-O1 -Wmaybe-uninitialized" }
+
+#include <optional>
+
+extern int get ();
+extern void set (int);
+
+struct A
+{
+ A () : m (get ()) {}
+ ~A () { set (m); } // { dg-bogus "may be used uninitialized in this function" }
+
+ int m;
+};
+
+struct B
+{
+ B ();
+ ~B ();
+};
+
+void func ()
+{
+ std::optional<A> maybe_a;
+ std::optional<B> maybe_b;
+
+ maybe_a.emplace ();
+ maybe_b.emplace ();
+}