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: unassignedclangb...@nondot.org
          Reporter: com...@gmail.com
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to