[PATCH] D20541: [esan|cfrag]: Add createCacheFragGV.

Qin Zhao via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 08:16:03 PDT 2016


zhaoqin added inline comments.

================
Comment at: lib/Transforms/Instrumentation/EfficiencySanitizer.cpp:199
@@ +198,3 @@
+// Create the global variable for the cache-fragmentation tool.
+GlobalVariable *EfficiencySanitizer::createCacheFragGV(Module &M) {
+  assert(Options.ToolType == EfficiencySanitizerOptions::ESAN_CacheFrag);
----------------
aizatsky wrote:
> What is the purpose for having different struct types for each tool? Is there a case where they are different or would it allways be "{ToolType, ModuleName}"?
So far, only the cache fragmentation tool takes the variable passed to runtime.

Creating a struct variable includes two parts:
type specification: line 202 - line 214
and
variable initialization: line 216 - line 225.
I feel it is better/clearer/simpler to put the two parts together for easy code reading.

The header creation mainly just line 216 - line 218 and line 223. Separate it seems does more harm than good.


http://reviews.llvm.org/D20541





More information about the llvm-commits mailing list