[PATCH] D53706: [MultiTailCallElimination]: Pass to eliminate multiple tail calls

Martin Elshuber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 03:06:48 PST 2018


marels added inline comments.


================
Comment at: lib/Transforms/Scalar/MultiTailCallElimination.cpp:1507-1513
+      if (&*BBI == TI)
+        (&*BBI == E) {
+        StaticInst.push_back(&*BBI);
+        // Advance the current iteration interval to next candidate.
+        ++CandI;
+        continue;
+      }
----------------
john.brawn wrote:
> john.brawn wrote:
> > This doesn't even compile.  If I turn the condition into ((&*BBI == E) || (&*BBI == TI)) or one of those two on their own I get an assertion failure on ++CandI because CandI is Candidates.end().
> I looks like maybe the while(true) should be while(CandI != Candidates.end()). With that the tests pass at least.
I have no idea how I messed this up, but I did.

The issue is after my final tests, I did some cosmetics and added. Somehow a couple of lines got deleted. I found them in my local history. Big ups.

Although I am currently onto replying to the comments and will be included the fix the next update, please also find it below

```
diff --git a/lib/Transforms/Scalar/MultiTailCallElimination.cpp b/lib/Transforms/Scalar/MultiTailCallElimination.cpp
index ab4bff0..2dafdf1 100644
--- a/lib/Transforms/Scalar/MultiTailCallElimination.cpp
+++ b/lib/Transforms/Scalar/MultiTailCallElimination.cpp
@@ -1505,7 +1505,10 @@ private:

       // If we reached the terminator we are done.
       if (&*BBI == TI)
-        (&*BBI == E) {
+        break;
+
+      // The current search intervals end candidate is reached?
+      if (&*BBI == E) {
         StaticInst.push_back(&*BBI);
         // Advance the current iteration interval to next candidate.
         ++CandI;
``` 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53706/new/

https://reviews.llvm.org/D53706





More information about the llvm-commits mailing list