[llvm] [WIP] Extend data layout to add non zero null value for address space. (PR #83109)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 23:42:19 PST 2024
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 3356818eed3224c50012f8ed2bfa046f2bc8e154 540b9e8a21e883016aba3398cbbb8aabfefe06cb -- llvm/include/llvm/IR/DataLayout.h llvm/lib/IR/DataLayout.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/IR/DataLayout.h b/llvm/include/llvm/IR/DataLayout.h
index 75fd19efd7..7e41653718 100644
--- a/llvm/include/llvm/IR/DataLayout.h
+++ b/llvm/include/llvm/IR/DataLayout.h
@@ -21,10 +21,10 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Alignment.h"
@@ -303,10 +303,10 @@ public:
}
uint64_t getNonZeroValueForAddrSpace(uint64_t AddrSpace) {
- auto It = AddrSpaceToNonZeroValueMap.find(AddrSpace);
- if (It == AddrSpaceToNonZeroValueMap.end())
- return 0x000000000;
- return AddrSpaceToNonZeroValueMap[AddrSpace];
+ auto It = AddrSpaceToNonZeroValueMap.find(AddrSpace);
+ if (It == AddrSpaceToNonZeroValueMap.end())
+ return 0x000000000;
+ return AddrSpaceToNonZeroValueMap[AddrSpace];
}
void setNonZeroValueForAddrSpace(uint64_t AddrSpace, uint64_t Value) {
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 591b0fda66..83d0debdcc 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -511,14 +511,14 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
return reportError("Invalid address space, must be a 24-bit integer");
if (Rest.empty())
- return reportError(
- "Missing address space specification for pointer in datalayout string");
+ return reportError("Missing address space specification for pointer in "
+ "datalayout string");
if (Error Err = ::split(Rest, ':', Split))
return Err;
uint64_t Value;
if (Error Err = getInt(Tok, Value))
return Err;
-
+
setNonZeroValueForAddrSpace(AddrSpace, Value);
break;
``````````
</details>
https://github.com/llvm/llvm-project/pull/83109
More information about the llvm-commits
mailing list