[llvm] [llvm][IR] Add per-global code model attribute (PR #72077)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 12 18:50:37 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 18415c8365047841c4671798e0129ca9bbd03c40 1db42907230511288a3ebc8f2a7b1453d11e62ac -- llvm/include/llvm/AsmParser/LLParser.h llvm/include/llvm/AsmParser/LLToken.h llvm/include/llvm/IR/GlobalObject.h llvm/lib/AsmParser/LLLexer.cpp llvm/lib/AsmParser/LLParser.cpp llvm/lib/Bitcode/Reader/BitcodeReader.cpp llvm/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/lib/IR/AsmWriter.cpp llvm/lib/IR/Globals.cpp llvm/lib/IR/LLVMContextImpl.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/IR/GlobalObject.h b/llvm/include/llvm/IR/GlobalObject.h
index 08af50191a..ac402b92b2 100644
--- a/llvm/include/llvm/IR/GlobalObject.h
+++ b/llvm/include/llvm/IR/GlobalObject.h
@@ -17,8 +17,8 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Value.h"
-#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Alignment.h"
+#include "llvm/Support/CodeGen.h"
namespace llvm {
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 740692894e..6f1b1c107a 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1145,13 +1145,18 @@ static bool getDecodedDSOLocal(unsigned Val) {
}
static CodeModel::Model getDecodedCodeModel(unsigned Val) {
- switch(Val) {
- case 1: return CodeModel::Tiny;
+ switch (Val) {
+ case 1:
+ return CodeModel::Tiny;
default: // Map unknown values to small.
- case 2: return CodeModel::Small;
- case 3: return CodeModel::Kernel;
- case 4: return CodeModel::Medium;
- case 5: return CodeModel::Large;
+ case 2:
+ return CodeModel::Small;
+ case 3:
+ return CodeModel::Kernel;
+ case 4:
+ return CodeModel::Medium;
+ case 5:
+ return CodeModel::Large;
}
}
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 44f4b9e2dc..117d5208b9 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -1216,11 +1216,16 @@ static unsigned getEncodedCodeModel(const GlobalVariable &GV) {
if (!GV.hasCodeModel())
return 0;
switch (GV.getCodeModel()) {
- case CodeModel::Tiny: return 1;
- case CodeModel::Small: return 2;
- case CodeModel::Kernel: return 3;
- case CodeModel::Medium: return 4;
- case CodeModel::Large: return 5;
+ case CodeModel::Tiny:
+ return 1;
+ case CodeModel::Small:
+ return 2;
+ case CodeModel::Kernel:
+ return 3;
+ case CodeModel::Medium:
+ return 4;
+ case CodeModel::Large:
+ return 5;
}
llvm_unreachable("Invalid code model");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/72077
More information about the llvm-commits
mailing list