[Mlir-commits] [flang] [mlir] [mlir] Build llvm.mlir.constant attributes from the result type (PR #218607)

Christian Ulmann llvmlistbot at llvm.org
Tue Aug 25 11:00:12 PDT 2026


https://github.com/Dinistro updated https://github.com/llvm/llvm-project/pull/218607

>From 45d2bdb61add0414188cfae55269ebdc5597c3d7 Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 25 Aug 2026 15:58:07 +0200
Subject: [PATCH 1/5] [mlir][NFC] Share createIndexAttrConstant as a free
 function

The `LLVM::ConstantOp` with an index-typed attribute idiom existed in three
byte-identical copies: the protected `ConvertToLLVMPattern` member, a file-static
helper in `MemRefBuilder.cpp`, and open-coded in the free function
`mlir::LLVM::getStridedElementPtr`, which cannot reach the protected member.

Promote a single free `mlir::LLVM::createIndexAttrConstant` and route all three
through it, so that a change to how these constants are built has one place to
happen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
---
 .../mlir/Conversion/LLVMCommon/Pattern.h      |  5 ++++
 .../Conversion/LLVMCommon/MemRefBuilder.cpp   | 27 +++++++------------
 mlir/lib/Conversion/LLVMCommon/Pattern.cpp    | 18 ++++++++-----
 3 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h b/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
index 2f468458addd3..b47f4998702a0 100644
--- a/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
+++ b/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
@@ -88,6 +88,11 @@ LogicalResult decomposeValue(OpBuilder &builder, Location loc, Value src,
 Value composeValue(OpBuilder &builder, Location loc, ValueRange src,
                    Type dstType);
 
+/// Creates a constant Op producing a value of `resultType` from an index-typed
+/// integer attribute.
+Value createIndexAttrConstant(OpBuilder &builder, Location loc, Type resultType,
+                              int64_t value);
+
 /// Performs the index computation to get to the element at `indices` of the
 /// memory pointed to by `memRefDesc`, using the layout map of `type`.
 /// The indices are linearized as:
diff --git a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
index 522e91421ff55..92412ab5096a6 100644
--- a/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/MemRefBuilder.cpp
@@ -8,6 +8,7 @@
 
 #include "mlir/Conversion/LLVMCommon/MemRefBuilder.h"
 #include "MemRefDescriptor.h"
+#include "mlir/Conversion/LLVMCommon/Pattern.h"
 #include "mlir/Conversion/LLVMCommon/TypeConverter.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/LLVMIR/LLVMTypes.h"
@@ -95,14 +96,6 @@ void MemRefDescriptor::setAlignedPtr(OpBuilder &builder, Location loc,
   setPtr(builder, loc, kAlignedPtrPosInMemRefDescriptor, ptr);
 }
 
-// Creates a constant Op producing a value of `resultType` from an index-typed
-// integer attribute.
-static Value createIndexAttrConstant(OpBuilder &builder, Location loc,
-                                     Type resultType, int64_t value) {
-  return LLVM::ConstantOp::create(builder, loc, resultType,
-                                  builder.getIndexAttr(value));
-}
-
 /// Builds IR extracting the offset from the descriptor.
 Value MemRefDescriptor::offset(OpBuilder &builder, Location loc) {
   return LLVM::ExtractValueOp::create(builder, loc, value,
@@ -120,7 +113,7 @@ void MemRefDescriptor::setOffset(OpBuilder &builder, Location loc,
 void MemRefDescriptor::setConstantOffset(OpBuilder &builder, Location loc,
                                          uint64_t offset) {
   setOffset(builder, loc,
-            createIndexAttrConstant(builder, loc, indexType, offset));
+            LLVM::createIndexAttrConstant(builder, loc, indexType, offset));
 }
 
 /// Builds IR extracting the pos-th size from the descriptor.
@@ -137,7 +130,7 @@ Value MemRefDescriptor::size(OpBuilder &builder, Location loc, Value pos,
   auto ptrTy = LLVM::LLVMPointerType::get(builder.getContext());
 
   // Copy size values to stack-allocated memory.
-  auto one = createIndexAttrConstant(builder, loc, indexType, 1);
+  auto one = LLVM::createIndexAttrConstant(builder, loc, indexType, 1);
   auto sizes = LLVM::ExtractValueOp::create(
       builder, loc, value,
       llvm::ArrayRef<int64_t>({kSizePosInMemRefDescriptor}));
@@ -162,7 +155,7 @@ void MemRefDescriptor::setSize(OpBuilder &builder, Location loc, unsigned pos,
 void MemRefDescriptor::setConstantSize(OpBuilder &builder, Location loc,
                                        unsigned pos, uint64_t size) {
   setSize(builder, loc, pos,
-          createIndexAttrConstant(builder, loc, indexType, size));
+          LLVM::createIndexAttrConstant(builder, loc, indexType, size));
 }
 
 /// Builds IR extracting the pos-th stride from the descriptor.
@@ -183,7 +176,7 @@ void MemRefDescriptor::setStride(OpBuilder &builder, Location loc, unsigned pos,
 void MemRefDescriptor::setConstantStride(OpBuilder &builder, Location loc,
                                          unsigned pos, uint64_t stride) {
   setStride(builder, loc, pos,
-            createIndexAttrConstant(builder, loc, indexType, stride));
+            LLVM::createIndexAttrConstant(builder, loc, indexType, stride));
 }
 
 LLVM::LLVMPointerType MemRefDescriptor::getElementPtrType() {
@@ -209,7 +202,7 @@ Value MemRefDescriptor::bufferPtr(OpBuilder &builder, Location loc,
   Value offsetVal =
       ShapedType::isDynamic(offsetCst)
           ? offset(builder, loc)
-          : createIndexAttrConstant(builder, loc, indexType, offsetCst);
+          : LLVM::createIndexAttrConstant(builder, loc, indexType, offsetCst);
   Type elementType = converter.convertType(type.getElementType());
   ptr = LLVM::GEPOp::create(builder, loc, ptr.getType(), elementType, ptr,
                             offsetVal);
@@ -360,9 +353,9 @@ Value UnrankedMemRefDescriptor::computeSize(
   Type indexType = typeConverter.getIndexType();
 
   // Initialize shared constants.
-  Value one = createIndexAttrConstant(builder, loc, indexType, 1);
-  Value two = createIndexAttrConstant(builder, loc, indexType, 2);
-  Value indexSize = createIndexAttrConstant(
+  Value one = LLVM::createIndexAttrConstant(builder, loc, indexType, 1);
+  Value two = LLVM::createIndexAttrConstant(builder, loc, indexType, 2);
+  Value indexSize = LLVM::createIndexAttrConstant(
       builder, loc, indexType,
       llvm::divideCeil(typeConverter.getIndexTypeBitwidth(), 8));
 
@@ -373,7 +366,7 @@ Value UnrankedMemRefDescriptor::computeSize(
   //   2 * sizeof(pointer) + (1 + 2 * rank) * sizeof(index).
   // TODO: consider including the actual size (including eventual padding due
   // to data layout) into the unranked descriptor.
-  Value pointerSize = createIndexAttrConstant(
+  Value pointerSize = LLVM::createIndexAttrConstant(
       builder, loc, indexType,
       llvm::divideCeil(typeConverter.getPointerBitwidth(addressSpace), 8));
   Value doublePointerSize =
diff --git a/mlir/lib/Conversion/LLVMCommon/Pattern.cpp b/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
index 2e0d92c3ba847..99b67bab98231 100644
--- a/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
@@ -55,12 +55,17 @@ Type ConvertToLLVMPattern::getPtrType(unsigned addressSpace) const {
 
 Type ConvertToLLVMPattern::getVoidPtrType() const { return getPtrType(); }
 
+Value mlir::LLVM::createIndexAttrConstant(OpBuilder &builder, Location loc,
+                                          Type resultType, int64_t value) {
+  return LLVM::ConstantOp::create(builder, loc, resultType,
+                                  builder.getIndexAttr(value));
+}
+
 Value ConvertToLLVMPattern::createIndexAttrConstant(OpBuilder &builder,
                                                     Location loc,
                                                     Type resultType,
                                                     int64_t value) {
-  return LLVM::ConstantOp::create(builder, loc, resultType,
-                                  builder.getIndexAttr(value));
+  return LLVM::createIndexAttrConstant(builder, loc, resultType, value);
 }
 
 Value ConvertToLLVMPattern::getStridedElementPtr(
@@ -628,11 +633,10 @@ Value mlir::LLVM::getStridedElementPtr(OpBuilder &builder, Location loc,
   for (int i = 0, e = indices.size(); i < e; ++i) {
     Value increment = indices[i];
     if (strides[i] != 1) { // Skip if stride is 1.
-      Value stride =
-          ShapedType::isDynamic(strides[i])
-              ? memRefDescriptor.stride(builder, loc, i)
-              : LLVM::ConstantOp::create(builder, loc, indexType,
-                                         builder.getIndexAttr(strides[i]));
+      Value stride = ShapedType::isDynamic(strides[i])
+                         ? memRefDescriptor.stride(builder, loc, i)
+                         : LLVM::createIndexAttrConstant(builder, loc,
+                                                         indexType, strides[i]);
       increment = LLVM::MulOp::create(builder, loc, increment, stride,
                                       intOverflowFlags);
     }

>From 31c7c3fa6ad8a65ae0f7204867704d5234b84f39 Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 25 Aug 2026 16:28:11 +0200
Subject: [PATCH 2/5] [mlir][NFC] Expose getConstantElementType from the LLVM
 dialect

The `llvm.mlir.constant` verifier determines the element type it compares by
looking through LLVM array types and then a vector or tensor type. Conversion
code that builds such constants needs the same notion, so make the helper
available instead of leaving it file-static in `LLVMDialect.cpp`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
---
 mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h | 7 +++++++
 mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp     | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
index f3bd5c090803d..fcc2a0f332c21 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.h
@@ -221,6 +221,13 @@ bool satisfiesLLVMModule(Operation *op);
 /// Lookup parent Module satisfying LLVM conditions on the Module Operation.
 Operation *parentLLVMModule(Operation *op);
 
+/// Determines the element type of `type` the way the `llvm.mlir.constant`
+/// verifier does, i.e. by looking through LLVM array types and then through a
+/// `VectorType` or `TensorType`. Everything else is treated as a scalar. Use
+/// this when building a constant so that the attribute and the result type are
+/// compared consistently with the verifier.
+Type getConstantElementType(Type type);
+
 /// Convert an array of integer attributes to a vector of integers that can be
 /// used as indices in LLVM operations.
 template <typename IntT = int64_t>
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 374ad4a9dcb83..a5c7a1b8c03b0 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -3479,7 +3479,7 @@ static int64_t getNumElements(Type t) {
 
 /// Determine the element type of `type`. Supported types are `VectorType`,
 /// `TensorType`, and `LLVMArrayType`. Everything else is treated as a scalar.
-static Type getElementType(Type type) {
+Type LLVM::getConstantElementType(Type type) {
   while (auto arrayType = dyn_cast<LLVM::LLVMArrayType>(type))
     type = arrayType.getElementType();
   if (auto vecType = dyn_cast<VectorType>(type))
@@ -3678,8 +3678,8 @@ LogicalResult LLVM::ConstantOp::verify() {
              << getNumElements(getType()) << " vs. " << attrNumElements;
     }
 
-    Type attrElmType = getElementType(elementsAttr.getType());
-    Type resultElmType = getElementType(getType());
+    Type attrElmType = LLVM::getConstantElementType(elementsAttr.getType());
+    Type resultElmType = LLVM::getConstantElementType(getType());
     if (auto floatType = dyn_cast<FloatType>(attrElmType))
       return verifyFloatSemantics(floatType.getFloatSemantics(), resultElmType);
 

>From c5cb787d42f94bd0eb2d849d32ce604ce78386f8 Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 25 Aug 2026 16:36:12 +0200
Subject: [PATCH 3/5] [mlir][VectorToLLVM] Use the converted index type in
 vector.type_cast

`VectorTypeCastOpConversion` hardcoded `i64` for the offset, size and stride
constants it inserts into the target memref descriptor, while the descriptor's
fields have the converted index type. With a type converter configured for a
32-bit index the pattern therefore emitted invalid IR:

  'llvm.insertvalue' op Type mismatch: cannot insert 'i64' into
  '!llvm.struct<(ptr, ptr, i32)>'

Build the constants from the converted index type instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
---
 .../VectorToLLVM/ConvertVectorToLLVM.cpp      | 24 +++++++++----------
 .../VectorToLLVM/vector-to-llvm-32b.mlir      | 15 ++++++++++++
 2 files changed, 26 insertions(+), 13 deletions(-)
 create mode 100644 mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir

diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 54c117bae476b..287bb7132bd11 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -1479,7 +1479,9 @@ class VectorTypeCastOpConversion
     if (llvm::any_of(*targetStrides, ShapedType::isDynamic))
       return failure();
 
-    auto int64Ty = IntegerType::get(rewriter.getContext(), 64);
+    // The offset, size and stride fields of a memref descriptor use the
+    // converted index type, which is not necessarily `i64`.
+    Type indexTy = getTypeConverter()->getIndexType();
 
     // Create descriptor.
     auto desc = MemRefDescriptor::poison(rewriter, loc, llvmTargetDescriptorTy);
@@ -1491,23 +1493,19 @@ class VectorTypeCastOpConversion
     Value ptr = sourceMemRef.alignedPtr(rewriter, loc);
     desc.setAlignedPtr(rewriter, loc, ptr);
     // Fill offset 0.
-    auto attr = rewriter.getIntegerAttr(rewriter.getIndexType(), 0);
-    auto zero = LLVM::ConstantOp::create(rewriter, loc, int64Ty, attr);
-    desc.setOffset(rewriter, loc, zero);
+    desc.setOffset(rewriter, loc,
+                   LLVM::createIndexAttrConstant(rewriter, loc, indexTy, 0));
 
     // Fill size and stride descriptors in memref.
     for (const auto &indexedSize :
          llvm::enumerate(targetMemRefType.getShape())) {
       int64_t index = indexedSize.index();
-      auto sizeAttr =
-          rewriter.getIntegerAttr(rewriter.getIndexType(), indexedSize.value());
-      auto size = LLVM::ConstantOp::create(rewriter, loc, int64Ty, sizeAttr);
-      desc.setSize(rewriter, loc, index, size);
-      auto strideAttr = rewriter.getIntegerAttr(rewriter.getIndexType(),
-                                                (*targetStrides)[index]);
-      auto stride =
-          LLVM::ConstantOp::create(rewriter, loc, int64Ty, strideAttr);
-      desc.setStride(rewriter, loc, index, stride);
+      desc.setSize(rewriter, loc, index,
+                   LLVM::createIndexAttrConstant(rewriter, loc, indexTy,
+                                                 indexedSize.value()));
+      desc.setStride(rewriter, loc, index,
+                     LLVM::createIndexAttrConstant(rewriter, loc, indexTy,
+                                                   (*targetStrides)[index]));
     }
 
     rewriter.replaceOp(castOp, {desc});
diff --git a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir
new file mode 100644
index 0000000000000..64b242c3a0275
--- /dev/null
+++ b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir
@@ -0,0 +1,15 @@
+// The memref descriptor fields use the converted index type, which is not
+// necessarily `i64`. `convert-vector-to-llvm` has no index bitwidth option, so
+// drive the vector patterns through a pass that configures a 32-bit index.
+
+// RUN: mlir-opt %s -convert-gpu-to-nvvm='index-bitwidth=32' | FileCheck %s
+
+gpu.module @m {
+  // CHECK-LABEL: llvm.func @type_cast
+  //       CHECK:   %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i32
+  //       CHECK:   llvm.insertvalue %[[OFFSET]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i32)>
+  gpu.func @type_cast(%arg0: memref<8x8x8xf32>) -> memref<vector<8x8x8xf32>> {
+    %0 = vector.type_cast %arg0 : memref<8x8x8xf32> to memref<vector<8x8x8xf32>>
+    gpu.return %0 : memref<vector<8x8x8xf32>>
+  }
+}

>From 1dd55f19b9cb36353aba076abcb75ba968560e6f Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 25 Aug 2026 16:59:04 +0200
Subject: [PATCH 4/5] [mlir][MPIToLLVM] Take the descriptor index type from the
 descriptor

`getRawPtrAndSize` extracted the memref descriptor's offset as `i64` and
unconditionally truncated the extents to `i32`. Both assume a 64-bit index: with
a 32-bit one the extract disagrees with the descriptor's field type and the
truncation becomes an invalid `llvm.trunc` from `i32` to `i32`.

Read the index type off the descriptor and only adjust the extent width when it
actually differs. While here, drop the rank-0 branch that rebuilt the already
available element count as an `arith.constant` in the middle of an LLVM
lowering.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
---
 mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp | 28 +++++++++++++--------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
index 70aa735655e18..8179b121ae6cf 100644
--- a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
+++ b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
@@ -15,7 +15,6 @@
 #include "mlir/Conversion/MPIToLLVM/MPIToLLVM.h"
 #include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
 #include "mlir/Conversion/LLVMCommon/Pattern.h"
-#include "mlir/Dialect/Arith/IR/Arith.h"
 #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
 #include "mlir/Dialect/DLTI/DLTI.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
@@ -56,24 +55,33 @@ std::pair<Value, Value> getRawPtrAndSize(const Location loc,
                                          Value memRef, int64_t rank,
                                          Type elType) {
   Type ptrType = LLVM::LLVMPointerType::get(rewriter.getContext());
+  Type i32Type = rewriter.getI32Type();
+  auto descriptorType = cast<LLVM::LLVMStructType>(memRef.getType());
+  // The offset and the sizes of a memref descriptor have the converted index
+  // type, which is not necessarily `i64`. Take it from the descriptor itself.
+  auto indexType = cast<IntegerType>(descriptorType.getBody()[2]);
+
   Value dataPtr =
       LLVM::ExtractValueOp::create(rewriter, loc, ptrType, memRef, 1);
-  Value offset = LLVM::ExtractValueOp::create(rewriter, loc,
-                                              rewriter.getI64Type(), memRef, 2);
+  Value offset =
+      LLVM::ExtractValueOp::create(rewriter, loc, indexType, memRef, 2);
   Value resPtr =
       LLVM::GEPOp::create(rewriter, loc, ptrType, elType, dataPtr, offset);
-  Value size = LLVM::ConstantOp::create(rewriter, loc, rewriter.getI32Type(),
+  Value size = LLVM::ConstantOp::create(rewriter, loc, i32Type,
                                         rewriter.getIndexAttr(1));
-  if (cast<LLVM::LLVMStructType>(memRef.getType()).getBody().size() > 3) {
+  if (descriptorType.getBody().size() > 3) {
     for (int64_t i = 0; i < rank; ++i) {
       Value dim = LLVM::ExtractValueOp::create(rewriter, loc, memRef,
                                                ArrayRef<int64_t>{3, i});
-      dim = LLVM::TruncOp::create(rewriter, loc, rewriter.getI32Type(), dim);
-      size =
-          LLVM::MulOp::create(rewriter, loc, rewriter.getI32Type(), dim, size);
+      // The MPI interface counts elements in an `i32`, so adjust the
+      // index-typed extent to that width. Extents are non-negative, hence the
+      // zero extension.
+      if (indexType.getWidth() > 32)
+        dim = LLVM::TruncOp::create(rewriter, loc, i32Type, dim);
+      else if (indexType.getWidth() < 32)
+        dim = LLVM::ZExtOp::create(rewriter, loc, i32Type, dim);
+      size = LLVM::MulOp::create(rewriter, loc, i32Type, dim, size);
     }
-  } else {
-    size = arith::ConstantIntOp::create(rewriter, loc, 1, 32);
   }
   return {resPtr, size};
 }

>From ea9ae6ad5adc61439b3a48974d42e45d92dd8493 Mon Sep 17 00:00:00 2001
From: Christian Ulmann <christian.ulmann at nextsilicon.com>
Date: Tue, 25 Aug 2026 17:00:06 +0200
Subject: [PATCH 5/5] [mlir] Build llvm.mlir.constant attributes from the
 result type

Many conversion patterns created `llvm.mlir.constant` with a value attribute
whose type does not match the result type. The most common case was pairing an
`index`-typed attribute with the converted index type:

  llvm.mlir.constant(1 : index) : i64

but there were also plain width and signedness mismatches, e.g. NVGPU's
`makeI64Const` built `i64` constants from `i32` attributes, and the NVVM `fdiv`
expansion used `ui32` attributes on `i32` values.

Translation to LLVM IR ignores the attribute type and uses the result type, so
the emitted IR was correct, but the attribute type is meaningless in this state
and anything that reads it back sees the wrong type. Derive the attribute from
the result type in every case; where the result is the converted index type,
`LLVM::createIndexAttrConstant` now does this for all of its callers.

In `ArithToLLVM`, retype the value attribute when the type converter maps
`index` to a different integer type. Two element type changes must not be
retyped: the low-precision float types that the converter maps to a same-width
integer keep their float attribute, which `llvm.mlir.constant` accepts and takes
the float semantics from, and a resource-backed elements attribute refers to a
blob laid out for its own element type. Anything else is a malformed
`arith.constant`, and the match fails rather than reinterpreting its value.

`WmmaOpsToNvvm` builds its leading dimension attribute from the `i32` result, so
reject a value that does not fit instead of narrowing it silently.

This is in preparation for verifying that the two types agree.

Co-Authored-By: Claude Opus 5 (1M context) <noreply at anthropic.com>
---
 flang/test/Driver/tco-test-gen.fir            |   8 +-
 flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir |  50 +++----
 .../bounds-generation-for-char-arrays.f90     |  12 +-
 .../Fir/convert-and-fold-insert-on-range.fir  |   4 +-
 flang/test/Fir/convert-memref-codegen.mlir    |  14 +-
 .../test/Fir/convert-nontemporal-to-llvm.fir  |   2 +-
 .../test/Fir/convert-to-llvm-access-group.fir |   4 +-
 .../Fir/convert-to-llvm-openmp-and-fir.fir    |  92 +++++++------
 flang/test/Fir/convert-to-llvm.fir            |  38 +++---
 flang/test/Fir/embox-char.fir                 |  10 +-
 flang/test/Fir/embox-substring.fir            |   2 +-
 flang/test/Fir/rebox-susbtring.fir            |   2 +-
 flang/test/Fir/tbaa.fir                       |   4 +-
 mlir/docs/TargetLLVMIR.md                     |  14 +-
 mlir/docs/Tutorials/Toy/Ch-6.md               |   6 +-
 .../mlir/Conversion/LLVMCommon/Pattern.h      |  13 +-
 .../AMDGPUToROCDL/AMDGPUToROCDL.cpp           |   8 +-
 .../Conversion/ArithToLLVM/ArithToLLVM.cpp    |  92 ++++++++++++-
 mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp |  10 +-
 .../Conversion/GPUCommon/GPUOpsLowering.cpp   |   2 +-
 .../GPUCommon/GPUToLLVMConversion.cpp         |  32 ++---
 .../Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp    |  18 ++-
 mlir/lib/Conversion/LLVMCommon/Pattern.cpp    |   2 +-
 .../Conversion/LLVMCommon/TypeConverter.cpp   |   2 +-
 mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp   |   2 +-
 .../Conversion/MemRefToLLVM/MemRefToLLVM.cpp  |  20 +--
 .../Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp    |   2 +-
 .../OpenACCToLLVM/ACCToLLVMUtils.cpp          |   8 +-
 .../Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp    |   2 +-
 .../VectorToLLVM/ConvertVectorToLLVM.cpp      |  10 +-
 .../Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp    |   2 +-
 .../NVVM/Transforms/OptimizeForNVVM.cpp       |   6 +-
 .../AMDGPUToROCDL/amdgpu-to-rocdl.mlir        |   2 +-
 .../AMDGPUToROCDL/load_lds-gfx950.mlir        |   8 +-
 .../Conversion/AMDGPUToROCDL/load_lds.mlir    |  30 ++---
 .../Conversion/ArithToLLVM/arith-to-llvm.mlir |  29 +++-
 .../FuncToLLVM/calling-convention.mlir        |  34 ++---
 .../FuncToLLVM/func-memref-return.mlir        |  26 ++--
 .../Conversion/FuncToLLVM/func-to-llvm.mlir   |  58 ++++----
 ...launch-func-bare-ptr-intersperse-size.mlir |   6 +-
 .../GPUCommon/lower-launch-func-bare-ptr.mlir |   6 +-
 ...ower-launch-func-to-gpu-runtime-calls.mlir |  10 +-
 .../GPUCommon/memory-attrbution.mlir          |  60 +++++----
 .../GPUToLLVMSPV/gpu-to-llvm-spv.mlir         |   3 +
 .../Conversion/GPUToNVVM/gpu-to-nvvm.mlir     |   4 +-
 .../GPUToNVVM/wmma-ops-to-nvvm.mlir           |  38 +++---
 mlir/test/Conversion/MPIToLLVM/mpitollvm.mlir |   4 +-
 .../convert-dynamic-memref-ops.mlir           |  90 ++++++-------
 .../convert-static-memref-ops.mlir            |  86 ++++++------
 .../expand-then-convert-to-llvm.mlir          | 110 +++++++--------
 .../MemRefToLLVM/memref-to-llvm.mlir          | 116 ++++++++--------
 .../Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir |  50 +++----
 .../OpenMPToLLVM/convert-to-llvmir.mlir       |  42 +++---
 .../Conversion/PtrToLLVM/ptr-to-llvm.mlir     |  14 +-
 .../vector-load-store-to-llvm.mlir            |  20 +--
 .../VectorToLLVM/vector-to-llvm-32b.mlir      |   2 +-
 .../vector-to-llvm-interface.mlir             |  24 ++--
 mlir/test/Dialect/Affine/loop-fusion-4.mlir   |   4 +-
 .../Dialect/GPU/dynamic-shared-memory.mlir    |  24 ++--
 .../lower-to-llvm-e2e-with-target-tag.mlir    |   2 +-
 ...lvm-e2e-with-top-level-named-sequence.mlir |   2 +-
 .../test/Dialect/LLVMIR/constant-folding.mlir |   2 +-
 .../Dialect/LLVMIR/optimize-for-nvvm.mlir     |   4 +-
 .../Linalg/fusion-multiuse-producer.mlir      |   4 +-
 .../Dialect/OpenMP/host-op-filtering.mlir     |   6 +-
 ...ffload-privatization-prepare-by-value.mlir |   8 +-
 .../omp-offload-privatization-prepare.mlir    |   4 +-
 mlir/test/Dialect/OpenMP/ops.mlir             |  32 ++---
 mlir/test/Dialect/Vector/canonicalize.mlir    |   6 +-
 .../Dialect/X86/AMX/legalize-for-llvm.mlir    |   4 +
 .../LLVMIR/CPU/test-vector-reductions-fp.mlir |   2 +-
 .../CPU/test-vector-reductions-int.mlir       |   2 +-
 ...assume-alignment-runtime-verification.mlir |   6 +-
 .../atomic-rmw-runtime-verification.mlir      |   6 +-
 .../MemRef/store-runtime-verification.mlir    |   6 +-
 .../CPU/X86/inline-asm-vector-avx512.mlir     |   2 +-
 mlir/test/Target/LLVMIR/arm-sme.mlir          |   4 +-
 mlir/test/Target/LLVMIR/arm-sve.mlir          |   4 +-
 mlir/test/Target/LLVMIR/gpu.mlir              |  20 +--
 mlir/test/Target/LLVMIR/llvmir.mlir           | 126 +++++++++---------
 .../omptarget-array-sectioning-host.mlir      |   6 +-
 .../omptarget-data-use-dev-ordering.mlir      |  12 +-
 .../Target/LLVMIR/omptarget-debug-var-2.mlir  |   8 +-
 .../omptarget-declare-target-llvm-host.mlir   |   4 +-
 .../omptarget-declare-target-to-host.mlir     |   6 +-
 .../LLVMIR/omptarget-depend-host-only.mlir    |   8 +-
 mlir/test/Target/LLVMIR/omptarget-depend.mlir |  14 +-
 .../omptarget-fortran-common-block-host.mlir  |   4 +-
 mlir/test/Target/LLVMIR/omptarget-llvm.mlir   |  40 +++---
 .../omptarget-memcpy-align-metadata.mlir      |   2 +-
 ...t-nested-ptr-record-type-mapping-host.mlir |  10 +-
 ...arget-nested-record-type-mapping-host.mlir |   6 +-
 mlir/test/Target/LLVMIR/omptarget-nowait.mlir |   2 +-
 .../omptarget-record-type-mapping-host.mlir   |   6 +-
 ...rget-record-type-with-ptr-member-host.mlir |   6 +-
 .../LLVMIR/omptarget-teams-reduction.mlir     |   6 +-
 .../LLVMIR/omptarget-wsloop-collapsed.mlir    |   2 +-
 .../LLVMIR/openmp-data-target-device.mlir     |  10 +-
 mlir/test/Target/LLVMIR/openmp-llvm.mlir      |  40 +++---
 .../openmp-nested-task-target-parallel.mlir   |   8 +-
 mlir/test/Target/LLVMIR/openmp-nested.mlir    |   6 +-
 .../Target/LLVMIR/openmp-nontemporal.mlir     |   4 +-
 mlir/test/Target/LLVMIR/openmp-private.mlir   |   2 +-
 .../openmp-reduction-array-sections.mlir      |   8 +-
 .../Target/LLVMIR/openmp-simd-linear.mlir     |   6 +-
 .../Target/LLVMIR/openmp-target-private.mlir  |   6 +-
 .../LLVMIR/openmp-target-wsloop-private.mlir  |   2 +-
 .../Target/LLVMIR/openmp-teams-reduction.mlir |   6 +-
 .../openmp-wsloop-test-block-structure.mlir   |   4 +-
 mlir/test/mlir-runner/simple.mlir             |   4 +-
 mlir/test/mlir-runner/verify-entry-point.mlir |   8 +-
 111 files changed, 1016 insertions(+), 885 deletions(-)

diff --git a/flang/test/Driver/tco-test-gen.fir b/flang/test/Driver/tco-test-gen.fir
index 438804ce42b76..4c9f9c1ed79d3 100644
--- a/flang/test/Driver/tco-test-gen.fir
+++ b/flang/test/Driver/tco-test-gen.fir
@@ -44,12 +44,10 @@ func.func @_QPtest(%arg0: !fir.ref<i32> {fir.bindc_name = "num"}, %arg1: !fir.re
 
 // CMPLX:           %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CMPLX:           %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
-// CMPLX:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : index) : i64
-// CMPLX:           %[[VAL_3:.*]] = llvm.mlir.constant(0 : index) : i64
-// CMPLX:           %[[VAL_4:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CMPLX:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CMPLX:           %[[VAL_3:.*]] = llvm.mlir.constant(0 : i64) : i64
 
-// SIMPLE:          %[[VAL_3:.*]] = llvm.mlir.constant(0 : index) : i64
-// SIMPLE:          %[[VAL_2:.*]] = llvm.mlir.constant(1 : index) : i64
+// SIMPLE:          %[[VAL_3:.*]] = llvm.mlir.constant(0 : i64) : i64
 // SIMPLE:          %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
 // SIMPLE:          %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
 
diff --git a/flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir b/flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir
index 03e441ada81c9..c70d775e0924b 100644
--- a/flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir
+++ b/flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir
@@ -9,21 +9,21 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : ve
     %4 = llvm.mlir.constant(25 : i32) : i32
     %5 = llvm.mlir.constant(21 : i32) : i32
     %6 = llvm.mlir.constant(17 : i32) : i32
-    %7 = llvm.mlir.constant(1 : index) : i64
+    %7 = llvm.mlir.constant(1 : i64) : i64
     %8 = llvm.mlir.constant(27 : i32) : i32
     %9 = llvm.mlir.constant(6 : i32) : i32
     %10 = llvm.mlir.constant(1 : i32) : i32
     %11 = llvm.mlir.constant(0 : i32) : i32
-    %12 = llvm.mlir.constant(10 : index) : i64
+    %12 = llvm.mlir.constant(10 : i64) : i64
     %13 = llvm.mlir.addressof @_QQclX91d13f6e74caa2f03965d7a7c6a8fdd5 : !llvm.ptr
     %14 = llvm.call @_FortranACUFMemAlloc(%2, %11, %13, %6) : (i64, i32, !llvm.ptr, i32) -> !llvm.ptr
-    %15 = llvm.mlir.constant(10 : index) : i64
-    %16 = llvm.mlir.constant(1 : index) : i64
+    %15 = llvm.mlir.constant(10 : i64) : i64
+    %16 = llvm.mlir.constant(1 : i64) : i64
     %17 = llvm.alloca %15 x i32 : (i64) -> !llvm.ptr
     %18 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
     %19 = llvm.insertvalue %17, %18[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
     %20 = llvm.insertvalue %17, %19[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
-    %21 = llvm.mlir.constant(0 : index) : i64
+    %21 = llvm.mlir.constant(0 : i64) : i64
     %22 = llvm.insertvalue %21, %20[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
     %23 = llvm.insertvalue %15, %22[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
     %24 = llvm.insertvalue %16, %23[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
@@ -31,21 +31,21 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : ve
     %26 = llvm.mlir.undef : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
     %27 = llvm.insertvalue %25, %26[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
     %28 = llvm.insertvalue %25, %27[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
-    %29 = llvm.mlir.constant(0 : index) : i64
+    %29 = llvm.mlir.constant(0 : i64) : i64
     %30 = llvm.insertvalue %29, %28[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
-    %31 = llvm.mlir.constant(10 : index) : i64
+    %31 = llvm.mlir.constant(10 : i64) : i64
     %32 = llvm.insertvalue %31, %30[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
-    %33 = llvm.mlir.constant(1 : index) : i64
+    %33 = llvm.mlir.constant(1 : i64) : i64
     %34 = llvm.insertvalue %33, %32[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
-    %35 = llvm.mlir.constant(1 : index) : i64
-    %36 = llvm.mlir.constant(11 : index) : i64
-    %37 = llvm.mlir.constant(1 : index) : i64
+    %35 = llvm.mlir.constant(1 : i64) : i64
+    %36 = llvm.mlir.constant(11 : i64) : i64
+    %37 = llvm.mlir.constant(1 : i64) : i64
     llvm.br ^bb1(%35 : i64)
   ^bb1(%38: i64):  // 2 preds: ^bb0, ^bb2
     %39 = llvm.icmp "slt" %38, %36 : i64
     llvm.cond_br %39, ^bb2, ^bb3
   ^bb2:  // pred: ^bb1
-    %40 = llvm.mlir.constant(-1 : index) : i64
+    %40 = llvm.mlir.constant(-1 : i64) : i64
     %41 = llvm.add %38, %40 : i64
     %42 = llvm.extractvalue %34[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> 
     %43 = llvm.getelementptr %42[%41] : (!llvm.ptr, i64) -> !llvm.ptr, i32
@@ -118,10 +118,10 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr<272>, d
     llvm.return
   }
   llvm.func @_QQmain() attributes {fir.bindc_name = "test"} {
-    %0 = llvm.mlir.constant(1 : index) : i64
-    %1 = llvm.mlir.constant(2 : index) : i64
+    %0 = llvm.mlir.constant(1 : i64) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
     %2 = llvm.mlir.constant(0 : i32) : i32
-    %3 = llvm.mlir.constant(10 : index) : i64
+    %3 = llvm.mlir.constant(10 : i64) : i64
     gpu.launch_func  @cuda_device_mod::@_QMmod1Psub1 clusters in (%1, %1, %0) blocks in (%3, %3, %0) threads in (%3, %3, %0) : i64 dynamic_shared_memory_size %2  {cuf.proc_attr = #cuf.cuda_proc<global>}
     llvm.return
   }
@@ -143,12 +143,12 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : ve
     %4 = llvm.mlir.constant(25 : i32) : i32
     %5 = llvm.mlir.constant(21 : i32) : i32
     %6 = llvm.mlir.constant(17 : i32) : i32
-    %7 = llvm.mlir.constant(1 : index) : i64
+    %7 = llvm.mlir.constant(1 : i64) : i64
     %8 = llvm.mlir.constant(27 : i32) : i32
     %9 = llvm.mlir.constant(6 : i32) : i32
     %10 = llvm.mlir.constant(1 : i32) : i32
     %11 = llvm.mlir.constant(0 : i32) : i32
-    %12 = llvm.mlir.constant(10 : index) : i64
+    %12 = llvm.mlir.constant(10 : i64) : i64
     %13 = llvm.mlir.addressof @_QQclX91d13f6e74caa2f03965d7a7c6a8fdd5 : !llvm.ptr
     %14 = llvm.call @_FortranACUFMemAlloc(%2, %11, %13, %6) : (i64, i32, !llvm.ptr, i32) -> !llvm.ptr
     gpu.launch_func  @cuda_device_mod::@_QMmod1Psub1 blocks in (%7, %7, %7) threads in (%12, %7, %7) : i64 dynamic_shared_memory_size %11 args(%14 : !llvm.ptr) {cuf.proc_attr = #cuf.cuda_proc<grid_global>}
@@ -174,11 +174,11 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr<272>, d
     llvm.return
   }
   llvm.func @_QQmain() attributes {fir.bindc_name = "test"} {
-    %0 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(1 : i64) : i64
     %stream = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
-    %1 = llvm.mlir.constant(2 : index) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
     %2 = llvm.mlir.constant(0 : i32) : i32
-    %3 = llvm.mlir.constant(10 : index) : i64
+    %3 = llvm.mlir.constant(10 : i64) : i64
     %token = cuf.stream_cast %stream : !llvm.ptr
     %res_token = gpu.launch_func async [%token] @cuda_device_mod::@_QMmod1Psub1 blocks in (%3, %3, %0) threads in (%3, %3, %0) : i64 dynamic_shared_memory_size %2 {cuf.proc_attr = #cuf.cuda_proc<global>}
     llvm.return
@@ -204,12 +204,12 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<i1, dense<8> : ve
     %4 = llvm.mlir.constant(25 : i32) : i32
     %5 = llvm.mlir.constant(21 : i32) : i32
     %6 = llvm.mlir.constant(17 : i32) : i32
-    %7 = llvm.mlir.constant(1 : index) : i64
+    %7 = llvm.mlir.constant(1 : i64) : i64
     %8 = llvm.mlir.constant(27 : i32) : i32
     %9 = llvm.mlir.constant(6 : i32) : i32
     %10 = llvm.mlir.constant(1 : i32) : i32
     %11 = llvm.mlir.constant(0 : i32) : i32
-    %12 = llvm.mlir.constant(10 : index) : i64
+    %12 = llvm.mlir.constant(10 : i64) : i64
     %13 = llvm.mlir.addressof @_QQclX91d13f6e74caa2f03965d7a7c6a8fdd5 : !llvm.ptr
     %14 = llvm.call @_FortranACUFMemAlloc(%2, %11, %13, %6) : (i64, i32, !llvm.ptr, i32) -> !llvm.ptr
     %token = cuf.stream_cast %stream : !llvm.ptr
@@ -238,10 +238,10 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr<272>, d
     llvm.return
   }
   llvm.func @_QQmain() attributes {fir.bindc_name = "test"} {
-    %0 = llvm.mlir.constant(1 : index) : i64
-    %1 = llvm.mlir.constant(2 : index) : i64
+    %0 = llvm.mlir.constant(1 : i64) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
     %2 = llvm.mlir.constant(0 : i32) : i32
-    %3 = llvm.mlir.constant(10 : index) : i64
+    %3 = llvm.mlir.constant(10 : i64) : i64
     %stream = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
     %token = cuf.stream_cast %stream : !llvm.ptr
     %res_token = gpu.launch_func async [%token] @cuda_device_mod::@_QMmod1Psub1 blocks in (%3, %3, %0) threads in (%3, %3, %0) : i64 dynamic_shared_memory_size %2  {cuf.proc_attr = #cuf.cuda_proc<global>}
diff --git a/flang/test/Fir/OpenMP/bounds-generation-for-char-arrays.f90 b/flang/test/Fir/OpenMP/bounds-generation-for-char-arrays.f90
index 2ef87d9180c24..ef5f5f63f13ca 100644
--- a/flang/test/Fir/OpenMP/bounds-generation-for-char-arrays.f90
+++ b/flang/test/Fir/OpenMP/bounds-generation-for-char-arrays.f90
@@ -17,10 +17,10 @@ module attributes {omp.is_target_device = false} {
 
 // CHECK-LABEL:   llvm.func @_QPchar_array(
 // CHECK-SAME:      %[[ARG0:.*]]: !llvm.ptr) {
-// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(9 : index) : i64
-// CHECK:           %[[VAL_1:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_3:.*]] = llvm.mlir.constant(10 : index) : i64
+// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(9 : i64) : i64
+// CHECK:           %[[VAL_1:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_3:.*]] = llvm.mlir.constant(10 : i64) : i64
 // CHECK:           %[[VAL_4:.*]] = omp.map.bounds lower_bound(%[[VAL_1]] : i64) upper_bound(%[[VAL_0]] : i64) extent(%[[VAL_3]] : i64) stride(%[[VAL_2]] : i64) start_idx(%[[VAL_2]] : i64)
 // CHECK:           %[[VAL_5:.*]] = omp.map.bounds lower_bound(%[[VAL_1]] : i64) upper_bound(%[[VAL_0]] : i64) extent(%[[VAL_3]] : i64) stride(%[[VAL_2]] : i64) start_idx(%[[VAL_2]] : i64)
 // CHECK:           %[[VAL_6:.*]] = llvm.mlir.constant(0 : i64) : i64
@@ -59,8 +59,8 @@ module attributes {omp.is_target_device = false} {
 // CHECK-SAME:      %[[ARG0:.*]]: !llvm.ptr) {
 // CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK:           %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-// CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_3:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_3:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(72 : i32) : i32
 // CHECK:           "llvm.intr.memcpy"(%[[VAL_1]], %[[ARG0]], %[[VAL_4]]) <{arg_attrs = [{{.*}}], isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()
 // CHECK:           %[[VAL_5:.*]] = llvm.getelementptr %[[VAL_1]][0, 7, %[[VAL_3]], 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
diff --git a/flang/test/Fir/convert-and-fold-insert-on-range.fir b/flang/test/Fir/convert-and-fold-insert-on-range.fir
index df18614d80b63..b12920f2e245b 100644
--- a/flang/test/Fir/convert-and-fold-insert-on-range.fir
+++ b/flang/test/Fir/convert-and-fold-insert-on-range.fir
@@ -20,13 +20,13 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
 //CHECK-SAME:  [
 //CHECK-SAME:    [#llvm.zero, 8, 20240719 : i32, 1 : i8, 28 : i8, 2 : i8, 0 : i8,
 //CHECK-SAME:      [
-//CHECK-SAME:        [1, 0 : index, 8]
+//CHECK-SAME:        [1, 0, 8]
 //CHECK-SAME:      ]
 //CHECK-SAME:    ],
 //CHECK-SAME:  [
 //CHECK-SAME:    [#llvm.zero, 8, 20240719 : i32, 1 : i8, 28 : i8, 2 : i8, 0 : i8,
 //CHECK-SAME:      [
-//CHECK-SAME:        [1, 0 : index, 8]
+//CHECK-SAME:        [1, 0, 8]
 //CHECK-SAME:      ]
 //CHECK-SAME:    ]) :
 //CHECK-SAME: !llvm.array<2 x struct<"sometype", (struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>)>>
diff --git a/flang/test/Fir/convert-memref-codegen.mlir b/flang/test/Fir/convert-memref-codegen.mlir
index 0d8d3e6093253..f31e50dc761d1 100644
--- a/flang/test/Fir/convert-memref-codegen.mlir
+++ b/flang/test/Fir/convert-memref-codegen.mlir
@@ -21,7 +21,7 @@
 // CHECK:         %[[POISON1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:         %[[DESC2:.*]] = llvm.insertvalue %[[BUF]], %[[POISON1]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:         %[[DESC3:.*]] = llvm.insertvalue %[[BUF]], %[[DESC2]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:         %[[ZERO:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:         %[[ZERO:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:         %[[DESC4:.*]] = llvm.insertvalue %[[ZERO]], %[[DESC3]][2] : !llvm.struct<(ptr, ptr, i64)>
 //
 // CHECK-NOT:     fir.convert
@@ -48,7 +48,7 @@ func.func @memref_to_ref_convert(%arg0: memref<f32>) {
 // CHECK:           %[[MLIR_1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_3:.*]] = llvm.insertvalue %[[GETELEMENTPTR_0]], %[[MLIR_1]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_4:.*]] = llvm.insertvalue %[[GETELEMENTPTR_0]], %[[INSERTVALUE_3]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[INSERTVALUE_5:.*]] = llvm.insertvalue %[[MLIR_2]], %[[INSERTVALUE_4]][2] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           llvm.return %[[INSERTVALUE_5]] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:         }
@@ -78,15 +78,15 @@ func.func @memref_to_memref_convert(%arg0: memref<f32>) -> memref<i1> {
 // CHECK:           %[[MLIR_1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[INSERTVALUE_5:.*]] = llvm.insertvalue %[[GETELEMENTPTR_0]], %[[MLIR_1]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[INSERTVALUE_6:.*]] = llvm.insertvalue %[[GETELEMENTPTR_0]], %[[INSERTVALUE_5]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[INSERTVALUE_7:.*]] = llvm.insertvalue %[[MLIR_2]], %[[INSERTVALUE_6]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:           %[[INSERTVALUE_8:.*]] = llvm.insertvalue %[[MLIR_3]], %[[INSERTVALUE_7]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(3 : index) : i64
+// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(3 : i64) : i64
 // CHECK:           %[[INSERTVALUE_9:.*]] = llvm.insertvalue %[[MLIR_4]], %[[INSERTVALUE_8]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[MLIR_5:.*]] = llvm.mlir.constant(3 : index) : i64
+// CHECK:           %[[MLIR_5:.*]] = llvm.mlir.constant(3 : i64) : i64
 // CHECK:           %[[INSERTVALUE_10:.*]] = llvm.insertvalue %[[MLIR_5]], %[[INSERTVALUE_9]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[MLIR_6:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[MLIR_6:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[INSERTVALUE_11:.*]] = llvm.insertvalue %[[MLIR_6]], %[[INSERTVALUE_10]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           llvm.return %[[INSERTVALUE_11]] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:         }
diff --git a/flang/test/Fir/convert-nontemporal-to-llvm.fir b/flang/test/Fir/convert-nontemporal-to-llvm.fir
index 584f1055b9e4f..f64012e0b6798 100644
--- a/flang/test/Fir/convert-nontemporal-to-llvm.fir
+++ b/flang/test/Fir/convert-nontemporal-to-llvm.fir
@@ -50,7 +50,7 @@
 // CHECK:    %[[CONST_VAL:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:    %[[ALLOCA2:.*]] = llvm.alloca %[[CONST_VAL]] x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
 // CHECK:    %[[IDX_VAL:.*]] = llvm.mlir.constant(1 : i32) : i32
-// CHECK:    %[[CONST_VAL1:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:    %[[CONST_VAL1:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:    %[[END_IDX:.*]] = llvm.mlir.constant(100 : i32) : i32
 // CHECK:    omp.simd nontemporal(%[[ARG0:.*]] : !llvm.ptr) {
 // CHECK:      omp.loop_nest (%[[ARG3:.*]]) : i32 = (%[[IDX_VAL]]) to (%[[END_IDX]]) inclusive step (%[[IDX_VAL]]) {
diff --git a/flang/test/Fir/convert-to-llvm-access-group.fir b/flang/test/Fir/convert-to-llvm-access-group.fir
index f9807c8b8ed09..a3e9c50040d89 100644
--- a/flang/test/Fir/convert-to-llvm-access-group.fir
+++ b/flang/test/Fir/convert-to-llvm-access-group.fir
@@ -11,8 +11,8 @@
 // CHECK:           %[[ALLOCA_0:.*]] = llvm.alloca %[[MLIR_0]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // CHECK:           %[[MLIR_1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[ALLOCA_1:.*]] = llvm.alloca %[[MLIR_1]] x i32 {bindc_name = "j"} : (i64) -> !llvm.ptr
-// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[MLIR_2:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[LOAD_0:.*]] = llvm.load %[[ARG2]] : !llvm.ptr -> i32
 // CHECK:           %[[SEXT_0:.*]] = llvm.sext %[[LOAD_0]] : i32 to i64
diff --git a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
index 09d14300002aa..2e8bc25e08b7a 100644
--- a/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
+++ b/flang/test/Fir/convert-to-llvm-openmp-and-fir.fir
@@ -287,44 +287,50 @@ func.func @_QPomp_target_data() {
 // CHECK:           %[[VAL_6:.*]] = llvm.alloca %[[VAL_5]] x !llvm.array<1024 x i32> {bindc_name = "b"} : (i64) -> !llvm.ptr
 // CHECK:           %[[VAL_7:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_8:.*]] = llvm.alloca %[[VAL_7]] x !llvm.array<1024 x i32> {bindc_name = "a"} : (i64) -> !llvm.ptr
-// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(1024 : index) : i64
-// CHECK:           %[[VAL_9:.*]] = llvm.mlir.constant(1024 : index) : i64
-// CHECK:           %[[VAL_10:.*]] = llvm.mlir.constant(1024 : index) : i64
-// CHECK:           %[[VAL_11:.*]] = llvm.mlir.constant(1024 : index) : i64
-// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_13:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_14:.*]] = llvm.mlir.constant(1023 : index) : i64
+// Each extent constant is followed by an identically-printed stride constant,
+// so the strides have to be matched explicitly to keep the sequence aligned.
+// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(1024 : i64) : i64
+// CHECK-NEXT:      llvm.mlir.constant(1 : i64) : i64
+// CHECK-NEXT:      %[[VAL_9:.*]] = llvm.mlir.constant(1024 : i64) : i64
+// CHECK-NEXT:      llvm.mlir.constant(1 : i64) : i64
+// CHECK-NEXT:      %[[VAL_10:.*]] = llvm.mlir.constant(1024 : i64) : i64
+// CHECK-NEXT:      llvm.mlir.constant(1 : i64) : i64
+// CHECK-NEXT:      %[[VAL_11:.*]] = llvm.mlir.constant(1024 : i64) : i64
+// CHECK-NEXT:      llvm.mlir.constant(1 : i64) : i64
+// CHECK-NEXT:      %[[VAL_12:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_13:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_14:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_15:.*]] = omp.map.bounds lower_bound(%[[VAL_13]] : i64) upper_bound(%[[VAL_14]] : i64) extent(%[[VAL_0]] : i64) stride(%[[VAL_12]] : i64) start_idx(%[[VAL_12]] : i64)
 // CHECK:           %[[VAL_16:.*]] = omp.map.info var_ptr(%[[VAL_8]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) bounds(%[[VAL_15]]) name("a") -> !llvm.ptr
-// CHECK:           %[[VAL_17:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_18:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_19:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_17:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_18:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_19:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_20:.*]] = omp.map.bounds lower_bound(%[[VAL_18]] : i64) upper_bound(%[[VAL_19]] : i64) extent(%[[VAL_9]] : i64) stride(%[[VAL_17]] : i64) start_idx(%[[VAL_17]] : i64)
 // CHECK:           %[[VAL_21:.*]] = omp.map.info var_ptr(%[[VAL_6]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(to) capture(ByRef) bounds(%[[VAL_20]]) name("b") -> !llvm.ptr
-// CHECK:           %[[VAL_22:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_23:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_24:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_22:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_23:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_24:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_25:.*]] = omp.map.bounds lower_bound(%[[VAL_23]] : i64) upper_bound(%[[VAL_24]] : i64) extent(%[[VAL_10]] : i64) stride(%[[VAL_22]] : i64) start_idx(%[[VAL_22]] : i64)
 // CHECK:           %[[VAL_26:.*]] = omp.map.info var_ptr(%[[VAL_4]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(always, storage) capture(ByRef) bounds(%[[VAL_25]]) name("c") -> !llvm.ptr
 // CHECK:           omp.target_enter_data map_entries(%[[VAL_16]], %[[VAL_21]], %[[VAL_26]] : !llvm.ptr, !llvm.ptr, !llvm.ptr)
-// CHECK:           %[[VAL_27:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_28:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_29:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_27:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_28:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_29:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_30:.*]] = omp.map.bounds lower_bound(%[[VAL_28]] : i64) upper_bound(%[[VAL_29]] : i64) extent(%[[VAL_0]] : i64) stride(%[[VAL_27]] : i64) start_idx(%[[VAL_27]] : i64)
 // CHECK:           %[[VAL_31:.*]] = omp.map.info var_ptr(%[[VAL_8]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) bounds(%[[VAL_30]]) name("a") -> !llvm.ptr
-// CHECK:           %[[VAL_32:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_33:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_34:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_32:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_33:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_34:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_35:.*]] = omp.map.bounds lower_bound(%[[VAL_33]] : i64) upper_bound(%[[VAL_34]] : i64) extent(%[[VAL_9]] : i64) stride(%[[VAL_32]] : i64) start_idx(%[[VAL_32]] : i64)
 // CHECK:           %[[VAL_36:.*]] = omp.map.info var_ptr(%[[VAL_6]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(from) capture(ByRef) bounds(%[[VAL_35]]) name("b") -> !llvm.ptr
-// CHECK:           %[[VAL_37:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_38:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_39:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_37:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_38:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_39:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_40:.*]] = omp.map.bounds lower_bound(%[[VAL_38]] : i64) upper_bound(%[[VAL_39]] : i64) extent(%[[VAL_10]] : i64) stride(%[[VAL_37]] : i64) start_idx(%[[VAL_37]] : i64)
 // CHECK:           %[[VAL_41:.*]] = omp.map.info var_ptr(%[[VAL_4]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(storage) capture(ByRef) bounds(%[[VAL_40]]) name("c") -> !llvm.ptr
-// CHECK:           %[[VAL_42:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_43:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_44:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_42:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_43:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_44:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_45:.*]] = omp.map.bounds lower_bound(%[[VAL_43]] : i64) upper_bound(%[[VAL_44]] : i64) extent(%[[VAL_11]] : i64) stride(%[[VAL_42]] : i64) start_idx(%[[VAL_42]] : i64)
 // CHECK:           %[[VAL_46:.*]] = omp.map.info var_ptr(%[[VAL_2]] : !llvm.ptr, !llvm.array<1024 x i32>) map_clauses(always, delete) capture(ByRef) bounds(%[[VAL_45]]) name("d") -> !llvm.ptr
 // CHECK:           omp.target_exit_data map_entries(%[[VAL_31]], %[[VAL_36]], %[[VAL_41]], %[[VAL_46]] : !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr)
@@ -374,10 +380,10 @@ func.func @_QPopenmp_target_data_region() {
 // CHECK:           %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
 // CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<1024 x i32> {bindc_name = "a"} : (i64) -> !llvm.ptr
-// CHECK:           %[[VAL_MAX:.*]] = llvm.mlir.constant(1024 : index) : i64
-// CHECK:           %[[VAL_ONE:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_ZERO:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_UPPER:.*]] = llvm.mlir.constant(1023 : index) : i64
+// CHECK:           %[[VAL_MAX:.*]] = llvm.mlir.constant(1024 : i64) : i64
+// CHECK:           %[[VAL_ONE:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_ZERO:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_UPPER:.*]] = llvm.mlir.constant(1023 : i64) : i64
 // CHECK:           %[[VAL_BOUNDS:.*]] = omp.map.bounds   lower_bound(%[[VAL_ZERO]] : i64) upper_bound(%[[VAL_UPPER]] : i64) extent(%[[VAL_MAX]] : i64) stride(%[[VAL_ONE]] : i64) start_idx(%[[VAL_ONE]] : i64)
 // CHECK:           %[[VAL_MAP:.*]] = omp.map.info var_ptr(%[[VAL_1]] : !llvm.ptr, !llvm.array<1024 x i32>)  map_clauses(tofrom) capture(ByRef) bounds(%[[VAL_BOUNDS]]) name("a") -> !llvm.ptr
 // CHECK:           omp.target_data   map_entries(%[[VAL_MAP]] : !llvm.ptr) {
@@ -385,13 +391,13 @@ func.func @_QPopenmp_target_data_region() {
 // CHECK:             %[[VAL_5:.*]] = llvm.sext %[[VAL_4]] : i32 to i64
 // CHECK:             %[[VAL_6:.*]] = llvm.mlir.constant(1024 : i32) : i32
 // CHECK:             %[[VAL_7:.*]] = llvm.sext %[[VAL_6]] : i32 to i64
-// CHECK:             %[[VAL_8:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:             %[[VAL_8:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:             %[[VAL_9:.*]] = llvm.trunc %[[VAL_5]] : i64 to i32
 // CHECK:             %[[VAL_10:.*]] = llvm.sub %[[VAL_7]], %[[VAL_5]]  : i64
 // CHECK:             %[[VAL_11:.*]] = llvm.add %[[VAL_10]], %[[VAL_8]]  : i64
 // CHECK:             llvm.br ^bb1(%[[VAL_5]], %[[VAL_9]], %[[VAL_11]] : i64, i32, i64)
 // CHECK:           ^bb1(%[[VAL_12:.*]]: i64, %[[VAL_13:.*]]: i32, %[[VAL_14:.*]]: i64):
-// CHECK:             %[[VAL_15:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:             %[[VAL_15:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:             %[[VAL_16:.*]] = llvm.icmp "sgt" %[[VAL_14]], %[[VAL_15]] : i64
 // CHECK:             llvm.cond_br %[[VAL_16]], ^bb2, ^bb3
 // CHECK:           ^bb2:
@@ -407,7 +413,7 @@ func.func @_QPopenmp_target_data_region() {
 // CHECK:             %[[VAL_25:.*]] = llvm.load %[[VAL_3]] : !llvm.ptr -> i32
 // CHECK:             %[[VAL_26:.*]] = llvm.add %[[VAL_25]], %[[VAL_24]] overflow<nsw> : i32
 // CHECK:             %[[VAL_27:.*]] = llvm.add %[[VAL_12]], %[[VAL_8]] overflow<nsw> : i64
-// CHECK:             %[[VAL_28:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:             %[[VAL_28:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:             %[[VAL_29:.*]] = llvm.sub %[[VAL_14]], %[[VAL_28]]  : i64
 // CHECK:             llvm.br ^bb1(%[[VAL_27]], %[[VAL_26]], %[[VAL_29]] : i64, i32, i64)
 // CHECK:           ^bb3:
@@ -458,11 +464,11 @@ func.func @_QPomp_target() {
 // CHECK-LABEL:   llvm.func @_QPomp_target() {
 // CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.array<512 x i32> {bindc_name = "a"} : (i64) -> !llvm.ptr
-// CHECK:           %[[EXTENT:.*]] = llvm.mlir.constant(512 : index) : i64
+// CHECK:           %[[EXTENT:.*]] = llvm.mlir.constant(512 : i64) : i64
 // CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(64 : i32) : i32
-// CHECK:           %[[STRIDE:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[LOWER:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[UPPER:.*]] = llvm.mlir.constant(511 : index) : i64
+// CHECK:           %[[STRIDE:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[LOWER:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[UPPER:.*]] = llvm.mlir.constant(511 : i64) : i64
 // CHECK:           %[[BOUNDS:.*]] = omp.map.bounds   lower_bound(%[[LOWER]] : i64) upper_bound(%[[UPPER]] : i64) extent(%[[EXTENT]] : i64) stride(%[[STRIDE]] : i64) start_idx(%[[STRIDE]] : i64)
 // CHECK:           %[[MAP:.*]] = omp.map.info var_ptr(%[[VAL_1]] : !llvm.ptr, !llvm.array<512 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) name("a") -> !llvm.ptr
 // CHECK:           omp.target kernel_type(generic) thread_limit(%[[VAL_2]] : i32) map_entries(%[[MAP]] -> %[[ARG_0:.*]] : !llvm.ptr) {
@@ -524,7 +530,7 @@ func.func @_QPsimd_with_nested_loop() {
 // CHECK-NEXT:        omp.loop_nest (%[[CNT:.*]]) : i32 = (%[[LOWER]]) to (%[[UPPER]]) inclusive step (%[[STEP]]) {
 // CHECK:               llvm.br ^bb1(%[[VAL_1:.*]], %[[VAL_2:.*]] : i64, i64)
 // CHECK:             ^bb1(%[[VAL_3:.*]]: i64, %[[VAL_4:.*]]: i64):
-// CHECK:               %[[VAL_5:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:               %[[VAL_5:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:               %[[VAL_6:.*]] = llvm.icmp "sgt" %[[VAL_4]], %[[VAL_5]] : i64
 // CHECK:               llvm.cond_br %[[VAL_6]], ^bb2, ^bb3
 // CHECK:             ^bb2:
@@ -994,8 +1000,8 @@ func.func @omp_map_info_nested_derived_type_explicit_member_conversion(%arg0 : !
 // CHECK: %[[ADDR_OF:.*]] = llvm.mlir.addressof @var_common_ : !llvm.ptr
 // CHECK: %[[CB_MAP:.*]] = omp.map.info var_ptr(%[[ADDR_OF]] : !llvm.ptr, !llvm.array<8 x i8>) map_clauses(tofrom) capture(ByRef) name("var_common") -> !llvm.ptr
 // CHECK:    omp.target kernel_type(generic) map_entries(%[[CB_MAP]] -> %[[ARG0:.*]] : !llvm.ptr) {
-// CHECK:      %[[VAR_2_OFFSET:.*]] = llvm.mlir.constant(4 : index) : i64
-// CHECK:      %[[VAR_1_OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:      %[[VAR_2_OFFSET:.*]] = llvm.mlir.constant(4 : i64) : i64
+// CHECK:      %[[VAR_1_OFFSET:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:      %{{.*}} = llvm.getelementptr %[[ARG0]][%[[VAR_1_OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
 // CHECK:      %{{.*}} = llvm.getelementptr %[[ARG0]][%[[VAR_2_OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
 
@@ -1026,8 +1032,8 @@ fir.global common @var_common_(dense<0> : vector<8xi8>) {alignment = 4 : i64} :
 
 // CHECK-LABEL:  llvm.func @omp_map_common_block_using_common_block_members
 
-// CHECK:    %[[VAR_2_OFFSET:.*]] = llvm.mlir.constant(4 : index) : i64
-// CHECK:    %[[VAR_1_OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:    %[[VAR_2_OFFSET:.*]] = llvm.mlir.constant(4 : i64) : i64
+// CHECK:    %[[VAR_1_OFFSET:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:    %[[ADDR_OF:.*]] = llvm.mlir.addressof @var_common_ : !llvm.ptr
 // CHECK:    %[[VAR_1_CB_GEP:.*]] = llvm.getelementptr %[[ADDR_OF]][%[[VAR_1_OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
 // CHECK:    %[[VAR_2_CB_GEP:.*]] = llvm.getelementptr %[[ADDR_OF]][%[[VAR_2_OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
@@ -1071,11 +1077,11 @@ func.func @use_index(%arg0 : index) {
 }
 
 // CHECK-LABEL:   llvm.func @alloca_hoisting_openmp() {
-// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(6 : index) : i64
+// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(6 : i64) : i64
 // CHECK:           %[[VAL_1:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(42 : i32) : i32
 // CHECK:           omp.parallel {
-// CHECK:             %[[VAL_3:.*]] = llvm.mlir.constant(6 : index) : i64
+// CHECK:             %[[VAL_3:.*]] = llvm.mlir.constant(6 : i64) : i64
 // CHECK:             %[[VAL_4:.*]] = llvm.alloca %[[VAL_3]] x i8 : (i64) -> !llvm.ptr
 // CHECK:             omp.wsloop {
 // CHECK:               omp.loop_nest (%[[VAL_5:.*]]) : i32 = (%[[VAL_1]]) to (%[[VAL_2]]) inclusive step (%[[VAL_1]]) {
diff --git a/flang/test/Fir/convert-to-llvm.fir b/flang/test/Fir/convert-to-llvm.fir
index f621c5715e43f..3aaab7d9c81f1 100644
--- a/flang/test/Fir/convert-to-llvm.fir
+++ b/flang/test/Fir/convert-to-llvm.fir
@@ -1105,7 +1105,7 @@ func.func @alloca_several() -> !fir.ref<i32> {
 }
 
 // CHECK-LABEL: llvm.func @alloca_several() -> !llvm.ptr
-// CHECK: [[N:%.*]] = llvm.mlir.constant(100 : index) : i64
+// CHECK: [[N:%.*]] = llvm.mlir.constant(100 : i64) : i64
 // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[TOTAL:%.*]] = llvm.mul [[ONE]], [[N]] : i64
 // GENERIC: [[A:%.*]] = llvm.alloca [[TOTAL]] x i32
@@ -1206,7 +1206,7 @@ func.func @alloca_multidim_array(%0 : index) -> !fir.ref<!fir.array<8x16x32xf32>
 
 // CHECK-LABEL: llvm.func @alloca_multidim_array
 // CHECK-SAME: ([[OP1:%.*]]: i64) -> !llvm.ptr
-// CHECK: [[OP2:%.*]] = llvm.mlir.constant(24 : index) : i64
+// CHECK: [[OP2:%.*]] = llvm.mlir.constant(24 : i64) : i64
 // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[MUL1:%.*]] = llvm.mul [[OP1]], [[ONE]] : i64
 // CHECK: [[TOTAL:%.*]] = llvm.mul [[MUL1]], [[OP2]] : i64
@@ -1227,7 +1227,7 @@ func.func @alloca_const_interior_array(%0 : index) -> !fir.ref<!fir.array<8x9x?x
 
 // CHECK-LABEL: llvm.func @alloca_const_interior_array
 // CHECK-SAME: ([[OP1:%.*]]: i64) -> !llvm.ptr
-// CHECK: [[OP2:%.*]] = llvm.mlir.constant(64 : index) : i64
+// CHECK: [[OP2:%.*]] = llvm.mlir.constant(64 : i64) : i64
 // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[MUL1:%.*]] = llvm.mul [[OP1]], [[ONE]] : i64
 // CHECK: [[TOTAL:%.*]] = llvm.mul [[MUL1]], [[OP2]] : i64
@@ -1388,7 +1388,7 @@ func.func @dead_shift() {
 
 // CHECK-LABEL: llvm.func @dead_shift
 // CHECK-NOT: fir.shift
-// CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}}
+// CHECK: %{{.*}} = llvm.mlir.constant(0 : i[[IDX:[0-9]+]]) : i[[IDX]]
 // CHECK-NEXT: llvm.return
 
 // -----
@@ -1415,7 +1415,7 @@ func.func @dead_shape() {
 
 // CHECK-LABEL: llvm.func @dead_shape
 // CHECK-NOT: fir.shape
-// CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}}
+// CHECK: %{{.*}} = llvm.mlir.constant(0 : i[[IDX:[0-9]+]]) : i[[IDX]]
 // CHECK-NEXT: llvm.return
 
 func.func @dead_shapeshift() {
@@ -1426,7 +1426,7 @@ func.func @dead_shapeshift() {
 
 // CHECK-LABEL: llvm.func @dead_shapeshift
 // CHECK-NOT: fir.shape_shift
-// CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}}
+// CHECK: %{{.*}} = llvm.mlir.constant(0 : i[[IDX:[0-9]+]]) : i[[IDX]]
 // CHECK-NEXT: llvm.return
 
 func.func @dead_slice() {
@@ -1437,7 +1437,7 @@ func.func @dead_slice() {
 
 // CHECK-LABEL: llvm.func @dead_slice
 // CHECK-NOT: fir.slice
-// CHECK: %{{.*}} = llvm.mlir.constant(0 : index) : i{{.*}}
+// CHECK: %{{.*}} = llvm.mlir.constant(0 : i[[IDX:[0-9]+]]) : i[[IDX]]
 // CHECK-NEXT: llvm.return
 
 // -----
@@ -1843,9 +1843,9 @@ func.func private @_QPxb(!fir.box<!fir.array<?x?xf64>>)
 // GENERIC:       %[[ALLOCA:.*]] = llvm.alloca %[[ALLOCA_SIZE]] x !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // AMDGPU:        %[[AA:.*]] = llvm.alloca %[[ALLOCA_SIZE]] x !llvm.struct<(ptr, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, i{{.*}}, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr<5>
 // AMDGPU:        %[[ALLOCA:.*]] = llvm.addrspacecast %[[AA]] : !llvm.ptr<5> to !llvm.ptr
-// CHECK:         %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
-// CHECK:         %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:         %[[C2:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:         %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
+// CHECK:         %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:         %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:         %[[N1_TMP:.*]] = llvm.sub %[[N]], %[[SH1]]  : i64
 // CHECK:         %[[N1:.*]] = llvm.add %[[N1_TMP]], %[[C1]]  : i64
 // CHECK:         %[[N2_TMP:.*]] = llvm.sub %[[N]], %[[SH2]]  : i64
@@ -1934,7 +1934,7 @@ func.func private @_QPtest_dt_callee(%arg0: !fir.box<!fir.array<?xi32>>)
 // GENERIC:       %[[V:.*]] = llvm.alloca %[[ALLOCA_SIZE_V]] x i32 {bindc_name = "v"} : (i64) -> !llvm.ptr
 // AMDGPU:        %[[AB:.*]] = llvm.alloca %[[ALLOCA_SIZE_V]] x i32 {bindc_name = "v"} : (i64) -> !llvm.ptr<5>
 // AMDGPU:        %[[V:.*]] = llvm.addrspacecast %[[AB]] : !llvm.ptr<5> to !llvm.ptr
-// CHECK:         %[[C20:.*]] = llvm.mlir.constant(20 : index) : i64
+// CHECK:         %[[C20:.*]] = llvm.mlir.constant(20 : i64) : i64
 // CHECK:         %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:         %[[C10:.*]] = llvm.mlir.constant(10 : i64) : i64
 // CHECK:         %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
@@ -1986,9 +1986,9 @@ func.func @_QPtest_dt_slice2(%arg0: !fir.ref<!fir.array<2x!fir.type<_QPtest_dt_s
 
 // CHECK-LABEL: llvm.func @_QPtest_dt_slice2(
 // CHECK-SAME:        %[[ARG0:.*]]: !llvm.ptr) {
-// CHECK:         %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:         %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:         %[[C2:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:         %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:         %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:         %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:         %[[C0_2:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:         %{{.*}} = llvm.getelementptr %[[ARG0]][%[[C0_2]], {{.*}}, 0, %[[C1]], %[[C0]]] : (!llvm.ptr, i64, i64, i64, i64) -> !llvm.ptr, !llvm.array<2 x struct<"_QPtest_dt_slice2Tt", (array<3 x array<2 x i32>>)>>
 // CHECK:         return
@@ -2232,11 +2232,11 @@ func.func @test_rebox_1(%arg0: !fir.box<!fir.array<?x?xf32>>) {
 //GENERIC:  %[[RESULT_BOX_REF:.*]] = llvm.alloca %[[ONE_1]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 //AMDGPU:   %[[AA:.*]] = llvm.alloca %[[ONE_1]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr<5>
 //AMDGPU:   %[[RESULT_BOX_REF:.*]] = llvm.addrspacecast %[[AA]] : !llvm.ptr<5> to !llvm.ptr
-//CHECK:    %[[THREE:.*]] = llvm.mlir.constant(3 : index) : i64
-//CHECK:    %[[FOUR:.*]] = llvm.mlir.constant(4 : index) : i64
-//CHECK:    %[[FIVE:.*]] = llvm.mlir.constant(5 : index) : i64
-//CHECK:    %[[SIX:.*]] = llvm.mlir.constant(6 : index) : i64
-//CHECK:    %[[EIGHTY:.*]] = llvm.mlir.constant(80 : index) : i64
+//CHECK:    %[[THREE:.*]] = llvm.mlir.constant(3 : i64) : i64
+//CHECK:    %[[FOUR:.*]] = llvm.mlir.constant(4 : i64) : i64
+//CHECK:    %[[FIVE:.*]] = llvm.mlir.constant(5 : i64) : i64
+//CHECK:    %[[SIX:.*]] = llvm.mlir.constant(6 : i64) : i64
+//CHECK:    %[[EIGHTY:.*]] = llvm.mlir.constant(80 : i64) : i64
 //CHECK:    %[[FLOAT_TYPE:.*]] = llvm.mlir.constant(27 : i32) : i32
 //CHECK:    %[[ELEM_SIZE_I64:.*]] = llvm.mlir.constant(4 : i64) : i64
 //CHECK:    %[[EXTRA_GEP:.*]] = llvm.getelementptr %[[ARG0]][0, 6] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
diff --git a/flang/test/Fir/embox-char.fir b/flang/test/Fir/embox-char.fir
index bdb58d4d12368..52c9aee657238 100644
--- a/flang/test/Fir/embox-char.fir
+++ b/flang/test/Fir/embox-char.fir
@@ -22,9 +22,9 @@
 // CHECK:           %[[VAL_8:.*]] = llvm.alloca %[[VAL_7]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // CHECK:           %[[VAL_9:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK:           %[[VAL_10:.*]] = llvm.alloca %[[VAL_9]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-// CHECK:           %[[VAL_11:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK:           %[[VAL_13:.*]] = llvm.mlir.constant(4 : index) : i64
+// CHECK:           %[[VAL_11:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:           %[[VAL_13:.*]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK:           %[[VAL_14:.*]] = llvm.mlir.constant(72 : i32) : i32
 // CHECK:           "llvm.intr.memcpy"(%[[VAL_10]], %[[VAL_0]], %[[VAL_14]]) <{arg_attrs = [{{.*}}], isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()
 // CHECK:           %[[VAL_15:.*]] = llvm.getelementptr %[[VAL_10]][0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
@@ -116,8 +116,8 @@ func.func @test_char4(%arg0: !fir.ref<!fir.box<!fir.heap<!fir.array<?x?x!fir.cha
 // CHECK:           %[[VAL_8:.*]] = llvm.alloca %[[VAL_7]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // CHECK:           %[[VAL_9:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK:           %[[VAL_10:.*]] = llvm.alloca %[[VAL_9]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-// CHECK:           %[[VAL_11:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[VAL_11:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_13:.*]] = llvm.mlir.constant(72 : i32) : i32
 // CHECK:           "llvm.intr.memcpy"(%[[VAL_10]], %[[VAL_0]], %[[VAL_13]]) <{arg_attrs = [{{.*}}], isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()
 // CHECK:           %[[VAL_14:.*]] = llvm.getelementptr %[[VAL_10]][0, 1] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<2 x array<3 x i64>>)>
diff --git a/flang/test/Fir/embox-substring.fir b/flang/test/Fir/embox-substring.fir
index 6ce6346f89b1d..dd597e943a240 100644
--- a/flang/test/Fir/embox-substring.fir
+++ b/flang/test/Fir/embox-substring.fir
@@ -28,7 +28,7 @@ func.func private @dump(!fir.box<!fir.array<2x!fir.char<1>>>)
 // CHECK-LABEL:   llvm.func @substring_dyn_base(
 // CHECK-SAME:                                  %[[VAL_0:.*]]: !llvm.ptr,
 // CHECK-SAME:                                  %[[VAL_1:.*]]: i64) {
-// CHECK:           %[[VAL_5:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[VAL_5:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           llvm.mlir.constant(1 : i64) : i64
 // CHECK:           llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_30:.*]] = llvm.mlir.constant(1 : i64) : i64
diff --git a/flang/test/Fir/rebox-susbtring.fir b/flang/test/Fir/rebox-susbtring.fir
index 8f7f4facd13a2..1e91f8bbbbae7 100644
--- a/flang/test/Fir/rebox-susbtring.fir
+++ b/flang/test/Fir/rebox-susbtring.fir
@@ -19,10 +19,10 @@ func.func @char_section(%arg0: !fir.box<!fir.array<?x!fir.char<1,20>>>) {
 // Only test the computation of the base address offset computation accounting for the substring
 
 // CHECK:         %[[VAL_4:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK:         %[[VAL_30:.*]] = llvm.mlir.constant(0 : i64) : i64
 
 // CHECK:         %[[VAL_37:.*]] = llvm.getelementptr %[[VAL_0]]{{\[}}0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<{{.*}}>
 // CHECK:         %[[VAL_38:.*]] = llvm.load %[[VAL_37]] : !llvm.ptr -> !llvm.ptr
-// CHECK:         %[[VAL_30:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:         %[[VAL_40:.*]] = llvm.getelementptr %[[VAL_38]]{{\[}}%[[VAL_30]], %[[VAL_4]]] : (!llvm.ptr, i64, i64) -> !llvm.ptr, !llvm.array<20 x i8>
 
 // More offset computation with descriptor strides and triplets that is not character specific ...
diff --git a/flang/test/Fir/tbaa.fir b/flang/test/Fir/tbaa.fir
index 4f7560d5abbb8..6d5041d960678 100644
--- a/flang/test/Fir/tbaa.fir
+++ b/flang/test/Fir/tbaa.fir
@@ -131,7 +131,7 @@ module {
 // CHECK:           %[[VAL_1:.*]] = llvm.alloca %[[VAL_0]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK:           %[[VAL_3:.*]] = llvm.alloca %[[VAL_2]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_5:.*]] = llvm.mlir.constant(8 : i32) : i32
 // CHECK:           %[[VAL_6:.*]] = llvm.mlir.constant(-1 : i32) : i32
 // CHECK:           %[[VAL_7:.*]] = llvm.mlir.addressof @_QFEx : !llvm.ptr
@@ -202,7 +202,7 @@ module {
 // CHECK:         }
 
 // CHECK-LABEL:   llvm.mlir.global internal @_QFEx() {addr_space = 0 : i32} : !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>, ptr, array<1 x i64>)> {
-// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[VAL_0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_1:.*]] = llvm.mlir.zero : !llvm.ptr
 // CHECK:           %[[VAL_2:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_3:.*]] = llvm.mlir.constant(-1 : i32) : i32
diff --git a/mlir/docs/TargetLLVMIR.md b/mlir/docs/TargetLLVMIR.md
index 2bcacbb4ee946..d41c4a829cbfa 100644
--- a/mlir/docs/TargetLLVMIR.md
+++ b/mlir/docs/TargetLLVMIR.md
@@ -544,15 +544,15 @@ llvm.func @caller(%arg0: !llvm.ptr) {
   %2 = llvm.insertelement %arg0, %1[1] : !descriptor
 
   // The offset is set up to zero.
-  %3 = llvm.mlir.constant(0 : index) : i64
+  %3 = llvm.mlir.constant(0 : i64) : i64
   %4 = llvm.insertelement %3, %2[2] : !descriptor
 
   // The sizes and strides are derived from the statically known values.
-  %5 = llvm.mlir.constant(2 : index) : i64
-  %6 = llvm.mlir.constant(4 : index) : i64
+  %5 = llvm.mlir.constant(2 : i64) : i64
+  %6 = llvm.mlir.constant(4 : i64) : i64
   %7 = llvm.insertelement %5, %4[3, 0] : !descriptor
   %8 = llvm.insertelement %6, %7[3, 1] : !descriptor
-  %9 = llvm.mlir.constant(1 : index) : i64
+  %9 = llvm.mlir.constant(1 : i64) : i64
   %10 = llvm.insertelement %9, %8[4, 0] : !descriptor
   %11 = llvm.insertelement %10, %9[4, 1] : !descriptor
 
@@ -667,7 +667,7 @@ llvm.func @qux(%arg0: !llvm.ptr, %arg1: !llvm.ptr,
   %7 = llvm.insertvalue %arg6, %6[4, 1] : !llvm.memref_2d
 
   // Store the descriptor in a stack-allocated space.
-  %8 = llvm.mlir.constant(1 : index) : i64
+  %8 = llvm.mlir.constant(1 : i64) : i64
   %9 = llvm.alloca %8 x !llvm.memref_2d
      : (i64) -> !llvm.ptr
   llvm.store %7, %9 : !llvm.memref_2d, !llvm.ptr
@@ -841,11 +841,11 @@ is transformed into the equivalent of the following code:
 // When the stride or, in absence of explicit strides, the trailing sizes are
 // known statically, this value is used as a constant. The natural value of
 // strides is the product of all sizes following the current dimension.
-%stride2 = llvm.mlir.constant(32 : index) : i64
+%stride2 = llvm.mlir.constant(32 : i64) : i64
 %addr2 = arith.muli %stride2, %2 : i64
 %addr3 = arith.addi %addr1, %addr2 : i64
 
-%stride3 = llvm.mlir.constant(8 : index) : i64
+%stride3 = llvm.mlir.constant(8 : i64) : i64
 %addr4 = arith.muli %stride3, %3 : i64
 %addr5 = arith.addi %addr3, %addr4 : i64
 
diff --git a/mlir/docs/Tutorials/Toy/Ch-6.md b/mlir/docs/Tutorials/Toy/Ch-6.md
index 13c28c6cb8dff..4db18b9d1d981 100644
--- a/mlir/docs/Tutorials/Toy/Ch-6.md
+++ b/mlir/docs/Tutorials/Toy/Ch-6.md
@@ -142,11 +142,11 @@ llvm.func @main() {
 
 ^bb16:
   %221 = llvm.extractvalue %25[0] : !llvm<"{ double*, i64, [2 x i64], [2 x i64] }">
-  %222 = llvm.mlir.constant(0 : index) : i64
-  %223 = llvm.mlir.constant(2 : index) : i64
+  %222 = llvm.mlir.constant(0 : i64) : i64
+  %223 = llvm.mlir.constant(2 : i64) : i64
   %224 = llvm.mul %214, %223 : i64
   %225 = llvm.add %222, %224 : i64
-  %226 = llvm.mlir.constant(1 : index) : i64
+  %226 = llvm.mlir.constant(1 : i64) : i64
   %227 = llvm.mul %219, %226 : i64
   %228 = llvm.add %225, %227 : i64
   %229 = llvm.getelementptr %221[%228] : (!llvm."double*">, i64) -> !llvm<"f64*">
diff --git a/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h b/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
index b47f4998702a0..a5ed42fe40d23 100644
--- a/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
+++ b/mlir/include/mlir/Conversion/LLVMCommon/Pattern.h
@@ -88,8 +88,9 @@ LogicalResult decomposeValue(OpBuilder &builder, Location loc, Value src,
 Value composeValue(OpBuilder &builder, Location loc, ValueRange src,
                    Type dstType);
 
-/// Creates a constant Op producing a value of `resultType` from an index-typed
-/// integer attribute.
+/// Creates an `llvm.mlir.constant` producing `value` as `resultType`, which is
+/// expected to be the converted index type. The value attribute is built from
+/// `resultType` so that the two agree.
 Value createIndexAttrConstant(OpBuilder &builder, Location loc, Type resultType,
                               int64_t value);
 
@@ -167,9 +168,9 @@ class ConvertToLLVMPattern : public ConversionPattern {
   /// buffer size from these sizes.
   ///
   /// For example, memref<4x?xf32> with `sizeInBytes = true` emits:
-  /// `sizes[0]`   = llvm.mlir.constant(4 : index) : i64
+  /// `sizes[0]`   = llvm.mlir.constant(4 : i64) : i64
   /// `sizes[1]`   = `dynamicSizes[0]`
-  /// `strides[1]` = llvm.mlir.constant(1 : index) : i64
+  /// `strides[1]` = llvm.mlir.constant(1 : i64) : i64
   /// `strides[0]` = `sizes[0]`
   /// %size        = llvm.mul `sizes[0]`, `sizes[1]` : i64
   /// %nullptr     = llvm.mlir.zero : !llvm.ptr
@@ -178,9 +179,9 @@ class ConvertToLLVMPattern : public ConversionPattern {
   /// `sizeBytes`  = llvm.ptrtoint %gep : !llvm.ptr to i64
   ///
   /// If `sizeInBytes = false`, memref<4x?xf32> emits:
-  /// `sizes[0]`   = llvm.mlir.constant(4 : index) : i64
+  /// `sizes[0]`   = llvm.mlir.constant(4 : i64) : i64
   /// `sizes[1]`   = `dynamicSizes[0]`
-  /// `strides[1]` = llvm.mlir.constant(1 : index) : i64
+  /// `strides[1]` = llvm.mlir.constant(1 : i64) : i64
   /// `strides[0]` = `sizes[0]`
   /// %size        = llvm.mul `sizes[0]`, `sizes[1]` : i64
   void getMemRefDescriptorSizes(Location loc, MemRefType memRefType,
diff --git a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
index e8f77d6c9f435..ced8673917651 100644
--- a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
+++ b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp
@@ -306,10 +306,10 @@ struct FatRawBufferCastLowering
                                    memrefType)
             : descriptor.alignedPtr(rewriter, loc);
 
-    Value offset = adaptor.getResetOffset()
-                       ? LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                                  rewriter.getIndexAttr(0))
-                       : descriptor.offset(rewriter, loc);
+    Value offset =
+        adaptor.getResetOffset()
+            ? createIndexAttrConstant(rewriter, loc, getIndexType(), 0)
+            : descriptor.offset(rewriter, loc);
 
     bool hasSizes = memrefType.getRank() > 0;
     // No need to unpack() and pack() all the individual sizes and strides,
diff --git a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
index 4e8ef252a10c9..187bdeb3fd4e9 100644
--- a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
+++ b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp
@@ -371,13 +371,97 @@ struct SelectOpOneToNLowering : public ConvertOpToLLVMPattern<arith::SelectOp> {
 // ConstantOpLowering
 //===----------------------------------------------------------------------===//
 
+/// Retypes `attr` for a `llvm.mlir.constant` of `resultType`. `arith.constant`
+/// requires the value attribute and the result to have the same type, but the
+/// type converter may map the element type to a different one, e.g. `index` to
+/// `i32` or `i64` depending on the configured index bitwidth. Build the
+/// attribute from the converted type so that the two agree wherever that is
+/// representable. Returns a null attribute if `attr` cannot be used for
+/// `resultType`.
+static TypedAttr convertConstantValue(TypedAttr attr, Type resultType) {
+  // Compare the element types the way the `llvm.mlir.constant` verifier does,
+  // which is why aggregates need not match exactly: a multi-dimensional vector
+  // constant keeps its builtin attribute type even though the result is a
+  // nested LLVM array.
+  Type sourceElementType = LLVM::getConstantElementType(attr.getType());
+  Type targetElementType = LLVM::getConstantElementType(resultType);
+  if (sourceElementType == targetElementType)
+    return attr;
+
+  auto targetIntType = dyn_cast<IntegerType>(targetElementType);
+  if (!targetIntType)
+    return {};
+
+  // The converter maps the low-precision float types that have no LLVM
+  // equivalent to an integer of the same width. The attribute stays a float
+  // attribute in that case: `llvm.mlir.constant` accepts it and takes the
+  // float semantics from it, see `getLLVMConstant`.
+  if (auto sourceFloatType = dyn_cast<FloatType>(sourceElementType)) {
+    if (sourceFloatType.getWidth() != targetIntType.getWidth())
+      return {};
+    return attr;
+  }
+
+  // Apart from those floats, `index` is the only element type the converter
+  // rewrites, so anything else is a malformed `arith.constant`. Bail out rather
+  // than reinterpret its value, which would silently change the constant (e.g.
+  // sign-extending an `i1` `true` to -1).
+  if (!isa<IndexType>(sourceElementType))
+    return {};
+  // `index` is signless but holds signed values, so narrowing to a smaller
+  // index bitwidth truncates and widening sign-extends.
+  unsigned width = targetIntType.getWidth();
+
+  if (auto intAttr = dyn_cast<IntegerAttr>(attr))
+    return IntegerAttr::get(targetIntType,
+                            intAttr.getValue().sextOrTrunc(width));
+
+  auto retypeValues = [&](DenseIntElementsAttr values) {
+    return values.mapValues(targetIntType, [&](const APInt &value) {
+      return value.sextOrTrunc(width);
+    });
+  };
+
+  if (auto denseAttr = dyn_cast<DenseIntElementsAttr>(attr))
+    return retypeValues(denseAttr);
+
+  if (auto sparseAttr = dyn_cast<SparseElementsAttr>(attr))
+    return SparseElementsAttr::get(
+        cast<ShapedType>(attr.getType()).clone(targetIntType),
+        sparseAttr.getIndices(),
+        retypeValues(cast<DenseIntElementsAttr>(sparseAttr.getValues())));
+
+  // A resource-backed elements attribute refers to a blob laid out for its own
+  // element type, so it cannot be retyped here. Keep it rather than fail the
+  // lowering: `llvm.mlir.constant` accepts an integer elements attribute for an
+  // integer result element type independently of the width.
+  if (isa<ElementsAttr>(attr))
+    return attr;
+
+  return {};
+}
+
 LogicalResult
 ConstantOpLowering::matchAndRewrite(arith::ConstantOp op, OpAdaptor adaptor,
                                     ConversionPatternRewriter &rewriter) const {
-  return LLVM::detail::oneToOneRewrite(op, LLVM::ConstantOp::getOperationName(),
-                                       adaptor.getOperands(), op->getAttrs(),
-                                       /*propAttr=*/Attribute{},
-                                       *getTypeConverter(), rewriter);
+  Type resultType = getTypeConverter()->convertType(op.getType());
+  if (!resultType)
+    return rewriter.notifyMatchFailure(op, "failed to convert result type");
+
+  TypedAttr value = convertConstantValue(op.getValue(), resultType);
+  if (!value)
+    return rewriter.notifyMatchFailure(
+        op, "failed to convert value attribute to the converted result type");
+
+  // `arith.constant` has no operands and a single result, so there is nothing
+  // for `oneToOneRewrite` to do here beyond converting `resultType` a second
+  // time.
+  DictionaryAttr discardableAttrs = op->getDiscardableAttrDictionary();
+  auto constantOp =
+      LLVM::ConstantOp::create(rewriter, op.getLoc(), resultType, value);
+  constantOp->setDiscardableAttrs(discardableAttrs);
+  rewriter.replaceOp(op, constantOp);
+  return success();
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
index 2686158f67e76..9464be346a6bc 100644
--- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
+++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
@@ -207,9 +207,9 @@ static void wrapExternalFunction(OpBuilder &builder, Location loc,
   if (resultStructType) {
     // Allocate the struct on the stack and pass the pointer.
     Type resultType = cast<LLVM::LLVMFunctionType>(wrapperType).getParamType(0);
-    Value one = LLVM::ConstantOp::create(
-        builder, loc, typeConverter.convertType(builder.getIndexType()),
-        builder.getIntegerAttr(builder.getIndexType(), 1));
+    Type indexType = typeConverter.convertType(builder.getIndexType());
+    Value one = LLVM::ConstantOp::create(builder, loc, indexType,
+                                         builder.getIntegerAttr(indexType, 1));
     Value result =
         LLVM::AllocaOp::create(builder, loc, resultType, resultStructType, one);
     args.push_back(result);
@@ -235,9 +235,9 @@ static void wrapExternalFunction(OpBuilder &builder, Location loc,
                     wrapperArgsRange.take_front(numToDrop));
 
       auto ptrTy = LLVM::LLVMPointerType::get(builder.getContext());
+      Type indexType = typeConverter.convertType(builder.getIndexType());
       Value one = LLVM::ConstantOp::create(
-          builder, loc, typeConverter.convertType(builder.getIndexType()),
-          builder.getIntegerAttr(builder.getIndexType(), 1));
+          builder, loc, indexType, builder.getIntegerAttr(indexType, 1));
       Value allocated = LLVM::AllocaOp::create(
           builder, loc, ptrTy, packed.getType(), one, /*alignment=*/0);
       LLVM::StoreOp::create(builder, loc, packed, allocated);
diff --git a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
index eeb90a7ff8150..e2d251bb109f6 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUOpsLowering.cpp
@@ -601,7 +601,7 @@ LogicalResult GPUPrintfOpToVPrintfLowering::matchAndRewrite(
   Type structType =
       LLVM::LLVMStructType::getLiteral(gpuPrintfOp.getContext(), types);
   Value one = LLVM::ConstantOp::create(rewriter, loc, rewriter.getI64Type(),
-                                       rewriter.getIndexAttr(1));
+                                       rewriter.getI64IntegerAttr(1));
   Value tempAlloc =
       LLVM::AllocaOp::create(rewriter, loc, ptrType, structType, one,
                              /*alignment=*/0);
diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
index 80b9a15ac9a41..a6530fe05411c 100644
--- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
+++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp
@@ -1081,8 +1081,8 @@ LogicalResult LegalizeLaunchFuncOpPattern::matchAndRewrite(
       uint64_t staticSize = static_cast<uint64_t>(bitwidth / 8) *
                             static_cast<uint64_t>(memrefTy.getNumElements());
 
-      Value sizeArg = LLVM::ConstantOp::create(
-          rewriter, loc, getIndexType(), rewriter.getIndexAttr(staticSize));
+      Value sizeArg =
+          createIndexAttrConstant(rewriter, loc, getIndexType(), staticSize);
       llvmArgumentsWithSizes.push_back(llvmArg); // Presumably a bare pointer.
       llvmArgumentsWithSizes.push_back(sizeArg);
     }
@@ -1260,8 +1260,8 @@ LogicalResult ConvertCreateDnTensorOpToGpuRuntimeCallPattern::matchAndRewrite(
   // the dnmat is used with spmat with 2:4 sparsity
   if (dims.size() == 2) {
     if (isSpMMCusparseLtOp(op.getDnTensor())) {
-      auto handleSz = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                               rewriter.getIndexAttr(11032));
+      auto handleSz =
+          createIndexAttrConstant(rewriter, loc, getIndexType(), 11032);
       handle = LLVM::AllocaOp::create(rewriter, loc, llvmPointerType,
                                       llvmInt8Type, handleSz, /*alignment=*/16);
       handle = LLVM::BitcastOp::create(rewriter, loc, llvmPointerType, handle);
@@ -1422,8 +1422,7 @@ LogicalResult ConvertCreate2To4SpMatOpToGpuRuntimeCallPattern::matchAndRewrite(
   auto dtp = genConstInt32From(rewriter, loc, getCuSparseDataTypeFrom(dType));
 
   // CUDA runner asserts the size is 44104 bytes.
-  auto handleSz = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                           rewriter.getIndexAttr(44104));
+  auto handleSz = createIndexAttrConstant(rewriter, loc, getIndexType(), 44104);
   Value handle = LLVM::AllocaOp::create(
       rewriter, loc, llvmPointerType, llvmInt8Type, handleSz, /*alignment=*/16);
   handle = LLVM::BitcastOp::create(rewriter, loc, llvmPointerType, handle);
@@ -1512,8 +1511,7 @@ LogicalResult ConvertSpMMBufferSizeOpToGpuRuntimeCallPattern::matchAndRewrite(
         genConstInt32From(rewriter, loc, get2To4PruneFlag(op.getSpmatA()));
     auto computeType = genConstInt32From(
         rewriter, loc, getCuSparseLtDataTypeFrom(adaptor.getComputeType()));
-    auto three = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                          rewriter.getIndexAttr(3));
+    auto three = createIndexAttrConstant(rewriter, loc, getIndexType(), 3);
     auto bufferSize =
         LLVM::AllocaOp::create(rewriter, loc, llvmPointerType, llvmPointerType,
                                three, /*alignment=*/16);
@@ -1526,12 +1524,10 @@ LogicalResult ConvertSpMMBufferSizeOpToGpuRuntimeCallPattern::matchAndRewrite(
 
     auto bufferSizePtr1 = LLVM::GEPOp::create(
         rewriter, loc, llvmPointerType, llvmPointerType, bufferSize,
-        ValueRange{LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                            rewriter.getIndexAttr(1))});
+        ValueRange{createIndexAttrConstant(rewriter, loc, getIndexType(), 1)});
     auto bufferSizePtr2 = LLVM::GEPOp::create(
         rewriter, loc, llvmPointerType, llvmPointerType, bufferSize,
-        ValueRange{LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                            rewriter.getIndexAttr(2))});
+        ValueRange{createIndexAttrConstant(rewriter, loc, getIndexType(), 2)});
     auto bufferSize0 =
         LLVM::LoadOp::create(rewriter, loc, llvmInt64Type, bufferSize);
     auto bufferSize1 =
@@ -1741,23 +1737,19 @@ LogicalResult ConvertSpMatGetSizeOpToGpuRuntimeCallPattern::matchAndRewrite(
   Location loc = op.getLoc();
   auto stream = adaptor.getAsyncDependencies().front();
 
-  auto three = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                        rewriter.getIndexAttr(3));
+  auto three = createIndexAttrConstant(rewriter, loc, getIndexType(), 3);
   auto buffer = LLVM::AllocaOp::create(rewriter, loc, llvmPointerType,
                                        llvmInt64Type, three, /*alignment=*/16);
 
   auto rowsPtr = LLVM::GEPOp::create(
       rewriter, loc, llvmPointerType, llvmPointerType, buffer,
-      ValueRange{LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                          rewriter.getIndexAttr(0))});
+      ValueRange{createIndexAttrConstant(rewriter, loc, getIndexType(), 0)});
   auto colsPtr = LLVM::GEPOp::create(
       rewriter, loc, llvmPointerType, llvmPointerType, buffer,
-      ValueRange{LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                          rewriter.getIndexAttr(1))});
+      ValueRange{createIndexAttrConstant(rewriter, loc, getIndexType(), 1)});
   auto nnzsPtr = LLVM::GEPOp::create(
       rewriter, loc, llvmPointerType, llvmPointerType, buffer,
-      ValueRange{LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                          rewriter.getIndexAttr(2))});
+      ValueRange{createIndexAttrConstant(rewriter, loc, getIndexType(), 2)});
   createSpMatGetSizeBuilder.create(
       loc, rewriter, {adaptor.getSpmat(), rowsPtr, colsPtr, nnzsPtr, stream});
   auto rows = LLVM::LoadOp::create(rewriter, loc, llvmInt64Type, rowsPtr);
diff --git a/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp b/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp
index 6254de81780f5..7c27238e57b1b 100644
--- a/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp
+++ b/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp
@@ -128,9 +128,16 @@ struct WmmaLoadOpToNVVMLowering
         cast<MemRefType>(subgroupMmaLoadMatrixOp.getSrcMemref().getType()),
         adaptor.getSrcMemref(), adaptor.getIndices());
 
+    // The NVVM op takes the leading dimension as an `i32`. Reject a value that
+    // does not fit rather than silently truncating it.
+    int64_t leadDimension =
+        subgroupMmaLoadMatrixOp.getLeadDimension().getSExtValue();
+    if (!llvm::isInt<32>(leadDimension))
+      return rewriter.notifyMatchFailure(
+          op, "leading dimension does not fit into an i32");
     Value leadingDim = LLVM::ConstantOp::create(
         rewriter, loc, rewriter.getI32Type(),
-        subgroupMmaLoadMatrixOp.getLeadDimensionAttr());
+        rewriter.getI32IntegerAttr(static_cast<int32_t>(leadDimension)));
     rewriter.replaceOpWithNewOp<NVVM::WMMALoadOp>(
         op, resType, dataPtr, leadingDim, m, n, k, layout, eltype, frag);
     return success();
@@ -183,9 +190,16 @@ struct WmmaStoreOpToNVVMLowering
         rewriter, loc,
         cast<MemRefType>(subgroupMmaStoreMatrixOp.getDstMemref().getType()),
         adaptor.getDstMemref(), adaptor.getIndices());
+    // The NVVM op takes the leading dimension as an `i32`. Reject a value that
+    // does not fit rather than silently truncating it.
+    int64_t leadDimension =
+        subgroupMmaStoreMatrixOp.getLeadDimension().getSExtValue();
+    if (!llvm::isInt<32>(leadDimension))
+      return rewriter.notifyMatchFailure(
+          op, "leading dimension does not fit into an i32");
     Value leadingDim = LLVM::ConstantOp::create(
         rewriter, loc, rewriter.getI32Type(),
-        subgroupMmaStoreMatrixOp.getLeadDimensionAttr());
+        rewriter.getI32IntegerAttr(static_cast<int32_t>(leadDimension)));
     rewriter.replaceOpWithNewOp<NVVM::WMMAStoreOp>(
         op, dataPtr, m, n, k, layout, eltype, storeOpOperands, leadingDim);
     return success();
diff --git a/mlir/lib/Conversion/LLVMCommon/Pattern.cpp b/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
index 99b67bab98231..9c116ef4f7ac2 100644
--- a/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/Pattern.cpp
@@ -58,7 +58,7 @@ Type ConvertToLLVMPattern::getVoidPtrType() const { return getPtrType(); }
 Value mlir::LLVM::createIndexAttrConstant(OpBuilder &builder, Location loc,
                                           Type resultType, int64_t value) {
   return LLVM::ConstantOp::create(builder, loc, resultType,
-                                  builder.getIndexAttr(value));
+                                  builder.getIntegerAttr(resultType, value));
 }
 
 Value ConvertToLLVMPattern::createIndexAttrConstant(OpBuilder &builder,
diff --git a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
index b267623d9b80e..2ad3397209da0 100644
--- a/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
+++ b/mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp
@@ -737,7 +737,7 @@ Value LLVMTypeConverter::promoteOneMemRefDescriptor(Location loc, Value operand,
   // alloca op and so we omit allocating at the entry block.
   auto ptrType = LLVM::LLVMPointerType::get(builder.getContext());
   Value one = LLVM::ConstantOp::create(builder, loc, builder.getI64Type(),
-                                       builder.getIndexAttr(1));
+                                       builder.getI64IntegerAttr(1));
   Value allocated =
       LLVM::AllocaOp::create(builder, loc, ptrType, operand.getType(), one);
   // Store into the alloca'ed descriptor.
diff --git a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
index 8179b121ae6cf..f956b01d225fd 100644
--- a/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
+++ b/mlir/lib/Conversion/MPIToLLVM/MPIToLLVM.cpp
@@ -68,7 +68,7 @@ std::pair<Value, Value> getRawPtrAndSize(const Location loc,
   Value resPtr =
       LLVM::GEPOp::create(rewriter, loc, ptrType, elType, dataPtr, offset);
   Value size = LLVM::ConstantOp::create(rewriter, loc, i32Type,
-                                        rewriter.getIndexAttr(1));
+                                        rewriter.getI32IntegerAttr(1));
   if (descriptorType.getBody().size() > 3) {
     for (int64_t i = 0; i < rank; ++i) {
       Value dim = LLVM::ExtractValueOp::create(rewriter, loc, memRef,
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 206dd5b992fc2..3ecaa49510d8f 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -100,8 +100,9 @@ getAlignedAllocFn(OpBuilder &b, const LLVMTypeConverter *typeConverter,
 ///   aligned = bumped - bumped % alignment
 static Value createAligned(ConversionPatternRewriter &rewriter, Location loc,
                            Value input, Value alignment) {
-  Value one = LLVM::ConstantOp::create(rewriter, loc, alignment.getType(),
-                                       rewriter.getIndexAttr(1));
+  Value one =
+      LLVM::ConstantOp::create(rewriter, loc, alignment.getType(),
+                               rewriter.getIntegerAttr(alignment.getType(), 1));
   Value bump = LLVM::SubOp::create(rewriter, loc, alignment, one);
   Value bumped = LLVM::AddOp::create(rewriter, loc, input, bump);
   Value mod = LLVM::URemOp::create(rewriter, loc, bumped, alignment);
@@ -1103,8 +1104,8 @@ struct MemRefCastOpLowering : public ConvertOpToLLVMPattern<memref::CastOp> {
           loc, adaptor.getSource(), rewriter);
 
       // rank = ConstantOp srcRank
-      auto rankVal = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                              rewriter.getIndexAttr(rank));
+      auto rankVal =
+          createIndexAttrConstant(rewriter, loc, getIndexType(), rank);
       // poison = PoisonOp
       UnrankedMemRefDescriptor memRefDesc =
           UnrankedMemRefDescriptor::poison(rewriter, loc, targetStructType);
@@ -1157,8 +1158,8 @@ class MemRefCopyOpLowering : public ConvertOpToLLVMPattern<memref::CopyOp> {
     MemRefDescriptor srcDesc(adaptor.getSource());
 
     // Compute number of elements.
-    Value numElements = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                                 rewriter.getIndexAttr(1));
+    Value numElements =
+        createIndexAttrConstant(rewriter, loc, getIndexType(), 1);
     for (int pos = 0; pos < srcType.getRank(); ++pos) {
       auto size = srcDesc.size(rewriter, loc, pos);
       numElements = LLVM::MulOp::create(rewriter, loc, numElements, size);
@@ -1223,8 +1224,7 @@ class MemRefCopyOpLowering : public ConvertOpToLLVMPattern<memref::CopyOp> {
                          : adaptor.getTarget();
 
     // Now promote the unranked descriptors to the stack.
-    auto one = LLVM::ConstantOp::create(rewriter, loc, getIndexType(),
-                                        rewriter.getIndexAttr(1));
+    auto one = createIndexAttrConstant(rewriter, loc, getIndexType(), 1);
     auto promote = [&](Value desc) {
       auto ptrType = LLVM::LLVMPointerType::get(rewriter.getContext());
       auto allocated =
@@ -1373,8 +1373,8 @@ struct MemorySpaceCastOpLowering
       int64_t bytesToSkip =
           2 * llvm::divideCeil(
                   getTypeConverter()->getPointerBitwidth(resultAddrSpace), 8);
-      Value bytesToSkipConst = LLVM::ConstantOp::create(
-          rewriter, loc, getIndexType(), rewriter.getIndexAttr(bytesToSkip));
+      Value bytesToSkipConst =
+          createIndexAttrConstant(rewriter, loc, getIndexType(), bytesToSkip);
       Value copySize =
           LLVM::SubOp::create(rewriter, loc, getIndexType(),
                               resultUnderlyingSize, bytesToSkipConst);
diff --git a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
index b155505a2dae1..7207c960985f3 100644
--- a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
+++ b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
@@ -1094,7 +1094,7 @@ struct NVGPUGenerateWarpgroupDescriptorLowering
 
 static Value makeI64Const(ImplicitLocOpBuilder &b, int32_t index) {
   return LLVM::ConstantOp::create(b, b.getIntegerType(64),
-                                  b.getI32IntegerAttr(index));
+                                  b.getI64IntegerAttr(index));
 }
 
 /// Returns a Value that holds data type enum that is expected by CUDA driver.
diff --git a/mlir/lib/Conversion/OpenACCToLLVM/ACCToLLVMUtils.cpp b/mlir/lib/Conversion/OpenACCToLLVM/ACCToLLVMUtils.cpp
index 96a306d24b491..99f9a7f622c0a 100644
--- a/mlir/lib/Conversion/OpenACCToLLVM/ACCToLLVMUtils.cpp
+++ b/mlir/lib/Conversion/OpenACCToLLVM/ACCToLLVMUtils.cpp
@@ -99,8 +99,8 @@ Value acc::getOrCreateGlobalString(Location loc, OpBuilder &builder,
       getOrCreateGlobalStringOp(loc, builder, name, value, module);
 
   Value globalPtr = LLVM::AddressOfOp::create(builder, loc, global);
-  Value cst0 =
-      LLVM::ConstantOp::create(builder, loc, i64Ty, builder.getIndexAttr(0));
+  Value cst0 = LLVM::ConstantOp::create(builder, loc, i64Ty,
+                                        builder.getI64IntegerAttr(0));
   return LLVM::GEPOp::create(builder, loc, ptrTy, global.getType(), globalPtr,
                              ArrayRef<Value>({cst0, cst0}));
 }
@@ -157,8 +157,8 @@ Value acc::createIdent(Location loc, StringRef functionName, OpBuilder &builder,
     builder.setInsertionPointToStart(block);
     Value ident = LLVM::ZeroOp::create(builder, loc, structTy);
     Value sourceBase = LLVM::AddressOfOp::create(builder, loc, sourceGlobal);
-    Value cst0 =
-        LLVM::ConstantOp::create(builder, loc, i64Ty, builder.getIndexAttr(0));
+    Value cst0 = LLVM::ConstantOp::create(builder, loc, i64Ty,
+                                          builder.getI64IntegerAttr(0));
     Value sourcePtr =
         LLVM::GEPOp::create(builder, loc, ptrTy, sourceGlobal.getType(),
                             sourceBase, ArrayRef<Value>({cst0, cst0}));
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
index e459513bc619c..04c2288b71c2c 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
@@ -331,7 +331,7 @@ class AccessChainPattern : public SPIRVToLLVMConversion<spirv::AccessChainOp> {
       return rewriter.notifyMatchFailure(op, "type conversion failed");
     Value zero =
         LLVM::ConstantOp::create(rewriter, op.getLoc(), llvmIndexType,
-                                 rewriter.getIntegerAttr(indexType, 0));
+                                 rewriter.getIntegerAttr(llvmIndexType, 0));
     indices.insert(indices.begin(), zero);
 
     auto elementType = getTypeConverter()->convertType(
diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
index 287bb7132bd11..cc230f4bafe84 100644
--- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
+++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp
@@ -45,10 +45,9 @@ static Value insertOne(ConversionPatternRewriter &rewriter,
                        int64_t pos) {
   assert(rank > 0 && "0-D vector corner case should have been handled already");
   if (rank == 1) {
-    auto idxType = rewriter.getIndexType();
+    Type idxType = typeConverter.convertType(rewriter.getIndexType());
     auto constant = LLVM::ConstantOp::create(
-        rewriter, loc, typeConverter.convertType(idxType),
-        rewriter.getIntegerAttr(idxType, pos));
+        rewriter, loc, idxType, rewriter.getIntegerAttr(idxType, pos));
     return LLVM::InsertElementOp::create(rewriter, loc, llvmType, val1, val2,
                                          constant);
   }
@@ -60,10 +59,9 @@ static Value extractOne(ConversionPatternRewriter &rewriter,
                         const LLVMTypeConverter &typeConverter, Location loc,
                         Value val, Type llvmType, int64_t rank, int64_t pos) {
   if (rank <= 1) {
-    auto idxType = rewriter.getIndexType();
+    Type idxType = typeConverter.convertType(rewriter.getIndexType());
     auto constant = LLVM::ConstantOp::create(
-        rewriter, loc, typeConverter.convertType(idxType),
-        rewriter.getIntegerAttr(idxType, pos));
+        rewriter, loc, idxType, rewriter.getIntegerAttr(idxType, pos));
     return LLVM::ExtractElementOp::create(rewriter, loc, llvmType, val,
                                           constant);
   }
diff --git a/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp b/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp
index f782be5502a8a..d6ff8504582c8 100644
--- a/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp
+++ b/mlir/lib/Conversion/XeGPUToXeVM/XeGPUToXeVM.cpp
@@ -1249,7 +1249,7 @@ class AtomicRMWToXeVMPattern : public OpConversionPattern<xegpu::AtomicRMWOp> {
     for (int i = 0; i < srcOrDstVecTy.getNumElements(); i++) {
       auto val = vector::ExtractOp::create(rewriter, loc, resVec, i);
       Value idx = LLVM::ConstantOp::create(rewriter, loc, rewriter.getI64Type(),
-                                           rewriter.getIndexAttr(i));
+                                           rewriter.getI64IntegerAttr(i));
       Value currPtr =
           LLVM::GEPOp::create(rewriter, loc, ptrTypeLLVM,
                               srcOrDstVecTy.getElementType(), basePtrLLVM, idx);
diff --git a/mlir/lib/Dialect/NVVM/Transforms/OptimizeForNVVM.cpp b/mlir/lib/Dialect/NVVM/Transforms/OptimizeForNVVM.cpp
index 0994946d09686..db6e746d3ecc6 100644
--- a/mlir/lib/Dialect/NVVM/Transforms/OptimizeForNVVM.cpp
+++ b/mlir/lib/Dialect/NVVM/Transforms/OptimizeForNVVM.cpp
@@ -73,12 +73,12 @@ LogicalResult ExpandDivF16::matchAndRewrite(LLVM::FDivOp op,
   Value refined = LLVM::FMAOp::create(rewriter, loc, err, rcp, approx);
 
   // Use refined value if approx is normal (exponent neither all 0 or all 1).
-  Value mask = LLVM::ConstantOp::create(
-      rewriter, loc, i32Type, rewriter.getUI32IntegerAttr(0x7f800000));
+  Value mask = LLVM::ConstantOp::create(rewriter, loc, i32Type,
+                                        rewriter.getI32IntegerAttr(0x7f800000));
   Value cast = LLVM::BitcastOp::create(rewriter, loc, i32Type, approx);
   Value exp = LLVM::AndOp::create(rewriter, loc, i32Type, cast, mask);
   Value zero = LLVM::ConstantOp::create(rewriter, loc, i32Type,
-                                        rewriter.getUI32IntegerAttr(0));
+                                        rewriter.getI32IntegerAttr(0));
   Value pred = LLVM::OrOp::create(
       rewriter, loc,
       LLVM::ICmpOp::create(rewriter, loc, LLVM::ICmpPredicate::eq, exp, zero),
diff --git a/mlir/test/Conversion/AMDGPUToROCDL/amdgpu-to-rocdl.mlir b/mlir/test/Conversion/AMDGPUToROCDL/amdgpu-to-rocdl.mlir
index c945bbf410c3f..8b45b04f7a86a 100644
--- a/mlir/test/Conversion/AMDGPUToROCDL/amdgpu-to-rocdl.mlir
+++ b/mlir/test/Conversion/AMDGPUToROCDL/amdgpu-to-rocdl.mlir
@@ -90,7 +90,7 @@ func.func @fat_raw_buffer_cast_reset_offset(%buf: memref<?xi32, strided<[1], off
   // CHECK-DAG: %[[maxVals:.*]] = llvm.mul %[[size0]], %[[stride0]]
   // CHECK-DAG: %[[byteSize:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK-DAG: %[[numRecords:.*]] = llvm.mul %[[maxVals]], %[[byteSize]]
-  // CHECK-DAG: %[[zeroOff:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK-DAG: %[[zeroOff:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK-DAG: %[[strideArg:.*]] = llvm.mlir.constant(0 : i16) : i16
   // GFX9:  %[[flags:.*]] = llvm.mlir.constant(159744 : i32)
   // RDNA:  %[[flags:.*]] = llvm.mlir.constant(822243328 : i32)
diff --git a/mlir/test/Conversion/AMDGPUToROCDL/load_lds-gfx950.mlir b/mlir/test/Conversion/AMDGPUToROCDL/load_lds-gfx950.mlir
index 5bbbf8405105e..ff8f19c33a437 100644
--- a/mlir/test/Conversion/AMDGPUToROCDL/load_lds-gfx950.mlir
+++ b/mlir/test/Conversion/AMDGPUToROCDL/load_lds-gfx950.mlir
@@ -21,14 +21,14 @@ func.func @fat_buffer_load_to_rocdl_f96(%global : memref<128x72xf32, #amdgpu.add
   // GFX950: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // GFX950: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[BUFFER_DESC]][1]
 
-  // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // GFX950: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // GFX950: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // GFX950: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // GFX950: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // GFX950: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // GFX950: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -62,14 +62,14 @@ func.func @fat_buffer_load_to_rocdl_f128(%global : memref<128x72xf32, #amdgpu.ad
   // GFX950: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // GFX950: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[BUFFER_DESC]][1]
 
-  // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // GFX950: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // GFX950: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // GFX950: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // GFX950: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // GFX950: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // GFX950: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // GFX950: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // GFX950: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
diff --git a/mlir/test/Conversion/AMDGPUToROCDL/load_lds.mlir b/mlir/test/Conversion/AMDGPUToROCDL/load_lds.mlir
index 1e1ef32126b7f..c2783c216d66d 100644
--- a/mlir/test/Conversion/AMDGPUToROCDL/load_lds.mlir
+++ b/mlir/test/Conversion/AMDGPUToROCDL/load_lds.mlir
@@ -21,14 +21,14 @@ func.func @global_load_to_rocdl_f32(%global : memref<128x72xf32, #gpu.address_sp
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -59,14 +59,14 @@ func.func @global_load_to_rocdl_wg_mem(%global : memref<128x72xf32>) {
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -111,14 +111,14 @@ func.func @global_load_to_rocdl_i8(%global : memref<128x72xi8, #gpu.address_spac
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast %[[ALLOC]]
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -149,14 +149,14 @@ func.func @global_load_to_rocdl_vec(%global : memref<128x72xi16, #gpu.address_sp
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast %[[ALLOC]]
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C128:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK: %[[C128:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C128]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -184,7 +184,7 @@ func.func @global_load_to_rocdl_dynamic_indices(%global : memref<512xi32, #gpu.a
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRCIDX_CAST]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[DSTIDX:.*]] = llvm.mul %[[DSTIDX_CAST]], %[[C64]] : i64
   // CHECK: %[[DSTIDX1:.*]] = llvm.add %[[DSTIDX]], %[[C0_I64]] : i64
   // CHECK: %[[LDS_PTR:.*]] = llvm.getelementptr %[[LDS_BASE]][%[[DSTIDX1]]]
@@ -216,14 +216,14 @@ func.func @fat_buffer_load_to_rocdl_f32(%global : memref<128x72xf32, #amdgpu.add
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[BUFFER_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -254,14 +254,14 @@ func.func @global_load_to_rocdl_async_f32(%global : memref<128x72xf32, #gpu.addr
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
@@ -292,14 +292,14 @@ func.func @global_load_to_rocdl_async_f32_fat_raw_buffer(%global : memref<128x72
   // CHECK: %[[LDS_DESC:.*]] = builtin.unrealized_conversion_cast
   // CHECK: %[[GLOBAL_BASE:.*]] = llvm.extractvalue %[[GLOBAL_DESC]][1]
 
-  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : index) : i64
+  // CHECK: %[[C72:.*]] = llvm.mlir.constant(72 : i64) : i64
   // CHECK: %[[MUL:.*]] = llvm.mul %[[IC12]], %[[C72]] : i64
   // CHECK: %[[SRC_OFFSET:.*]] = llvm.add %[[MUL]], %[[IC0]] : i64
 
   // CHECK: %[[GLOBAL_PTR:.*]] = llvm.getelementptr %[[GLOBAL_BASE]][%[[SRC_OFFSET]]]
   // CHECK: %[[LDS_BASE:.*]] = llvm.extractvalue %[[LDS_DESC]][1]
 
-  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK: %[[C64:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK: %[[MUL_2:.*]] = llvm.mul %[[IC32]], %[[C64]] : i64
   // CHECK: %[[DST_OFFSET:.*]] = llvm.add %[[MUL_2]], %[[IC0]] : i64
 
diff --git a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
index 8a8b48f5d6143..b399d17660217 100644
--- a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
@@ -566,7 +566,7 @@ func.func @fcmp(f32, f32) -> () {
 
 // CHECK-LABEL: @index_vector
 func.func @index_vector(%arg0: vector<4xindex>) {
-  // CHECK: %[[CST:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3]> : vector<4xindex>) : vector<4xi64>
+  // CHECK: %[[CST:.*]] = llvm.mlir.constant(dense<[0, 1, 2, 3]> : vector<4xi64>) : vector<4xi64>
   %0 = arith.constant dense<[0, 1, 2, 3]> : vector<4xindex>
   // CHECK: %[[V:.*]] = llvm.add %{{.*}}, %[[CST]] : vector<4xi64>
   %1 = arith.addi %arg0, %0 : vector<4xindex>
@@ -981,3 +981,30 @@ func.func @supported_fp_type(%arg0: f32, %arg1: vector<4xf32>, %arg2: vector<4x8
   %3 = arith.cmpf oeq, %arg0, %arg3 : f32
   return
 }
+
+// -----
+
+// The type converter maps the low-precision float types that have no LLVM
+// equivalent to an integer of the same width. The value attribute stays a float
+// attribute, which `llvm.mlir.constant` accepts for such a result type.
+
+// CHECK-LABEL: @low_precision_float_constant
+//       CHECK:   llvm.mlir.constant(1.000000e+00 : f8E4M3FN) : i8
+//       CHECK:   llvm.mlir.constant(dense<1.000000e+00> : vector<4xf8E4M3FN>) : vector<4xi8>
+func.func @low_precision_float_constant() -> (f8E4M3FN, vector<4xf8E4M3FN>) {
+  %0 = arith.constant 1.0 : f8E4M3FN
+  %1 = arith.constant dense<1.0> : vector<4xf8E4M3FN>
+  return %0, %1 : f8E4M3FN, vector<4xf8E4M3FN>
+}
+
+// -----
+
+// A sparse elements attribute of `index` element type has to be rebuilt, as it
+// cannot be retyped element-wise like a dense one.
+
+// CHECK-LABEL: @sparse_index_constant
+//       CHECK:   llvm.mlir.constant(sparse<0, 1> : vector<4xi64>) : vector<4xi64>
+func.func @sparse_index_constant() -> vector<4xindex> {
+  %0 = arith.constant sparse<[[0]], [1]> : vector<4xindex>
+  return %0 : vector<4xindex>
+}
diff --git a/mlir/test/Conversion/FuncToLLVM/calling-convention.mlir b/mlir/test/Conversion/FuncToLLVM/calling-convention.mlir
index 3b52d8fd76464..e6ffdd2ae2cf4 100644
--- a/mlir/test/Conversion/FuncToLLVM/calling-convention.mlir
+++ b/mlir/test/Conversion/FuncToLLVM/calling-convention.mlir
@@ -22,7 +22,7 @@ func.func private @external(%arg0: memref<?x?xf32>, %arg1: memref<f32>)
   // CHECK: %[[DESC07:.*]] = llvm.insertvalue %arg6, %[[DESC06]][4, 1]
 
   // Allocate on stack and store to comply with C calling convention.
-  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index)
+  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64)
   // CHECK: %[[DESC0_ALLOCA:.*]] = llvm.alloca %[[C1]] x !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.store %[[DESC07]], %[[DESC0_ALLOCA]]
 
@@ -33,7 +33,7 @@ func.func private @external(%arg0: memref<?x?xf32>, %arg1: memref<f32>)
   // CHECK: %[[DESC13:.*]] = llvm.insertvalue %arg9, %[[DESC12]][2] : !llvm.struct<(ptr, ptr, i64)>
 
   // Allocate on stack and store to comply with C calling convention.
-  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index)
+  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64)
   // CHECK: %[[DESC1_ALLOCA:.*]] = llvm.alloca %[[C1]] x !llvm.struct<(ptr, ptr, i64)>
   // CHECK: llvm.store %[[DESC13]], %[[DESC1_ALLOCA]]
 
@@ -119,8 +119,8 @@ func.func @return_var_memref_caller(%arg0: memref<4x3xf32>) {
   // CHECK: %[[CALL_RES:.*]] = llvm.call @return_var_memref
   %0 = call @return_var_memref(%arg0) : (memref<4x3xf32>) -> memref<*xf32>
 
-  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : index)
-  // CHECK: %[[TWO:.*]] = llvm.mlir.constant(2 : index)
+  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : i64)
+  // CHECK: %[[TWO:.*]] = llvm.mlir.constant(2 : i64)
   // These sizes may depend on the data layout, not matching specific values.
   // CHECK: %[[IDX_SIZE:.*]] = llvm.mlir.constant
 
@@ -146,14 +146,14 @@ func.func @return_var_memref_caller(%arg0: memref<4x3xf32>) {
 func.func @return_var_memref(%arg0: memref<4x3xf32>) -> memref<*xf32> attributes { llvm.emit_c_interface } {
   // Match the construction of the unranked descriptor.
   // CHECK: %[[ALLOCA:.*]] = llvm.alloca
-  // CHECK: %[[RANK:.*]] = llvm.mlir.constant(2 : index)
+  // CHECK: %[[RANK:.*]] = llvm.mlir.constant(2 : i64)
   // CHECK: %[[DESC_0:.*]] = llvm.mlir.poison : !llvm.struct<(i64, ptr)>
   // CHECK: %[[DESC_1:.*]] = llvm.insertvalue %[[RANK]], %[[DESC_0]][0]
   // CHECK: %[[DESC_2:.*]] = llvm.insertvalue %[[ALLOCA]], %[[DESC_1]][1]
   %0 = memref.cast %arg0: memref<4x3xf32> to memref<*xf32>
 
-  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : index)
-  // CHECK: %[[TWO:.*]] = llvm.mlir.constant(2 : index)
+  // CHECK: %[[ONE:.*]] = llvm.mlir.constant(1 : i64)
+  // CHECK: %[[TWO:.*]] = llvm.mlir.constant(2 : i64)
   // These sizes may depend on the data layout, not matching specific values.
   // CHECK: %[[IDX_SIZE:.*]] = llvm.mlir.constant
 
@@ -254,15 +254,15 @@ func.func @bare_ptr_calling_conv(%arg0: memref<4x3xf32>, %arg1 : index, %arg2 :
   // CHECK: %[[POISON_DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[INSERT_ALLOCPTR:.*]] = llvm.insertvalue %[[ARG0]], %[[POISON_DESC]][0]
   // CHECK: %[[INSERT_ALIGNEDPTR:.*]] = llvm.insertvalue %[[ARG0]], %[[INSERT_ALLOCPTR]][1]
-  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[INSERT_OFFSET:.*]] = llvm.insertvalue %[[C0]], %[[INSERT_ALIGNEDPTR]][2]
-  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[INSERT_DIM0:.*]] = llvm.insertvalue %[[C4]], %[[INSERT_OFFSET]][3, 0]
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[INSERT_STRIDE0:.*]] = llvm.insertvalue %[[C3]], %[[INSERT_DIM0]][4, 0]
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[INSERT_DIM1:.*]] = llvm.insertvalue %[[C3]], %[[INSERT_STRIDE0]][3, 1]
-  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[INSERT_STRIDE1:.*]] = llvm.insertvalue %[[C1]], %[[INSERT_DIM1]][4, 1]
 
   // CHECK: %[[ALIGNEDPTR:.*]] = llvm.extractvalue %[[INSERT_STRIDE1]][1]
@@ -283,15 +283,15 @@ func.func @bare_ptr_calling_conv_multiresult(%arg0: memref<4x3xf32>, %arg1 : ind
   // CHECK: %[[POISON_DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[INSERT_ALLOCPTR:.*]] = llvm.insertvalue %[[ARG0]], %[[POISON_DESC]][0]
   // CHECK: %[[INSERT_ALIGNEDPTR:.*]] = llvm.insertvalue %[[ARG0]], %[[INSERT_ALLOCPTR]][1]
-  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[INSERT_OFFSET:.*]] = llvm.insertvalue %[[C0]], %[[INSERT_ALIGNEDPTR]][2]
-  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[INSERT_DIM0:.*]] = llvm.insertvalue %[[C4]], %[[INSERT_OFFSET]][3, 0]
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[INSERT_STRIDE0:.*]] = llvm.insertvalue %[[C3]], %[[INSERT_DIM0]][4, 0]
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[INSERT_DIM1:.*]] = llvm.insertvalue %[[C3]], %[[INSERT_STRIDE0]][3, 1]
-  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[INSERT_STRIDE1:.*]] = llvm.insertvalue %[[C1]], %[[INSERT_DIM1]][4, 1]
 
   // CHECK: %[[ALIGNEDPTR:.*]] = llvm.extractvalue %[[INSERT_STRIDE1]][1]
diff --git a/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir b/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
index 22ebbf8618bde..173633cf08417 100644
--- a/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
+++ b/mlir/test/Conversion/FuncToLLVM/func-memref-return.mlir
@@ -20,15 +20,15 @@ func.func @check_static_return(%static : memref<32x18xf32>) -> memref<32x18xf32>
 // BAREPTR: %[[udf:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[base0:.*]] = llvm.insertvalue %[[arg]], %[[udf]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[aligned:.*]] = llvm.insertvalue %[[arg]], %[[base0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val0:.*]] = llvm.mlir.constant(0 : index) : i64
+// BAREPTR-NEXT: %[[val0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // BAREPTR-NEXT: %[[ins0:.*]] = llvm.insertvalue %[[val0]], %[[aligned]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val1:.*]] = llvm.mlir.constant(32 : index) : i64
+// BAREPTR-NEXT: %[[val1:.*]] = llvm.mlir.constant(32 : i64) : i64
 // BAREPTR-NEXT: %[[ins1:.*]] = llvm.insertvalue %[[val1]], %[[ins0]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val2:.*]] = llvm.mlir.constant(18 : index) : i64
+// BAREPTR-NEXT: %[[val2:.*]] = llvm.mlir.constant(18 : i64) : i64
 // BAREPTR-NEXT: %[[ins2:.*]] = llvm.insertvalue %[[val2]], %[[ins1]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val3:.*]] = llvm.mlir.constant(18 : index) : i64
+// BAREPTR-NEXT: %[[val3:.*]] = llvm.mlir.constant(18 : i64) : i64
 // BAREPTR-NEXT: %[[ins3:.*]] = llvm.insertvalue %[[val3]], %[[ins2]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val4:.*]] = llvm.mlir.constant(1 : index) : i64
+// BAREPTR-NEXT: %[[val4:.*]] = llvm.mlir.constant(1 : i64) : i64
 // BAREPTR-NEXT: %[[ins4:.*]] = llvm.insertvalue %[[val4]], %[[ins3]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[base1:.*]] = llvm.extractvalue %[[ins4]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: llvm.return %[[base1]] : !llvm.ptr
@@ -47,15 +47,15 @@ func.func @check_static_return_with_offset(%static : memref<32x18xf32, strided<[
 // BAREPTR: %[[udf:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[base0:.*]] = llvm.insertvalue %[[arg]], %[[udf]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[aligned:.*]] = llvm.insertvalue %[[arg]], %[[base0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val0:.*]] = llvm.mlir.constant(7 : index) : i64
+// BAREPTR-NEXT: %[[val0:.*]] = llvm.mlir.constant(7 : i64) : i64
 // BAREPTR-NEXT: %[[ins0:.*]] = llvm.insertvalue %[[val0]], %[[aligned]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val1:.*]] = llvm.mlir.constant(32 : index) : i64
+// BAREPTR-NEXT: %[[val1:.*]] = llvm.mlir.constant(32 : i64) : i64
 // BAREPTR-NEXT: %[[ins1:.*]] = llvm.insertvalue %[[val1]], %[[ins0]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val2:.*]] = llvm.mlir.constant(22 : index) : i64
+// BAREPTR-NEXT: %[[val2:.*]] = llvm.mlir.constant(22 : i64) : i64
 // BAREPTR-NEXT: %[[ins2:.*]] = llvm.insertvalue %[[val2]], %[[ins1]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val3:.*]] = llvm.mlir.constant(18 : index) : i64
+// BAREPTR-NEXT: %[[val3:.*]] = llvm.mlir.constant(18 : i64) : i64
 // BAREPTR-NEXT: %[[ins3:.*]] = llvm.insertvalue %[[val3]], %[[ins2]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// BAREPTR-NEXT: %[[val4:.*]] = llvm.mlir.constant(1 : index) : i64
+// BAREPTR-NEXT: %[[val4:.*]] = llvm.mlir.constant(1 : i64) : i64
 // BAREPTR-NEXT: %[[ins4:.*]] = llvm.insertvalue %[[val4]], %[[ins3]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: %[[base1:.*]] = llvm.extractvalue %[[ins4]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // BAREPTR-NEXT: llvm.return %[[base1]] : !llvm.ptr
@@ -75,11 +75,11 @@ func.func @check_memref_func_call(%in : memref<10xi8>) -> memref<20xi8> {
   // BAREPTR-NEXT:    %[[desc0:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // BAREPTR-NEXT:    %[[desc1:.*]] = llvm.insertvalue %[[call]], %[[desc0]][0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // BAREPTR-NEXT:    %[[desc2:.*]] = llvm.insertvalue %[[call]], %[[desc1]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // BAREPTR-NEXT:    %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // BAREPTR-NEXT:    %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // BAREPTR-NEXT:    %[[desc4:.*]] = llvm.insertvalue %[[c0]], %[[desc2]][2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // BAREPTR-NEXT:    %[[c20:.*]] = llvm.mlir.constant(20 : index) : i64
+  // BAREPTR-NEXT:    %[[c20:.*]] = llvm.mlir.constant(20 : i64) : i64
   // BAREPTR-NEXT:    %[[desc6:.*]] = llvm.insertvalue %[[c20]], %[[desc4]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // BAREPTR-NEXT:    %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // BAREPTR-NEXT:    %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // BAREPTR-NEXT:    %[[outDesc:.*]] = llvm.insertvalue %[[c1]], %[[desc6]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %res = call @foo(%in) : (memref<10xi8>) -> (memref<20xi8>)
   // BAREPTR-NEXT:    %[[res:.*]] = llvm.extractvalue %[[outDesc]][0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
diff --git a/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir b/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
index 6a04960e3513a..edba803ad0d75 100644
--- a/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
+++ b/mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir
@@ -31,12 +31,12 @@ func.func @simple_loop() {
   cf.br ^bb1
 
 // CHECK-NEXT: ^bb1:	// pred: ^bb0
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK32-NEXT: ^bb1:	// pred: ^bb0
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i32
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : i32) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(42 : i32) : i32
 // CHECK32-NEXT:  llvm.br ^bb2({{.*}} : i32)
 ^bb1:	// pred: ^bb0
   %c1 = arith.constant 1 : index
@@ -55,12 +55,12 @@ func.func @simple_loop() {
 
 // CHECK:      ^bb3:	// pred: ^bb2
 // CHECK-NEXT:  llvm.call @body({{.*}}) : (i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK32:      ^bb3:	// pred: ^bb2
 // CHECK32-NEXT:  llvm.call @body({{.*}}) : (i32) -> ()
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : i32) : i32
 // CHECK32-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i32
 // CHECK32-NEXT:  llvm.br ^bb2({{.*}} : i32)
 ^bb3:	// pred: ^bb2
@@ -125,12 +125,12 @@ func.func @func_args(i32, i32) -> i32 {
   cf.br ^bb1
 
 // CHECK-NEXT: ^bb1:	// pred: ^bb0
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK32-NEXT: ^bb1:	// pred: ^bb0
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i32
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(0 : i32) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(42 : i32) : i32
 // CHECK32-NEXT:  llvm.br ^bb2({{.*}} : i32)
 ^bb1:	// pred: ^bb0
   %c0 = arith.constant 0 : index
@@ -152,7 +152,7 @@ func.func @func_args(i32, i32) -> i32 {
 // CHECK-NEXT:  {{.*}} = llvm.call @other({{.*}}, %arg0) : (i64, i32) -> i32
 // CHECK-NEXT:  {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (i64, i32) -> i32
 // CHECK-NEXT:  {{.*}} = llvm.call @other({{.*}}, %arg1) : (i64, i32) -> i32
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK32-NEXT: ^bb3:	// pred: ^bb2
@@ -160,7 +160,7 @@ func.func @func_args(i32, i32) -> i32 {
 // CHECK32-NEXT:  {{.*}} = llvm.call @other({{.*}}, %arg0) : (i32, i32) -> i32
 // CHECK32-NEXT:  {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (i32, i32) -> i32
 // CHECK32-NEXT:  {{.*}} = llvm.call @other({{.*}}, %arg1) : (i32, i32) -> i32
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(1 : i32) : i32
 // CHECK32-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i32
 // CHECK32-NEXT:  llvm.br ^bb2({{.*}} : i32)
 ^bb3:	// pred: ^bb2
@@ -173,11 +173,11 @@ func.func @func_args(i32, i32) -> i32 {
   cf.br ^bb2(%6 : index)
 
 // CHECK-NEXT: ^bb4:	// pred: ^bb2
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (i64, i32) -> i32
 // CHECK-NEXT:  llvm.return {{.*}} : i32
 // CHECK32-NEXT: ^bb4:	// pred: ^bb2
-// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i32
+// CHECK32-NEXT:  {{.*}} = llvm.mlir.constant(0 : i32) : i32
 // CHECK32-NEXT:  {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (i32, i32) -> i32
 // CHECK32-NEXT:  llvm.return {{.*}} : i32
 ^bb4:	// pred: ^bb2
@@ -205,8 +205,8 @@ func.func @imperfectly_nested_loops() {
   cf.br ^bb1
 
 // CHECK-NEXT: ^bb1:	// pred: ^bb0
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 ^bb1:	// pred: ^bb0
   %c0 = arith.constant 0 : index
@@ -228,8 +228,8 @@ func.func @imperfectly_nested_loops() {
   cf.br ^bb4
 
 // CHECK-NEXT: ^bb4:	// pred: ^bb3
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(7 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(56 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(7 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(56 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb5({{.*}} : i64)
 ^bb4:	// pred: ^bb3
   %c7 = arith.constant 7 : index
@@ -245,7 +245,7 @@ func.func @imperfectly_nested_loops() {
 
 // CHECK-NEXT: ^bb6:	// pred: ^bb5
 // CHECK-NEXT:  llvm.call @body2({{.*}}, {{.*}}) : (i64, i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(2 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(2 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb5({{.*}} : i64)
 ^bb6:	// pred: ^bb5
@@ -256,7 +256,7 @@ func.func @imperfectly_nested_loops() {
 
 // CHECK-NEXT: ^bb7:	// pred: ^bb5
 // CHECK-NEXT:  llvm.call @post({{.*}}) : (i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 ^bb7:	// pred: ^bb5
@@ -281,8 +281,8 @@ func.func private @body3(index, index)
 // CHECK-LABEL: func @more_imperfectly_nested_loops() {
 // CHECK-NEXT:  llvm.br ^bb1
 // CHECK-NEXT:^bb1:	// pred: ^bb0
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(0 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(42 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK-NEXT:^bb2({{.*}}: i64):	// 2 preds: ^bb1, ^bb11
 // CHECK-NEXT:  {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : i64
@@ -291,35 +291,35 @@ func.func private @body3(index, index)
 // CHECK-NEXT:  llvm.call @pre({{.*}}) : (i64) -> ()
 // CHECK-NEXT:  llvm.br ^bb4
 // CHECK-NEXT:^bb4:	// pred: ^bb3
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(7 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(56 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(7 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(56 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb5({{.*}} : i64)
 // CHECK-NEXT:^bb5({{.*}}: i64):	// 2 preds: ^bb4, ^bb6
 // CHECK-NEXT:  {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.cond_br {{.*}}, ^bb6, ^bb7
 // CHECK-NEXT:^bb6:	// pred: ^bb5
 // CHECK-NEXT:  llvm.call @body2({{.*}}, {{.*}}) : (i64, i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(2 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(2 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb5({{.*}} : i64)
 // CHECK-NEXT:^bb7:	// pred: ^bb5
 // CHECK-NEXT:  llvm.call @mid({{.*}}) : (i64) -> ()
 // CHECK-NEXT:  llvm.br ^bb8
 // CHECK-NEXT:^bb8:	// pred: ^bb7
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(18 : index) : i64
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(37 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(18 : i64) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(37 : i64) : i64
 // CHECK-NEXT:  llvm.br ^bb9({{.*}} : i64)
 // CHECK-NEXT:^bb9({{.*}}: i64):	// 2 preds: ^bb8, ^bb10
 // CHECK-NEXT:  {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.cond_br {{.*}}, ^bb10, ^bb11
 // CHECK-NEXT:^bb10:	// pred: ^bb9
 // CHECK-NEXT:  llvm.call @body3({{.*}}, {{.*}}) : (i64, i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(3 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(3 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb9({{.*}} : i64)
 // CHECK-NEXT:^bb11:	// pred: ^bb9
 // CHECK-NEXT:  llvm.call @post({{.*}}) : (i64) -> ()
-// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : index) : i64
+// CHECK-NEXT:  {{.*}} = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT:  {{.*}} = llvm.add {{.*}}, {{.*}} : i64
 // CHECK-NEXT:  llvm.br ^bb2({{.*}} : i64)
 // CHECK-NEXT:^bb12:	// pred: ^bb2
diff --git a/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr-intersperse-size.mlir b/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr-intersperse-size.mlir
index 171b13da22713..150a774b0eae2 100644
--- a/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr-intersperse-size.mlir
+++ b/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr-intersperse-size.mlir
@@ -12,9 +12,9 @@ module attributes {gpu.container_module, spirv.target_env = #spirv.target_env<#s
     // CHECK: [[PTR1:%.*]] = llvm.extractvalue [[RANK1UMD]][1]
     // CHECK: [[PTR2:%.*]] = llvm.extractvalue [[RANK2UMD]][1]
     // CHECK: [[PTR3:%.*]] = llvm.extractvalue [[RANK2UMD]][1]
-    // CHECK: [[SIZE1:%.*]] = llvm.mlir.constant(32 : index) : i64
-    // CHECK: [[SIZE2:%.*]] = llvm.mlir.constant(256 : index) : i64
-    // CHECK: [[SIZE3:%.*]] = llvm.mlir.constant(48 : index) : i64
+    // CHECK: [[SIZE1:%.*]] = llvm.mlir.constant(32 : i64) : i64
+    // CHECK: [[SIZE2:%.*]] = llvm.mlir.constant(256 : i64) : i64
+    // CHECK: [[SIZE3:%.*]] = llvm.mlir.constant(48 : i64) : i64
     %6 = builtin.unrealized_conversion_cast %rank1UndefMemrefDescriptor : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> to memref<8xf32>
     %10 = builtin.unrealized_conversion_cast %rank2UndefMemrefDescriptor : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> to memref<8x8xi32>
     %14 = builtin.unrealized_conversion_cast %rank2UndefMemrefDescriptor : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> to memref<4x12xi8>
diff --git a/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr.mlir b/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr.mlir
index a13524432cfae..2d237372fb65f 100644
--- a/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr.mlir
+++ b/mlir/test/Conversion/GPUCommon/lower-launch-func-bare-ptr.mlir
@@ -6,11 +6,11 @@ module attributes {gpu.container_module} {
       %0 = llvm.mlir.undef : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
       %1 = llvm.insertvalue %arg1, %0[0] : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
       %2 = llvm.insertvalue %arg1, %1[1] : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
-      %3 = llvm.mlir.constant(0 : index) : i64
+      %3 = llvm.mlir.constant(0 : i64) : i64
       %4 = llvm.insertvalue %3, %2[2] : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
-      %5 = llvm.mlir.constant(10 : index) : i64
+      %5 = llvm.mlir.constant(10 : i64) : i64
       %6 = llvm.insertvalue %5, %4[3, 0] : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
-      %7 = llvm.mlir.constant(1 : index) : i64
+      %7 = llvm.mlir.constant(1 : i64) : i64
       %8 = llvm.insertvalue %7, %6[4, 0] : !llvm.struct<(ptr<1>, ptr<1>, i64, array<1 x i64>, array<1 x i64>)>
       llvm.return
     }
diff --git a/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir b/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir
index 79baa8c894120..61726c05f36d1 100644
--- a/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir
+++ b/mlir/test/Conversion/GPUCommon/lower-launch-func-to-gpu-runtime-calls.mlir
@@ -11,7 +11,7 @@ module attributes {gpu.container_module} {
   }
 
   func.func @foo(%buffer: memref<?xf32>) {
-  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i64
+  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : i64) : i64
   // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i32
   // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i32
     %c8 = arith.constant 8 : index
@@ -45,10 +45,10 @@ module attributes {gpu.container_module} {
   }
 
   func.func @foo(%buffer: memref<?xf32>) {
-  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i64
+  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : i64) : i64
   // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i32
   // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i32
-  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : i64) : i64
     %c8 = arith.constant 8 : index    
     %c32 = arith.constant 32 : i32
     %c256 = arith.constant 256 : i32
@@ -76,10 +76,10 @@ module attributes {gpu.container_module} {
   gpu.binary @kernel_module [#gpu.object<#rocdl.target, "blob">]
 
   func.func @foo(%buffer: memref<?xf32>) {
-  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : index) : i64
+  // CHECK: [[C8:%.*]] = llvm.mlir.constant(8 : i64) : i64
   // CHECK: [[C32:%.*]] = llvm.mlir.constant(32 : i32) : i32
   // CHECK: [[C256:%.*]] = llvm.mlir.constant(256 : i32) : i32
-  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : i64) : i64
     %c8 = arith.constant 8 : index
     %c32 = arith.constant 32 : i32
     %c256 = arith.constant 256 : i32
diff --git a/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir b/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
index a3a6f53e5c0ad..38e73ea9179ac 100644
--- a/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
+++ b/mlir/test/Conversion/GPUCommon/memory-attrbution.mlir
@@ -15,21 +15,21 @@ gpu.module @kernel {
     // NVVM: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
     // NVVM: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // NVVM: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // NVVM: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // NVVM: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // NVVM: %[[descr6:.*]] = llvm.insertvalue %[[c1]], %[[descr5]][4, 0]
 
     // ROCDL: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr<5>, ptr<5>, i64, array<1 x i64>, array<1 x i64>)>
     // ROCDL: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // ROCDL: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // ROCDL: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // ROCDL: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // ROCDL: %[[descr6:.*]] = llvm.insertvalue %[[c1]], %[[descr5]][4, 0]
 
     // "Store" lowering should work just as any other memref, only check that
@@ -79,21 +79,21 @@ gpu.module @kernel {
     // NVVM: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<1 x i64>, array<1 x i64>)>
     // NVVM: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // NVVM: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // NVVM: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // NVVM: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // NVVM: %[[descr6:.*]] = llvm.insertvalue %[[c1]], %[[descr5]][4, 0]
 
     // ROCDL: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<1 x i64>, array<1 x i64>)>
     // ROCDL: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // ROCDL: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // ROCDL: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // ROCDL: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // ROCDL: %[[descr6:.*]] = llvm.insertvalue %[[c1]], %[[descr5]][4, 0]
 
     // "Store" lowering should work just as any other memref, only check that
@@ -140,37 +140,37 @@ gpu.module @kernel {
     // NVVM: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
     // NVVM: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // NVVM: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // NVVM: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // NVVM: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // NVVM: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // NVVM: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // NVVM: %[[c12:.*]] = llvm.mlir.constant(12 : index) : i64
+    // NVVM: %[[c12:.*]] = llvm.mlir.constant(12 : i64) : i64
     // NVVM: %[[descr6:.*]] = llvm.insertvalue %[[c12]], %[[descr5]][4, 0]
-    // NVVM: %[[c2:.*]] = llvm.mlir.constant(2 : index) : i64
+    // NVVM: %[[c2:.*]] = llvm.mlir.constant(2 : i64) : i64
     // NVVM: %[[descr7:.*]] = llvm.insertvalue %[[c2]], %[[descr6]][3, 1]
-    // NVVM: %[[c6:.*]] = llvm.mlir.constant(6 : index) : i64
+    // NVVM: %[[c6:.*]] = llvm.mlir.constant(6 : i64) : i64
     // NVVM: %[[descr8:.*]] = llvm.insertvalue %[[c6]], %[[descr7]][4, 1]
-    // NVVM: %[[c6:.*]] = llvm.mlir.constant(6 : index) : i64
+    // NVVM: %[[c6:.*]] = llvm.mlir.constant(6 : i64) : i64
     // NVVM: %[[descr9:.*]] = llvm.insertvalue %[[c6]], %[[descr8]][3, 2]
-    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // NVVM: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // NVVM: %[[descr10:.*]] = llvm.insertvalue %[[c1]], %[[descr9]][4, 2]
 
     // ROCDL: %[[descr1:.*]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
     // ROCDL: %[[descr2:.*]] = llvm.insertvalue %[[raw]], %[[descr1]][0]
     // ROCDL: %[[descr3:.*]] = llvm.insertvalue %[[raw]], %[[descr2]][1]
-    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+    // ROCDL: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
     // ROCDL: %[[descr4:.*]] = llvm.insertvalue %[[c0]], %[[descr3]][2]
-    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : index) : i64
+    // ROCDL: %[[c4:.*]] = llvm.mlir.constant(4 : i64) : i64
     // ROCDL: %[[descr5:.*]] = llvm.insertvalue %[[c4]], %[[descr4]][3, 0]
-    // ROCDL: %[[c12:.*]] = llvm.mlir.constant(12 : index) : i64
+    // ROCDL: %[[c12:.*]] = llvm.mlir.constant(12 : i64) : i64
     // ROCDL: %[[descr6:.*]] = llvm.insertvalue %[[c12]], %[[descr5]][4, 0]
-    // ROCDL: %[[c2:.*]] = llvm.mlir.constant(2 : index) : i64
+    // ROCDL: %[[c2:.*]] = llvm.mlir.constant(2 : i64) : i64
     // ROCDL: %[[descr7:.*]] = llvm.insertvalue %[[c2]], %[[descr6]][3, 1]
-    // ROCDL: %[[c6:.*]] = llvm.mlir.constant(6 : index) : i64
+    // ROCDL: %[[c6:.*]] = llvm.mlir.constant(6 : i64) : i64
     // ROCDL: %[[descr8:.*]] = llvm.insertvalue %[[c6]], %[[descr7]][4, 1]
-    // ROCDL: %[[c6:.*]] = llvm.mlir.constant(6 : index) : i64
+    // ROCDL: %[[c6:.*]] = llvm.mlir.constant(6 : i64) : i64
     // ROCDL: %[[descr9:.*]] = llvm.insertvalue %[[c6]], %[[descr8]][3, 2]
-    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : index) : i64
+    // ROCDL: %[[c1:.*]] = llvm.mlir.constant(1 : i64) : i64
     // ROCDL: %[[descr10:.*]] = llvm.insertvalue %[[c1]], %[[descr9]][4, 2]
 
     %c0 = arith.constant 0 : index
@@ -245,11 +245,15 @@ gpu.module @kernel {
   gpu.func @explicitAlign(%arg0 : index)
     workgroup(%arg1: memref<48xf32, #gpu.address_space<workgroup>> {llvm.align = 8 : i64})
     private(%arg2: memref<48xf32, #gpu.address_space<private>> {llvm.align = 4 : i64}) {
+    // Anchor past the workgroup descriptor, whose size constant is
+    // indistinguishable from the alloca's.
+    // NVVM: llvm.insertvalue %{{.*}}[4, 0]
     // NVVM: %[[size:.*]] = llvm.mlir.constant(48 : i64) : i64
-    // NVVM: %[[raw:.*]] = llvm.alloca %[[size]] x f32 {alignment = 4 : i64} : (i64) -> !llvm.ptr
+    // NVVM-NEXT: %[[raw:.*]] = llvm.alloca %[[size]] x f32 {alignment = 4 : i64} : (i64) -> !llvm.ptr
 
+    // ROCDL: llvm.insertvalue %{{.*}}[4, 0]
     // ROCDL: %[[size:.*]] = llvm.mlir.constant(48 : i64) : i64
-    // ROCDL: %[[raw:.*]] = llvm.alloca %[[size]] x f32 {alignment = 4 : i64} : (i64) -> !llvm.ptr<5>
+    // ROCDL-NEXT: %[[raw:.*]] = llvm.alloca %[[size]] x f32 {alignment = 4 : i64} : (i64) -> !llvm.ptr<5>
 
     %val = memref.load %arg1[%arg0] : memref<48xf32, #gpu.address_space<workgroup>>
     memref.store %val, %arg2[%arg0] : memref<48xf32, #gpu.address_space<private>>
diff --git a/mlir/test/Conversion/GPUToLLVMSPV/gpu-to-llvm-spv.mlir b/mlir/test/Conversion/GPUToLLVMSPV/gpu-to-llvm-spv.mlir
index 913c8b88d8e94..43fe86b05041f 100644
--- a/mlir/test/Conversion/GPUToLLVMSPV/gpu-to-llvm-spv.mlir
+++ b/mlir/test/Conversion/GPUToLLVMSPV/gpu-to-llvm-spv.mlir
@@ -513,6 +513,9 @@ gpu.module @kernels {
 // CHECK:           %[[VAL_79:.*]] = llvm.mlir.constant(32 : i64) : i64
 // CHECK:           %[[VAL_80:.*]] = llvm.alloca %[[VAL_79]] x i32 : (i64) -> !llvm.ptr
 
+// Anchor past the first private descriptor, whose size constant is
+// indistinguishable from the next alloca's.
+// CHECK:           llvm.insertvalue %{{.*}}[4, 0]
 // CHECK:           %[[VAL_91:.*]] = llvm.mlir.constant(32 : i64) : i64
 // CHECK-64:        %[[VAL_92:.*]] = llvm.alloca %[[VAL_91]] x i64 : (i64) -> !llvm.ptr
 // CHECK-32:        %[[VAL_92:.*]] = llvm.alloca %[[VAL_91]] x i32 : (i64) -> !llvm.ptr
diff --git a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
index d97ff465af444..c07f7a9725562 100644
--- a/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir
@@ -660,7 +660,7 @@ gpu.module @test_module_29 {
   gpu.func @test_const_printf() {
     // CHECK-NEXT: %[[FORMATSTR:.*]] = llvm.mlir.addressof @[[$PRINT_GLOBAL0]] : !llvm.ptr
     // CHECK-NEXT: %[[FORMATSTART:.*]] = llvm.getelementptr %[[FORMATSTR]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<14 x i8>
-    // CHECK-NEXT: %[[O:.*]] = llvm.mlir.constant(1 : index) : i64
+    // CHECK-NEXT: %[[O:.*]] = llvm.mlir.constant(1 : i64) : i64
     // CHECK-NEXT: %[[ALLOC:.*]] = llvm.alloca %[[O]] x !llvm.struct<()> : (i64) -> !llvm.ptr
     // CHECK-NEXT: llvm.call @vprintf(%[[FORMATSTART]], %[[ALLOC]]) : (!llvm.ptr, !llvm.ptr) -> i32
     gpu.printf "Hello, world\n"
@@ -680,7 +680,7 @@ gpu.module @test_module_29 {
     // CHECK-NEXT: %[[FORMATSTR:.*]] = llvm.mlir.addressof @[[$PRINT_GLOBAL1]] : !llvm.ptr
     // CHECK-NEXT: %[[FORMATSTART:.*]] = llvm.getelementptr %[[FORMATSTR]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<11 x i8>
     // CHECK-NEXT: %[[EXT:.+]] = llvm.fpext %[[ARG1]] : f32 to f64
-    // CHECK-NEXT: %[[O:.*]] = llvm.mlir.constant(1 : index) : i64
+    // CHECK-NEXT: %[[O:.*]] = llvm.mlir.constant(1 : i64) : i64
     // CHECK-NEXT: %[[ALLOC:.*]] = llvm.alloca %[[O]] x !llvm.struct<(i32, f64)> : (i64) -> !llvm.ptr
     // CHECK-NEXT: %[[EL0:.*]] = llvm.getelementptr %[[ALLOC]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, f64)>
     // CHECK-NEXT: llvm.store %[[ARG0]], %[[EL0]] : i32, !llvm.ptr
diff --git a/mlir/test/Conversion/GPUToNVVM/wmma-ops-to-nvvm.mlir b/mlir/test/Conversion/GPUToNVVM/wmma-ops-to-nvvm.mlir
index aab9e2cded65d..31bdca01d7ae7 100644
--- a/mlir/test/Conversion/GPUToNVVM/wmma-ops-to-nvvm.mlir
+++ b/mlir/test/Conversion/GPUToNVVM/wmma-ops-to-nvvm.mlir
@@ -12,26 +12,26 @@ gpu.module @test_module {
     %i = arith.constant 16 : index
     %j = arith.constant 16 : index
     %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] leadDimension 32 transpose : memref<32x32xf16, 3> -> !gpu.mma_matrix<16x16xf16, "AOp">
-    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i64
+    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : i64) : i64
     // CHECK: %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK:  %[[BASE:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i64
+    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : i64) : i64
     // CHECK:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]  : i64
     // CHECK:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i64
     // CHECK:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f16
-    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK:  %[[FRAG:.*]] = nvvm.wmma.load %[[ADDRESS]], %[[LDM32]]
     // CHECK-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <f16>, fragment = a  : (!llvm.ptr<3>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK:  llvm.return %[[FRAG]] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
 
-    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i32
+    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : i32) : i32
     // CHECK32: %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK32:  %[[BASE:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i32, array<2 x i32>, array<2 x i32>)>
-    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]  : i32
     // CHECK32:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i32
     // CHECK32:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i32) -> !llvm.ptr<3>, f16
-    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  %[[FRAG:.*]] = nvvm.wmma.load %[[ADDRESS]], %[[LDM32]]
     // CHECK32-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <f16>, fragment = a  : (!llvm.ptr<3>) -> !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK32:  llvm.return %[[FRAG]] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
@@ -51,26 +51,26 @@ gpu.module @test_module {
     %i = arith.constant 16 : index
     %j = arith.constant 16 : index
     %0 = gpu.subgroup_mma_load_matrix %wg[%i, %j] leadDimension 32 transpose : memref<32x32xi8, 3> -> !gpu.mma_matrix<16x16xsi8, "AOp">
-    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i64
+    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : i64) : i64
     // CHECK: %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK:  %[[BASE:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i64
+    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : i64) : i64
     // CHECK:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]  : i64
     // CHECK:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i64
     // CHECK:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, i8
-    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK:  %[[FRAG:.*]] = nvvm.wmma.load %[[ADDRESS]], %[[LDM32]]
     // CHECK-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <s8>, fragment = a  : (!llvm.ptr<3>) -> !llvm.struct<(i32, i32)>
     // CHECK:  llvm.return %[[FRAG]] : !llvm.struct<(i32, i32)>
 
-    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i32
+    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : i32) : i32
     // CHECK32: %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK32:  %[[BASE:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i32, array<2 x i32>, array<2 x i32>)>
-    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]  : i32
     // CHECK32:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i32
     // CHECK32:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i32) -> !llvm.ptr<3>, i8
-    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  %[[FRAG:.*]] = nvvm.wmma.load %[[ADDRESS]], %[[LDM32]]
     // CHECK32-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <s8>, fragment = a  : (!llvm.ptr<3>) -> !llvm.struct<(i32, i32)>
     // CHECK32:  llvm.return %[[FRAG]] : !llvm.struct<(i32, i32)>
@@ -94,7 +94,7 @@ gpu.module @test_module {
     // CHECK: %[[MUL:.*]] = llvm.mul %{{.*}}, %{{.*}} : i64
     // CHECK: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}} : i64
     // CHECK: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f64
-    // CHECK: %[[C32_I32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK: %[[C32_I32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK: %[[LOAD:.*]] = nvvm.wmma.load %[[GEP]], %[[C32_I32]], m = 8, n = 8, k = 4, layout = <row>, element_type = <f64>, fragment = a : (!llvm.ptr<3>) -> f64
     // CHECK: llvm.return %[[LOAD]] : f64
   }
@@ -113,7 +113,7 @@ gpu.module @test_module {
     %i = arith.constant 16 : index
     %j = arith.constant 16 : index
     gpu.subgroup_mma_store_matrix %arg0, %sg[%i,%j] leadDimension 32 transpose : !gpu.mma_matrix<16x16xf16, "COp">, memref<32x32xf16, 3>
-    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i64
+    // CHECK:  %[[INX:.*]] = llvm.mlir.constant(16 : i64) : i64
     // CHECK:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
@@ -123,16 +123,16 @@ gpu.module @test_module {
     // CHECK:  %[[EL3:.*]] = llvm.extractvalue %[[D]][2] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK:  %[[EL4:.*]] = llvm.extractvalue %[[D]][3] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK:  %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i64
+    // CHECK:  %[[LDM:.*]] = llvm.mlir.constant(32 : i64) : i64
     // CHECK:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]   : i64
     // CHECK:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i64
     // CHECK:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f16
-    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK:  nvvm.wmma.store %[[ADDRESS]], %[[LDM32]], %[[EL1]], %[[EL2]], %[[EL3]], %[[EL4]]
     // CHECK-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <f16> : !llvm.ptr<3>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>
     // CHECK:  llvm.return
 
-    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : index) : i32
+    // CHECK32:  %[[INX:.*]] = llvm.mlir.constant(16 : i32) : i32
     // CHECK32:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK32:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
     // CHECK32:  %{{.*}} = llvm.insertvalue %{{.*}}, %{{.*}}[{{.*}}, {{.*}}]
@@ -142,11 +142,11 @@ gpu.module @test_module {
     // CHECK32:  %[[EL3:.*]] = llvm.extractvalue %[[D]][2] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK32:  %[[EL4:.*]] = llvm.extractvalue %[[D]][3] : !llvm.struct<(vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>)>
     // CHECK32:  %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr<3>, ptr<3>, i32, array<2 x i32>, array<2 x i32>)>
-    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  %[[LI:.*]] = llvm.mul %[[INX]], %[[LDM]]   : i32
     // CHECK32:  %[[LIJ:.*]] = llvm.add %[[LI]], %[[INX]]  : i32
     // CHECK32:  %[[ADDRESS:.*]] = llvm.getelementptr %[[BASE]][%[[LIJ]]] : (!llvm.ptr<3>, i32) -> !llvm.ptr<3>, f16
-    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : index) : i32
+    // CHECK32:  %[[LDM32:.*]] = llvm.mlir.constant(32 : i32) : i32
     // CHECK32:  nvvm.wmma.store %[[ADDRESS]], %[[LDM32]], %[[EL1]], %[[EL2]], %[[EL3]], %[[EL4]]
     // CHECK32-SAME: m = 16, n = 16, k = 16, layout = <col>, element_type = <f16> : !llvm.ptr<3>, vector<2xf16>, vector<2xf16>, vector<2xf16>, vector<2xf16>
     // CHECK32:  llvm.return
diff --git a/mlir/test/Conversion/MPIToLLVM/mpitollvm.mlir b/mlir/test/Conversion/MPIToLLVM/mpitollvm.mlir
index 73ad2d8f9299f..b1ba5f8af3945 100644
--- a/mlir/test/Conversion/MPIToLLVM/mpitollvm.mlir
+++ b/mlir/test/Conversion/MPIToLLVM/mpitollvm.mlir
@@ -137,7 +137,7 @@ module attributes {dlti.map = #dlti.map<"MPI:Implementation" = "MPICH">} {
     %comm = mpi.comm_world : !mpi.comm
     // CHECK: [[v0:%.*]] = llvm.insertvalue {{.*}}[4, 0]
     // CHECK: llvm.mul
-    // CHECK: [[v1:%.*]] = llvm.mlir.constant(1 : index) : i32
+    // CHECK: [[v1:%.*]] = llvm.mlir.constant(1 : i32) : i32
     // CHECK: [[v2:%.*]] = llvm.extractvalue [[v0]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
     // CHECK: [[v3:%.*]] = llvm.trunc [[v2]] : i64 to i32
     // CHECK: [[v4:%.*]] = llvm.mul [[v3]], [[v1]] : i32
@@ -298,7 +298,7 @@ module attributes { dlti.map = #dlti.map<"MPI:Implementation" = "OpenMPI"> } {
     %comm = mpi.comm_world : !mpi.comm
     // CHECK: [[v0:%.*]] = llvm.insertvalue {{.*}}[4, 0]
     // CHECK: llvm.mul
-    // CHECK: [[v1:%.*]] = llvm.mlir.constant(1 : index) : i32
+    // CHECK: [[v1:%.*]] = llvm.mlir.constant(1 : i32) : i32
     // CHECK: [[v2:%.*]] = llvm.extractvalue [[v0]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
     // CHECK: [[v3:%.*]] = llvm.trunc [[v2]] : i64 to i32
     // CHECK: [[v4:%.*]] = llvm.mul [[v3]], [[v1]] : i32
diff --git a/mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir b/mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
index 2843e469c16a0..49d67d8b0c23b 100644
--- a/mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
+++ b/mlir/test/Conversion/MemRefToLLVM/convert-dynamic-memref-ops.mlir
@@ -7,8 +7,8 @@
 func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref<?x42x?xf32> {
 //   CHECK-DAG:  %[[M:.*]] = builtin.unrealized_conversion_cast %[[Marg]]
 //   CHECK-DAG:  %[[N:.*]] = builtin.unrealized_conversion_cast %[[Narg]]
-//       CHECK:  %[[c42:.*]] = llvm.mlir.constant(42 : index) : i64
-//  CHECK-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : index) : i64
+//       CHECK:  %[[c42:.*]] = llvm.mlir.constant(42 : i64) : i64
+//  CHECK-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : i64) : i64
 //  CHECK-NEXT:  %[[st0:.*]] = llvm.mul %[[N]], %[[c42]] : i64
 //  CHECK-NEXT:  %[[sz:.*]] = llvm.mul %[[st0]], %[[M]] : i64
 //  CHECK-NEXT:  %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
@@ -18,7 +18,7 @@ func.func @mixed_alloc(%arg0: index, %arg1: index) -> memref<?x42x?xf32> {
 //  CHECK-NEXT:  llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %{{.*}}, %{{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : index) : i64
+//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : i64) : i64
 //  CHECK-NEXT:  llvm.insertvalue %[[off]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[M]], %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[c42]], %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
@@ -58,7 +58,7 @@ func.func @unranked_dealloc(%arg0: memref<*xf32>) {
 func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref<?x?xf32> {
 //   CHECK-DAG:  %[[M:.*]] = builtin.unrealized_conversion_cast %[[Marg]]
 //   CHECK-DAG:  %[[N:.*]] = builtin.unrealized_conversion_cast %[[Narg]]
-//  CHECK-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : index) : i64
+//  CHECK-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : i64) : i64
 //  CHECK-NEXT:  %[[sz:.*]] = llvm.mul %[[N]], %[[M]] : i64
 //  CHECK-NEXT:  %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
 //  CHECK-NEXT:  %[[gep:.*]] = llvm.getelementptr %[[null]][%[[sz]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -67,7 +67,7 @@ func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref<?x?xf32> {
 //  CHECK-NEXT:  llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %{{.*}}, %{{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : index) : i64
+//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : i64) : i64
 //  CHECK-NEXT:  llvm.insertvalue %[[off]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[M]], %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[N]], %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -84,13 +84,13 @@ func.func @dynamic_alloc(%arg0: index, %arg1: index) -> memref<?x?xf32> {
 func.func @dynamic_alloca(%arg0: index, %arg1: index) -> memref<?x?xf32> {
 //   CHECK-DAG:  %[[M:.*]] = builtin.unrealized_conversion_cast %[[Marg]]
 //   CHECK-DAG:  %[[N:.*]] = builtin.unrealized_conversion_cast %[[Narg]]
-//  CHECK-NEXT:  %[[st1:.*]] = llvm.mlir.constant(1 : index) : i64
+//  CHECK-NEXT:  %[[st1:.*]] = llvm.mlir.constant(1 : i64) : i64
 //  CHECK-NEXT:  %[[num_elems:.*]] = llvm.mul %[[N]], %[[M]] : i64
 //  CHECK-NEXT:  %[[allocated:.*]] = llvm.alloca %[[num_elems]] x f32 : (i64) -> !llvm.ptr
 //  CHECK-NEXT:  llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[allocated]], %{{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[allocated]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : index) : i64
+//  CHECK-NEXT:  %[[off:.*]] = llvm.mlir.constant(0 : i64) : i64
 //  CHECK-NEXT:  llvm.insertvalue %[[off]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[M]], %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 //  CHECK-NEXT:  llvm.insertvalue %[[N]], %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -124,14 +124,14 @@ func.func @dynamic_dealloc(%arg0: memref<?x?xf32>) {
 // CHECK-LABEL: func @stdlib_aligned_alloc({{.*}})
 // ALIGNED-ALLOC-LABEL: func @stdlib_aligned_alloc({{.*}})
 func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> {
-// ALIGNED-ALLOC:       %[[sz1:.*]] = llvm.mlir.constant(32 : index) : i64
-// ALIGNED-ALLOC-NEXT:  %[[sz2:.*]] = llvm.mlir.constant(18 : index) : i64
-// ALIGNED-ALLOC-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : index) : i64
-// ALIGNED-ALLOC-NEXT:  %[[num_elems:.*]] = llvm.mlir.constant(576 : index) : i64
+// ALIGNED-ALLOC:       %[[sz1:.*]] = llvm.mlir.constant(32 : i64) : i64
+// ALIGNED-ALLOC-NEXT:  %[[sz2:.*]] = llvm.mlir.constant(18 : i64) : i64
+// ALIGNED-ALLOC-NEXT:  %[[one:.*]] = llvm.mlir.constant(1 : i64) : i64
+// ALIGNED-ALLOC-NEXT:  %[[num_elems:.*]] = llvm.mlir.constant(576 : i64) : i64
 // ALIGNED-ALLOC-NEXT:  %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
 // ALIGNED-ALLOC-NEXT:  %[[gep:.*]] = llvm.getelementptr %[[null]][%[[num_elems]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
 // ALIGNED-ALLOC-NEXT:  %[[bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr to i64
-// ALIGNED-ALLOC-NEXT:  %[[alignment:.*]] = llvm.mlir.constant(32 : index) : i64
+// ALIGNED-ALLOC-NEXT:  %[[alignment:.*]] = llvm.mlir.constant(32 : i64) : i64
 // ALIGNED-ALLOC-NEXT:  %[[allocated:.*]] = llvm.call @aligned_alloc(%[[alignment]], %[[bytes]]) : (i64, i64) -> !llvm.ptr
   %0 = memref.alloc() alignment = 32 : memref<32x18xf32>
   // Do another alloc just to test that we have a unique declaration for
@@ -140,19 +140,19 @@ func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> {
   %1 = memref.alloc() alignment = 64 : memref<4096xf32>
 
   // Alignment is to element type boundaries (minimum 16 bytes).
-  // ALIGNED-ALLOC:  %[[c32:.*]] = llvm.mlir.constant(32 : index) : i64
+  // ALIGNED-ALLOC:  %[[c32:.*]] = llvm.mlir.constant(32 : i64) : i64
   // ALIGNED-ALLOC-NEXT:  llvm.call @aligned_alloc(%[[c32]]
   %2 = memref.alloc() : memref<4096xvector<8xf32>>
   // The minimum alignment is 16 bytes unless explicitly specified.
-  // ALIGNED-ALLOC:  %[[c16:.*]] = llvm.mlir.constant(16 : index) : i64
+  // ALIGNED-ALLOC:  %[[c16:.*]] = llvm.mlir.constant(16 : i64) : i64
   // ALIGNED-ALLOC-NEXT:  llvm.call @aligned_alloc(%[[c16]],
   %3 = memref.alloc() : memref<4096xvector<2xf32>>
-  // ALIGNED-ALLOC:  %[[c8:.*]] = llvm.mlir.constant(8 : index) : i64
+  // ALIGNED-ALLOC:  %[[c8:.*]] = llvm.mlir.constant(8 : i64) : i64
   // ALIGNED-ALLOC-NEXT:  llvm.call @aligned_alloc(%[[c8]],
   %4 = memref.alloc() alignment = 8 : memref<1024xvector<4xf32>>
   // Bump the memref allocation size if its size is not a multiple of alignment.
-  // ALIGNED-ALLOC:       %[[c32:.*]] = llvm.mlir.constant(32 : index) : i64
-  // ALIGNED-ALLOC:       llvm.mlir.constant(1 : index) : i64
+  // ALIGNED-ALLOC:       %[[c32:.*]] = llvm.mlir.constant(32 : i64) : i64
+  // ALIGNED-ALLOC:       llvm.mlir.constant(1 : i64) : i64
   // ALIGNED-ALLOC-NEXT:  llvm.sub
   // ALIGNED-ALLOC-NEXT:  llvm.add
   // ALIGNED-ALLOC-NEXT:  llvm.urem
@@ -160,7 +160,7 @@ func.func @stdlib_aligned_alloc(%N : index) -> memref<32x18xf32> {
   // ALIGNED-ALLOC-NEXT:  llvm.call @aligned_alloc(%[[c32]], %[[SIZE_ALIGNED]])
   %5 = memref.alloc() alignment = 32 : memref<100xf32>
   // Bump alignment to the next power of two if it isn't.
-  // ALIGNED-ALLOC:  %[[c128:.*]] = llvm.mlir.constant(128 : index) : i64
+  // ALIGNED-ALLOC:  %[[c128:.*]] = llvm.mlir.constant(128 : i64) : i64
   // ALIGNED-ALLOC:  llvm.call @aligned_alloc(%[[c128]]
   %6 = memref.alloc(%N) : memref<?xvector<18xf32>>
   return %0 : memref<32x18xf32>
@@ -276,10 +276,10 @@ module attributes { dlti.dl_spec = #dlti.dl_spec<
 // CHECK: [[RESULT_1:%.*]] = llvm.insertvalue [[RANK]], [[RESULT_0]][0] : !llvm.struct<(i64, ptr)>
 
 // Compute size in bytes to allocate result ranked descriptor
-// CHECK: [[C1:%.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i64
-// CHECK: [[INDEX_SIZE:%.*]] = llvm.mlir.constant(8 : index) : i64
-// CHECK: [[PTR_SIZE:%.*]] = llvm.mlir.constant(8 : index) : i64
+// CHECK: [[C1:%.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : i64) : i64
+// CHECK: [[INDEX_SIZE:%.*]] = llvm.mlir.constant(8 : i64) : i64
+// CHECK: [[PTR_SIZE:%.*]] = llvm.mlir.constant(8 : i64) : i64
 // CHECK: [[DOUBLE_PTR_SIZE:%.*]] = llvm.mul [[C2]], [[PTR_SIZE]]
 // CHECK: [[DOUBLE_RANK:%.*]] = llvm.mul [[C2]], %{{.*}}
 // CHECK: [[NUM_INDEX_VALS:%.*]] = llvm.add [[DOUBLE_RANK]], [[C1]]
@@ -302,7 +302,7 @@ module attributes { dlti.dl_spec = #dlti.dl_spec<
 
 // CHECK: [[SOURCE_OFFSET_GEP:%.*]] = llvm.getelementptr [[SOURCE_DESC]][2]
 // CHECK: [[RESULT_OFFSET_GEP:%.*]] = llvm.getelementptr [[RESULT_DESC]][2]
-// CHECK: [[SIZEOF_TWO_RESULT_PTRS:%.*]] = llvm.mlir.constant(16 : index) : i64
+// CHECK: [[SIZEOF_TWO_RESULT_PTRS:%.*]] = llvm.mlir.constant(16 : i64) : i64
 // CHECK: [[COPY_SIZE:%.*]] = llvm.sub [[DESC_ALLOC_SIZE]], [[SIZEOF_TWO_RESULT_PTRS]]
 // CHECK: "llvm.intr.memcpy"([[RESULT_OFFSET_GEP]], [[SOURCE_OFFSET_GEP]], [[COPY_SIZE]]) <{isVolatile = false}>
 
@@ -374,17 +374,17 @@ func.func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) {
 // CHECK-LABEL: func @memref_cast_ranked_to_unranked
 // CHECK32-LABEL: func @memref_cast_ranked_to_unranked
 func.func @memref_cast_ranked_to_unranked(%arg : memref<42x2x?xf32>) {
-// CHECK-DAG:  %[[c:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK-DAG:  %[[c:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK-DAG:  %[[p:.*]] = llvm.alloca %[[c]] x !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> : (i64) -> !llvm.ptr
 // CHECK-DAG:  llvm.store %{{.*}}, %[[p]] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>, !llvm.ptr
-// CHECK-DAG:  %[[r:.*]] = llvm.mlir.constant(3 : index) : i64
+// CHECK-DAG:  %[[r:.*]] = llvm.mlir.constant(3 : i64) : i64
 //     CHECK:  llvm.mlir.poison : !llvm.struct<(i64, ptr)>
 // CHECK-DAG:  llvm.insertvalue %[[r]], %{{.*}}[0] : !llvm.struct<(i64, ptr)>
 // CHECK-DAG:  llvm.insertvalue %[[p]], %{{.*}}[1] : !llvm.struct<(i64, ptr)>
-// CHECK32-DAG:  %[[c:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK32-DAG:  %[[c:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK32-DAG:  %[[p:.*]] = llvm.alloca %[[c]] x !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)> : (i64) -> !llvm.ptr
 // CHECK32-DAG:  llvm.store %{{.*}}, %[[p]] : !llvm.struct<(ptr, ptr, i32, array<3 x i32>, array<3 x i32>)>, !llvm.ptr
-// CHECK32-DAG:  %[[r:.*]] = llvm.mlir.constant(3 : index) : i32
+// CHECK32-DAG:  %[[r:.*]] = llvm.mlir.constant(3 : i32) : i32
 //     CHECK32:  llvm.mlir.poison : !llvm.struct<(i32, ptr)>
 // CHECK32-DAG:  llvm.insertvalue %[[r]], %{{.*}}[0] : !llvm.struct<(i32, ptr)>
 // CHECK32-DAG:  llvm.insertvalue %[[p]], %{{.*}}[1] : !llvm.struct<(i32, ptr)>
@@ -405,7 +405,7 @@ func.func @memref_cast_unranked_to_ranked(%arg : memref<*xf32>) {
 
 // CHECK-LABEL: func @mixed_memref_dim
 func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) {
-// CHECK: llvm.mlir.constant(42 : index) : i64
+// CHECK: llvm.mlir.constant(42 : i64) : i64
   %c0 = arith.constant 0 : index
   %0 = memref.dim %mixed, %c0 : memref<42x?x?x13x?xf32>
 // CHECK: llvm.extractvalue %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
@@ -414,7 +414,7 @@ func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) {
 // CHECK: llvm.extractvalue %{{.*}}[3, 2] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
   %c2 = arith.constant 2 : index
   %2 = memref.dim %mixed, %c2 : memref<42x?x?x13x?xf32>
-// CHECK: llvm.mlir.constant(13 : index) : i64
+// CHECK: llvm.mlir.constant(13 : i64) : i64
   %c3 = arith.constant 3 : index
   %3 = memref.dim %mixed, %c3 : memref<42x?x?x13x?xf32>
 // CHECK: llvm.extractvalue %{{.*}}[3, 4] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
@@ -429,7 +429,7 @@ func.func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) {
 // CHECK: %{{.*}}, %[[IDXarg:.*]]: index
 func.func @memref_dim_with_dyn_index(%arg : memref<3x?xf32>, %idx : index) -> index {
   // CHECK-DAG: %[[IDX:.*]] = builtin.unrealized_conversion_cast %[[IDXarg]]
-  // CHECK-DAG: %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK-DAG: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK-DAG: %[[SIZES:.*]] = llvm.extractvalue %{{.*}}[3] : ![[DESCR_TY:.*]]
   // CHECK-DAG: %[[SIZES_PTR:.*]] = llvm.alloca %[[C1]] x !llvm.array<2 x i64> : (i64) -> !llvm.ptr
   // CHECK-DAG: llvm.store %[[SIZES]], %[[SIZES_PTR]] : !llvm.array<2 x i64>, !llvm.ptr
@@ -455,15 +455,15 @@ func.func @memref_reinterpret_cast_ranked_to_static_shape(%input : memref<2x3xf3
 // CHECK: [[ALIGNED_PTR:%.*]] = llvm.extractvalue [[INPUT]][1] : [[TY]]
 // CHECK: [[OUT_1:%.*]] = llvm.insertvalue [[BASE_PTR]], [[OUT_0]][0] : [[TY]]
 // CHECK: [[OUT_2:%.*]] = llvm.insertvalue [[ALIGNED_PTR]], [[OUT_1]][1] : [[TY]]
-// CHECK: [[OFFSET:%.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: [[OFFSET:%.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: [[OUT_3:%.*]] = llvm.insertvalue [[OFFSET]], [[OUT_2]][2] : [[TY]]
-// CHECK: [[SIZE_0:%.*]] = llvm.mlir.constant(6 : index) : i64
+// CHECK: [[SIZE_0:%.*]] = llvm.mlir.constant(6 : i64) : i64
 // CHECK: [[OUT_4:%.*]] = llvm.insertvalue [[SIZE_0]], [[OUT_3]][3, 0] : [[TY]]
-// CHECK: [[SIZE_1:%.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: [[SIZE_1:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[OUT_5:%.*]] = llvm.insertvalue [[SIZE_1]], [[OUT_4]][4, 0] : [[TY]]
-// CHECK: [[STRIDE_0:%.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: [[STRIDE_0:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[OUT_6:%.*]] = llvm.insertvalue [[STRIDE_0]], [[OUT_5]][3, 1] : [[TY]]
-// CHECK: [[STRIDE_1:%.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: [[STRIDE_1:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[OUT_7:%.*]] = llvm.insertvalue [[STRIDE_1]], [[OUT_6]][4, 1] : [[TY]]
 
 // -----
@@ -520,10 +520,10 @@ func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref<?xindex>) {
 // CHECK: [[UNRANKED_OUT_1:%.*]] = llvm.insertvalue [[RANK]], [[UNRANKED_OUT_O]][0] : !llvm.struct<(i64, ptr)>
 
 // Compute size in bytes to allocate result ranked descriptor
-// CHECK: [[C1:%.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : index) : i64
-// CHECK: [[INDEX_SIZE:%.*]] = llvm.mlir.constant(8 : index) : i64
-// CHECK: [[PTR_SIZE:%.*]] = llvm.mlir.constant(8 : index) : i64
+// CHECK: [[C1:%.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: [[C2:%.*]] = llvm.mlir.constant(2 : i64) : i64
+// CHECK: [[INDEX_SIZE:%.*]] = llvm.mlir.constant(8 : i64) : i64
+// CHECK: [[PTR_SIZE:%.*]] = llvm.mlir.constant(8 : i64) : i64
 // CHECK: [[DOUBLE_PTR_SIZE:%.*]] = llvm.mul [[C2]], [[PTR_SIZE]] : i64
 // CHECK: [[DESC_ALLOC_SIZE:%.*]] = llvm.add [[DOUBLE_PTR_SIZE]], %{{.*}}
 // CHECK: [[UNDERLYING_DESC:%.*]] = llvm.alloca [[DESC_ALLOC_SIZE]] x i8
@@ -543,12 +543,12 @@ func.func @memref_reshape(%input : memref<2x3xf32>, %shape : memref<?xindex>) {
 // CHECK: [[SIZES_PTR:%.*]] = llvm.getelementptr [[UNDERLYING_DESC]]{{\[}}0, 3]
 // CHECK: [[STRIDES_PTR:%.*]] = llvm.getelementptr [[SIZES_PTR]]{{\[}}[[RANK]]]
 // CHECK: [[SHAPE_IN_PTR:%.*]] = llvm.extractvalue [[SHAPE]][1] : [[SHAPE_TY]]
-// CHECK: [[C1_:%.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: [[C1_:%.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: [[RANK_MIN_1:%.*]] = llvm.sub [[RANK]], [[C1_]] : i64
 // CHECK: llvm.br ^bb1([[RANK_MIN_1]], [[C1_]] : i64, i64)
 
 // CHECK: ^bb1([[DIM:%.*]]: i64, [[CUR_STRIDE:%.*]]: i64):
-// CHECK:   [[C0_:%.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:   [[C0_:%.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:   [[COND:%.*]] = llvm.icmp "sge" [[DIM]], [[C0_]] : i64
 // CHECK:   llvm.cond_br [[COND]], ^bb2, ^bb3
 
@@ -577,7 +577,7 @@ func.func @memref_of_memref() {
 
   // Static alignment should be computed as ceilPowerOf2(2 * sizeof(pointer) +
   // (1 + 2 * rank) * sizeof(index) = ceilPowerOf2(2 * 8 + 3 * 8) = 64.
-  // ALIGNED-ALLOC: llvm.mlir.constant(64 : index)
+  // ALIGNED-ALLOC: llvm.mlir.constant(64 : i64)
 
   // Check that the types are converted as expected.
   // ALIGNED-ALLOC: llvm.call @aligned_alloc
@@ -599,7 +599,7 @@ module attributes { dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<index, 32>> } {
 
     // Static alignment should be computed as ceilPowerOf2(2 * sizeof(pointer) +
     // (1 + 2 * rank) * sizeof(index) = ceilPowerOf2(2 * 8 + 3 * 4) = 32.
-    // ALIGNED-ALLOC: llvm.mlir.constant(32 : index)
+    // ALIGNED-ALLOC: llvm.mlir.constant(32 : i32)
 
     // Check that the types are converted as expected.
     // ALIGNED-ALLOC: llvm.call @aligned_alloc
@@ -622,7 +622,7 @@ func.func @memref_of_memref_of_memref() {
 
   // Static alignment should be computed as ceilPowerOf2(2 * sizeof(pointer) +
   // (1 + 2 * rank) * sizeof(index) = ceilPowerOf2(2 * 8 + 3 * 8) = 64.
-  // ALIGNED-ALLOC: llvm.mlir.constant(64 : index)
+  // ALIGNED-ALLOC: llvm.mlir.constant(64 : i64)
   // ALIGNED-ALLOC: llvm.call @aligned_alloc
   %0 = memref.alloc() : memref<1 x memref<2 x memref<3 x f32>>>
   return
@@ -639,7 +639,7 @@ func.func @ranked_unranked() {
 
   // Static alignment should be computed as ceilPowerOf2(sizeof(index) +
   // sizeof(pointer)) = 16.
-  // ALIGNED-ALLOC: llvm.mlir.constant(16 : index)
+  // ALIGNED-ALLOC: llvm.mlir.constant(16 : i64)
   // ALIGNED-ALLOC: llvm.call @aligned_alloc
   %0 = memref.alloc() : memref<1 x memref<* x f32>>
   memref.cast %0 : memref<1 x memref<* x f32>> to memref<* x memref<* x f32>>
diff --git a/mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir b/mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir
index cd93601eeb984..029d69279d139 100644
--- a/mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir
+++ b/mlir/test/Conversion/MemRefToLLVM/convert-static-memref-ops.mlir
@@ -2,7 +2,7 @@
 
 // CHECK-LABEL: func @zero_d_alloc()
 func.func @zero_d_alloc() -> memref<f32> {
-// CHECK: %[[one:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[one:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
 // CHECK: %[[gep:.*]] = llvm.getelementptr %[[null]][%[[one]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
 // CHECK: %[[size_bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr to i64
@@ -10,7 +10,7 @@ func.func @zero_d_alloc() -> memref<f32> {
 // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: llvm.insertvalue %[[ptr]], %{{.*}}[0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: llvm.insertvalue %[[ptr]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: llvm.insertvalue %[[c0]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: unrealized_conversion_cast %{{.*}}
 
@@ -34,16 +34,16 @@ func.func @zero_d_dealloc(%arg0: memref<f32>) {
 
 // CHECK-LABEL: func @aligned_1d_alloc(
 func.func @aligned_1d_alloc() -> memref<42xf32> {
-// CHECK: %[[sz1:.*]] = llvm.mlir.constant(42 : index) : i64
-// CHECK: %[[st1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[sz1:.*]] = llvm.mlir.constant(42 : i64) : i64
+// CHECK: %[[st1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
 // CHECK: %[[gep:.*]] = llvm.getelementptr %[[null]][%[[sz1]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
 // CHECK: %[[size_bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr to i64
-// CHECK: %[[alignment:.*]] = llvm.mlir.constant(8 : index) : i64
+// CHECK: %[[alignment:.*]] = llvm.mlir.constant(8 : i64) : i64
 // CHECK: %[[allocsize:.*]] = llvm.add %[[size_bytes]], %[[alignment]] : i64
 // CHECK: %[[ptr:.*]] = llvm.call @malloc(%[[allocsize]]) : (i64) -> !llvm.ptr
 // CHECK: %[[allocatedAsInt:.*]] = llvm.ptrtoint %[[ptr]] : !llvm.ptr to i64
-// CHECK: %[[one_1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[one_1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[bump:.*]] = llvm.sub %[[alignment]], %[[one_1]] : i64
 // CHECK: %[[bumped:.*]] = llvm.add %[[allocatedAsInt]], %[[bump]] : i64
 // CHECK: %[[mod:.*]] = llvm.urem %[[bumped]], %[[alignment]] : i64
@@ -52,7 +52,7 @@ func.func @aligned_1d_alloc() -> memref<42xf32> {
 // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 // CHECK: llvm.insertvalue %[[ptr]], %{{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 // CHECK: llvm.insertvalue %[[alignedBitCast]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-// CHECK: %[[c0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[c0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: llvm.insertvalue %[[c0]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %0 = memref.alloc() alignment = 8 : memref<42xf32>
   return %0 : memref<42xf32>
@@ -62,7 +62,7 @@ func.func @aligned_1d_alloc() -> memref<42xf32> {
 
 // CHECK-LABEL: func @static_alloc()
 func.func @static_alloc() -> memref<32x18xf32> {
-// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(576 : index) : i64
+// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(576 : i64) : i64
 // CHECK: %[[null:.*]] = llvm.mlir.zero : !llvm.ptr
 // CHECK: %[[gep:.*]] = llvm.getelementptr %[[null]][%[[num_elems]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
 // CHECK: %[[size_bytes:.*]] = llvm.ptrtoint %[[gep]] : !llvm.ptr to i64
@@ -75,10 +75,10 @@ func.func @static_alloc() -> memref<32x18xf32> {
 
 // CHECK-LABEL: func @static_alloca()
 func.func @static_alloca() -> memref<32x18xf32> {
-// CHECK: %[[sz1:.*]] = llvm.mlir.constant(32 : index) : i64
-// CHECK: %[[sz2:.*]] = llvm.mlir.constant(18 : index) : i64
-// CHECK: %[[st2:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(576 : index) : i64
+// CHECK: %[[sz1:.*]] = llvm.mlir.constant(32 : i64) : i64
+// CHECK: %[[sz2:.*]] = llvm.mlir.constant(18 : i64) : i64
+// CHECK: %[[st2:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(576 : i64) : i64
 // CHECK: %[[allocated:.*]] = llvm.alloca %[[num_elems]] x f32 : (i64) -> !llvm.ptr
  %0 = memref.alloca() : memref<32x18xf32>
 
@@ -97,12 +97,12 @@ func.func @static_alloca() -> memref<32x18xf32> {
 
 // CHECK-LABEL: func @static_alloca_zero()
 func.func @static_alloca_zero() -> memref<32x0x18xf32> {
-// CHECK: %[[sz1:.*]] = llvm.mlir.constant(32 : index) : i64
-// CHECK: %[[sz2:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK: %[[sz3:.*]] = llvm.mlir.constant(18 : index) : i64
-// CHECK: %[[st1:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[st2:.*]] = llvm.mlir.constant(0 : index) : i64
-// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[sz1:.*]] = llvm.mlir.constant(32 : i64) : i64
+// CHECK: %[[sz2:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK: %[[sz3:.*]] = llvm.mlir.constant(18 : i64) : i64
+// CHECK: %[[st1:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[st2:.*]] = llvm.mlir.constant(0 : i64) : i64
+// CHECK: %[[num_elems:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: %[[allocated:.*]] = llvm.alloca %[[num_elems]] x f32 : (i64) -> !llvm.ptr
  %0 = memref.alloca() : memref<32x0x18xf32>
 
@@ -137,7 +137,7 @@ func.func @static_load(%static : memref<10x42xf32>, %i : index, %j : index) {
 // CHECK-DAG:  %[[II:.*]] = builtin.unrealized_conversion_cast %[[I]]
 // CHECK-DAG:  %[[JJ:.*]] = builtin.unrealized_conversion_cast %[[J]]
 // CHECK:  %[[ptr:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:  %[[st0:.*]] = llvm.mlir.constant(42 : index) : i64
+// CHECK:  %[[st0:.*]] = llvm.mlir.constant(42 : i64) : i64
 // CHECK:  %[[offI:.*]] = llvm.mul %[[II]], %[[st0]] overflow<nsw, nuw> : i64
 // CHECK:  %[[off1:.*]] = llvm.add %[[offI]], %[[JJ]] overflow<nsw, nuw> : i64
 // CHECK:  %[[addr:.*]] = llvm.getelementptr inbounds|nuw %[[ptr]][%[[off1]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -165,7 +165,7 @@ func.func @static_store(%static : memref<10x42xf32>, %i : index, %j : index, %va
 // CHECK-DAG: %[[II:.*]] = builtin.unrealized_conversion_cast %[[I]]
 // CHECK-DAG: %[[JJ:.*]] = builtin.unrealized_conversion_cast %[[J]]
 // CHECK: %[[ptr:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK: %[[st0:.*]] = llvm.mlir.constant(42 : index) : i64
+// CHECK: %[[st0:.*]] = llvm.mlir.constant(42 : i64) : i64
 // CHECK: %[[offI:.*]] = llvm.mul %[[II]], %[[st0]] overflow<nsw, nuw> : i64
 // CHECK: %[[off1:.*]] = llvm.add %[[offI]], %[[JJ]] overflow<nsw, nuw> : i64
 // CHECK: %[[addr:.*]] = llvm.getelementptr inbounds|nuw %[[ptr]][%[[off1]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -179,19 +179,19 @@ func.func @static_store(%static : memref<10x42xf32>, %i : index, %j : index, %va
 
 // CHECK-LABEL: func @static_memref_dim
 func.func @static_memref_dim(%static : memref<42x32x15x13x27xf32>) {
-// CHECK:  llvm.mlir.constant(42 : index) : i64
+// CHECK:  llvm.mlir.constant(42 : i64) : i64
   %c0 = arith.constant 0 : index
   %0 = memref.dim %static, %c0 : memref<42x32x15x13x27xf32>
-// CHECK:  llvm.mlir.constant(32 : index) : i64
+// CHECK:  llvm.mlir.constant(32 : i64) : i64
   %c1 = arith.constant 1 : index
   %1 = memref.dim %static, %c1 : memref<42x32x15x13x27xf32>
-// CHECK:  llvm.mlir.constant(15 : index) : i64
+// CHECK:  llvm.mlir.constant(15 : i64) : i64
   %c2 = arith.constant 2 : index
   %2 = memref.dim %static, %c2 : memref<42x32x15x13x27xf32>
-// CHECK:  llvm.mlir.constant(13 : index) : i64
+// CHECK:  llvm.mlir.constant(13 : i64) : i64
   %c3 = arith.constant 3 : index
   %3 = memref.dim %static, %c3 : memref<42x32x15x13x27xf32>
-// CHECK:  llvm.mlir.constant(27 : index) : i64
+// CHECK:  llvm.mlir.constant(27 : i64) : i64
   %c4 = arith.constant 4 : index
   %4 = memref.dim %static, %c4 : memref<42x32x15x13x27xf32>
   return
@@ -253,21 +253,21 @@ func.func @memref.reshape(%arg0: memref<4x5x6xf32>) -> memref<2x6x20xf32> {
   // CHECK: %[[insert0:.*]] = llvm.insertvalue %[[elem0]], %[[undef]][0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
   // CHECK: %[[insert1:.*]] = llvm.insertvalue %[[elem1]], %[[insert0:.*]][1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 
-  // CHECK: %[[zero:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[zero:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[insert2:.*]] = llvm.insertvalue %[[zero]], %[[insert1]][2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 
-  // CHECK: %[[one:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[twenty0:.*]] = llvm.mlir.constant(20 : index) : i64
+  // CHECK: %[[one:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[twenty0:.*]] = llvm.mlir.constant(20 : i64) : i64
   // CHECK: %[[insert3:.*]] = llvm.insertvalue %[[twenty0]], %[[insert2]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
   // CHECK: %[[insert4:.*]] = llvm.insertvalue %[[one]], %[[insert3]][4, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 
-  // CHECK: %[[twenty1:.*]] = llvm.mlir.constant(20 : index) : i64
-  // CHECK: %[[six:.*]] = llvm.mlir.constant(6 : index) : i64
+  // CHECK: %[[twenty1:.*]] = llvm.mlir.constant(20 : i64) : i64
+  // CHECK: %[[six:.*]] = llvm.mlir.constant(6 : i64) : i64
   // CHECK: %[[insert5:.*]] = llvm.insertvalue %[[six]], %[[insert4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
   // CHECK: %[[insert6:.*]] = llvm.insertvalue %[[twenty1]], %[[insert5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 
-  // CHECK: %[[hundred_and_twenty:.*]] = llvm.mlir.constant(120 : index) : i64
-  // CHECK: %[[two:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[hundred_and_twenty:.*]] = llvm.mlir.constant(120 : i64) : i64
+  // CHECK: %[[two:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[insert7:.*]] = llvm.insertvalue %[[two]], %[[insert6]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
   // CHECK: %[[insert8:.*]] = llvm.insertvalue %[[hundred_and_twenty]], %[[insert7]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 
@@ -291,21 +291,21 @@ func.func @memref.reshape.dynamic.dim(%arg: memref<?x?x?xf32>, %shape: memref<4x
   // CHECK: %[[insert0:.*]] = llvm.insertvalue %[[alloc_ptr]], %[[undef]][0] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
   // CHECK: %[[insert1:.*]] = llvm.insertvalue %[[align_ptr]], %[[insert0]][1] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
 
-  // CHECK: %[[zero0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[zero0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[insert2:.*]] = llvm.insertvalue %[[zero0]], %[[insert1]][2] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
 
-  // CHECK: %[[one0:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[thirty_two0:.*]] = llvm.mlir.constant(32 : index) : i64
+  // CHECK: %[[one0:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[thirty_two0:.*]] = llvm.mlir.constant(32 : i64) : i64
   // CHECK: %[[insert3:.*]] = llvm.insertvalue %[[thirty_two0]], %[[insert2]][3, 3] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
   // CHECK: %[[insert4:.*]] = llvm.insertvalue %[[one0]], %[[insert3]][4, 3] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
 
-  // CHECK: %[[thirty_two1:.*]] = llvm.mlir.constant(32 : index) : i64
-  // CHECK: %[[twelve:.*]] = llvm.mlir.constant(12 : index) : i64
+  // CHECK: %[[thirty_two1:.*]] = llvm.mlir.constant(32 : i64) : i64
+  // CHECK: %[[twelve:.*]] = llvm.mlir.constant(12 : i64) : i64
   // CHECK: %[[insert5:.*]] = llvm.insertvalue %[[twelve]], %[[insert4]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
   // CHECK: %[[insert6:.*]] = llvm.insertvalue %[[thirty_two1]], %[[insert5]][4, 2] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
 
-  // CHECK: %[[three_hundred_and_eighty_four:.*]] = llvm.mlir.constant(384 : index) : i64
-  // CHECK: %[[one1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[three_hundred_and_eighty_four:.*]] = llvm.mlir.constant(384 : i64) : i64
+  // CHECK: %[[one1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[shape_ptr0:.*]] = llvm.extractvalue %[[shape_cast]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[shape_gep0:.*]] = llvm.getelementptr inbounds|nuw %[[shape_ptr0]][%[[one1]]] : (!llvm.ptr, i64) -> !llvm.ptr, i64
   // CHECK: %[[shape_load0:.*]] = llvm.load %[[shape_gep0]] : !llvm.ptr -> i64
@@ -313,7 +313,7 @@ func.func @memref.reshape.dynamic.dim(%arg: memref<?x?x?xf32>, %shape: memref<4x
   // CHECK: %[[insert8:.*]] = llvm.insertvalue %[[three_hundred_and_eighty_four]], %[[insert7]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<4 x i64>, array<4 x i64>)>
 
   // CHECK: %[[mul:.*]] = llvm.mul %19, %23  : i64
-  // CHECK: %[[zero1:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[zero1:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[shape_ptr1:.*]] = llvm.extractvalue %[[shape_cast]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[shape_gep1:.*]] = llvm.getelementptr inbounds|nuw %[[shape_ptr1]][%[[zero1]]] : (!llvm.ptr, i64) -> !llvm.ptr, i64
   // CHECK: %[[shape_load1:.*]] = llvm.load %[[shape_gep1]] : !llvm.ptr -> i64
@@ -340,11 +340,11 @@ func.func @memref.reshape_index(%arg0: memref<?x?xi32>, %shape: memref<1xindex>)
   // CHECK: %[[insert0:.*]] = llvm.insertvalue %[[alloc_ptr]], %[[undef:.*]][0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[insert1:.*]] = llvm.insertvalue %[[align_ptr]], %[[insert0:.*]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 
-  // CHECK: %[[zero0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[zero0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: %[[insert2:.*]] = llvm.insertvalue %[[zero0]], %[[insert1:.*]][2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 
-  // CHECK: %[[one0:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[zero1:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[one0:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[zero1:.*]] = llvm.mlir.constant(0 : i64) : i64
 
   // CHECK: %[[shape_ptr0:.*]] = llvm.extractvalue %[[shape_cast:.*]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[shape_gep0:.*]] = llvm.getelementptr inbounds|nuw %[[shape_ptr0:.*]][%[[zero1:.*]]] : (!llvm.ptr, i64) -> !llvm.ptr, i64
diff --git a/mlir/test/Conversion/MemRefToLLVM/expand-then-convert-to-llvm.mlir b/mlir/test/Conversion/MemRefToLLVM/expand-then-convert-to-llvm.mlir
index eaa4c35b3c2bf..7af291415b202 100644
--- a/mlir/test/Conversion/MemRefToLLVM/expand-then-convert-to-llvm.mlir
+++ b/mlir/test/Conversion/MemRefToLLVM/expand-then-convert-to-llvm.mlir
@@ -59,7 +59,7 @@ func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : in
 
   // CHECK: %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][0] : !llvm.struct<(ptr, ptr, i64
   // CHECK: %[[BASE_ALIGNED:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr, ptr, i64
-  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[STRIDE0]] overflow<nsw> : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[DESCSTRIDE0]] : i64 to index
   // CHECK: %[[DESCSTRIDE0_V2:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
@@ -95,7 +95,7 @@ func.func @subview_non_zero_addrspace(%0 : memref<64x4xf32, strided<[4, 1], offs
 
   // CHECK: %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][0] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[BASE_ALIGNED:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[STRIDE0]] overflow<nsw> : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[DESCSTRIDE0]] : i64 to index
   // CHECK: %[[DESCSTRIDE0_V2:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
@@ -131,7 +131,7 @@ func.func @subview_const_size(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>,
 
   // CHECK: %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[BASE_ALIGNED:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[C4]] overflow<nsw> : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[DESCSTRIDE0]] : i64 to index
   // CHECK: %[[DESCSTRIDE0_V2:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
@@ -144,7 +144,7 @@ func.func @subview_const_size(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>,
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[OFF2]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[C4]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[DESCSTRIDE0_V2]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_SIZE1:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[CST_SIZE1:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[CST_SIZE1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[ARG1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
@@ -168,7 +168,7 @@ func.func @subview_const_stride(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>
 
   // CHECK: %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[BASE_ALIGNED:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[OFF0:.*]] = llvm.mul %[[ARG0]], %[[C4]] overflow<nsw> : i64
   // CHECK: %[[OFF2:.*]] = llvm.add %[[OFF0]], %[[ARG1]] : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[OFF2]] : i64 to index
@@ -180,7 +180,7 @@ func.func @subview_const_stride(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[ARG0]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[C4]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[ARG1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[CST_STRIDE1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
   %1 = memref.subview %0[%arg0, %arg1][%arg0, %arg1][1, 2] :
@@ -202,15 +202,15 @@ func.func @subview_const_stride_and_offset(%0 : memref<64x8xf32, strided<[8, 1],
   // CHECK: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_OFF:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[CST_OFF:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[CST_OFF]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(62 : index) : i64
+  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(62 : i64) : i64
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[CST_SIZE0]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(8 : index) : i64
+  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(8 : i64) : i64
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[CST_STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_SIZE1:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[CST_SIZE1:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[CST_SIZE1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[CST_STRIDE1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
   %1 = memref.subview %0[0, 2][62, 3][1, 1] :
@@ -234,12 +234,12 @@ func.func @subview_mixed_static_dynamic(%0 : memref<64x4xf32, strided<[4, 1], of
 
   // CHECK: %[[BASE:.*]] = llvm.extractvalue %[[MEMREF]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[BASE_ALIGNED:.*]] = llvm.extractvalue %[[MEMREF]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[STRIDE0]] overflow<nsw> : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[DESCSTRIDE0]] : i64 to index
   // CHECK: %[[DESCSTRIDE0_V2:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
   // CHECK: %[[OFF0:.*]] = llvm.mul %[[ARG1]], %[[STRIDE0]] overflow<nsw> : i64
-  // CHECK: %[[BASE_OFF:.*]] = llvm.mlir.constant(2 : index)  : i64
+  // CHECK: %[[BASE_OFF:.*]] = llvm.mlir.constant(2 : i64)  : i64
   // CHECK: %[[OFF2:.*]] = llvm.add %[[OFF0]], %[[BASE_OFF]] : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[OFF2]] : i64 to index
   // CHECK: %[[OFF2:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
@@ -247,11 +247,11 @@ func.func @subview_mixed_static_dynamic(%0 : memref<64x4xf32, strided<[4, 1], of
   // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[OFF2]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(62 : index)  : i64
+  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(62 : i64)  : i64
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[CST_SIZE0]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[DESCSTRIDE0_V2]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[ARG2]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[CST_STRIDE1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
   %1 = memref.subview %0[%arg1, 2][62, %arg2][%arg0, 1] :
@@ -274,15 +274,15 @@ func.func @subview_leading_operands(%0 : memref<5x3xf32>, %1: memref<5x?xf32>) -
   // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Offset
-  // CHECK: %[[CST_OFF:.*]] = llvm.mlir.constant(6 : index) : i64
+  // CHECK: %[[CST_OFF:.*]] = llvm.mlir.constant(6 : i64) : i64
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[CST_OFF]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Sizes and strides @rank 0: both static extracted from type.
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[C3]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[C3]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Sizes and strides @rank 1: both static.
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[C3]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[CST_STRIDE1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   %2 = memref.subview %0[2, 0][3, 3][1, 1]: memref<5x3xf32> to memref<3x3xf32, strided<[3, 1], offset: 6>>
 
@@ -301,7 +301,7 @@ func.func @subview_leading_operands_dynamic(%0 : memref<5x?xf32>) -> memref<3x?x
   // Extract strides
   // CHECK: %[[STRIDE0:.*]] = llvm.extractvalue %[[MEMREF]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Compute and insert offset from 2 + dynamic value.
-  // CHECK: %[[CST_OFF0:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[CST_OFF0:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[OFF0:.*]] = llvm.mul %[[STRIDE0]], %[[CST_OFF0]] overflow<nsw> : i64
   // CHECK: %[[TMP:.*]] = builtin.unrealized_conversion_cast %[[OFF0]] : i64 to index
   // CHECK: %[[OFF0:.*]] = builtin.unrealized_conversion_cast %[[TMP]] : index to i64
@@ -312,12 +312,12 @@ func.func @subview_leading_operands_dynamic(%0 : memref<5x?xf32>) -> memref<3x?x
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[OFF0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Sizes and strides @rank 0: both static.
-  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[CST_SIZE0]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // Sizes and strides @rank 1: static stride 1, dynamic size unchanged from source memref.
   // CHECK: %[[DESC5:.*]] = llvm.insertvalue %[[SIZE1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[CST_STRIDE1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[DESC6:.*]] = llvm.insertvalue %[[CST_STRIDE1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
   %c0 = arith.constant 1 : index
@@ -339,11 +339,11 @@ func.func @subview_rank_reducing_leading_operands(%0 : memref<5x3xf32>) -> memre
   // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // Aligned ptr
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+  // CHECK: %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[C3]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // Sizes and strides @rank 0: both static.
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[C3]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[CST_STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 
   %1 = memref.subview %0[1, 0][1, 3][1, 1]: memref<5x3xf32> to memref<3xf32, strided<[1], offset: 3>>
@@ -362,11 +362,11 @@ func.func @subview_negative_stride(%arg0 : memref<7xf32>) -> memref<7xf32, strid
   // CHECK: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[BASE_ALIGNED]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[CST_OFF0:.*]] = llvm.mlir.constant(6 : index) : i64
+  // CHECK: %[[CST_OFF0:.*]] = llvm.mlir.constant(6 : i64) : i64
   // CHECK: %[[DESC2:.*]] = llvm.insertvalue %[[CST_OFF0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(7 : index) : i64
+  // CHECK: %[[CST_SIZE0:.*]] = llvm.mlir.constant(7 : i64) : i64
   // CHECK: %[[DESC3:.*]] = llvm.insertvalue %[[CST_SIZE0]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(-1 : index) : i64
+  // CHECK: %[[CST_STRIDE0:.*]] = llvm.mlir.constant(-1 : i64) : i64
   // CHECK: %[[DESC4:.*]] = llvm.insertvalue %[[CST_STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC4]] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> to memref<7xf32, strided<[-1], offset: 6>>
   // CHECK: return %[[RES]] : memref<7xf32, strided<[-1], offset: 6>>
@@ -387,21 +387,21 @@ func.func @collapse_shape_static(%arg0: memref<1x3x4x1x5xf32>) -> memref<3x4x5xf
 // CHECK:           %[[MEM:.*]] = builtin.unrealized_conversion_cast %[[ARG]] : memref<1x3x4x1x5xf32> to !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[BASE_BUFFER:.*]] = llvm.extractvalue %[[MEM]][0] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[ALIGNED_BUFFER:.*]] = llvm.extractvalue %[[MEM]][1] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[C0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+// CHECK:           %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
 // CHECK:           %[[DESC3:.*]] = llvm.insertvalue %[[C3]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C20:.*]] = llvm.mlir.constant(20 : index) : i64
+// CHECK:           %[[C20:.*]] = llvm.mlir.constant(20 : i64) : i64
 // CHECK:           %[[DESC4:.*]] = llvm.insertvalue %[[C20]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK:           %[[DESC5:.*]] = llvm.insertvalue %[[C4]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C5:.*]] = llvm.mlir.constant(5 : index) : i64
+// CHECK:           %[[C5:.*]] = llvm.mlir.constant(5 : i64) : i64
 // CHECK:           %[[DESC6:.*]] = llvm.insertvalue %[[C5]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[DESC7:.*]] = llvm.insertvalue %[[C5]], %[[DESC6]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[DESC8:.*]] = llvm.insertvalue %[[C1]], %[[DESC7]][4, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC8]] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)> to memref<3x4x5xf32>
 // CHECK:           return %[[RES]] : memref<3x4x5xf32>
@@ -433,11 +433,11 @@ func.func @collapse_shape_dynamic_with_non_identity_layout(
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[OFFSET]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK:           %[[DESC3:.*]] = llvm.insertvalue %[[C4]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC4:.*]] = llvm.insertvalue %[[STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC5:.*]] = llvm.insertvalue %[[FINAL_SIZE1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[DESC6:.*]] = llvm.insertvalue %[[C1]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC6]] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)> to memref<4x?xf32, strided<[?, ?], offset: ?>>
 // CHECK:           return %[[RES]] : memref<4x?xf32, strided<[?, ?], offset: ?>>
@@ -458,11 +458,11 @@ func.func @collapse_shape_dynamic_with_non_identity_layout(
 // CHECK32:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
 // CHECK32:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
 // CHECK32:           %[[DESC2:.*]] = llvm.insertvalue %[[OFFSET]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
-// CHECK32:           %[[C4_I32:.*]] = llvm.mlir.constant(4 : index) : i32
+// CHECK32:           %[[C4_I32:.*]] = llvm.mlir.constant(4 : i32) : i32
 // CHECK32:           %[[DESC3:.*]] = llvm.insertvalue %[[C4_I32]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
 // CHECK32:           %[[DESC4:.*]] = llvm.insertvalue %[[STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
 // CHECK32:           %[[DESC5:.*]] = llvm.insertvalue %[[FINAL_SIZE1_CAST]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
-// CHECK32:           %[[C1_I32:.*]] = llvm.mlir.constant(1 : index) : i32
+// CHECK32:           %[[C1_I32:.*]] = llvm.mlir.constant(1 : i32) : i32
 // CHECK32:           %[[DESC6:.*]] = llvm.insertvalue %[[C1_I32]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)>
 // CHECK32:           %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC6]] : !llvm.struct<(ptr, ptr, i32, array<2 x i32>, array<2 x i32>)> to memref<4x?xf32, strided<[?, ?], offset: ?>>
 // CHECK32:           return %[[RES]] : memref<4x?xf32, strided<[?, ?], offset: ?>>
@@ -482,22 +482,22 @@ func.func @expand_shape_static(%arg0: memref<3x4x5xf32>) -> memref<1x3x4x1x5xf32
 // CHECK:           %[[MEM:.*]] = builtin.unrealized_conversion_cast %[[ARG]] : memref<3x4x5xf32> to !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[BASE_BUFFER:.*]] = llvm.extractvalue %[[MEM]][0] : !llvm.struct<(ptr, ptr, i64,
 // CHECK:           %[[ALIGNED_BUFFER:.*]] = llvm.extractvalue %[[MEM]][1] : !llvm.struct<(ptr, ptr, i64,
-// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[C0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[DESC3:.*]] = llvm.insertvalue %[[C1]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C60:.*]] = llvm.mlir.constant(60 : index) : i64
+// CHECK:           %[[C60:.*]] = llvm.mlir.constant(60 : i64) : i64
 // CHECK:           %[[DESC4:.*]] = llvm.insertvalue %[[C60]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+// CHECK:           %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
 // CHECK:           %[[DESC5:.*]] = llvm.insertvalue %[[C3]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C20:.*]] = llvm.mlir.constant(20 : index) : i64
+// CHECK:           %[[C20:.*]] = llvm.mlir.constant(20 : i64) : i64
 // CHECK:           %[[DESC6:.*]] = llvm.insertvalue %[[C20]], %[[DESC5]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+// CHECK:           %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK:           %[[DESC7:.*]] = llvm.insertvalue %[[C4]], %[[DESC6]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
-// CHECK:           %[[C5:.*]] = llvm.mlir.constant(5 : index) : i64
+// CHECK:           %[[C5:.*]] = llvm.mlir.constant(5 : i64) : i64
 // CHECK:           %[[DESC8:.*]] = llvm.insertvalue %[[C5]], %[[DESC7]][4, 2] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[DESC9:.*]] = llvm.insertvalue %[[C1]], %[[DESC8]][3, 3] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
 // CHECK:           %[[DESC10:.*]] = llvm.insertvalue %[[C5]], %[[DESC9]][4, 3] : !llvm.struct<(ptr, ptr, i64, array<5 x i64>, array<5 x i64>)>
@@ -521,7 +521,7 @@ func.func @collapse_shape_fold_zero_dim(%arg0 : memref<1x1xf32>) -> memref<f32>
 // CHECK:           %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[C0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[RES:.*]] = builtin.unrealized_conversion_cast %[[DESC2]] : !llvm.struct<(ptr, ptr, i64)> to memref<f32>
 // CHECK:           return %[[RES]] : memref<f32>
@@ -539,12 +539,12 @@ func.func @expand_shape_zero_dim(%arg0 : memref<f32>) -> memref<1x1xf32> {
 // CHECK:           %[[MEM:.*]] = builtin.unrealized_conversion_cast %[[ARG]] : memref<f32> to !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[BASE_BUFFER:.*]] = llvm.extractvalue %[[MEM]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[ALIGNED_BUFFER:.*]] = llvm.extractvalue %[[MEM]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[C0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[DESC3:.*]] = llvm.insertvalue %[[C1]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC4:.*]] = llvm.insertvalue %[[C1]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC5:.*]] = llvm.insertvalue %[[C1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -565,10 +565,10 @@ func.func @collapse_shape_dynamic(%arg0 : memref<1x2x?xf32>) -> memref<1x?xf32>
 // CHECK:           %[[MEM:.*]] = builtin.unrealized_conversion_cast %[[ARG]] : memref<1x2x?xf32> to !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[BASE_BUFFER:.*]] = llvm.extractvalue %[[MEM]][0] : !llvm.struct<(ptr, ptr, i64,
 // CHECK:           %[[ALIGNED_BUFFER:.*]] = llvm.extractvalue %[[MEM]][1] : !llvm.struct<(ptr, ptr, i64,
-// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[SIZE2:.*]] = llvm.extractvalue %[[MEM]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[STRIDE0:.*]] = llvm.extractvalue %[[MEM]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[C2:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:           %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:           %[[FINAL_SIZE1:.*]] = llvm.mul %[[SIZE2]], %[[C2]] overflow<nsw> : i64
 // CHECK:           %[[SIZE1_TO_IDX:.*]] = builtin.unrealized_conversion_cast %[[FINAL_SIZE1]] : i64 to index
 // CHECK:           %[[FINAL_SIZE1:.*]] = builtin.unrealized_conversion_cast %[[SIZE1_TO_IDX]] : index to i64
@@ -576,7 +576,7 @@ func.func @collapse_shape_dynamic(%arg0 : memref<1x2x?xf32>) -> memref<1x?xf32>
 // CHECK:           %[[DESC0:.*]] = llvm.insertvalue %[[BASE_BUFFER]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BUFFER]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC2:.*]] = llvm.insertvalue %[[C0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[DESC3:.*]] = llvm.insertvalue %[[C1]], %[[DESC2]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC4:.*]] = llvm.insertvalue %[[STRIDE0]], %[[DESC3]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[DESC5:.*]] = llvm.insertvalue %[[FINAL_SIZE1]], %[[DESC4]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -602,16 +602,16 @@ func.func @expand_shape_dynamic(%arg0 : memref<1x?xf32>, %sz0: index) -> memref<
 // CHECK:           %[[MLIR_0:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_0:.*]] = llvm.insertvalue %[[EXTRACTVALUE_0]], %[[MLIR_0]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_1:.*]] = llvm.insertvalue %[[EXTRACTVALUE_1]], %[[INSERTVALUE_0]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:           %[[MLIR_1:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[MLIR_1:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[EXTRACTVALUE_2:.*]] = llvm.extractvalue %[[UNREALIZED_CONVERSION_CAST_1]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[MLIR_2:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_2:.*]] = llvm.insertvalue %[[EXTRACTVALUE_0]], %[[MLIR_2]][0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_3:.*]] = llvm.insertvalue %[[EXTRACTVALUE_1]], %[[INSERTVALUE_2]][1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_4:.*]] = llvm.insertvalue %[[MLIR_1]], %[[INSERTVALUE_3]][2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[INSERTVALUE_5:.*]] = llvm.insertvalue %[[MLIR_3]], %[[INSERTVALUE_4]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_6:.*]] = llvm.insertvalue %[[EXTRACTVALUE_2]], %[[INSERTVALUE_5]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:           %[[INSERTVALUE_7:.*]] = llvm.insertvalue %[[MLIR_4]], %[[INSERTVALUE_6]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_8:.*]] = llvm.insertvalue %[[UNREALIZED_CONVERSION_CAST_0]], %[[INSERTVALUE_7]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_9:.*]] = llvm.insertvalue %[[UNREALIZED_CONVERSION_CAST_0]], %[[INSERTVALUE_8]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
@@ -640,7 +640,7 @@ func.func @expand_shape_dynamic_with_non_identity_layout(
 // CHECK:           %[[MLIR_0:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_0:.*]] = llvm.insertvalue %[[EXTRACTVALUE_0]], %[[MLIR_0]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK:           %[[INSERTVALUE_1:.*]] = llvm.insertvalue %[[EXTRACTVALUE_1]], %[[INSERTVALUE_0]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK:           %[[MLIR_1:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[MLIR_1:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[EXTRACTVALUE_2:.*]] = llvm.extractvalue %[[UNREALIZED_CONVERSION_CAST_1]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[EXTRACTVALUE_3:.*]] = llvm.extractvalue %[[UNREALIZED_CONVERSION_CAST_1]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[EXTRACTVALUE_4:.*]] = llvm.extractvalue %[[UNREALIZED_CONVERSION_CAST_1]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -651,10 +651,10 @@ func.func @expand_shape_dynamic_with_non_identity_layout(
 // CHECK:           %[[INSERTVALUE_2:.*]] = llvm.insertvalue %[[EXTRACTVALUE_0]], %[[MLIR_2]][0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_3:.*]] = llvm.insertvalue %[[EXTRACTVALUE_1]], %[[INSERTVALUE_2]][1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_4:.*]] = llvm.insertvalue %[[EXTRACTVALUE_2]], %[[INSERTVALUE_3]][2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[MLIR_3:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[INSERTVALUE_5:.*]] = llvm.insertvalue %[[MLIR_3]], %[[INSERTVALUE_4]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_6:.*]] = llvm.insertvalue %[[EXTRACTVALUE_3]], %[[INSERTVALUE_5]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
-// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(2 : index) : i64
+// CHECK:           %[[MLIR_4:.*]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK:           %[[INSERTVALUE_7:.*]] = llvm.insertvalue %[[MLIR_4]], %[[INSERTVALUE_6]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_8:.*]] = llvm.insertvalue %[[UNREALIZED_CONVERSION_CAST_3]], %[[INSERTVALUE_7]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 // CHECK:           %[[INSERTVALUE_9:.*]] = llvm.insertvalue %[[UNREALIZED_CONVERSION_CAST_0]], %[[INSERTVALUE_8]][3, 2] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
diff --git a/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir b/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
index 9030eb3542853..c0626982bbb1d 100644
--- a/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
+++ b/mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir
@@ -18,7 +18,7 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
   // CHECK-DAG: %[[ARG2:.*]] = builtin.unrealized_conversion_cast %[[ARG2F]]
   // CHECK-DAG: %[[ARG0:.*]] = builtin.unrealized_conversion_cast %[[ARG0F]]
   // CHECK-DAG: %[[ARG1:.*]] = builtin.unrealized_conversion_cast %[[ARG1F]]
-  // CHECK: llvm.mlir.constant(2048 : index) : i64
+  // CHECK: llvm.mlir.constant(2048 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %0 = memref.alloc() : memref<2048xi8>
 
@@ -27,10 +27,10 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
   // CHECK: %[[BASE_PTR:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[SHIFTED_BASE_PTR:.*]] = llvm.getelementptr %[[BASE_PTR]][%[[ARG2]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
   // CHECK: llvm.insertvalue %[[SHIFTED_BASE_PTR]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[C0]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[ARG1]], %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(1 : index) : i64
+  // CHECK: llvm.mlir.constant(1 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[ARG0]], %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.mul %{{.*}}, %[[ARG1]]
@@ -42,12 +42,12 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
   // CHECK: %[[BASE_PTR_2:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[SHIFTED_BASE_PTR_2:.*]] = llvm.getelementptr %[[BASE_PTR_2]][%[[ARG2]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
   // CHECK: llvm.insertvalue %[[SHIFTED_BASE_PTR_2]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C0_2:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0_2:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[C0_2]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[ARG1]], %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(1 : index) : i64
+  // CHECK: llvm.mlir.constant(1 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.mul %{{.*}}, %[[ARG1]]
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -58,20 +58,20 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
   // CHECK: %[[BASE_PTR_3:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[SHIFTED_BASE_PTR_3:.*]] = llvm.getelementptr %[[BASE_PTR_3]][%[[ARG2]]] : (!llvm.ptr, i64) -> !llvm.ptr, i8
   // CHECK: llvm.insertvalue %[[SHIFTED_BASE_PTR_3]], %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C0_3:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0_3:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[C0_3]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(1 : index) : i64
+  // CHECK: llvm.mlir.constant(1 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(64 : index) : i64
+  // CHECK: llvm.mlir.constant(64 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   %5 = memref.view %0[%arg2][] : memref<2048xi8> to memref<64x4xf32>
 
   // Test view memory space.
-  // CHECK: llvm.mlir.constant(2048 : index) : i64
+  // CHECK: llvm.mlir.constant(2048 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr<4>, ptr<4>, i64, array<1 x i64>, array<1 x i64>)>
   %6 = memref.alloc() : memref<2048xi8, 4>
 
@@ -79,15 +79,15 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
   // CHECK: %[[BASE_PTR_4:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: %[[SHIFTED_BASE_PTR_4:.*]] = llvm.getelementptr %[[BASE_PTR_4]][%[[ARG2]]] : (!llvm.ptr<4>, i64) -> !llvm.ptr<4>, i8
   // CHECK: llvm.insertvalue %[[SHIFTED_BASE_PTR_4]], %{{.*}}[1] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[C0_4:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[C0_4:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[C0_4]], %{{.*}}[2] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 1] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(1 : index) : i64
+  // CHECK: llvm.mlir.constant(1 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(64 : index) : i64
+  // CHECK: llvm.mlir.constant(64 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr<4>, ptr<4>, i64, array<2 x i64>, array<2 x i64>)>
   %7 = memref.view %6[%arg2][] : memref<2048xi8, 4> to memref<64x4xf32, 4>
 
@@ -106,27 +106,27 @@ func.func @view(%arg0 : index, %arg1 : index, %arg2 : index) {
 func.func @view_empty_memref(%offset: index, %mem: memref<0xi8>) {
 
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(0 : index) : i64
+  // CHECK: llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(1 : index) : i64
+  // CHECK: llvm.mlir.constant(1 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(0 : index) : i64
+  // CHECK: llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: llvm.mlir.constant(4 : index) : i64
+  // CHECK: llvm.mlir.constant(4 : i64) : i64
   // CHECK: = llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 
   // CHECK-INTERFACE: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-INTERFACE: llvm.mlir.constant(0 : index) : i64
+  // CHECK-INTERFACE: llvm.mlir.constant(0 : i64) : i64
   // CHECK-INTERFACE: llvm.insertvalue %{{.*}}, %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-INTERFACE: llvm.mlir.constant(4 : index) : i64
+  // CHECK-INTERFACE: llvm.mlir.constant(4 : i64) : i64
   // CHECK-INTERFACE: llvm.insertvalue %{{.*}}, %{{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-INTERFACE: llvm.mlir.constant(1 : index) : i64
+  // CHECK-INTERFACE: llvm.mlir.constant(1 : i64) : i64
   // CHECK-INTERFACE: llvm.insertvalue %{{.*}}, %{{.*}}[4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-INTERFACE: llvm.mlir.constant(0 : index) : i64
+  // CHECK-INTERFACE: llvm.mlir.constant(0 : i64) : i64
   // CHECK-INTERFACE: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-INTERFACE: llvm.mlir.constant(4 : index) : i64
+  // CHECK-INTERFACE: llvm.mlir.constant(4 : i64) : i64
   // CHECK-INTERFACE: = llvm.insertvalue %{{.*}}, %{{.*}}[4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   %0 = memref.view %mem[%offset][] : memref<0xi8> to memref<0x4xf32>
 
@@ -148,7 +148,7 @@ func.func @view_memref_as_rank0(%offset: index, %mem: memref<2xi8>) {
   // ALL:  llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // ALL:  llvm.getelementptr %{{.*}}[%{{.*}}] : (!llvm.ptr, i64) -> !llvm.ptr, i8
   // ALL:  llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64)>
-  // ALL:  llvm.mlir.constant(0 : index) : i64
+  // ALL:  llvm.mlir.constant(0 : i64) : i64
   // ALL:  llvm.insertvalue %{{.*}}, %{{.*}}[2] : !llvm.struct<(ptr, ptr, i64)>
   %memref_view_bf16 = memref.view %mem[%offset][] : memref<2xi8> to memref<bf16>
 
@@ -186,7 +186,7 @@ func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : in
 func.func @assume_alignment(%0 : memref<4x4xf16>) {
   // CHECK: %[[PTR:.*]] = llvm.extractvalue %[[MEMREF:.*]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK-NEXT: %[[TRUE:.*]] = llvm.mlir.constant(true) : i1
-  // CHECK-NEXT: %[[ALIGN:.*]] = llvm.mlir.constant(16 : index) : i64
+  // CHECK-NEXT: %[[ALIGN:.*]] = llvm.mlir.constant(16 : i64) : i64
   // CHECK-NEXT: llvm.intr.assume %[[TRUE]] ["align"(%[[PTR]], %[[ALIGN]] : !llvm.ptr, i64)] : i1
   // CHECK-INTERFACE: llvm.intr.assume
   %1 = memref.assume_alignment %0, 16 : memref<4x4xf16>
@@ -232,7 +232,7 @@ func.func @assume_alignment_w_offset(%0 : memref<4x4xf16, strided<[?, ?], offset
   // CHECK-DAG: %[[OFFSET:.*]] = llvm.extractvalue %[[MEMREF]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK-DAG: %[[BUFF_ADDR:.*]] =  llvm.getelementptr %[[PTR]][%[[OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, f16
   // CHECK-DAG: %[[TRUE:.*]] = llvm.mlir.constant(true) : i1
-  // CHECK-DAG: %[[ALIGN:.*]] = llvm.mlir.constant(16 : index) : i64
+  // CHECK-DAG: %[[ALIGN:.*]] = llvm.mlir.constant(16 : i64) : i64
   // CHECK-NEXT: llvm.intr.assume %[[TRUE]] ["align"(%[[BUFF_ADDR]], %[[ALIGN]] : !llvm.ptr, i64)] : i1
   // CHECK-INTERFACE: llvm.intr.assume
   %1 = memref.assume_alignment %0, 16 : memref<4x4xf16, strided<[?, ?], offset: ?>>
@@ -256,7 +256,7 @@ func.func @dim_of_unranked(%unranked: memref<*xi32>) -> index {
 // CHECK: %[[OFFSET_PTR:.*]] = llvm.getelementptr %[[RANKED_DESC]]{{\[}}
 // CHECK-SAME:   0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, ptr, i64)>
 
-// CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[INDEX_INC:.*]] = llvm.add %[[C1]], %{{.*}} : i64
 
 // CHECK: %[[SIZE_PTR:.*]] = llvm.getelementptr %[[OFFSET_PTR]]{{\[}}
@@ -335,16 +335,16 @@ memref.global @gv2 : memref<2x3xf32> = dense<[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]]>
 // CHECK-INTERFACE-LABEL: func @get_gv0_memref
 func.func @get_gv0_memref() {
   %0 = memref.get_global @gv0 : memref<2xf32>
-  // CHECK: %[[DIM:.*]] = llvm.mlir.constant(2 : index) : i64
-  // CHECK: %[[STRIDE:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[DIM:.*]] = llvm.mlir.constant(2 : i64) : i64
+  // CHECK: %[[STRIDE:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[ADDR:.*]] = llvm.mlir.addressof @gv0 : !llvm.ptr
   // CHECK: %[[GEP:.*]] = llvm.getelementptr %[[ADDR]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<2 x f32>
-  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : index) : i64
+  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : i64) : i64
   // CHECK: %[[DEADBEEFPTR:.*]] = llvm.inttoptr %[[DEADBEEF]] : i64 to !llvm.ptr
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: llvm.insertvalue %[[DEADBEEFPTR]], {{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: llvm.insertvalue %[[GEP]], {{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[OFFSET]], {{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: llvm.insertvalue %[[DIM]], {{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: llvm.insertvalue %[[STRIDE]], {{.*}}[4, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
@@ -357,17 +357,17 @@ func.func @get_gv0_memref() {
 // CHECK-LABEL: func @get_gv2_memref
 // CHECK-INTERFACE-LABEL: func @get_gv2_memref
 func.func @get_gv2_memref() {
-  // CHECK: %[[DIM0:.*]] = llvm.mlir.constant(2 : index) : i64
-  // CHECK: %[[DIM1:.*]] = llvm.mlir.constant(3 : index) : i64
-  // CHECK: %[[STRIDE1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[DIM0:.*]] = llvm.mlir.constant(2 : i64) : i64
+  // CHECK: %[[DIM1:.*]] = llvm.mlir.constant(3 : i64) : i64
+  // CHECK: %[[STRIDE1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[ADDR:.*]] = llvm.mlir.addressof @gv2 : !llvm.ptr
   // CHECK: %[[GEP:.*]] = llvm.getelementptr %[[ADDR]][0, 0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.array<2 x array<3 x f32>>
-  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : index) : i64
+  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : i64) : i64
   // CHECK: %[[DEADBEEFPTR:.*]] = llvm.inttoptr %[[DEADBEEF]] : i64 to !llvm.ptr
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[DEADBEEFPTR]], {{.*}}[0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[GEP]], {{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[OFFSET]], {{.*}}[2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[DIM0]], {{.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
   // CHECK: llvm.insertvalue %[[DIM1]], {{.*}}[3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -389,12 +389,12 @@ memref.global @gv3 : memref<f32> = dense<1.0>
 func.func @get_gv3_memref() {
   // CHECK: %[[ADDR:.*]] = llvm.mlir.addressof @gv3 : !llvm.ptr
   // CHECK: %[[GEP:.*]] = llvm.getelementptr %[[ADDR]][0] : (!llvm.ptr) -> !llvm.ptr, f32
-  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : index) : i64
+  // CHECK: %[[DEADBEEF:.*]] = llvm.mlir.constant(3735928559 : i64) : i64
   // CHECK: %[[DEADBEEFPTR:.*]] = llvm.inttoptr %[[DEADBEEF]] : i64 to !llvm.ptr
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
   // CHECK: llvm.insertvalue %[[DEADBEEFPTR]], {{.*}}[0] : !llvm.struct<(ptr, ptr, i64)>
   // CHECK: llvm.insertvalue %[[GEP]], {{.*}}[1] : !llvm.struct<(ptr, ptr, i64)>
-  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i64
+  // CHECK: %[[OFFSET:.*]] = llvm.mlir.constant(0 : i64) : i64
   // CHECK: llvm.insertvalue %[[OFFSET]], {{.*}}[2] : !llvm.struct<(ptr, ptr, i64)>
   // CHECK-INTERFACE: llvm.mlir.addressof
   // CHECK-INTERFACE: llvm.getelementptr
@@ -459,9 +459,9 @@ func.func @rank_of_ranked(%ranked: memref<?xi32>) {
   %rank = memref.rank %ranked : memref<?xi32>
   return
 }
-// CHECK: llvm.mlir.constant(1 : index) : i64
-// CHECK32: llvm.mlir.constant(1 : index) : i32
-// CHECK-INTERFACE: llvm.mlir.constant(1 : index) : i64
+// CHECK: llvm.mlir.constant(1 : i64) : i64
+// CHECK32: llvm.mlir.constant(1 : i32) : i32
+// CHECK-INTERFACE: llvm.mlir.constant(1 : i64) : i64
 
 // -----
 
@@ -513,7 +513,7 @@ func.func @atomic_rmw_with_offset(%I : memref<10xi32, strided<[1], offset: 5>>,
 // CHECK-DAG:    %[[MEMREF_STRUCT:.+]] = builtin.unrealized_conversion_cast %[[ARG0]] : memref<10xi32, strided<[1], offset: 5>> to !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
 // CHECK-DAG:    %[[INDEX:.+]] = builtin.unrealized_conversion_cast %[[ARG2]] : index to i64
 // CHECK:        %[[BASE_PTR:.+]] = llvm.extractvalue %[[MEMREF_STRUCT]][1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
-// CHECK:        %[[OFFSET:.+]] = llvm.mlir.constant(5 : index) : i64
+// CHECK:        %[[OFFSET:.+]] = llvm.mlir.constant(5 : i64) : i64
 // CHECK:        %[[OFFSET_PTR:.+]] = llvm.getelementptr %[[BASE_PTR]][%[[OFFSET]]] : (!llvm.ptr, i64) -> !llvm.ptr, i32
 // CHECK:        %[[PTR:.+]] = llvm.getelementptr %[[OFFSET_PTR]][%[[INDEX]]] : (!llvm.ptr, i64) -> !llvm.ptr, i32
 // CHECK:        llvm.atomicrmw _and %[[PTR]], %[[ARG1]] acq_rel
@@ -616,15 +616,15 @@ llvm.func @generic_atomic_rmw_in_alloca_scope() {
 // CHECK-INTERFACE-LABEL: func @memref_copy_ranked
 func.func @memref_copy_ranked() {
   %0 = memref.alloc() : memref<2xf32>
-  // CHECK: llvm.mlir.constant(2 : index) : i64
+  // CHECK: llvm.mlir.constant(2 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %1 = memref.cast %0 : memref<2xf32> to memref<?xf32>
   %2 = memref.alloc() : memref<2xf32>
-  // CHECK: llvm.mlir.constant(2 : index) : i64
+  // CHECK: llvm.mlir.constant(2 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %3 = memref.cast %2 : memref<2xf32> to memref<?xf32>
   memref.copy %1, %3 : memref<?xf32> to memref<?xf32>
-  // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: [[EXTRACT0:%.*]] = llvm.extractvalue {{%.*}}[3, 0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   // CHECK: [[MUL:%.*]] = llvm.mul [[ONE]], [[EXTRACT0]] : i64
   // CHECK: [[NULL:%.*]] = llvm.mlir.zero : !llvm.ptr
@@ -708,23 +708,23 @@ func.func @memref_copy_noncontiguous(%in: memref<16x2xi32>, %offset: index) {
 // CHECK-INTERFACE-LABEL: func @memref_copy_unranked
 func.func @memref_copy_unranked() {
   %0 = memref.alloc() : memref<2xi1>
-  // CHECK: llvm.mlir.constant(2 : index) : i64
+  // CHECK: llvm.mlir.constant(2 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %1 = memref.cast %0 : memref<2xi1> to memref<*xi1>
   %2 = memref.alloc() : memref<2xi1>
-  // CHECK: llvm.mlir.constant(2 : index) : i64
+  // CHECK: llvm.mlir.constant(2 : i64) : i64
   // CHECK: llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %3 = memref.cast %2 : memref<2xi1> to memref<*xi1>
   memref.copy %1, %3 : memref<*xi1> to memref<*xi1>
-  // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: [[ONE:%.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: [[ALLOCA:%.*]] = llvm.alloca [[ONE]] x !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)> : (i64) -> !llvm.ptr
   // CHECK: llvm.store {{%.*}}, [[ALLOCA]] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>, !llvm.ptr
-  // CHECK: [[RANK:%.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: [[RANK:%.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: [[UNDEF:%.*]] = llvm.mlir.poison : !llvm.struct<(i64, ptr)>
   // CHECK: [[INSERT:%.*]] = llvm.insertvalue [[RANK]], [[UNDEF]][0] : !llvm.struct<(i64, ptr)>
   // CHECK: [[INSERT2:%.*]] = llvm.insertvalue [[ALLOCA]], [[INSERT]][1] : !llvm.struct<(i64, ptr)>
   // CHECK: [[STACKSAVE:%.*]] = llvm.intr.stacksave : !llvm.ptr
-  // CHECK: [[RANK2:%.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: [[RANK2:%.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: [[ALLOCA2:%.*]] = llvm.alloca [[RANK2]] x !llvm.struct<(i64, ptr)> : (i64) -> !llvm.ptr
   // CHECK: llvm.store {{%.*}}, [[ALLOCA2]] : !llvm.struct<(i64, ptr)>, !llvm.ptr
   // CHECK: [[ALLOCA3:%.*]] = llvm.alloca [[RANK2]] x !llvm.struct<(i64, ptr)> : (i64) -> !llvm.ptr
@@ -779,7 +779,7 @@ func.func @extract_aligned_pointer_as_index_unranked(%m: memref<*xf32>) -> index
 // CHECK: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: %[[DESC0:.*]] = llvm.insertvalue %[[BASE]], %[[DESC]][0] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: %[[DESC1:.*]] = llvm.insertvalue %[[ALIGNED_BASE]], %[[DESC0]][1] : !llvm.struct<(ptr, ptr, i64)>
-// CHECK: %[[OFF0:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[OFF0:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: %[[BASE_BUFFER_DESC:.*]] = llvm.insertvalue %[[OFF0]], %[[DESC1]][2] : !llvm.struct<(ptr, ptr, i64)>
 // CHECK: %[[OFFSET:.*]] = llvm.extractvalue %[[MEM_DESC]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK: %[[SIZE0:.*]] = llvm.extractvalue %[[MEM_DESC]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -878,9 +878,9 @@ func.func @alloca_unconvertable_memory_space() {
 
 // CHECK-LABEL: func @alloca_huge(
 func.func @alloca_huge(%arg0 : index) {
-  // CHECK: %[[D0:.*]] = llvm.mlir.constant(9223372036854775807 : index) : i64
-  // CHECK: %[[D1:.*]] = llvm.mlir.constant(3 : index) : i64
-  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[D0:.*]] = llvm.mlir.constant(9223372036854775807 : i64) : i64
+  // CHECK: %[[D1:.*]] = llvm.mlir.constant(3 : i64) : i64
+  // CHECK: %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[NUMELTS:.*]] = llvm.mlir.poison : i64
   // CHECK: llvm.alloca %[[NUMELTS]] x i32 : (i64) -> !llvm.ptr
   %1 = memref.alloca() : memref<9223372036854775807x3xi32>
diff --git a/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir b/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
index 7d32d8db81313..eb7d8bd08b718 100644
--- a/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
+++ b/mlir/test/Conversion/NVGPUToNVVM/nvgpu-to-nvvm.mlir
@@ -248,15 +248,15 @@ func.func @async_cp(
   %src: memref<128x128xf32>, %dst: memref<3x16x128xf32, 3>, %i : index) {
   // CHECK: %[[IDX1:.*]] = builtin.unrealized_conversion_cast %[[IDX]] : index to i64
   // CHECK-DAG: %[[BASEDST:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
-  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(2048 : index) : i64
+  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(2048 : i64) : i64
   // CHECK-DAG: %[[LI:.*]] = llvm.mul %[[IDX1]], %[[S0]] : i64
-  // CHECK-DAG: %[[S1:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S1:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[FI0:.*]] = llvm.mul %[[IDX1]], %[[S1]] : i64
   // CHECK-DAG: %[[FI1:.*]] = llvm.add %[[LI]], %[[FI0]] : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.add %[[FI1]], %[[IDX1]] : i64
   // CHECK-DAG: %[[ADDRESSDST:.*]] = llvm.getelementptr %[[BASEDST]][%[[FI2]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>
   // CHECK-DAG: %[[BASESRC:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-DAG: %[[S3:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S3:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[FI3:.*]] = llvm.mul %[[IDX1]], %[[S3]]  : i64
   // CHECK-DAG: %[[FI4:.*]] = llvm.add %[[FI3]], %[[IDX1]]  : i64
   // CHECK-DAG: %[[ADDRESSSRC:.*]] = llvm.getelementptr %[[BASESRC]][%[[FI4]]] : (!llvm.ptr, i64) -> !llvm.ptr
@@ -279,12 +279,12 @@ func.func @async_cp_i4(
   %src: memref<128x64xi4>, %dst: memref<128x128xi4, 3>, %i : index) -> !nvgpu.device.async.token {
   // CHECK: %[[IDX1:.*]] = builtin.unrealized_conversion_cast %[[IDX]] : index to i64
   // CHECK-DAG: %[[BASEDST:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[LI:.*]] = llvm.mul %[[IDX1]], %[[S0]] : i64
   // CHECK-DAG: %[[FI1:.*]] = llvm.add %[[LI]], %[[IDX1]] : i64
   // CHECK-DAG: %[[ADDRESSDST:.*]] = llvm.getelementptr %[[BASEDST]][%[[FI1]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>
   // CHECK-DAG: %[[BASESRC:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(64 : index) : i64
+  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(64 : i64) : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.mul %[[IDX1]], %[[S2]]  : i64
   // CHECK-DAG: %[[FI3:.*]] = llvm.add %[[FI2]], %[[IDX1]]  : i64
   // CHECK-DAG: %[[ADDRESSSRC:.*]] = llvm.getelementptr %[[BASESRC]][%[[FI3]]] : (!llvm.ptr, i64) -> !llvm.ptr
@@ -301,15 +301,15 @@ func.func @async_cp_zfill_f32_align4(
   // CHECK-DAG: %[[IDX1:.*]] = builtin.unrealized_conversion_cast %[[IDX]] : index to i64
   // CHECK-DAG: %[[SRC1:.*]] = builtin.unrealized_conversion_cast %[[SRCELEMENTS]] : index to i64
   // CHECK-DAG: %[[BASEDST:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
-  // CHECK-DAG: %[[S2048:.*]] = llvm.mlir.constant(2048 : index) : i64
+  // CHECK-DAG: %[[S2048:.*]] = llvm.mlir.constant(2048 : i64) : i64
   // CHECK-DAG: %[[LI1:.*]] = llvm.mul %[[IDX1]], %[[S2048]] : i64
-  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[LI:.*]] = llvm.mul %[[IDX1]], %[[S0]] : i64
   // CHECK-DAG: %[[FI1:.*]] = llvm.add %[[LI1]], %[[LI]] : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.add %[[FI1]], %[[IDX1]] : i64
   // CHECK-DAG: %[[ADDRESSDST:.*]] = llvm.getelementptr %[[BASEDST]][%[[FI2]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
   // CHECK-DAG: %[[BASESRC:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.mul %[[IDX1]], %[[S2]]  : i64
   // CHECK-DAG: %[[FI3:.*]] = llvm.add %[[FI2]], %[[IDX1]]  : i64
   // CHECK-DAG: %[[ADDRESSSRC:.*]] = llvm.getelementptr %[[BASESRC]][%[[FI3]]] : (!llvm.ptr, i64) -> !llvm.ptr
@@ -336,15 +336,15 @@ func.func @async_cp_zfill_f32_align1(
   // CHECK-DAG: %[[IDX1:.*]] = builtin.unrealized_conversion_cast %[[IDX]] : index to i64
   // CHECK-DAG: %[[SRC1:.*]] = builtin.unrealized_conversion_cast %[[SRCELEMENTS]] : index to i64
   // CHECK-DAG: %[[BASEDST:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
-  // CHECK-DAG: %[[S2048:.*]] = llvm.mlir.constant(2048 : index) : i64
+  // CHECK-DAG: %[[S2048:.*]] = llvm.mlir.constant(2048 : i64) : i64
   // CHECK-DAG: %[[LI1:.*]] = llvm.mul %[[IDX1]], %[[S2048]] : i64
-  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S0:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[LI:.*]] = llvm.mul %[[IDX1]], %[[S0]] : i64
   // CHECK-DAG: %[[FI1:.*]] = llvm.add %[[LI1]], %[[LI]] : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.add %[[FI1]], %[[IDX1]] : i64
   // CHECK-DAG: %[[ADDRESSDST:.*]] = llvm.getelementptr %[[BASEDST]][%[[FI2]]] : (!llvm.ptr<3>, i64) -> !llvm.ptr<3>, f32
   // CHECK-DAG: %[[BASESRC:.*]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(128 : index) : i64
+  // CHECK-DAG: %[[S2:.*]] = llvm.mlir.constant(128 : i64) : i64
   // CHECK-DAG: %[[FI2:.*]] = llvm.mul %[[IDX1]], %[[S2]]  : i64
   // CHECK-DAG: %[[FI3:.*]] = llvm.add %[[FI2]], %[[IDX1]]  : i64
   // CHECK-DAG: %[[ADDRESSSRC:.*]] = llvm.getelementptr %[[BASESRC]][%[[FI3]]] : (!llvm.ptr, i64) -> !llvm.ptr
@@ -874,7 +874,7 @@ module @mymodule {
     // CHECK: nvvm.cp.async.bulk.tensor.shared.cluster.global
     nvgpu.tma.async.load %lhsTensorMap[%c0, %c0], %mbarrier[%c0] to %lhsShmem : !lhsTensorMap, !barrierType -> memref<128x64xf16,3>
     // CHECK: %[[desc:.+]] = llvm.extractvalue %{{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-    // CHECK: %[[c8192:.+]] = llvm.mlir.constant(8192 : index) : i64
+    // CHECK: %[[c8192:.+]] = llvm.mlir.constant(8192 : i64) : i64
     // CHECK: %[[shmemOfset:.+]] = llvm.getelementptr %[[desc]][%[[c8192]]] : (!llvm.ptr<3>, i64)
     // CHECK: %[[dest:.+]] = llvm.addrspacecast %[[shmemOfset]] : !llvm.ptr<3> to !llvm.ptr<7>
     // CHECK: nvvm.cp.async.bulk.tensor.shared.cluster.global %[[dest]], %{{.*}}, %{{.*}}, box[%{{.*}}, %{{.*}}]
@@ -938,38 +938,38 @@ func.func @warpgroup_mma_128_128_64(
 // CHECK: %[[UD:.+]] =  llvm.mlir.poison : !llvm.struct<(struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>, struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>)>
 // CHECK: %[[S2:.+]] = llvm.extractvalue %[[ARG]][0] : !llvm.struct<(struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>, struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>)>
 // CHECK: %[[S4:.+]] = nvvm.wgmma.mma_async %[[S0]], %[[S1]], %[[S2]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)> -> !llvm.struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>
-// CHECK: %[[S5:.+]] = llvm.mlir.constant(2 : i32) : i64
+// CHECK: %[[S5:.+]] = llvm.mlir.constant(2 : i64) : i64
 // CHECK: %[[S6:.+]] = llvm.add %[[S0]], %[[S5]] : i64
-// CHECK: %[[S7:.+]] = llvm.mlir.constant(128 : i32) : i64
+// CHECK: %[[S7:.+]] = llvm.mlir.constant(128 : i64) : i64
 // CHECK: %[[S8:.+]] = llvm.add %[[S1]], %[[S7]]  : i64
 // CHECK: %[[S9:.+]] = nvvm.wgmma.mma_async %[[S6]], %[[S8]], %[[S4]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
-// CHECK: %[[S10:.+]] = llvm.mlir.constant(4 : i32) : i64
+// CHECK: %[[S10:.+]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK: %[[S11:.+]] = llvm.add %[[S0]], %[[S10]]  : i64
-// CHECK: %[[S12:.+]] = llvm.mlir.constant(256 : i32) : i64
+// CHECK: %[[S12:.+]] = llvm.mlir.constant(256 : i64) : i64
 // CHECK: %[[S13:.+]] = llvm.add %[[S1]], %[[S12]]  : i64
 // CHECK: %[[S14:.+]] = nvvm.wgmma.mma_async %[[S11]], %[[S13]], %[[S9]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
-// CHECK: %[[S15:.+]] = llvm.mlir.constant(6 : i32) : i64
+// CHECK: %[[S15:.+]] = llvm.mlir.constant(6 : i64) : i64
 // CHECK: %[[S16:.+]] = llvm.add %[[S0]], %[[S15]]  : i64
-// CHECK: %[[S17:.+]] = llvm.mlir.constant(384 : i32) : i64
+// CHECK: %[[S17:.+]] = llvm.mlir.constant(384 : i64) : i64
 // CHECK: %[[S18:.+]] = llvm.add %[[S1]], %[[S17]]  : i64
 // CHECK: %[[S19:.+]] = nvvm.wgmma.mma_async %[[S16]], %[[S18]], %[[S14]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
 // CHECK: %[[S3:.+]] = llvm.extractvalue %[[ARG]][1] : !llvm.struct<(struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>, struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>)>
-// CHECK: %[[S21:.+]] = llvm.mlir.constant(512 : i32) : i64
+// CHECK: %[[S21:.+]] = llvm.mlir.constant(512 : i64) : i64
 // CHECK: %[[S22:.+]] = llvm.add %[[S0]], %[[S21]]  : i64
 // CHECK: %[[S23:.+]] = nvvm.wgmma.mma_async %[[S22]], %[[S1]], %[[S3]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
-// CHECK: %[[S24:.+]] = llvm.mlir.constant(514 : i32) : i64
+// CHECK: %[[S24:.+]] = llvm.mlir.constant(514 : i64) : i64
 // CHECK: %[[S25:.+]] = llvm.add %[[S0]], %[[S24]]  : i64
-// CHECK: %[[S26:.+]] = llvm.mlir.constant(128 : i32) : i64
+// CHECK: %[[S26:.+]] = llvm.mlir.constant(128 : i64) : i64
 // CHECK: %[[S27:.+]] = llvm.add %[[S1]], %[[S26]]  : i64
 // CHECK: %[[S28:.+]] = nvvm.wgmma.mma_async %[[S25]], %[[S27]], %[[S23]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
-// CHECK: %[[S29:.+]] = llvm.mlir.constant(516 : i32) : i64
+// CHECK: %[[S29:.+]] = llvm.mlir.constant(516 : i64) : i64
 // CHECK: %[[S30:.+]] = llvm.add %[[S0]], %[[S29]]  : i64
-// CHECK: %[[S31:.+]] = llvm.mlir.constant(256 : i32) : i64
+// CHECK: %[[S31:.+]] = llvm.mlir.constant(256 : i64) : i64
 // CHECK: %[[S32:.+]] = llvm.add %[[S1]], %[[S31]]  : i64
 // CHECK: %[[S33:.+]] = nvvm.wgmma.mma_async %[[S30]], %[[S32]], %[[S28]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
-// CHECK: %[[S34:.+]] = llvm.mlir.constant(518 : i32) : i64
+// CHECK: %[[S34:.+]] = llvm.mlir.constant(518 : i64) : i64
 // CHECK: %[[S35:.+]] = llvm.add %[[S0]], %[[S34]]  : i64
-// CHECK: %[[S36:.+]] = llvm.mlir.constant(384 : i32) : i64
+// CHECK: %[[S36:.+]] = llvm.mlir.constant(384 : i64) : i64
 // CHECK: %[[S37:.+]] = llvm.add %[[S1]], %[[S36]]  : i64
 // CHECK: %[[S38:.+]] = nvvm.wgmma.mma_async %[[S35]], %[[S37]], %[[S33]], <m = 64, n = 128, k = 16>, D[<f32>, <one>, <wrapped>], A[<f16>, <one>, <row>], B[<f16>, <one>, <row>] : !llvm.struct
 // CHECK: %[[S40:.+]] = llvm.insertvalue %[[S19]], %[[UD]][0] : !llvm.struct<(struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>, struct<(f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32, f32)>)>
diff --git a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
index 1f48d3c07a11e..65397f7cbdff4 100644
--- a/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
+++ b/mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir
@@ -397,9 +397,9 @@ llvm.func @_QPsimple_reduction(%arg0: !llvm.ptr {fir.bindc_name = "y"}) {
 
 // CHECK-LABEL:  @_QQmain
 llvm.func @_QQmain() {
-  %0 = llvm.mlir.constant(0 : index) : i64
-  %1 = llvm.mlir.constant(5 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(0 : i64) : i64
+  %1 = llvm.mlir.constant(5 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   %3 = llvm.mlir.constant(1 : i64) : i64
   %4 = llvm.alloca %3 x i32 : (i64) -> !llvm.ptr
 // CHECK: omp.taskgroup
@@ -438,8 +438,8 @@ llvm.func @_QFPdo_work(%arg0: !llvm.ptr {fir.bindc_name = "i"}) {
 
 // CHECK-LABEL:  @sub_
 llvm.func @sub_() {
-  %0 = llvm.mlir.constant(0 : index) : i64
-  %1 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(0 : i64) : i64
+  %1 = llvm.mlir.constant(1 : i64) : i64
   %2 = llvm.mlir.constant(1 : i64) : i64
   %3 = llvm.alloca %2 x i32 {bindc_name = "i", in_type = i32, operandSegmentSizes = array<i32: 0, 0>, uniq_name = "_QFsubEi"} : (i64) -> !llvm.ptr
 // CHECK: omp.ordered.region
@@ -469,16 +469,16 @@ llvm.func @sub_() {
 
 // CHECK-LABEL:   llvm.func @_QPtarget_map_with_bounds(
 // CHECK:           %[[ARG_0:.*]]: !llvm.ptr, %[[ARG_1:.*]]: !llvm.ptr, %[[ARG_2:.*]]: !llvm.ptr) {
-// CHECK: %[[C_01:.*]] = llvm.mlir.constant(4 : index) : i64
-// CHECK: %[[C_02:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[C_03:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[C_04:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[C_01:.*]] = llvm.mlir.constant(4 : i64) : i64
+// CHECK: %[[C_02:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[C_03:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[C_04:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[BOUNDS0:.*]] = omp.map.bounds   lower_bound(%[[C_02]] : i64) upper_bound(%[[C_01]] : i64) stride(%[[C_04]] : i64) start_idx(%[[C_04]] : i64)
 // CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG_1]] : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS0]]) name("") -> !llvm.ptr
-// CHECK: %[[C_11:.*]] = llvm.mlir.constant(4 : index) : i64
-// CHECK: %[[C_12:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[C_13:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[C_14:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK: %[[C_11:.*]] = llvm.mlir.constant(4 : i64) : i64
+// CHECK: %[[C_12:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[C_13:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[C_14:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[BOUNDS1:.*]] = omp.map.bounds   lower_bound(%[[C_12]] : i64) upper_bound(%[[C_11]] : i64) stride(%[[C_14]] : i64) start_idx(%[[C_14]] : i64)
 // CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG_2]] : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS1]]) name("") -> !llvm.ptr
 // CHECK: omp.target kernel_type(generic) map_entries(%[[MAP0]] -> %[[BB_ARG0:.*]], %[[MAP1]]  -> %[[BB_ARG1:.*]] : !llvm.ptr, !llvm.ptr) {
@@ -488,16 +488,16 @@ llvm.func @sub_() {
 // CHECK:}
 
 llvm.func @_QPtarget_map_with_bounds(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr) {
-  %0 = llvm.mlir.constant(4 : index) : i64
-  %1 = llvm.mlir.constant(1 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
-  %3 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(4 : i64) : i64
+  %1 = llvm.mlir.constant(1 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
+  %3 = llvm.mlir.constant(1 : i64) : i64
   %4 = omp.map.bounds   lower_bound(%1 : i64) upper_bound(%0 : i64) stride(%3 : i64) start_idx(%3 : i64)
   %5 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%4) name("") -> !llvm.ptr
-  %6 = llvm.mlir.constant(4 : index) : i64
-  %7 = llvm.mlir.constant(1 : index) : i64
-  %8 = llvm.mlir.constant(1 : index) : i64
-  %9 = llvm.mlir.constant(1 : index) : i64
+  %6 = llvm.mlir.constant(4 : i64) : i64
+  %7 = llvm.mlir.constant(1 : i64) : i64
+  %8 = llvm.mlir.constant(1 : i64) : i64
+  %9 = llvm.mlir.constant(1 : i64) : i64
   %10 = omp.map.bounds   lower_bound(%7 : i64) upper_bound(%6 : i64) stride(%9 : i64) start_idx(%9 : i64)
   %11 = omp.map.info var_ptr(%arg2 : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%10) name("") -> !llvm.ptr
   omp.target kernel_type(generic) map_entries(%5 -> %arg3, %11 -> %arg4: !llvm.ptr, !llvm.ptr) {
diff --git a/mlir/test/Conversion/PtrToLLVM/ptr-to-llvm.mlir b/mlir/test/Conversion/PtrToLLVM/ptr-to-llvm.mlir
index d53fc19a47c90..befec1e9b5632 100644
--- a/mlir/test/Conversion/PtrToLLVM/ptr-to-llvm.mlir
+++ b/mlir/test/Conversion/PtrToLLVM/ptr-to-llvm.mlir
@@ -119,15 +119,15 @@ func.func @test_get_metadata_dynamic(%arg0: memref<?x?xf32, #ptr.generic_space>)
 // CHECK:           %[[VAL_1:.*]] = llvm.extractvalue %[[ARG1]][0] : !llvm.struct<(ptr)>
 // CHECK:           %[[VAL_2:.*]] = llvm.insertvalue %[[VAL_1]], %[[VAL_0]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[VAL_3:.*]] = llvm.insertvalue %[[ARG0]], %[[VAL_2]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_5:.*]] = llvm.insertvalue %[[VAL_4]], %[[VAL_3]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_6:.*]] = llvm.mlir.constant(10 : index) : i64
+// CHECK:           %[[VAL_6:.*]] = llvm.mlir.constant(10 : i64) : i64
 // CHECK:           %[[VAL_7:.*]] = llvm.insertvalue %[[VAL_6]], %[[VAL_5]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_8:.*]] = llvm.mlir.constant(20 : index) : i64
+// CHECK:           %[[VAL_8:.*]] = llvm.mlir.constant(20 : i64) : i64
 // CHECK:           %[[VAL_9:.*]] = llvm.insertvalue %[[VAL_8]], %[[VAL_7]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_10:.*]] = llvm.mlir.constant(20 : index) : i64
+// CHECK:           %[[VAL_10:.*]] = llvm.mlir.constant(20 : i64) : i64
 // CHECK:           %[[VAL_11:.*]] = llvm.insertvalue %[[VAL_10]], %[[VAL_9]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_13:.*]] = llvm.insertvalue %[[VAL_12]], %[[VAL_11]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           llvm.return %[[VAL_13]] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:         }
@@ -143,7 +143,7 @@ func.func @test_from_ptr_static(%arg0: !ptr.ptr<#ptr.generic_space>, %arg1: !ptr
 // CHECK:           %[[VAL_1:.*]] = llvm.extractvalue %[[ARG1]][0] : !llvm.struct<(ptr, i64, i64, i64)>
 // CHECK:           %[[VAL_2:.*]] = llvm.insertvalue %[[VAL_1]], %[[VAL_0]][0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[VAL_3:.*]] = llvm.insertvalue %[[ARG0]], %[[VAL_2]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK:           %[[VAL_4:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK:           %[[VAL_5:.*]] = llvm.insertvalue %[[VAL_4]], %[[VAL_3]][2] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[VAL_6:.*]] = llvm.extractvalue %[[ARG1]][1] : !llvm.struct<(ptr, i64, i64, i64)>
 // CHECK:           %[[VAL_7:.*]] = llvm.insertvalue %[[VAL_6]], %[[VAL_5]][3, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
@@ -151,7 +151,7 @@ func.func @test_from_ptr_static(%arg0: !ptr.ptr<#ptr.generic_space>, %arg1: !ptr
 // CHECK:           %[[VAL_9:.*]] = llvm.insertvalue %[[VAL_8]], %[[VAL_7]][3, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           %[[VAL_10:.*]] = llvm.extractvalue %[[ARG1]][3] : !llvm.struct<(ptr, i64, i64, i64)>
 // CHECK:           %[[VAL_11:.*]] = llvm.insertvalue %[[VAL_10]], %[[VAL_9]][4, 0] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : index) : i64
+// CHECK:           %[[VAL_12:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK:           %[[VAL_13:.*]] = llvm.insertvalue %[[VAL_12]], %[[VAL_11]][4, 1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:           llvm.return %[[VAL_13]] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // CHECK:         }
diff --git a/mlir/test/Conversion/VectorToLLVM/vector-load-store-to-llvm.mlir b/mlir/test/Conversion/VectorToLLVM/vector-load-store-to-llvm.mlir
index c1543a64fbbe6..ceaf3529211d6 100644
--- a/mlir/test/Conversion/VectorToLLVM/vector-load-store-to-llvm.mlir
+++ b/mlir/test/Conversion/VectorToLLVM/vector-load-store-to-llvm.mlir
@@ -11,7 +11,7 @@ func.func @load(%memref : memref<200x100xf32>, %i : index, %j : index) -> vector
 }
 
 // ALL-LABEL: func @load
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -26,7 +26,7 @@ func.func @load_scalable(%memref : memref<200x100xf32>, %i : index, %j : index)
 }
 
 // ALL-LABEL: func @load_scalable
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -41,7 +41,7 @@ func.func @load_nontemporal(%memref : memref<200x100xf32>, %i : index, %j : inde
 }
 
 // ALL-LABEL: func @load_nontemporal
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -56,7 +56,7 @@ func.func @load_nontemporal_scalable(%memref : memref<200x100xf32>, %i : index,
 }
 
 // ALL-LABEL: func @load_nontemporal_scalable
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -97,7 +97,7 @@ func.func @load_0d(%memref : memref<200x100xf32>, %i : index, %j : index) -> vec
 // ALL: %[[I:.*]] = builtin.unrealized_conversion_cast %{{.*}} : index to i64
 // ALL: %[[CAST_MEMREF:.*]] = builtin.unrealized_conversion_cast %{{.*}} : memref<200x100xf32> to !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
 // ALL: %[[REF:.*]] = llvm.extractvalue %[[CAST_MEMREF]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %[[I]], %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %[[J]]
 // DEFAULT: %[[ADDR:.*]] = llvm.getelementptr %[[REF]][%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -129,7 +129,7 @@ func.func @store(%memref : memref<200x100xf32>, %i : index, %j : index) {
 }
 
 // ALL-LABEL: func @store
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -145,7 +145,7 @@ func.func @store_scalable(%memref : memref<200x100xf32>, %i : index, %j : index)
 }
 
 // ALL-LABEL: func @store_scalable
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -161,7 +161,7 @@ func.func @store_nontemporal(%memref : memref<200x100xf32>, %i : index, %j : ind
 }
 
 // ALL-LABEL: func @store_nontemporal
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -177,7 +177,7 @@ func.func @store_nontemporal_scalable(%memref : memref<200x100xf32>, %i : index,
 }
 
 // ALL-LABEL: func @store_nontemporal_scalable
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %{{.*}}, %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %{{.*}}
 // DEFAULT: %[[GEP:.*]] = llvm.getelementptr %{{.*}}[%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
@@ -219,7 +219,7 @@ func.func @store_0d(%memref : memref<200x100xf32>, %i : index, %j : index) {
 // ALL: %[[CST:.*]] = arith.constant dense<1.100000e+01> : vector<f32>
 // ALL: %[[VAL:.*]] = builtin.unrealized_conversion_cast %[[CST]] : vector<f32> to vector<1xf32>
 // ALL: %[[REF:.*]] = llvm.extractvalue %[[CAST_MEMREF]][1] : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
-// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : index) : i64
+// ALL: %[[C100:.*]] = llvm.mlir.constant(100 : i64) : i64
 // ALL: %[[MUL:.*]] = llvm.mul %[[I]], %[[C100]]
 // ALL: %[[ADD:.*]] = llvm.add %[[MUL]], %[[J]]
 // DEFAULT: %[[ADDR:.*]] = llvm.getelementptr %[[REF]][%[[ADD]]] : (!llvm.ptr, i64) -> !llvm.ptr, f32
diff --git a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir
index 64b242c3a0275..ce5874058ca88 100644
--- a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir
+++ b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-32b.mlir
@@ -6,7 +6,7 @@
 
 gpu.module @m {
   // CHECK-LABEL: llvm.func @type_cast
-  //       CHECK:   %[[OFFSET:.*]] = llvm.mlir.constant(0 : index) : i32
+  //       CHECK:   %[[OFFSET:.*]] = llvm.mlir.constant(0 : i32) : i32
   //       CHECK:   llvm.insertvalue %[[OFFSET]], %{{.*}}[2] : !llvm.struct<(ptr, ptr, i32)>
   gpu.func @type_cast(%arg0: memref<8x8x8xf32>) -> memref<vector<8x8x8xf32>> {
     %0 = vector.type_cast %arg0 : memref<8x8x8xf32> to memref<vector<8x8x8xf32>>
diff --git a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-interface.mlir b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-interface.mlir
index b8c41f4140399..4b89bc60a3d76 100644
--- a/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-interface.mlir
+++ b/mlir/test/Conversion/VectorToLLVM/vector-to-llvm-interface.mlir
@@ -228,25 +228,25 @@ func.func @shuffle_1D(%arg0: vector<2xf32>, %arg1: vector<3xf32>) -> vector<5xf3
 // CHECK-SAME: %[[A:.*]]: vector<2xf32>,
 // CHECK-SAME: %[[B:.*]]: vector<3xf32>)
 //       CHECK:   %[[U0:.*]] = llvm.mlir.poison : vector<5xf32>
-//       CHECK:   %[[C2:.*]] = llvm.mlir.constant(2 : index) : i64
+//       CHECK:   %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
 //       CHECK:   %[[E1:.*]] = llvm.extractelement %[[B]][%[[C2]] : i64] : vector<3xf32>
-//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 //       CHECK:   %[[I1:.*]] = llvm.insertelement %[[E1]], %[[U0]][%[[C0]] : i64] : vector<5xf32>
-//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 //       CHECK:   %[[E2:.*]] = llvm.extractelement %[[B]][%[[C1]] : i64] : vector<3xf32>
-//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 //       CHECK:   %[[I2:.*]] = llvm.insertelement %[[E2]], %[[I1]][%[[C1]] : i64] : vector<5xf32>
-//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 //       CHECK:   %[[E3:.*]] = llvm.extractelement %[[B]][%[[C0]] : i64] : vector<3xf32>
-//       CHECK:   %[[C2:.*]] = llvm.mlir.constant(2 : index) : i64
+//       CHECK:   %[[C2:.*]] = llvm.mlir.constant(2 : i64) : i64
 //       CHECK:   %[[I3:.*]] = llvm.insertelement %[[E3]], %[[I2]][%[[C2]] : i64] : vector<5xf32>
-//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : index) : i64
+//       CHECK:   %[[C1:.*]] = llvm.mlir.constant(1 : i64) : i64
 //       CHECK:   %[[E4:.*]] = llvm.extractelement %[[A]][%[[C1]] : i64] : vector<2xf32>
-//       CHECK:   %[[C3:.*]] = llvm.mlir.constant(3 : index) : i64
+//       CHECK:   %[[C3:.*]] = llvm.mlir.constant(3 : i64) : i64
 //       CHECK:   %[[I4:.*]] = llvm.insertelement %[[E4]], %[[I3]][%[[C3]] : i64] : vector<5xf32>
-//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : index) : i64
+//       CHECK:   %[[C0:.*]] = llvm.mlir.constant(0 : i64) : i64
 //       CHECK:   %[[E5:.*]] = llvm.extractelement %[[A]][%[[C0]] : i64] : vector<2xf32>
-//       CHECK:   %[[C4:.*]] = llvm.mlir.constant(4 : index) : i64
+//       CHECK:   %[[C4:.*]] = llvm.mlir.constant(4 : i64) : i64
 //       CHECK:   %[[I5:.*]] = llvm.insertelement %[[E5]], %[[I4]][%[[C4]] : i64] : vector<5xf32>
 //       CHECK:   return %[[I5]] : vector<5xf32>
 
@@ -765,7 +765,7 @@ func.func @type_cast_f32(%arg0: memref<8x8x8xf32>) -> memref<vector<8x8x8xf32>>
 //       CHECK:   llvm.insertvalue %[[allocated]], {{.*}}[0] : !llvm.struct<(ptr, ptr, i64)>
 //       CHECK:   %[[aligned:.*]] = llvm.extractvalue {{.*}}[1] : !llvm.struct<(ptr, ptr, i64, array<3 x i64>, array<3 x i64>)>
 //       CHECK:   llvm.insertvalue %[[aligned]], {{.*}}[1] : !llvm.struct<(ptr, ptr, i64)>
-//       CHECK:   llvm.mlir.constant(0 : index
+//       CHECK:   llvm.mlir.constant(0 : i64
 //       CHECK:   llvm.insertvalue {{.*}}[2] : !llvm.struct<(ptr, ptr, i64)>
 
 // NOTE: No test for scalable vectors - the input memref is fixed size.
@@ -796,7 +796,7 @@ func.func @type_cast_non_zero_addrspace(%arg0: memref<8x8x8xf32, 3>) -> memref<v
 //       CHECK:   llvm.insertvalue %[[allocated]], {{.*}}[0] : !llvm.struct<(ptr<3>, ptr<3>, i64)>
 //       CHECK:   %[[aligned:.*]] = llvm.extractvalue {{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<3 x i64>, array<3 x i64>)>
 //       CHECK:   llvm.insertvalue %[[aligned]], {{.*}}[1] : !llvm.struct<(ptr<3>, ptr<3>, i64)>
-//       CHECK:   llvm.mlir.constant(0 : index
+//       CHECK:   llvm.mlir.constant(0 : i64
 //       CHECK:   llvm.insertvalue {{.*}}[2] : !llvm.struct<(ptr<3>, ptr<3>, i64)>
 
 // NOTE: No test for scalable vectors - the input memref is fixed size.
diff --git a/mlir/test/Dialect/Affine/loop-fusion-4.mlir b/mlir/test/Dialect/Affine/loop-fusion-4.mlir
index 157de102c4259..a3adb3f1d1f20 100644
--- a/mlir/test/Dialect/Affine/loop-fusion-4.mlir
+++ b/mlir/test/Dialect/Affine/loop-fusion-4.mlir
@@ -368,8 +368,8 @@ func.func @same_memref_load_multiple_stores(%producer : memref<32xf32>, %produce
 
 // PRODUCER-CONSUMER-MAXIMAL-LABEL: func @memref_index_type
 func.func @memref_index_type() {
-  %0 = llvm.mlir.constant(2 : index) : i64
-  %2 = llvm.mlir.constant(0 : index) : i64
+  %0 = llvm.mlir.constant(2 : i64) : i64
+  %2 = llvm.mlir.constant(0 : i64) : i64
   %3 = builtin.unrealized_conversion_cast %2 : i64 to index
   %alloc = memref.alloc() alignment = 64 : memref<8x18xf32>
   %alloc_1 = memref.alloc() alignment = 64 : memref<3xf32>
diff --git a/mlir/test/Dialect/GPU/dynamic-shared-memory.mlir b/mlir/test/Dialect/GPU/dynamic-shared-memory.mlir
index 810f7d2c3ebda..4e027187c42ba 100644
--- a/mlir/test/Dialect/GPU/dynamic-shared-memory.mlir
+++ b/mlir/test/Dialect/GPU/dynamic-shared-memory.mlir
@@ -20,11 +20,11 @@ gpu.module @modules {
     %1 = memref.view %shmem[%c16384][] : memref<?xi8, #gpu.address_space<workgroup>> to memref<32x64xf32, #gpu.address_space<workgroup>>
     "test.use.shared.memory"(%1) : (memref<32x64xf32, #gpu.address_space<workgroup>>) -> ()
 
-// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : index) : i64
-// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : index) : i64
+// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : i64) : i64
+// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : i64) : i64
 // CHECK-DAG: %[[S2:.+]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : index) : i64
-// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : index) : i64
+// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK-DAG: %[[S5:.+]] = llvm.mlir.addressof @__dynamic_shmem__3 : !llvm.ptr<3>
 //     CHECK: %[[S6:.+]] = llvm.insertvalue %[[S5]], %[[S2]][0] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
 //     CHECK: %[[S7:.+]] = llvm.getelementptr %[[S5]][8192] : (!llvm.ptr<3>) -> !llvm.ptr<3>, i8
@@ -54,11 +54,11 @@ gpu.module @modules {
     %shmem = gpu.dynamic_shared_memory : memref<?xi8, #gpu.address_space<workgroup>>
     %0 = memref.view %shmem[%c8192][] : memref<?xi8, #gpu.address_space<workgroup>> to memref<32x64xf32, #gpu.address_space<workgroup>>
     "test.use.shared.memory"(%0) : (memref<32x64xf32, #gpu.address_space<workgroup>>) -> ()
-// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : index) : i64
-// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : index) : i64
+// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : i64) : i64
+// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : i64) : i64
 // CHECK-DAG: %[[S2:.+]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : index) : i64
-// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : index) : i64
+// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK-DAG: %[[S5:.+]] = llvm.mlir.addressof @__dynamic_shmem__3 : !llvm.ptr<3>
 //     CHECK: %[[S6:.+]] = llvm.insertvalue %[[S5]], %[[S2]][0] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
 //     CHECK: %[[S7:.+]] = llvm.getelementptr %[[S5]][8192] : (!llvm.ptr<3>) -> !llvm.ptr<3>, i8
@@ -80,11 +80,11 @@ gpu.module @modules {
     %shmem = gpu.dynamic_shared_memory : memref<?xi8, #gpu.address_space<workgroup>>
     %0 = memref.view %shmem[%c8192][] : memref<?xi8, #gpu.address_space<workgroup>> to memref<32x64xf32, #gpu.address_space<workgroup>>
     "test.use.shared.memory"(%0) : (memref<32x64xf32, #gpu.address_space<workgroup>>) -> ()
-// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : index) : i64
-// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : index) : i64
+// CHECK-DAG: %[[S0:.+]] = llvm.mlir.constant(32 : i64) : i64
+// CHECK-DAG: %[[S1:.+]] = llvm.mlir.constant(64 : i64) : i64
 // CHECK-DAG: %[[S2:.+]] = llvm.mlir.poison : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
-// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : index) : i64
-// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : index) : i64
+// CHECK-DAG: %[[S3:.+]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK-DAG: %[[S4:.+]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK-DAG: %[[S5:.+]] = llvm.mlir.addressof @__dynamic_shmem__3 : !llvm.ptr<3>
 //     CHECK: %[[S6:.+]] = llvm.insertvalue %[[S5]], %[[S2]][0] : !llvm.struct<(ptr<3>, ptr<3>, i64, array<2 x i64>, array<2 x i64>)>
 //     CHECK: %[[S7:.+]] = llvm.getelementptr %[[S5]][8192] : (!llvm.ptr<3>) -> !llvm.ptr<3>, i8
diff --git a/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir b/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir
index 835ae01ffa8c1..005f6645da137 100644
--- a/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir
+++ b/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-target-tag.mlir
@@ -27,7 +27,7 @@ func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : in
   // CHECK-SAME: %[[ARG2:[^:]*]]: i64)
   // CHECK-SAME: -> !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>
 
-  // CHECK-DAG: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK-DAG: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK-DAG: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[STRIDE0]] overflow<nsw> : i64
   // CHECK-DAG: %[[OFF2:.*]] = llvm.add %[[DESCSTRIDE0]], %[[ARG1]] : i64
   // CHECK-DAG: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
diff --git a/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir b/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir
index 864ebb2155740..ec05908779674 100644
--- a/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir
+++ b/mlir/test/Dialect/LLVM/lower-to-llvm-e2e-with-top-level-named-sequence.mlir
@@ -26,7 +26,7 @@ func.func @subview(%0 : memref<64x4xf32, strided<[4, 1], offset: 0>>, %arg0 : in
   // CHECK-SAME: %[[ARG2:[^:]*]]: i64)
   // CHECK-SAME: -> !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>
 
-  // CHECK-DAG: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : index) : i64
+  // CHECK-DAG: %[[STRIDE0:.*]] = llvm.mlir.constant(4 : i64) : i64
   // CHECK-DAG: %[[DESCSTRIDE0:.*]] = llvm.mul %[[ARG0]], %[[STRIDE0]] overflow<nsw> : i64
   // CHECK-DAG: %[[OFF2:.*]] = llvm.add %[[DESCSTRIDE0]], %[[ARG1]] : i64
   // CHECK-DAG: %[[DESC:.*]] = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<2 x i64>, array<2 x i64>)>
diff --git a/mlir/test/Dialect/LLVMIR/constant-folding.mlir b/mlir/test/Dialect/LLVMIR/constant-folding.mlir
index 0616f19b8fddb..777213e067c26 100644
--- a/mlir/test/Dialect/LLVMIR/constant-folding.mlir
+++ b/mlir/test/Dialect/LLVMIR/constant-folding.mlir
@@ -177,7 +177,7 @@ llvm.func @malloc(i64) -> !llvm.ptr
 // CHECK-LABEL: func.func @insert_op
 func.func @insert_op(%arg0: index, %arg1: memref<13x13xi64>, %arg2: index) {
   %cst_7 = arith.constant dense<1526248407> : vector<1xi64>
-  %1 = llvm.mlir.constant(1 : index) : i64
+  %1 = llvm.mlir.constant(1 : i64) : i64
   %101 = vector.insert %1, %cst_7 [0] : i64 into vector<1xi64>
   vector.print %101 : vector<1xi64>
   return
diff --git a/mlir/test/Dialect/LLVMIR/optimize-for-nvvm.mlir b/mlir/test/Dialect/LLVMIR/optimize-for-nvvm.mlir
index b98d2e08b7548..2ef1982c40214 100644
--- a/mlir/test/Dialect/LLVMIR/optimize-for-nvvm.mlir
+++ b/mlir/test/Dialect/LLVMIR/optimize-for-nvvm.mlir
@@ -2,8 +2,8 @@
 
 // CHECK-LABEL: llvm.func @fdiv_fp16
 llvm.func @fdiv_fp16(%arg0 : f16, %arg1 : f16) -> f16 {
-  // CHECK-DAG: %[[c0:.*]]      = llvm.mlir.constant(0 : ui32) : i32
-  // CHECK-DAG: %[[mask:.*]]    = llvm.mlir.constant(2139095040 : ui32) : i32
+  // CHECK-DAG: %[[c0:.*]]      = llvm.mlir.constant(0 : i32) : i32
+  // CHECK-DAG: %[[mask:.*]]    = llvm.mlir.constant(2139095040 : i32) : i32
   // CHECK-DAG: %[[lhs:.*]]     = llvm.fpext %arg0 : f16 to f32
   // CHECK-DAG: %[[rhs:.*]]     = llvm.fpext %arg1 : f16 to f32
   // CHECK-DAG: %[[rcp:.*]]     = nvvm.rcp.approx.ftz.f %[[rhs]] : f32
diff --git a/mlir/test/Dialect/Linalg/fusion-multiuse-producer.mlir b/mlir/test/Dialect/Linalg/fusion-multiuse-producer.mlir
index ca788839a4927..e686d406ceabd 100644
--- a/mlir/test/Dialect/Linalg/fusion-multiuse-producer.mlir
+++ b/mlir/test/Dialect/Linalg/fusion-multiuse-producer.mlir
@@ -35,7 +35,7 @@ func.func @multi_use_producer(%arg0 : tensor<?x?xf32>, %arg1 : tensor<?x?xf32>,
 
 func.func @multi_use_producer_2(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x8xf32> attributes {llvm.emit_c_interface} {
   %0 = llvm.mlir.constant(0.000000e+00 : f32) : f32
-  %1 = llvm.mlir.constant(31 : index) : i64
+  %1 = llvm.mlir.constant(31 : i64) : i64
   %2 = tensor.empty() : tensor<1x32x32x8xf32>
   %3 = tensor.empty() : tensor<1x32x32x8xindex>
   %4:2 = linalg.generic {
@@ -92,7 +92,7 @@ func.func @multi_use_producer_2(%arg0: tensor<1x32x32x8xf32>) -> tensor<1x32x32x
 // CHECK-LABEL: func @multi_use_producer_2(
 // CHECK-SAME: %[[ARG0:[a-zA-Z0-9]+]]: tensor<1x32x32x8xf32>)
 // CHECK-SAME: -> tensor<1x32x32x8xf32>
-// CHECK: %[[C31:.+]] = llvm.mlir.constant(31 : index) : i64
+// CHECK: %[[C31:.+]] = llvm.mlir.constant(31 : i64) : i64
 // CHECK: %[[R0:.+]]:2 = linalg.generic {
 // CHECK-SAME: ins(%[[ARG0]], %[[ARG0]], %[[ARG0]], %[[ARG0]], %[[ARG0]] : tensor<1x32x32x8xf32>, tensor<1x32x32x8xf32>, tensor<1x32x32x8xf32>, tensor<1x32x32x8xf32>, tensor<1x32x32x8xf32>)
 // CHECK-SAME: outs(%[[INIT:.+]], %[[INIT_1:.+]] : tensor<1x32x32x8xf32>, tensor<1x32x32x8xi64>)
diff --git a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
index 8ef6df39094cd..bf0a7185132b1 100644
--- a/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
+++ b/mlir/test/Dialect/OpenMP/host-op-filtering.mlir
@@ -170,9 +170,9 @@ module attributes {omp.is_target_device = true} {
     // CHECK-NEXT: %[[VAR_PTR_PTR:.*]] = llvm.getelementptr %[[ARG]][0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
     %0 = llvm.mlir.constant(1 : i32) : i32
     %1 = llvm.alloca %0 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-    %2 = llvm.mlir.constant(0 : index) : i64
-    %3 = llvm.mlir.constant(1 : index) : i64
-    %4 = llvm.mlir.constant(9 : index) : i64
+    %2 = llvm.mlir.constant(0 : i64) : i64
+    %3 = llvm.mlir.constant(1 : i64) : i64
+    %4 = llvm.mlir.constant(9 : i64) : i64
     %5 = llvm.mlir.constant(48 : i32) : i32
     "llvm.intr.memcpy"(%1, %arg0, %5) <{arg_attrs = [{llvm.align = 8 : i64}, {llvm.align = 8 : i64}, {}], isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i32) -> ()
     %6 = llvm.getelementptr %1[0, 7, %2, 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
diff --git a/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir b/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir
index da35c47efab01..e474295eea2d7 100644
--- a/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir
+++ b/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare-by-value.mlir
@@ -42,8 +42,8 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
     %1 = llvm.alloca %0 x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
     %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = llvm.alloca %2 x !llvm.struct<(ptr, i64)> : (i64) -> !llvm.ptr
-    %4 = llvm.mlir.constant(1 : index) : i64
-    %5 = llvm.mlir.constant(0 : index) : i64
+    %4 = llvm.mlir.constant(1 : i64) : i64
+    %5 = llvm.mlir.constant(0 : i64) : i64
     %6 = llvm.mlir.constant(0 : i32) : i32
     %7 = llvm.mlir.constant(1 : i64) : i64
     %8 = llvm.mlir.constant(1 : i64) : i64
@@ -81,8 +81,8 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
 // CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(16 : i64) : i64
 // CHECK: %[[HEAP0:.*]] = llvm.call @malloc(%[[VAL_3]]) : (i64) -> !llvm.ptr
 // CHECK: %[[VAL_5:.*]] = llvm.alloca %[[VAL_2]] x !llvm.struct<(ptr, i64)> : (i64) -> !llvm.ptr
-// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(1 : index) : i64
-// CHECK: %[[VAL_7:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[VAL_6:.*]] = llvm.mlir.constant(1 : i64) : i64
+// CHECK: %[[VAL_7:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: %[[VAL_8:.*]] = llvm.mlir.constant(0 : i32) : i32
 // CHECK: %[[VAL_9:.*]] = llvm.mlir.constant(1 : i64) : i64
 // CHECK: %[[VAL_10:.*]] = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir b/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir
index 740f2b3b22ea0..ba6e80478b859 100644
--- a/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir
+++ b/mlir/test/Dialect/OpenMP/omp-offload-privatization-prepare.mlir
@@ -41,7 +41,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
 
   llvm.func internal @firstprivate_test(%arg0: !llvm.ptr {fir.bindc_name = "ptr0"}, %arg1: !llvm.ptr {fir.bindc_name = "ptr1"}) {
     %0 = llvm.mlir.constant(1 : i32) : i32
-    %1 = llvm.mlir.constant(0 : index) : i64
+    %1 = llvm.mlir.constant(0 : i64) : i64
     %5 = llvm.alloca %0 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
     %19 = llvm.alloca %0 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {bindc_name = "local"} : (i32) -> !llvm.ptr
     %20 = llvm.alloca %0 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {bindc_name = "glocal"} : (i32) -> !llvm.ptr
@@ -95,7 +95,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<!llvm.ptr<270> = dense<32> : vec
 // CHECK-SAME:      %[[ARG0:.*]]: !llvm.ptr {fir.bindc_name = "ptr0"},
 // CHECK-SAME:      %[[ARG1:.*]]: !llvm.ptr {fir.bindc_name = "ptr1"}) {
 // CHECK: %[[VAL_0:.*]] = llvm.mlir.constant(1 : i32) : i32
-// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(0 : index) : i64
+// CHECK: %[[VAL_1:.*]] = llvm.mlir.constant(0 : i64) : i64
 // CHECK: %[[VAL_2:.*]] = llvm.alloca %[[VAL_0]] x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
 // CHECK: %[[VAL_3:.*]] = llvm.mlir.constant(48 : i64) : i64
 // CHECK: %[[HEAP0:.*]] = llvm.call @malloc(%[[VAL_3]]) : (i64) -> !llvm.ptr
diff --git a/mlir/test/Dialect/OpenMP/ops.mlir b/mlir/test/Dialect/OpenMP/ops.mlir
index 8c3bf45793291..a0aff2cdfda0e 100644
--- a/mlir/test/Dialect/OpenMP/ops.mlir
+++ b/mlir/test/Dialect/OpenMP/ops.mlir
@@ -3292,29 +3292,29 @@ combiner {
 // CHECK-LABEL: omp_targets_with_map_bounds
 // CHECK-SAME: (%[[ARG0:.*]]: !llvm.ptr, %[[ARG1:.*]]: !llvm.ptr)
 func.func @omp_targets_with_map_bounds(%arg0: !llvm.ptr, %arg1: !llvm.ptr) -> () {
-  // CHECK: %[[C_00:.*]] = llvm.mlir.constant(4 : index) : i64
-  // CHECK: %[[C_01:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[C_02:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[C_03:.*]] = llvm.mlir.constant(1 : index) : i64
+  // CHECK: %[[C_00:.*]] = llvm.mlir.constant(4 : i64) : i64
+  // CHECK: %[[C_01:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[C_02:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[C_03:.*]] = llvm.mlir.constant(1 : i64) : i64
   // CHECK: %[[BOUNDS0:.*]] = omp.map.bounds   lower_bound(%[[C_01]] : i64) upper_bound(%[[C_00]] : i64) stride(%[[C_02]] : i64) start_idx(%[[C_03]] : i64)
   // CHECK: %[[MAP0:.*]] = omp.map.info var_ptr(%[[ARG0]] : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS0]]) name("") -> !llvm.ptr
-    %0 = llvm.mlir.constant(4 : index) : i64
-    %1 = llvm.mlir.constant(1 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
-    %3 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(4 : i64) : i64
+    %1 = llvm.mlir.constant(1 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
+    %3 = llvm.mlir.constant(1 : i64) : i64
     %4 = omp.map.bounds   lower_bound(%1 : i64) upper_bound(%0 : i64) stride(%2 : i64) start_idx(%3 : i64)
 
     %mapv1 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.array<10 x i32>)   map_clauses(tofrom) capture(ByRef) bounds(%4) name("") -> !llvm.ptr
-  // CHECK: %[[C_10:.*]] = llvm.mlir.constant(9 : index) : i64
-  // CHECK: %[[C_11:.*]] = llvm.mlir.constant(1 : index) : i64
-  // CHECK: %[[C_12:.*]] = llvm.mlir.constant(2 : index) : i64
-  // CHECK: %[[C_13:.*]] = llvm.mlir.constant(2 : index) : i64
+  // CHECK: %[[C_10:.*]] = llvm.mlir.constant(9 : i64) : i64
+  // CHECK: %[[C_11:.*]] = llvm.mlir.constant(1 : i64) : i64
+  // CHECK: %[[C_12:.*]] = llvm.mlir.constant(2 : i64) : i64
+  // CHECK: %[[C_13:.*]] = llvm.mlir.constant(2 : i64) : i64
   // CHECK: %[[BOUNDS1:.*]] = omp.map.bounds   lower_bound(%[[C_11]] : i64) upper_bound(%[[C_10]] : i64) stride(%[[C_12]] : i64) start_idx(%[[C_13]] : i64)
   // CHECK: %[[MAP1:.*]] = omp.map.info var_ptr(%[[ARG1]] : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(storage) capture(ByCopy) mapper(@my_mapper) bounds(%[[BOUNDS1]]) name("") -> !llvm.ptr
-    %6 = llvm.mlir.constant(9 : index) : i64
-    %7 = llvm.mlir.constant(1 : index) : i64
-    %8 = llvm.mlir.constant(2 : index) : i64
-    %9 = llvm.mlir.constant(2 : index) : i64
+    %6 = llvm.mlir.constant(9 : i64) : i64
+    %7 = llvm.mlir.constant(1 : i64) : i64
+    %8 = llvm.mlir.constant(2 : i64) : i64
+    %9 = llvm.mlir.constant(2 : i64) : i64
     %10 = omp.map.bounds   lower_bound(%7 : i64) upper_bound(%6 : i64) stride(%8 : i64) start_idx(%9 : i64)
     %mapv2 = omp.map.info var_ptr(%arg1 : !llvm.ptr, !llvm.array<10 x i32>) map_clauses(storage) capture(ByCopy) mapper(@my_mapper) bounds(%10) name("") -> !llvm.ptr
 
diff --git a/mlir/test/Dialect/Vector/canonicalize.mlir b/mlir/test/Dialect/Vector/canonicalize.mlir
index 25edb72cc5eb2..7ad6eda6ec1ba 100644
--- a/mlir/test/Dialect/Vector/canonicalize.mlir
+++ b/mlir/test/Dialect/Vector/canonicalize.mlir
@@ -3853,9 +3853,9 @@ func.func @from_elements_i1_to_i8_conversion() -> vector<1xi8> {
 // CHECK-NEXT:    %[[CST:.*]] = arith.constant dense<[0, 1, 42]> : vector<3xi64>
 // CHECK-NEXT:    return %[[CST]] : vector<3xi64>
 func.func @from_elements_index_to_i64_conversion() -> vector<3xi64> {
-  %cst0 = llvm.mlir.constant(0 : index) : i64
-  %cst1 = llvm.mlir.constant(1 : index) : i64
-  %cst42 = llvm.mlir.constant(42 : index) : i64
+  %cst0 = llvm.mlir.constant(0 : i64) : i64
+  %cst1 = llvm.mlir.constant(1 : i64) : i64
+  %cst42 = llvm.mlir.constant(42 : i64) : i64
   %v = vector.from_elements %cst0, %cst1, %cst42 : vector<3xi64>
   return %v : vector<3xi64>
 }
diff --git a/mlir/test/Dialect/X86/AMX/legalize-for-llvm.mlir b/mlir/test/Dialect/X86/AMX/legalize-for-llvm.mlir
index a88a3b6b994c1..e3cf60601f42b 100644
--- a/mlir/test/Dialect/X86/AMX/legalize-for-llvm.mlir
+++ b/mlir/test/Dialect/X86/AMX/legalize-for-llvm.mlir
@@ -126,6 +126,9 @@ func.func @mulf8E5M2(%arg0: memref<?x?xf8E5M2>, %arg1: memref<?x?xf32>) {
 
 /// Intrinsics require stride in number of bytes.
 // CHECK-LABEL: strides_implicit(
+// Anchor past the GEP, whose stride constant is indistinguishable from the
+// tile load's.
+// CHECK: llvm.getelementptr
 // CHECK: %[[LOAD_STRIDE_1:.+]] = llvm.mlir.constant(32 : i64) : i64
 // CHECK: llvm.call_intrinsic "llvm.x86.tileloadd64.internal"(%{{.+}}, %{{.+}}, %{{.+}}, %[[LOAD_STRIDE_1]]
 // CHECK: %[[LOAD_STRIDE_2:.+]] = llvm.mlir.constant(128 : i64) : i64
@@ -135,6 +138,7 @@ func.func @mulf8E5M2(%arg0: memref<?x?xf8E5M2>, %arg1: memref<?x?xf32>) {
 // CHECK: %[[LOAD_STRIDE_SCALE:.+]] = llvm.mlir.constant(4 : i64) : i64
 // CHECK: %[[LOAD_STRIDE_3:.+]] = llvm.mul %[[LOAD_STRIDE_SCALE]], %[[LOAD_BUF_STRIDE]]
 // CHECK: llvm.call_intrinsic "llvm.x86.tileloadd64.internal"(%{{.+}}, %{{.+}}, %{{.+}}, %[[LOAD_STRIDE_3]]
+// CHECK: llvm.getelementptr
 // CHECK: %[[STORE_STRIDE_1:.+]] = llvm.mlir.constant(32 : i64) : i64
 // CHECK: llvm.call_intrinsic "llvm.x86.tilestored64.internal"(%{{.+}}, %{{.+}}, %{{.+}}, %[[STORE_STRIDE_1]]
 // CHECK: %[[STORE_STRIDE_2:.+]] = llvm.mlir.constant(128 : i64) : i64
diff --git a/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir b/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
index 053058fa774d8..f9ef835538a9b 100644
--- a/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
+++ b/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-fp.mlir
@@ -13,7 +13,7 @@ module {
     %2 = llvm.mlir.constant(3.000000e+00 : f32) : f32
     %3 = llvm.mlir.constant(4.000000e+00 : f32) : f32
     %4 = llvm.mlir.undef : vector<4xf32>
-    %5 = llvm.mlir.constant(0 : index) : i64
+    %5 = llvm.mlir.constant(0 : i64) : i64
     %6 = llvm.insertelement %0, %4[%5 : i64] : vector<4xf32>
     %7 = llvm.shufflevector %6, %4 [0, 0, 0, 0] : vector<4xf32>
     %8 = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir b/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
index 3e5220253ca87..a80330189ee50 100644
--- a/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
+++ b/mlir/test/Integration/Dialect/LLVMIR/CPU/test-vector-reductions-int.mlir
@@ -13,7 +13,7 @@ module {
     %2 = llvm.mlir.constant(3 : i64) : i64
     %3 = llvm.mlir.constant(4 : i64) : i64
     %4 = llvm.mlir.undef : vector<4xi64>
-    %5 = llvm.mlir.constant(0 : index) : i64
+    %5 = llvm.mlir.constant(0 : i64) : i64
     %6 = llvm.insertelement %0, %4[%5 : i64] : vector<4xi64>
     %7 = llvm.shufflevector %6, %4 [0, 0, 0, 0] : vector<4xi64>
     %8 = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Integration/Dialect/MemRef/assume-alignment-runtime-verification.mlir b/mlir/test/Integration/Dialect/MemRef/assume-alignment-runtime-verification.mlir
index ae46de18e8572..0e6af291c2dae 100644
--- a/mlir/test/Integration/Dialect/MemRef/assume-alignment-runtime-verification.mlir
+++ b/mlir/test/Integration/Dialect/MemRef/assume-alignment-runtime-verification.mlir
@@ -25,9 +25,9 @@ func.func @main() {
   // Construct a memref descriptor with a pointer that is not aligned to 4.
   // This cannot be done with just the memref dialect. We have to resort to
   // the LLVM dialect.
-  %c0 = llvm.mlir.constant(0 : index) : i64
-  %c1 = llvm.mlir.constant(1 : index) : i64
-  %c3 = llvm.mlir.constant(3 : index) : i64
+  %c0 = llvm.mlir.constant(0 : i64) : i64
+  %c1 = llvm.mlir.constant(1 : i64) : i64
+  %c3 = llvm.mlir.constant(3 : i64) : i64
   %unaligned_ptr = llvm.inttoptr %c3 : i64 to !llvm.ptr
   %4 = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %5 = llvm.insertvalue %unaligned_ptr, %4[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
diff --git a/mlir/test/Integration/Dialect/MemRef/atomic-rmw-runtime-verification.mlir b/mlir/test/Integration/Dialect/MemRef/atomic-rmw-runtime-verification.mlir
index 6a7984ca88a1e..859ceadb247e2 100644
--- a/mlir/test/Integration/Dialect/MemRef/atomic-rmw-runtime-verification.mlir
+++ b/mlir/test/Integration/Dialect/MemRef/atomic-rmw-runtime-verification.mlir
@@ -28,9 +28,9 @@ func.func @main() {
   %ptr = memref.extract_aligned_pointer_as_index %alloc : memref<10xf32> -> index
   %ptr_i64 = arith.index_cast %ptr : index to i64
   %ptr_llvm = llvm.inttoptr %ptr_i64 : i64 to !llvm.ptr
-  %c0 = llvm.mlir.constant(0 : index) : i64
-  %c1 = llvm.mlir.constant(1 : index) : i64
-  %c5 = llvm.mlir.constant(5 : index) : i64
+  %c0 = llvm.mlir.constant(0 : i64) : i64
+  %c1 = llvm.mlir.constant(1 : i64) : i64
+  %c5 = llvm.mlir.constant(5 : i64) : i64
   %4 = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %5 = llvm.insertvalue %ptr_llvm, %4[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %6 = llvm.insertvalue %ptr_llvm, %5[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
diff --git a/mlir/test/Integration/Dialect/MemRef/store-runtime-verification.mlir b/mlir/test/Integration/Dialect/MemRef/store-runtime-verification.mlir
index 760f2a78537a7..53d860df5b0f6 100644
--- a/mlir/test/Integration/Dialect/MemRef/store-runtime-verification.mlir
+++ b/mlir/test/Integration/Dialect/MemRef/store-runtime-verification.mlir
@@ -28,9 +28,9 @@ func.func @main() {
   %ptr = memref.extract_aligned_pointer_as_index %alloc : memref<10xf32> -> index
   %ptr_i64 = arith.index_cast %ptr : index to i64
   %ptr_llvm = llvm.inttoptr %ptr_i64 : i64 to !llvm.ptr
-  %c0 = llvm.mlir.constant(0 : index) : i64
-  %c1 = llvm.mlir.constant(1 : index) : i64
-  %c5 = llvm.mlir.constant(5 : index) : i64
+  %c0 = llvm.mlir.constant(0 : i64) : i64
+  %c1 = llvm.mlir.constant(1 : i64) : i64
+  %c5 = llvm.mlir.constant(5 : i64) : i64
   %4 = llvm.mlir.poison : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %5 = llvm.insertvalue %ptr_llvm, %4[0] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
   %6 = llvm.insertvalue %ptr_llvm, %5[1] : !llvm.struct<(ptr, ptr, i64, array<1 x i64>, array<1 x i64>)>
diff --git a/mlir/test/Integration/Dialect/Vector/CPU/X86/inline-asm-vector-avx512.mlir b/mlir/test/Integration/Dialect/Vector/CPU/X86/inline-asm-vector-avx512.mlir
index 8376464cee42d..21344b706380a 100644
--- a/mlir/test/Integration/Dialect/Vector/CPU/X86/inline-asm-vector-avx512.mlir
+++ b/mlir/test/Integration/Dialect/Vector/CPU/X86/inline-asm-vector-avx512.mlir
@@ -11,7 +11,7 @@ module {
       : !llvm.array<16 x i32>
 
   llvm.func @entry() -> i32 {
-    %c0 = llvm.mlir.constant(0 : index) : i64
+    %c0 = llvm.mlir.constant(0 : i64) : i64
 
     %1 = llvm.mlir.addressof @const16 : !llvm.ptr
     %ptr = llvm.getelementptr %1[%c0, %c0]
diff --git a/mlir/test/Target/LLVMIR/arm-sme.mlir b/mlir/test/Target/LLVMIR/arm-sme.mlir
index 0a13a75618a23..84dfcc96edd0f 100644
--- a/mlir/test/Target/LLVMIR/arm-sme.mlir
+++ b/mlir/test/Target/LLVMIR/arm-sme.mlir
@@ -146,7 +146,7 @@ llvm.func @arm_sme_load(%nxv1i1  : vector<[1]xi1>,
                         %nxv8i1  : vector<[8]xi1>,
                         %nxv16i1 : vector<[16]xi1>,
                         %ptr    : !llvm.ptr) {
-  %c0 = llvm.mlir.constant(0 : index) : i32
+  %c0 = llvm.mlir.constant(0 : i32) : i32
   // CHECK: call void @llvm.aarch64.sme.ld1q.horiz
   "arm_sme.intr.ld1q.horiz"(%nxv1i1, %ptr, %c0) <{tile_id = 0 : i32}> :
               (vector<[1]xi1>, !llvm.ptr, i32) -> ()
@@ -189,7 +189,7 @@ llvm.func @arm_sme_store(%nxv1i1  : vector<[1]xi1>,
                          %nxv8i1  : vector<[8]xi1>,
                          %nxv16i1 : vector<[16]xi1>,
                          %ptr    : !llvm.ptr) {
-  %c0 = llvm.mlir.constant(0 : index) : i32
+  %c0 = llvm.mlir.constant(0 : i32) : i32
   // CHECK: call void @llvm.aarch64.sme.st1q.horiz
   "arm_sme.intr.st1q.horiz"(%nxv1i1, %ptr, %c0) <{tile_id = 0 : i32}> :
               (vector<[1]xi1>, !llvm.ptr, i32) -> ()
diff --git a/mlir/test/Target/LLVMIR/arm-sve.mlir b/mlir/test/Target/LLVMIR/arm-sve.mlir
index 67f383ea1a8a0..b365e555c0b78 100644
--- a/mlir/test/Target/LLVMIR/arm-sve.mlir
+++ b/mlir/test/Target/LLVMIR/arm-sve.mlir
@@ -255,8 +255,8 @@ llvm.func @memcopy(%arg0: !llvm.ptr, %arg1: !llvm.ptr,
   %11 = llvm.insertvalue %arg9, %10[4, 0] : !llvm.struct<(ptr, ptr, i64,
                                                          array<1 x i64>,
                                                          array<1 x i64>)>
-  %12 = llvm.mlir.constant(0 : index) : i64
-  %13 = llvm.mlir.constant(4 : index) : i64
+  %12 = llvm.mlir.constant(0 : i64) : i64
+  %13 = llvm.mlir.constant(4 : i64) : i64
   // CHECK: [[VL:%[0-9]+]] = call i64 @llvm.vscale.i64()
   %14 = "llvm.intr.vscale"() : () -> i64
   // CHECK: mul i64 [[VL]], 4
diff --git a/mlir/test/Target/LLVMIR/gpu.mlir b/mlir/test/Target/LLVMIR/gpu.mlir
index da816bf24f63a..140fabca444da 100644
--- a/mlir/test/Target/LLVMIR/gpu.mlir
+++ b/mlir/test/Target/LLVMIR/gpu.mlir
@@ -26,7 +26,7 @@ module attributes {gpu.container_module} {
     // CHECK: call void @mgpuLaunchKernel(ptr [[FUNC]], i64 8, i64 8, i64 8, i64 8, i64 8, i64 8, i32 256, ptr [[STREAM]], ptr [[ARGS_ARRAY]], ptr null, i64 2)
     // CHECK: call void @mgpuStreamSynchronize(ptr [[STREAM]])
     // CHECK: call void @mgpuStreamDestroy(ptr [[STREAM]])
-    %0 = llvm.mlir.constant(8 : index) : i64
+    %0 = llvm.mlir.constant(8 : i64) : i64
     %1 = llvm.mlir.constant(32 : i32) : i32
     %2 = llvm.mlir.constant(256 : i32) : i32
     gpu.launch_func @kernel_module::@kernel blocks in (%0, %0, %0) threads in (%0, %0, %0) : i64 dynamic_shared_memory_size %2 args(%1 : i32, %1 : i32)
@@ -70,7 +70,7 @@ module {
 module attributes {gpu.container_module} {
   gpu.binary @kernel_module  [#gpu.object<#rocdl.target, "BLOB">]
   llvm.func @foo(%stream : !llvm.ptr) {
-    %0 = llvm.mlir.constant(8 : index) : i64
+    %0 = llvm.mlir.constant(8 : i64) : i64
     // CHECK-NOT: @mgpuStreamCreate
     // CHECK: call void @mgpuLaunchKernel
     gpu.launch_func <%stream : !llvm.ptr> @kernel_module::@kernel blocks in (%0, %0, %0) threads in (%0, %0, %0) : i64
@@ -90,9 +90,9 @@ module attributes {gpu.container_module} {
   // CHECK-SAME: i64 1, i64 1, i64 1,
   // CHECK-SAME: i64 2, i64 2, i64 2,
   // CHECK-SAME: i64 3, i64 3, i64 3, i32 0, ptr
-    %c1 = llvm.mlir.constant(1 : index) : i64
-    %c2 = llvm.mlir.constant(2 : index) : i64
-    %c3 = llvm.mlir.constant(3 : index) : i64
+    %c1 = llvm.mlir.constant(1 : i64) : i64
+    %c2 = llvm.mlir.constant(2 : i64) : i64
+    %c3 = llvm.mlir.constant(3 : i64) : i64
     gpu.launch_func @kernel_module::@kernel
         clusters in (%c1, %c1, %c1)
         blocks in (%c2, %c2, %c2)
@@ -112,8 +112,8 @@ module attributes {gpu.container_module} {
   // CHECK-SAME: i64 2, i64 2, i64 2,
   // CHECK-SAME: i64 0, i64 0, i64 0,
   // CHECK-SAME: i64 3, i64 3, i64 3,
-    %c2 = llvm.mlir.constant(2 : index) : i64
-    %c3 = llvm.mlir.constant(3 : index) : i64
+    %c2 = llvm.mlir.constant(2 : i64) : i64
+    %c3 = llvm.mlir.constant(3 : i64) : i64
     gpu.launch_func @kernel_module::@kernel
         blocks in (%c2, %c2, %c2)
         threads in (%c3, %c3, %c3) : i64
@@ -133,9 +133,9 @@ module attributes {gpu.container_module} {
   // CHECK-SAME: i64 2, i64 2, i64 2,
   // CHECK-SAME: i64 1, i64 1, i64 1,
   // CHECK-SAME: i64 3, i64 3, i64 3,
-    %c1 = llvm.mlir.constant(1 : index) : i64
-    %c2 = llvm.mlir.constant(2 : index) : i64
-    %c3 = llvm.mlir.constant(3 : index) : i64
+    %c1 = llvm.mlir.constant(1 : i64) : i64
+    %c2 = llvm.mlir.constant(2 : i64) : i64
+    %c3 = llvm.mlir.constant(3 : i64) : i64
     gpu.launch_func @kernel_module::@kernel
         clusters in (%c1, %c1, %c1)
         blocks in (%c2, %c2, %c2)
diff --git a/mlir/test/Target/LLVMIR/llvmir.mlir b/mlir/test/Target/LLVMIR/llvmir.mlir
index f27c0a46780f2..718f19f32131d 100644
--- a/mlir/test/Target/LLVMIR/llvmir.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir.mlir
@@ -266,7 +266,7 @@ llvm.func @global_refs() {
   // Check the contracted form of load from array constants.
   // CHECK: load i8, ptr @string_const
   %2 = llvm.mlir.addressof @string_const : !llvm.ptr
-  %c0 = llvm.mlir.constant(0 : index) : i64
+  %c0 = llvm.mlir.constant(0 : i64) : i64
   %3 = llvm.getelementptr %2[%c0, %c0] : (!llvm.ptr, i64, i64) -> !llvm.ptr, !llvm.array<6 x i8>
   %4 = llvm.load %3 : !llvm.ptr -> i8
 
@@ -286,8 +286,8 @@ llvm.func @simple_loop() {
 // CHECK: [[SIMPLE_bb1]]:
 // CHECK-NEXT: br label %[[SIMPLE_bb2:[0-9]+]]
 ^bb1:   // pred: ^bb0
-  %0 = llvm.mlir.constant(1 : index) : i64
-  %1 = llvm.mlir.constant(42 : index) : i64
+  %0 = llvm.mlir.constant(1 : i64) : i64
+  %1 = llvm.mlir.constant(42 : i64) : i64
   llvm.br ^bb2(%0 : i64)
 
 // CHECK: [[SIMPLE_bb2]]:
@@ -304,7 +304,7 @@ llvm.func @simple_loop() {
 // CHECK-NEXT:   br label %[[SIMPLE_bb2]]
 ^bb3:   // pred: ^bb2
   llvm.call @body(%2) : (i64) -> ()
-  %4 = llvm.mlir.constant(1 : index) : i64
+  %4 = llvm.mlir.constant(1 : i64) : i64
   %5 = llvm.add %2, %4 : i64
   llvm.br ^bb2(%5 : i64)
 
@@ -355,8 +355,8 @@ llvm.func @func_args(%arg0: i32, %arg1: i32) -> i32 {
 // CHECK: [[ARGS_bb1]]:
 // CHECK-NEXT: br label %[[ARGS_bb2:[0-9]+]]
 ^bb1:   // pred: ^bb0
-  %1 = llvm.mlir.constant(0 : index) : i64
-  %2 = llvm.mlir.constant(42 : index) : i64
+  %1 = llvm.mlir.constant(0 : i64) : i64
+  %2 = llvm.mlir.constant(42 : i64) : i64
   llvm.br ^bb2(%1 : i64)
 
 // CHECK: [[ARGS_bb2]]:
@@ -379,7 +379,7 @@ llvm.func @func_args(%arg0: i32, %arg1: i32) -> i32 {
   %6 = llvm.call @other(%5, %arg0) : (i64, i32) -> i32
   %7 = llvm.call @other(%5, %6) : (i64, i32) -> i32
   %8 = llvm.call @other(%5, %arg1) : (i64, i32) -> i32
-  %9 = llvm.mlir.constant(1 : index) : i64
+  %9 = llvm.mlir.constant(1 : i64) : i64
   %10 = llvm.add %3, %9 : i64
   llvm.br ^bb2(%10 : i64)
 
@@ -387,7 +387,7 @@ llvm.func @func_args(%arg0: i32, %arg1: i32) -> i32 {
 // CHECK-NEXT:   %14 = call i32 @other(i64 0, i32 0)
 // CHECK-NEXT:   ret i32 %14
 ^bb4:   // pred: ^bb2
-  %11 = llvm.mlir.constant(0 : index) : i64
+  %11 = llvm.mlir.constant(0 : i64) : i64
   %12 = llvm.call @other(%11, %0) : (i64, i32) -> i32
   llvm.return %12 : i32
 }
@@ -409,8 +409,8 @@ llvm.func @imperfectly_nested_loops() {
 // CHECK: [[IMPER_bb1]]:
 // CHECK-NEXT:   br label %[[IMPER_bb2:[0-9]+]]
 ^bb1:   // pred: ^bb0
-  %0 = llvm.mlir.constant(0 : index) : i64
-  %1 = llvm.mlir.constant(42 : index) : i64
+  %0 = llvm.mlir.constant(0 : i64) : i64
+  %1 = llvm.mlir.constant(42 : i64) : i64
   llvm.br ^bb2(%0 : i64)
 
 // CHECK: [[IMPER_bb2]]:
@@ -431,8 +431,8 @@ llvm.func @imperfectly_nested_loops() {
 // CHECK: [[IMPER_bb4]]:
 // CHECK-NEXT:   br label %[[IMPER_bb5:[0-9]+]]
 ^bb4:   // pred: ^bb3
-  %4 = llvm.mlir.constant(7 : index) : i64
-  %5 = llvm.mlir.constant(56 : index) : i64
+  %4 = llvm.mlir.constant(7 : i64) : i64
+  %5 = llvm.mlir.constant(56 : i64) : i64
   llvm.br ^bb5(%4 : i64)
 
 // CHECK: [[IMPER_bb5]]:
@@ -449,7 +449,7 @@ llvm.func @imperfectly_nested_loops() {
 // CHECK-NEXT:   br label %[[IMPER_bb5]]
 ^bb6:   // pred: ^bb5
   llvm.call @body2(%2, %6) : (i64, i64) -> ()
-  %8 = llvm.mlir.constant(2 : index) : i64
+  %8 = llvm.mlir.constant(2 : i64) : i64
   %9 = llvm.add %6, %8 : i64
   llvm.br ^bb5(%9 : i64)
 
@@ -459,7 +459,7 @@ llvm.func @imperfectly_nested_loops() {
 // CHECK-NEXT:   br label %[[IMPER_bb2]]
 ^bb7:   // pred: ^bb5
   llvm.call @post(%2) : (i64) -> ()
-  %10 = llvm.mlir.constant(1 : index) : i64
+  %10 = llvm.mlir.constant(1 : i64) : i64
   %11 = llvm.add %2, %10 : i64
   llvm.br ^bb2(%11 : i64)
 
@@ -520,8 +520,8 @@ llvm.func @body3(i64, i64)
 llvm.func @more_imperfectly_nested_loops() {
   llvm.br ^bb1
 ^bb1:	// pred: ^bb0
-  %0 = llvm.mlir.constant(0 : index) : i64
-  %1 = llvm.mlir.constant(42 : index) : i64
+  %0 = llvm.mlir.constant(0 : i64) : i64
+  %1 = llvm.mlir.constant(42 : i64) : i64
   llvm.br ^bb2(%0 : i64)
 ^bb2(%2: i64):	// 2 preds: ^bb1, ^bb11
   %3 = llvm.icmp "slt" %2, %1 : i64
@@ -530,35 +530,35 @@ llvm.func @more_imperfectly_nested_loops() {
   llvm.call @pre(%2) : (i64) -> ()
   llvm.br ^bb4
 ^bb4:	// pred: ^bb3
-  %4 = llvm.mlir.constant(7 : index) : i64
-  %5 = llvm.mlir.constant(56 : index) : i64
+  %4 = llvm.mlir.constant(7 : i64) : i64
+  %5 = llvm.mlir.constant(56 : i64) : i64
   llvm.br ^bb5(%4 : i64)
 ^bb5(%6: i64):	// 2 preds: ^bb4, ^bb6
   %7 = llvm.icmp "slt" %6, %5 : i64
   llvm.cond_br %7, ^bb6, ^bb7
 ^bb6:	// pred: ^bb5
   llvm.call @body2(%2, %6) : (i64, i64) -> ()
-  %8 = llvm.mlir.constant(2 : index) : i64
+  %8 = llvm.mlir.constant(2 : i64) : i64
   %9 = llvm.add %6, %8 : i64
   llvm.br ^bb5(%9 : i64)
 ^bb7:	// pred: ^bb5
   llvm.call @mid(%2) : (i64) -> ()
   llvm.br ^bb8
 ^bb8:	// pred: ^bb7
-  %10 = llvm.mlir.constant(18 : index) : i64
-  %11 = llvm.mlir.constant(37 : index) : i64
+  %10 = llvm.mlir.constant(18 : i64) : i64
+  %11 = llvm.mlir.constant(37 : i64) : i64
   llvm.br ^bb9(%10 : i64)
 ^bb9(%12: i64):	// 2 preds: ^bb8, ^bb10
   %13 = llvm.icmp "slt" %12, %11 : i64
   llvm.cond_br %13, ^bb10, ^bb11
 ^bb10:	// pred: ^bb9
   llvm.call @body3(%2, %12) : (i64, i64) -> ()
-  %14 = llvm.mlir.constant(3 : index) : i64
+  %14 = llvm.mlir.constant(3 : i64) : i64
   %15 = llvm.add %12, %14 : i64
   llvm.br ^bb9(%15 : i64)
 ^bb11:	// pred: ^bb9
   llvm.call @post(%2) : (i64) -> ()
-  %16 = llvm.mlir.constant(1 : index) : i64
+  %16 = llvm.mlir.constant(1 : i64) : i64
   %17 = llvm.add %2, %16 : i64
   llvm.br ^bb2(%17 : i64)
 ^bb12:	// pred: ^bb2
@@ -607,11 +607,11 @@ llvm.func @dso_local_func() attributes {dso_local} {
 llvm.func @memref_alloc() {
 // CHECK-NEXT: %{{[0-9]+}} = call ptr @malloc(i64 400)
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr } undef, ptr %{{[0-9]+}}, 0
-  %0 = llvm.mlir.constant(10 : index) : i64
-  %1 = llvm.mlir.constant(10 : index) : i64
+  %0 = llvm.mlir.constant(10 : i64) : i64
+  %1 = llvm.mlir.constant(10 : i64) : i64
   %2 = llvm.mul %0, %1 : i64
   %3 = llvm.mlir.undef : !llvm.struct<(ptr)>
-  %4 = llvm.mlir.constant(4 : index) : i64
+  %4 = llvm.mlir.constant(4 : i64) : i64
   %5 = llvm.mul %2, %4 : i64
   %6 = llvm.call @malloc(%5) : (i64) -> !llvm.ptr
   %7 = llvm.insertvalue %6, %3[0] : !llvm.struct<(ptr)>
@@ -627,17 +627,17 @@ llvm.func @store_load_static() {
 ^bb0:
 // CHECK-NEXT: %{{[0-9]+}} = call ptr @malloc(i64 40)
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr } undef, ptr %{{[0-9]+}}, 0
-  %0 = llvm.mlir.constant(10 : index) : i64
+  %0 = llvm.mlir.constant(10 : i64) : i64
   %1 = llvm.mlir.undef : !llvm.struct<(ptr)>
-  %2 = llvm.mlir.constant(4 : index) : i64
+  %2 = llvm.mlir.constant(4 : i64) : i64
   %3 = llvm.mul %0, %2 : i64
   %4 = llvm.call @malloc(%3) : (i64) -> !llvm.ptr
   %6 = llvm.insertvalue %4, %1[0] : !llvm.struct<(ptr)>
   %7 = llvm.mlir.constant(1.000000e+00 : f32) : f32
   llvm.br ^bb1
 ^bb1:   // pred: ^bb0
-  %8 = llvm.mlir.constant(0 : index) : i64
-  %9 = llvm.mlir.constant(10 : index) : i64
+  %8 = llvm.mlir.constant(0 : i64) : i64
+  %9 = llvm.mlir.constant(10 : i64) : i64
   llvm.br ^bb2(%8 : i64)
 // CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
 ^bb2(%10: i64):        // 2 preds: ^bb1, ^bb3
@@ -649,11 +649,11 @@ llvm.func @store_load_static() {
 // CHECK: %{{[0-9]+}} = extractvalue { ptr } %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 %{{[0-9]+}}
 // CHECK-NEXT: store float 1.000000e+00, ptr %{{[0-9]+}}
-  %12 = llvm.mlir.constant(10 : index) : i64
+  %12 = llvm.mlir.constant(10 : i64) : i64
   %13 = llvm.extractvalue %6[0] : !llvm.struct<(ptr)>
   %14 = llvm.getelementptr %13[%10] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   llvm.store %7, %14 : f32, !llvm.ptr
-  %15 = llvm.mlir.constant(1 : index) : i64
+  %15 = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
   %16 = llvm.add %10, %15 : i64
 // CHECK-NEXT: br label %{{[0-9]+}}
@@ -661,8 +661,8 @@ llvm.func @store_load_static() {
 ^bb4:   // pred: ^bb2
   llvm.br ^bb5
 ^bb5:   // pred: ^bb4
-  %17 = llvm.mlir.constant(0 : index) : i64
-  %18 = llvm.mlir.constant(10 : index) : i64
+  %17 = llvm.mlir.constant(0 : i64) : i64
+  %18 = llvm.mlir.constant(10 : i64) : i64
   llvm.br ^bb6(%17 : i64)
 // CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
 ^bb6(%19: i64):        // 2 preds: ^bb5, ^bb7
@@ -674,11 +674,11 @@ llvm.func @store_load_static() {
 // CHECK:      %{{[0-9]+}} = extractvalue { ptr } %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 %{{[0-9]+}}
 // CHECK-NEXT: %{{[0-9]+}} = load float, ptr %{{[0-9]+}}
-  %21 = llvm.mlir.constant(10 : index) : i64
+  %21 = llvm.mlir.constant(10 : i64) : i64
   %22 = llvm.extractvalue %6[0] : !llvm.struct<(ptr)>
   %23 = llvm.getelementptr %22[%19] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   %24 = llvm.load %23 : !llvm.ptr -> f32
-  %25 = llvm.mlir.constant(1 : index) : i64
+  %25 = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
   %26 = llvm.add %19, %25 : i64
 // CHECK-NEXT: br label %{{[0-9]+}}
@@ -695,7 +695,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64 } undef, ptr %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
   %0 = llvm.mlir.undef : !llvm.struct<(ptr, i64)>
-  %1 = llvm.mlir.constant(4 : index) : i64
+  %1 = llvm.mlir.constant(4 : i64) : i64
   %2 = llvm.mul %arg0, %1 : i64
   %3 = llvm.call @malloc(%2) : (i64) -> !llvm.ptr
   %5 = llvm.insertvalue %3, %0[0] : !llvm.struct<(ptr, i64)>
@@ -704,7 +704,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
 // CHECK-NEXT: br label %{{[0-9]+}}
   llvm.br ^bb1
 ^bb1:   // pred: ^bb0
-  %8 = llvm.mlir.constant(0 : index) : i64
+  %8 = llvm.mlir.constant(0 : i64) : i64
   llvm.br ^bb2(%8 : i64)
 // CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
 ^bb2(%9: i64): // 2 preds: ^bb1, ^bb3
@@ -721,7 +721,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
   %12 = llvm.extractvalue %6[0] : !llvm.struct<(ptr, i64)>
   %13 = llvm.getelementptr %12[%9] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   llvm.store %7, %13 : f32, !llvm.ptr
-  %14 = llvm.mlir.constant(1 : index) : i64
+  %14 = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
   %15 = llvm.add %9, %14 : i64
 // CHECK-NEXT: br label %{{[0-9]+}}
@@ -729,7 +729,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
 ^bb4:   // pred: ^bb3
   llvm.br ^bb5
 ^bb5:   // pred: ^bb4
-  %16 = llvm.mlir.constant(0 : index) : i64
+  %16 = llvm.mlir.constant(0 : i64) : i64
   llvm.br ^bb6(%16 : i64)
 // CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
 ^bb6(%17: i64):        // 2 preds: ^bb5, ^bb7
@@ -746,7 +746,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
   %20 = llvm.extractvalue %6[0] : !llvm.struct<(ptr, i64)>
   %21 = llvm.getelementptr %20[%17] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   %22 = llvm.load %21 : !llvm.ptr -> f32
-  %23 = llvm.mlir.constant(1 : index) : i64
+  %23 = llvm.mlir.constant(1 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
   %24 = llvm.add %17, %23 : i64
 // CHECK-NEXT: br label %{{[0-9]+}}
@@ -758,7 +758,7 @@ llvm.func @store_load_dynamic(%arg0: i64) {
 
 // CHECK-LABEL: define void @store_load_mixed(i64 {{%.*}})
 llvm.func @store_load_mixed(%arg0: i64) {
-  %0 = llvm.mlir.constant(10 : index) : i64
+  %0 = llvm.mlir.constant(10 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = mul i64 2, %{{[0-9]+}}
 // CHECK-NEXT: %{{[0-9]+}} = mul i64 %{{[0-9]+}}, 4
 // CHECK-NEXT: %{{[0-9]+}} = mul i64 %{{[0-9]+}}, 10
@@ -767,13 +767,13 @@ llvm.func @store_load_mixed(%arg0: i64) {
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64, i64 } undef, ptr %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64, i64 } %{{[0-9]+}}, i64 10, 2
-  %1 = llvm.mlir.constant(2 : index) : i64
-  %2 = llvm.mlir.constant(4 : index) : i64
+  %1 = llvm.mlir.constant(2 : i64) : i64
+  %2 = llvm.mlir.constant(4 : i64) : i64
   %3 = llvm.mul %1, %arg0 : i64
   %4 = llvm.mul %3, %2 : i64
   %5 = llvm.mul %4, %0 : i64
   %6 = llvm.mlir.undef : !llvm.struct<(ptr, i64, i64)>
-  %7 = llvm.mlir.constant(4 : index) : i64
+  %7 = llvm.mlir.constant(4 : i64) : i64
   %8 = llvm.mul %5, %7 : i64
   %9 = llvm.call @malloc(%8) : (i64) -> !llvm.ptr
   %11 = llvm.insertvalue %9, %6[0] : !llvm.struct<(ptr, i64, i64)>
@@ -782,12 +782,12 @@ llvm.func @store_load_mixed(%arg0: i64) {
 
 // CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
 // CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
-  %14 = llvm.mlir.constant(1 : index) : i64
-  %15 = llvm.mlir.constant(2 : index) : i64
+  %14 = llvm.mlir.constant(1 : i64) : i64
+  %15 = llvm.mlir.constant(2 : i64) : i64
   %16 = llvm.call @get_index() : () -> i64
   %17 = llvm.call @get_index() : () -> i64
   %18 = llvm.mlir.constant(4.200000e+01 : f32) : f32
-  %19 = llvm.mlir.constant(2 : index) : i64
+  %19 = llvm.mlir.constant(2 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = extractvalue { ptr, i64, i64 } %{{[0-9]+}}, 1
 // CHECK-NEXT: %{{[0-9]+}} = extractvalue { ptr, i64, i64 } %{{[0-9]+}}, 2
 // CHECK-NEXT: %{{[0-9]+}} = mul i64 1, %{{[0-9]+}}
@@ -800,7 +800,7 @@ llvm.func @store_load_mixed(%arg0: i64) {
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 %{{[0-9]+}}
 // CHECK-NEXT: store float 4.200000e+01, ptr %{{[0-9]+}}
   %20 = llvm.extractvalue %13[1] : !llvm.struct<(ptr, i64, i64)>
-  %21 = llvm.mlir.constant(4 : index) : i64
+  %21 = llvm.mlir.constant(4 : i64) : i64
   %22 = llvm.extractvalue %13[2] : !llvm.struct<(ptr, i64, i64)>
   %23 = llvm.mul %14, %20 : i64
   %24 = llvm.add %23, %15 : i64
@@ -822,9 +822,9 @@ llvm.func @store_load_mixed(%arg0: i64) {
 // CHECK-NEXT: %{{[0-9]+}} = extractvalue { ptr, i64, i64 } %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 %{{[0-9]+}}
 // CHECK-NEXT: %{{[0-9]+}} = load float, ptr %{{[0-9]+}}
-  %31 = llvm.mlir.constant(2 : index) : i64
+  %31 = llvm.mlir.constant(2 : i64) : i64
   %32 = llvm.extractvalue %13[1] : !llvm.struct<(ptr, i64, i64)>
-  %33 = llvm.mlir.constant(4 : index) : i64
+  %33 = llvm.mlir.constant(4 : i64) : i64
   %34 = llvm.extractvalue %13[2] : !llvm.struct<(ptr, i64, i64)>
   %35 = llvm.mul %17, %32 : i64
   %36 = llvm.add %35, %16 : i64
@@ -841,14 +841,14 @@ llvm.func @store_load_mixed(%arg0: i64) {
 
 // CHECK-LABEL: define { ptr, i64 } @memref_args_rets({ ptr } {{%.*}}, { ptr, i64 } {{%.*}}, { ptr, i64 } {{%.*}})
 llvm.func @memref_args_rets(%arg0: !llvm.struct<(ptr)>, %arg1: !llvm.struct<(ptr, i64)>, %arg2: !llvm.struct<(ptr, i64)>) -> !llvm.struct<(ptr, i64)> {
-  %0 = llvm.mlir.constant(7 : index) : i64
+  %0 = llvm.mlir.constant(7 : i64) : i64
 // CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
   %1 = llvm.call @get_index() : () -> i64
   %2 = llvm.mlir.constant(4.200000e+01 : f32) : f32
 // CHECK-NEXT: %{{[0-9]+}} = extractvalue { ptr } %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 7
 // CHECK-NEXT: store float 4.200000e+01, ptr %{{[0-9]+}}
-  %3 = llvm.mlir.constant(10 : index) : i64
+  %3 = llvm.mlir.constant(10 : i64) : i64
   %4 = llvm.extractvalue %arg0[0] : !llvm.struct<(ptr)>
   %5 = llvm.getelementptr %4[%0] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   llvm.store %2, %5 : f32, !llvm.ptr
@@ -866,7 +866,7 @@ llvm.func @memref_args_rets(%arg0: !llvm.struct<(ptr)>, %arg1: !llvm.struct<(ptr
 // CHECK-NEXT: %{{[0-9]+}} = extractvalue { ptr, i64 } %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = getelementptr float, ptr %{{[0-9]+}}, i64 %{{[0-9]+}}
 // CHECK-NEXT: store float 4.200000e+01, ptr %{{[0-9]+}}
-  %9 = llvm.mlir.constant(10 : index) : i64
+  %9 = llvm.mlir.constant(10 : i64) : i64
   %10 = llvm.extractvalue %arg2[1] : !llvm.struct<(ptr, i64)>
   %11 = llvm.mul %0, %10 : i64
   %12 = llvm.add %11, %1 : i64
@@ -878,10 +878,10 @@ llvm.func @memref_args_rets(%arg0: !llvm.struct<(ptr)>, %arg1: !llvm.struct<(ptr
 // CHECK-NEXT: %{{[0-9]+}} = call ptr @malloc(i64 %{{[0-9]+}})
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64 } undef, ptr %{{[0-9]+}}, 0
 // CHECK-NEXT: %{{[0-9]+}} = insertvalue { ptr, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
-  %15 = llvm.mlir.constant(10 : index) : i64
+  %15 = llvm.mlir.constant(10 : i64) : i64
   %16 = llvm.mul %15, %1 : i64
   %17 = llvm.mlir.undef : !llvm.struct<(ptr, i64)>
-  %18 = llvm.mlir.constant(4 : index) : i64
+  %18 = llvm.mlir.constant(4 : i64) : i64
   %19 = llvm.mul %16, %18 : i64
   %20 = llvm.call @malloc(%19) : (i64) -> !llvm.ptr
   %22 = llvm.insertvalue %20, %17[0] : !llvm.struct<(ptr, i64)>
@@ -894,11 +894,11 @@ llvm.func @memref_args_rets(%arg0: !llvm.struct<(ptr)>, %arg1: !llvm.struct<(ptr
 // CHECK-LABEL: define i64 @memref_dim({ ptr, i64, i64 } {{%.*}})
 llvm.func @memref_dim(%arg0: !llvm.struct<(ptr, i64, i64)>) -> i64 {
 // Expecting this to create an LLVM constant.
-  %0 = llvm.mlir.constant(42 : index) : i64
+  %0 = llvm.mlir.constant(42 : i64) : i64
 // CHECK-NEXT: %2 = extractvalue { ptr, i64, i64 } %0, 1
   %1 = llvm.extractvalue %arg0[1] : !llvm.struct<(ptr, i64, i64)>
 // Expecting this to create an LLVM constant.
-  %2 = llvm.mlir.constant(10 : index) : i64
+  %2 = llvm.mlir.constant(10 : i64) : i64
 // CHECK-NEXT: %3 = extractvalue { ptr, i64, i64 } %0, 2
   %3 = llvm.extractvalue %arg0[2] : !llvm.struct<(ptr, i64, i64)>
 // Checking that the constant for d0 has been created.
@@ -950,11 +950,11 @@ llvm.func @multireturn_caller() {
   %6 = llvm.mlir.constant(4.200000e+01 : f32) : f32
 // CHECK:   fadd float [[ret1]], 4.200000e+01
   %7 = llvm.fadd %2, %6 : f32
-  %8 = llvm.mlir.constant(0 : index) : i64
-  %9 = llvm.mlir.constant(42 : index) : i64
+  %8 = llvm.mlir.constant(0 : i64) : i64
+  %9 = llvm.mlir.constant(42 : i64) : i64
 // CHECK:   extractvalue { ptr, i64, i64 } [[ret2]], 0
   %10 = llvm.extractvalue %3[1] : !llvm.struct<(ptr, i64, i64)>
-  %11 = llvm.mlir.constant(10 : index) : i64
+  %11 = llvm.mlir.constant(10 : i64) : i64
   %12 = llvm.extractvalue %3[2] : !llvm.struct<(ptr, i64, i64)>
   %13 = llvm.mul %8, %10 : i64
   %14 = llvm.add %13, %8 : i64
@@ -1438,14 +1438,14 @@ llvm.func @structconstant() -> !llvm.struct<(i32, f32)> {
 
 // CHECK-LABEL: @indexconstantsplat
 llvm.func @indexconstantsplat() -> vector<3xi32> {
-  %1 = llvm.mlir.constant(dense<42> : vector<3xindex>) : vector<3xi32>
+  %1 = llvm.mlir.constant(dense<42> : vector<3xi32>) : vector<3xi32>
   // CHECK: ret <3 x i32> splat (i32 42)
   llvm.return %1 : vector<3xi32>
 }
 
 // CHECK-LABEL: @indexconstantarray
 llvm.func @indexconstantarray() -> vector<3xi32> {
-  %1 = llvm.mlir.constant(dense<[0, 1, 2]> : vector<3xindex>) : vector<3xi32>
+  %1 = llvm.mlir.constant(dense<[0, 1, 2]> : vector<3xi32>) : vector<3xi32>
   // CHECK: ret <3 x i32> <i32 0, i32 1, i32 2>
   llvm.return %1 : vector<3xi32>
 }
diff --git a/mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir b/mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
index 77a78abcd247e..10376183434b6 100644
--- a/mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-array-sectioning-host.mlir
@@ -11,9 +11,9 @@ module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-a
   llvm.func @_3d_target_array_section() {
     %0 = llvm.mlir.addressof @_QFEinarray : !llvm.ptr
     %1 = llvm.mlir.addressof @_QFEoutarray : !llvm.ptr
-    %2 = llvm.mlir.constant(1 : index) : i64
-    %3 = llvm.mlir.constant(0 : index) : i64
-    %4 = llvm.mlir.constant(2 : index) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
+    %3 = llvm.mlir.constant(0 : i64) : i64
+    %4 = llvm.mlir.constant(2 : i64) : i64
     %5 = omp.map.bounds   lower_bound(%3 : i64) upper_bound(%4 : i64) stride(%2 : i64) start_idx(%2 : i64)
     %6 = omp.map.bounds   lower_bound(%2 : i64) upper_bound(%2 : i64) stride(%2 : i64) start_idx(%2 : i64)
     %7 = omp.map.info var_ptr(%0 : !llvm.ptr, !llvm.array<3 x array<3 x array<3 x i32>>>)   map_clauses(tofrom) capture(ByRef) bounds(%5, %5, %6) name("inarray(1:3,1:3,2:2)") -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-data-use-dev-ordering.mlir b/mlir/test/Target/LLVMIR/omptarget-data-use-dev-ordering.mlir
index 430da565a16a2..19ed1496552d2 100644
--- a/mlir/test/Target/LLVMIR/omptarget-data-use-dev-ordering.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-data-use-dev-ordering.mlir
@@ -7,9 +7,9 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"], omp.version = #omp.version<version = 50>} {
   llvm.func @mix_use_device_ptr_and_addr_and_map_(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg11: !llvm.ptr, %arg12: !llvm.ptr) {
-    %0 = llvm.mlir.constant(0 : index) : i64
-    %1 = llvm.mlir.constant(2 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(0 : i64) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = omp.map.bounds lower_bound(%0 : i64) upper_bound(%1 : i64) extent(%1 : i64) stride(%2 : i64) start_idx(%0 : i64) stride_in_bytes(true)
     %4 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.struct<(i64)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
     %5 = omp.map.info var_ptr(%arg1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
@@ -36,9 +36,9 @@ module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-a
   }
 
   llvm.func @mix_use_device_ptr_and_addr_and_map_2(%arg0: !llvm.ptr, %arg1: !llvm.ptr, %arg2: !llvm.ptr, %arg3: !llvm.ptr, %arg4: !llvm.ptr, %arg5: !llvm.ptr, %arg11: !llvm.ptr, %arg12: !llvm.ptr) {
-    %0 = llvm.mlir.constant(0 : index) : i64
-    %1 = llvm.mlir.constant(2 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(0 : i64) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = omp.map.bounds lower_bound(%0 : i64) upper_bound(%1 : i64) extent(%1 : i64) stride(%2 : i64) start_idx(%0 : i64) stride_in_bytes(true)
     %4 = omp.map.info var_ptr(%arg0 : !llvm.ptr, !llvm.struct<(i64)>) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
     %5 = omp.map.info var_ptr(%arg1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir b/mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir
index 2c78ae4c33f75..b74355caa8d25 100644
--- a/mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-debug-var-2.mlir
@@ -33,10 +33,10 @@ module attributes {omp.is_target_device = false} {
     %0 = llvm.mlir.constant(1 : i64) : i64
     %1 = llvm.alloca %0 x f32 : (i64) -> !llvm.ptr
     %4 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr
-    %6 = llvm.mlir.constant(9 : index) : i64
-    %7 = llvm.mlir.constant(0 : index) : i64
-    %8 = llvm.mlir.constant(1 : index) : i64
-    %10 = llvm.mlir.constant(10 : index) : i64
+    %6 = llvm.mlir.constant(9 : i64) : i64
+    %7 = llvm.mlir.constant(0 : i64) : i64
+    %8 = llvm.mlir.constant(1 : i64) : i64
+    %10 = llvm.mlir.constant(10 : i64) : i64
     %11 = llvm.mlir.addressof @_QFEarr : !llvm.ptr
     %14 = omp.map.info var_ptr(%1 : !llvm.ptr, f32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr
     %15 = omp.map.bounds lower_bound(%7 : i64) upper_bound(%6 : i64) extent(%10 : i64) stride(%8 : i64) start_idx(%8 : i64)
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
index 0d795eefa1f9d..acaa1b7aac9f4 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-llvm-host.mlir
@@ -26,8 +26,8 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_targe
     %6 = llvm.insertvalue %5, %4[1, 0] : !llvm.array<2 x array<2 x i32>>
     %7 = llvm.mlir.constant(4 : i32) : i32
     %8 = llvm.insertvalue %7, %6[1, 1] : !llvm.array<2 x array<2 x i32>>
-    %9 = llvm.mlir.constant(2 : index) : i64
-    %10 = llvm.mlir.constant(2 : index) : i64
+    %9 = llvm.mlir.constant(2 : i64) : i64
+    %10 = llvm.mlir.constant(2 : i64) : i64
     llvm.return %8 : !llvm.array<2 x array<2 x i32>>
   }
 
diff --git a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
index 16dcc5fad589a..b1c0a1ea78603 100644
--- a/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-declare-target-to-host.mlir
@@ -15,9 +15,9 @@ module attributes {llvm.target_triple = "x86_64-unknown-linux-gnu", omp.is_gpu =
   // CHECK-DAG: %[[OFFLOADPTR:.*]] = getelementptr inbounds [2 x ptr], ptr %.offload_ptrs, i32 0, i32 0
   // CHECK-DAG: store ptr @_QMtest_0Ezii, ptr %[[OFFLOADPTR]], align 8
   llvm.func @_QQmain() {
-    %0 = llvm.mlir.constant(1 : index) : i64
-    %1 = llvm.mlir.constant(0 : index) : i64
-    %2 = llvm.mlir.constant(11 : index) : i64
+    %0 = llvm.mlir.constant(1 : i64) : i64
+    %1 = llvm.mlir.constant(0 : i64) : i64
+    %2 = llvm.mlir.constant(11 : i64) : i64
     %3 = llvm.mlir.addressof @_QMtest_0Ezii : !llvm.ptr
     %4 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%2 : i64) extent(%2 : i64) stride(%0 : i64) start_idx(%1 : i64) stride_in_bytes(true)
     %5 = omp.map.info var_ptr(%3 : !llvm.ptr, !llvm.array<11 x f32>) map_clauses(tofrom) capture(ByRef) bounds(%4) -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir b/mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir
index 8a91beff07c7d..df9ec507ff1d0 100644
--- a/mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-depend-host-only.mlir
@@ -2,14 +2,14 @@
 
 module attributes {omp.is_target_device = false} {
   llvm.func @omp_target_depend_() {
-    %0 = llvm.mlir.constant(39 : index) : i64
-    %1 = llvm.mlir.constant(1 : index) : i64
-    %2 = llvm.mlir.constant(40 : index) : i64
+    %0 = llvm.mlir.constant(39 : i64) : i64
+    %1 = llvm.mlir.constant(1 : i64) : i64
+    %2 = llvm.mlir.constant(40 : i64) : i64
     %3 = omp.map.bounds lower_bound(%1 : i64) upper_bound(%0 : i64) extent(%2 : i64) stride(%1 : i64) start_idx(%1 : i64)
     %4 = llvm.mlir.addressof @_QFEa : !llvm.ptr
     %5 = omp.map.info var_ptr(%4 : !llvm.ptr, !llvm.array<40 x i32>) map_clauses(from) capture(ByRef) bounds(%3) name("a") -> !llvm.ptr
     omp.target kernel_type(generic) depend(taskdependin -> %4 : !llvm.ptr) map_entries(%5 -> %arg0 : !llvm.ptr) {
-      %6 = llvm.mlir.constant(100 : index) : i32
+      %6 = llvm.mlir.constant(100 : i32) : i32
       llvm.store %6, %arg0 : i32, !llvm.ptr
       omp.terminator
     }
diff --git a/mlir/test/Target/LLVMIR/omptarget-depend.mlir b/mlir/test/Target/LLVMIR/omptarget-depend.mlir
index d1320ccd8bcb4..0c4eb0dd0a6b0 100644
--- a/mlir/test/Target/LLVMIR/omptarget-depend.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-depend.mlir
@@ -2,10 +2,10 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.func @_QQmain() attributes {fir.bindc_name = "main"} {
-    %0 = llvm.mlir.constant(39 : index) : i64
-    %1 = llvm.mlir.constant(0 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
-    %3 = llvm.mlir.constant(40 : index) : i64
+    %0 = llvm.mlir.constant(39 : i64) : i64
+    %1 = llvm.mlir.constant(0 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
+    %3 = llvm.mlir.constant(40 : i64) : i64
     %4 = llvm.mlir.addressof @_QFEa : !llvm.ptr
     %5 = llvm.mlir.addressof @_QFEb : !llvm.ptr
     %6 = llvm.mlir.constant(1 : i64) : i64
@@ -48,10 +48,10 @@ module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-a
     %12 = omp.map.info var_ptr(%7 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("i") -> !llvm.ptr
     %13 = omp.map.info var_ptr(%8 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("n") -> !llvm.ptr
     omp.target kernel_type(generic) depend(taskdependin -> %4 : !llvm.ptr) map_entries(%10 -> %arg0, %11 -> %arg1, %12 -> %arg2, %13 -> %arg3 : !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) {
-      %14 = llvm.mlir.constant(0 : index) : i64
+      %14 = llvm.mlir.constant(0 : i64) : i64
       %15 = llvm.mlir.constant(10 : i32) : i32
-      %16 = llvm.mlir.constant(1 : index) : i64
-      %17 = llvm.mlir.constant(40 : index) : i64
+      %16 = llvm.mlir.constant(1 : i64) : i64
+      %17 = llvm.mlir.constant(40 : i64) : i64
       %18 = llvm.load %arg3 : !llvm.ptr -> i32
       %19 = llvm.sext %18 : i32 to i64
       %20 = llvm.trunc %16 : i64 to i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir b/mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir
index 1b7d5f25ff692..fa7ce9c5f849f 100644
--- a/mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-fortran-common-block-host.mlir
@@ -7,8 +7,8 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.func @omp_map_common_block_using_common_block_members() {
-    %0 = llvm.mlir.constant(4 : index) : i64
-    %1 = llvm.mlir.constant(0 : index) : i64
+    %0 = llvm.mlir.constant(4 : i64) : i64
+    %1 = llvm.mlir.constant(0 : i64) : i64
     %2 = llvm.mlir.addressof @var_common_ : !llvm.ptr
     %3 = llvm.getelementptr %2[%1] : (!llvm.ptr, i64) -> !llvm.ptr, i8
     %4 = llvm.getelementptr %2[%0] : (!llvm.ptr, i64) -> !llvm.ptr, i8
diff --git a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
index 8bc6a3859826a..2aaf916fa2978 100644
--- a/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-llvm.mlir
@@ -42,10 +42,10 @@ module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
 
 module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.func @_QPopenmp_target_data_region(%0 : !llvm.ptr) {
-    %1 = llvm.mlir.constant(1023 : index) : i64
-    %2 = llvm.mlir.constant(0 : index) : i64
-    %3 = llvm.mlir.constant(1024 : index) : i64
-    %4 = llvm.mlir.constant(1 : index) : i64
+    %1 = llvm.mlir.constant(1023 : i64) : i64
+    %2 = llvm.mlir.constant(0 : i64) : i64
+    %3 = llvm.mlir.constant(1024 : i64) : i64
+    %4 = llvm.mlir.constant(1 : i64) : i64
     %5 = omp.map.bounds   lower_bound(%2 : i64) upper_bound(%1 : i64) extent(%3 : i64) stride(%4 : i64) start_idx(%4 : i64)
     %6 = omp.map.info var_ptr(%0 : !llvm.ptr, !llvm.array<1024 x i32>)   map_clauses(from) capture(ByRef) bounds(%5)  name("") -> !llvm.ptr
     omp.target_data map_entries(%6 : !llvm.ptr) {
@@ -103,16 +103,16 @@ module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
     %11 = llvm.mlir.constant(10 : i32) : i32
     %12 = llvm.icmp "slt" %10, %11 : i32
     %13 = llvm.load %5 : !llvm.ptr -> i32
-    %14 = llvm.mlir.constant(1023 : index) : i64
-    %15 = llvm.mlir.constant(0 : index) : i64
-    %16 = llvm.mlir.constant(1024 : index) : i64
-    %17 = llvm.mlir.constant(1 : index) : i64
+    %14 = llvm.mlir.constant(1023 : i64) : i64
+    %15 = llvm.mlir.constant(0 : i64) : i64
+    %16 = llvm.mlir.constant(1024 : i64) : i64
+    %17 = llvm.mlir.constant(1 : i64) : i64
     %18 = omp.map.bounds   lower_bound(%15 : i64) upper_bound(%14 : i64) extent(%16 : i64) stride(%17 : i64) start_idx(%17 : i64)
     %map1 = omp.map.info var_ptr(%1 : !llvm.ptr, !llvm.array<1024 x i32>)   map_clauses(to) capture(ByRef) bounds(%18) name("") -> !llvm.ptr
-    %19 = llvm.mlir.constant(511 : index) : i64
-    %20 = llvm.mlir.constant(0 : index) : i64
-    %21 = llvm.mlir.constant(512 : index) : i64
-    %22 = llvm.mlir.constant(1 : index) : i64
+    %19 = llvm.mlir.constant(511 : i64) : i64
+    %20 = llvm.mlir.constant(0 : i64) : i64
+    %21 = llvm.mlir.constant(512 : i64) : i64
+    %22 = llvm.mlir.constant(1 : i64) : i64
     %23 = omp.map.bounds   lower_bound(%20 : i64) upper_bound(%19 : i64) extent(%21 : i64) stride(%22 : i64) start_idx(%22 : i64)
     %map2 = omp.map.info var_ptr(%3 : !llvm.ptr, !llvm.array<512 x i32>)   map_clauses(exit_release_or_enter_alloc) capture(ByRef) bounds(%23) name("") -> !llvm.ptr
     omp.target_enter_data   if(%12) device(%13 : i32) map_entries(%map1, %map2 : !llvm.ptr, !llvm.ptr)
@@ -120,16 +120,16 @@ module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
     %25 = llvm.mlir.constant(10 : i32) : i32
     %26 = llvm.icmp "sgt" %24, %25 : i32
     %27 = llvm.load %5 : !llvm.ptr -> i32
-    %28 = llvm.mlir.constant(1023 : index) : i64
-    %29 = llvm.mlir.constant(0 : index) : i64
-    %30 = llvm.mlir.constant(1024 : index) : i64
-    %31 = llvm.mlir.constant(1 : index) : i64
+    %28 = llvm.mlir.constant(1023 : i64) : i64
+    %29 = llvm.mlir.constant(0 : i64) : i64
+    %30 = llvm.mlir.constant(1024 : i64) : i64
+    %31 = llvm.mlir.constant(1 : i64) : i64
     %32 = omp.map.bounds   lower_bound(%29 : i64) upper_bound(%28 : i64) extent(%30 : i64) stride(%31 : i64) start_idx(%31 : i64)
     %map3 = omp.map.info var_ptr(%1 : !llvm.ptr, !llvm.array<1024 x i32>)   map_clauses(from) capture(ByRef) bounds(%32) name("") -> !llvm.ptr
-    %33 = llvm.mlir.constant(511 : index) : i64
-    %34 = llvm.mlir.constant(0 : index) : i64
-    %35 = llvm.mlir.constant(512 : index) : i64
-    %36 = llvm.mlir.constant(1 : index) : i64
+    %33 = llvm.mlir.constant(511 : i64) : i64
+    %34 = llvm.mlir.constant(0 : i64) : i64
+    %35 = llvm.mlir.constant(512 : i64) : i64
+    %36 = llvm.mlir.constant(1 : i64) : i64
     %37 = omp.map.bounds   lower_bound(%34 : i64) upper_bound(%33 : i64) extent(%35 : i64) stride(%36 : i64) start_idx(%36 : i64)
     %map4 = omp.map.info var_ptr(%3 : !llvm.ptr, !llvm.array<512 x i32>)   map_clauses(exit_release_or_enter_alloc) capture(ByRef) bounds(%37) name("") -> !llvm.ptr
     omp.target_exit_data   if(%26) device(%27 : i32) map_entries(%map3, %map4 : !llvm.ptr, !llvm.ptr)
diff --git a/mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir b/mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir
index a5ff9812bcb23..c3b0f7b772508 100644
--- a/mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-memcpy-align-metadata.mlir
@@ -22,7 +22,7 @@ module attributes {llvm.data_layout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:6
     %12 = omp.map.info var_ptr(%2 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("k") -> !llvm.ptr
     %13 = omp.map.info var_ptr(%7 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("nz") -> !llvm.ptr
     omp.target kernel_type(spmd) map_entries(%10 -> %arg0, %11 -> %arg1, %12 -> %arg2, %13 -> %arg3, %9 -> %arg4 : !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr, !llvm.ptr) {
-      %14 = llvm.mlir.constant(0 : index) : i64
+      %14 = llvm.mlir.constant(0 : i64) : i64
       %15 = llvm.mlir.constant(13 : i32) : i32
       %16 = llvm.mlir.constant(1000 : i32) : i32
       %17 = llvm.mlir.constant(1 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-nested-ptr-record-type-mapping-host.mlir b/mlir/test/Target/LLVMIR/omptarget-nested-ptr-record-type-mapping-host.mlir
index 7745d6390f3f2..8de8effd40c8d 100644
--- a/mlir/test/Target/LLVMIR/omptarget-nested-ptr-record-type-mapping-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-nested-ptr-record-type-mapping-host.mlir
@@ -8,11 +8,11 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.func @omp_nested_derived_type_alloca_map(%arg0: !llvm.ptr) {
-    %0 = llvm.mlir.constant(4 : index) : i64
-    %1 = llvm.mlir.constant(1 : index) : i64
-    %2 = llvm.mlir.constant(2 : index) : i64
-    %3 = llvm.mlir.constant(0 : index) : i64
-    %4 = llvm.mlir.constant(6 : index) : i64
+    %0 = llvm.mlir.constant(4 : i64) : i64
+    %1 = llvm.mlir.constant(1 : i64) : i64
+    %2 = llvm.mlir.constant(2 : i64) : i64
+    %3 = llvm.mlir.constant(0 : i64) : i64
+    %4 = llvm.mlir.constant(6 : i64) : i64
     %5 = omp.map.bounds lower_bound(%3 : i64) upper_bound(%0 : i64) extent(%0 : i64) stride(%1 : i64) start_idx(%3 : i64) stride_in_bytes(true)
     %6 = llvm.getelementptr %arg0[0, 6] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(f32, struct<(ptr, i64, i32, i8, i8, i8, i8)>, array<10 x i32>, f32, struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>, i32, struct<(f32, array<10 x i32>, struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>, i32)>)>
     %7 = llvm.getelementptr %6[0, 2] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(f32, array<10 x i32>, struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>, i32)>
diff --git a/mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir b/mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir
index 2d7bd152ba742..fa6bc23be5ffd 100644
--- a/mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-nested-record-type-mapping-host.mlir
@@ -9,9 +9,9 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
 llvm.func @_QQmain() {
-    %0 = llvm.mlir.constant(10 : index) : i64
-    %1 = llvm.mlir.constant(4 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(10 : i64) : i64
+    %1 = llvm.mlir.constant(4 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = llvm.mlir.constant(1 : i64) : i64
     %4 = llvm.alloca %3 x !llvm.struct<(f32, array<10 x i32>, struct<(f32, i32)>, i32)> : (i64) -> !llvm.ptr
     %5 = llvm.getelementptr %4[0, 3] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(f32, array<10 x i32>, struct<(f32, i32)>, i32)>
diff --git a/mlir/test/Target/LLVMIR/omptarget-nowait.mlir b/mlir/test/Target/LLVMIR/omptarget-nowait.mlir
index d1a01c8d84369..eb29b23a5995b 100644
--- a/mlir/test/Target/LLVMIR/omptarget-nowait.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-nowait.mlir
@@ -10,7 +10,7 @@ module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
     %5 = omp.map.info var_ptr(%1 : !llvm.ptr, f64) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("n") -> !llvm.ptr
     omp.target kernel_type(generic) nowait map_entries(%4 -> %arg1, %5 -> %arg2, %3 -> %arg3 : !llvm.ptr, !llvm.ptr, !llvm.ptr) {
       %two_f = llvm.mlir.constant(2.000000e+00 : f64) : f64
-      %one_i = llvm.mlir.constant(1 : index) : i64
+      %one_i = llvm.mlir.constant(1 : i64) : i64
       %6 = llvm.getelementptr %arg1[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
       %7 = llvm.load %6 : !llvm.ptr -> !llvm.ptr
       %8 = llvm.getelementptr %7[%one_i] : (!llvm.ptr, i64) -> !llvm.ptr, i8
diff --git a/mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir b/mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir
index d640ac40c2a06..ab77249730d04 100644
--- a/mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-record-type-mapping-host.mlir
@@ -8,9 +8,9 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
 llvm.func @_QQmain() {
-    %0 = llvm.mlir.constant(10 : index) : i64
-    %1 = llvm.mlir.constant(4 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(10 : i64) : i64
+    %1 = llvm.mlir.constant(4 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = llvm.mlir.constant(1 : i64) : i64
     %4 = llvm.alloca %3 x !llvm.struct<(f32, array<10 x i32>, i32)> : (i64) -> !llvm.ptr
     %5 = llvm.mlir.constant(2 : i32) : i32
diff --git a/mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir b/mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir
index cba8467948ea5..b7a654cea9dc3 100644
--- a/mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-record-type-with-ptr-member-host.mlir
@@ -8,9 +8,9 @@
 
 module attributes {omp.is_target_device = false, omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.func @main() {
-    %0 = llvm.mlir.constant(5 : index) : i64
-    %1 = llvm.mlir.constant(2 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
+    %0 = llvm.mlir.constant(5 : i64) : i64
+    %1 = llvm.mlir.constant(2 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
     %3 = llvm.mlir.addressof @full_arr : !llvm.ptr
     %4 = llvm.mlir.constant(1 : i64) : i64
     %5 = llvm.alloca %4 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8)> : (i64) -> !llvm.ptr
diff --git a/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir b/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
index 9110e831cb949..635015acf3813 100644
--- a/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-teams-reduction.mlir
@@ -27,9 +27,9 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
     %9 = omp.map.info var_ptr(%2 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) name("sum") -> !llvm.ptr
     %10 = omp.map.info var_ptr(%5 : !llvm.ptr, i32) map_clauses(implicit, exit_release_or_enter_alloc) capture(ByCopy) name("index_") -> !llvm.ptr
     omp.target kernel_type(generic) map_entries(%9 -> %arg0, %10 -> %arg1 : !llvm.ptr, !llvm.ptr) {
-      %11 = llvm.mlir.constant(0 : index) : i64
-      %12 = llvm.mlir.constant(10000 : index) : i64
-      %13 = llvm.mlir.constant(1 : index) : i64
+      %11 = llvm.mlir.constant(0 : i64) : i64
+      %12 = llvm.mlir.constant(10000 : i64) : i64
+      %13 = llvm.mlir.constant(1 : i64) : i64
       omp.teams reduction(@add_reduction_i32 %arg0 -> %arg2 : !llvm.ptr) {
         %14 = llvm.trunc %13 : i64 to i32
         llvm.br ^bb1(%14, %12 : i32, i64)
diff --git a/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir b/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
index f120dde8131d6..4cc0211e076f2 100644
--- a/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
+++ b/mlir/test/Target/LLVMIR/omptarget-wsloop-collapsed.mlir
@@ -7,7 +7,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<"dlti.alloca_memo
   llvm.func @target_collapsed_wsloop(%arg0: !llvm.ptr) attributes {omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} {
     %loop_ub = llvm.mlir.constant(99 : i32) : i32
     %loop_lb = llvm.mlir.constant(0 : i32) : i32
-    %loop_step = llvm.mlir.constant(1 : index) : i32
+    %loop_step = llvm.mlir.constant(1 : i32) : i32
     omp.wsloop {
       omp.loop_nest (%arg1, %arg2) : i32 = (%loop_lb, %loop_lb) to (%loop_ub, %loop_ub) inclusive step (%loop_step, %loop_step) collapse(2) {
         %1 = llvm.add %arg1, %arg2  : i32
diff --git a/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir b/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
index 24aceef5d3b95..506669aea22db 100644
--- a/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-data-target-device.mlir
@@ -6,10 +6,10 @@
 module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
   llvm.mlir.global weak_odr hidden local_unnamed_addr constant @__oclc_ABI_version(400 : i32) {addr_space = 4 : i32} : i32
   llvm.func @_QQmain() attributes {fir.bindc_name = "main", omp.declare_target = #omp.declaretarget<device_type = (host), capture_clause = (to)>} {
-    %0 = llvm.mlir.constant(99 : index) : i64
-    %1 = llvm.mlir.constant(0 : index) : i64
-    %2 = llvm.mlir.constant(1 : index) : i64
-    %3 = llvm.mlir.constant(100 : index) : i64
+    %0 = llvm.mlir.constant(99 : i64) : i64
+    %1 = llvm.mlir.constant(0 : i64) : i64
+    %2 = llvm.mlir.constant(1 : i64) : i64
+    %3 = llvm.mlir.constant(100 : i64) : i64
     %4 = llvm.mlir.constant(1 : i64) : i64
     %5 = llvm.alloca %4 x i32 {bindc_name = "array_length"} : (i64) -> !llvm.ptr<5>
     %6 = llvm.addrspacecast %5 : !llvm.ptr<5> to !llvm.ptr
@@ -25,7 +25,7 @@ module attributes {omp.target_triples = ["amdgcn-amd-amdhsa"]} {
       %15 = llvm.mlir.constant(100 : i32) : i32
       %16 = llvm.mlir.constant(1 : i32) : i32
       omp.target kernel_type(spmd) host_eval(%15 -> %arg0, %16 -> %arg1 : i32, i32) map_entries(%13 -> %arg2, %14 -> %arg3 : !llvm.ptr, !llvm.ptr) {
-        %17 = llvm.mlir.constant(100 : index) : i64
+        %17 = llvm.mlir.constant(100 : i64) : i64
         omp.parallel {
           %18 = llvm.mlir.constant(1 : i64) : i64
           %19 = llvm.alloca %18 x i32 {pinned} : (i64) -> !llvm.ptr<5>
diff --git a/mlir/test/Target/LLVMIR/openmp-llvm.mlir b/mlir/test/Target/LLVMIR/openmp-llvm.mlir
index 1435f15983218..ce237da85906d 100644
--- a/mlir/test/Target/LLVMIR/openmp-llvm.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-llvm.mlir
@@ -86,8 +86,8 @@ llvm.func @test_omp_parallel_2() -> () {
   // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_2:.*]])
   omp.parallel {
     ^bb0:
-      %0 = llvm.mlir.constant(1 : index) : i64
-      %1 = llvm.mlir.constant(42 : index) : i64
+      %0 = llvm.mlir.constant(1 : i64) : i64
+      %1 = llvm.mlir.constant(42 : i64) : i64
       llvm.call @body(%0) : (i64) -> ()
       llvm.call @body(%1) : (i64) -> ()
       llvm.br ^bb1
@@ -129,7 +129,7 @@ llvm.func @test_omp_parallel_num_threads_1(%arg0: i32) -> () {
 
 // CHECK: define void @test_omp_parallel_num_threads_2()
 llvm.func @test_omp_parallel_num_threads_2() -> () {
-  %0 = llvm.mlir.constant(4 : index) : i32
+  %0 = llvm.mlir.constant(4 : i32) : i32
   // CHECK: %[[GTN_NUM_THREADS_VAR_2:.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GTN_SI_VAR_2:.*]])
   // CHECK: call void @__kmpc_push_num_threads(ptr @[[GTN_SI_VAR_2]], i32 %[[GTN_NUM_THREADS_VAR_2]], i32 4)
   // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_2:.*]])
@@ -146,7 +146,7 @@ llvm.func @test_omp_parallel_num_threads_2() -> () {
 
 // CHECK: define void @test_omp_parallel_num_threads_3()
 llvm.func @test_omp_parallel_num_threads_3() -> () {
-  %0 = llvm.mlir.constant(4 : index) : i32
+  %0 = llvm.mlir.constant(4 : i32) : i32
   // CHECK: %[[GTN_NUM_THREADS_VAR_3_1:.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GTN_SI_VAR_3_1:.*]])
   // CHECK: call void @__kmpc_push_num_threads(ptr @[[GTN_SI_VAR_3_1]], i32 %[[GTN_NUM_THREADS_VAR_3_1]], i32 4)
   // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_3_1:.*]])
@@ -154,7 +154,7 @@ llvm.func @test_omp_parallel_num_threads_3() -> () {
     omp.barrier
     omp.terminator
   }
-  %1 = llvm.mlir.constant(8 : index) : i32
+  %1 = llvm.mlir.constant(8 : i32) : i32
   // CHECK: %[[GTN_NUM_THREADS_VAR_3_2:.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GTN_SI_VAR_3_2:.*]])
   // CHECK: call void @__kmpc_push_num_threads(ptr @[[GTN_SI_VAR_3_2]], i32 %[[GTN_NUM_THREADS_VAR_3_2]], i32 8)
   // CHECK: call void{{.*}}@__kmpc_fork_call{{.*}}@[[OMP_OUTLINED_FN_NUM_THREADS_3_2:.*]])
@@ -175,7 +175,7 @@ llvm.func @test_omp_parallel_num_threads_3() -> () {
 // CHECK: define void @test_omp_parallel_if_1(i32 %[[IF_EXPR_1:.*]])
 llvm.func @test_omp_parallel_if_1(%arg0: i32) -> () {
 
-  %0 = llvm.mlir.constant(0 : index) : i32
+  %0 = llvm.mlir.constant(0 : i32) : i32
   %1 = llvm.icmp "slt" %arg0, %0 : i32
 // CHECK: %[[IF_COND_VAR_1:.*]] = icmp slt i32 %[[IF_EXPR_1]], 0
 
@@ -403,9 +403,9 @@ llvm.func @wsloop_linear(%lb : i32, %ub : i32, %step : i32, %x : !llvm.ptr) {
 
 // CHECK-LABEL: @wsloop_simple
 llvm.func @wsloop_simple(%arg0: !llvm.ptr) {
-  %0 = llvm.mlir.constant(42 : index) : i64
-  %1 = llvm.mlir.constant(10 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(42 : i64) : i64
+  %1 = llvm.mlir.constant(10 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   omp.parallel {
     "omp.wsloop"() ({
       omp.loop_nest (%arg1) : i64 = (%1) to (%0) step (%2) {
@@ -429,9 +429,9 @@ llvm.func @wsloop_simple(%arg0: !llvm.ptr) {
 
 // CHECK-LABEL: @wsloop_inclusive_1
 llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) {
-  %0 = llvm.mlir.constant(42 : index) : i64
-  %1 = llvm.mlir.constant(10 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(42 : i64) : i64
+  %1 = llvm.mlir.constant(10 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   // CHECK: store i64 31, ptr %{{.*}}upperbound
   "omp.wsloop"() ({
     omp.loop_nest (%arg1) : i64 = (%1) to (%0) step (%2) {
@@ -448,9 +448,9 @@ llvm.func @wsloop_inclusive_1(%arg0: !llvm.ptr) {
 
 // CHECK-LABEL: @wsloop_inclusive_2
 llvm.func @wsloop_inclusive_2(%arg0: !llvm.ptr) {
-  %0 = llvm.mlir.constant(42 : index) : i64
-  %1 = llvm.mlir.constant(10 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(42 : i64) : i64
+  %1 = llvm.mlir.constant(10 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   // CHECK: store i64 32, ptr %{{.*}}upperbound
   "omp.wsloop"() ({
     omp.loop_nest (%arg1) : i64 = (%1) to (%0) inclusive step (%2) {
@@ -1581,8 +1581,8 @@ llvm.func @omp_atomic_read_implicit_cast () {
   %5 = llvm.alloca %4 x !llvm.array<2 x struct<(f32, f32)>> {bindc_name = "x"} : (i64) -> !llvm.ptr
   %6 = llvm.mlir.constant(1 : i64) : i64
   %7 = llvm.alloca %6 x i32 {bindc_name = "w"} : (i64) -> !llvm.ptr
-  %8 = llvm.mlir.constant(1 : index) : i64
-  %9 = llvm.mlir.constant(2 : index) : i64
+  %8 = llvm.mlir.constant(1 : i64) : i64
+  %9 = llvm.mlir.constant(2 : i64) : i64
   %10 = llvm.mlir.constant(1 : i64) : i64
   %11 = llvm.mlir.constant(0 : i64) : i64
   %12 = llvm.sub %8, %10 overflow<nsw> : i64
@@ -4084,9 +4084,9 @@ module attributes {omp.requires = #omp<clause_requires reverse_offload|unified_s
 // -----
 
 llvm.func @distribute() {
-  %0 = llvm.mlir.constant(42 : index) : i64
-  %1 = llvm.mlir.constant(10 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %0 = llvm.mlir.constant(42 : i64) : i64
+  %1 = llvm.mlir.constant(10 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   omp.distribute {
     omp.loop_nest (%arg1) : i64 = (%1) to (%0) step (%2) {
       omp.yield
diff --git a/mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir b/mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir
index c255afcc9bb50..2869a40c0b2b7 100644
--- a/mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-nested-task-target-parallel.mlir
@@ -16,10 +16,10 @@ llvm.func @_QQmain() {
 %1 = llvm.alloca %0 x i32 {bindc_name = "i"} : (i64) -> !llvm.ptr
 %2 = llvm.mlir.constant(1 : i64) : i64
 %3 = llvm.alloca %2 x i32 {bindc_name = "c"} : (i64) -> !llvm.ptr
-%4 = llvm.mlir.constant(10 : index) : i64
-%5 = llvm.mlir.constant(0 : index) : i64
-%6 = llvm.mlir.constant(10000 : index) : i64
-%7 = llvm.mlir.constant(1 : index) : i64
+%4 = llvm.mlir.constant(10 : i64) : i64
+%5 = llvm.mlir.constant(0 : i64) : i64
+%6 = llvm.mlir.constant(10000 : i64) : i64
+%7 = llvm.mlir.constant(1 : i64) : i64
 %8 = llvm.mlir.constant(1 : i64) : i64
 %9 = llvm.mlir.addressof @_QFECchunksz : !llvm.ptr
 %10 = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Target/LLVMIR/openmp-nested.mlir b/mlir/test/Target/LLVMIR/openmp-nested.mlir
index a5224540691f3..cbb9d93f8b014 100644
--- a/mlir/test/Target/LLVMIR/openmp-nested.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-nested.mlir
@@ -6,9 +6,9 @@ module {
 
   llvm.func @main(%arg0: i32, %arg1: !llvm.ptr) -> i32 {
     omp.parallel   {
-      %0 = llvm.mlir.constant(1 : index) : i64
-      %1 = llvm.mlir.constant(10 : index) : i64
-      %2 = llvm.mlir.constant(0 : index) : i64
+      %0 = llvm.mlir.constant(1 : i64) : i64
+      %1 = llvm.mlir.constant(10 : i64) : i64
+      %2 = llvm.mlir.constant(0 : i64) : i64
       %4 = llvm.mlir.constant(0 : i32) : i32
       %12 = llvm.alloca %0 x i64 : (i64) -> !llvm.ptr
       omp.wsloop {
diff --git a/mlir/test/Target/LLVMIR/openmp-nontemporal.mlir b/mlir/test/Target/LLVMIR/openmp-nontemporal.mlir
index 974cf674d547d..858e7e1750ce9 100644
--- a/mlir/test/Target/LLVMIR/openmp-nontemporal.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-nontemporal.mlir
@@ -43,7 +43,7 @@ llvm.func @_QPtest(%arg0: !llvm.ptr {fir.bindc_name = "n"}, %arg1: !llvm.ptr {fi
         %9 = llvm.sext %8 : i32 to i64
         %10 = llvm.getelementptr %2[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
         %11 = llvm.load %10 : !llvm.ptr -> !llvm.ptr
-        %12 = llvm.mlir.constant(0 : index) : i64
+        %12 = llvm.mlir.constant(0 : i64) : i64
         %13 = llvm.getelementptr %2[0, 7, %12, 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
         %14 = llvm.load %13 : !llvm.ptr -> i64
         %15 = llvm.getelementptr %2[0, 7, %12, 1] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
@@ -70,7 +70,7 @@ llvm.func @_QPtest(%arg0: !llvm.ptr {fir.bindc_name = "n"}, %arg1: !llvm.ptr {fi
         %31 = llvm.sext %30 : i32 to i64
         %32 = llvm.getelementptr %1[0, 0] : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
         %33 = llvm.load %32 : !llvm.ptr -> !llvm.ptr
-        %34 = llvm.mlir.constant(0 : index) : i64
+        %34 = llvm.mlir.constant(0 : i64) : i64
         %35 = llvm.getelementptr %1[0, 7, %34, 0] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
         %36 = llvm.load %35 : !llvm.ptr -> i64
         %37 = llvm.getelementptr %1[0, 7, %34, 1] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)>
diff --git a/mlir/test/Target/LLVMIR/openmp-private.mlir b/mlir/test/Target/LLVMIR/openmp-private.mlir
index e93f246f80f70..f720835b8a8e4 100644
--- a/mlir/test/Target/LLVMIR/openmp-private.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-private.mlir
@@ -240,7 +240,7 @@ omp.declare_reduction @reducer.part : !llvm.ptr alloc {
 llvm.func @_QPequivalence() {
   %0 = llvm.mlir.constant(1 : i64) : i64
   %1 = llvm.alloca %0 x !llvm.array<4 x i8> : (i64) -> !llvm.ptr
-  %2 = llvm.mlir.constant(0 : index) : i64
+  %2 = llvm.mlir.constant(0 : i64) : i64
   %3 = llvm.getelementptr %1[0, %2] : (!llvm.ptr, i64) -> !llvm.ptr, !llvm.array<4 x i8>
   omp.parallel private(@_QFequivalenceEx_firstprivate_ptr_f32 %3 -> %arg0 : !llvm.ptr) {
     %4 = llvm.mlir.constant(3.140000e+00 : f32) : f32
diff --git a/mlir/test/Target/LLVMIR/openmp-reduction-array-sections.mlir b/mlir/test/Target/LLVMIR/openmp-reduction-array-sections.mlir
index d218272830e71..46f76ff28e717 100644
--- a/mlir/test/Target/LLVMIR/openmp-reduction-array-sections.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-reduction-array-sections.mlir
@@ -16,8 +16,8 @@ omp.declare_reduction @add_reduction_byref_box_Uxf32 : !llvm.ptr alloc {
 } combiner {
 ^bb0(%arg0: !llvm.ptr, %arg1: !llvm.ptr):
   %0 = llvm.mlir.constant(0 : i64) : i64
-  %1 = llvm.mlir.constant(0 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %1 = llvm.mlir.constant(0 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   llvm.br ^bb1(%0 : i64)
 ^bb1(%3: i64):  // 2 preds: ^bb0, ^bb2
   %4 = llvm.icmp "sgt" %3, %1 : i64
@@ -40,8 +40,8 @@ omp.declare_reduction @add_reduction_byref_box_Uxf32 : !llvm.ptr alloc {
 }
 llvm.func @sectionsreduction_(%arg0: !llvm.ptr {fir.bindc_name = "x"}) attributes {fir.internal_name = "_QPsectionsreduction"} {
   %0 = llvm.mlir.constant(1 : i64) : i64
-  %1 = llvm.mlir.constant(0 : index) : i64
-  %2 = llvm.mlir.constant(1 : index) : i64
+  %1 = llvm.mlir.constant(0 : i64) : i64
+  %2 = llvm.mlir.constant(1 : i64) : i64
   omp.parallel {
     %3 = llvm.alloca %0 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> : (i64) -> !llvm.ptr
     omp.sections reduction(byref @add_reduction_byref_box_Uxf32 %3 -> %arg1 : !llvm.ptr) {
diff --git a/mlir/test/Target/LLVMIR/openmp-simd-linear.mlir b/mlir/test/Target/LLVMIR/openmp-simd-linear.mlir
index 1a88bb394abeb..af31abb1de90f 100644
--- a/mlir/test/Target/LLVMIR/openmp-simd-linear.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-simd-linear.mlir
@@ -45,9 +45,9 @@ llvm.func @test_simd_linear() {
 // CHECK:       omp.region.cont1:
 
 llvm.func @test_simd_linear2(%a : !llvm.ptr) {
-  %c0_i64 = llvm.mlir.constant(0 : index) : i64
-  %c1_i64 = llvm.mlir.constant(1 : index) : i64
-  %c100_i64 = llvm.mlir.constant(100 : index) : i64
+  %c0_i64 = llvm.mlir.constant(0 : i64) : i64
+  %c1_i64 = llvm.mlir.constant(1 : i64) : i64
+  %c100_i64 = llvm.mlir.constant(100 : i64) : i64
   %c1_i32 = llvm.mlir.constant(1 : i32) : i32
   %c100_i32 = llvm.mlir.constant(100 : i32) : i32
 
diff --git a/mlir/test/Target/LLVMIR/openmp-target-private.mlir b/mlir/test/Target/LLVMIR/openmp-target-private.mlir
index e1798b5c66b63..482f9c17cce3a 100644
--- a/mlir/test/Target/LLVMIR/openmp-target-private.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-target-private.mlir
@@ -102,11 +102,11 @@ llvm.func @target_boxchar_(%arg0: !llvm.ptr {fir.bindc_name = "l"}) attributes {
   llvm.store %12, %3 : !llvm.struct<(ptr, i64)>, !llvm.ptr
   %14 = omp.map.info var_ptr(%3 : !llvm.ptr, !llvm.struct<(ptr, i64)>) map_clauses(to) capture(ByRef) -> !llvm.ptr
   omp.target kernel_type(generic) map_entries(%13 -> %arg1, %14 -> %arg2 : !llvm.ptr, !llvm.ptr) private(@_QFtarget_boxcharEchar_var_private_boxchar_c8xU %12 -> %arg3 [map_idx=1] : !llvm.struct<(ptr, i64)>) {
-    %15 = llvm.mlir.constant(0 : index) : i64
+    %15 = llvm.mlir.constant(0 : i64) : i64
     %16 = llvm.mlir.constant(32 : i8) : i8
-    %17 = llvm.mlir.constant(1 : index) : i64
+    %17 = llvm.mlir.constant(1 : i64) : i64
     %18 = llvm.mlir.constant(false) : i1
-    %19 = llvm.mlir.constant(5 : index) : i64
+    %19 = llvm.mlir.constant(5 : i64) : i64
     %20 = llvm.mlir.constant(5 : i32) : i32
     %21 = llvm.extractvalue %arg3[0] : !llvm.struct<(ptr, i64)>
     %22 = llvm.extractvalue %arg3[1] : !llvm.struct<(ptr, i64)>
diff --git a/mlir/test/Target/LLVMIR/openmp-target-wsloop-private.mlir b/mlir/test/Target/LLVMIR/openmp-target-wsloop-private.mlir
index cffe71e684ebc..359ae9a21d0ce 100644
--- a/mlir/test/Target/LLVMIR/openmp-target-wsloop-private.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-target-wsloop-private.mlir
@@ -16,7 +16,7 @@ llvm.func @test_alloca_ip_workaround() {
   omp.target kernel_type(generic) {
     %65 = llvm.mlir.constant(1 : i32) : i32
     %66 = llvm.alloca %65 x !llvm.struct<(ptr, i64, i32, i8, i8, i8, i8, array<1 x array<3 x i64>>)> {alignment = 8 : i64} : (i32) -> !llvm.ptr
-    %67 = llvm.mlir.constant(0 : index) : i64
+    %67 = llvm.mlir.constant(0 : i64) : i64
     %68 = llvm.mlir.constant(10 : i32) : i32
     %69 = llvm.mlir.constant(1 : i32) : i32
     omp.wsloop private(@impure_alloca_privatizer %66 -> %arg6 : !llvm.ptr) {
diff --git a/mlir/test/Target/LLVMIR/openmp-teams-reduction.mlir b/mlir/test/Target/LLVMIR/openmp-teams-reduction.mlir
index 79110565455dd..45f0969d04ea2 100644
--- a/mlir/test/Target/LLVMIR/openmp-teams-reduction.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-teams-reduction.mlir
@@ -17,9 +17,9 @@ llvm.func @simple_teams_only_reduction_() attributes {fir.internal_name = "_QPsi
   %1 = llvm.alloca %0 x i32 {bindc_name = "sum"} : (i64) -> !llvm.ptr
   %2 = llvm.mlir.constant(1 : i64) : i64
   %3 = llvm.alloca %2 x i32 {bindc_name = "index_"} : (i64) -> !llvm.ptr
-  %4 = llvm.mlir.constant(0 : index) : i64
-  %5 = llvm.mlir.constant(10000 : index) : i64
-  %6 = llvm.mlir.constant(1 : index) : i64
+  %4 = llvm.mlir.constant(0 : i64) : i64
+  %5 = llvm.mlir.constant(10000 : i64) : i64
+  %6 = llvm.mlir.constant(1 : i64) : i64
   %7 = llvm.mlir.constant(0 : i32) : i32
   %8 = llvm.mlir.constant(1 : i64) : i64
   %9 = llvm.mlir.constant(1 : i64) : i64
diff --git a/mlir/test/Target/LLVMIR/openmp-wsloop-test-block-structure.mlir b/mlir/test/Target/LLVMIR/openmp-wsloop-test-block-structure.mlir
index 19ae425e20403..01a9e81deac95 100644
--- a/mlir/test/Target/LLVMIR/openmp-wsloop-test-block-structure.mlir
+++ b/mlir/test/Target/LLVMIR/openmp-wsloop-test-block-structure.mlir
@@ -5,8 +5,8 @@
 // produced by the Fujitsu test.
 
 llvm.func @test_block_structure() {
-  %i1 = llvm.mlir.constant(1 : index) : i1
-  %i64 = llvm.mlir.constant(1 : index) : i64
+  %i1 = llvm.mlir.constant(1 : i1) : i1
+  %i64 = llvm.mlir.constant(1 : i64) : i64
   llvm.br ^bb1(%i64, %i64 : i64, i64)
 
 ^bb1(%20: i64, %21: i64):  // 2 preds: ^bb0, ^bb5
diff --git a/mlir/test/mlir-runner/simple.mlir b/mlir/test/mlir-runner/simple.mlir
index 44fe98f8d2bcb..714115e0221cc 100644
--- a/mlir/test/mlir-runner/simple.mlir
+++ b/mlir/test/mlir-runner/simple.mlir
@@ -36,7 +36,7 @@ llvm.func @main() -> f32 {
 
 // Helper typed functions wrapping calls to "malloc" and "free".
 llvm.func @allocation() -> !llvm.ptr {
-  %0 = llvm.mlir.constant(4 : index) : i64
+  %0 = llvm.mlir.constant(4 : i64) : i64
   %1 = llvm.call @malloc(%0) : (i64) -> !llvm.ptr
   llvm.return %1 : !llvm.ptr
 }
@@ -49,7 +49,7 @@ llvm.func @deallocation(%arg0: !llvm.ptr) {
 // works.
 llvm.func @foo() -> f32 {
   %0 = llvm.call @allocation() : () -> !llvm.ptr
-  %1 = llvm.mlir.constant(0 : index) : i64
+  %1 = llvm.mlir.constant(0 : i64) : i64
   %2 = llvm.mlir.constant(1.234000e+03 : f32) : f32
   %3 = llvm.getelementptr %0[%1] : (!llvm.ptr, i64) -> !llvm.ptr, f32
   llvm.store %2, %3 : f32, !llvm.ptr
diff --git a/mlir/test/mlir-runner/verify-entry-point.mlir b/mlir/test/mlir-runner/verify-entry-point.mlir
index c7165bd46302f..18797f25a9efa 100644
--- a/mlir/test/mlir-runner/verify-entry-point.mlir
+++ b/mlir/test/mlir-runner/verify-entry-point.mlir
@@ -17,7 +17,7 @@ llvm.func @entry_inputs_void(%arg0: i32) {
 
 // CHECK-ENTRY-RESULT-VOID: Error: expected void function
 llvm.func @entry_result_void() -> (i32) {
-  %0 = llvm.mlir.constant(0 : index) : i32
+  %0 = llvm.mlir.constant(0 : i32) : i32
   llvm.return %0 : i32
 }
 
@@ -31,18 +31,18 @@ llvm.func @entry_inputs_i32(%arg0: i32) {
 
 // CHECK-ENTRY-RESULT-I32: Error: only single i32 function result supported
 llvm.func @entry_result_i32() -> (i64) {
-  %0 = llvm.mlir.constant(0 : index) : i64
+  %0 = llvm.mlir.constant(0 : i64) : i64
   llvm.return %0 : i64
 }
 
 // CHECK-ENTRY-RESULT-I64: Error: only single i64 function result supported
 llvm.func @entry_result_i64() -> (i32) {
-  %0 = llvm.mlir.constant(0 : index) : i32
+  %0 = llvm.mlir.constant(0 : i32) : i32
   llvm.return %0 : i32
 }
 
 // CHECK-ENTRY-RESULT-F32: Error: only single f32 function result supported
 llvm.func @entry_result_f32() -> (i32) {
-  %0 = llvm.mlir.constant(0 : index) : i32
+  %0 = llvm.mlir.constant(0 : i32) : i32
   llvm.return %0 : i32
 }



More information about the Mlir-commits mailing list