[RISCV][NFC] Move static global variables into static variable in function.
authorKito Cheng <kito.cheng@sifive.com>
Thu, 30 Jun 2022 02:28:21 +0000 (10:28 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Thu, 30 Jun 2022 02:30:01 +0000 (10:30 +0800)
commit1b8cde9b633841c7199b345132423dd3d6bdf3e7
tree384256de6f7c964912933b7e109c63ecce05ea75
parent9a572164d592ec439fea6b635c28698e5b194546
[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
clang/lib/Support/RISCVVIntrinsicUtils.cpp