[PATCH] D87255: [PATCH 24/27] [noalias] DeadArgumentElimination
Jeroen Dobbelaere via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 7 14:35:39 PDT 2020
jeroen.dobbelaere created this revision.
jeroen.dobbelaere added reviewers: hfinkel, jdoerfert.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jeroen.dobbelaere requested review of this revision.
DeadArgumentElimination: keep track of !noalias (for Full Restrict) and !alias.scope information for calls that are modified.
https://reviews.llvm.org/D87255
Files:
llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/test/Transforms/DeadArgElim/noalias.ll
Index: llvm/test/Transforms/DeadArgElim/noalias.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/DeadArgElim/noalias.ll
@@ -0,0 +1,25 @@
+; RUN: opt -deadargelim -S < %s | FileCheck %s
+
+; Checks if !noalias metadata is corret in deadargelim.
+
+define void @caller() #0 {
+; CHECK: call void @test_vararg(), !noalias ![[NA:[0-9]]]
+; CHECK: call void @test(), !noalias ![[NA]]
+ call void (i32, ...) @test_vararg(i32 1), !noalias !0
+ call void @test(i32 1), !noalias !0
+ ret void
+}
+
+define internal void @test_vararg(i32, ...) #1 {
+ ret void
+}
+
+define internal void @test(i32 %a) #1 {
+ ret void
+}
+
+; CHECK:![[NA]] = !{![[NA2:[0-9]]]}
+; CHECK:![[NA2]] = distinct !{![[NA2]], !"the var"}
+!0 = !{!1}
+!1 = distinct !{!1, !"the var"}
+
Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
===================================================================
--- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -207,7 +207,9 @@
}
NewCB->setCallingConv(CB->getCallingConv());
NewCB->setAttributes(PAL);
- NewCB->copyMetadata(*CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg});
+ NewCB->copyMetadata(*CB,
+ {LLVMContext::MD_prof, LLVMContext::MD_dbg,
+ LLVMContext::MD_noalias, LLVMContext::MD_alias_scope});
Args.clear();
@@ -935,7 +937,9 @@
}
NewCB->setCallingConv(CB.getCallingConv());
NewCB->setAttributes(NewCallPAL);
- NewCB->copyMetadata(CB, {LLVMContext::MD_prof, LLVMContext::MD_dbg});
+ NewCB->copyMetadata(CB,
+ {LLVMContext::MD_prof, LLVMContext::MD_dbg,
+ LLVMContext::MD_noalias, LLVMContext::MD_alias_scope});
Args.clear();
ArgAttrVec.clear();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87255.290370.patch
Type: text/x-patch
Size: 1859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200907/9cbed05c/attachment.bin>
More information about the llvm-commits
mailing list