[all-commits] [llvm/llvm-project] 1b8cde: [RISCV][NFC] Move static global variables into sta...

Kito Cheng via All-commits all-commits at lists.llvm.org
Wed Jun 29 19:30:15 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b8cde9b633841c7199b345132423dd3d6bdf3e7
      https://github.com/llvm/llvm-project/commit/1b8cde9b633841c7199b345132423dd3d6bdf3e7
  Author: Kito Cheng <kito.cheng at sifive.com>
  Date:   2022-06-30 (Thu, 30 Jun 2022)

  Changed paths:
    M clang/lib/Support/RISCVVIntrinsicUtils.cpp

  Log Message:
  -----------
  [RISCV][NFC] Move static global variables into static variable in function.

It's violate coding guideline in LLVM coding standard[1], because the  the initialization order is nondeterministic and that might increase the launch time of programs.

However these variables are only used to cache query result, so we can move these variables into the function,, that which resolve both issue: 1. initialized in deterministic order, 2. Initialized that when the first time used.

[1] https://llvm.org/docs/CodingStandards.html#do-not-use-static-constructors

Reviewed By: MaskRay

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




More information about the All-commits mailing list