It seems LLVM can now emit DDGs for each loop in a function (https://github.com/llvm/llvm-project/blob/llvmorg-12.0.1/llvm/lib/Analysis/DDGPrinter.cpp).
I am able to generate CFG and Callgraph with opt --dot-cfg foo.bc and with opt --dot-callgraph foo.bc, but the similar opt --dot-ddg-only foo.bc executes but generates no .dot file. I also tried opt -passes=dot-ddg foo.bc without success.
Is there another opt possible call? Or someone has suggestions for other similar tools?
C code used (foo.bc obtained with clang -c -emit-llvm foo.c -o foo.bc):
void foo(int b[], int c[], int n){
for (int i = 1; i < n; i++) {
b[i] = c[i] + b[i-1];
}
}
int main(){
int b[] = {1, 2, 3, 4, 5};
int c[] = {1, 1, 1, 1, 1};
foo(b, c, 5);
}
