diff options
Diffstat (limited to 'llvm/test/Transforms/InstCombine/annotate-noalias.ll')
-rw-r--r-- | llvm/test/Transforms/InstCombine/annotate-noalias.ll | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/annotate-noalias.ll b/llvm/test/Transforms/InstCombine/annotate-noalias.ll new file mode 100644 index 00000000000..651bff191c1 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/annotate-noalias.ll @@ -0,0 +1,78 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -instcombine -S < %s | FileCheck %s + + +declare i8* @memcpy(i8* nocapture, i8* nocapture, i64) +declare i8* @strncpy(i8* nocapture, i8* nocapture, i64) +declare i8* @strcpy(i8* nocapture, i8* nocapture) + +define i8* @memcpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @memcpy_const_size_noalias( +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias align 1 dereferenceable(16) [[D:%.*]], i8* noalias align 1 dereferenceable(16) [[S:%.*]], i64 16, i1 false) +; CHECK-NEXT: ret i8* [[D]] +; + %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 16) + ret i8* %call +} + +define i8* @memcpy_const_zero_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @memcpy_const_zero_size_noalias( +; CHECK-NEXT: ret i8* [[D:%.*]] +; + %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 0) + ret i8* %call +} + +define i8* @memcpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) { +; CHECK-LABEL: @memcpy_nonconst_size_noalias( +; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias align 1 [[D:%.*]], i8* noalias align 1 [[S:%.*]], i64 [[N:%.*]], i1 false) +; CHECK-NEXT: ret i8* [[D]] +; + %call = tail call i8* @memcpy(i8* %d, i8* %s, i64 %n) + ret i8* %call +} + +define i8* @strncpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @strncpy_const_size_noalias( +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 16) +; CHECK-NEXT: ret i8* [[CALL]] +; + %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 16) + ret i8* %call +} + +define i8* @strncpy_const_zero_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @strncpy_const_zero_size_noalias( +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 0) +; CHECK-NEXT: ret i8* [[CALL]] +; + %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 0) + ret i8* %call +} + +define i8* @strncpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s, i64 %n) { +; CHECK-LABEL: @strncpy_nonconst_size_noalias( +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strncpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]], i64 [[N:%.*]]) +; CHECK-NEXT: ret i8* [[CALL]] +; + %call = tail call i8* @strncpy(i8* %d, i8* %s, i64 %n) + ret i8* %call +} + +define i8* @strcpy_const_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @strcpy_const_size_noalias( +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strcpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]]) +; CHECK-NEXT: ret i8* [[CALL]] +; + %call = tail call i8* @strcpy(i8* %d, i8* %s) + ret i8* %call +} + +define i8* @strcpy_nonconst_size_noalias(i8* nocapture readonly %d, i8* nocapture readonly %s) { +; CHECK-LABEL: @strcpy_nonconst_size_noalias( +; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @strcpy(i8* noalias [[D:%.*]], i8* noalias [[S:%.*]]) +; CHECK-NEXT: ret i8* [[CALL]] +; + %call = tail call i8* @strcpy(i8* %d, i8* %s) + ret i8* %call +} |