bool MemoryDependenceAnalysis::nonLocalHelper(Instruction* query,
BasicBlock* block,
- DenseMap<BasicBlock*, Value*>& resp) {
+ DenseMap<BasicBlock*, Value*>& resp,
+ SmallPtrSet<BasicBlock*, 4>& visited) {
if (resp.count(block))
return resp[block] != None;
return true;
}
+ visited.insert(block);
+
bool inserted = false;
for (pred_iterator PI = pred_begin(block), PE = pred_end(block);
PI != PE; ++PI)
- inserted |= nonLocalHelper(query, *PI, resp);
+ if (!visited.count(*PI))
+ inserted |= nonLocalHelper(query, *PI, resp, visited);
+
+ visited.erase(block);
if (!inserted)
resp.insert(std::make_pair(block, None));
}
bool inserted = false;
+ SmallPtrSet<BasicBlock*, 4> visited;
+ visited.insert(query->getParent());
BasicBlock* parent = query->getParent();
for (pred_iterator PI = pred_begin(parent), PE = pred_end(parent);
PI != PE; ++PI) {
- inserted |= nonLocalHelper(query, *PI, resp);
+ if (!visited.count(*PI))
+ inserted |= nonLocalHelper(query, *PI, resp, visited);
}
if (!inserted)
--- /dev/null
+; RUN: llvm-as < %s | opt -gvn | llvm-dis
+
+ %struct.s_segment_inf = type { float, i32, i16, i16, float, float, i32, float, float }
+
+define void @print_arch(i8* %arch_file, i32 %route_type, i64 %det_routing_arch.0.0, i64 %det_routing_arch.0.1, i64 %det_routing_arch.0.2, i64 %det_routing_arch.0.3, i64 %det_routing_arch.0.4, %struct.s_segment_inf* %segment_inf, i64 %timing_inf.0.0, i64 %timing_inf.0.1, i64 %timing_inf.0.2, i64 %timing_inf.0.3, i64 %timing_inf.0.4, i32 %timing_inf.1) {
+entry:
+ br i1 false, label %bb278, label %bb344
+
+bb278: ; preds = %bb278, %entry
+ br i1 false, label %bb278, label %bb344
+
+bb344: ; preds = %bb278, %entry
+ %tmp38758 = load i16* null, align 2 ; <i16> [#uses=0]
+ ret void
+}