[PATCH] D116180: [InstrProf] Add single byte coverage mode

Ellis Hoag via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 14:39:22 PST 2022


ellis marked an inline comment as done.
ellis added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:947
+    std::vector<Constant *> InitialValues(NumCounters,
+                                          Constant::getAllOnesValue(CounterTy));
+    CounterPtr = new GlobalVariable(
----------------
kyulee wrote:
> ellis wrote:
> > kyulee wrote:
> > > Can we just use `Constant::getAllOnesValue()` like `Constant::getNullValue()` with the array type?
> > Unfortunately, `ConstantArray::get()` takes an array so we cannot give it just a `Constant`.
> > 
> > https://llvm.org/doxygen/classllvm_1_1ConstantArray.html#a0900dacdc7ad8e3ea0cc92993c7fd422
> > 
> > Also, `getAllOnesValue()` does not appear to accept an array type yet.
> `FixedVectorType` instead of `ArrayType` seems the same semantic, which appears to work.
I would like to avoid using different array types for function entry cover and block counters. From the docs (https://llvm.org/docs/LangRef.html#vector-type) it seems that the vector type is intended for SIMD instructions and we won't them on these globals.

I think a better solution would be to expand `getAllOnesValue()` to take an array type, but I haven't looked into whether that is realistic. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116180/new/

https://reviews.llvm.org/D116180



More information about the llvm-commits mailing list