Revert "tree-optimization/106809 - compile time hog in VN"

This reverts commit 051f78a5c1.
This commit is contained in:
Richard Biener
2023-05-04 09:39:12 +02:00
parent c642277ccb
commit 4ee3d035a9
2 changed files with 27 additions and 58 deletions

View File

@@ -1,28 +0,0 @@
/* { dg-do compile } */
/* { dg-additional-options "-Wuninitialized" } */
int foo (int x, int *val)
{
switch (x)
{
#define C(n) \
case n + 0: return *val; \
case n + 1: return *val; \
case n + 2: return *val; \
case n + 3: return *val; \
case n + 4: return *val; \
case n + 5: return *val; \
case n + 6: return *val; \
case n + 7: return *val; \
case n + 8: return *val; \
case n + 9: return *val;
#define C1(n) \
C(n+00) C(n+10) C(n+20) C(n+30) C(n+40) \
C(n+50) C(n+60) C(n+70) C(n+80) C(n+90)
#define C10(n) \
C1(n+000) C1(n+100) C1(n+200) C1(n+300) C1(n+400) \
C1(n+500) C1(n+600) C1(n+700) C1(n+800) C1(n+900)
C10(1000)
}
return 0;
}

View File

@@ -4509,44 +4509,41 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2, bool allow_back)
}
/* Iterate to the single executable bb2 successor. */
if (EDGE_COUNT (bb2->succs) > 1)
{
edge succe = NULL;
FOR_EACH_EDGE (e, ei, bb2->succs)
if ((e->flags & EDGE_EXECUTABLE)
|| (!allow_back && (e->flags & EDGE_DFS_BACK)))
edge succe = NULL;
FOR_EACH_EDGE (e, ei, bb2->succs)
if ((e->flags & EDGE_EXECUTABLE)
|| (!allow_back && (e->flags & EDGE_DFS_BACK)))
{
if (succe)
{
if (succe)
succe = NULL;
break;
}
succe = e;
}
if (succe)
{
/* Verify the reached block is only reached through succe.
If there is only one edge we can spare us the dominator
check and iterate directly. */
if (EDGE_COUNT (succe->dest->preds) > 1)
{
FOR_EACH_EDGE (e, ei, succe->dest->preds)
if (e != succe
&& ((e->flags & EDGE_EXECUTABLE)
|| (!allow_back && (e->flags & EDGE_DFS_BACK))))
{
succe = NULL;
break;
}
succe = e;
}
}
if (succe)
{
/* Verify the reached block is only reached through succe.
If there is only one edge we can spare us the dominator
check and iterate directly. */
if (EDGE_COUNT (succe->dest->preds) > 1)
{
FOR_EACH_EDGE (e, ei, succe->dest->preds)
if (e != succe
&& ((e->flags & EDGE_EXECUTABLE)
|| (!allow_back && (e->flags & EDGE_DFS_BACK))))
{
succe = NULL;
break;
}
}
if (succe)
{
bb2 = succe->dest;
bb2 = succe->dest;
/* Re-do the dominance check with changed bb2. */
if (dominated_by_p (CDI_DOMINATORS, bb1, bb2))
return true;
}
/* Re-do the dominance check with changed bb2. */
if (dominated_by_p (CDI_DOMINATORS, bb1, bb2))
return true;
}
}