Anshunkang Zhou via llvm-dev
2020-Nov-13 08:41 UTC
[llvm-dev] Question about LLVM region analysis
Hi, developers, Recently, I am trying to use the LLVM Region analysis, the LLVM version is 10. I use opt to print out the region analysis result using "opt -view-regions-only region.ll". However, I am confused about the result produced by LLVM, I found that LLVM seems to skip loop preheader when grouping blocks into regions. Here is a simple example code: ```region.c void split(int a, int b) { int aaa = a * b; if (aaa > 100) { for (int i = 0; i < 100; i++) { printf("%d\n", i); if (i == 10) printf("asdsad\n"); } } else if (aaa < 100) { printf("elif\n"); } } ``` Running "opt -regions -analyze region.ll" I got: ``` Printing analysis 'Detect single entry single exit regions' for function 'split': Region tree: [0] entry => <Function Return> [1] entry => if.end9 [2] for.cond => for.end [3] for.body => if.end [2] if.else => if.end8 End region tree ``` LLVM uses "for.cond" as the entry and "for.end" as the exit, but there is a loop preheader block before "for.cond" named "if.then", using "if.then" as the entry can still get a legal region. So I wonder why LLVM does not contain the loop preheader into the region. The dot file is in the mail attachment. Thanks! -------------- next part -------------- A non-text attachment was scrubbed... Name: regonly-361ef8.dot.png Type: image/png Size: 51626 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20201113/cd419607/attachment-0001.png>
Maybe Matching Threads
- [LLVMdev] [Polly] Analysis of extra compile-time overhead for simple nested loops
- [LLVMdev] [Polly] Analysis of extra compile-time overhead for simple nested loops
- [LLVMdev] [Polly] Analysis of extra compile-time overhead for simple nested loops
- [LLVMdev] [Polly] Analysis of extra compile-time overhead for simple nested loops
- [LLVMdev] [Polly] Analysis of extra compile-time overhead for simple nested loops