Skip to content

Conversation

@cme
Copy link

@cme cme commented Mar 20, 2023

Avoid changing multiple stores to 'memset' calls when when the stores can be combined into a smaller number of stores by SelectionDAG when some alignment information is available on some stores.

@cme cme requested a review from draganmladjenovic March 20, 2023 17:47
Avoid changing multiple stores to 'memset' calls when when the
stores can be combined into a smaller number of stores by SelectionDAG
when some alignment information is available on some stores.
@cme cme force-pushed the nanomips-llvm13-memcopyopt-heuristics branch from 8024c95 to d662c71 Compare March 20, 2023 19:46
Copy link

@draganmladjenovic draganmladjenovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@cme cme closed this May 22, 2023
@cme cme reopened this Jul 7, 2023
@cme cme changed the base branch from nanomips-llvm13-submission to nanomips July 7, 2023 20:09
@cme cme merged commit efeed9e into nanomips Jul 7, 2023
cme pushed a commit that referenced this pull request Sep 18, 2023
For the following program,
  $ cat t.c
  struct t {
   int (__attribute__((btf_type_tag("rcu"))) *f)();
   int a;
  };
  int foo(struct t *arg) {
    return arg->a;
  }
Compiling with 'clang -g -O2 -S t.c' will cause a failure like below:
  clang: /home/yhs/work/llvm-project/clang/lib/Sema/SemaType.cpp:6391: void {anonymous}::DeclaratorLocFiller::VisitParenTypeLoc(clang::ParenTypeLoc):
         Assertion `Chunk.Kind == DeclaratorChunk::Paren' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  ......
  #5 0x00007f89e4280ea5 abort (/lib64/libc.so.6+0x21ea5)
  #6 0x00007f89e4280d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
  #7 0x00007f89e42a6456 (/lib64/libc.so.6+0x47456)
  #8 0x00000000045c2596 GetTypeSourceInfoForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  #9 0x00000000045ccfa5 GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  ......

The reason of the failure is due to the mismatch of TypeLoc and D.getTypeObject().Kind. For example,
the TypeLoc is
  BTFTagAttributedType 0x88614e0 'int  btf_type_tag(rcu)()' sugar
  |-ParenType 0x8861480 'int ()' sugar
  | `-FunctionNoProtoType 0x8861450 'int ()' cdecl
  |   `-BuiltinType 0x87fd500 'int'
while corresponding D.getTypeObject().Kind points to DeclaratorChunk::Paren, and
this will cause later assertion.

To fix the issue, similar to AttributedTypeLoc, let us skip BTFTagAttributedTypeLoc in
GetTypeSourceInfoForDeclarator().

Differential Revision: https://reviews.llvm.org/D136807
farazs-github pushed a commit that referenced this pull request Mar 11, 2024
…euristics

Improve MemCopyOpt heuristics to account for combinable stores
milica-lazarevic pushed a commit that referenced this pull request Jun 18, 2024
…euristics

Improve MemCopyOpt heuristics to account for combinable stores
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants