[polly] r301669 - [CodeGen] Skip verify if -polly-codegen-verify is set to false

Tobias Grosser via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 12:08:20 PDT 2017


Author: grosser
Date: Fri Apr 28 14:08:20 2017
New Revision: 301669

URL: http://llvm.org/viewvc/llvm-project?rev=301669&view=rev
Log:
[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 }

Modified:
    polly/trunk/lib/CodeGen/CodeGeneration.cpp

Modified: polly/trunk/lib/CodeGen/CodeGeneration.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGen/CodeGeneration.cpp?rev=301669&r1=301668&r2=301669&view=diff
==============================================================================
--- polly/trunk/lib/CodeGen/CodeGeneration.cpp (original)
+++ polly/trunk/lib/CodeGen/CodeGeneration.cpp Fri Apr 28 14:08:20 2017
@@ -72,7 +72,7 @@ public:
   ///}
 
   void verifyGeneratedFunction(Scop &S, Function &F) {
-    if (!verifyFunction(F, &errs()) || !Verify)
+    if (!Verify || !verifyFunction(F, &errs()))
       return;
 
     DEBUG({




More information about the llvm-commits mailing list