提交 b4b14d9b 编写于 作者: C cfang

6876276: assert(!is_visited,"visit only once")

Summary: schedule the superword loads based on dependence constraints
Reviewed-by: kvn, never
上级 56e46bd6
...@@ -990,8 +990,8 @@ void SuperWord::remove_and_insert(MemNode *current, MemNode *prev, MemNode *lip, ...@@ -990,8 +990,8 @@ void SuperWord::remove_and_insert(MemNode *current, MemNode *prev, MemNode *lip,
// (5) We know there is no dependence cycle, so there in no other case; // (5) We know there is no dependence cycle, so there in no other case;
// (6) Finally, all memory ops in another single pack should be moved in the same direction. // (6) Finally, all memory ops in another single pack should be moved in the same direction.
// //
// To schedule a load pack: the memory edge of every loads in the pack must be // To schedule a load pack, we use the memory state of either the first or the last load in
// the same as the memory edge of the last executed load in the pack // the pack, based on the dependence constraint.
void SuperWord::co_locate_pack(Node_List* pk) { void SuperWord::co_locate_pack(Node_List* pk) {
if (pk->at(0)->is_Store()) { if (pk->at(0)->is_Store()) {
MemNode* first = executed_first(pk)->as_Mem(); MemNode* first = executed_first(pk)->as_Mem();
...@@ -1076,15 +1076,32 @@ void SuperWord::co_locate_pack(Node_List* pk) { ...@@ -1076,15 +1076,32 @@ void SuperWord::co_locate_pack(Node_List* pk) {
current = my_mem->as_Mem(); current = my_mem->as_Mem();
} // end while } // end while
} else if (pk->at(0)->is_Load()) { //load } else if (pk->at(0)->is_Load()) { //load
// all use the memory state that the last executed load uses // all loads in the pack should have the same memory state. By default,
LoadNode* last_load = executed_last(pk)->as_Load(); // we use the memory state of the last load. However, if any load could
Node* last_mem = last_load->in(MemNode::Memory); // not be moved down due to the dependence constraint, we use the memory
_igvn.hash_delete(last_mem); // state of the first load.
// Give each load same memory state as last Node* last_mem = executed_last(pk)->in(MemNode::Memory);
Node* first_mem = executed_first(pk)->in(MemNode::Memory);
bool schedule_last = true;
for (uint i = 0; i < pk->size(); i++) {
Node* ld = pk->at(i);
for (Node* current = last_mem; current != ld->in(MemNode::Memory);
current=current->in(MemNode::Memory)) {
assert(current != first_mem, "corrupted memory graph");
if(current->is_Mem() && !independent(current, ld)){
schedule_last = false; // a later store depends on this load
break;
}
}
}
Node* mem_input = schedule_last ? last_mem : first_mem;
_igvn.hash_delete(mem_input);
// Give each load the same memory state
for (uint i = 0; i < pk->size(); i++) { for (uint i = 0; i < pk->size(); i++) {
LoadNode* ld = pk->at(i)->as_Load(); LoadNode* ld = pk->at(i)->as_Load();
_igvn.hash_delete(ld); _igvn.hash_delete(ld);
ld->set_req(MemNode::Memory, last_mem); ld->set_req(MemNode::Memory, mem_input);
_igvn._worklist.push(ld); _igvn._worklist.push(ld);
} }
} }
......
...@@ -45,7 +45,7 @@ public class Test1 { ...@@ -45,7 +45,7 @@ public class Test1 {
for (int i = 0; i < src.length; i++) { for (int i = 0; i < src.length; i++) {
if (src[i] != ref[i]) { if (src[i] != ref[i]) {
System.out.println("Error: src and ref don't match at " + i); System.out.println("Error: src and ref don't match at " + i);
System.exit(-1); System.exit(97);
} }
} }
} }
......
...@@ -51,7 +51,7 @@ public class Test2 { ...@@ -51,7 +51,7 @@ public class Test2 {
int value = (i-1 + src.length)%src.length; // correct value after shifting int value = (i-1 + src.length)%src.length; // correct value after shifting
if (src[i] != value) { if (src[i] != value) {
System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]); System.out.println("Error: src["+i+"] should be "+ value + " instead of " + src[i]);
System.exit(-1); System.exit(97);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册