[llvm] a184c75 - [BitCodeAnalyzer] Add a few missing TYPE_CODES and MODULE_CODE_COMDAT to GetCodeName
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 12 15:44:20 PDT 2020
Author: Craig Topper
Date: 2020-10-12T15:43:12-07:00
New Revision: a184c758b77dd6849eab2d46baa6a719780dd539
URL: https://github.com/llvm/llvm-project/commit/a184c758b77dd6849eab2d46baa6a719780dd539
DIFF: https://github.com/llvm/llvm-project/commit/a184c758b77dd6849eab2d46baa6a719780dd539.diff
LOG: [BitCodeAnalyzer] Add a few missing TYPE_CODES and MODULE_CODE_COMDAT to GetCodeName
Happened to notice some of these printing as UnknownCode while running llvm-bcanalyzer on a bc file I had.
Differential Revision: https://reviews.llvm.org/D86900
Added:
llvm/test/Bitcode/bcanalyzer-comdat.ll
llvm/test/Bitcode/bcanalyzer-types.ll
Modified:
llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
index 2ce064c7685a..e91af121ea08 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeAnalyzer.cpp
@@ -135,6 +135,7 @@ static Optional<const char *> GetCodeName(unsigned CodeID, unsigned BlockID,
STRINGIFY_CODE(MODULE_CODE, FUNCTION)
STRINGIFY_CODE(MODULE_CODE, ALIAS)
STRINGIFY_CODE(MODULE_CODE, GCNAME)
+ STRINGIFY_CODE(MODULE_CODE, COMDAT)
STRINGIFY_CODE(MODULE_CODE, VSTOFFSET)
STRINGIFY_CODE(MODULE_CODE, METADATA_VALUES_UNUSED)
STRINGIFY_CODE(MODULE_CODE, SOURCE_FILENAME)
@@ -176,16 +177,20 @@ static Optional<const char *> GetCodeName(unsigned CodeID, unsigned BlockID,
STRINGIFY_CODE(TYPE_CODE, OPAQUE)
STRINGIFY_CODE(TYPE_CODE, INTEGER)
STRINGIFY_CODE(TYPE_CODE, POINTER)
+ STRINGIFY_CODE(TYPE_CODE, HALF)
STRINGIFY_CODE(TYPE_CODE, ARRAY)
STRINGIFY_CODE(TYPE_CODE, VECTOR)
STRINGIFY_CODE(TYPE_CODE, X86_FP80)
STRINGIFY_CODE(TYPE_CODE, FP128)
STRINGIFY_CODE(TYPE_CODE, PPC_FP128)
STRINGIFY_CODE(TYPE_CODE, METADATA)
+ STRINGIFY_CODE(TYPE_CODE, X86_MMX)
STRINGIFY_CODE(TYPE_CODE, STRUCT_ANON)
STRINGIFY_CODE(TYPE_CODE, STRUCT_NAME)
STRINGIFY_CODE(TYPE_CODE, STRUCT_NAMED)
STRINGIFY_CODE(TYPE_CODE, FUNCTION)
+ STRINGIFY_CODE(TYPE_CODE, TOKEN)
+ STRINGIFY_CODE(TYPE_CODE, BFLOAT)
}
case bitc::CONSTANTS_BLOCK_ID:
diff --git a/llvm/test/Bitcode/bcanalyzer-comdat.ll b/llvm/test/Bitcode/bcanalyzer-comdat.ll
new file mode 100644
index 000000000000..931696ecd559
--- /dev/null
+++ b/llvm/test/Bitcode/bcanalyzer-comdat.ll
@@ -0,0 +1,5 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+
+; CHECK: <COMDAT
+$comdat.any = comdat any
+ at comdat.any = global i32 0, comdat
diff --git a/llvm/test/Bitcode/bcanalyzer-types.ll b/llvm/test/Bitcode/bcanalyzer-types.ll
new file mode 100644
index 000000000000..cbe6f5d22c94
--- /dev/null
+++ b/llvm/test/Bitcode/bcanalyzer-types.ll
@@ -0,0 +1,25 @@
+; RUN: llvm-as < %s | llvm-bcanalyzer -dump | FileCheck %s
+
+; CHECK: Block ID {{.*}} (TYPE_BLOCK_ID)
+; CHECK: BFLOAT
+; CHECK: TOKEN
+; CHECK: X86_MMX
+; CHECK: HALF
+; CHECK: Block ID
+
+define half @test_half(half %x, half %y) {
+ %a = fadd half %x, %y
+ ret half %a
+}
+
+define x86_mmx @test_mmx(<2 x i32> %x) {
+ %a = bitcast <2 x i32> %x to x86_mmx
+ ret x86_mmx %a
+}
+
+define bfloat @test_bfloat(i16 %x) {
+ %a = bitcast i16 %x to bfloat
+ ret bfloat %a
+}
+
+declare void @llvm.token(token)
More information about the llvm-commits
mailing list