[LLVMdev] Should we add noduplicate attribute on the function which contains a noduplicate function call?

Yi-Hong Lyu b95705030 at ntu.edu.tw
Tue Feb 10 14:01:09 PST 2015


Hello all,

I have a question related to noduplicate attribute.

For example, if I have the following source code:

__attribute__((noduplicate)) __attribute__((always_inline)) void wait () {
    // some code
    barrier();
    // some code
}

__attribute__((noduplicate)) void barrier ();

void f () {
    // some code
    wait();
    // some code
}

Sometimes I observed a phenomenon that SimplifyCFGPass would transform
function f to:

void f () {
    // some code
    wait();
    // some code
critedge:
    // some code
    wait();
    // some code
}

After the execution of AlwaysInliner, the function f would be:

void f () {
    // some code
    barrier();
    // some code
critedge:
    // some code
    barrier();
    // some code
}

It seems that barrier call is duplicated in function f. I am wondering
whether it is a bug of LLVM. Should we add noduplicate attribute on the
function which contains a noduplicate function call?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150211/07d16faf/attachment.html>


More information about the llvm-dev mailing list