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

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 11:15:58 PDT 2020


aeubanks added a comment.

In D82344#2185182 <https://reviews.llvm.org/D82344#2185182>, @ychen wrote:

> In D82344#2184414 <https://reviews.llvm.org/D82344#2184414>, @ebrevnov wrote:
>
>> 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.
>
> Thanks. Confirmed. Considering it is a debugging feature like pass logging, I think I'm going to add another BeforeNonSkipped callback (D84774 <https://reviews.llvm.org/D84774>) to run this since it is probably useful to verify other IR unit before/after a real pass in the future.

+1, thanks!


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