I’m currently trying to develop new LLVM Pass that will generate
simple data dependencies graph. For now I’m trying to get familiar
My general idea is to traverse each function (runOnFunction)
top to bottom Instruction by Instruction, using DA.depends( I, I2, …)
on every Instructions combination in function to check if they are
dependent on any others.
Problem is that almost all (if not all) Instructions seems to be dependent
on others even if they write/read to/from different memory cells.
Also I’m getting Dependence (confused) object, not the FullDependence,
should i try to dynamically cast it to FullDependence, or is there a way
to determine which Dependence instance i got other way?
Please help, I’m not an C++ nor LLVM programmer, but PHP-developer,
however i need it done asap. If you can help just a little, give me a hint,
i’ll be very, very thankful for ANY support.
The DependenceAnalysis pass isn’t reliable yet; it has several errors that need to be corrected. These manifest by the analysis claiming there’s no dependence when one in fact exists.
Your proposed scheme of testing every pair of instructions is asymptotically expensive, requiring O(n^2) tests, where each test is already fairly expensive. I describe (or start to describe) a better approach here.
In the meantime, you should be getting better results than you report. You’ll want to use several other passes in conjunction with DA. Try something like
opt -basicaa -mem2reg -simplifycfg -loop-simplify -loop-rotate -simplifycfg -instcombine -indvars`` -da
Also, a confused dependences mean that the analysis wasn’t able to prove anything; a FullDependence means the analysis was able to prove some facts, though it wasn’t actually able to disprove the dependence. It’s not reasonable to cast a Dependence to a FullDependence.