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

Marek Kurdej via All-commits all-commits at lists.llvm.org
Thu Jun 9 13:08:07 PDT 2022


  Branch: refs/heads/release/14.x
  Home:   https://github.com/llvm/llvm-project
  Commit: d350783a0520d09eb61e2eca1cd61c9cdac00908
      https://github.com/llvm/llvm-project/commit/d350783a0520d09eb61e2eca1cd61c9cdac00908
  Author: Stephen Long <steplong at quicinc.com>
  Date:   2022-06-08 (Wed, 08 Jun 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

(cherry picked from commit e02f4976acbf086904bf3903348603cc0f04e6ad)


  Commit: 3cd9df8443f8d5bd308e2417a77bebeef5264327
      https://github.com/llvm/llvm-project/commit/3cd9df8443f8d5bd308e2417a77bebeef5264327
  Author: Marek Kurdej <marek.kurdej+llvm.org at gmail.com>
  Date:   2022-06-09 (Thu, 09 Jun 2022)

  Changed paths:
    M clang/lib/Format/WhitespaceManager.cpp
    M clang/unittests/Format/FormatTest.cpp

  Log Message:
  -----------
  [clang-format] Fix PointerAlignment: Right not working with tab indentation.

Fixes https://github.com/llvm/llvm-project/issues/55407.

Given configuration:
```
UseTab: Always
PointerAlignment: Right
AlignConsecutiveDeclarations: true
```

Before, the pointer was misaligned in this code:
```
void f() {
	unsigned long long big;
	char	      *ptr; // misaligned
	int		   i;
}
```

That was due to the fact that when handling right-aligned pointers, the Spaces were changed but StartOfTokenColumn was not.

Also, a tab was used not only for indentation but for spacing too when using `UseTab: ForIndentation` config option:
```
void f() {
	unsigned long long big;
	char	      *ptr; // \t after char
	int                i;
}
```

Reviewed By: owenpan

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


Compare: https://github.com/llvm/llvm-project/compare/198626ad43fd...3cd9df8443f8


More information about the All-commits mailing list