diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-10 11:39:56 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-10 11:39:56 +0100 |
commit | df0f6bbb3aa701b7d42aeefdf014eb73e9332d92 (patch) | |
tree | a12e468521e660fd6d2f0d9721b596e5336072f9 /gcc/gimple-loop-interchange.cc | |
parent | 629cc78bee7fdae342bc099ec3bde6cbce5172a8 (diff) | |
download | gcc-df0f6bbb3aa701b7d42aeefdf014eb73e9332d92.zip gcc-df0f6bbb3aa701b7d42aeefdf014eb73e9332d92.tar.gz gcc-df0f6bbb3aa701b7d42aeefdf014eb73e9332d92.tar.bz2 |
re PR tree-optimization/83337 (ICE at -O3 x86_64-linux-gnu: in interpret_rhs_expr, at tree-scalar-evolution.c:1775)
PR tree-optimization/83337
* gimple-loop-interchange.cc (compute_access_stride): Handle bitfield DRs
properly.
* gcc.dg/tree-ssa/loop-interchange-14.c: New test.
* gcc.dg/tree-ssa/loop-interchange-15.c: New test.
From-SVN: r255528
Diffstat (limited to 'gcc/gimple-loop-interchange.cc')
-rw-r--r-- | gcc/gimple-loop-interchange.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc index 3f7c54f..301b511 100644 --- a/gcc/gimple-loop-interchange.cc +++ b/gcc/gimple-loop-interchange.cc @@ -1291,6 +1291,30 @@ compute_access_stride (struct loop *loop_nest, struct loop *loop, gcc_assert (loop == bb->loop_father); tree ref = DR_REF (dr); + if (TREE_CODE (ref) == COMPONENT_REF + && DECL_BIT_FIELD (TREE_OPERAND (ref, 1))) + { + /* We can't take address of bitfields. If the bitfield is at constant + offset from the start of the struct, just use address of the + struct, for analysis of the strides that shouldn't matter. */ + if (!TREE_OPERAND (ref, 2) + || TREE_CODE (TREE_OPERAND (ref, 2)) == INTEGER_CST) + ref = TREE_OPERAND (ref, 0); + /* Otherwise, if we have a bit field representative, use that. */ + else if (DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (ref, 1)) + != NULL_TREE) + { + tree repr = DECL_BIT_FIELD_REPRESENTATIVE (TREE_OPERAND (ref, 1)); + ref = build3 (COMPONENT_REF, TREE_TYPE (repr), TREE_OPERAND (ref, 0), + repr, TREE_OPERAND (ref, 2)); + } + /* Otherwise punt. */ + else + { + dr->aux = strides; + return; + } + } tree scev_base = build_fold_addr_expr (ref); tree scev = analyze_scalar_evolution (loop, scev_base); scev = instantiate_scev (loop_preheader_edge (loop_nest), loop, scev); |