[all-commits] [llvm/llvm-project] de579b: [LowerConstantIntrinsics] reuse isManifestLogic fr...

Nick Desaulniers via All-commits all-commits at lists.llvm.org
Mon May 17 11:16:49 PDT 2021


  Branch: refs/heads/release/12.x
  Home:   https://github.com/llvm/llvm-project
  Commit: de579bae6eabd02b815e549776b8c680957a0769
      https://github.com/llvm/llvm-project/commit/de579bae6eabd02b815e549776b8c680957a0769
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2021-05-17 (Mon, 17 May 2021)

  Changed paths:
    M llvm/include/llvm/IR/Constant.h
    M llvm/lib/Analysis/ConstantFolding.cpp
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp
    M llvm/test/Transforms/LowerConstantIntrinsics/constant-intrinsics.ll

  Log Message:
  -----------
  [LowerConstantIntrinsics] reuse isManifestLogic from ConstantFolding

GlobalVariables are Constants, yet should not unconditionally be
considered true for __builtin_constant_p.

Via the LangRef
https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic:

    This intrinsic generates no code. If its argument is known to be a
    manifest compile-time constant value, then the intrinsic will be
    converted to a constant true value. Otherwise, it will be converted
    to a constant false value.

    In particular, note that if the argument is a constant expression
    which refers to a global (the address of which _is_ a constant, but
    not manifest during the compile), then the intrinsic evaluates to
    false.

Move isManifestConstant from ConstantFolding to be a method of
Constant so that we can reuse the same logic in
LowerConstantIntrinsics.

pr/41459

Reviewed By: rsmith, george.burgess.iv

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

(cherry picked from commit 8c72749bd92d35397e93908bc5a504d4cbcef1cb)




More information about the All-commits mailing list