[llvm] bb0896e - add testcase for D127202, NFC
Chen Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 30 02:42:05 PDT 2022
Author: Chen Zheng
Date: 2022-06-30T05:40:34-04:00
New Revision: bb0896e96f30c6f812c6824067ff52bdd707ad26
URL: https://github.com/llvm/llvm-project/commit/bb0896e96f30c6f812c6824067ff52bdd707ad26
DIFF: https://github.com/llvm/llvm-project/commit/bb0896e96f30c6f812c6824067ff52bdd707ad26.diff
LOG: add testcase for D127202, NFC
Added:
llvm/test/Transforms/Inline/inline-noalias-unidentify-object.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/Transforms/Inline/inline-noalias-unidentify-object.ll b/llvm/test/Transforms/Inline/inline-noalias-unidentify-object.ll
new file mode 100644
index 0000000000000..520605f856a4e
--- /dev/null
+++ b/llvm/test/Transforms/Inline/inline-noalias-unidentify-object.ll
@@ -0,0 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=inline -enable-noalias-to-md-conversion -S | FileCheck %s
+
+define i32 @caller(ptr %p) {
+; CHECK-LABEL: @caller(
+; CHECK-NEXT: call void @llvm.experimental.noalias.scope.decl(metadata [[META0:![0-9]+]])
+; CHECK-NEXT: [[P_8_I:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 8
+; CHECK-NEXT: [[V_I:%.*]] = load i32, ptr [[P_8_I]], align 4, !alias.scope !0
+; CHECK-NEXT: [[P_1_I:%.*]] = getelementptr i8, ptr [[P]], i64 1
+; CHECK-NEXT: [[P_2_I:%.*]] = getelementptr i8, ptr [[P_1_I]], i64 1
+; CHECK-NEXT: [[P_3_I:%.*]] = getelementptr i8, ptr [[P_2_I]], i64 1
+; CHECK-NEXT: [[P_4_I:%.*]] = getelementptr i8, ptr [[P_3_I]], i64 1
+; CHECK-NEXT: [[P_5_I:%.*]] = getelementptr i8, ptr [[P_4_I]], i64 1
+; CHECK-NEXT: [[P_6_I:%.*]] = getelementptr i8, ptr [[P_5_I]], i64 1
+; CHECK-NEXT: [[P_7_I:%.*]] = getelementptr i8, ptr [[P_6_I]], i64 1
+; CHECK-NEXT: [[P_8_ALIAS_I:%.*]] = getelementptr i8, ptr [[P_7_I]], i64 1
+; CHECK-NEXT: store i32 42, ptr [[P_8_ALIAS_I]], align 4, !noalias !0
+; CHECK-NEXT: ret i32 [[V_I]]
+;
+ %v = call i32 @callee(ptr %p)
+ ret i32 %v
+}
+
+define internal i32 @callee(ptr noalias %p) {
+ %p.8 = getelementptr i8, ptr %p, i64 8
+ %v = load i32, ptr %p.8
+ %p.1 = getelementptr i8, ptr %p, i64 1
+ %p.2 = getelementptr i8, ptr %p.1, i64 1
+ %p.3 = getelementptr i8, ptr %p.2, i64 1
+ %p.4 = getelementptr i8, ptr %p.3, i64 1
+ %p.5 = getelementptr i8, ptr %p.4, i64 1
+ %p.6 = getelementptr i8, ptr %p.5, i64 1
+ %p.7 = getelementptr i8, ptr %p.6, i64 1
+ %p.8.alias = getelementptr i8, ptr %p.7, i64 1
+ store i32 42, ptr %p.8.alias
+ ret i32 %v
+}
More information about the llvm-commits
mailing list