<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 5:25 PM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: chapuni<br>
Date: Wed Mar  4 19:25:12 2015<br>
New Revision: 231335<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=231335&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=231335&view=rev</a><br>
Log:<br>
Revert r231103, "FullDependenceAnalysis: Avoid using the (deprecated in C++11) copy ctor"<br>
<br>
It is miscompiled on msc18.<br></blockquote><div><br>Any ideas on what the miscompile was? Or workarounds that avoid tickling it? It'd probably be handy to know what tickles this sort of thing so we can recognize/avoid it in the future in other places.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Modified:<br>
    llvm/trunk/lib/Analysis/DependenceAnalysis.cpp<br>
<br>
Modified: llvm/trunk/lib/Analysis/DependenceAnalysis.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=231335&r1=231334&r2=231335&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DependenceAnalysis.cpp?rev=231335&r1=231334&r2=231335&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Analysis/DependenceAnalysis.cpp (original)<br>
+++ llvm/trunk/lib/Analysis/DependenceAnalysis.cpp Wed Mar  4 19:25:12 2015<br>
@@ -3334,8 +3334,7 @@ DependenceAnalysis::depends(Instruction<br>
   DEBUG(dbgs() << "    common nesting levels = " << CommonLevels << "\n");<br>
   DEBUG(dbgs() << "    maximum nesting levels = " << MaxLevels << "\n");<br>
<br>
-  auto Result = llvm::make_unique<FullDependence>(<br>
-      Src, Dst, PossiblyLoopIndependent, CommonLevels);<br>
+  FullDependence Result(Src, Dst, PossiblyLoopIndependent, CommonLevels);<br>
   ++TotalArrayPairs;<br>
<br>
   // See if there are GEPs we can use.<br>
@@ -3473,7 +3472,7 @@ DependenceAnalysis::depends(Instruction<br>
       collectCommonLoops(Pair[SI].Dst,<br>
                          LI->getLoopFor(Dst->getParent()),<br>
                          Pair[SI].Loops);<br>
-      Result->Consistent = false;<br>
+      Result.Consistent = false;<br>
     }<br>
     else if (Pair[SI].Classification == Subscript::ZIV) {<br>
       // always separable<br>
@@ -3520,26 +3519,26 @@ DependenceAnalysis::depends(Instruction<br>
     switch (Pair[SI].Classification) {<br>
     case Subscript::ZIV:<br>
       DEBUG(dbgs() << ", ZIV\n");<br>
-      if (testZIV(Pair[SI].Src, Pair[SI].Dst, *Result))<br>
+      if (testZIV(Pair[SI].Src, Pair[SI].Dst, Result))<br>
         return nullptr;<br>
       break;<br>
     case Subscript::SIV: {<br>
       DEBUG(dbgs() << ", SIV\n");<br>
       unsigned Level;<br>
       const SCEV *SplitIter = nullptr;<br>
-      if (testSIV(Pair[SI].Src, Pair[SI].Dst, Level, *Result, NewConstraint,<br>
-                  SplitIter))<br>
+      if (testSIV(Pair[SI].Src, Pair[SI].Dst, Level,<br>
+                  Result, NewConstraint, SplitIter))<br>
         return nullptr;<br>
       break;<br>
     }<br>
     case Subscript::RDIV:<br>
       DEBUG(dbgs() << ", RDIV\n");<br>
-      if (testRDIV(Pair[SI].Src, Pair[SI].Dst, *Result))<br>
+      if (testRDIV(Pair[SI].Src, Pair[SI].Dst, Result))<br>
         return nullptr;<br>
       break;<br>
     case Subscript::MIV:<br>
       DEBUG(dbgs() << ", MIV\n");<br>
-      if (testMIV(Pair[SI].Src, Pair[SI].Dst, Pair[SI].Loops, *Result))<br>
+      if (testMIV(Pair[SI].Src, Pair[SI].Dst, Pair[SI].Loops, Result))<br>
         return nullptr;<br>
       break;<br>
     default:<br>
@@ -3576,8 +3575,8 @@ DependenceAnalysis::depends(Instruction<br>
           unsigned Level;<br>
           const SCEV *SplitIter = nullptr;<br>
           DEBUG(dbgs() << "SIV\n");<br>
-          if (testSIV(Pair[SJ].Src, Pair[SJ].Dst, Level, *Result, NewConstraint,<br>
-                      SplitIter))<br>
+          if (testSIV(Pair[SJ].Src, Pair[SJ].Dst, Level,<br>
+                      Result, NewConstraint, SplitIter))<br>
             return nullptr;<br>
           ConstrainedLevels.set(Level);<br>
           if (intersectConstraints(&Constraints[Level], &NewConstraint)) {<br>
@@ -3598,7 +3597,7 @@ DependenceAnalysis::depends(Instruction<br>
             // SJ is an MIV subscript that's part of the current coupled group<br>
             DEBUG(dbgs() << "\tSJ = " << SJ << "\n");<br>
             if (propagate(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops,<br>
-                          Constraints, Result->Consistent)) {<br>
+                          Constraints, Result.Consistent)) {<br>
               DEBUG(dbgs() << "\t    Changed\n");<br>
               ++DeltaPropagations;<br>
               Pair[SJ].Classification =<br>
@@ -3608,7 +3607,7 @@ DependenceAnalysis::depends(Instruction<br>
               switch (Pair[SJ].Classification) {<br>
               case Subscript::ZIV:<br>
                 DEBUG(dbgs() << "ZIV\n");<br>
-                if (testZIV(Pair[SJ].Src, Pair[SJ].Dst, *Result))<br>
+                if (testZIV(Pair[SJ].Src, Pair[SJ].Dst, Result))<br>
                   return nullptr;<br>
                 Mivs.reset(SJ);<br>
                 break;<br>
@@ -3631,7 +3630,7 @@ DependenceAnalysis::depends(Instruction<br>
       for (int SJ = Mivs.find_first(); SJ >= 0; SJ = Mivs.find_next(SJ)) {<br>
         if (Pair[SJ].Classification == Subscript::RDIV) {<br>
           DEBUG(dbgs() << "RDIV test\n");<br>
-          if (testRDIV(Pair[SJ].Src, Pair[SJ].Dst, *Result))<br>
+          if (testRDIV(Pair[SJ].Src, Pair[SJ].Dst, Result))<br>
             return nullptr;<br>
           // I don't yet understand how to propagate RDIV results<br>
           Mivs.reset(SJ);<br>
@@ -3644,19 +3643,19 @@ DependenceAnalysis::depends(Instruction<br>
       for (int SJ = Mivs.find_first(); SJ >= 0; SJ = Mivs.find_next(SJ)) {<br>
         if (Pair[SJ].Classification == Subscript::MIV) {<br>
           DEBUG(dbgs() << "MIV test\n");<br>
-          if (testMIV(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops, *Result))<br>
+          if (testMIV(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops, Result))<br>
             return nullptr;<br>
         }<br>
         else<br>
           llvm_unreachable("expected only MIV subscripts at this point");<br>
       }<br>
<br>
-      // update Result->DV from constraint vector<br>
+      // update Result.DV from constraint vector<br>
       DEBUG(dbgs() << "    updating\n");<br>
       for (int SJ = ConstrainedLevels.find_first();<br>
            SJ >= 0; SJ = ConstrainedLevels.find_next(SJ)) {<br>
-        updateDirection(Result->DV[SJ - 1], Constraints[SJ]);<br>
-        if (Result->DV[SJ - 1].Direction == Dependence::DVEntry::NONE)<br>
+        updateDirection(Result.DV[SJ - 1], Constraints[SJ]);<br>
+        if (Result.DV[SJ - 1].Direction == Dependence::DVEntry::NONE)<br>
           return nullptr;<br>
       }<br>
     }<br>
@@ -3668,15 +3667,15 @@ DependenceAnalysis::depends(Instruction<br>
     CompleteLoops |= Pair[SI].Loops;<br>
   for (unsigned II = 1; II <= CommonLevels; ++II)<br>
     if (CompleteLoops[II])<br>
-      Result->DV[II - 1].Scalar = false;<br>
+      Result.DV[II - 1].Scalar = false;<br>
<br>
   if (PossiblyLoopIndependent) {<br>
     // Make sure the LoopIndependent flag is set correctly.<br>
     // All directions must include equal, otherwise no<br>
     // loop-independent dependence is possible.<br>
     for (unsigned II = 1; II <= CommonLevels; ++II) {<br>
-      if (!(Result->getDirection(II) & Dependence::DVEntry::EQ)) {<br>
-        Result->LoopIndependent = false;<br>
+      if (!(Result.getDirection(II) & Dependence::DVEntry::EQ)) {<br>
+        Result.LoopIndependent = false;<br>
         break;<br>
       }<br>
     }<br>
@@ -3686,7 +3685,7 @@ DependenceAnalysis::depends(Instruction<br>
     // loop-independent dependence possible, then no dependence exists.<br>
     bool AllEqual = true;<br>
     for (unsigned II = 1; II <= CommonLevels; ++II) {<br>
-      if (Result->getDirection(II) != Dependence::DVEntry::EQ) {<br>
+      if (Result.getDirection(II) != Dependence::DVEntry::EQ) {<br>
         AllEqual = false;<br>
         break;<br>
       }<br>
@@ -3695,7 +3694,9 @@ DependenceAnalysis::depends(Instruction<br>
       return nullptr;<br>
   }<br>
<br>
-  return std::move(Result);<br>
+  auto Final = make_unique<FullDependence>(Result);<br>
+  Result.DV = nullptr;<br>
+  return std::move(Final);<br>
 }<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>