[PATCH] D145350: [PowerPC] Check if the latch block is in the value list for the PHI before get the incoming value.
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 6 02:37:25 PST 2023
shchenz added inline comments.
================
Comment at: llvm/test/CodeGen/PowerPC/loop-instr-form-non-inc.ll:5
+
+define dso_local void @test_no_inc(ptr nocapture noundef nonnull readnone align 1 dereferenceable(1) %this, ptr noundef nonnull align 1 dereferenceable(1) %j) local_unnamed_addr #0 align 2 {
+; CHECK-LABEL: test_no_inc:
----------------
This is a reduced case from bugpoint:
```
define dso_local void @test_no_inc() local_unnamed_addr align 2 {
entry:
%call = tail call noundef i32 @_ZN1e1fEv()
%cmp10 = icmp sgt i32 %call, 0
br label %for.cond
for.cond: ; preds = %for.cond.cleanup, %entry
%g.0 = phi i32 [ 1, %entry ], [ %g.1.lcssa, %for.cond.cleanup ]
br i1 %cmp10, label %for.body.preheader, label %for.cond.cleanup
for.body.preheader: ; preds = %for.cond
%0 = add i32 %call, %g.0
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.body.preheader, %for.cond
%g.1.lcssa = phi i32 [ %g.0, %for.cond ], [ %0, %for.body.preheader ]
%arrayidx5 = getelementptr inbounds i8, ptr null, i32 %g.1.lcssa
store i8 0, ptr %arrayidx5, align 1
br label %for.cond
}
declare noundef i32 @_ZN1e1fEv() local_unnamed_addr
```
This should be able to further reduce, for example, using a parameter for `%call`, so that we can remove the external function call. And also we can add `nounwind` to the function, so that the cfi related instructions will not be generated.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145350/new/
https://reviews.llvm.org/D145350
More information about the llvm-commits
mailing list