[Beignet] [PATCH 02/18] GBE: Remove BBs if it only has a label instruction.

Song, Ruiling ruiling.song at intel.com
Wed Apr 2 20:24:10 PDT 2014


What I prefer is after you add a CFG Simplify pass, you can add an assert in the backend if we meet empty BB. Suppose this should not occur anymore.
My concern is we may further gather some CFG info besides "loopInfo" to GEN IR. So, when adding new info logic need an extra label Fix here.

At least I think you can let removeEmptyLabels() return quickly if there is no empty BBs.
> +        }
> +        revLabelMap.insert(std::make_pair(next, index));
> +        insn->remove();
> +        removeBlock(&BB);
> +      }
> +    });

If no empty BB. Simply return here.

> +    // fix labels for loops
> +    for (auto &x : loops) {
> +      for (auto &y : x->bbs) {
> +        if (labelMap.find(y) != labelMap.end())
> +          y = labelMap.find(y)->second;
> +      }
> +
> +      for (auto &z : x->exits) {
> +        if (labelMap.find(z.first) != labelMap.end())
> +          z.first = labelMap.find(z.first)->second;
> +        if (labelMap.find(z.second) != labelMap.end())
> +          z.second = labelMap.find(z.second)->second;
> +      }
> +    }
> + 



More information about the Beignet mailing list