diff options
| author | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-20 06:15:50 +0000 |
|---|---|---|
| committer | Johannes Doerfert <jdoerfert@anl.gov> | 2019-08-20 06:15:50 +0000 |
| commit | 12cbbab9d9366d37bb2c6f1057491d07c83aba59 (patch) | |
| tree | 29d67b7829e6153d26ec7e1cc9a2df3ea2fa92da /llvm/test/Transforms/FunctionAttrs/dereferenceable.ll | |
| parent | 169af994bcd66ff967441b036500b29d2cbef6c9 (diff) | |
| download | bcm5719-llvm-12cbbab9d9366d37bb2c6f1057491d07c83aba59.tar.gz bcm5719-llvm-12cbbab9d9366d37bb2c6f1057491d07c83aba59.zip | |
[Attributor] Create abstract attributes on-demand
Before, we create the set of abstract attributes initially and then
dealt with the fact hat a lookup could fail, e.g., return a nullptr.
This patch will ensure we always return a valid object from a lookup,
allowing us not only to remove the nullptr checks but also to grow the
set of abstract attributes "in-flight" on-demand.
One can now start from those that have the best chance of improving
performance without the need to specify all they might depend on.
While this introduces some boilerplate, the usage of attributes is much
easier and cleaner now.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66276
llvm-svn: 369331
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs/dereferenceable.ll')
| -rw-r--r-- | llvm/test/Transforms/FunctionAttrs/dereferenceable.ll | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll b/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll index d0da030243f..a9a2c26498a 100644 --- a/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll +++ b/llvm/test/Transforms/FunctionAttrs/dereferenceable.ll @@ -22,23 +22,20 @@ define i32* @test2(i32* dereferenceable_or_null(4) %0, double* dereferenceable(8 ; TEST 3 ; GEP inbounds define i32* @test3_1(i32* dereferenceable(8) %0) local_unnamed_addr { -; define nonnull dereferenceable(4) i32* @test3_1(i32* nonnull dereferenceable(8) %0) -; ATTRIBUTOR: define i32* @test3_1(i32* nonnull dereferenceable(8) %0) +; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_1(i32* nonnull dereferenceable(8) %0) %ret = getelementptr inbounds i32, i32* %0, i64 1 ret i32* %ret } define i32* @test3_2(i32* dereferenceable_or_null(32) %0) local_unnamed_addr { ; FIXME: Argument should be mark dereferenceable because of GEP `inbounds`. -; define nonnull dereferenceable(16) i32* @test3_2(i32* dereferenceable_or_null(32) %0) -; ATTRIBUTOR: define i32* @test3_2(i32* dereferenceable_or_null(32) %0) +; ATTRIBUTOR: define nonnull dereferenceable(16) i32* @test3_2(i32* dereferenceable_or_null(32) %0) %ret = getelementptr inbounds i32, i32* %0, i64 4 ret i32* %ret } define i32* @test3_3(i32* dereferenceable(8) %0, i32* dereferenceable(16) %1, i1 %2) local_unnamed_addr { -; define nonnull dereferenceable(4) i32* @test3_3(i32* nonnull dereferenceable(8) %0, i32* nonnull dereferenceable(16) %1, i1 %2) local_unnamed_addr -; ATTRIBUTOR: define i32* @test3_3(i32* nonnull dereferenceable(8) %0, i32* nonnull dereferenceable(16) %1, i1 %2) local_unnamed_addr +; ATTRIBUTOR: define nonnull dereferenceable(4) i32* @test3_3(i32* nonnull dereferenceable(8) %0, i32* nonnull dereferenceable(16) %1, i1 %2) local_unnamed_addr %ret1 = getelementptr inbounds i32, i32* %0, i64 1 %ret2 = getelementptr inbounds i32, i32* %1, i64 2 %ret = select i1 %2, i32* %ret1, i32* %ret2 |

