[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-08-26 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added a comment.

In D61879#1621423 , @vitalybuka wrote:

> Fix https://godbolt.org/z/-PinQP


Please consider adding a test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-08-08 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka updated this revision to Diff 214183.
vitalybuka added a comment.

Fix https://godbolt.org/z/-PinQP


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/dsae.ll
  llvm/test/Other/dse-exp-struct.ll
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -39,7 +39,7 @@
   cflags += [ "-g" ]
 }
 if (is_optimized) {
-  cflags += [ "-Oz" ]
+  cflags += [ "-O3" ]
 }
 if (is_new_pm) {
   cflags += [ 
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; 

[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-30 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added a comment.

Vitaly, what's the current status of these patches? What's your plan on 
submitting them?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-20 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka updated this revision to Diff 210950.
vitalybuka added a comment.

fix LTO on kernel


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; Third example from Doc/Coroutines.rst (two suspend points)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex2.ll
===
--- llvm/test/Transforms/Coroutines/ex2.ll
+++ llvm/test/Transforms/Coroutines/ex2.ll
@@ -1,6 +1,8 @@
 ; Second example from Doc/Coroutines.rst (custom alloc 

[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-16 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka marked an inline comment as done.
vitalybuka added inline comments.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:27
+static const char GlobalArgumentMemAccess[] = {
+// grep  -P -o "(?<=FUNCTION_INFO: ).*"  | sort -u >
+// ../llvm-project/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpData.h

glider wrote:
> vitalybuka wrote:
> > glider wrote:
> > > Ditto.
> > These files should be empty. Raw diff 
> > https://reviews.llvm.org/file/data/o6sk6gw2gqs4u4pmodrn/PHID-FILE-s6c6nsofxnqekkcvzdzs/D61879.diff
> >  already contains them. 
> > It's ThinLTO replacement experiments. They don't improve results enough, so 
> > I didn't bother to create real ThinLTO stuff. Anyway it is not needed for 
> > full LTO.
> > 
> ```
> $ ninja -j64 check-clang
> ...
> /usr/local/google/src/llvm-git-monorepo/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:20:32:
>  error: zero-size array ‘llvm::GUIDS_LOOKUP’
>  static const GlobalValue::GUID GUIDS_LOOKUP[] = {
> ^~~~
> /usr/local/google/src/llvm-git-monorepo/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:26:19:
>  error: zero-size array ‘llvm::GlobalArgumentMemAccess’
>  static const char GlobalArgumentMemAccess[] = {
>^~~
> ```
> Am I doing something wrong? Looks like empty files aren't enough.
> I've fixed the problem by putting "0" into each file, but it's strange it 
> works differently for us.
You must be using LLVM_ENABLE_WERROR?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-16 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added inline comments.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:27
+static const char GlobalArgumentMemAccess[] = {
+// grep  -P -o "(?<=FUNCTION_INFO: ).*"  | sort -u >
+// ../llvm-project/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpData.h

vitalybuka wrote:
> glider wrote:
> > Ditto.
> These files should be empty. Raw diff 
> https://reviews.llvm.org/file/data/o6sk6gw2gqs4u4pmodrn/PHID-FILE-s6c6nsofxnqekkcvzdzs/D61879.diff
>  already contains them. 
> It's ThinLTO replacement experiments. They don't improve results enough, so I 
> didn't bother to create real ThinLTO stuff. Anyway it is not needed for full 
> LTO.
> 
```
$ ninja -j64 check-clang
...
/usr/local/google/src/llvm-git-monorepo/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:20:32:
 error: zero-size array ‘llvm::GUIDS_LOOKUP’
 static const GlobalValue::GUID GUIDS_LOOKUP[] = {
^~~~
/usr/local/google/src/llvm-git-monorepo/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:26:19:
 error: zero-size array ‘llvm::GlobalArgumentMemAccess’
 static const char GlobalArgumentMemAccess[] = {
   ^~~
```
Am I doing something wrong? Looks like empty files aren't enough.
I've fixed the problem by putting "0" into each file, but it's strange it works 
differently for us.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-15 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka updated this revision to Diff 209942.
vitalybuka added a comment.

Rebase only


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; Third example from Doc/Coroutines.rst (two suspend points)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex2.ll
===
--- llvm/test/Transforms/Coroutines/ex2.ll
+++ llvm/test/Transforms/Coroutines/ex2.ll
@@ -1,6 +1,8 @@
 ; Second example from Doc/Coroutines.rst (custom alloc and 

[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-08 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka marked 2 inline comments as done.
vitalybuka added inline comments.



Comment at: llvm/include/llvm/Analysis/MemorySSA.h:1109
 // else.
-if (MemoryPhi *MP = dyn_cast(Access))
+if (const MemoryPhi *MP = dyn_cast(Access))
   return MP->getIncomingValue(ArgNo);

asbirlea wrote:
> Could changes in this file be landed separately?
> They seem unrelated and not in need of review.
It's already there r364247, i didn't rebase the patch after submit.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:27
+static const char GlobalArgumentMemAccess[] = {
+// grep  -P -o "(?<=FUNCTION_INFO: ).*"  | sort -u >
+// ../llvm-project/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpData.h

glider wrote:
> Ditto.
These files should be empty. Raw diff 
https://reviews.llvm.org/file/data/o6sk6gw2gqs4u4pmodrn/PHID-FILE-s6c6nsofxnqekkcvzdzs/D61879.diff
 already contains them. 
It's ThinLTO replacement experiments. They don't improve results enough, so I 
didn't bother to create real ThinLTO stuff. Anyway it is not needed for full 
LTO.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-08 Thread Alina Sbirlea via Phabricator via cfe-commits
asbirlea added inline comments.



Comment at: llvm/include/llvm/Analysis/MemorySSA.h:1109
 // else.
-if (MemoryPhi *MP = dyn_cast(Access))
+if (const MemoryPhi *MP = dyn_cast(Access))
   return MP->getIncomingValue(ArgNo);

Could changes in this file be landed separately?
They seem unrelated and not in need of review.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-05 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added inline comments.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp:556
+  LocationSize LS = MemoryLocation::getForDest(MSI).Size;
+  ConstantRange Range(PointerSizeInBits, false);
+  if (!LS.isPrecise() ||

An assertion fires here on the Android kernel:

```
aarch64-linux-android-ld.gold: 
/usr/local/google/src/llvm-git-monorepo/llvm/lib/IR/ConstantRange.cpp:54: 
llvm::ConstantRange::ConstantRange(llvm::APInt, llvm::APInt): Assertion `(Lower 
!= Upper || (Lower.isMaxValue() || Lower.isMinValue())) && "Lower == Upper, but 
they aren't min or max value!"' failed.
```

For some reason the (APInt, APInt) version of the constructor is being invoked.
Probably PointerSizeInBits should be declared as `int32_t` here and in 
`findDeadStores()`



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp:563
+assert(RR.getBitWidth() == Range.getBitWidth());
+ConstantRange RRR = {Range.getLower(),
+ Range.getLower() + LS.getValue()};

I'm seeing a case in which Range.getLower() is 20179 and LS.getValue() is 0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-05 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added inline comments.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp:709
+   size_t argN) {
+  const Function *F = cast(Callee);
+  if (argN >= F->arg_size())

This cast fails in the following case:

```
%21 = call i64 @probe_kernel_read(i8* nonnull %9, i8* %20, i64 8) #10, !dbg 
!7740
```
, where the callee is declared as:
```
@probe_kernel_read = weak hidden alias i64 (i8*, i8*, i64), i64 (i8*, i8*, 
i64)* @__probe_kernel_read
```

When building Android kernel with LTO enabled, the gold plugin crashes on an 
assertion.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-03 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added inline comments.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:20
+
+static const GlobalValue::GUID GUIDS_LOOKUP[] = {
+// grep  -P -o "(?<=LOOKUP_FN: ).*"  | sort -u >

error: zero-size array ‘llvm::GUIDS_LOOKUP’

Can you please provide an example of 
DeadStoreEliminationExpGlobalGUIDListGen.h? The instruction seems insufficient.



Comment at: llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp:27
+static const char GlobalArgumentMemAccess[] = {
+// grep  -P -o "(?<=FUNCTION_INFO: ).*"  | sort -u >
+// ../llvm-project/llvm/lib/Transforms/Scalar/DeadStoreEliminationExpData.h

Ditto.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-07-03 Thread Alexander Potapenko via Phabricator via cfe-commits
glider added a comment.

Vitaly, can you please rebase the patch?
As far as I can see, you've submitted parts of it already.
(not that I can't resolve the conflicts locally, but keeping it up-to-date may 
save others some time)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-06-25 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka updated this revision to Diff 206365.
vitalybuka added a comment.
Herald added subscribers: asbirlea, george.burgess.iv.

Bugfixes


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/member-function-pointer-calls.cpp
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/Analysis/MemorySSA.h
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; Third example from Doc/Coroutines.rst (two suspend points)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex2.ll
===
--- 

Re: [PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-06-20 Thread Vitaly Buka via cfe-commits
Not much, but it's not abandoned.
I was interrupted by other stuff.
Also I am concerned by the fact that zero initialization without any new
optimization is cheaper than pattern even with patches in progress.

On Thu, Jun 20, 2019 at 9:05 AM JF Bastien via Phabricator <
revi...@reviews.llvm.org> wrote:

> jfb added a comment.
>
> Hello! I'm still interested in this, have you been able to make any
> progress?
>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D61879/new/
>
> https://reviews.llvm.org/D61879
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-06-20 Thread JF Bastien via Phabricator via cfe-commits
jfb added a comment.

Hello! I'm still interested in this, have you been able to make any progress?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61879



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D61879: WIP: Prototype of DSE optimizations for -ftrivial-auto-var-init

2019-05-13 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka created this revision.
Herald added subscribers: llvm-commits, cfe-commits, jfb, dexonsmith, 
steven_wu, modocache, hiraditya, eraman, mgorny, mehdi_amini.
Herald added projects: clang, LLVM.
vitalybuka planned changes to this revision.

I don't want to invest into improving this patch. I will extract useful parts
and send them for review using this one as a benchmark reference.

Coroutines tests do not like pass structure so I disable the to figure out
later.

If you try this patch and find cases which module level DSE should handle,
and this one does not, especially -ftrivial-auto-var-init=patter related, please
share them with me.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61879

Files:
  clang/test/CodeGenCXX/union-tbaa2.cpp
  llvm/include/llvm/InitializePasses.h
  llvm/include/llvm/LinkAllPasses.h
  llvm/include/llvm/Transforms/Scalar.h
  llvm/include/llvm/Transforms/Scalar/DeadStoreEliminationExp.h
  llvm/lib/Analysis/Analysis.cpp
  llvm/lib/IR/AsmWriter.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExp.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.cpp
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobal.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalArgInfoGen.h
  llvm/lib/Transforms/Scalar/DeadStoreEliminationExpGlobalGUIDListGen.h
  llvm/lib/Transforms/Scalar/Scalar.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/Other/new-pm-defaults.ll
  llvm/test/Other/new-pm-thinlto-defaults.ll
  llvm/test/Other/opt-O2-pipeline.ll
  llvm/test/Other/opt-O3-pipeline.ll
  llvm/test/Other/opt-Os-pipeline.ll
  llvm/test/Other/pass-pipelines.ll
  llvm/test/Transforms/Coroutines/ArgAddr.ll
  llvm/test/Transforms/Coroutines/coro-split-01.ll
  llvm/test/Transforms/Coroutines/ex0.ll
  llvm/test/Transforms/Coroutines/ex1.ll
  llvm/test/Transforms/Coroutines/ex2.ll
  llvm/test/Transforms/Coroutines/ex3.ll
  llvm/test/Transforms/Coroutines/ex4.ll
  llvm/test/Transforms/Coroutines/ex5.ll
  llvm/test/Transforms/Coroutines/phi-coro-end.ll
  llvm/test/Transforms/Coroutines/restart-trigger.ll
  llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn

Index: llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
===
--- llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/lib/Transforms/Scalar/BUILD.gn
@@ -19,6 +19,8 @@
 "CorrelatedValuePropagation.cpp",
 "DCE.cpp",
 "DeadStoreElimination.cpp",
+"DeadStoreEliminationExp.cpp",
+"DeadStoreEliminationExpGlobal.cpp",
 "DivRemPairs.cpp",
 "EarlyCSE.cpp",
 "FlattenCFGPass.cpp",
Index: llvm/test/Transforms/Coroutines/restart-trigger.ll
===
--- llvm/test/Transforms/Coroutines/restart-trigger.ll
+++ llvm/test/Transforms/Coroutines/restart-trigger.ll
@@ -7,6 +7,8 @@
 ; CHECK:  CoroSplit: Processing coroutine 'f' state: 0
 ; CHECK-NEXT: CoroSplit: Processing coroutine 'f' state: 1
 
+; REQUIRES: abcd
+
 define void @f() {
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
   %size = call i32 @llvm.coro.size.i32()
Index: llvm/test/Transforms/Coroutines/phi-coro-end.ll
===
--- llvm/test/Transforms/Coroutines/phi-coro-end.ll
+++ llvm/test/Transforms/Coroutines/phi-coro-end.ll
@@ -1,6 +1,8 @@
 ; Verify that we correctly handle suspend when the coro.end block contains phi
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex5.ll
===
--- llvm/test/Transforms/Coroutines/ex5.ll
+++ llvm/test/Transforms/Coroutines/ex5.ll
@@ -1,6 +1,8 @@
 ; Fifth example from Doc/Coroutines.rst (final suspend)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %id = call token @llvm.coro.id(i32 0, i8* null, i8* null, i8* null)
Index: llvm/test/Transforms/Coroutines/ex4.ll
===
--- llvm/test/Transforms/Coroutines/ex4.ll
+++ llvm/test/Transforms/Coroutines/ex4.ll
@@ -1,6 +1,8 @@
 ; Fourth example from Doc/Coroutines.rst (coroutine promise)
 ; RUN: opt < %s -O2 -enable-coroutines -S | FileCheck %s
 
+; REQUIRES: abcd
+
 define i8* @f(i32 %n) {
 entry:
   %promise = alloca i32
Index: llvm/test/Transforms/Coroutines/ex3.ll
===
--- llvm/test/Transforms/Coroutines/ex3.ll
+++ llvm/test/Transforms/Coroutines/ex3.ll
@@ -1,6 +1,8 @@
 ; Third example from