[llvm-branch-commits] [lldb] r287747 - Merging r284001:
Author: nitesh.jain Date: Wed Nov 23 02:18:42 2016 New Revision: 287747 URL: http://llvm.org/viewvc/llvm-project?rev=287747&view=rev Log: Merging r284001: r284001 | nitesh.jain | 2016-10-12 15:51:09 +0530 (Wed, 12 Oct 2016) | 7 lines [LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI Reviewers: clayborg, labath Subscribers: jaydeep, bhushan, slthakur, lldb-commits Differential Revision: https://reviews.llvm.org/D25021 Modified: lldb/branches/release_39/ (props changed) lldb/branches/release_39/include/lldb/Core/ArchSpec.h lldb/branches/release_39/source/Core/ArchSpec.cpp lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp Propchange: lldb/branches/release_39/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Wed Nov 23 02:18:42 2016 @@ -1,3 +1,3 @@ /lldb/branches/apple/python-GIL:156467-162159 /lldb/branches/iohandler:198360-200250 -/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284003 +/lldb/trunk:277343,277426,277997,277999,278001,283728-283729,284001,284003 Modified: lldb/branches/release_39/include/lldb/Core/ArchSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/include/lldb/Core/ArchSpec.h?rev=287747&r1=287746&r2=287747&view=diff == --- lldb/branches/release_39/include/lldb/Core/ArchSpec.h (original) +++ lldb/branches/release_39/include/lldb/Core/ArchSpec.h Wed Nov 23 02:18:42 2016 @@ -382,6 +382,14 @@ public: return m_core >= eCore_arm_generic && m_core < kNumCores; } +//-- +/// Return a string representing target application ABI. +/// +/// @return A string representing target application ABI. +//-- +std::string GetTargetABI() const; + + bool TripleVendorWasSpecified() const { @@ -677,6 +685,8 @@ public: m_flags = flags; } + void SetFlags(std::string elf_abi); + protected: bool IsEqualTo (const ArchSpec& rhs, bool exact_match) const; Modified: lldb/branches/release_39/source/Core/ArchSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Core/ArchSpec.cpp?rev=287747&r1=287746&r2=287747&view=diff == --- lldb/branches/release_39/source/Core/ArchSpec.cpp (original) +++ lldb/branches/release_39/source/Core/ArchSpec.cpp Wed Nov 23 02:18:42 2016 @@ -519,11 +519,46 @@ ArchSpec::IsMIPS() const return false; } -std::string -ArchSpec::GetClangTargetCPU () -{ -std::string cpu; -const llvm::Triple::ArchType machine = GetMachine(); + +std::string ArchSpec::GetTargetABI() const { + + std::string abi; + + if (IsMIPS()) { +switch (GetFlags() & ArchSpec::eMIPSABI_mask) { +case ArchSpec::eMIPSABI_N64: + abi = "n64"; + return abi; +case ArchSpec::eMIPSABI_N32: + abi = "n32"; + return abi; +case ArchSpec::eMIPSABI_O32: + abi = "o32"; + return abi; +default: + return abi; +} + } + return abi; +} + +void ArchSpec::SetFlags(std::string elf_abi) { + + uint32_t flag = GetFlags(); + if (IsMIPS()) { +if (elf_abi == "n64") + flag |= ArchSpec::eMIPSABI_N64; +else if (elf_abi == "n32") + flag |= ArchSpec::eMIPSABI_N32; +else if (elf_abi == "o32") + flag |= ArchSpec::eMIPSABI_O32; + } + SetFlags(flag); +} + +std::string ArchSpec::GetClangTargetCPU() { + std::string cpu; + const llvm::Triple::ArchType machine = GetMachine(); if (machine == llvm::Triple::mips || machine == llvm::Triple::mipsel || Modified: lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=287747&r1=287746&r2=287747&view=diff == --- lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original) +++ lldb/branches/release_39/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Wed Nov 23 02:18:42 2016 @@ -2856,6 +2856,7 @@ GDBRemoteCommunicationClient::GetCurrent std::string os_name; std::string vendor_name; std::string triple; +std::string elf_abi; uint32_t pointer_byte_size = 0; StringExtractor extractor; Byt
[llvm-branch-commits] [llvm-branch] r287777 - Merging r280143:
Author: tstellar Date: Wed Nov 23 11:05:01 2016 New Revision: 28 URL: http://llvm.org/viewvc/llvm-project?rev=28&view=rev Log: Merging r280143: r280143 | dberlin | 2016-08-30 12:58:48 -0700 (Tue, 30 Aug 2016) | 2 lines IntrArgMemOnly is only defined (and current AA machinery only sanely supports) pointer arguments, and these intrinsics have vector of pointer arguments. Remove ArgMemOnly until we either have the machinery, define a new attribute, or something similar Added: llvm/branches/release_39/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll Modified: llvm/branches/release_39/include/llvm/IR/Intrinsics.td Modified: llvm/branches/release_39/include/llvm/IR/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/include/llvm/IR/Intrinsics.td?rev=28&r1=287776&r2=28&view=diff == --- llvm/branches/release_39/include/llvm/IR/Intrinsics.td (original) +++ llvm/branches/release_39/include/llvm/IR/Intrinsics.td Wed Nov 23 11:05:01 2016 @@ -668,13 +668,12 @@ def int_masked_gather: Intrinsic<[llvm_a [LLVMVectorOfPointersToElt<0>, llvm_i32_ty, LLVMVectorSameWidth<0, llvm_i1_ty>, LLVMMatchType<0>], - [IntrReadMem, IntrArgMemOnly]>; + [IntrReadMem]>; def int_masked_scatter: Intrinsic<[], [llvm_anyvector_ty, LLVMVectorOfPointersToElt<0>, llvm_i32_ty, - LLVMVectorSameWidth<0, llvm_i1_ty>], - [IntrArgMemOnly]>; + LLVMVectorSameWidth<0, llvm_i1_ty>]>; // Test whether a pointer is associated with a type metadata identifier. def int_type_test : Intrinsic<[llvm_i1_ty], [llvm_ptr_ty, llvm_metadata_ty], Added: llvm/branches/release_39/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll?rev=28&view=auto == --- llvm/branches/release_39/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll (added) +++ llvm/branches/release_39/test/Transforms/GVN/2016-08-30-MaskedScatterGather.ll Wed Nov 23 11:05:01 2016 @@ -0,0 +1,42 @@ +; RUN: opt < %s -basicaa -gvn -S | FileCheck %s + +declare void @llvm.masked.scatter.v2i32(<2 x i32> , <2 x i32*> , i32 , <2 x i1> ) +declare <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*>, i32, <2 x i1>, <2 x i32>) + +; This test ensures that masked scatter and gather operations, which take vectors of pointers, +; do not have pointer aliasing ignored when being processed. +; No scatter/gather calls should end up eliminated +; CHECK: llvm.masked.gather +; CHECK: llvm.masked.gather +; CHECK: llvm.masked.scatter +; CHECK: llvm.masked.gather +; CHECK: llvm.masked.scatter +; CHECK: llvm.masked.gather +define spir_kernel void @test(<2 x i32*> %in1, <2 x i32*> %in2, i32* %out) { +entry: + ; Just some temporary storage + %tmp.0 = alloca i32 + %tmp.1 = alloca i32 + %tmp.i = insertelement <2 x i32*> undef, i32* %tmp.0, i32 0 + %tmp = insertelement <2 x i32*> %tmp.i, i32* %tmp.1, i32 1 + ; Read from in1 and in2 + %in1.v = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %in1, i32 1, <2 x i1> , <2 x i32> undef) #1 + %in2.v = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %in2, i32 1, <2 x i1> , <2 x i32> undef) #1 + ; Store in1 to the allocas + call void @llvm.masked.scatter.v2i32(<2 x i32> %in1.v, <2 x i32*> %tmp, i32 1, <2 x i1> ); + ; Read in1 from the allocas + ; This gather should alias the scatter we just saw + %tmp.v.0 = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %tmp, i32 1, <2 x i1> , <2 x i32> undef) #1 + ; Store in2 to the allocas + call void @llvm.masked.scatter.v2i32(<2 x i32> %in2.v, <2 x i32*> %tmp, i32 1, <2 x i1> ); + ; Read in2 from the allocas + ; This gather should alias the scatter we just saw, and not be eliminated + %tmp.v.1 = call <2 x i32> @llvm.masked.gather.v2i32(<2 x i32*> %tmp, i32 1, <2 x i1> , <2 x i32> undef) #1 + ; Store in2 to out for good measure + %tmp.v.1.0 = extractelement <2 x i32> %tmp.v.1, i32 0 + %tmp.v.1.1 = extractelement <2 x i32> %tmp.v.1, i32 1 + store i32 %tmp.v.1.0, i32* %out + %out.1 = getelementptr i32, i32* %out, i32 1 + store i32 %tmp.v.1.1, i32* %out.1 + ret void +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-branch] r287779 - Merging r279930:
Author: tstellar Date: Wed Nov 23 11:26:28 2016 New Revision: 287779 URL: http://llvm.org/viewvc/llvm-project?rev=287779&view=rev Log: Merging r279930: r279930 | elena.demikhovsky | 2016-08-28 01:53:53 -0700 (Sun, 28 Aug 2016) | 7 lines [Loop Vectorizer] Fixed memory confilict checks. Fixed a bug in run-time checks for possible memory conflicts inside loop. The bug is in Low <-> High boundaries calculation. The High boundary should be calculated as "last memory access pointer + element size". Differential revision: https://reviews.llvm.org/D23176 Added: llvm/branches/release_39/test/Analysis/LoopAccessAnalysis/memcheck-off-by-one-error.ll Modified: llvm/branches/release_39/include/llvm/Analysis/LoopAccessAnalysis.h llvm/branches/release_39/lib/Analysis/LoopAccessAnalysis.cpp llvm/branches/release_39/test/Analysis/LoopAccessAnalysis/number-of-memchecks.ll llvm/branches/release_39/test/Analysis/LoopAccessAnalysis/reverse-memcheck-bounds.ll llvm/branches/release_39/test/Transforms/LoopVectorize/runtime-check-readonly.ll llvm/branches/release_39/test/Transforms/LoopVectorize/tbaa-nodep.ll llvm/branches/release_39/test/Transforms/LoopVersioningLICM/loopversioningLICM1.ll Modified: llvm/branches/release_39/include/llvm/Analysis/LoopAccessAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/include/llvm/Analysis/LoopAccessAnalysis.h?rev=287779&r1=287778&r2=287779&view=diff == --- llvm/branches/release_39/include/llvm/Analysis/LoopAccessAnalysis.h (original) +++ llvm/branches/release_39/include/llvm/Analysis/LoopAccessAnalysis.h Wed Nov 23 11:26:28 2016 @@ -334,9 +334,11 @@ public: struct PointerInfo { /// Holds the pointer value that we need to check. TrackingVH PointerValue; -/// Holds the pointer value at the beginning of the loop. +/// Holds the smallest byte address accessed by the pointer throughout all +/// iterations of the loop. const SCEV *Start; -/// Holds the pointer value at the end of the loop. +/// Holds the largest byte address accessed by the pointer throughout all +/// iterations of the loop, plus 1. const SCEV *End; /// Holds the information if this pointer is used for writing to memory. bool IsWritePtr; Modified: llvm/branches/release_39/lib/Analysis/LoopAccessAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Analysis/LoopAccessAnalysis.cpp?rev=287779&r1=287778&r2=287779&view=diff == --- llvm/branches/release_39/lib/Analysis/LoopAccessAnalysis.cpp (original) +++ llvm/branches/release_39/lib/Analysis/LoopAccessAnalysis.cpp Wed Nov 23 11:26:28 2016 @@ -148,6 +148,19 @@ const SCEV *llvm::replaceSymbolicStrideS return OrigSCEV; } +/// Calculate Start and End points of memory access. +/// Let's assume A is the first access and B is a memory access on N-th loop +/// iteration. Then B is calculated as: +/// B = A + Step*N . +/// Step value may be positive or negative. +/// N is a calculated back-edge taken count: +/// N = (TripCount > 0) ? RoundDown(TripCount -1 , VF) : 0 +/// Start and End points are calculated in the following way: +/// Start = UMIN(A, B) ; End = UMAX(A, B) + SizeOfElt, +/// where SizeOfElt is the size of single memory access in bytes. +/// +/// There is no conflict when the intervals are disjoint: +/// NoConflict = (P2.Start >= P1.End) || (P1.Start >= P2.End) void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, bool WritePtr, unsigned DepSetId, unsigned ASId, const ValueToValueMap &Strides, @@ -176,12 +189,17 @@ void RuntimePointerChecking::insert(Loop if (CStep->getValue()->isNegative()) std::swap(ScStart, ScEnd); } else { - // Fallback case: the step is not constant, but the we can still + // Fallback case: the step is not constant, but we can still // get the upper and lower bounds of the interval by using min/max // expressions. ScStart = SE->getUMinExpr(ScStart, ScEnd); ScEnd = SE->getUMaxExpr(AR->getStart(), ScEnd); } +// Add the size of the pointed element to ScEnd. +unsigned EltSize = + Ptr->getType()->getPointerElementType()->getScalarSizeInBits() / 8; +const SCEV *EltSizeSCEV = SE->getConstant(ScEnd->getType(), EltSize); +ScEnd = SE->getAddExpr(ScEnd, EltSizeSCEV); } Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, Sc); @@ -1863,9 +1881,17 @@ std::pair Value *End0 = ChkBuilder.CreateBitCast(A.End, PtrArithTy1, "bc"); Value *End1 = ChkBuilder.CreateBitCast(B.End, PtrArithTy0, "bc"); -Value
[llvm-branch-commits] [cfe-branch] r287784 - [LTO] Merge r287685 into the 3.9.1 branch, darwin: Unconditionally pass -lto_library, remove -Wliblto warning.
Author: mehdi_amini Date: Wed Nov 23 12:00:06 2016 New Revision: 287784 URL: http://llvm.org/viewvc/llvm-project?rev=287784&view=rev Log: [LTO] Merge r287685 into the 3.9.1 branch, darwin: Unconditionally pass -lto_library, remove -Wliblto warning. See: https://llvm.org/bugs/PR31120 Modified: cfe/branches/release_39/include/clang/Basic/DiagnosticDriverKinds.td cfe/branches/release_39/lib/Driver/Tools.cpp cfe/branches/release_39/test/Driver/darwin-ld-lto.c Modified: cfe/branches/release_39/include/clang/Basic/DiagnosticDriverKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/include/clang/Basic/DiagnosticDriverKinds.td?rev=287784&r1=287783&r2=287784&view=diff == --- cfe/branches/release_39/include/clang/Basic/DiagnosticDriverKinds.td (original) +++ cfe/branches/release_39/include/clang/Basic/DiagnosticDriverKinds.td Wed Nov 23 12:00:06 2016 @@ -159,8 +159,6 @@ def err_drv_bitcode_unsupported_on_toolc "-fembed-bitcode is not supported on versions of iOS prior to 6.0">; def warn_O4_is_O3 : Warning<"-O4 is equivalent to -O3">, InGroup; -def warn_drv_lto_libpath : Warning<"libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead">, - InGroup; def warn_drv_optimization_value : Warning<"optimization level '%0' is not supported; using '%1%2' instead">, InGroup; def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not supported">, Modified: cfe/branches/release_39/lib/Driver/Tools.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Driver/Tools.cpp?rev=287784&r1=287783&r2=287784&view=diff == --- cfe/branches/release_39/lib/Driver/Tools.cpp (original) +++ cfe/branches/release_39/lib/Driver/Tools.cpp Wed Nov 23 12:00:06 2016 @@ -7640,20 +7640,20 @@ void darwin::Linker::AddLinkArgs(Compila } // Use -lto_library option to specify the libLTO.dylib path. Try to find - // it in clang installed libraries. If not found, the option is not used - // and 'ld' will use its default mechanism to search for libLTO.dylib. + // it in clang installed libraries. ld64 will only look at this argument + // when it actually uses LTO, so libLTO.dylib only needs to exist at link + // time if ld64 decides that it needs to use LTO. + // Since this is passed unconditionally, ld64 will never look for libLTO.dylib + // next to it. That's ok since ld64 using a libLTO.dylib not matching the + // clang version won't work anyways. if (Version[0] >= 133) { // Search for libLTO in /../lib/libLTO.dylib StringRef P = llvm::sys::path::parent_path(D.Dir); SmallString<128> LibLTOPath(P); llvm::sys::path::append(LibLTOPath, "lib"); llvm::sys::path::append(LibLTOPath, "libLTO.dylib"); -if (llvm::sys::fs::exists(LibLTOPath)) { - CmdArgs.push_back("-lto_library"); - CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath)); -} else { - D.Diag(diag::warn_drv_lto_libpath); -} +CmdArgs.push_back("-lto_library"); +CmdArgs.push_back(C.getArgs().MakeArgString(LibLTOPath)); } // Derived from the "link" spec. Modified: cfe/branches/release_39/test/Driver/darwin-ld-lto.c URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Driver/darwin-ld-lto.c?rev=287784&r1=287783&r2=287784&view=diff == --- cfe/branches/release_39/test/Driver/darwin-ld-lto.c (original) +++ cfe/branches/release_39/test/Driver/darwin-ld-lto.c Wed Nov 23 12:00:06 2016 @@ -1,6 +1,6 @@ // REQUIRES: system-darwin -// Check that ld gets "-lto_library" and warnings about libLTO.dylib path. +// Check that ld gets "-lto_library". // RUN: %clang -target x86_64-apple-darwin10 -### %s \ // RUN: -ccc-install-dir %T/bin -mlinker-version=133 2> %t.log @@ -9,16 +9,8 @@ // LINK_LTOLIB_PATH: {{ld(.exe)?"}} // LINK_LTOLIB_PATH: "-lto_library" +// Also pass -lto_library even if the file doesn't exist; if it's needed at +// link time, ld will complain instead. // RUN: %clang -target x86_64-apple-darwin10 -### %s \ // RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 2> %t.log -// RUN: cat %t.log -// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_WRN %s < %t.log -// -// LINK_LTOLIB_PATH_WRN: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead - -// RUN: %clang -target x86_64-apple-darwin10 -### %s \ -// RUN: -ccc-install-dir %S/dummytestdir -mlinker-version=133 -Wno-liblto 2> %t.log -// RUN: cat %t.log -// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH_NOWRN %s < %t.log -// -// LINK_LTOLIB_PATH_NOWRN-NOT: warning: libLTO.dylib relative to clang installed dir not found; using 'ld' default search path instead +// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log _
[llvm-branch-commits] [cfe-branch] r287790 - Merging r281797:
Author: tstellar Date: Wed Nov 23 12:21:42 2016 New Revision: 287790 URL: http://llvm.org/viewvc/llvm-project?rev=287790&view=rev Log: Merging r281797: r281797 | richard-llvm | 2016-09-16 16:30:39 -0700 (Fri, 16 Sep 2016) | 10 lines Fix a couple of wrong-code bugs in switch-on-constant optimization: * recurse through intermediate LabelStmts and AttributedStmts when checking whether a statement inside a switch declares a variable * if the end of a compound statement is reachable from the chosen case label, and the compound statement contains a variable declaration, it's not valid to just emit the contents of the compound statement -- we must emit the statement itself or we lose the scope (and thus end lifetimes at the wrong point) Modified: cfe/branches/release_39/lib/CodeGen/CGStmt.cpp cfe/branches/release_39/lib/CodeGen/CodeGenFunction.cpp cfe/branches/release_39/lib/CodeGen/CodeGenFunction.h cfe/branches/release_39/test/CodeGenCXX/switch-case-folding-2.cpp Modified: cfe/branches/release_39/lib/CodeGen/CGStmt.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CGStmt.cpp?rev=287790&r1=287789&r2=287790&view=diff == --- cfe/branches/release_39/lib/CodeGen/CGStmt.cpp (original) +++ cfe/branches/release_39/lib/CodeGen/CGStmt.cpp Wed Nov 23 12:21:42 2016 @@ -1323,6 +1323,10 @@ static CSFC_Result CollectStatementsForC // Handle this as two cases: we might be looking for the SwitchCase (if so // the skipped statements must be skippable) or we might already have it. CompoundStmt::const_body_iterator I = CS->body_begin(), E = CS->body_end(); +bool StartedInLiveCode = FoundCase; +unsigned StartSize = ResultStmts.size(); + +// If we've not found the case yet, scan through looking for it. if (Case) { // Keep track of whether we see a skipped declaration. The code could be // using the declaration even if it is skipped, so we can't optimize out @@ -1332,7 +1336,7 @@ static CSFC_Result CollectStatementsForC // If we're looking for the case, just see if we can skip each of the // substatements. for (; Case && I != E; ++I) { -HadSkippedDecl |= isa(*I); +HadSkippedDecl |= CodeGenFunction::mightAddDeclToScope(*I); switch (CollectStatementsForCase(*I, Case, FoundCase, ResultStmts)) { case CSFC_Failure: return CSFC_Failure; @@ -1368,11 +1372,19 @@ static CSFC_Result CollectStatementsForC break; } } + + if (!FoundCase) +return CSFC_Success; + + assert(!HadSkippedDecl && "fallthrough after skipping decl"); } // If we have statements in our range, then we know that the statements are // live and need to be added to the set of statements we're tracking. +bool AnyDecls = false; for (; I != E; ++I) { + AnyDecls |= CodeGenFunction::mightAddDeclToScope(*I); + switch (CollectStatementsForCase(*I, nullptr, FoundCase, ResultStmts)) { case CSFC_Failure: return CSFC_Failure; case CSFC_FallThrough: @@ -1390,7 +1402,24 @@ static CSFC_Result CollectStatementsForC } } -return Case ? CSFC_Success : CSFC_FallThrough; +// If we're about to fall out of a scope without hitting a 'break;', we +// can't perform the optimization if there were any decls in that scope +// (we'd lose their end-of-lifetime). +if (AnyDecls) { + // If the entire compound statement was live, there's one more thing we + // can try before giving up: emit the whole thing as a single statement. + // We can do that unless the statement contains a 'break;'. + // FIXME: Such a break must be at the end of a construct within this one. + // We could emit this by just ignoring the BreakStmts entirely. + if (StartedInLiveCode && !CodeGenFunction::containsBreak(S)) { +ResultStmts.resize(StartSize); +ResultStmts.push_back(S); + } else { +return CSFC_Failure; + } +} + +return CSFC_FallThrough; } // Okay, this is some other statement that we don't handle explicitly, like a Modified: cfe/branches/release_39/lib/CodeGen/CodeGenFunction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/CodeGen/CodeGenFunction.cpp?rev=287790&r1=287789&r2=287790&view=diff == --- cfe/branches/release_39/lib/CodeGen/CodeGenFunction.cpp (original) +++ cfe/branches/release_39/lib/CodeGen/CodeGenFunction.cpp Wed Nov 23 12:21:42 2016 @@ -25,6 +25,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/StmtCXX.h" +#include "clang/AST/StmtObjC.h" #include "clang/Basic/Builtins.h" #include "
[llvm-branch-commits] [llvm-branch] r287805 - Merge r287453 in 3.9.1 : [ThinLTO] Fix crash when importing an opaque type
Author: mehdi_amini Date: Wed Nov 23 14:52:51 2016 New Revision: 287805 URL: http://llvm.org/viewvc/llvm-project?rev=287805&view=rev Log: Merge r287453 in 3.9.1 : [ThinLTO] Fix crash when importing an opaque type See: http://llvm.org/PR31072 Added: llvm/branches/release_39/test/ThinLTO/X86/Inputs/import_opaque_type.ll llvm/branches/release_39/test/ThinLTO/X86/import_opaque_type.ll Modified: llvm/branches/release_39/lib/Linker/IRMover.cpp Modified: llvm/branches/release_39/lib/Linker/IRMover.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Linker/IRMover.cpp?rev=287805&r1=287804&r2=287805&view=diff == --- llvm/branches/release_39/lib/Linker/IRMover.cpp (original) +++ llvm/branches/release_39/lib/Linker/IRMover.cpp Wed Nov 23 14:52:51 2016 @@ -1336,7 +1336,7 @@ bool IRMover::IdentifiedStructTypeSet::h IRMover::IRMover(Module &M) : Composite(M) { TypeFinder StructTypes; - StructTypes.run(M, true); + StructTypes.run(M, /* OnlyNamed */ false); for (StructType *Ty : StructTypes) { if (Ty->isOpaque()) IdentifiedStructTypes.addOpaque(Ty); Added: llvm/branches/release_39/test/ThinLTO/X86/Inputs/import_opaque_type.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/ThinLTO/X86/Inputs/import_opaque_type.ll?rev=287805&view=auto == --- llvm/branches/release_39/test/ThinLTO/X86/Inputs/import_opaque_type.ll (added) +++ llvm/branches/release_39/test/ThinLTO/X86/Inputs/import_opaque_type.ll Wed Nov 23 14:52:51 2016 @@ -0,0 +1,15 @@ +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.11.0" + +%0 = type { i8 } + +%a = type { %0 * } + +define void @bar(%a *) { + ret void +} + +define void @baz() { + call void @bar(%a *null) + ret void +} Added: llvm/branches/release_39/test/ThinLTO/X86/import_opaque_type.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/ThinLTO/X86/import_opaque_type.ll?rev=287805&view=auto == --- llvm/branches/release_39/test/ThinLTO/X86/import_opaque_type.ll (added) +++ llvm/branches/release_39/test/ThinLTO/X86/import_opaque_type.ll Wed Nov 23 14:52:51 2016 @@ -0,0 +1,27 @@ +; Do setup work for all below tests: generate bitcode and combined index +; RUN: opt -module-summary %s -o %t.bc +; RUN: opt -module-summary %p/Inputs/import_opaque_type.ll -o %t2.bc +; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc + +; Check that we import correctly the imported type to replace the opaque one here +; RUN: llvm-lto -thinlto-action=import %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s + + +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-apple-macosx10.11.0" + +; CHECK: %0 = type { i8 } +%0 = type opaque + +%a = type { %0 * } + +declare void @baz() +define void @foo(%a *) { + call void @baz() + ret void +} + +define i32 @main() { +call void @foo(%a *null) + ret i32 0 +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm-branch] r287809 - Merging r281479:
Author: tstellar Date: Wed Nov 23 15:03:25 2016 New Revision: 287809 URL: http://llvm.org/viewvc/llvm-project?rev=287809&view=rev Log: Merging r281479: r281479 | nemanja.i.ibm | 2016-09-14 07:19:09 -0700 (Wed, 14 Sep 2016) | 9 lines Fix code-gen crash on Power9 for insert_vector_elt with variable index (PR30189) This patch corresponds to review: https://reviews.llvm.org/D24021 In the initial implementation of this instruction, I forgot to account for variable indices. This patch fixes PR30189 and should probably be merged into 3.9.1 (I'll open a bug according to the new instructions). Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h llvm/branches/release_39/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp?rev=287809&r1=287808&r2=287809&view=diff == --- llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 23 15:03:25 2016 @@ -665,9 +665,10 @@ PPCTargetLowering::PPCTargetLowering(con addRegisterClass(MVT::v2i64, &PPC::VRRCRegClass); addRegisterClass(MVT::v1i128, &PPC::VRRCRegClass); } + if (Subtarget.hasP9Vector()) { - setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i32, Legal); - setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4f32, Legal); + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4i32, Custom); + setOperationAction(ISD::INSERT_VECTOR_ELT, MVT::v4f32, Custom); } } @@ -7846,6 +7847,17 @@ SDValue PPCTargetLowering::LowerSCALAR_T return DAG.getLoad(Op.getValueType(), dl, Store, FIdx, MachinePointerInfo()); } +SDValue PPCTargetLowering::LowerINSERT_VECTOR_ELT(SDValue Op, + SelectionDAG &DAG) const { + assert(Op.getOpcode() == ISD::INSERT_VECTOR_ELT && + "Should only be called for ISD::INSERT_VECTOR_ELT"); + ConstantSDNode *C = dyn_cast(Op.getOperand(2)); + // We have legal lowering for constant indices but not for variable ones. + if (C) +return Op; + return SDValue(); +} + SDValue PPCTargetLowering::LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const { SDLoc dl(Op); @@ -8248,6 +8260,7 @@ SDValue PPCTargetLowering::LowerOperatio case ISD::SCALAR_TO_VECTOR: return LowerSCALAR_TO_VECTOR(Op, DAG); case ISD::SIGN_EXTEND_INREG: return LowerSIGN_EXTEND_INREG(Op, DAG); case ISD::EXTRACT_VECTOR_ELT: return LowerEXTRACT_VECTOR_ELT(Op, DAG); + case ISD::INSERT_VECTOR_ELT: return LowerINSERT_VECTOR_ELT(Op, DAG); case ISD::MUL:return LowerMUL(Op, DAG); // For counter-based loop handling. Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h?rev=287809&r1=287808&r2=287809&view=diff == --- llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h Wed Nov 23 15:03:25 2016 @@ -824,6 +824,7 @@ namespace llvm { SDValue LowerSRA_PARTS(SDValue Op, SelectionDAG &DAG) const; SDValue LowerBUILD_VECTOR(SDValue Op, SelectionDAG &DAG) const; SDValue LowerVECTOR_SHUFFLE(SDValue Op, SelectionDAG &DAG) const; +SDValue LowerINSERT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; SDValue LowerEXTRACT_VECTOR_ELT(SDValue Op, SelectionDAG &DAG) const; SDValue LowerINTRINSIC_WO_CHAIN(SDValue Op, SelectionDAG &DAG) const; SDValue LowerSCALAR_TO_VECTOR(SDValue Op, SelectionDAG &DAG) const; Modified: llvm/branches/release_39/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll?rev=287809&r1=287808&r2=287809&view=diff == --- llvm/branches/release_39/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll (original) +++ llvm/branches/release_39/test/CodeGen/PowerPC/p9-xxinsertw-xxextractuw.ll Wed Nov 23 15:03:25 2016 @@ -968,3 +968,25 @@ entry: %vecins = shufflevector <4 x float> %a, <4 x float> %a, <4 x i32> ret <4 x float> %vecins } +define <4 x float> @insertVarF(<4 x float> %a, float %f, i32 %el) { +entry: +; CHECK-LABEL: insertVarF +; CHECK: stxsspx 1, +; CHECK: lxvd2x +; CHECK-BE-LABEL: insertVarF +; CHECK-BE: st
[llvm-branch-commits] [llvm-branch] r287811 - Merging r282182:
Author: tstellar Date: Wed Nov 23 15:17:33 2016 New Revision: 287811 URL: http://llvm.org/viewvc/llvm-project?rev=287811&view=rev Log: Merging r282182: r282182 | nemanja.i.ibm | 2016-09-22 12:06:38 -0700 (Thu, 22 Sep 2016) | 6 lines [PowerPC] Sign extend sub-word values for atomic comparisons Atomic comparison instructions use the sub-word load instruction on Power8 and up but the value is not sign extended prior to the signed word compare instruction. This patch adds that sign extension. Added: llvm/branches/release_39/test/CodeGen/PowerPC/pr30451.ll Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp?rev=287811&r1=287810&r2=287811&view=diff == --- llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 23 15:17:33 2016 @@ -8471,8 +8471,17 @@ PPCTargetLowering::EmitAtomicBinary(Mach if (BinOpcode) BuildMI(BB, dl, TII->get(BinOpcode), TmpReg).addReg(incr).addReg(dest); if (CmpOpcode) { -BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) - .addReg(incr).addReg(dest); +// Signed comparisons of byte or halfword values must be sign-extended. +if (CmpOpcode == PPC::CMPW && AtomicSize < 4) { + unsigned ExtReg = RegInfo.createVirtualRegister(&PPC::GPRCRegClass); + BuildMI(BB, dl, TII->get(AtomicSize == 1 ? PPC::EXTSB : PPC::EXTSH), + ExtReg).addReg(dest); + BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) +.addReg(incr).addReg(ExtReg); +} else + BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) +.addReg(incr).addReg(dest); + BuildMI(BB, dl, TII->get(PPC::BCC)) .addImm(CmpPred).addReg(PPC::CR0).addMBB(exitMBB); BB->addSuccessor(loop2MBB); Added: llvm/branches/release_39/test/CodeGen/PowerPC/pr30451.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/CodeGen/PowerPC/pr30451.ll?rev=287811&view=auto == --- llvm/branches/release_39/test/CodeGen/PowerPC/pr30451.ll (added) +++ llvm/branches/release_39/test/CodeGen/PowerPC/pr30451.ll Wed Nov 23 15:17:33 2016 @@ -0,0 +1,69 @@ +; RUN: llc < %s -mcpu=pwr8 -mtriple=powerpc64le-unknown-unknown | FileCheck %s +define i8 @atomic_min_i8() { +top: + %0 = alloca i8, align 2 + %1 = bitcast i8* %0 to i8* + call void @llvm.lifetime.start(i64 2, i8* %1) + store i8 -1, i8* %0, align 2 + %2 = atomicrmw min i8* %0, i8 0 acq_rel + %3 = load atomic i8, i8* %0 acquire, align 8 + call void @llvm.lifetime.end(i64 2, i8* %1) + ret i8 %3 +; CHECK-LABEL: atomic_min_i8 +; CHECK: lbarx [[DST:[0-9]+]], +; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]] +; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] +; CHECK-NEXT: bge 0 +} +define i16 @atomic_min_i16() { +top: + %0 = alloca i16, align 2 + %1 = bitcast i16* %0 to i8* + call void @llvm.lifetime.start(i64 2, i8* %1) + store i16 -1, i16* %0, align 2 + %2 = atomicrmw min i16* %0, i16 0 acq_rel + %3 = load atomic i16, i16* %0 acquire, align 8 + call void @llvm.lifetime.end(i64 2, i8* %1) + ret i16 %3 +; CHECK-LABEL: atomic_min_i16 +; CHECK: lharx [[DST:[0-9]+]], +; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]] +; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] +; CHECK-NEXT: bge 0 +} + +define i8 @atomic_max_i8() { +top: + %0 = alloca i8, align 2 + %1 = bitcast i8* %0 to i8* + call void @llvm.lifetime.start(i64 2, i8* %1) + store i8 -1, i8* %0, align 2 + %2 = atomicrmw max i8* %0, i8 0 acq_rel + %3 = load atomic i8, i8* %0 acquire, align 8 + call void @llvm.lifetime.end(i64 2, i8* %1) + ret i8 %3 +; CHECK-LABEL: atomic_max_i8 +; CHECK: lbarx [[DST:[0-9]+]], +; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]] +; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] +; CHECK-NEXT: ble 0 +} +define i16 @atomic_max_i16() { +top: + %0 = alloca i16, align 2 + %1 = bitcast i16* %0 to i8* + call void @llvm.lifetime.start(i64 2, i8* %1) + store i16 -1, i16* %0, align 2 + %2 = atomicrmw max i16* %0, i16 0 acq_rel + %3 = load atomic i16, i16* %0 acquire, align 8 + call void @llvm.lifetime.end(i64 2, i8* %1) + ret i16 %3 +; CHECK-LABEL: atomic_max_i16 +; CHECK: lharx [[DST:[0-9]+]], +; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]] +; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] +; CHECK-NEXT: ble 0 +} + +declare void @llvm.lifetime.start(i64, i8*) +declare void @llvm.lifetime.end(i64, i8*) ___ llvm-b
[llvm-branch-commits] [llvm-branch] r287810 - Merging r279933:
Author: tstellar Date: Wed Nov 23 15:17:31 2016 New Revision: 287810 URL: http://llvm.org/viewvc/llvm-project?rev=287810&view=rev Log: Merging r279933: r279933 | hfinkel | 2016-08-28 09:17:58 -0700 (Sun, 28 Aug 2016) | 4 lines [PowerPC] Implement lowering for atomicrmw min/max/umin/umax Implement lowering for atomicrmw min/max/umin/umax. Fixes PR28818. Added: llvm/branches/release_39/test/CodeGen/PowerPC/atomic-minmax.ll Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.h llvm/branches/release_39/lib/Target/PowerPC/PPCInstr64Bit.td llvm/branches/release_39/lib/Target/PowerPC/PPCInstrInfo.td Modified: llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp?rev=287810&r1=287809&r2=287810&view=diff == --- llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/branches/release_39/lib/Target/PowerPC/PPCISelLowering.cpp Wed Nov 23 15:17:31 2016 @@ -8385,7 +8385,9 @@ Instruction* PPCTargetLowering::emitTrai MachineBasicBlock * PPCTargetLowering::EmitAtomicBinary(MachineInstr &MI, MachineBasicBlock *BB, unsigned AtomicSize, -unsigned BinOpcode) const { +unsigned BinOpcode, +unsigned CmpOpcode, +unsigned CmpPred) const { // This also handles ATOMIC_SWAP, indicated by BinOpcode==0. const TargetInstrInfo *TII = Subtarget.getInstrInfo(); @@ -8425,8 +8427,12 @@ PPCTargetLowering::EmitAtomicBinary(Mach DebugLoc dl = MI.getDebugLoc(); MachineBasicBlock *loopMBB = F->CreateMachineBasicBlock(LLVM_BB); + MachineBasicBlock *loop2MBB = +CmpOpcode ? F->CreateMachineBasicBlock(LLVM_BB) : nullptr; MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB); F->insert(It, loopMBB); + if (CmpOpcode) +F->insert(It, loop2MBB); F->insert(It, exitMBB); exitMBB->splice(exitMBB->begin(), BB, std::next(MachineBasicBlock::iterator(MI)), BB->end()); @@ -8448,11 +8454,31 @@ PPCTargetLowering::EmitAtomicBinary(Mach // st[wd]cx. r0, ptr // bne- loopMBB // fallthrough --> exitMBB + + // For max/min... + // loopMBB: + // l[wd]arx dest, ptr + // cmpl?[wd] incr, dest + // bgt exitMBB + // loop2MBB: + // st[wd]cx. dest, ptr + // bne- loopMBB + // fallthrough --> exitMBB + BB = loopMBB; BuildMI(BB, dl, TII->get(LoadMnemonic), dest) .addReg(ptrA).addReg(ptrB); if (BinOpcode) BuildMI(BB, dl, TII->get(BinOpcode), TmpReg).addReg(incr).addReg(dest); + if (CmpOpcode) { +BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) + .addReg(incr).addReg(dest); +BuildMI(BB, dl, TII->get(PPC::BCC)) + .addImm(CmpPred).addReg(PPC::CR0).addMBB(exitMBB); +BB->addSuccessor(loop2MBB); +BB->addSuccessor(exitMBB); +BB = loop2MBB; + } BuildMI(BB, dl, TII->get(StoreMnemonic)) .addReg(TmpReg).addReg(ptrA).addReg(ptrB); BuildMI(BB, dl, TII->get(PPC::BCC)) @@ -8470,10 +8496,13 @@ MachineBasicBlock * PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr &MI, MachineBasicBlock *BB, bool is8bit, // operation -unsigned BinOpcode) const { +unsigned BinOpcode, +unsigned CmpOpcode, +unsigned CmpPred) const { // If we support part-word atomic mnemonics, just use them if (Subtarget.hasPartwordAtomics()) -return EmitAtomicBinary(MI, BB, is8bit ? 1 : 2, BinOpcode); +return EmitAtomicBinary(MI, BB, is8bit ? 1 : 2, BinOpcode, +CmpOpcode, CmpPred); // This also handles ATOMIC_SWAP, indicated by BinOpcode==0. const TargetInstrInfo *TII = Subtarget.getInstrInfo(); @@ -8495,8 +8524,12 @@ PPCTargetLowering::EmitPartwordAtomicBin DebugLoc dl = MI.getDebugLoc(); MachineBasicBlock *loopMBB = F->CreateMachineBasicBlock(LLVM_BB); + MachineBasicBlock *loop2MBB = +CmpOpcode ? F->CreateMachineBasicBlock(LLVM_BB) : nullptr; MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB); F->insert(It, loopMBB); + if (CmpOpcode) +F->insert(It, loop2MBB); F->insert(It, exitMBB); exitMBB->splice(exitMBB->begin(), BB, std::next(MachineBasicBlock::iterator(MI)), BB->end()); @@ -8581,6 +8614,32 @@ PPCTargetLowering::EmitPartwordAtomicBin .add
[llvm-branch-commits] [cfe-branch] r287815 - Merge r275905 into 3.9 branch: Allow iOS and tvOS version numbers with 2-digit major version numbers.
Author: mehdi_amini Date: Wed Nov 23 15:25:50 2016 New Revision: 287815 URL: http://llvm.org/viewvc/llvm-project?rev=287815&view=rev Log: Merge r275905 into 3.9 branch: Allow iOS and tvOS version numbers with 2-digit major version numbers. See: http://llvm.org/PR30555 Modified: cfe/branches/release_39/lib/Basic/Targets.cpp cfe/branches/release_39/lib/Driver/ToolChains.cpp cfe/branches/release_39/test/Frontend/darwin-version.c Modified: cfe/branches/release_39/lib/Basic/Targets.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Basic/Targets.cpp?rev=287815&r1=287814&r2=287815&view=diff == --- cfe/branches/release_39/lib/Basic/Targets.cpp (original) +++ cfe/branches/release_39/lib/Basic/Targets.cpp Wed Nov 23 15:25:50 2016 @@ -158,14 +158,25 @@ static void getDarwinDefines(MacroBuilde // Set the appropriate OS version define. if (Triple.isiOS()) { -assert(Maj < 10 && Min < 100 && Rev < 100 && "Invalid version!"); -char Str[6]; -Str[0] = '0' + Maj; -Str[1] = '0' + (Min / 10); -Str[2] = '0' + (Min % 10); -Str[3] = '0' + (Rev / 10); -Str[4] = '0' + (Rev % 10); -Str[5] = '\0'; +assert(Maj < 100 && Min < 100 && Rev < 100 && "Invalid version!"); +char Str[7]; +if (Maj < 10) { + Str[0] = '0' + Maj; + Str[1] = '0' + (Min / 10); + Str[2] = '0' + (Min % 10); + Str[3] = '0' + (Rev / 10); + Str[4] = '0' + (Rev % 10); + Str[5] = '\0'; +} else { + // Handle versions >= 10. + Str[0] = '0' + (Maj / 10); + Str[1] = '0' + (Maj % 10); + Str[2] = '0' + (Min / 10); + Str[3] = '0' + (Min % 10); + Str[4] = '0' + (Rev / 10); + Str[5] = '0' + (Rev % 10); + Str[6] = '\0'; +} if (Triple.isTvOS()) Builder.defineMacro("__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__", Str); else Modified: cfe/branches/release_39/lib/Driver/ToolChains.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Driver/ToolChains.cpp?rev=287815&r1=287814&r2=287815&view=diff == --- cfe/branches/release_39/lib/Driver/ToolChains.cpp (original) +++ cfe/branches/release_39/lib/Driver/ToolChains.cpp Wed Nov 23 15:25:50 2016 @@ -688,13 +688,13 @@ void Darwin::AddDeploymentTarget(Derived assert(iOSVersion && "Unknown target platform!"); if (!Driver::GetReleaseVersion(iOSVersion->getValue(), Major, Minor, Micro, HadExtra) || -HadExtra || Major >= 10 || Minor >= 100 || Micro >= 100) +HadExtra || Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << iOSVersion->getAsString(Args); } else if (Platform == TvOS) { if (!Driver::GetReleaseVersion(TvOSVersion->getValue(), Major, Minor, Micro, HadExtra) || HadExtra || -Major >= 10 || Minor >= 100 || Micro >= 100) +Major >= 100 || Minor >= 100 || Micro >= 100) getDriver().Diag(diag::err_drv_invalid_version_number) << TvOSVersion->getAsString(Args); } else if (Platform == WatchOS) { Modified: cfe/branches/release_39/test/Frontend/darwin-version.c URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/Frontend/darwin-version.c?rev=287815&r1=287814&r2=287815&view=diff == --- cfe/branches/release_39/test/Frontend/darwin-version.c (original) +++ cfe/branches/release_39/test/Frontend/darwin-version.c Wed Nov 23 15:25:50 2016 @@ -10,6 +10,8 @@ // RUN: %clang_cc1 -triple armv6-apple-ios2.3.1 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20301' | count 1 // RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple armv7-apple-ios10.1.2 -dM -E -o %t %s +// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '100102' | count 1 // RUN: %clang_cc1 -triple i386-apple-macosx10.4.0 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 // RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t @@ -32,6 +34,8 @@ // RUN: grep '__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__' %t | grep '80300' | count 1 // RUN: not grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t // RUN: not grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t +// RUN: %clang_cc1 -triple arm64-apple-tvos10.2.3 -dM -E -o %t %s +// RUN: grep '__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__' %t | grep '100203' | count 1 // RUN: %clang_cc1 -triple x86_64-apple-tvos8.3 -dM -E -o %t %s // RUN: grep '__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__' %t | grep '80300' | count 1 ___ llvm-branch-commits mailing list llvm-branch-commits
[llvm-branch-commits] [cfe-branch] r287816 - Merging r275926:
Author: tstellar Date: Wed Nov 23 15:29:33 2016 New Revision: 287816 URL: http://llvm.org/viewvc/llvm-project?rev=287816&view=rev Log: Merging r275926: r275926 | kkwli0 | 2016-07-18 15:49:16 -0700 (Mon, 18 Jul 2016) | 25 lines [OpenMP] Fix incorrect diagnostics in map clause Having the following code pattern will result in incorrect diagnostic int main() { int arr[10]; #pragma omp target data map(arr[:]) #pragma omp target map(arr) {} } t.cpp:4:24: error: original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage #pragma omp target map(arr) ^~~ t.cpp:3:29: note: used here #pragma omp target data map(arr[:]) ^~ 1 error generated. Patch by David S. Differential Revision: https://reviews.llvm.org/D22075 Modified: cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp cfe/branches/release_39/test/OpenMP/target_map_messages.cpp cfe/branches/release_39/test/OpenMP/target_parallel_for_map_messages.cpp cfe/branches/release_39/test/OpenMP/target_parallel_for_simd_map_messages.cpp cfe/branches/release_39/test/OpenMP/target_parallel_map_messages.cpp Modified: cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp?rev=287816&r1=287815&r2=287816&view=diff == --- cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/branches/release_39/lib/Sema/SemaOpenMP.cpp Wed Nov 23 15:29:33 2016 @@ -10680,6 +10680,25 @@ static bool CheckMapConflicts( if (CI->getAssociatedDeclaration() != SI->getAssociatedDeclaration()) break; } +// Check if the extra components of the expressions in the enclosing +// data environment are redundant for the current base declaration. +// If they are, the maps completely overlap, which is legal. +for (; SI != SE; ++SI) { + QualType Type; + if (auto *ASE = + dyn_cast(SI->getAssociatedExpression())) { +Type = ASE->getBase()->IgnoreParenImpCasts()->getType(); + } else if (auto *OASE = + dyn_cast(SI->getAssociatedExpression())) { +auto *E = OASE->getBase()->IgnoreParenImpCasts(); +Type = +OMPArraySectionExpr::getBaseOriginalType(E).getCanonicalType(); + } + if (Type.isNull() || Type->isAnyPointerType() || + CheckArrayExpressionDoesNotReferToWholeSize( + SemaRef, SI->getAssociatedExpression(), Type)) +break; +} // OpenMP 4.5 [2.15.5.1, map Clause, Restrictions, p.4] // List items of map clauses in the same construct must not share Modified: cfe/branches/release_39/test/OpenMP/target_map_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/test/OpenMP/target_map_messages.cpp?rev=287816&r1=287815&r2=287816&view=diff == --- cfe/branches/release_39/test/OpenMP/target_map_messages.cpp (original) +++ cfe/branches/release_39/test/OpenMP/target_map_messages.cpp Wed Nov 23 15:29:33 2016 @@ -284,6 +284,11 @@ void SAclient(int arg) { {} } } + #pragma omp target data map(marr[:][:][:]) + { +#pragma omp target data map(marr) +{} + } #pragma omp target data map(to: t) { @@ -419,10 +424,10 @@ T tmain(T argc) { #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} foo(); -#pragma omp target data map(k[:4], j, l[:5]) // expected-note 4 {{used here}} +#pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}} #pragma omp target data map(k) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) -#pragma omp target map(l) // expected-error 2 {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}} +#pragma omp target map(l) foo(); #pragma omp target data map(always, tofrom: x) @@ -488,10 +493,10 @@ int main(int argc, char **argv) { #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} foo(); -#pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}} +#pragma omp target data map(k[:4], j, l[:5]) // expected-note {{used here}} #pragma omp target data map(k) // expected-error {{pointer cannot be mapped along with a section derived from