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

Brian Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 19:37:45 PST 2024


================
@@ -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);
----------------
briansmith wrote:

With a 64-bit type, very few counters will overflow. With a pointer-width type, more counters will overflow, especially on 16-bit targets, but even on 32-bit targets. I speculate this is why 64-bit integers are used currently. How should we address this concern?

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


More information about the llvm-commits mailing list