From d439911f73e303383570fe05dc908c3442f678c4 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Fri, 28 Apr 2017 19:08:20 +0000 Subject: [PATCH] [CodeGen] Skip verify if -polly-codegen-verify is set to false Before this change, we always tried to verify the function and printed verification errors, but just did not abort in case -polly-codegen-verify=false was set and verification failed. As verification can become very cosly -- for large functions with many scops we may verify the very same function very often -- this can affect compile time very negatively. Hence, we respect the -polly-codegen-verify flag with this check, ensuring that no verification is run if -polly-codegen-verify=false. This reduces code generation time from 26 seconds to 4 seconds on the test case below with -polly-codegen-verify=false: struct X { int x; }; void a(); #define SIG (int x, X **y, X **z) typedef void (*fn)SIG; #define FN { for (int i = 0; i < x; ++i) { (*y)[i].x += (*z)[i].x; } a(); } #define FN5 FN FN FN FN FN #define FN25 FN5 FN5 FN5 FN5 #define FN125 FN25 FN25 FN25 FN25 FN25 #define FN250 FN125 FN125 #define FN1250 FN250 FN250 FN250 FN250 FN250 void x SIG { FN1250 } llvm-svn: 301669 --- polly/lib/CodeGen/CodeGeneration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polly/lib/CodeGen/CodeGeneration.cpp b/polly/lib/CodeGen/CodeGeneration.cpp index ea98ef7..e1d28b3 100644 --- a/polly/lib/CodeGen/CodeGeneration.cpp +++ b/polly/lib/CodeGen/CodeGeneration.cpp @@ -72,7 +72,7 @@ public: ///} void verifyGeneratedFunction(Scop &S, Function &F) { - if (!verifyFunction(F, &errs()) || !Verify) + if (!Verify || !verifyFunction(F, &errs())) return; DEBUG({ -- 2.7.4