HomePhabricator

[SimplifyCFG] Optimize CFG when null is passed to a function with nonnull…

Authored by xbolva00 on Jan 15 2021, 2:07 PM.

Description

[SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument

Example:

__attribute__((nonnull,noinline)) char * pinc(char *p)  {
  return ++p;
}

char * foo(bool b, char *a) {
       return pinc(b ? 0 : a);

}

optimize to

char * foo(bool b, char *a) {
       return pinc(a);

}

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D94180

Details