src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 8129893 Sdiff src/share/vm/opto

src/share/vm/opto/superword.cpp

Print this page




 166       if (n_tail != n->in(LoopNode::EntryControl)) {
 167         if (!n_tail->is_Mem()) {
 168           is_slp = false;
 169           break;
 170         }
 171       }
 172     }
 173 
 174     // This must happen after check of phi/if
 175     if (n->is_Phi() || n->is_If()) {
 176       ignored_loop_nodes[i] = n->_idx;
 177       continue;
 178     }
 179 
 180     if (n->is_LoadStore() || n->is_MergeMem() ||
 181       (n->is_Proj() && !n->as_Proj()->is_CFG())) {
 182       is_slp = false;
 183       break;
 184     }
 185 


 186     if (n->is_Mem()) {
 187       MemNode* current = n->as_Mem();
 188       BasicType bt = current->memory_type();


 189       if (is_java_primitive(bt) == false) {
 190         ignored_loop_nodes[i] = n->_idx;
 191         continue;
 192       }



 193       Node* adr = n->in(MemNode::Address);
 194       Node* n_ctrl = _phase->get_ctrl(adr);
 195 
 196       // save a queue of post process nodes
 197       if (n_ctrl != NULL && lpt()->is_member(_phase->get_loop(n_ctrl))) {
 198         // Process the memory expression
 199         int stack_idx = 0;
 200         bool have_side_effects = true;
 201         if (adr->is_AddP() == false) {
 202           nstack.push(adr, stack_idx++);
 203         } else {
 204           // Mark the components of the memory operation in nstack
 205           SWPointer p1(current, this, &nstack, true);
 206           have_side_effects = p1.node_stack()->is_nonempty();
 207         }
 208 
 209         // Process the pointer stack
 210         while (have_side_effects) {
 211           Node* pointer_node = nstack.node();
 212           for (uint j = 0; j < lpt()->_body.size(); j++) {


 214             if (cur_node == pointer_node) {
 215               ignored_loop_nodes[j] = cur_node->_idx;
 216               break;
 217             }
 218           }
 219           nstack.pop();
 220           have_side_effects = nstack.is_nonempty();
 221         }
 222       }
 223     }
 224   }
 225 
 226   if (is_slp) {
 227     // Now we try to find the maximum supported consistent vector which the machine
 228     // description can use
 229     for (uint i = 0; i < lpt()->_body.size(); i++) {
 230       if (ignored_loop_nodes[i] != -1) continue;
 231 
 232       BasicType bt;
 233       Node* n = lpt()->_body.at(i);
 234       if (n->is_Store()) {
 235         bt = n->as_Mem()->memory_type();
 236       } else {
 237         bt = n->bottom_type()->basic_type();
 238       }

 239 
 240       int cur_max_vector = Matcher::max_vector_size(bt);
 241 
 242       // If a max vector exists which is not larger than _local_loop_unroll_factor
 243       // stop looking, we already have the max vector to map to.
 244       if (cur_max_vector <= local_loop_unroll_factor) {
 245         is_slp = false;
 246 #ifndef PRODUCT
 247         if (TraceSuperWordLoopUnrollAnalysis) {
 248           tty->print_cr("slp analysis fails: unroll limit equals max vector\n");
 249         }
 250 #endif
 251         break;
 252       }
 253 
 254       // Map the maximal common vector
 255       if (VectorNode::implemented(n->Opcode(), cur_max_vector, bt)) {
 256         if (cur_max_vector < max_vector) {
 257           max_vector = cur_max_vector;
 258         }




 166       if (n_tail != n->in(LoopNode::EntryControl)) {
 167         if (!n_tail->is_Mem()) {
 168           is_slp = false;
 169           break;
 170         }
 171       }
 172     }
 173 
 174     // This must happen after check of phi/if
 175     if (n->is_Phi() || n->is_If()) {
 176       ignored_loop_nodes[i] = n->_idx;
 177       continue;
 178     }
 179 
 180     if (n->is_LoadStore() || n->is_MergeMem() ||
 181       (n->is_Proj() && !n->as_Proj()->is_CFG())) {
 182       is_slp = false;
 183       break;
 184     }
 185 
 186     // Ignore nodes with non-primitive type.
 187     BasicType bt;
 188     if (n->is_Mem()) {
 189       bt = n->as_Mem()->memory_type();
 190     } else {
 191       bt = n->bottom_type()->basic_type();
 192     }
 193     if (is_java_primitive(bt) == false) {
 194       ignored_loop_nodes[i] = n->_idx;
 195       continue;
 196     }
 197 
 198     if (n->is_Mem()) {
 199       MemNode* current = n->as_Mem();
 200       Node* adr = n->in(MemNode::Address);
 201       Node* n_ctrl = _phase->get_ctrl(adr);
 202 
 203       // save a queue of post process nodes
 204       if (n_ctrl != NULL && lpt()->is_member(_phase->get_loop(n_ctrl))) {
 205         // Process the memory expression
 206         int stack_idx = 0;
 207         bool have_side_effects = true;
 208         if (adr->is_AddP() == false) {
 209           nstack.push(adr, stack_idx++);
 210         } else {
 211           // Mark the components of the memory operation in nstack
 212           SWPointer p1(current, this, &nstack, true);
 213           have_side_effects = p1.node_stack()->is_nonempty();
 214         }
 215 
 216         // Process the pointer stack
 217         while (have_side_effects) {
 218           Node* pointer_node = nstack.node();
 219           for (uint j = 0; j < lpt()->_body.size(); j++) {


 221             if (cur_node == pointer_node) {
 222               ignored_loop_nodes[j] = cur_node->_idx;
 223               break;
 224             }
 225           }
 226           nstack.pop();
 227           have_side_effects = nstack.is_nonempty();
 228         }
 229       }
 230     }
 231   }
 232 
 233   if (is_slp) {
 234     // Now we try to find the maximum supported consistent vector which the machine
 235     // description can use
 236     for (uint i = 0; i < lpt()->_body.size(); i++) {
 237       if (ignored_loop_nodes[i] != -1) continue;
 238 
 239       BasicType bt;
 240       Node* n = lpt()->_body.at(i);
 241       if (n->is_Mem()) {
 242         bt = n->as_Mem()->memory_type();
 243       } else {
 244         bt = n->bottom_type()->basic_type();
 245       }
 246       if (is_java_primitive(bt) == false) continue;
 247 
 248       int cur_max_vector = Matcher::max_vector_size(bt);
 249 
 250       // If a max vector exists which is not larger than _local_loop_unroll_factor
 251       // stop looking, we already have the max vector to map to.
 252       if (cur_max_vector <= local_loop_unroll_factor) {
 253         is_slp = false;
 254 #ifndef PRODUCT
 255         if (TraceSuperWordLoopUnrollAnalysis) {
 256           tty->print_cr("slp analysis fails: unroll limit equals max vector\n");
 257         }
 258 #endif
 259         break;
 260       }
 261 
 262       // Map the maximal common vector
 263       if (VectorNode::implemented(n->Opcode(), cur_max_vector, bt)) {
 264         if (cur_max_vector < max_vector) {
 265           max_vector = cur_max_vector;
 266         }


src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File