From: Philip Reames Date: Fri, 17 Aug 2018 23:17:31 +0000 (+0000) Subject: [AST] Clarify printing of unknown size locations [NFC] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96bc076c3a9ab660f830f13a63aee8816a023cc0;p=platform%2Fupstream%2Fllvm.git [AST] Clarify printing of unknown size locations [NFC] Printing "unknown" is much more clear than an arbitrary large integer llvm-svn: 340108 --- diff --git a/llvm/lib/Analysis/AliasSetTracker.cpp b/llvm/lib/Analysis/AliasSetTracker.cpp index 2879dea..23c598d 100644 --- a/llvm/lib/Analysis/AliasSetTracker.cpp +++ b/llvm/lib/Analysis/AliasSetTracker.cpp @@ -603,7 +603,10 @@ void AliasSet::print(raw_ostream &OS) const { for (iterator I = begin(), E = end(); I != E; ++I) { if (I != begin()) OS << ", "; I.getPointer()->printAsOperand(OS << "("); - OS << ", " << I.getSize() << ")"; + if (I.getSize() == MemoryLocation::UnknownSize) + OS << ", unknown)"; + else + OS << ", " << I.getSize() << ")"; } } if (!UnknownInsts.empty()) { diff --git a/llvm/test/Analysis/AliasSet/memtransfer.ll b/llvm/test/Analysis/AliasSet/memtransfer.ll index 0d7e601..2634dd3 100644 --- a/llvm/test/Analysis/AliasSet/memtransfer.ll +++ b/llvm/test/Analysis/AliasSet/memtransfer.ll @@ -3,6 +3,28 @@ @s = global i8 1, align 1 @d = global i8 2, align 1 + +; CHECK: Alias sets for function 'test_known_size': +; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values. +; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Ref Pointers: (i8* %s, 1) +; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %d, 1) +define void @test_known_size(i8* noalias %s, i8* noalias %d) { +entry: + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 1, i1 false) + ret void +} + +; CHECK: Alias sets for function 'test_unknown_size': +; CHECK: Alias Set Tracker: 2 alias sets for 2 pointer values. +; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Ref Pointers: (i8* %s, unknown) +; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %d, unknown) +define void @test_unknown_size(i8* noalias %s, i8* noalias %d, i64 %len) { +entry: + call void @llvm.memcpy.p0i8.p0i8.i64(i8* %d, i8* %s, i64 %len, i1 false) + ret void +} + + ; CHECK: Alias sets for function 'test1': ; CHECK: Alias Set Tracker: 3 alias sets for 4 pointer values. ; CHECK: AliasSet[0x{{[0-9a-f]+}}, 1] must alias, Mod Pointers: (i8* %a, 1)