[llvm] [InstrProf] Change step from 64-bit to pointer-sized int (PR #83239)

Jovan Dmitrović via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 01:46:30 PST 2024


https://github.com/jdmitrovic-syrmia created https://github.com/llvm/llvm-project/pull/83239

Fixed 64-bit step can lead to creating atomic instructions unsupported by the target architecture (see rust-lang/rust#112313).

>From a45c783d0686c2f7a9d442e617e994a1d8d496eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jovan=20Dmitrovi=C4=87?= <jovan.dmitrovic at syrmia.com>
Date: Wed, 28 Feb 2024 09:50:20 +0100
Subject: [PATCH] [InstrProf] Change step from 64-bit to pointer-sized int

Fixed 64-bit step can lead to creating atomic instructions
unsupported by the target architecture (see rust-lang/rust#112313).
---
 llvm/lib/IR/IntrinsicInst.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 89403e1d7fcb4d..0f0a6bf23ffe43 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -288,7 +288,8 @@ Value *InstrProfIncrementInst::getStep() const {
   }
   const Module *M = getModule();
   LLVMContext &Context = M->getContext();
-  return ConstantInt::get(Type::getInt64Ty(Context), 1);
+  const auto &DL = M->getDataLayout();
+  return ConstantInt::get(DL.getIntPtrType(Context), 1);
 }
 
 std::optional<RoundingMode> ConstrainedFPIntrinsic::getRoundingMode() const {



More information about the llvm-commits mailing list