summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
diff options
context:
space:
mode:
authorCharles Davis <cdavis5x@gmail.com>2015-02-25 05:10:25 +0000
committerCharles Davis <cdavis5x@gmail.com>2015-02-25 05:10:25 +0000
commit33d1dc000806708d65597da6a810bb450664f11d (patch)
treec0364e7539f6502c53b407f6cfb9eb1eee325010 /llvm/test/Transforms/InstCombine/loadstore-metadata.ll
parentd70bb8d8cbe78dceb6d3ac501244874d8f1b85af (diff)
downloadbcm5719-llvm-33d1dc000806708d65597da6a810bb450664f11d.tar.gz
bcm5719-llvm-33d1dc000806708d65597da6a810bb450664f11d.zip
[IC] Turn non-null MD on pointer loads to range MD on integer loads.
Summary: This change fixes the FIXME that you recently added when you committed (a modified version of) my patch. When `InstCombine` combines a load and store of an pointer to those of an equivalently-sized integer, it currently drops any `!nonnull` metadata that might be present. This change replaces `!nonnull` metadata with `!range !{ 1, -1 }` metadata instead. Reviewers: chandlerc Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D7621 llvm-svn: 230462
Diffstat (limited to 'llvm/test/Transforms/InstCombine/loadstore-metadata.ll')
-rw-r--r--llvm/test/Transforms/InstCombine/loadstore-metadata.ll16
1 files changed, 12 insertions, 4 deletions
diff --git a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
index e5b04494bf1..be55fa62f6d 100644
--- a/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
+++ b/llvm/test/Transforms/InstCombine/loadstore-metadata.ll
@@ -82,21 +82,29 @@ exit:
define void @test_load_cast_combine_nonnull(float** %ptr) {
; We can't preserve nonnull metadata when converting a load of a pointer to
-; a load of an integer.
-; FIXME: We should really transform this into range metadata and vice versa.
+; a load of an integer. Instead, we translate it to range metadata.
+; FIXME: We should also transform range metadata back into nonnull metadata.
+; FIXME: This test is very fragile. If any LABEL lines are added after
+; this point, the test will fail, because this test depends on a metadata tuple,
+; which is always emitted at the end of the file. At some point, we should
+; consider an option to the IR printer to emit MD tuples after the function
+; that first uses them--this will allow us to refer to them like this and not
+; have the tests break. For now, this function must always come last in this
+; file, and no LABEL lines are to be added after this point.
;
; CHECK-LABEL: @test_load_cast_combine_nonnull(
-; CHECK: %[[V:.*]] = load i64* %{{.*}}
+; CHECK: %[[V:.*]] = load i64* %{{.*}}, !range ![[MD:[0-9]+]]
; CHECK-NOT: !nonnull
; CHECK: store i64 %[[V]], i64*
entry:
%p = load float** %ptr, !nonnull !3
%gep = getelementptr float** %ptr, i32 42
store float* %p, float** %gep
-
ret void
}
+; This is the metadata tuple that we reference above:
+; CHECK: ![[MD]] = !{i64 1, i64 0}
!0 = !{ !1, !1, i64 0 }
!1 = !{ !1 }
!2 = !{ !2, !1 }
OpenPOWER on IntegriCloud