[llvm] r314857 - [AArch64] Use LateSimplifyCFG after expanding atomic operations.

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 10:53:33 PDT 2017


On 4 October 2017 at 18:58, Balaram Makam <bmakam at codeaurora.org> wrote:
> My guess is that we now run LateSimplifyCFG after atomic-expand so this modifies the CFG in MachineBranchProb.ll and triggers a failure. I assume any changes to the CFG will trigger a failure to this test and modifying the test to expect the new CFG is not a right fix. The test must be made robust to CFG changes. However, I do not have a way to test this as it passes on my machine.
> Do you have a simple reproducer?

Uh, not really, I'll send you one tomorrow!

> Thanks,
> Balaram
> -----Original Message-----
> From: Diana Picus [mailto:diana.picus at linaro.org]
> Sent: Wednesday, October 04, 2017 12:53 PM
> To: Balaram Makam <bmakam at codeaurora.org>
> Cc: llvm-commits <llvm-commits at lists.llvm.org>
> Subject: Re: [llvm] r314857 - [AArch64] Use LateSimplifyCFG after expanding atomic operations.
>
> That's a reasonable fix for now. Can you root cause it though?
>
> Thanks,
> Diana
>
> On 4 October 2017 at 18:49, Balaram Makam <bmakam at codeaurora.org> wrote:
>> I went ahead and committed:
>> [r314912] "[ARM] Mark flaky test MachineBranchProb.ll unsupported again for ARM/AArch64"
>>
>> commit 33762fbab78fd28b9f162fd1093a8a91c7f41b6e
>> Author: bmakam <bmakam at 91177308-0d34-0410-b5e6-96231b3b80d8>
>> Date:   Wed Oct 4 16:45:24 2017 +0000
>>
>>     "[ARM] Mark flaky test MachineBranchProb.ll unsupported again for ARM/AArch64"
>>
>>     r314857 changed the CFG that resulted in the flaky test MachineBranchProb.ll to
>>     fail the bots again. Marking it as unsupported for ARM/AArch64 again until we
>>     find the cause.
>>
>>     git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314912
>> 91177308-0d34-0410-b5e6-96231b3b80d8
>>
>> test/CodeGen/Generic/MachineBranchProb.ll
>>
>> Thanks,
>> Balaram
>> -----Original Message-----
>> From: Balaram Makam [mailto:bmakam at codeaurora.org]
>> Sent: Wednesday, October 04, 2017 12:24 PM
>> To: 'Balaram Makam' <bmakam at codeaurora.org>; 'Diana Picus'
>> <diana.picus at linaro.org>
>> Cc: 'llvm-commits' <llvm-commits at lists.llvm.org>
>> Subject: RE: [llvm] r314857 - [AArch64] Use LateSimplifyCFG after expanding atomic operations.
>>
>> Hi Diana,
>>
>> I can't reproduce the lit failure on my machine. Looking at the git history this test seems to be very flaky and prone to break if we run extra SimplifyCFG which disrupts this test.
>> Can we mark this flaky test as unsupported again as was done in r298887 before, until we find the cause?
>>
>> Thanks,
>> Balaram
>>
>> -----Original Message-----
>> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
>> Behalf Of Balaram Makam via llvm-commits
>> Sent: Wednesday, October 04, 2017 11:08 AM
>> To: 'Diana Picus' <diana.picus at linaro.org>
>> Cc: 'llvm-commits' <llvm-commits at lists.llvm.org>
>> Subject: RE: [llvm] r314857 - [AArch64] Use LateSimplifyCFG after expanding atomic operations.
>>
>> Sorry for the breakage. It's due to a lit test:
>> test/CodeGen/Generic/MachineBranchProb.ll
>> My ninja check did not catch this failure.
>> Hopefully it will be an easy fix, otherwise I'll revert and investigate.
>>
>> Thanks for your patience,
>> Balaram.
>>
>> -----Original Message-----
>> From: Diana Picus [mailto:diana.picus at linaro.org]
>> Sent: Wednesday, October 04, 2017 8:19 AM
>> To: Balaram Makam <bmakam at codeaurora.org>
>> Cc: llvm-commits <llvm-commits at lists.llvm.org>
>> Subject: Re: [llvm] r314857 - [AArch64] Use LateSimplifyCFG after expanding atomic operations.
>>
>> Hi,
>>
>> I think this broke one of our aarch64 bots. Could you please fix/revert?
>> http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/888
>> 1
>>
>> Thanks,
>> Diana
>>
>> On 4 October 2017 at 00:39, Balaram Makam via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>> Author: bmakam
>>> Date: Tue Oct  3 15:39:24 2017
>>> New Revision: 314857
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=314857&view=rev
>>> Log:
>>> [AArch64] Use LateSimplifyCFG after expanding atomic operations.
>>>
>>> Summary:
>>> After r308422 we defer optimizations that can destroy loop canonical
>>> forms to LateSimplifyCFG. Running LateSimplifyCFG after expanding
>>> atomic operations can exploit more control-flow opportunities.
>>>
>>> Reviewers: mcrosier, t.p.northover, efriedma
>>>
>>> Reviewed By: efriedma
>>>
>>> Subscribers: aemerson, rengolin, javed.absar, llvm-commits,
>>> kristof.beyls
>>>
>>> Differential Revision: https://reviews.llvm.org/D38262
>>>
>>> Modified:
>>>     llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
>>>     llvm/trunk/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll
>>>     llvm/trunk/test/CodeGen/AArch64/cmpxchg-idioms.ll
>>>
>>> Modified: llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AAr
>>> c h64TargetMachine.cpp?rev=314857&r1=314856&r2=314857&view=diff
>>> =====================================================================
>>> =
>>> ========
>>> --- llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp (original)
>>> +++ llvm/trunk/lib/Target/AArch64/AArch64TargetMachine.cpp Tue Oct  3
>>> +++ 15:39:24 2017
>>> @@ -365,7 +365,7 @@ void AArch64PassConfig::addIRPasses() {
>>>    // determine whether it succeeded. We can exploit existing control-flow in
>>>    // ldrex/strex loops to simplify this, but it needs tidying up.
>>>    if (TM->getOptLevel() != CodeGenOpt::None && EnableAtomicTidy)
>>> -    addPass(createCFGSimplificationPass());
>>> +    addPass(createLateCFGSimplificationPass());
>>>
>>>    // Run LoopDataPrefetch
>>>    //
>>>
>>> Modified: llvm/trunk/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/a
>>> a rch64-loop-gep-opt.ll?rev=314857&r1=314856&r2=314857&view=diff
>>> =====================================================================
>>> =
>>> ========
>>> --- llvm/trunk/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll
>>> (original)
>>> +++ llvm/trunk/test/CodeGen/AArch64/aarch64-loop-gep-opt.ll Tue Oct
>>> +++ 3
>>> +++ 15:39:24 2017
>>> @@ -19,9 +19,9 @@ entry:
>>>
>>>  do.body.i:
>>>  ; CHECK-LABEL: do.body.i:
>>> -; CHECK:          %uglygep1 = getelementptr i8, i8* %uglygep, i64 %3
>>> -; CHECK-NEXT:     %4 = bitcast i8* %uglygep1 to i32*
>>> -; CHECK-NOT:      %uglygep1 = getelementptr i8, i8* %uglygep, i64 1032
>>> +; CHECK:          %uglygep2 = getelementptr i8, i8* %uglygep, i64 %3
>>> +; CHECK-NEXT:     %4 = bitcast i8* %uglygep2 to i32*
>>> +; CHECK-NOT:      %uglygep2 = getelementptr i8, i8* %uglygep, i64 1032
>>>
>>>
>>>    %0 = phi i32 [ 256, %entry ], [ %.be, %do.body.i.backedge ]
>>>
>>> Modified: llvm/trunk/test/CodeGen/AArch64/cmpxchg-idioms.ll
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/c
>>> m pxchg-idioms.ll?rev=314857&r1=314856&r2=314857&view=diff
>>> =====================================================================
>>> =
>>> ========
>>> --- llvm/trunk/test/CodeGen/AArch64/cmpxchg-idioms.ll (original)
>>> +++ llvm/trunk/test/CodeGen/AArch64/cmpxchg-idioms.ll Tue Oct  3
>>> +++ 15:39:24 2017
>>> @@ -91,3 +91,63 @@ end:
>>>
>>>  declare void @bar()
>>>  declare void @baz()
>>> +
>>> +define i1 @test_conditional2(i32 %a, i32 %b, i32* %c) { ;
>>> +CHECK-LABEL: test_conditional2:
>>> +; CHECK: [[LOOP:LBB[0-9]+_[0-9]+]]:
>>> +; CHECK: ldaxr [[LOADED:w[0-9]+]], [x19] ; CHECK: cmp [[LOADED]],
>>> +w21 ; CHECK: b.ne [[FAILED:LBB[0-9]+_[0-9]+]]
>>> +
>>> +; CHECK: stlxr [[STATUS:w[0-9]+]], w20, [x19] ; CHECK: cbnz
>>> +[[STATUS]], [[LOOP]] ; CHECK: orr [[STATUS]], wzr, #0x1 ; CHECK: b
>>> +[[PH:LBB[0-9]+_[0-9]+]]
>>> +
>>> +; CHECK: [[FAILED]]:
>>> +; CHECK-NOT: cmp {{w[0-9]+}}, {{w[0-9]+}}
>>> +
>>> +; verify the preheader is simplified by latesimplifycfg.
>>> +; CHECK: [[PH]]:
>>> +; CHECK: orr w22, wzr, #0x2
>>> +; CHECK-NOT: orr w22, wzr, #0x4
>>> +; CHECK-NOT: cmn w22, #4
>>> +; CHECK: b [[LOOP2:LBB[0-9]+_[0-9]+]] ; CHECK-NOT: b.ne [[LOOP2]] ;
>>> +CHECK-NOT: b {{LBB[0-9]+_[0-9]+}} ; CHECK: bl _foo
>>> +entry:
>>> +  %pair = cmpxchg i32* %c, i32 %a, i32 %b seq_cst seq_cst
>>> +  %success = extractvalue { i32, i1 } %pair, 1
>>> +  br label %for.cond
>>> +
>>> +for.cond:                                         ; preds = %if.end, %entry
>>> +  %i.0 = phi i32 [ 2, %entry ], [ %dec, %if.end ]
>>> +  %changed.0.off0 = phi i1 [ %success, %entry ], [ %changed.1.off0,
>>> +%if.end ]
>>> +  %dec = add nsw i32 %i.0, -1
>>> +  %tobool = icmp eq i32 %i.0, 0
>>> +  br i1 %tobool, label %for.cond.cleanup, label %for.body
>>> +
>>> +for.cond.cleanup:                                 ; preds = %for.cond
>>> +  %changed.0.off0.lcssa = phi i1 [ %changed.0.off0, %for.cond ]
>>> +  ret i1 %changed.0.off0.lcssa
>>> +
>>> +for.body:                                         ; preds = %for.cond
>>> +  %or = or i32 %a, %b
>>> +  %idxprom = sext i32 %dec to i64
>>> +  %arrayidx = getelementptr inbounds i32, i32* %c, i64 %idxprom
>>> +  %0 = load i32, i32* %arrayidx, align 4
>>> +  %cmp = icmp eq i32 %or, %0
>>> +  br i1 %cmp, label %if.end, label %if.then
>>> +
>>> +if.then:                                          ; preds = %for.body
>>> +  store i32 %or, i32* %arrayidx, align 4
>>> +  tail call void @foo()
>>> +  br label %if.end
>>> +
>>> +if.end:                                           ; preds = %for.body, %if.then
>>> +  %changed.1.off0 = phi i1 [ false, %if.then ], [ %changed.0.off0,
>>> +%for.body ]
>>> +  br label %for.cond
>>> +}
>>> +
>>> +declare void @foo()
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>


More information about the llvm-commits mailing list