Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1441)

Unified Diff: lib/Transforms/NaCl/ExpandByVal.cpp

Issue 14060026: PNaCl: Add NoAlias attributes in ExpandByVal and ExpandVarArgs passes (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/Transforms/NaCl/ExpandVarArgs.cpp » ('j') | test/Transforms/NaCl/expand-varargs.ll » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/NaCl/ExpandByVal.cpp
diff --git a/lib/Transforms/NaCl/ExpandByVal.cpp b/lib/Transforms/NaCl/ExpandByVal.cpp
index cc2c73325eac25f33e9c85f7696556bb3d465854..7227f3e5018b60f1e02b69624830b2a82733f3fa 100644
--- a/lib/Transforms/NaCl/ExpandByVal.cpp
+++ b/lib/Transforms/NaCl/ExpandByVal.cpp
@@ -82,6 +82,14 @@ AttributeSet RemoveAttrs(LLVMContext &Context, AttributeSet Attrs) {
Attr->getKindAsEnum() != Attribute::StructRet) {
AB.addAttribute(*Attr);
}
+ // IR semantics require that ByVal implies NoAlias. However, IR
+ // semantics do not require StructRet to imply NoAlias. For
+ // example, a global variable address can be passed as a
+ // StructRet argument, although Clang does not do so and Clang
+ // explicitly adds NoAlias to StructRet arguments.
+ if (Attr->getKindAsEnum() == Attribute::ByVal) {
+ AB.addAttribute(Attribute::get(Context, Attribute::NoAlias));
+ }
}
AttrList.push_back(AttributeSet::get(Context, Index, AB));
}
« no previous file with comments | « no previous file | lib/Transforms/NaCl/ExpandVarArgs.cpp » ('j') | test/Transforms/NaCl/expand-varargs.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698