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

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 01:47:19 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Jovan Dmitrović (jdmitrovic-syrmia)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/83239.diff


1 Files Affected:

- (modified) llvm/lib/IR/IntrinsicInst.cpp (+2-1) 


``````````diff
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 {

``````````

</details>


https://github.com/llvm/llvm-project/pull/83239


More information about the llvm-commits mailing list