[PATCH] D101841: [Coroutines] Do not add alloca to the frame if the size is 0

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 04:23:02 PDT 2021


ChuanqiXu added inline comments.


================
Comment at: llvm/test/Transforms/Coroutines/coro-zero-alloca.ll:64-81
+; CHECK-LABEL: define internal fastcc void @foo.resume(%foo.Frame* noalias nonnull align 8 dereferenceable(24) %FramePtr) {
+; CHECK-NEXT:    entry.resume:
+; CHECK-NEXT:      %vFrame = bitcast %foo.Frame* %FramePtr to i8*
+; CHECK-NEXT:      %a1.reload.addr = getelementptr inbounds %foo.Frame, %foo.Frame* %FramePtr, i64 0, i32 2
+; CHECK-NEXT:      %a4.reload.addr = getelementptr inbounds %foo.Frame, %foo.Frame* %FramePtr, i64 0, i32 3
+; CHECK-NEXT:      %a0.reload.addr = bitcast %foo.Frame* %FramePtr to [0 x i8]*
+; CHECK-NEXT:      %a4.cast = bitcast i16* %a4.reload.addr to i8*
----------------
djtodoro wrote:
> ChuanqiXu wrote:
> > djtodoro wrote:
> > > djtodoro wrote:
> > > > ChuanqiXu wrote:
> > > > > rjmccall wrote:
> > > > > > lxfind wrote:
> > > > > > > ChuanqiXu wrote:
> > > > > > > > The checks for foo.resume fails in my environment. My output was:
> > > > > > > > ```
> > > > > > > > define internal fastcc void @foo.resume(%foo.Frame* noalias nonnull align 8 dereferenceable(24) %FramePtr) {
> > > > > > > > entry.resume:
> > > > > > > >   %vFrame = bitcast %foo.Frame* %FramePtr to i8*
> > > > > > > >   %a1.reload.addr = getelementptr inbounds %foo.Frame, %foo.Frame* %FramePtr, i64 0, i32 2
> > > > > > > >   %a4.reload.addr = getelementptr inbounds %foo.Frame, %foo.Frame* %FramePtr, i64 0, i32 3
> > > > > > > >   %a0.reload.addr = bitcast %foo.Frame* %FramePtr to [0 x i8]*
> > > > > > > >   %a4.cast = bitcast i16* %a4.reload.addr to i8*
> > > > > > > >   %a1.cast = bitcast i32* %a1.reload.addr to i8*
> > > > > > > >   tail call void @usePointer(i8* nonnull %vFrame)
> > > > > > > >   tail call void @usePointer(i8* nonnull %a1.cast)
> > > > > > > >   tail call void @usePointer(i8* nonnull %vFrame)
> > > > > > > >   tail call void @usePointer(i8* nonnull %vFrame)
> > > > > > > >   tail call void @usePointer(i8* nonnull %a4.cast)
> > > > > > > >   tail call void @usePointer2([0 x i8]* nonnull %a0.reload.addr)
> > > > > > > >   tail call void @free(i8* nonnull %vFrame)
> > > > > > > >   ret void
> > > > > > > > }
> > > > > > > > ```
> > > > > > > > It also looks good without failing to match.
> > > > > > > That's strange. Seems the frame placement isn't deterministic?
> > > > > > `a3.cast` is a redundant bitcast, which some passes will eliminate.  Maybe the test is accidentally testing more than just the result of the split pass?
> > > > > My bad. It looks like I pollute my code locally. After I cloned a new version, everything looks good.
> > > > I think that this test still fails: https://lab.llvm.org/buildbot/#/builders/123/builds/3751
> > > > 
> > > > On my RHEL7, it also fails.
> > > ping
> > It is really interesting. I fix this problem by cloning a new clean LLVM source. Did you try that?
> It is still failing on my machine.
Do you test this with upstream or downstream? It is OK in trunk in my machine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101841



More information about the llvm-commits mailing list