[polly] r309753 - [ForwardOpTree] Execute canForwardTree also in release builds.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 15:15:04 PDT 2017


Author: meinersbur
Date: Tue Aug  1 15:15:04 2017
New Revision: 309753

URL: http://llvm.org/viewvc/llvm-project?rev=309753&view=rev
Log:
[ForwardOpTree] Execute canForwardTree also in release builds.

Commit r309730 moved the call to canForwardTree into an assert(), even
though this function has side-effects if its DoIt parameter is true. To
avoid a warning in release builds, do an (void)Execution of its result
instead.

To avoid such confusion in the future, rename
canForwardTree() to forwardTree().

Modified:
    polly/trunk/lib/Transform/ForwardOpTree.cpp

Modified: polly/trunk/lib/Transform/ForwardOpTree.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Transform/ForwardOpTree.cpp?rev=309753&r1=309752&r2=309753&view=diff
==============================================================================
--- polly/trunk/lib/Transform/ForwardOpTree.cpp (original)
+++ polly/trunk/lib/Transform/ForwardOpTree.cpp Tue Aug  1 15:15:04 2017
@@ -137,9 +137,8 @@ private:
   ///
   /// @return If DoIt==false, return whether the operand tree can be forwarded.
   ///         If DoIt==true, return FD_DidForward.
-  ForwardingDecision canForwardTree(ScopStmt *TargetStmt, Value *UseVal,
-                                    ScopStmt *UseStmt, Loop *UseLoop,
-                                    bool DoIt) {
+  ForwardingDecision forwardTree(ScopStmt *TargetStmt, Value *UseVal,
+                                 ScopStmt *UseStmt, Loop *UseLoop, bool DoIt) {
     VirtualUse VUse = VirtualUse::create(UseStmt, UseLoop, UseVal, true);
     switch (VUse.getKind()) {
     case VirtualUse::Constant:
@@ -241,7 +240,7 @@ private:
 
       for (Value *OpVal : Inst->operand_values()) {
         ForwardingDecision OpDecision =
-            canForwardTree(TargetStmt, OpVal, DefStmt, DefLoop, DoIt);
+            forwardTree(TargetStmt, OpVal, DefStmt, DefLoop, DoIt);
         switch (OpDecision) {
         case FD_CannotForward:
           assert(!DoIt);
@@ -275,13 +274,16 @@ private:
     Loop *InLoop = Stmt->getSurroundingLoop();
 
     ForwardingDecision Assessment =
-        canForwardTree(Stmt, RA->getAccessValue(), Stmt, InLoop, false);
+        forwardTree(Stmt, RA->getAccessValue(), Stmt, InLoop, false);
     assert(Assessment != FD_DidForward);
     if (Assessment != FD_CanForwardTree)
       return false;
 
-    assert(canForwardTree(Stmt, RA->getAccessValue(), Stmt, InLoop, true) ==
-           FD_DidForward);
+    ForwardingDecision Execution =
+        forwardTree(Stmt, RA->getAccessValue(), Stmt, InLoop, true);
+    assert(Execution == FD_DidForward &&
+           "A previous positive assessment must also be executable");
+    (void)Execution;
 
     Stmt->removeSingleMemoryAccess(RA);
     return true;




More information about the llvm-commits mailing list