[llvm-branch-commits] [lldb] 19c735e - Merging r372835:

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Michal Gorny
Date: 2019-11-27T09:42:18-08:00
New Revision: 19c735edfb7e937894463d0b315896ad972e44da

URL: 
https://github.com/llvm/llvm-project/commit/19c735edfb7e937894463d0b315896ad972e44da
DIFF: 
https://github.com/llvm/llvm-project/commit/19c735edfb7e937894463d0b315896ad972e44da.diff

LOG: Merging r372835:


r372835 | mgorny | 2019-09-25 02:47:35 -0700 (Wed, 25 Sep 2019) | 12 lines

[lldb] [cmake] Fix installing Python modules on systems using /usr/lib

Fix installing Python modules on systems that use /usr/lib for Python
while installing other libraries in /usr/lib64.  Rewrite CMake logic
to query correct directories from Python, similarly to how
prepare_binding_Python.py does it.  Furthermore, change the regex used
in get_relative_lib_dir.py to allow 'lib' without suffix.

I think that the code can be further improved but I'd like to take
this enterprise in smaller steps in case one of them breaks something.

Differential Revision: https://reviews.llvm.org/D67890


Added: 


Modified: 
lldb/scripts/CMakeLists.txt
lldb/scripts/get_relative_lib_dir.py

Removed: 




diff  --git a/lldb/scripts/CMakeLists.txt b/lldb/scripts/CMakeLists.txt
index 1a0ea96ff9f6..7de797302795 100644
--- a/lldb/scripts/CMakeLists.txt
+++ b/lldb/scripts/CMakeLists.txt
@@ -42,15 +42,18 @@ add_custom_target(swig_wrapper ALL DEPENDS
 )
 
 if(NOT LLDB_BUILD_FRAMEWORK)
-  if(CMAKE_SYSTEM_NAME MATCHES "Windows")
-set(swig_python_subdir site-packages)
-  else()
-set(swig_python_subdir 
python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
-  endif()
-
-  set(SWIG_PYTHON_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${swig_python_subdir})
-  set(SWIG_INSTALL_DIR lib${LLVM_LIBDIR_SUFFIX})
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig, sys; 
print(distutils.sysconfig.get_python_lib(True, False, sys.argv[1]))"
+${CMAKE_BINARY_DIR}
+OUTPUT_VARIABLE SWIG_PYTHON_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
+  execute_process(
+COMMAND ${PYTHON_EXECUTABLE}
+-c "import distutils.sysconfig; 
print(distutils.sysconfig.get_python_lib(True, False, ''))"
+OUTPUT_VARIABLE SWIG_INSTALL_DIR
+OUTPUT_STRIP_TRAILING_WHITESPACE)
 
   # Install the LLDB python module
-  install(DIRECTORY ${SWIG_PYTHON_DIR} DESTINATION ${SWIG_INSTALL_DIR})
+  install(DIRECTORY ${SWIG_PYTHON_DIR}/ DESTINATION ${SWIG_INSTALL_DIR})
 endif()

diff  --git a/lldb/scripts/get_relative_lib_dir.py 
b/lldb/scripts/get_relative_lib_dir.py
index f7020d653fdd..3afeeafd7b48 100644
--- a/lldb/scripts/get_relative_lib_dir.py
+++ b/lldb/scripts/get_relative_lib_dir.py
@@ -23,7 +23,7 @@ def get_python_relative_libdir():
 # right answer always.
 arch_specific_libdir = distutils.sysconfig.get_python_lib(True, False)
 split_libdir = arch_specific_libdir.split(os.sep)
-lib_re = re.compile(r"^lib.+$")
+lib_re = re.compile(r"^lib.*$")
 
 for i in range(len(split_libdir)):
 match = lib_re.match(split_libdir[i])



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 28f6aac - [CMake] Fix LLVM build non-determinism on RHEL

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Amy Kwan
Date: 2019-11-27T11:17:05-08:00
New Revision: 28f6aac1c102f7d8ba8afce900079e42e67bedca

URL: 
https://github.com/llvm/llvm-project/commit/28f6aac1c102f7d8ba8afce900079e42e67bedca
DIFF: 
https://github.com/llvm/llvm-project/commit/28f6aac1c102f7d8ba8afce900079e42e67bedca.diff

LOG: [CMake] Fix LLVM build non-determinism on RHEL

On RHEL, the OS tooling (ar, ranlib) is not deterministic by default.
Therefore, we cannot get bit-for-bit identical builds.

The goal of this patch is that it adds the flags required to force determinism.

Differential Revision: https://reviews.llvm.org/D64817

(cherry picked from commit c84c62c50aa8524dbf96217c337f3b5ee4139000)

Added: 


Modified: 
llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 




diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake 
b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 59e1bdb8ebc4..4425eb91a5fc 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -145,6 +145,28 @@ if(APPLE)
   set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} 
