[PATCH] D47624: [PM/LoopUnswitch] Fix PR37651 by correctly invalidating SCEV when unswitching loops.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 22:22:44 PDT 2018


chandlerc added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp:359
+    if (OuterL)
+      SE->forgetLoop(OuterL);
+    else
----------------
mkazantsev wrote:
> Why it is enough? Imagine that you have
>   for (...) { // Loop 1
>     for (...) { // Loop 2
>       for (...) { // Loop 3
>         ...
>        }
>     }
>   }
> 
> Let `L` be Loop 3 and all exits from `L` lead to Loop 2. Then, if I understand the code correctly, OuterL will be found as Loop 2 and we invalidate it (and its internals). But what if what we are going to do with Loop 3 also affects trip count in Loop 1?
Do you know how to build such a test case? I wasn't able to craft anything, but I'm not a SCEV expert.


Repository:
  rL LLVM

https://reviews.llvm.org/D47624





More information about the llvm-commits mailing list