[llvm-commits] [PATCH] Remove readonly/readnone attributes from all called functions

Evgeniy Stepanov eugenis at google.com
Thu Dec 6 01:15:39 PST 2012


  Lets say function A calls function B.
  When we instrument  A, we do so assuming that B is non-readonly - for example, it will write to __msan_retval_tls global variable. If by the end of runOnFunction(A) function B is still marked readonly, some other optimization pass running on A may optimize out code that propagates or checks shadow of B's return value.

  Because function passes for different functions may be interleaved, we can't wait till runOnFunction(B) to update B's attributes. A instrumentation and B becoming not readonly must happen at the same time.

  In fact, it seems that readonly/readnone attributes are set in a non-functionpass FunctionAttrs, which means we can clear the attributes in MemorySanitizer.doInitialization for all functions in a module. How does this sound?

  I'm also not entirely convinced that removing readonly attribute is a safe operation in itself. There could have been optimization already applied to the function's callers that rely on the fact that the function is readonly.

http://llvm-reviews.chandlerc.com/D173



More information about the llvm-commits mailing list