[llvm-bugs] [Bug 49667] New: [LegacyPassManager] PM need unexpectant order when adding pass Require

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 21 02:57:23 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=49667

            Bug ID: 49667
           Summary: [LegacyPassManager] PM need unexpectant  order when
                    adding pass Require
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Loop Optimizer
          Assignee: unassignedbugs at nondot.org
          Reporter: zhongyunde at tom.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24666
  --> https://bugs.llvm.org/attachment.cgi?id=24666&action=edit
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!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210321/6d793419/attachment.html>


More information about the llvm-bugs mailing list