[gcc]
2017-07-12 Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Return
early if there is no lhs.
[testsuite]
2017-07-12 Will Schmidt <will_schmidt@vnet.ibm.com>
* gcc.target/powerpc/fold-vec-missing-lhs: New.
From-SVN: r250185
+ 2017-07-13 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Return
+ early if there is no lhs.
+
2017-07-13 Martin Liska <mliska@suse.cz>
* dwarf2out.c (gen_pointer_type_die): Remove dead code.
= (enum rs6000_builtins) DECL_FUNCTION_CODE (fndecl);
tree arg0, arg1, lhs;
+ /* Generic solution to prevent gimple folding of code without a LHS. */
+ if (!gimple_call_lhs (stmt))
+ return false;
+
switch (fn_code)
{
/* Flavors of vec_add. We deliberately don't expand
+ 2017-07-13 Will Schmidt <will_schmidt@vnet.ibm.com>
+
+ * gcc.target/powerpc/fold-vec-missing-lhs.c: New.
+
2017-07-13 Martin Liska <mliska@suse.cz>
* c-c++-common/ubsan/sanitize-all-1.c: Update scanned pattern.
--- /dev/null
+/* This test is meant to verify that the gimple-folding does not
+ occur when the LHS portion of an expression is missing.
+ The intent of this test is to verify that we do not generate an ICE.
+ This was noticed during debug of PR81317. */
+
+/* { dg-do compile } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+#include <altivec.h>
+
+vector signed short
+test1_nolhs (vector bool short x, vector signed short y)
+{
+ vec_add (x, y);
+ return vec_add (x, y);
+}
+
+vector signed short
+test2_nolhs (vector signed short x, vector bool short y)
+{
+ vec_add (x, y);
+ return vec_add (x, y);
+}