diff mbox

PR63676, exit tree fold when node be TREE_CLOBBER_P

Message ID 545C9D80.9070007@arm.com
State New
Headers show

Commit Message

Jiong Wang Nov. 7, 2014, 10:22 a.m. UTC
the problem is caused by constant fold of node with TREE_CLOBBER_P be true.

according to rtl expander, the purpose of clobber is to mark the going out of scope.

             if (TREE_CLOBBER_P (rhs))
               /* This is a clobber to mark the going out of scope for
                  this LHS.  */

for vshuf-v16hi, there will be such node

   <bb 5>:
   r ={v} {CLOBBER};

while the new added "fold_all_stmts" since r216728 will invoke generic "fold"
and that function in fold-const.c has a bug when folding CONSTRUCTOR. we should not do
fold if the tree node is also with TREE_THIS_VOLATILE (t) be true, otherwise we will
generate extra insn during expand.

for example, above assignment will be transformed into

   r = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

while OImode immediate move is not supported when "-mcpu=cortex-a9 -mfloat-abi=softfp -mfpu=neon" specified,
thus trigger "insn_invalid_p" error for this testcase.

bootstrap ok on x86-64, no regression.
ICE on arm gone away.

ok to trunk?

gcc/
   PR tree/63676
   fold-const.c (fold): Do not fold node when TREE_CLOBBER_P be true.
diff mbox

Patch

diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index efcefa7..006fb70 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -14318,6 +14318,10 @@  fold (tree expr)
   if (kind == tcc_constant)
     return t;

+  /* Return right away if a TREE_CLOBBER node.  */
+  if (TREE_CLOBBER_P (t))
+    return t;
+
   /* CALL_EXPR-like objects with variable numbers of operands are
      treated specially.  */
   if (kind == tcc_vl_exp)