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

Kyungwoo Lee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 13:02:56 PST 2022


kyulee added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp:947
+    std::vector<Constant *> InitialValues(NumCounters,
+                                          Constant::getAllOnesValue(CounterTy));
+    CounterPtr = new GlobalVariable(
----------------
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.


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