How to fix loop not unrolled: the optimizer was unable to perform the requested transformation in clang?

17 Views Asked by At

When I try to use #pragma unroll, it throws error.

    CC       xdp_prog_user
    CLANG    xdp_prog_kern_02.o
    LLC      xdp_prog_kern_02.o
    CLANG    xdp_prog_kern_03.o
    LLC      xdp_prog_kern_03.o
    CLANG    tc_reply_kern_02.o
    LLC      tc_reply_kern_02.o
    CLANG    xdp_vlan01_kern.o
xdp_vlan01_kern.c:66:2: error: loop not unrolled: the optimizer was unable to perform the requested transformation; the transformation might be disabled or specified as part of an unsupported transformation ordering [-Werror,-Wpass-failed=transform-warning]
   66 |         for (i = 0; i < VLAN_MAX_DEPTH; i++) {
      |         ^
1 error generated.
make: *** [../common/common.mk:116: xdp_vlan01_kern.o] Error 1

I'm using the latest clang

pegasus@pegasus:~/Documents/xdp-tutorial/packet-solutions$ clang --version
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 815644b4dd882ade2e5649d4f97c3dd6f7aea200)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/pegasus/Documents/llvm-project/build/bin
0

There are 0 best solutions below