[polly] r287265 - [DBG] Allow to emit the RTC value at runtime
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 17 13:49:19 PST 2016
Author: jdoerfert
Date: Thu Nov 17 15:49:19 2016
New Revision: 287265
URL: http://llvm.org/viewvc/llvm-project?rev=287265&view=rev
Log:
[DBG] Allow to emit the RTC value at runtime
The new command line flag "polly-codegen-emit-rtc-print" can be used to
place a "printf" in the generated code that will print the RTC value and
the overflow state.
Modified:
polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
Modified: polly/trunk/lib/CodeGen/IslNodeBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/IslNodeBuilder.cpp?rev=287265&r1=287264&r2=287265&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/IslNodeBuilder.cpp (original)
+++ polly/trunk/lib/CodeGen/IslNodeBuilder.cpp Thu Nov 17 15:49:19 2016
@@ -18,10 +18,12 @@
#include "polly/CodeGen/IslAst.h"
#include "polly/CodeGen/IslExprBuilder.h"
#include "polly/CodeGen/LoopGenerators.h"
+#include "polly/CodeGen/RuntimeDebugBuilder.h"
#include "polly/CodeGen/Utils.h"
#include "polly/Config/config.h"
#include "polly/DependenceInfo.h"
#include "polly/LinkAllPasses.h"
+#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/SCEVValidator.h"
@@ -54,6 +56,11 @@ using namespace llvm;
// trigger for corner cases (e.g., the "dct_luma" function in h264, SPEC2006).
static int const MaxDimensionsInAccessRange = 9;
+static cl::opt<bool> PollyGenerateRTCPrint(
+ "polly-codegen-emit-rtc-print",
+ cl::desc("Emit code that prints the runtime check result dynamically."),
+ cl::Hidden, cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
+
__isl_give isl_ast_expr *
IslNodeBuilder::getUpperBound(__isl_keep isl_ast_node *For,
ICmpInst::Predicate &Predicate) {
@@ -1320,6 +1327,15 @@ Value *IslNodeBuilder::createRTC(isl_ast
RTC = Builder.CreateIsNotNull(RTC);
Value *OverflowHappened =
Builder.CreateNot(ExprBuilder.getOverflowState(), "polly.rtc.overflown");
+
+ if (PollyGenerateRTCPrint) {
+ auto *F = Builder.GetInsertBlock()->getParent();
+ RuntimeDebugBuilder::createCPUPrinter(
+ Builder, "F: " + F->getName().str() + " R: " +
+ S.getRegion().getNameStr() + " __RTC: ",
+ RTC, " Overflow: ", OverflowHappened);
+ }
+
RTC = Builder.CreateAnd(RTC, OverflowHappened, "polly.rtc.result");
ExprBuilder.setTrackOverflow(false);
return RTC;
More information about the llvm-commits
mailing list