summaryrefslogtreecommitdiff
path: root/Source/VCGeneration/VC.cs
diff options
context:
space:
mode:
authorGravatar Unknown <afd@afd-THINK>2012-09-24 16:11:32 +0100
committerGravatar Unknown <afd@afd-THINK>2012-09-24 16:11:32 +0100
commit75c3147f8dc77eb25d77090956645c55943e2052 (patch)
tree4472fa9af20025cf5b58e7b3bbbd54a46a7ad1df /Source/VCGeneration/VC.cs
parent07bfca4b8bb403152385b6713be34e2e210f5962 (diff)
Fixed issue with uniformity analysis and block merging. Uniformity analysis
now enabled by default.
Diffstat (limited to 'Source/VCGeneration/VC.cs')
-rw-r--r--Source/VCGeneration/VC.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/VCGeneration/VC.cs b/Source/VCGeneration/VC.cs
index 2ac8dc83..e7f5999a 100644
--- a/Source/VCGeneration/VC.cs
+++ b/Source/VCGeneration/VC.cs
@@ -3042,15 +3042,20 @@ namespace VC {
/// <summary>
/// Simplifies the CFG of the given implementation impl by merging each
/// basic block with a single predecessor into that predecessor if the
- /// predecessor has a single successor.
+ /// predecessor has a single successor. If a uniformity analyser is
+ /// being used then block will only be merged if they are both uniform
+ /// or both non-uniform
/// </summary>
- public static void MergeBlocksIntoPredecessors(Program prog, Implementation impl) {
+ public static void MergeBlocksIntoPredecessors(Program prog, Implementation impl, UniformityAnalyser uni) {
var blockGraph = prog.ProcessLoops(impl);
var predMap = new Dictionary<Block, Block>();
foreach (var block in blockGraph.Nodes) {
try {
var pred = blockGraph.Predecessors(block).Single();
- if (blockGraph.Successors(pred).Single() == block) {
+ if (blockGraph.Successors(pred).Single() == block &&
+ (uni == null ||
+ (uni.IsUniform(impl.Name, pred) && uni.IsUniform(impl.Name, block)) ||
+ (!uni.IsUniform(impl.Name, pred) && !uni.IsUniform(impl.Name, block)))) {
Block predMapping;
while (predMap.TryGetValue(pred, out predMapping))
pred = predMapping;