[PATCH] D101841: [Coroutines] Do not add alloca to the frame if the size is 0
Xun Li via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 6 08:33:22 PDT 2021
lxfind 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:
> 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?
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