[all-commits] [llvm/llvm-project] e02f49: [LoopIdiom] Merge TBAA of adjacent stores when cre...

Stephen Long via All-commits all-commits at lists.llvm.org
Wed Mar 30 16:55:16 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e02f4976acbf086904bf3903348603cc0f04e6ad
      https://github.com/llvm/llvm-project/commit/e02f4976acbf086904bf3903348603cc0f04e6ad
  Author: Stephen Long <steplong at quicinc.com>
  Date:   2022-03-30 (Wed, 30 Mar 2022)

  Changed paths:
    M llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
    M llvm/test/Transforms/LoopIdiom/memset-tbaa.ll

  Log Message:
  -----------
  [LoopIdiom] Merge TBAA of adjacent stores when creating memset

Factor in the TBAA of adjacent stores instead of just the head store
when merging stores into a memset. We were seeing GVN remove a load that
had a TBAA that matched the 2nd store because GVN determined it didn't
match the TBAA of the memset. The memset had the TBAA of only the first
store.

i.e. Loading the field pi_ of shared_count after memset to create an
array of shared_ptr

template<class T>
class shared_ptr {
  T *p;
  shared_count refcount;
};

class shared_count {
  sp_counted_base *pi_;
};

Differential Revision: https://reviews.llvm.org/D122205




More information about the All-commits mailing list