]> granicus.if.org Git - llvm/commitdiff
Teach ValueTracking that aarch64.irg result aliases its input.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 3 Jul 2019 20:19:14 +0000 (20:19 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Wed, 3 Jul 2019 20:19:14 +0000 (20:19 +0000)
Reviewers: javed.absar, olista01

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64103

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365079 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueTracking.cpp
test/Analysis/ValueTracking/aarch64.irg.ll [new file with mode: 0644]

index ebd214586d6a1a8afe866ed23b589736dd90ad81..3ff5bf085990f15bc670bf71cf8af581a6b548d2 100644 (file)
@@ -3697,7 +3697,8 @@ const Value *llvm::getArgumentAliasingToReturnedPointer(const CallBase *Call) {
 bool llvm::isIntrinsicReturningPointerAliasingArgumentWithoutCapturing(
     const CallBase *Call) {
   return Call->getIntrinsicID() == Intrinsic::launder_invariant_group ||
-         Call->getIntrinsicID() == Intrinsic::strip_invariant_group;
+         Call->getIntrinsicID() == Intrinsic::strip_invariant_group ||
+         Call->getIntrinsicID() == Intrinsic::aarch64_irg;
 }
 
 /// \p PN defines a loop-variant pointer to an object.  Check if the
diff --git a/test/Analysis/ValueTracking/aarch64.irg.ll b/test/Analysis/ValueTracking/aarch64.irg.ll
new file mode 100644 (file)
index 0000000..75e198a
--- /dev/null
@@ -0,0 +1,18 @@
+; RUN: opt -S -instsimplify -instcombine < %s | FileCheck %s
+
+; CHECK-LABEL: define void @checkNonnullIrg()
+define void @checkNonnullIrg() {
+; CHECK:   %[[p:.*]] = call i8* @llvm.aarch64.irg(i8* nonnull
+; CHECK:   call void @use(i8* nonnull %[[p]])
+entry:
+  %0 = alloca i8, align 16
+
+  %p = call i8* @llvm.aarch64.irg(i8* %0, i64 5)
+  call void @use(i8* %p)
+
+  ret void
+}
+
+declare i8* @llvm.aarch64.irg(i8*, i64)
+
+declare void @use(i8*)