[PATCH] D82344: [NewPM] Allow passes to never be skipped

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 04:59:11 PDT 2020


ebrevnov added a comment.

This change causes problems to us. Even though "enable-npm-optnone" is false by default it affects us because we use custom pass instrumentation callback which causes passes to be skipped under some conditions.

Here is a short reproducer for the problem:

> opt -enable-new-pm  -enable-npm-optnone -passes=licm test.ll
> cat test.ll

define i32 @test1(i32 %a) #0 {
entry:

  br label %body

body:

  %i.0 = phi i32 [ 0, %entry ], [ %inc, %body ]
  %inc = add nsw i32 %i.0, 1
  %cmp = icmp slt i32 %i.0, %a
  br i1 %cmp, label %body, label %end

end:

  ret i32 %inc

}

attributes #0 = { optnone noinline }

It fails with assert(L->isRecursivelyLCSSAForm(LAR.DT, LI) && "Loops must remain in LCSSA form!") at FunctionToLoopPassAdaptor::run:311. The problem here is that LoopSimplify and LCSAA passes of LoopCanonicalizationFPM was skipped and we hit the assert. Interestingly, even if I move "if (!PI.runBeforePass<Loop>(Pass, *L)) continue;" from line 318 to be above the assert we still hit this assert. That happens because loop pass is PassManager itself and is not skipped. One possible solution which comes to my mind would be to run LCSSA verification pass by means of pass manger so it would be skipped by the same mechanism.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82344



More information about the llvm-commits mailing list