[PATCH] D29023: [Stack Protection] Add diagnostic information for why stack protection was applied to a function

Adam Nemet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 16:33:11 PST 2017


anemet requested changes to this revision.
anemet added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/CodeGen/StackProtector.cpp:226
 
+  OptimizationRemarkEmitter ORE(F);
+  Twine ReasonStub =
----------------
Please add a comment that we're constructing ORE on the fly rather than using through the analysis pass to avoid building DominatorTree and LoopInfo which is not available this late in the IR pipeline.


================
Comment at: lib/CodeGen/StackProtector.cpp:231-233
+    OptimizationRemark Remark(
+        DEBUG_TYPE, *F, F->getSubprogram(),
+        ReasonStub + "a function attribute or command-line switch");
----------------
OK, clearly we had too many APIs driving this functionality, and not too surprisingly, you didn't pick the right ones.   So I went ahead and cleaned up the APIs (e.g. r296019, r296037).

This is not the ctor you want to use (and after my changes, you can't).  Please use one of the two that are available now.


================
Comment at: lib/CodeGen/StackProtector.cpp:254
               Layout.insert(std::make_pair(AI, SSPLK_LargeArray));
+              ORE.emitOptimizationRemark(DEBUG_TYPE, &I, ReasonStub + AllocaMsg);
               NeedsProtector = true;
----------------
Same here, I removed this legacy interface.  Please use ORE.emit().


https://reviews.llvm.org/D29023





More information about the llvm-commits mailing list