[llvm] r340108 - [AST] Clarify printing of unknown size locations [NFC]
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 17 16:17:31 PDT 2018
Author: reames
Date: Fri Aug 17 16:17:31 2018
New Revision: 340108
URL: http://llvm.org/viewvc/llvm-project?rev=340108&view=rev
Log:
[AST] Clarify printing of unknown size locations [NFC]
Printing "unknown" is much more clear than an arbitrary large integer
Modified:
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
llvm/trunk/test/Analysis/AliasSet/memtransfer.ll
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=340108&r1=340107&r2=340108&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Fri Aug 17 16:17:31 2018
@@ -603,7 +603,10 @@ void AliasSet::print(raw_ostream &OS) co
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()) {
Modified: llvm/trunk/test/Analysis/AliasSet/memtransfer.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/AliasSet/memtransfer.ll?rev=340108&r1=340107&r2=340108&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/AliasSet/memtransfer.ll (original)
+++ llvm/trunk/test/Analysis/AliasSet/memtransfer.ll Fri Aug 17 16:17:31 2018
@@ -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)
More information about the llvm-commits
mailing list