[llvm] fe6ca54 - [LangRef] Correct value ranges for address space, vector, and float bit sizes.
Michael Liao via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 18:54:55 PST 2023
Author: Michael Liao
Date: 2023-02-23T21:54:50-05:00
New Revision: fe6ca546825304e49a73eaa2c4ced57e1a8d6a5b
URL: https://github.com/llvm/llvm-project/commit/fe6ca546825304e49a73eaa2c4ced57e1a8d6a5b
DIFF: https://github.com/llvm/llvm-project/commit/fe6ca546825304e49a73eaa2c4ced57e1a8d6a5b.diff
LOG: [LangRef] Correct value ranges for address space, vector, and float bit sizes.
- The current implementation checks them for 24-bit inegers but the
document says 23-bit one effectively by listing the range as [1,2^23).
- Minor error message correction.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D144685
Added:
Modified:
llvm/docs/LangRef.rst
llvm/lib/IR/DataLayout.cpp
llvm/test/Assembler/invalid-datalayout17.ll
llvm/test/Assembler/invalid-datalayout4.ll
Removed:
################################################################################
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index b4c9cff4821c..2ba5fba140ab 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -2770,23 +2770,23 @@ as follows:
specified, the default index size is equal to the pointer size. All sizes
are in bits. The address space, ``n``, is optional, and if not specified,
denotes the default address space 0. The value of ``n`` must be
- in the range [1,2^23).
+ in the range [1,2^24).
``i<size>:<abi>[:<pref>]``
This specifies the alignment for an integer type of a given bit
- ``<size>``. The value of ``<size>`` must be in the range [1,2^23).
+ ``<size>``. The value of ``<size>`` must be in the range [1,2^24).
``<pref>`` is optional and defaults to ``<abi>``.
For ``i8``, the ``<abi>`` value must equal 8,
that is, ``i8`` must be naturally aligned.
``v<size>:<abi>[:<pref>]``
This specifies the alignment for a vector type of a given bit
- ``<size>``. The value of ``<size>`` must be in the range [1,2^23).
+ ``<size>``. The value of ``<size>`` must be in the range [1,2^24).
``<pref>`` is optional and defaults to ``<abi>``.
``f<size>:<abi>[:<pref>]``
This specifies the alignment for a floating-point type of a given bit
``<size>``. Only values of ``<size>`` that are supported by the target
will work. 32 (float) and 64 (double) are supported on all targets; 80
or 128 (
diff erent flavors of long double) are also supported on some
- targets. The value of ``<size>`` must be in the range [1,2^23).
+ targets. The value of ``<size>`` must be in the range [1,2^24).
``<pref>`` is optional and defaults to ``<abi>``.
``a:<abi>[:<pref>]``
This specifies the alignment for an object of aggregate type.
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index ae248e94fa66..444630d2d26e 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -305,7 +305,7 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
if (Error Err = getInt(Tok, AddrSpace))
return Err;
if (!isUInt<24>(AddrSpace))
- return reportError("Invalid address space, must be a 24bit integer");
+ return reportError("Invalid address space, must be a 24-bit integer");
// Size.
if (Rest.empty())
@@ -571,7 +571,7 @@ Error DataLayout::setAlignment(AlignTypeEnum AlignType, Align ABIAlign,
// an assert. See D67400 for context.
assert(Log2(ABIAlign) < 16 && Log2(PrefAlign) < 16 && "Alignment too big");
if (!isUInt<24>(BitWidth))
- return reportError("Invalid bit width, must be a 24bit integer");
+ return reportError("Invalid bit width, must be a 24-bit integer");
if (PrefAlign < ABIAlign)
return reportError(
"Preferred alignment cannot be less than the ABI alignment");
diff --git a/llvm/test/Assembler/invalid-datalayout17.ll b/llvm/test/Assembler/invalid-datalayout17.ll
index 519f5c10ab3c..b7eab74ad2a8 100644
--- a/llvm/test/Assembler/invalid-datalayout17.ll
+++ b/llvm/test/Assembler/invalid-datalayout17.ll
@@ -1,3 +1,3 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
target datalayout = "i16777216:16:16"
-; CHECK: Invalid bit width, must be a 24bit integer
+; CHECK: Invalid bit width, must be a 24-bit integer
diff --git a/llvm/test/Assembler/invalid-datalayout4.ll b/llvm/test/Assembler/invalid-datalayout4.ll
index 2d946d32609d..99a6a6093954 100644
--- a/llvm/test/Assembler/invalid-datalayout4.ll
+++ b/llvm/test/Assembler/invalid-datalayout4.ll
@@ -1,3 +1,3 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
target datalayout = "p16777216:64:64:64"
-; CHECK: Invalid address space, must be a 24bit integer
+; CHECK: Invalid address space, must be a 24-bit integer
More information about the llvm-commits
mailing list