< prev index next >

src/share/vm/opto/cfgnode.cpp

Print this page




1872           }
1873           phase->is_IterGVN()->register_new_node_with_optimizer(base);
1874         }
1875         return new AddPNode(base, base, y);
1876       }
1877     }
1878   }
1879 
1880   // Split phis through memory merges, so that the memory merges will go away.
1881   // Piggy-back this transformation on the search for a unique input....
1882   // It will be as if the merged memory is the unique value of the phi.
1883   // (Do not attempt this optimization unless parsing is complete.
1884   // It would make the parser's memory-merge logic sick.)
1885   // (MergeMemNode is not dead_loop_safe - need to check for dead loop.)
1886   if (progress == NULL && can_reshape && type() == Type::MEMORY) {
1887     // see if this phi should be sliced
1888     uint merge_width = 0;
1889     bool saw_self = false;
1890     for( uint i=1; i<req(); ++i ) {// For all paths in
1891       Node *ii = in(i);






1892       if (ii->is_MergeMem()) {
1893         MergeMemNode* n = ii->as_MergeMem();
1894         merge_width = MAX2(merge_width, n->req());
1895         saw_self = saw_self || phase->eqv(n->base_memory(), this);
1896       }
1897     }
1898 
1899     // This restriction is temporarily necessary to ensure termination:
1900     if (!saw_self && adr_type() == TypePtr::BOTTOM)  merge_width = 0;
1901 
1902     if (merge_width > Compile::AliasIdxRaw) {
1903       // found at least one non-empty MergeMem
1904       const TypePtr* at = adr_type();
1905       if (at != TypePtr::BOTTOM) {
1906         // Patch the existing phi to select an input from the merge:
1907         // Phi:AT1(...MergeMem(m0, m1, m2)...) into
1908         //     Phi:AT1(...m1...)
1909         int alias_idx = phase->C->get_alias_index(at);
1910         for (uint i=1; i<req(); ++i) {
1911           Node *ii = in(i);




1872           }
1873           phase->is_IterGVN()->register_new_node_with_optimizer(base);
1874         }
1875         return new AddPNode(base, base, y);
1876       }
1877     }
1878   }
1879 
1880   // Split phis through memory merges, so that the memory merges will go away.
1881   // Piggy-back this transformation on the search for a unique input....
1882   // It will be as if the merged memory is the unique value of the phi.
1883   // (Do not attempt this optimization unless parsing is complete.
1884   // It would make the parser's memory-merge logic sick.)
1885   // (MergeMemNode is not dead_loop_safe - need to check for dead loop.)
1886   if (progress == NULL && can_reshape && type() == Type::MEMORY) {
1887     // see if this phi should be sliced
1888     uint merge_width = 0;
1889     bool saw_self = false;
1890     for( uint i=1; i<req(); ++i ) {// For all paths in
1891       Node *ii = in(i);
1892       // TOP inputs should not be counted as safe inputs because if the
1893       // Phi references itself through all other inputs then splitting the
1894       // Phi through memory merges would create dead loop at later stage.
1895       if (ii == top) {
1896         return NULL; // Delay optimization until graph is cleaned.
1897       }
1898       if (ii->is_MergeMem()) {
1899         MergeMemNode* n = ii->as_MergeMem();
1900         merge_width = MAX2(merge_width, n->req());
1901         saw_self = saw_self || phase->eqv(n->base_memory(), this);
1902       }
1903     }
1904 
1905     // This restriction is temporarily necessary to ensure termination:
1906     if (!saw_self && adr_type() == TypePtr::BOTTOM)  merge_width = 0;
1907 
1908     if (merge_width > Compile::AliasIdxRaw) {
1909       // found at least one non-empty MergeMem
1910       const TypePtr* at = adr_type();
1911       if (at != TypePtr::BOTTOM) {
1912         // Patch the existing phi to select an input from the merge:
1913         // Phi:AT1(...MergeMem(m0, m1, m2)...) into
1914         //     Phi:AT1(...m1...)
1915         int alias_idx = phase->C->get_alias_index(at);
1916         for (uint i=1; i<req(); ++i) {
1917           Node *ii = in(i);


< prev index next >