<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [LegacyPassManager] PM need unexpectant order when adding pass Require"
   href="https://bugs.llvm.org/show_bug.cgi?id=49667">49667</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[LegacyPassManager] PM need unexpectant  order when adding pass Require
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Loop Optimizer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zhongyunde@tom.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24666" name="attach_24666" title="test case from the classic flang runtime library libpgmath file kidnnt.c">attachment 24666</a> <a href="attachment.cgi?id=24666&action=edit" title="test case from the classic flang runtime library libpgmath file kidnnt.c">[details]</a></span>
test case from the classic flang runtime library libpgmath file kidnnt.c

base the the newest trunk, git commit a3545a0b0, then with following patch, the
compile can pass the very simple test case kidnnt.c attached. while if the
AU.addRequired<LazyValueInfoWrapperPass>() use the commented version, which
place it before the InjectTLIMappingsLegacy, then the compile will failed with 
 Crash.

+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -83,6 +83,7 @@
 #include "llvm/Analysis/CodeMetrics.h"
 #include "llvm/Analysis/DemandedBits.h"
 #include "llvm/Analysis/GlobalsModRef.h"
+#include "llvm/Analysis/LazyValueInfo.h"
 #include "llvm/Analysis/LoopAccessAnalysis.h"
 #include "llvm/Analysis/LoopAnalysisManager.h"
 #include "llvm/Analysis/LoopInfo.h"
@@ -1986,7 +1987,9 @@ struct LoopVectorize : public FunctionPass {
     AU.addRequired<LoopAccessLegacyAnalysis>();
     AU.addRequired<DemandedBitsWrapperPass>();
     AU.addRequired<OptimizationRemarkEmitterWrapperPass>();
+    //AU.addRequired<LazyValueInfoWrapperPass>();
     AU.addRequired<InjectTLIMappingsLegacy>();
+    AU.addRequired<LazyValueInfoWrapperPass>();

     // We currently do not preserve loopinfo/dominator analyses with outer
loop
     // vectorization. Until this is addressed, mark these analyses as
preserved
@@ -7495,6 +7498,7 @@ INITIALIZE_PASS_DEPENDENCY(LoopAccessLegacyAnalysis)
 INITIALIZE_PASS_DEPENDENCY(DemandedBitsWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(OptimizationRemarkEmitterWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(ProfileSummaryInfoWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(LazyValueInfoWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(InjectTLIMappingsLegacy)




test case compiled with -O3, such as: clang -c ~/kidnnt.c  -O3
=================== test case =================
long long __mth_i_kidnnt(double d)
{
    return ( (long long)(d));
}

================= Crash  Information =========================
Unable to schedule 'ScalarEvolution-based Alias Analysis' required by 'SLP
Vectorizer'
Unable to schedule pass
UNREACHABLE executed at
/home/zyd/llvm-project-dev_12x/llvm/lib/IR/LegacyPassManager.cpp:1294!</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>