[PATCH] D102367: [LowerConstantIntrinsics] only accept ConstantData other than UndefValue as constant

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 16:42:17 PDT 2021


nickdesaulniers added a comment.

> While I think it would be correct to return i1 true when passing undef ..., it would also be correct to return i1 false

I think it's better to return `i1 false`, otherwise we diverge from GCC on the test case I provided above:

  int foo(void) {
      int i;
      return __builtin_constant_p(i);
  }

(and disagree with ourselves when optimizations are enabled). https://godbolt.org/z/P8onTznMj I'm fixing early-cse and instcombine now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102367



More information about the llvm-commits mailing list