[polly] one more slow pretty printing in the default path


in lib/Analysis/RegionPass.cpp there are 3 occurrences of:
These are slowing down compile times with polly.
I would suggest to either remove these calls,
or only turn on when the programmer asks for -debug.

The reason for the slow pretty printing of types is the same as
previously discussed in:


Just removing those calls looks like a hack as it yields -analyse output
without named regions.

On the other side, having calls to WriteAsOperand in Region::getNameStr() is the cause of this slowdown. It helps us to provide a reasonable way to name regions that do have unnamed basic blocks. If we can find a better/faster way to name such regions we could
remove the call to WriteAsOperand without regrets. We could e.g. just
assign an increasing number to each new region and just call them region_<number>.


I think it may be not easy to understand the mapping relationship between regions and basic blocks if we simplify call them region_. Since the key problem is to identify anonymous basic blocks, maybe we can try to obtain the sequence number of those anonymous basic blocks. In that case, we can simplify the Region:getNameStr() into:

if (getEntry()->getName().empty()) {
// raw_string_ostream OS(entryName);
// WriteAsOperand(OS, getEntry(), false);
entryName = “BB#” + getEntry()->getGlobalSequenceNumber(); //getGlobalSequenceNumber is required to be implemented!
} else
entryName = getEntry()->getName();

which is similar to the way used in MachineBasicBlock class. Of course, we need to implement the getGlbalSequenceNumber() or similar functions.

BTW, has anyone already had a testcase that will produce regions with anonymous basic block. I can have a try to fix this problem.