Implement trivial unswitching for switch stmts. This allows us to trivial
authorChris Lattner <sabre@nondot.org>
Wed, 15 Feb 2006 22:52:05 +0000 (22:52 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 15 Feb 2006 22:52:05 +0000 (22:52 +0000)
commita48654ef23c35d9d07e5c0cb80726ec788dae93a
treedef98c01859200808f58a07514f4f33b56ffbc09
parentfe1c31204e66b2e725e081614852a0e241e92f2f
Implement trivial unswitching for switch stmts.  This allows us to trivial
unswitch this loop on 2 before sweating to unswitch on 1/3.

void test4(int N, int i, int C, int*P, int*Q) {
  int j;
  for (j = 0; j < N; ++j) {
    switch (C) {                // general unswitching.
    default: P[i+j] = 0; break;
    case 1: Q[i+j] = 0; break;
    case 3: P[i+j] = Q[i+j]; break;
    case 2: break;              //  TRIVIAL UNSWITCH on C==2
    }
  }
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26223 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopUnswitch.cpp