[PATCH] D29092: PR31729: [GVNHoist] Don't hoist unsafe scalars at -Oz

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 17:09:43 PST 2017


efriedma added a comment.

> GVNHoist: 935 checks if Call->mayThrow() which checks if the call will unwind or not IIUC.

mayThrow() isn't really helpful here; consider:

  #include <stdlib.h>
  void f() { exit(0); }
  void (*ff)() = f;
  int r;
  int g(int x, int a) {
    if (a) {
      r = 999 / x;
      return 3;
    } else {
      ff();
      return 999 / x;
    }
  }
  int (*gg)(int, int) = g;
  int main() {
    gg(0, 0);
  }


https://reviews.llvm.org/D29092





More information about the llvm-commits mailing list