[llvm] [TableGen] Eliminate use of `convertInitializerTo` in SearchableTable (PR #109206)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 20 04:27:16 PDT 2024
================
@@ -31,17 +31,19 @@ using namespace llvm;
#define DEBUG_TYPE "searchable-table-emitter"
-namespace {
-
-int64_t getAsInt(Init *B) {
- return cast<IntInit>(
- B->convertInitializerTo(IntRecTy::get(B->getRecordKeeper())))
- ->getValue();
+static int64_t getAsInt(const Init *B) {
+ if (const BitsInit *BI = dyn_cast<BitsInit>(B))
+ return *BI->convertInitializerToInt();
+ else if (const IntInit *II = dyn_cast<IntInit>(BI))
----------------
jurahul wrote:
Done.
https://github.com/llvm/llvm-project/pull/109206
More information about the llvm-commits
mailing list