-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
 endif()
 
+if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+  # RHEL7 has ar and ranlib being non-deterministic by default. The D flag 
forces determinism,
+  # however only GNU version of ar and ranlib (2.27) have this option. 
+  # RHEL DTS7 is also affected by this, which uses GNU binutils 2.28
+  execute_process(COMMAND ${CMAKE_AR} rD t.a
+  WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE 
AR_RESULT OUTPUT_VARIABLE RANLIB_OUTPUT)
+  if(${AR_RESULT} EQUAL 0)
+execute_process(COMMAND ${CMAKE_RANLIB} -D t.a
+WORKING_DIRECTORY ${CMAKE_BINARY_DIR} RESULT_VARIABLE 
RANLIB_RESULT OUTPUT_VARIABLE RANLIB_OUTPUT)
+if(${RANLIB_RESULT} EQUAL 0)
+  set(CMAKE_C_ARCHIVE_CREATE " Dqc   
")
+  set(CMAKE_C_ARCHIVE_APPEND " Dq
")
+  set(CMAKE_C_ARCHIVE_FINISH " -D ")
+
+  set(CMAKE_CXX_ARCHIVE_CREATE " Dqc   
")
+  set(CMAKE_CXX_ARCHIVE_APPEND " Dq
")
+  set(CMAKE_CXX_ARCHIVE_FINISH " -D ")
+endif()
+file(REMOVE ${CMAKE_BINARY_DIR}/t.a)
+  endif()
+endif()
+
 if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
   if(NOT LLVM_BUILD_32_BITS)
 if (CMAKE_CXX_COMPILER_ID MATCHES "XL")



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 7fc9f12 - Merging r372281:

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Serge Guelton
Date: 2019-11-27T11:28:33-08:00
New Revision: 7fc9f129f80f192bd5ed73e9b94ffc59803c17fc

URL: 
https://github.com/llvm/llvm-project/commit/7fc9f129f80f192bd5ed73e9b94ffc59803c17fc
DIFF: 
https://github.com/llvm/llvm-project/commit/7fc9f129f80f192bd5ed73e9b94ffc59803c17fc.diff

LOG: Merging r372281:


r372281 | serge_sans_paille | 2019-09-18 17:54:40 -0700 (Wed, 18 Sep 2019) | 8 
lines

Initialize all fields in ABIArgInfo.

Due to usage of an uninitialized fields, we end up with
a Conditional jump or move depends on uninitialised value

Fixes https://bugs.llvm.org/show_bug.cgi?id=40547

Commited on behalf of Martin Liska 


Added: 


Modified: 
clang/include/clang/CodeGen/CGFunctionInfo.h

Removed: 




diff  --git a/clang/include/clang/CodeGen/CGFunctionInfo.h 
b/clang/include/clang/CodeGen/CGFunctionInfo.h
index 1f81072e23d0..5069d9af42a3 100644
--- a/clang/include/clang/CodeGen/CGFunctionInfo.h
+++ b/clang/include/clang/CodeGen/CGFunctionInfo.h
@@ -109,14 +109,12 @@ class ABIArgInfo {
 UnpaddedCoerceAndExpandType = T;
   }
 
-  ABIArgInfo(Kind K)
-  : TheKind(K), PaddingInReg(false), InReg(false) {
-  }
-
 public:
-  ABIArgInfo()
+  ABIArgInfo(Kind K = Direct)
   : TypeData(nullptr), PaddingType(nullptr), DirectOffset(0),
-TheKind(Direct), PaddingInReg(false), InReg(false) {}
+TheKind(K), PaddingInReg(false), InAllocaSRet(false),
+IndirectByVal(false), IndirectRealign(false), SRetAfterThis(false),
+InReg(false), CanBeFlattened(false), SignExt(false) {}
 
   static ABIArgInfo getDirect(llvm::Type *T = nullptr, unsigned Offset = 0,
   llvm::Type *Padding = nullptr,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] af5faf8 - [x86] avoid crashing when splitting AVX stores with non-simple type (PR43916)

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Sanjay Patel
Date: 2019-11-27T13:32:50-08:00
New Revision: af5faf8909f2bd28b5a138539dfc3efc1fb3a80b

URL: 
https://github.com/llvm/llvm-project/commit/af5faf8909f2bd28b5a138539dfc3efc1fb3a80b
DIFF: 
https://github.com/llvm/llvm-project/commit/af5faf8909f2bd28b5a138539dfc3efc1fb3a80b.diff

LOG: [x86] avoid crashing when splitting AVX stores with non-simple type 
(PR43916)

The store splitting transform was assuming a simple type (MVT),
but that's not necessarily the case as shown in the test.

(cherry picked from commit 8e34dd941cb304c785ef623633ad663b59cfced0)

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/avx-load-store.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 1869cc9da017..920cdd7e625e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -21182,12 +21182,14 @@ static SDValue splitVectorStore(StoreSDNode *Store, 
SelectionDAG &DAG) {
  "Expecting 256/512-bit op");
 
   // Splitting volatile memory ops is not allowed unless the operation was not
-  // legal to begin with. We are assuming the input op is legal (this transform
-  // is only used for targets with AVX).
+  // legal to begin with. Assume the input store is legal (this transform is
+  // only used for targets with AVX). Note: It is possible that we have an
+  // illegal type like v2i128, and so we could allow splitting a volatile store
+  // in that case if that is important.
   if (Store->isVolatile())
 return SDValue();
 
-  MVT StoreVT = StoredVal.getSimpleValueType();
+  EVT StoreVT = StoredVal.getValueType();
   unsigned NumElems = StoreVT.getVectorNumElements();
   unsigned HalfSize = StoredVal.getValueSizeInBits() / 2;
   unsigned HalfAlign = (128 == HalfSize ? 16 : 32);

diff  --git a/llvm/test/CodeGen/X86/avx-load-store.ll 
b/llvm/test/CodeGen/X86/avx-load-store.ll
index 402e2705191e..1b3c35855ae9 100644
--- a/llvm/test/CodeGen/X86/avx-load-store.ll
+++ b/llvm/test/CodeGen/X86/avx-load-store.ll
@@ -333,3 +333,26 @@ define void @add4i64a16(<4 x i64>* %ret, <4 x i64>* %bp) 
nounwind {
   ret void
 }
 
+; This used to crash.
+; v2i128 may not be a "simple" (MVT) type, but we can split that.
+; This example gets split further in legalization.
+
+define void @PR43916(<2 x i128> %y, <2 x i128>* %z) {
+; CHECK-LABEL: PR43916:
+; CHECK:   # %bb.0:
+; CHECK-NEXT:movq %rcx, 24(%r8)
+; CHECK-NEXT:movq %rdx, 16(%r8)
+; CHECK-NEXT:movq %rsi, 8(%r8)
+; CHECK-NEXT:movq %rdi, (%r8)
+; CHECK-NEXT:retq
+;
+; CHECK_O0-LABEL: PR43916:
+; CHECK_O0:   # %bb.0:
+; CHECK_O0-NEXT:movq %rdi, (%r8)
+; CHECK_O0-NEXT:movq %rsi, 8(%r8)
+; CHECK_O0-NEXT:movq %rdx, 16(%r8)
+; CHECK_O0-NEXT:movq %rcx, 24(%r8)
+; CHECK_O0-NEXT:retq
+  store <2 x i128> %y, <2 x i128>* %z, align 16
+  ret void
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] bead8bf - Merging r371548:

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Alexey Bataev
Date: 2019-11-27T13:36:23-08:00
New Revision: bead8bf31fb4a6bf02af67bd3029adb5dedf704f

URL: 
https://github.com/llvm/llvm-project/commit/bead8bf31fb4a6bf02af67bd3029adb5dedf704f
DIFF: 
https://github.com/llvm/llvm-project/commit/bead8bf31fb4a6bf02af67bd3029adb5dedf704f.diff

LOG: Merging r371548:


r371548 | abataev | 2019-09-10 12:16:56 -0700 (Tue, 10 Sep 2019) | 10 lines

Fix for PR43175: compiler crash when trying to emit noncapturable
constant.

If the constexpr variable is partially initialized, the initializer can
be emitted as the structure, not as an array, because of some early
optimizations. The llvm variable gets the type from this constant and,
thus, gets the type which is pointer to struct rather than pointer to an
array. We need to convert this type to be truely array, otherwise it may
lead to the compiler crash when trying to emit array subscript
expression.


Added: 
clang/test/OpenMP/constexpr_partial_array.cpp

Modified: 
clang/lib/CodeGen/CGExpr.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 5a4b1188b711..b6c2567bd578 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -2540,6 +2540,11 @@ LValue CodeGenFunction::EmitDeclRefLValue(const 
DeclRefExpr *E) {
 // Spill the constant value to a global.
 Addr = CGM.createUnnamedGlobalFrom(*VD, Val,
getContext().getDeclAlign(VD));
+llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType());
+auto *PTy = llvm::PointerType::get(
+VarTy, getContext().getTargetAddressSpace(VD->getType()));
+if (PTy != Addr.getType())
+  Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy);
   } else {
 // Should we be using the alignment of the constant pointer we emitted?
 CharUnits Alignment =

diff  --git a/clang/test/OpenMP/constexpr_partial_array.cpp 
b/clang/test/OpenMP/constexpr_partial_array.cpp
new file mode 100644
index ..998d75edbb88
--- /dev/null
+++ b/clang/test/OpenMP/constexpr_partial_array.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -verify -triple x86_64-pc-windows-msvc19.22.27905 
-emit-llvm -o - -fopenmp %s | FileCheck %s
+// expected-no-diagnostics
+
+// CHECK: [[C_VAR_VAL:@.+]] = private unnamed_addr constant <{ i8, [26 x i8] 
}> <{ i8 1, [26 x i8] zeroinitializer }>,
+char a;
+bool b() {
+  static constexpr bool c[27]{1};
+  // CHECK: getelementptr inbounds [27 x i8], [27 x i8]* bitcast (<{ i8, [26 x 
i8] }>* [[C_VAR_VAL]] to [27 x i8]*),
+  return c[a];
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] e99a087 - Merging r373389:

