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

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 06:57:14 PDT 2021


djtodoro 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*
----------------
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.


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