[PATCH] D94142: [IR] Allow scalable vectors in structs to support intrinsics returning multiple values.

Kito Cheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 10 23:21:56 PST 2021


kito-cheng added a comment.

> This patch removes the existing restriction for this. I've modified
> StructType::isSized to consider a struct containing scalable vectors
> as unsized so the verifier won't allow loads/stores/allocas of these
> structs.

I worry about this will become a problem when we implement tuple type on C level,
clang will emit alloca & load & store no matter using -O0 or -O1.

For example following program:

  struct foo{
      int x;
  };
  
  int bar(void)
  {
      struct foo a;
      return a.x;
  }

Will emit following code:

  define i32 @bar() #0 {
    %1 = alloca %struct.foo, align 4
    %2 = getelementptr inbounds %struct.foo, %struct.foo* %1, i32 0, i32 0
    %3 = load i32, i32* %2, align 4
    ret i32 %3
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94142



More information about the llvm-commits mailing list