2019-11-27 Thread Tom Stellard via llvm-branch-commits

Author: Leonard Chan
Date: 2019-11-27T13:57:45-08:00
New Revision: e99a087fff6c547cae1192f54edcc474f46f6567

URL: 
https://github.com/llvm/llvm-project/commit/e99a087fff6c547cae1192f54edcc474f46f6567
DIFF: 
https://github.com/llvm/llvm-project/commit/e99a087fff6c547cae1192f54edcc474f46f6567.diff

LOG: Merging r373389:


r373389 | leonardchan | 2019-10-01 13:30:46 -0700 (Tue, 01 Oct 2019) | 10 lines

[ASan] Make GlobalsMD member a const reference.

PR42924 points out that copying the GlobalsMetadata type during
construction of AddressSanitizer can result in exteremely lengthened
build times for translation units that have many globals. This can be addressed
by just making the GlobalsMD member in AddressSanitizer a reference to
avoid the copy. The GlobalsMetadata type is already passed to the
constructor as a reference anyway.

Differential Revision: https://reviews.llvm.org/D68287


Added: 


Modified: 
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 6821e214e921..89a90eab8978 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -677,7 +677,7 @@ struct AddressSanitizer {
   FunctionCallee AsanMemmove, AsanMemcpy, AsanMemset;
   InlineAsm *EmptyAsm;
   Value *LocalDynamicShadow = nullptr;
-  GlobalsMetadata GlobalsMD;
+  const GlobalsMetadata &GlobalsMD;
   DenseMap ProcessedAllocas;
 };
 
@@ -783,7 +783,7 @@ class ModuleAddressSanitizer {
   }
   int GetAsanVersion(const Module &M) const;
 
-  GlobalsMetadata GlobalsMD;
+  const GlobalsMetadata &GlobalsMD;
   bool CompileKernel;
   bool Recover;
   bool UseGlobalsGC;



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits