diff options
| author | Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> | 2020-01-18 22:10:46 +0100 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-03-06 14:36:11 +0100 |
| commit | edcd83a669b68a2d371a54dc46e647a2efe97a4f (patch) | |
| tree | 1da16db9c64752dd35d196b1ad0d5b7a6654bb2f /mlir/lib | |
| parent | 50eedc134a219ef6d2345e4efc5471a2e3824223 (diff) | |
| download | bcm5719-llvm-edcd83a669b68a2d371a54dc46e647a2efe97a4f.tar.gz bcm5719-llvm-edcd83a669b68a2d371a54dc46e647a2efe97a4f.zip | |
[mlir] NFC: Rename index_t to index_type
mlir currently fails to build on Solaris:
/vol/llvm/src/llvm-project/dist/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp:78:20: error: reference to 'index_t' is ambiguous
IndexHandle zero(index_t(0)), one(index_t(1));
^
/usr/include/sys/types.h:103:16: note: candidate found by name lookup is 'index_t'
typedef short index_t;
^
/vol/llvm/src/llvm-project/dist/mlir/include/mlir/EDSC/Builders.h:27:8: note: candidate found by name lookup is 'mlir::edsc::index_t'
struct index_t {
^
and many more.
Given that POSIX reserves all identifiers ending in `_t` 2.2.2 The Name Space <https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html>, it seems
quite unwise to use such identifiers in user code, even more so without a distinguished
prefix.
The following patch fixes this by renaming `index_t` to `index_type`.
cases.
Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D72619
(cherry picked from commit 002ec79f979b9da9dedafe7ea036e00c90a9fbb7)
Diffstat (limited to 'mlir/lib')
| -rw-r--r-- | mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp | 2 | ||||
| -rw-r--r-- | mlir/lib/EDSC/Builders.cpp | 2 | ||||
| -rw-r--r-- | mlir/lib/EDSC/Helpers.cpp | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp b/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp index 3ed031b985a..975397be344 100644 --- a/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp +++ b/mlir/lib/Conversion/VectorToLoops/ConvertVectorToLoops.cpp @@ -75,7 +75,7 @@ static SmallVector<edsc::ValueHandle, 8> clip(TransferOpTy transfer, using namespace edsc::op; using edsc::intrinsics::select; - IndexHandle zero(index_t(0)), one(index_t(1)); + IndexHandle zero(index_type(0)), one(index_type(1)); SmallVector<edsc::ValueHandle, 8> memRefAccess(transfer.indices()); SmallVector<edsc::ValueHandle, 8> clippedScalarAccessExprs( memRefAccess.size(), edsc::IndexHandle()); diff --git a/mlir/lib/EDSC/Builders.cpp b/mlir/lib/EDSC/Builders.cpp index b966003f24f..868b00b44b9 100644 --- a/mlir/lib/EDSC/Builders.cpp +++ b/mlir/lib/EDSC/Builders.cpp @@ -65,7 +65,7 @@ MLIRContext *mlir::edsc::ScopedContext::getContext() { return getBuilder().getContext(); } -mlir::edsc::ValueHandle::ValueHandle(index_t cst) { +mlir::edsc::ValueHandle::ValueHandle(index_type cst) { auto &b = ScopedContext::getBuilder(); auto loc = ScopedContext::getLocation(); v = b.create<ConstantIndexOp>(loc, cst.v).getResult(); diff --git a/mlir/lib/EDSC/Helpers.cpp b/mlir/lib/EDSC/Helpers.cpp index f24b2073f4d..a8dfdeab29c 100644 --- a/mlir/lib/EDSC/Helpers.cpp +++ b/mlir/lib/EDSC/Helpers.cpp @@ -24,7 +24,7 @@ static SmallVector<ValueHandle, 8> getMemRefSizes(Value memRef) { if (shape[idx] == -1) { res.push_back(ValueHandle::create<DimOp>(memRef, idx)); } else { - res.push_back(static_cast<index_t>(shape[idx])); + res.push_back(static_cast<index_type>(shape[idx])); } } return res; @@ -35,7 +35,7 @@ mlir::edsc::MemRefView::MemRefView(Value v) : base(v) { auto memrefSizeValues = getMemRefSizes(v); for (auto &size : memrefSizeValues) { - lbs.push_back(static_cast<index_t>(0)); + lbs.push_back(static_cast<index_type>(0)); ubs.push_back(size); steps.push_back(1); } @@ -45,8 +45,8 @@ mlir::edsc::VectorView::VectorView(Value v) : base(v) { auto vectorType = v.getType().cast<VectorType>(); for (auto s : vectorType.getShape()) { - lbs.push_back(static_cast<index_t>(0)); - ubs.push_back(static_cast<index_t>(s)); + lbs.push_back(static_cast<index_type>(0)); + ubs.push_back(static_cast<index_type>(s)); steps.push_back(1); } } |

