[llvm-bugs] [Bug 41474] New: Implement __attribute__((noipa)) to make a function a black box for interprocedural optimizations

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 11 16:07:34 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41474

            Bug ID: 41474
           Summary: Implement __attribute__((noipa)) to make a function a
                    black box for interprocedural optimizations
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: comexk at gmail.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

Currently, Clang will always optimize this to `return 3`:

static int inner(int a) {
    return a + 1;
}
int outer() {
    return inner(2);
}

Notably, this happens even if inner is marked `noinline`, because of the
Interprocedural Sparse Conditional Constant Propagation pass.

This is unhelpful for various use cases, including:
- testing the compiler's code generation
- defining a dummy function whose purpose is to be a place to break in a
debugger

GCC has a function attribute `noipa`, whose effect is (to quote the manual):

> Disable interprocedural optimizations between the function with this attribute and its callers, as if the body of the function is not available when optimizing callers and the callers are unavailable when optimizing the body.

It would be good to support this in LLVM/Clang as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190411/31730061/attachment.html>


More information about the llvm-bugs mailing list