summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-04-07 21:46:12 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-04-07 21:46:12 +0000
commit351241c83ea67cf4cc31b3e30b952ec45c9736e1 (patch)
tree88bbd41c8f3073d0873a01ed43bef135e0114d58
parentaac71a4a0eb420173239a6acb6d192570c974464 (diff)
downloadbcm5719-llvm-351241c83ea67cf4cc31b3e30b952ec45c9736e1.tar.gz
bcm5719-llvm-351241c83ea67cf4cc31b3e30b952ec45c9736e1.zip
Replace Sema-level implementation of -fassume-sane-operator-new with a
CodeGen-level implementation. Instead of adding an attribute to clang's FunctionDecl, add the IR attribute directly. This means a module built with this flag is now compatible with code built without it and vice versa. This change also results in the 'noalias' attribute no longer being added to calls to operator new in the IR; it's now only added to the declaration. It also fixes a bug where we failed to add the attribute to the 'nothrow' versions (because we didn't implicitly declare them, there was no good time to inject a fake attribute). llvm-svn: 265728
-rw-r--r--clang/include/clang/Basic/CodeGenOptions.def3
-rw-r--r--clang/include/clang/Basic/LangOptions.def1
-rw-r--r--clang/include/clang/Sema/Sema.h3
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp16
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp2
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp15
-rw-r--r--clang/test/CodeGenCXX/align-avx-complete-objects.cpp4
-rw-r--r--clang/test/CodeGenCXX/arm.cpp18
-rw-r--r--clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp2
-rw-r--r--clang/test/CodeGenCXX/cxx11-initializer-array-new.cpp6
-rw-r--r--clang/test/CodeGenCXX/delete-two-arg.cpp4
-rw-r--r--clang/test/CodeGenCXX/exceptions.cpp14
-rw-r--r--clang/test/CodeGenCXX/goto.cpp2
-rw-r--r--clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp6
-rw-r--r--clang/test/CodeGenCXX/mips-size_t-ptrdiff_t.cpp12
-rw-r--r--clang/test/CodeGenCXX/multi-dim-operator-new.cpp6
-rw-r--r--clang/test/CodeGenCXX/new-alias.cpp2
-rw-r--r--clang/test/CodeGenCXX/new-array-init.cpp4
-rw-r--r--clang/test/CodeGenCXX/new-overflow.cpp18
-rw-r--r--clang/test/CodeGenCXX/new.cpp35
-rw-r--r--clang/test/CodeGenCXX/operator-new.cpp6
-rw-r--r--clang/test/CodeGenCXX/static-init.cpp2
-rw-r--r--clang/test/CodeGenObjCXX/arc-new-delete.mm16
-rw-r--r--clang/test/CodeGenObjCXX/copy.mm2
-rw-r--r--clang/test/Modules/explicit-build-flags.cpp3
25 files changed, 103 insertions, 99 deletions
diff --git a/clang/include/clang/Basic/CodeGenOptions.def b/clang/include/clang/Basic/CodeGenOptions.def
index c09aa202092..14a6ae50c1a 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -30,8 +30,9 @@ CODEGENOPT(Name, Bits, Default)
CODEGENOPT(DisableIntegratedAS, 1, 0) ///< -no-integrated-as
CODEGENOPT(CompressDebugSections, 1, 0) ///< -Wa,-compress-debug-sections
-CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink
CODEGENOPT(AsmVerbose , 1, 0) ///< -dA, -fverbose-asm.
+CODEGENOPT(AssumeSaneOperatorNew , 1, 1) ///< implicit __attribute__((malloc)) operator new
+CODEGENOPT(Autolink , 1, 1) ///< -fno-autolink
CODEGENOPT(ObjCAutoRefCountExceptions , 1, 0) ///< Whether ARC should be EH-safe.
CODEGENOPT(CoverageExtraChecksum, 1, 0) ///< Whether we need a second checksum for functions in GCNO files.
CODEGENOPT(CoverageNoFunctionNamesInData, 1, 0) ///< Do not include function names in GCDA files.
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 13aa595aedb..94269608760 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -189,7 +189,6 @@ LANGOPT(CUDAAllowVariadicFunctions, 1, 0, "allowing variadic functions in CUDA d
LANGOPT(CUDAHostDeviceConstexpr, 1, 1, "treating unattributed constexpr functions as __host__ __device__")
LANGOPT(CUDADeviceFlushDenormalsToZero, 1, 0, "flushing denormals to zero")
-LANGOPT(AssumeSaneOperatorNew , 1, 1, "implicit __attribute__((malloc)) for C++'s new operators")
LANGOPT(SizedDeallocation , 1, 0, "enable sized deallocation functions")
LANGOPT(ConceptsTS , 1, 0, "enable C++ Extensions for Concepts")
BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index f5813bf097e..f3c4ae5caf4 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -4710,8 +4710,7 @@ public:
void DeclareGlobalNewDelete();
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return,
QualType Param1,
- QualType Param2 = QualType(),
- bool addRestrictAttr = false);
+ QualType Param2 = QualType());
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
DeclarationName Name, FunctionDecl* &Operator,
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index d70c05a766d..db1ed3c6570 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -1076,12 +1076,22 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
if (const SectionAttr *SA = FD->getAttr<SectionAttr>())
F->setSection(SA->getName());
- // A replaceable global allocation function does not act like a builtin by
- // default, only if it is invoked by a new-expression or delete-expression.
- if (FD->isReplaceableGlobalAllocationFunction())
+ if (FD->isReplaceableGlobalAllocationFunction()) {
+ // A replaceable global allocation function does not act like a builtin by
+ // default, only if it is invoked by a new-expression or delete-expression.
F->addAttribute(llvm::AttributeSet::FunctionIndex,
llvm::Attribute::NoBuiltin);
+ // A sane operator new returns a non-aliasing pointer.
+ // FIXME: Also add NonNull attribute to the return value
+ // for the non-nothrow forms?
+ auto Kind = FD->getDeclName().getCXXOverloadedOperator();
+ if (getCodeGenOpts().AssumeSaneOperatorNew &&
+ (Kind == OO_New || Kind == OO_Array_New))
+ F->addAttribute(llvm::AttributeSet::ReturnIndex,
+ llvm::Attribute::NoAlias);
+ }
+
if (isa<CXXConstructorDecl>(FD) || isa<CXXDestructorDecl>(FD))
F->setUnnamedAddr(true);
else if (const auto *MD = dyn_cast<CXXMethodDecl>(FD))
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 9eedaad9920..28cf5be0e8f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -533,6 +533,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.hasFlag(OPT_fcoverage_mapping, OPT_fno_coverage_mapping, false);
Opts.DumpCoverageMapping = Args.hasArg(OPT_dump_coverage_mapping);
Opts.AsmVerbose = Args.hasArg(OPT_masm_verbose);
+ Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
Opts.ObjCAutoRefCountExceptions = Args.hasArg(OPT_fobjc_arc_exceptions);
Opts.CXAAtExit = !Args.hasArg(OPT_fno_use_cxa_atexit);
Opts.CXXCtorDtorAliases = Args.hasArg(OPT_mconstructor_aliases);
@@ -1739,7 +1740,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (!Opts.NoBuiltin)
getAllNoBuiltinFuncValues(Args, Opts.NoBuiltinFuncs);
Opts.NoMathBuiltin = Args.hasArg(OPT_fno_math_builtin);
- Opts.AssumeSaneOperatorNew = !Args.hasArg(OPT_fno_assume_sane_operator_new);
Opts.SizedDeallocation = Args.hasArg(OPT_fsized_deallocation);
Opts.ConceptsTS = Args.hasArg(OPT_fconcepts_ts);
Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 4a8c9c95cc4..87c2ded7c8d 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -2245,14 +2245,13 @@ void Sema::DeclareGlobalNewDelete() {
QualType VoidPtr = Context.getPointerType(Context.VoidTy);
QualType SizeT = Context.getSizeType();
- bool AssumeSaneOperatorNew = getLangOpts().AssumeSaneOperatorNew;
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_New),
- VoidPtr, SizeT, QualType(), AssumeSaneOperatorNew);
+ VoidPtr, SizeT, QualType());
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_Array_New),
- VoidPtr, SizeT, QualType(), AssumeSaneOperatorNew);
+ VoidPtr, SizeT, QualType());
DeclareGlobalAllocationFunction(
Context.DeclarationNames.getCXXOperatorName(OO_Delete),
Context.VoidTy, VoidPtr);
@@ -2273,8 +2272,7 @@ void Sema::DeclareGlobalNewDelete() {
/// allocation function if it doesn't already exist.
void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
QualType Return,
- QualType Param1, QualType Param2,
- bool AddRestrictAttr) {
+ QualType Param1, QualType Param2) {
DeclContext *GlobalCtx = Context.getTranslationUnitDecl();
unsigned NumParams = Param2.isNull() ? 1 : 2;
@@ -2297,9 +2295,6 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
// FIXME: Do we need to check for default arguments here?
if (InitialParam1Type == Param1 &&
(NumParams == 1 || InitialParam2Type == Param2)) {
- if (AddRestrictAttr && !Func->hasAttr<RestrictAttr>())
- Func->addAttr(RestrictAttr::CreateImplicit(
- Context, RestrictAttr::GNU_malloc));
// Make the function visible to name lookup, even if we found it in
// an unimported module. It either is an implicitly-declared global
// allocation function, or is suppressing that function.
@@ -2342,10 +2337,6 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
Alloc->addAttr(VisibilityAttr::CreateImplicit(Context,
VisibilityAttr::Default));
- if (AddRestrictAttr)
- Alloc->addAttr(
- RestrictAttr::CreateImplicit(Context, RestrictAttr::GNU_malloc));
-
ParmVarDecl *ParamDecls[2];
for (unsigned I = 0; I != NumParams; ++I) {
ParamDecls[I] = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
diff --git a/clang/test/CodeGenCXX/align-avx-complete-objects.cpp b/clang/test/CodeGenCXX/align-avx-complete-objects.cpp
index 6ab17f5d656..ad4a91428d2 100644
--- a/clang/test/CodeGenCXX/align-avx-complete-objects.cpp
+++ b/clang/test/CodeGenCXX/align-avx-complete-objects.cpp
@@ -13,7 +13,7 @@ volatile float TestAlign(void)
}
// CHECK: [[R:%.*]] = alloca <8 x float>, align 32
-// CHECK-NEXT: [[CALL:%.*]] = call noalias i8* @_Znwm(i64 32)
+// CHECK-NEXT: [[CALL:%.*]] = call i8* @_Znwm(i64 32)
// CHECK-NEXT: [[ZERO:%.*]] = bitcast i8* [[CALL]] to <8 x float>*
// CHECK-NEXT: store <8 x float>* [[ZERO]], <8 x float>** [[P:%.*]], align 8
// CHECK-NEXT: [[ONE:%.*]] = load <8 x float>*, <8 x float>** [[P]], align 8
@@ -42,7 +42,7 @@ volatile float TestAlign2(void)
}
// CHECK: [[R:%.*]] = alloca <8 x float>, align 32
-// CHECK-NEXT: [[CALL:%.*]] = call noalias i8* @_Znwm(i64 32)
+// CHECK-NEXT: [[CALL:%.*]] = call i8* @_Znwm(i64 32)
// CHECK-NEXT: [[ZERO:%.*]] = bitcast i8* [[CALL]] to <8 x float>*
// CHECK-NEXT: store <8 x float>* [[ZERO]], <8 x float>** [[P:%.*]], align 8
// CHECK-NEXT: [[ONE:%.*]] = load <8 x float>*, <8 x float>** [[P]], align 8
diff --git a/clang/test/CodeGenCXX/arm.cpp b/clang/test/CodeGenCXX/arm.cpp
index 11ae6b24c26..d0b896d182d 100644
--- a/clang/test/CodeGenCXX/arm.cpp
+++ b/clang/test/CodeGenCXX/arm.cpp
@@ -109,7 +109,7 @@ namespace test3 {
void a() {
// CHECK-LABEL: define void @_ZN5test31aEv()
- // CHECK: call noalias i8* @_Znam(i32 48)
+ // CHECK: call i8* @_Znam(i32 48)
// CHECK: store i32 4
// CHECK: store i32 10
A *x = new A[10];
@@ -122,7 +122,7 @@ namespace test3 {
// CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
// CHECK: [[OR:%.*]] = or i1
// CHECK: [[SZ:%.*]] = select i1 [[OR]]
- // CHECK: call noalias i8* @_Znam(i32 [[SZ]])
+ // CHECK: call i8* @_Znam(i32 [[SZ]])
// CHECK: store i32 4
// CHECK: store i32 [[N]]
A *x = new A[n];
@@ -130,7 +130,7 @@ namespace test3 {
void c() {
// CHECK-LABEL: define void @_ZN5test31cEv()
- // CHECK: call noalias i8* @_Znam(i32 808)
+ // CHECK: call i8* @_Znam(i32 808)
// CHECK: store i32 4
// CHECK: store i32 200
A (*x)[20] = new A[10][20];
@@ -143,7 +143,7 @@ namespace test3 {
// CHECK: [[NE:%.*]] = mul i32 [[N]], 20
// CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
// CHECK: [[SZ:%.*]] = select
- // CHECK: call noalias i8* @_Znam(i32 [[SZ]])
+ // CHECK: call i8* @_Znam(i32 [[SZ]])
// CHECK: store i32 4
// CHECK: store i32 [[NE]]
A (*x)[20] = new A[n][20];
@@ -182,7 +182,7 @@ namespace test4 {
void a() {
// CHECK-LABEL: define void @_ZN5test41aEv()
- // CHECK: call noalias i8* @_Znam(i32 48)
+ // CHECK: call i8* @_Znam(i32 48)
// CHECK: store i32 4
// CHECK: store i32 10
A *x = new A[10];
@@ -194,7 +194,7 @@ namespace test4 {
// CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4)
// CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
// CHECK: [[SZ:%.*]] = select
- // CHECK: call noalias i8* @_Znam(i32 [[SZ]])
+ // CHECK: call i8* @_Znam(i32 [[SZ]])
// CHECK: store i32 4
// CHECK: store i32 [[N]]
A *x = new A[n];
@@ -202,7 +202,7 @@ namespace test4 {
void c() {
// CHECK-LABEL: define void @_ZN5test41cEv()
- // CHECK: call noalias i8* @_Znam(i32 808)
+ // CHECK: call i8* @_Znam(i32 808)
// CHECK: store i32 4
// CHECK: store i32 200
A (*x)[20] = new A[10][20];
@@ -215,7 +215,7 @@ namespace test4 {
// CHECK: [[NE:%.*]] = mul i32 [[N]], 20
// CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8)
// CHECK: [[SZ:%.*]] = select
- // CHECK: call noalias i8* @_Znam(i32 [[SZ]])
+ // CHECK: call i8* @_Znam(i32 [[SZ]])
// CHECK: store i32 4
// CHECK: store i32 [[NE]]
A (*x)[20] = new A[n][20];
@@ -383,7 +383,7 @@ namespace test9 {
// CHECK-NEXT: [[OVERFLOW:%.*]] = or i1 [[O0]], [[O1]]
// CHECK-NEXT: [[T3:%.*]] = extractvalue { i32, i1 } [[T2]], 0
// CHECK-NEXT: [[T4:%.*]] = select i1 [[OVERFLOW]], i32 -1, i32 [[T3]]
-// CHECK-NEXT: [[ALLOC:%.*]] = call noalias i8* @_Znam(i32 [[T4]])
+// CHECK-NEXT: [[ALLOC:%.*]] = call i8* @_Znam(i32 [[T4]])
// CHECK-NEXT: [[T0:%.*]] = bitcast i8* [[ALLOC]] to i32*
// CHECK-NEXT: store i32 16, i32* [[T0]]
// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i32, i32* [[T0]], i32 1
diff --git a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
index 311edaabb5d..7bab11488ad 100644
--- a/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ b/clang/test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -249,7 +249,7 @@ haslist2::haslist2()
void fn10(int i) {
// CHECK-LABEL: define void @_Z4fn10i
// CHECK: alloca [3 x i32]
- // CHECK: call noalias i8* @_Znw{{[jm]}}
+ // CHECK: call i8* @_Znw{{[jm]}}
// CHECK: store i32 %
// CHECK: store i32 2
// CHECK: store i32 3
diff --git a/clang/test/CodeGenCXX/cxx11-initializer-array-new.cpp b/clang/test/CodeGenCXX/cxx11-initializer-array-new.cpp
index c662190ff38..59f96031fc4 100644
--- a/clang/test/CodeGenCXX/cxx11-initializer-array-new.cpp
+++ b/clang/test/CodeGenCXX/cxx11-initializer-array-new.cpp
@@ -7,7 +7,7 @@ struct S { S(); S(int); ~S(); int n; };
void *p = new S[2][3]{ { 1, 2, 3 }, { 4, 5, 6 } };
// CHECK-LABEL: define
-// CHECK: %[[ALLOC:.*]] = call noalias i8* @_Znam(i64 32)
+// CHECK: %[[ALLOC:.*]] = call i8* @_Znam(i64 32)
// CHECK: %[[COOKIE:.*]] = bitcast i8* %[[ALLOC]] to i64*
// CHECK: store i64 6, i64* %[[COOKIE]]
// CHECK: %[[START_AS_i8:.*]] = getelementptr inbounds i8, i8* %[[ALLOC]], i64 8
@@ -50,7 +50,7 @@ void *q = new S[n][3]{ { 1, 2, 3 }, { 4, 5, 6 } };
// CHECK: call {{.*}} @llvm.umul.with.overflow.i64(i64 %[[N:.*]], i64 12)
// CHECK: %[[ELTS:.*]] = mul i64 %[[N]], 3
// CHECK: call {{.*}} @llvm.uadd.with.overflow.i64(i64 %{{.*}}, i64 8)
-// CHECK: %[[ALLOC:.*]] = call noalias i8* @_Znam(i64 %{{.*}})
+// CHECK: %[[ALLOC:.*]] = call i8* @_Znam(i64 %{{.*}})
//
// CHECK: %[[COOKIE:.*]] = bitcast i8* %[[ALLOC]] to i64*
// CHECK: store i64 %[[ELTS]], i64* %[[COOKIE]]
@@ -113,7 +113,7 @@ void *r = new T[n][3]{ { 1, 2, 3 }, { 4, 5, 6 } };
// No cookie.
// CHECK-NOT: @llvm.uadd.with.overflow
//
-// CHECK: %[[ALLOC:.*]] = call noalias i8* @_Znam(i64 %{{.*}})
+// CHECK: %[[ALLOC:.*]] = call i8* @_Znam(i64 %{{.*}})
//
// CHECK: %[[START_AS_T:.*]] = bitcast i8* %[[ALLOC]] to %[[T:.*]]*
//
diff --git a/clang/test/CodeGenCXX/delete-two-arg.cpp b/clang/test/CodeGenCXX/delete-two-arg.cpp
index 85275b3eb17..68a6fa6736e 100644
--- a/clang/test/CodeGenCXX/delete-two-arg.cpp
+++ b/clang/test/CodeGenCXX/delete-two-arg.cpp
@@ -27,7 +27,7 @@ namespace test2 {
// CHECK: define [[A:%.*]]* @_ZN5test24testEv()
A *test() {
- // CHECK: [[NEW:%.*]] = call noalias i8* @_Znaj(i32 44)
+ // CHECK: [[NEW:%.*]] = call i8* @_Znaj(i32 44)
// CHECK-NEXT: [[T0:%.*]] = bitcast i8* [[NEW]] to i32*
// CHECK-NEXT: store i32 10, i32* [[T0]]
// CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds i8, i8* [[NEW]], i32 4
@@ -63,7 +63,7 @@ namespace test3 {
// CHECK-LABEL: define void @_ZN5test34testEv()
void test() {
- // CHECK: call noalias i8* @_Znaj(i32 24)
+ // CHECK: call i8* @_Znaj(i32 24)
// CHECK-NEXT: bitcast
// CHECK-NEXT: store i32 5
(void) new B[5];
diff --git a/clang/test/CodeGenCXX/exceptions.cpp b/clang/test/CodeGenCXX/exceptions.cpp
index ff76b11350d..86616d1e2c6 100644
--- a/clang/test/CodeGenCXX/exceptions.cpp
+++ b/clang/test/CodeGenCXX/exceptions.cpp
@@ -30,7 +30,7 @@ namespace test1 {
A *a() {
// CHECK: define [[A:%.*]]* @_ZN5test11aEv()
- // CHECK: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 5)
// CHECK: ret [[A]]* [[CAST]]
@@ -40,7 +40,7 @@ namespace test1 {
A *b() {
// CHECK: define [[A:%.*]]* @_ZN5test11bEv()
- // CHECK: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: [[FOO:%.*]] = invoke i32 @_ZN5test13fooEv()
// CHECK: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[FOO]])
@@ -56,7 +56,7 @@ namespace test1 {
A *c() {
// CHECK: define [[A:%.*]]* @_ZN5test11cEv()
// CHECK: [[ACTIVE:%.*]] = alloca i1
- // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
@@ -82,7 +82,7 @@ namespace test1 {
A *d() {
// CHECK: define [[A:%.*]]* @_ZN5test11dEv()
// CHECK: [[ACTIVE:%.*]] = alloca i1
- // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
@@ -100,7 +100,7 @@ namespace test1 {
A *e() {
// CHECK: define [[A:%.*]]* @_ZN5test11eEv()
// CHECK: [[ACTIVE:%.*]] = alloca i1
- // CHECK-NEXT: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK-NEXT: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test11BC1Ev([[B:%.*]]* [[T0:%.*]])
@@ -131,7 +131,7 @@ namespace test1 {
// CHECK: define [[A:%.*]]* @_ZN5test11iEv()
// CHECK: [[X:%.*]] = alloca [[A]]*, align 8
// CHECK: [[ACTIVE:%.*]] = alloca i1
- // CHECK: [[NEW:%.*]] = call noalias i8* @_Znwm(i64 8)
+ // CHECK: [[NEW:%.*]] = call i8* @_Znwm(i64 8)
// CHECK-NEXT: store i1 true, i1* [[ACTIVE]]
// CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
// CHECK-NEXT: invoke void @_ZN5test15makeBEv([[B:%.*]]* sret [[T0:%.*]])
@@ -422,7 +422,7 @@ namespace test9 {
return new A[10];
}
// CHECK: define {{%.*}}* @_ZN5test94testEv
- // CHECK: [[TEST9_NEW:%.*]] = call noalias i8* @_Znam
+ // CHECK: [[TEST9_NEW:%.*]] = call i8* @_Znam
// CHECK: call void @_ZdaPv(i8* [[TEST9_NEW]])
}
diff --git a/clang/test/CodeGenCXX/goto.cpp b/clang/test/CodeGenCXX/goto.cpp
index c1a0eeccf81..27bd7affbac 100644
--- a/clang/test/CodeGenCXX/goto.cpp
+++ b/clang/test/CodeGenCXX/goto.cpp
@@ -18,7 +18,7 @@ namespace test0 {
// CHECK-NEXT: [[CLEANUPACTIVE:%.*]] = alloca i1
// CHECK: call void @_ZN5test01AC1Ev([[A]]* [[Y]])
// CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[Z]])
- // CHECK: [[NEW:%.*]] = invoke noalias i8* @_Znwm(i64 1)
+ // CHECK: [[NEW:%.*]] = invoke i8* @_Znwm(i64 1)
// CHECK: store i1 true, i1* [[CLEANUPACTIVE]]
// CHECK: [[NEWCAST:%.*]] = bitcast i8* [[NEW]] to [[V]]*
// CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]])
diff --git a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
index 75c0621347a..9ef1879ce5f 100644
--- a/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
+++ b/clang/test/CodeGenCXX/microsoft-abi-array-cookies.cpp
@@ -7,7 +7,7 @@ struct ClassWithoutDtor {
void check_array_no_cookies() {
// CHECK: define void @"\01?check_array_no_cookies@@YAXXZ"() [[NUW:#[0-9]+]]
-// CHECK: call noalias i8* @"\01??_U@YAPAXI@Z"(i32 42)
+// CHECK: call i8* @"\01??_U@YAPAXI@Z"(i32 42)
ClassWithoutDtor *array = new ClassWithoutDtor[42];
// CHECK: call void @"\01??_V@YAXPAX@Z"(
@@ -24,7 +24,7 @@ void check_array_cookies_simple() {
// CHECK: define {{.*}} @"\01?check_array_cookies_simple@@YAXXZ"()
ClassWithDtor *array = new ClassWithDtor[42];
-// CHECK: [[ALLOCATED:%.*]] = call noalias i8* @"\01??_U@YAPAXI@Z"(i32 46)
+// CHECK: [[ALLOCATED:%.*]] = call i8* @"\01??_U@YAPAXI@Z"(i32 46)
// 46 = 42 + size of cookie (4)
// CHECK: [[COOKIE:%.*]] = bitcast i8* [[ALLOCATED]] to i32*
// CHECK: store i32 42, i32* [[COOKIE]]
@@ -46,7 +46,7 @@ struct __attribute__((aligned(8))) ClassWithAlignment {
void check_array_cookies_aligned() {
// CHECK: define {{.*}} @"\01?check_array_cookies_aligned@@YAXXZ"()
ClassWithAlignment *array = new ClassWithAlignment[42];
-// CHECK: [[ALLOCATED:%.*]] = call noalias i8* @"\01??_U@YAPAXI@Z"(i32 344)
+// CHECK: [[ALLOCATED:%.*]] = call i8* @"\01??_U@YAPAXI@Z"(i32 344)
// 344 = 42*8 + size of cookie (8, due to alignment)
// CHECK: [[COOKIE:%.*]] = bitcast i8* [[ALLOCATED]] to i32*
// CHECK: store i32 42, i32* [[COOKIE]]
diff --git a/clang/test/CodeGenCXX/mips-size_t-ptrdiff_t.cpp b/clang/test/CodeGenCXX/mips-size_t-ptrdiff_t.cpp
index 1ff01820bb1..5b245a4aacc 100644
--- a/clang/test/CodeGenCXX/mips-size_t-ptrdiff_t.cpp
+++ b/clang/test/CodeGenCXX/mips-size_t-ptrdiff_t.cpp
@@ -10,13 +10,13 @@ long *alloc_long() {
return rv;
}
// O32-LABEL: define i32* @_Z10alloc_longv()
-// O32: call noalias i8* @_Znwj(i32 signext 4)
+// O32: call i8* @_Znwj(i32 signext 4)
// N32-LABEL: define i32* @_Z10alloc_longv()
-// N32: call noalias i8* @_Znwj(i32 signext 4)
+// N32: call i8* @_Znwj(i32 signext 4)
// N64-LABEL: define i64* @_Z10alloc_longv()
-// N64: call noalias i8* @_Znwm(i64 zeroext 8)
+// N64: call i8* @_Znwm(i64 zeroext 8)
long *alloc_long_array() {
long *rv = new long[2];
@@ -24,13 +24,13 @@ long *alloc_long_array() {
}
// O32-LABEL: define i32* @_Z16alloc_long_arrayv()
-// O32: call noalias i8* @_Znaj(i32 signext 8)
+// O32: call i8* @_Znaj(i32 signext 8)
// N32-LABEL: define i32* @_Z16alloc_long_arrayv()
-// N32: call noalias i8* @_Znaj(i32 signext 8)
+// N32: call i8* @_Znaj(i32 signext 8)
// N64-LABEL: define i64* @_Z16alloc_long_arrayv()
-// N64: call noalias i8* @_Znam(i64 zeroext 16)
+// N64: call i8* @_Znam(i64 zeroext 16)
#include <stddef.h>
diff --git a/clang/test/CodeGenCXX/multi-dim-operator-new.cpp b/clang/test/CodeGenCXX/multi-dim-operator-new.cpp
index 7a235e83a78..0dfcffb6aa4 100644
--- a/clang/test/CodeGenCXX/multi-dim-operator-new.cpp
+++ b/clang/test/CodeGenCXX/multi-dim-operator-new.cpp
@@ -43,7 +43,7 @@ int main() {
return 0;
}
-// CHECK: call noalias i8* @_Znam
-// CHECK: call noalias i8* @_Znam
-// CHECK: call noalias i8* @_Znam
+// CHECK: call i8* @_Znam
+// CHECK: call i8* @_Znam
+// CHECK: call i8* @_Znam
diff --git a/clang/test/CodeGenCXX/new-alias.cpp b/clang/test/CodeGenCXX/new-alias.cpp
index 4afd942e3cd..b21638abbfb 100644
--- a/clang/test/CodeGenCXX/new-alias.cpp
+++ b/clang/test/CodeGenCXX/new-alias.cpp
@@ -9,5 +9,5 @@ extern "C" char *something(long long x) {
void *operator new(size_t) __attribute__((alias("something")));
// PR16715: don't assert here.
-// CHECK: call noalias i8* @_Znwm(i64 4){{$}}
+// CHECK: call i8* @_Znwm(i64 4){{$}}
int *pr16715 = new int;
diff --git a/clang/test/CodeGenCXX/new-array-init.cpp b/clang/test/CodeGenCXX/new-array-init.cpp
index 6b76f471a22..602f93c34f0 100644
--- a/clang/test/CodeGenCXX/new-array-init.cpp
+++ b/clang/test/CodeGenCXX/new-array-init.cpp
@@ -14,7 +14,7 @@ void fn(int n) {
// CHECK-LABEL: define void @_Z15const_underflowv
void const_underflow() {
// CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3
- // CHECK: call noalias i8* @_Zna{{.}}(i{{32|64}} -1)
+ // CHECK: call i8* @_Zna{{.}}(i{{32|64}} -1)
new int[2] { 1, 2, 3 };
}
@@ -37,7 +37,7 @@ void check_array_value_init() {
struct S;
new (int S::*[3][4][5]) ();
- // CHECK: call noalias i8* @_Zna{{.}}(i{{32 240|64 480}})
+ // CHECK: call i8* @_Zna{{.}}(i{{32 240|64 480}})
// CHECK: getelementptr inbounds i{{32|64}}, i{{32|64}}* {{.*}}, i{{32|64}} 60
// CHECK: phi
diff --git a/clang/test/CodeGenCXX/new-overflow.cpp b/clang/test/CodeGenCXX/new-overflow.cpp
index 9057e049b70..0c4c3c823d1 100644
--- a/clang/test/CodeGenCXX/new-overflow.cpp
+++ b/clang/test/CodeGenCXX/new-overflow.cpp
@@ -17,7 +17,7 @@ namespace test0 {
// CHECK-NEXT: [[T1:%.*]] = extractvalue { i32, i1 } [[T0]], 1
// CHECK-NEXT: [[T2:%.*]] = extractvalue { i32, i1 } [[T0]], 0
// CHECK-NEXT: [[T3:%.*]] = select i1 [[T1]], i32 -1, i32 [[T2]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T3]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T3]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(short s) {
return new elt[s];
@@ -40,7 +40,7 @@ namespace test1 {
// CHECK-NEXT: [[T2:%.*]] = extractvalue { i32, i1 } [[T0]], 0
// CHECK-NEXT: [[T3:%.*]] = mul i32 [[N]], 100
// CHECK-NEXT: [[T4:%.*]] = select i1 [[T1]], i32 -1, i32 [[T2]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T4]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T4]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T3]]
elt *test(short s) {
return new elt[s];
@@ -68,7 +68,7 @@ namespace test2 {
// CHECK-NEXT: [[T6:%.*]] = or i1 [[T1]], [[T5]]
// CHECK-NEXT: [[T7:%.*]] = extractvalue { i32, i1 } [[T4]], 0
// CHECK-NEXT: [[T8:%.*]] = select i1 [[T6]], i32 -1, i32 [[T7]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T8]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T8]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T3]]
elt *test(short s) {
return new elt[s];
@@ -87,7 +87,7 @@ namespace test4 {
// CHECK: [[N:%.*]] = sext i16 {{%.*}} to i32
// CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
// CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T1]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(short s) {
return new elt[s];
@@ -106,7 +106,7 @@ namespace test5 {
// CHECK: [[N:%.*]] = load i32, i32*
// CHECK-NEXT: [[T0:%.*]] = icmp slt i32 [[N]], 0
// CHECK-NEXT: [[T1:%.*]] = select i1 [[T0]], i32 -1, i32 [[N]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T1]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T1]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(int s) {
return new elt[s];
@@ -128,7 +128,7 @@ namespace test6 {
// CHECK-NEXT: [[T1:%.*]] = extractvalue { i32, i1 } [[T0]], 1
// CHECK-NEXT: [[T2:%.*]] = extractvalue { i32, i1 } [[T0]], 0
// CHECK-NEXT: [[T3:%.*]] = select i1 [[T1]], i32 -1, i32 [[T2]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T3]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T3]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[N]]
elt *test(unsigned short s) {
return new elt[s];
@@ -151,7 +151,7 @@ namespace test7 {
// CHECK-NEXT: [[T2:%.*]] = extractvalue { i32, i1 } [[T0]], 0
// CHECK-NEXT: [[T3:%.*]] = mul i32 [[N]], 100
// CHECK-NEXT: [[T4:%.*]] = select i1 [[T1]], i32 -1, i32 [[T2]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T4]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T4]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T3]]
elt *test(unsigned short s) {
return new elt[s];
@@ -176,7 +176,7 @@ namespace test8 {
// CHECK-NEXT: [[T4:%.*]] = or i1 [[T0]], [[T3]]
// CHECK-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T2]], 0
// CHECK-NEXT: [[T6:%.*]] = select i1 [[T4]], i32 -1, i32 [[T5]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T6]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T6]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T1]]
elt *test(long long s) {
return new elt[s];
@@ -201,7 +201,7 @@ namespace test9 {
// CHECK-NEXT: [[T4:%.*]] = or i1 [[T0]], [[T3]]
// CHECK-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T2]], 0
// CHECK-NEXT: [[T6:%.*]] = select i1 [[T4]], i32 -1, i32 [[T5]]
- // CHECK-NEXT: call noalias i8* @_Znaj(i32 [[T6]])
+ // CHECK-NEXT: call i8* @_Znaj(i32 [[T6]])
// CHECK: getelementptr inbounds {{.*}}, i32 [[T1]]
elt *test(unsigned long long s) {
return new elt[s];
diff --git a/clang/test/CodeGenCXX/new.cpp b/clang/test/CodeGenCXX/new.cpp
index 6d6f7013861..ae2ec1505c5 100644
--- a/clang/test/CodeGenCXX/new.cpp
+++ b/clang/test/CodeGenCXX/new.cpp
@@ -127,15 +127,15 @@ struct B { int a; };
struct Bmemptr { int Bmemptr::* memptr; int a; };
void t11(int n) {
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK: call void @llvm.memset.p0i8.i64(
B* b = new B();
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK: {{call void.*llvm.memset.p0i8.i64.*i8 0, i64 %}}
B *b2 = new B[n]();
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64
// CHECK: br
Bmemptr *b_memptr = new Bmemptr[n]();
@@ -148,11 +148,11 @@ struct Empty { };
// We don't need to initialize an empty class.
// CHECK-LABEL: define void @_Z3t12v
void t12() {
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK-NOT: br
(void)new Empty[10];
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK-NOT: br
(void)new Empty[10]();
@@ -162,11 +162,11 @@ void t12() {
// Zero-initialization
// CHECK-LABEL: define void @_Z3t13i
void t13(int n) {
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK: store i32 0, i32*
(void)new int();
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK: {{call void.*llvm.memset.p0i8.i64.*i8 0, i64 %}}
(void)new int[n]();
@@ -186,7 +186,7 @@ void f() {
// CHECK: call void @_ZN5AllocD1Ev(
// CHECK: call void @_ZN5AllocdaEPv(i8*
delete[] new Alloc[10][20];
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK: call void @_ZdlPv(i8*
delete new bool;
// CHECK: ret void
@@ -274,7 +274,7 @@ namespace PR10197 {
// CHECK-LABEL: define weak_odr void @_ZN7PR101971fIiEEvv()
template<typename T>
void f() {
- // CHECK: [[CALL:%.*]] = call noalias i8* @_Znwm
+ // CHECK: [[CALL:%.*]] = call i8* @_Znwm
// CHECK-NEXT: [[CASTED:%.*]] = bitcast i8* [[CALL]] to
new T;
// CHECK-NEXT: ret void
@@ -296,7 +296,7 @@ namespace PR11757 {
struct X { X(); X(const X&); };
X* a(X* x) { return new X(X()); }
// CHECK: define {{.*}} @_ZN7PR117571aEPNS_1XE
- // CHECK: [[CALL:%.*]] = call noalias i8* @_Znwm
+ // CHECK: [[CALL:%.*]] = call i8* @_Znwm
// CHECK-NEXT: [[CASTED:%.*]] = bitcast i8* [[CALL]] to
// CHECK-NEXT: call void @_ZN7PR117571XC1Ev({{.*}}* [[CASTED]])
// CHECK-NEXT: ret {{.*}} [[CASTED]]
@@ -306,7 +306,7 @@ namespace PR13380 {
struct A { A() {} };
struct B : public A { int x; };
// CHECK-LABEL: define i8* @_ZN7PR133801fEv
- // CHECK: call noalias i8* @_Znam(
+ // CHECK: call i8* @_Znam(
// CHECK: call void @llvm.memset.p0i8
// CHECK-NEXT: call void @_ZN7PR133801BC1Ev
void* f() { return new B[2](); }
@@ -320,12 +320,12 @@ namespace N3664 {
// CHECK-LABEL: define void @_ZN5N36641fEv
void f() {
- // CHECK: call noalias i8* @_Znwm(i64 4) [[ATTR_BUILTIN_NEW:#[^ ]*]]
+ // CHECK: call i8* @_Znwm(i64 4) [[ATTR_BUILTIN_NEW:#[^ ]*]]
int *p = new int; // expected-note {{allocated with 'new' here}}
// CHECK: call void @_ZdlPv({{.*}}) [[ATTR_BUILTIN_DELETE:#[^ ]*]]
delete p;
- // CHECK: call noalias i8* @_Znam(i64 12) [[ATTR_BUILTIN_NEW]]
+ // CHECK: call i8* @_Znam(i64 12) [[ATTR_BUILTIN_NEW]]
int *q = new int[3];
// CHECK: call void @_ZdaPv({{.*}}) [[ATTR_BUILTIN_DELETE]]
delete[] p; // expected-warning {{'delete[]' applied to a pointer that was allocated with 'new'; did you mean 'delete'?}}
@@ -337,19 +337,18 @@ namespace N3664 {
(void) new (mpt) int;
}
- // FIXME: Can we mark this noalias?
- // CHECK: declare i8* @_ZnamRKSt9nothrow_t(i64, {{.*}}) [[ATTR_NOBUILTIN_NOUNWIND]]
+ // CHECK: declare noalias i8* @_ZnamRKSt9nothrow_t(i64, {{.*}}) [[ATTR_NOBUILTIN_NOUNWIND]]
// CHECK-LABEL: define void @_ZN5N36641gEv
void g() {
// It's OK for there to be attributes here, so long as we don't have a
// 'builtin' attribute.
- // CHECK: call noalias i8* @_Znwm(i64 4){{$}}
+ // CHECK: call i8* @_Znwm(i64 4){{$}}
int *p = (int*)operator new(4);
// CHECK: call void @_ZdlPv({{.*}}) [[ATTR_NOUNWIND:#[^ ]*]]
operator delete(p);
- // CHECK: call noalias i8* @_Znam(i64 12){{$}}
+ // CHECK: call i8* @_Znam(i64 12){{$}}
int *q = (int*)operator new[](12);
// CHECK: call void @_ZdaPv({{.*}}) [[ATTR_NOUNWIND]]
operator delete [](p);
@@ -362,7 +361,7 @@ namespace N3664 {
namespace builtins {
// CHECK-LABEL: define void @_ZN8builtins1fEv
void f() {
- // CHECK: call noalias i8* @_Znwm(i64 4) [[ATTR_BUILTIN_NEW]]
+ // CHECK: call i8* @_Znwm(i64 4) [[ATTR_BUILTIN_NEW]]
// CHECK: call void @_ZdlPv({{.*}}) [[ATTR_BUILTIN_DELETE]]
__builtin_operator_delete(__builtin_operator_new(4));
}
diff --git a/clang/test/CodeGenCXX/operator-new.cpp b/clang/test/CodeGenCXX/operator-new.cpp
index db56cda6cdd..dc1c36d8ead 100644
--- a/clang/test/CodeGenCXX/operator-new.cpp
+++ b/clang/test/CodeGenCXX/operator-new.cpp
@@ -16,7 +16,6 @@ void f1() {
new teste();
}
-
// rdar://5739832 - operator new should check for overflow in multiply.
void *f2(long N) {
return new int[N];
@@ -25,5 +24,8 @@ void *f2(long N) {
// SANE-NEXT: [[OVER:%.*]] = extractvalue {{.*}} [[UWO]], 1
// SANE-NEXT: [[SUM:%.*]] = extractvalue {{.*}} [[UWO]], 0
// SANE-NEXT: [[RESULT:%.*]] = select i1 [[OVER]], i32 -1, i32 [[SUM]]
-// SANE-NEXT: call noalias i8* @_Znaj(i32 [[RESULT]])
+// SANE-NEXT: call i8* @_Znaj(i32 [[RESULT]])
}
+
+// SANE: declare noalias i8* @_Znaj(
+// SANENOT: declare i8* @_Znaj(
diff --git a/clang/test/CodeGenCXX/static-init.cpp b/clang/test/CodeGenCXX/static-init.cpp
index 541f6416efd..bb974948a05 100644
--- a/clang/test/CodeGenCXX/static-init.cpp
+++ b/clang/test/CodeGenCXX/static-init.cpp
@@ -26,7 +26,7 @@ void f() {
}
void g() {
- // CHECK: call noalias i8* @_Znwm(i64 1)
+ // CHECK: call i8* @_Znwm(i64 1)
// CHECK: call void @_ZN1AC1Ev(
static A& a = *new A;
}
diff --git a/clang/test/CodeGenObjCXX/arc-new-delete.mm b/clang/test/CodeGenObjCXX/arc-new-delete.mm
index f853ea4366a..141f4019578 100644
--- a/clang/test/CodeGenObjCXX/arc-new-delete.mm
+++ b/clang/test/CodeGenObjCXX/arc-new-delete.mm
@@ -12,32 +12,32 @@ void test_new(id invalue) {
// OPT-NEXT: [[T0:%.*]] = call i8* @objc_retain(i8* [[INVALUE:%.*]])
// OPT-NEXT: store i8* [[T0]], i8** [[INVALUEADDR]]
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK-NEXT: {{bitcast i8\*.*to i8\*\*}}
// CHECK-NEXT: store i8* null, i8**
new strong_id;
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK-NEXT: {{bitcast i8\*.*to i8\*\*}}
// UNOPT-NEXT: store i8* null, i8**
// OPT-NEXT: call i8* @objc_initWeak(i8** {{.*}}, i8* null)
new weak_id;
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK-NEXT: {{bitcast i8\*.*to i8\*\*}}
// CHECK-NEXT: store i8* null, i8**
new __strong id;
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK-NEXT: {{bitcast i8\*.*to i8\*\*}}
// UNOPT-NEXT: store i8* null, i8**
// OPT-NEXT: call i8* @objc_initWeak(i8** {{.*}}, i8* null)
new __weak id;
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK: call i8* @objc_retain
// CHECK: store i8*
new __strong id(invalue);
- // CHECK: call noalias i8* @_Znwm
+ // CHECK: call i8* @_Znwm
// CHECK: call i8* @objc_initWeak
new __weak id(invalue);
@@ -48,12 +48,12 @@ void test_new(id invalue) {
// CHECK-LABEL: define void @_Z14test_array_new
void test_array_new() {
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK: store i64 17, i64*
// CHECK: call void @llvm.memset.p0i8.i64
new strong_id[17];
- // CHECK: call noalias i8* @_Znam
+ // CHECK: call i8* @_Znam
// CHECK: store i64 17, i64*
// CHECK: call void @llvm.memset.p0i8.i64
new weak_id[17];
diff --git a/clang/test/CodeGenObjCXX/copy.mm b/clang/test/CodeGenObjCXX/copy.mm
index 9e41bf026a7..7783137dc09 100644
--- a/clang/test/CodeGenObjCXX/copy.mm
+++ b/clang/test/CodeGenObjCXX/copy.mm
@@ -11,7 +11,7 @@ namespace test0 {
// CHECK: alloca
// CHECK-NEXT: getelementptr
// CHECK-NEXT: store
- // CHECK-NEXT: call noalias i8* @_Znwm(
+ // CHECK-NEXT: call i8* @_Znwm(
// CHECK-NEXT: bitcast
// CHECK-NEXT: bitcast
// CHECK-NEXT: bitcast
diff --git a/clang/test/Modules/explicit-build-flags.cpp b/clang/test/Modules/explicit-build-flags.cpp
index 12523fa3dd9..39fd8d1e41b 100644
--- a/clang/test/Modules/explicit-build-flags.cpp
+++ b/clang/test/Modules/explicit-build-flags.cpp
@@ -35,6 +35,9 @@
// RUN: %clang_cc1 -fmodules -DFOO=1 -fsanitize=address -x c++ -fmodule-name=tmp %t/map -emit-module -o %t/tmp-san.pcm
// RUN: %clang_cc1 -fmodules -DBAR=2 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp-san.pcm -verify -I%t %s
+// -fno-assume-sane-operator-new is implied by the driver -fsanitize=address flag.
+// RUN: %clang_cc1 -fmodules -DBAR=2 -fno-assume-sane-operator-new -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
+
// Can use the module if -O flags change.
// RUN: %clang_cc1 -fmodules -DBAR=2 -Os -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s
//
OpenPOWER on IntegriCloud