Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang: fix nested loop unrolling #3016

Closed
wants to merge 1 commit into from

Conversation

rafaeldtinoco
Copy link
Contributor

It turns out that nested loop unrolling makes the unrolling transformation not to work in clang (at least for eBPF architecture):

./pkg/ebpf/c/common/common.h:83:5: warning: 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 [-Wpass-failed=transform-warning]

for (i = 0; i < n; prefix++, str++, i++) {
^

By having two "has_prefix" function versions, depending if the caller is already unrolling the loop or not, clang is able to transform the loop in multiple versions.

Fixes: #2624

It turns out that nested loop unrolling makes the unrolling
transformation not to work in clang (at least for eBPF architecture):

./pkg/ebpf/c/common/common.h:83:5: warning: 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 [-Wpass-failed=transform-warning]

    for (i = 0; i < n; prefix++, str++, i++) {
    ^

By having two "has_prefix" function versions, depending if the caller is
already unrolling the loop or not, clang is able to transform the loop
in multiple versions.

Fixes: #2624
@rafaeldtinoco
Copy link
Contributor Author

Vanilla 4.19 kernels (non CORE only) don't like this fix BUT they are going to be dropped with CORE only Tracee (#1651) so I'm closing this and will have this commit together with the non CORE drop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracee can't be compiled with clang 15
1 participant