================
@@ -1341,20 +1344,26 @@ void 
InstrProfiling::createDataVariable(InstrProfCntrInstBase *Inc,
   }
   auto *Data =
       new GlobalVariable(*M, DataTy, false, Linkage, nullptr, DataVarName);
-  // Reference the counter variable with a label difference (link-time
-  // constant).
-  auto *RelativeCounterPtr =
-      ConstantExpr::getSub(ConstantExpr::getPtrToInt(CounterPtr, IntPtrTy),
-                           ConstantExpr::getPtrToInt(Data, IntPtrTy));
-
-  // Bitmaps are relative to the same data variable as profile counters.
+  Constant *RelativeCounterPtr;
   GlobalVariable *BitmapPtr = PD.RegionBitmaps;
   Constant *RelativeBitmapPtr = ConstantInt::get(IntPtrTy, 0);
-
-  if (BitmapPtr != nullptr) {
-    RelativeBitmapPtr =
-        ConstantExpr::getSub(ConstantExpr::getPtrToInt(BitmapPtr, IntPtrTy),
+  // By default counter ptr and bitmap ptr are address relative to data 
section.
----------------
MaskRay wrote:

This comment duplicates a bit of "// Reference the counter variable with a 
label difference (link-time".

We can just say: With binary profile correlation, profd is not loaded into 
memory. profd must reference profc with an absolute relocation.

https://github.com/llvm/llvm-project/pull/69493
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to