pranavk / spatial-computing

This repository contains LLVM compiler passes (for now) to convert a C/C++ program to PDM (a synthesizable dataflow intermediate representation)
Apache License 2.0
5 stars 1 forks source link

dfg pass: faulty dfg transformation for phi nodes #4

Open pranavk opened 9 years ago

pranavk commented 9 years ago

While converting the existing Control flow to Data flow graph there are some logic problems when dealing with PHI nodes that results in faulty DFG from given CFG.

The syntax of PHI nodes is like this - su.0 = phi i32 [0, %0], [%su.1, %"5"]

The current pass will directly connect the output of su.1 to su.0 but this is not the correct output. Instead it means that su.1 should be connected to su.0 from %"5" labeled block. So su.1 should be connected to su.0 gated via the predicate that one encounters while traversing from the definition of su.0 to the labeled block.