[llvm-dev] How to use the pass 'Unroll and Jam'

Das, Dibyendu via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 25 01:24:49 PDT 2019


Try the combo:

-enable-unroll-and-jam -allow-unroll-and-jam -unroll-and-jam-count=4

From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of ZHEN WEI via llvm-dev
Sent: Thursday, April 25, 2019 12:13 PM
To: llvm-dev at lists.llvm.org
Subject: [llvm-dev] How to use the pass 'Unroll and Jam'

Dear LLVM developers,

Recently I want to try the pass '-loop-unroll-and-jam' to observe how the IR is transformed, but I don't see the IR changed after doing the following steps.

Here are the details for preparing my experiment and I have tried the LLVM 6, 7 and 8:
1) Simple 2D array source code (loop.c) is given

```
#define M 32768
#define N 32768

double a[M][N], b[M][N], c[M][N];

int main() {
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < N; j++) {
            c[i][j] = a[i][j] + b[i][j];
        }
    }
    return 0;
}
```
2) Create an LLVM IR file
./bin/clang -O1 loop.c -emit-llvm -S -o loop.ll

3) Run the 'unroll-and-jam' pass
./bin/opt -loop-unroll-and-jam loop.ll -S -o loop-unrolljam.ll

I added the option '--debug-pass=Structure' to the opt, and I can see the 'Unroll and Jam loops' indeed executed by the Loop Pass Manager.
```
   ModulePass Manager
       FunctionPass Manager
        Dominator Tree Construction
        Basic Alias Analysis (stateless AA impl)
        Function Alias Analysis Results
        Natural Loop Information
        Scalar Evolution Analysis
        Dependence Analysis
        Canonicalize natural loops
        LCSSA Verifier
        Loop-Closed SSA Form Pass
        Loop Pass Manager
          Unroll and Jam loops
        Module Verifier
       Print Module IR
```

I also tried to add the option '-debug' to the opt to see if there is the debug information printed by LoopUnrollAndJam, but nothing.

Thank you very much.
--
Zhen Wei (魏禛)
Master Student
Department of Computer Science & Information  Engineering
National Taiwan University
Email:  zhenwei.tw at gmail.com<mailto:zhenwei.tw at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190425/47a84501/attachment.html>


More information about the llvm-dev mailing list