[PATCH] D75815: [InstCombine] Simplify calls with "returned" attribute

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 11:22:55 PDT 2020


eugenis added a comment.

I agree that the example code is relying on the attribute behavior that is underspecified. In this case, no_sanitize("memory") functions, when compiled with MSan, give special meaning to returning a value from a function. As a lot of other things that MSan does, this one is kind of best effort - consider if the function has passed the value by address:

  int* KMSAN_DO_NOTHING(int *p) {
    return p;
  }

This int will not get initialized by the no_sanitize attribute.

We could attempt to preserve this behavior by

1. suppressing all IPA across sanitize/no_sanitize boundary, the same as we do with inlining. This could be hard to maintain.
2. not inferring the "returned" attribute in no_sanitize(memory) functions. This makes sense, because the function does not simply return that argument.

Or fix this in the user code with optnone or explicit call to __msan_unpoison.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75815/new/

https://reviews.llvm.org/D75815





More information about the llvm-commits mailing list