[llvm-branch-commits] [cfe-branch] r292947 - Merging r292874:
Author: hans Date: Tue Jan 24 10:53:43 2017 New Revision: 292947 URL: http://llvm.org/viewvc/llvm-project?rev=292947&view=rev Log: Merging r292874: r292874 | dcoughlin | 2017-01-23 18:10:59 -0800 (Mon, 23 Jan 2017) | 6 lines Revert "[analyzer] Fix memory space of static locals seen from nested blocks." This reverts commit r292800. It is causing null pointer dereference false positives when a block that captures a static local is evaluated at the top level. Modified: cfe/branches/release_40/ (props changed) cfe/branches/release_40/lib/StaticAnalyzer/Core/MemRegion.cpp cfe/branches/release_40/test/Analysis/dispatch-once.m Propchange: cfe/branches/release_40/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jan 24 10:53:43 2017 @@ -1,4 +1,4 @@ /cfe/branches/type-system-rewrite:134693-134817 -/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291964,292032,292052,292183,292247,292265,292497,292555,292558-292559,292800,292847 +/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291964,292032,292052,292183,292247,292265,292497,292555,292558-292559,292800,292847,292874 /cfe/trunk/test:170344 /cfe/trunk/test/SemaTemplate:126920 Modified: cfe/branches/release_40/lib/StaticAnalyzer/Core/MemRegion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/lib/StaticAnalyzer/Core/MemRegion.cpp?rev=292947&r1=292946&r2=292947&view=diff == --- cfe/branches/release_40/lib/StaticAnalyzer/Core/MemRegion.cpp (original) +++ cfe/branches/release_40/lib/StaticAnalyzer/Core/MemRegion.cpp Tue Jan 24 10:53:43 2017 @@ -776,22 +776,6 @@ getStackOrCaptureRegionForDeclContext(co return (const StackFrameContext *)nullptr; } -static CanQualType getBlockPointerType(const BlockDecl *BD, ASTContext &C) { - // FIXME: The fallback type here is totally bogus -- though it should - // never be queried, it will prevent uniquing with the real - // BlockCodeRegion. Ideally we'd fix the AST so that we always had a - // signature. - QualType T; - if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) -T = TSI->getType(); - if (T.isNull()) -T = C.VoidTy; - if (!T->getAs()) -T = C.getFunctionNoProtoType(T); - T = C.getBlockPointerType(T); - return C.getCanonicalType(T); -} - const VarRegion* MemRegionManager::getVarRegion(const VarDecl *D, const LocationContext *LC) { const MemRegion *sReg = nullptr; @@ -819,7 +803,7 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(); } - // Finally handle locals. + // Finally handle static locals. } else { // FIXME: Once we implement scope handling, we will need to properly lookup // 'D' to the proper LocationContext. @@ -832,22 +816,9 @@ const VarRegion* MemRegionManager::getVa const StackFrameContext *STC = V.get(); -if (!STC) { - if (D->isStaticLocal()) { -const CodeTextRegion *fReg = nullptr; -if (const auto *ND = dyn_cast(DC)) - fReg = getFunctionCodeRegion(ND); -else if (const auto *BD = dyn_cast(DC)) - fReg = getBlockCodeRegion(BD, getBlockPointerType(BD, getContext()), -LC->getAnalysisDeclContext()); -assert(fReg && "Unable to determine code region for a static local!"); -sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, fReg); - } else { -// We're looking at a block-captured local variable, which may be either -// still local, or already moved to the heap. So we're not sure. -sReg = getUnknownRegion(); - } -} else { +if (!STC) + sReg = getUnknownRegion(); +else { if (D->hasLocalStorage()) { sReg = isa(D) || isa(D) ? static_cast(getStackArgumentsRegion(STC)) @@ -860,9 +831,22 @@ const VarRegion* MemRegionManager::getVa sReg = getGlobalsRegion(MemRegion::StaticGlobalSpaceRegionKind, getFunctionCodeRegion(cast(STCD))); else if (const BlockDecl *BD = dyn_cast(STCD)) { + // FIXME: The fallback type here is totally bogus -- though it should + // never be queried, it will prevent uniquing with the real + // BlockCodeRegion. Ideally we'd fix the AST so that we always had a + // signature. + QualType T; + if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) +T = TSI->getType(); + if (T.isNull()) +T = getContext().VoidTy; + if (!T->getAs()) +T = getContext().getFunctionNoProtoType(T); + T = getContext().getBlockPointerType(
[llvm-branch-commits] [llvm-branch] r292951 - Merging r291909:
Author: hans Date: Tue Jan 24 10:58:58 2017 New Revision: 292951 URL: http://llvm.org/viewvc/llvm-project?rev=292951&view=rev Log: Merging r291909: r291909 | compnerd | 2017-01-13 08:25:33 -0800 (Fri, 13 Jan 2017) | 9 lines ARM: match GCC's behaviour for builtins GCC changes the CC between the user-code and the builtins based on the value of `-target` rather than `-mfloat-abi`. When a HF target is used, the VFP variant of the AAPCS CC is used. Otherwise, the AAPCS variant is used. In all cases, the AEABI functions use the AAPCS CC. Adjust the calling convention based on the target. Resolves PR30543! Added: llvm/branches/release_40/test/CodeGen/Thumb2/intrinsics-cc.ll - copied unchanged from r291909, llvm/trunk/test/CodeGen/Thumb2/intrinsics-cc.ll Modified: llvm/branches/release_40/ (props changed) llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.h llvm/branches/release_40/test/CodeGen/Thumb2/float-intrinsics-double.ll llvm/branches/release_40/test/CodeGen/Thumb2/float-intrinsics-float.ll Propchange: llvm/branches/release_40/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Tue Jan 24 10:58:58 2017 @@ -1,3 +1,3 @@ /llvm/branches/Apple/Pertwee:110850,110961 /llvm/branches/type-system-rewrite:133420-134817 -/llvm/trunk:155241,291858-291859,291863,291875,291966,291968,291979,292133,292242,292254-292255,292280,292323,292467,292583,292625,292641,292667,292711,292758 +/llvm/trunk:155241,291858-291859,291863,291875,291909,291966,291968,291979,292133,292242,292254-292255,292280,292323,292467,292583,292625,292641,292667,292711,292758 Modified: llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp?rev=292951&r1=292950&r2=292951&view=diff == --- llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/branches/release_40/lib/Target/ARM/ARMISelLowering.cpp Tue Jan 24 10:58:58 2017 @@ -97,171 +97,6 @@ namespace { }; } -void ARMTargetLowering::InitLibcallCallingConvs() { - // The builtins on ARM always use AAPCS, irrespective of wheter C is AAPCS or - // AAPCS_VFP. - for (const auto LC : { - RTLIB::SHL_I16, - RTLIB::SHL_I32, - RTLIB::SHL_I64, - RTLIB::SHL_I128, - RTLIB::SRL_I16, - RTLIB::SRL_I32, - RTLIB::SRL_I64, - RTLIB::SRL_I128, - RTLIB::SRA_I16, - RTLIB::SRA_I32, - RTLIB::SRA_I64, - RTLIB::SRA_I128, - RTLIB::MUL_I8, - RTLIB::MUL_I16, - RTLIB::MUL_I32, - RTLIB::MUL_I64, - RTLIB::MUL_I128, - RTLIB::MULO_I32, - RTLIB::MULO_I64, - RTLIB::MULO_I128, - RTLIB::SDIV_I8, - RTLIB::SDIV_I16, - RTLIB::SDIV_I32, - RTLIB::SDIV_I64, - RTLIB::SDIV_I128, - RTLIB::UDIV_I8, - RTLIB::UDIV_I16, - RTLIB::UDIV_I32, - RTLIB::UDIV_I64, - RTLIB::UDIV_I128, - RTLIB::SREM_I8, - RTLIB::SREM_I16, - RTLIB::SREM_I32, - RTLIB::SREM_I64, - RTLIB::SREM_I128, - RTLIB::UREM_I8, - RTLIB::UREM_I16, - RTLIB::UREM_I32, - RTLIB::UREM_I64, - RTLIB::UREM_I128, - RTLIB::SDIVREM_I8, - RTLIB::SDIVREM_I16, - RTLIB::SDIVREM_I32, - RTLIB::SDIVREM_I64, - RTLIB::SDIVREM_I128, - RTLIB::UDIVREM_I8, - RTLIB::UDIVREM_I16, - RTLIB::UDIVREM_I32, - RTLIB::UDIVREM_I64, - RTLIB::UDIVREM_I128, - RTLIB::NEG_I32, - RTLIB::NEG_I64, - RTLIB::ADD_F32, - RTLIB::ADD_F64, - RTLIB::ADD_F80, - RTLIB::ADD_F128, - RTLIB::SUB_F32, - RTLIB::SUB_F64, - RTLIB::SUB_F80, - RTLIB::SUB_F128, - RTLIB::MUL_F32, - RTLIB::MUL_F64, - RTLIB::MUL_F80, - RTLIB::MUL_F128, - RTLIB::DIV_F32, - RTLIB::DIV_F64, - RTLIB::DIV_F80, - RTLIB::DIV_F128, - RTLIB::POWI_F32, - RTLIB::POWI_F64, - RTLIB::POWI_F80, - RTLIB::POWI_F128, - RTLIB::FPEXT_F64_F128, - RTLIB::FPEXT_F32_F128, - RTLIB::FPEXT_F32_F64, - RTLIB::FPEXT_F16_F32, - RTLIB::FPROUND_F32_F16, - RTLIB::FPROUND_F64_F16, - RTLIB::FPROUND_F80_F16, - RTLIB::FPROUND_F128_F16, - RTLIB::FPROUND_F64_F32, - RTLIB::FPROUN