[llvm-branch-commits] [clang] c102b96 - [X86] Correct the comments about comparison intrinsics. NFCI.

2021-01-07 Thread via llvm-branch-commits

Author: Wang, Pengfei
Date: 2021-01-08T15:36:15+08:00
New Revision: c102b9697bd4ec2b12dab9865661bfb2facc97ec

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

LOG: [X86] Correct the comments about comparison intrinsics. NFCI.

Added: 


Modified: 
clang/lib/CodeGen/CGBuiltin.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 1e0337ca7ac3..ea39d64e16f1 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -13955,8 +13955,7 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
 // Lowering vector comparisons to fcmp instructions, while
 // ignoring signalling behaviour requested
 // ignoring rounding mode requested
-// This is is only possible as long as FENV_ACCESS is not implemented.
-// See also: https://reviews.llvm.org/D45616
+// This is only possible if fp-model is not strict and FENV_ACCESS is off.
 
 // The third argument is the comparison condition, and integer in the
 // range [0, 31]



___
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] 69cf735 - [NewPM] Don't error when there's an unrecognized pass name

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T22:33:32-08:00
New Revision: 69cf7350628ace9de0908a51b770ecf3ee292848

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

LOG: [NewPM] Don't error when there's an unrecognized pass name

This currently blocks --print-before/after with a legacy PM pass, for
example when we use the new PM for the optimization pipeline but the
legacy PM for the codegen pipeline. Also in the future when the codegen
pipeline works with the new PM there will be multiple places to specify
passes, so even when everything is using the new PM, there will still be
multiple places that can accept different pass names.

Reviewed By: hoy, ychen

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

Added: 


Modified: 
llvm/include/llvm/IR/PassInstrumentation.h
llvm/lib/IR/PassInstrumentation.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/test/Other/print-before-after.ll

Removed: 




diff  --git a/llvm/include/llvm/IR/PassInstrumentation.h 
b/llvm/include/llvm/IR/PassInstrumentation.h
index 98b3fd451e4f..291f324b159a 100644
--- a/llvm/include/llvm/IR/PassInstrumentation.h
+++ b/llvm/include/llvm/IR/PassInstrumentation.h
@@ -127,8 +127,6 @@ class PassInstrumentationCallbacks {
   void addClassToPassName(StringRef ClassName, StringRef PassName);
   /// Get the pass name for a given pass class name.
   StringRef getPassNameForClassName(StringRef ClassName);
-  /// Whether or not the class to pass name map contains the pass name.
-  bool hasPassName(StringRef PassName);
 
 private:
   friend class PassInstrumentation;

diff  --git a/llvm/lib/IR/PassInstrumentation.cpp 
b/llvm/lib/IR/PassInstrumentation.cpp
index 6a2defcf6b0e..56a36db21e28 100644
--- a/llvm/lib/IR/PassInstrumentation.cpp
+++ b/llvm/lib/IR/PassInstrumentation.cpp
@@ -22,14 +22,6 @@ void 
PassInstrumentationCallbacks::addClassToPassName(StringRef ClassName,
   ClassToPassName[ClassName] = PassName.str();
 }
 
-bool PassInstrumentationCallbacks::hasPassName(StringRef PassName) {
-  for (const auto  : ClassToPassName) {
-if (E.getValue() == PassName)
-  return true;
-  }
-  return false;
-}
-
 StringRef
 PassInstrumentationCallbacks::getPassNameForClassName(StringRef ClassName) {
   return ClassToPassName[ClassName];

diff  --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 8f6a96dcf4ad..527d19d63589 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -459,14 +459,6 @@ PassBuilder::PassBuilder(bool DebugLogging, TargetMachine 
*TM,
 #define CGSCC_ANALYSIS(NAME, CREATE_PASS)  
\
   PIC->addClassToPassName(decltype(CREATE_PASS)::name(), NAME);
 #include "PassRegistry.def"
-for (const auto  : printBeforePasses()) {
-  if (!PIC->hasPassName(P))
-report_fatal_error("unrecognized pass name: " + P);
-}
-for (const auto  : printAfterPasses()) {
-  if (!PIC->hasPassName(P))
-report_fatal_error("unrecognized pass name: " + P);
-}
   }
 }
 

diff  --git a/llvm/test/Other/print-before-after.ll 
b/llvm/test/Other/print-before-after.ll
index c0b929d70c1b..41977929f741 100644
--- a/llvm/test/Other/print-before-after.ll
+++ b/llvm/test/Other/print-before-after.ll
@@ -1,5 +1,5 @@
-; RUN: not --crash opt < %s -disable-output -passes='no-op-module' 
-print-before=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
-; RUN: not --crash opt < %s -disable-output -passes='no-op-module' 
-print-after=bleh 2>&1 | FileCheck %s --check-prefix=NONE --allow-empty
+; RUN: opt < %s -disable-output -passes='no-op-module' -print-before=bleh 2>&1 
| FileCheck %s --check-prefix=NONE --allow-empty
+; RUN: opt < %s -disable-output -passes='no-op-module' -print-after=bleh 2>&1 
| FileCheck %s --check-prefix=NONE --allow-empty
 ; RUN: opt < %s -disable-output -passes='no-op-module' 
-print-before=no-op-function 2>&1 | FileCheck %s --check-prefix=NONE 
--allow-empty
 ; RUN: opt < %s -disable-output -passes='no-op-module' 
-print-after=no-op-function 2>&1 | FileCheck %s --check-prefix=NONE 
--allow-empty
 ; RUN: opt < %s -disable-output -passes='no-op-module,no-op-function' 
-print-before=no-op-module 2>&1 | FileCheck %s --check-prefix=ONCE



___
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] 0ebc1fb - [CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath

2021-01-07 Thread Raul Tambre via llvm-branch-commits

Author: Raul Tambre
Date: 2021-01-08T08:31:10+02:00
New Revision: 0ebc1fb29f278db0665423f15c53e6ee9601dddb

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

LOG: [CMake] Don't enable BUILD_WITH_INSTALL_RPATH when using custom build rpath

When `BUILD_WITH_INSTALL_RPATH` is enabled it prevents using a custom rpath only
for the build tree as the install rpath will be used. This makes it impossible 
to run a
runtimes build when compiling with Clang and wanting the installed rpath to be
empty (i.e. `-DCMAKE_BUILD_RPATH="" -DCMAKE_SKIP_INSTALL_RPATH=ON`).

Disable `BUILD_WITH_INSTALL_RPATH` when `CMAKE_BUILD_RPATH` is non-empty to
allow for such build scenarios.

Reviewed By: phosek

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

Added: 


Modified: 
llvm/cmake/modules/AddLLVM.cmake

Removed: 




diff  --git a/llvm/cmake/modules/AddLLVM.cmake 
b/llvm/cmake/modules/AddLLVM.cmake
index b86fbdaaa6d8..dc06ea14c584 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -865,10 +865,13 @@ macro(add_llvm_executable name)
 
   if(NOT ARG_NO_INSTALL_RPATH)
 llvm_setup_rpath(${name})
-  elseif (LLVM_LOCAL_RPATH)
-set_target_properties(${name} PROPERTIES
-  BUILD_WITH_INSTALL_RPATH On
-  INSTALL_RPATH "${LLVM_LOCAL_RPATH}")
+  else()
+# Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
+if(NOT "${CMAKE_BUILD_RPATH}" STREQUAL "")
+  set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+endif()
+
+set_property(TARGET ${name} PROPERTY INSTALL_RPATH "${LLVM_LOCAL_RPATH}")
   endif()
 
   if(DEFINED windows_resource_file)
@@ -2113,8 +2116,12 @@ function(llvm_setup_rpath name)
 return()
   endif()
 
+  # Enable BUILD_WITH_INSTALL_RPATH unless CMAKE_BUILD_RPATH is set.
+  if(NOT "${CMAKE_BUILD_RPATH}" STREQUAL "")
+set_property(TARGET ${name} PROPERTY BUILD_WITH_INSTALL_RPATH ON)
+  endif()
+
   set_target_properties(${name} PROPERTIES
-BUILD_WITH_INSTALL_RPATH On
 INSTALL_RPATH "${_install_rpath}"
 ${_install_name_dir})
 endfunction()



___
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] ae25a39 - AMDGPU/GlobalISel: Enable sret demotion

2021-01-07 Thread Christudasan Devadasan via llvm-branch-commits

Author: Christudasan Devadasan
Date: 2021-01-08T10:56:35+05:30
New Revision: ae25a397e9de833ffbd5d8e3b480086404625cb7

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

LOG: AMDGPU/GlobalISel: Enable sret demotion

Added: 


Modified: 
llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h
llvm/test/CodeGen/AMDGPU/GlobalISel/function-returns.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call-return-values.ll

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h 
b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
index dff73d185114..57ff3900ef25 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
@@ -358,8 +358,8 @@ class CallLowering {
   /// described by \p Outs can fit into the return registers. If false
   /// is returned, an sret-demotion is performed.
   virtual bool canLowerReturn(MachineFunction , CallingConv::ID CallConv,
-  SmallVectorImpl , bool 
IsVarArg,
-  LLVMContext ) const {
+  SmallVectorImpl ,
+  bool IsVarArg) const {
 return true;
   }
 

diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index e1591a4bf19b..a6d4ea76 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -95,8 +95,7 @@ bool CallLowering::lowerCall(MachineIRBuilder , 
const CallBase ,
 
   SmallVector SplitArgs;
   getReturnInfo(CallConv, RetTy, CB.getAttributes(), SplitArgs, DL);
-  Info.CanLowerReturn =
-  canLowerReturn(MF, CallConv, SplitArgs, IsVarArg, RetTy->getContext());
+  Info.CanLowerReturn = canLowerReturn(MF, CallConv, SplitArgs, IsVarArg);
 
   if (!Info.CanLowerReturn) {
 // Callee requires sret demotion.
@@ -592,8 +591,7 @@ bool 
CallLowering::checkReturnTypeForCallConv(MachineFunction ) const {
   SmallVector SplitArgs;
   getReturnInfo(CallConv, ReturnType, F.getAttributes(), SplitArgs,
 MF.getDataLayout());
-  return canLowerReturn(MF, CallConv, SplitArgs, F.isVarArg(),
-ReturnType->getContext());
+  return canLowerReturn(MF, CallConv, SplitArgs, F.isVarArg());
 }
 
 bool CallLowering::analyzeArgInfo(CCState ,

diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
index 3b6e263ee6d8..b86052e3a14e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
@@ -20,6 +20,7 @@
 #include "SIMachineFunctionInfo.h"
 #include "SIRegisterInfo.h"
 #include "llvm/CodeGen/Analysis.h"
+#include "llvm/CodeGen/FunctionLoweringInfo.h"
 #include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
 #include "llvm/IR/IntrinsicsAMDGPU.h"
 
@@ -420,6 +421,22 @@ static void unpackRegsToOrigType(MachineIRBuilder ,
   B.buildUnmerge(UnmergeResults, UnmergeSrc);
 }
 
+bool AMDGPUCallLowering::canLowerReturn(MachineFunction ,
+CallingConv::ID CallConv,
+SmallVectorImpl ,
+bool IsVarArg) const {
+  // For shaders. Vector types should be explicitly handled by CC.
+  if (AMDGPU::isEntryFunctionCC(CallConv))
+return true;
+
+  SmallVector ArgLocs;
+  const SITargetLowering  = *getTLI();
+  CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs,
+ MF.getFunction().getContext());
+
+  return checkReturn(CCInfo, Outs, TLI.CCAssignFnForReturn(CallConv, 
IsVarArg));
+}
+
 /// Lower the return value for the already existing \p Ret. This assumes that
 /// \p B's insertion point is correct.
 bool AMDGPUCallLowering::lowerReturnVal(MachineIRBuilder ,
@@ -533,7 +550,9 @@ bool AMDGPUCallLowering::lowerReturn(MachineIRBuilder , 
const Value *Val,
 Ret.addUse(ReturnAddrVReg);
   }
 
-  if (!lowerReturnVal(B, Val, VRegs, Ret))
+  if (!FLI.CanLowerReturn)
+insertSRetStores(B, Val->getType(), VRegs, FLI.DemoteRegister);
+  else if (!lowerReturnVal(B, Val, VRegs, Ret))
 return false;
 
   if (ReturnOpc == AMDGPU::S_SETPC_B64_return) {
@@ -872,6 +891,11 @@ bool AMDGPUCallLowering::lowerFormalArguments(
   unsigned Idx = 0;
   unsigned PSInputNum = 0;
 
+  // Insert the hidden sret parameter if the return value won't fit in the
+  // return registers.
+  if (!FLI.CanLowerReturn)
+insertSRetIncomingArgument(F, SplitArgs, FLI.DemoteRegister, MRI, DL);
+
   for (auto  : F.args()) {
 if (DL.getTypeStoreSize(Arg.getType()) == 0)
   continue;
@@ 

[llvm-branch-commits] [lldb] 57e0cd3 - [lldb] Make DoReadMemory a protected method.

2021-01-07 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-07T21:06:36-08:00
New Revision: 57e0cd356287321c4847a9e0a9177516dae0cbc1

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

LOG: [lldb] Make DoReadMemory a protected method.

DoReadMemory is LLDB's internal implementation and shouldn't be called
directly.

Differential revision: https://reviews.llvm.org/D94284

Added: 


Modified: 
lldb/include/lldb/Target/Process.h

lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp
lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

Removed: 




diff  --git a/lldb/include/lldb/Target/Process.h 
b/lldb/include/lldb/Target/Process.h
index e8dd8847e87a..6f30787f7e5b 100644
--- a/lldb/include/lldb/Target/Process.h
+++ b/lldb/include/lldb/Target/Process.h
@@ -1414,35 +1414,6 @@ class Process : public 
std::enable_shared_from_this,
   /// this process.
   virtual bool WarnBeforeDetach() const { return true; }
 
-  /// Actually do the reading of memory from a process.
-  ///
-  /// Subclasses must override this function and can return fewer bytes than
-  /// requested when memory requests are too large. This class will break up
-  /// the memory requests and keep advancing the arguments along as needed.
-  ///
-  /// \param[in] vm_addr
-  /// A virtual load address that indicates where to start reading
-  /// memory from.
-  ///
-  /// \param[in] size
-  /// The number of bytes to read.
-  ///
-  /// \param[out] buf
-  /// A byte buffer that is at least \a size bytes long that
-  /// will receive the memory bytes.
-  ///
-  /// \param[out] error
-  /// An error that indicates the success or failure of this
-  /// operation. If error indicates success (error.Success()),
-  /// then the value returned can be trusted, otherwise zero
-  /// will be returned.
-  ///
-  /// \return
-  /// The number of bytes that were actually read into \a buf.
-  /// Zero is returned in the case of an error.
-  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
-  Status ) = 0;
-
   /// Read of memory from a process.
   ///
   /// This function will read memory from the current process's address space
@@ -2570,6 +2541,35 @@ void PruneThreadPlans();
 bool trap_exceptions = false);
 
 protected:
+  /// Actually do the reading of memory from a process.
+  ///
+  /// Subclasses must override this function and can return fewer bytes than
+  /// requested when memory requests are too large. This class will break up
+  /// the memory requests and keep advancing the arguments along as needed.
+  ///
+  /// \param[in] vm_addr
+  /// A virtual load address that indicates where to start reading
+  /// memory from.
+  ///
+  /// \param[in] size
+  /// The number of bytes to read.
+  ///
+  /// \param[out] buf
+  /// A byte buffer that is at least \a size bytes long that
+  /// will receive the memory bytes.
+  ///
+  /// \param[out] error
+  /// An error that indicates the success or failure of this
+  /// operation. If error indicates success (error.Success()),
+  /// then the value returned can be trusted, otherwise zero
+  /// will be returned.
+  ///
+  /// \return
+  /// The number of bytes that were actually read into \a buf.
+  /// Zero is returned in the case of an error.
+  virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size,
+  Status ) = 0;
+
   void SetState(lldb::EventSP _sp);
 
   lldb::StateType GetPrivateState();

diff  --git 
a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp 
b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index d0d5a99b28ed..fd1916d296d5 100644
--- 
a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ 
b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -400,7 +400,7 @@ DynamicLoaderDarwinKernel::ReadMachHeader(addr_t addr, 
Process *process, llvm::M
 *read_error = false;
 
   // Read the mach header and see whether it looks like a kernel
-  if (process->DoReadMemory (addr, , sizeof(header), error) !=
+  if (process->ReadMemory(addr, , sizeof(header), error) !=
   sizeof(header)) {
 if (read_error)
   *read_error = true;
@@ -790,7 +790,7 @@ bool 
DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
 
   // For the kernel, we really do need an on-disk file copy of the binary
   // to do anything useful. This will force a call to dsymForUUID if it
-  // exists, instead of depending on the DebugSymbols preferences 

[llvm-branch-commits] [lldb] f2e0585 - [lldb] Access the ModuleList through iterators where possible (NFC)

2021-01-07 Thread Jonas Devlieghere via llvm-branch-commits

Author: Jonas Devlieghere
Date: 2021-01-07T21:06:36-08:00
New Revision: f2e05855deb39125a30a67b63a5e524792805768

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

LOG: [lldb] Access the ModuleList through iterators where possible (NFC)

Replace uses of GetModuleAtIndexUnlocked and
GetModulePointerAtIndexUnlocked with the ModuleIterable and
ModuleIterableNoLocking where applicable.

Differential revision: https://reviews.llvm.org/D94271

Added: 


Modified: 
lldb/include/lldb/Core/ModuleList.h
lldb/include/lldb/Utility/Iterable.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/ModuleList.cpp
lldb/source/Core/SearchFilter.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
lldb/source/Target/Process.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/ModuleList.h 
b/lldb/include/lldb/Core/ModuleList.h
index 1609f0f77c56..46a718f08f04 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -237,20 +237,6 @@ class ModuleList {
   /// \see ModuleList::GetSize()
   Module *GetModulePointerAtIndex(size_t idx) const;
 
-  /// Get the module pointer for the module at index \a idx without acquiring
-  /// the ModuleList mutex.  This MUST already have been acquired with
-  /// ModuleList::GetMutex and locked for this call to be safe.
-  ///
-  /// \param[in] idx
-  /// An index into this module collection.
-  ///
-  /// \return
-  /// A pointer to a Module which can by nullptr if \a idx is out
-  /// of range.
-  ///
-  /// \see ModuleList::GetSize()
-  Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
-
   /// Find compile units by partial or full path.
   ///
   /// Finds all compile units that match \a path in all of the modules and
@@ -491,11 +477,13 @@ class ModuleList {
   typedef LockingAdaptedIterable
   ModuleIterable;
-  ModuleIterable Modules() { return ModuleIterable(m_modules, GetMutex()); }
+  ModuleIterable Modules() const {
+return ModuleIterable(m_modules, GetMutex());
+  }
 
   typedef AdaptedIterable
   ModuleIterableNoLocking;
-  ModuleIterableNoLocking ModulesNoLocking() {
+  ModuleIterableNoLocking ModulesNoLocking() const {
 return ModuleIterableNoLocking(m_modules);
   }
 };

diff  --git a/lldb/include/lldb/Utility/Iterable.h 
b/lldb/include/lldb/Utility/Iterable.h
index 3f9b8b1e4c57..5c38e46feb92 100644
--- a/lldb/include/lldb/Utility/Iterable.h
+++ b/lldb/include/lldb/Utility/Iterable.h
@@ -170,7 +170,7 @@ template 
 class LockingAdaptedIterable : public AdaptedIterable {
 public:
-  LockingAdaptedIterable(C , MutexType )
+  LockingAdaptedIterable(const C , MutexType )
   : AdaptedIterable(container), m_mutex() {
 m_mutex->lock();
   }

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index 06d08ecdb3eb..d7bca308ca99 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -508,7 +508,6 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 "delete_locations: %i\n",
 module_list.GetSize(), load, delete_locations);
 
-  std::lock_guard guard(module_list.GetMutex());
   if (load) {
 // The logic for handling new modules is:
 // 1) If the filter rejects this module, then skip it. 2) Run through the
@@ -525,7 +524,7 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 // them after the locations pass.  Have to do it this way because resolving
 // breakpoints will add new locations potentially.
 
-for (ModuleSP module_sp : module_list.ModulesNoLocking()) {
+for (ModuleSP module_sp : module_list.Modules()) {
   bool seen = false;
   if (!m_filter_sp->ModulePasses(module_sp))
 continue;
@@ -589,9 +588,7 @@ void Breakpoint::ModulesChanged(ModuleList _list, 
bool load,
 else
   removed_locations_event = nullptr;
 
-size_t num_modules = module_list.GetSize();
-for (size_t i = 0; i < num_modules; i++) {
-  ModuleSP module_sp(module_list.GetModuleAtIndexUnlocked(i));
+for (ModuleSP module_sp 

[llvm-branch-commits] [llvm] b934160 - [Target] Use llvm::find_if (NFC)

2021-01-07 Thread Kazu Hirata via llvm-branch-commits

Author: Kazu Hirata
Date: 2021-01-07T20:29:36-08:00
New Revision: b934160aaa36be42d5b868704157f30339e7d855

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

LOG: [Target] Use llvm::find_if (NFC)

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
llvm/lib/Target/X86/X86InstructionSelector.cpp

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp 
b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 40435c12ca3b..fdf3acfe68c5 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -5425,10 +5425,10 @@ AArch64TargetLowering::LowerCall(CallLoweringInfo ,
 // take care of putting the two halves in the right place but we have 
to
 // combine them.
 SDValue  =
-std::find_if(RegsToPass.begin(), RegsToPass.end(),
- [=](const std::pair ) {
-   return Elt.first == VA.getLocReg();
- })
+llvm::find_if(RegsToPass,
+  [=](const std::pair ) {
+return Elt.first == VA.getLocReg();
+  })
 ->second;
 Bits = DAG.getNode(ISD::OR, DL, Bits.getValueType(), Bits, Arg);
 // Call site info is used for function's parameter entry value
@@ -5709,11 +5709,9 @@ AArch64TargetLowering::LowerReturn(SDValue Chain, 
CallingConv::ID CallConv,
 
 if (RegsUsed.count(VA.getLocReg())) {
   SDValue  =
-  std::find_if(RetVals.begin(), RetVals.end(),
-   [=](const std::pair ) {
- return Elt.first == VA.getLocReg();
-   })
-  ->second;
+  llvm::find_if(RetVals, [=](const std::pair ) {
+return Elt.first == VA.getLocReg();
+  })->second;
   Bits = DAG.getNode(ISD::OR, DL, Bits.getValueType(), Bits, Arg);
 } else {
   RetVals.emplace_back(VA.getLocReg(), Arg);

diff  --git a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp 
b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
index 4a60fc7dd8e5..7f68174e506d 100644
--- a/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
+++ b/llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
@@ -1578,11 +1578,10 @@ bool AMDGPUSymbolizer::tryAddingSymbolicOperand(MCInst 
,
   if (!Symbols)
 return false;
 
-  auto Result = std::find_if(Symbols->begin(), Symbols->end(),
- [Value](const SymbolInfoTy& Val) {
-return Val.Addr == static_cast(Value)
-&& Val.Type == ELF::STT_NOTYPE;
- });
+  auto Result = llvm::find_if(*Symbols, [Value](const SymbolInfoTy ) {
+return Val.Addr == static_cast(Value) &&
+   Val.Type == ELF::STT_NOTYPE;
+  });
   if (Result != Symbols->end()) {
 auto *Sym = Ctx.getOrCreateSymbol(Result->Name);
 const auto *Add = MCSymbolRefExpr::create(Sym, Ctx);

diff  --git a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp 
b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
index 7f66b4136e6a..7bac44476f05 100644
--- a/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
+++ b/llvm/lib/Target/AMDGPU/GCNRegPressure.cpp
@@ -224,9 +224,8 @@ collectVirtualRegUses(const MachineInstr , const 
LiveIntervals ,
 auto const UsedMask = getUsedRegMask(MO, MRI, LIS);
 
 auto Reg = MO.getReg();
-auto I = std::find_if(Res.begin(), Res.end(), [Reg](const RegisterMaskPair 
) {
-  return RM.RegUnit == Reg;
-});
+auto I = llvm::find_if(
+Res, [Reg](const RegisterMaskPair ) { return RM.RegUnit == Reg; });
 if (I != Res.end())
   I->LaneMask |= UsedMask;
 else

diff  --git a/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp 
b/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
index de8ec4f1a6b0..80fcb099ffaa 100644
--- a/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
+++ b/llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp
@@ -264,11 +264,10 @@ static bool lowerShiftReservedVGPR(MachineFunction ,
 
   // Find saved info about the pre-reserved register.
   const auto *ReservedVGPRInfoItr =
-  std::find_if(FuncInfo->getSGPRSpillVGPRs().begin(),
-   FuncInfo->getSGPRSpillVGPRs().end(),
-   [PreReservedVGPR](const auto ) {
- return SpillRegInfo.VGPR == PreReservedVGPR;
-   });
+   

[llvm-branch-commits] [llvm] 33bf1ca - [llvm] Use *Set::contains (NFC)

2021-01-07 Thread Kazu Hirata via llvm-branch-commits

Author: Kazu Hirata
Date: 2021-01-07T20:29:34-08:00
New Revision: 33bf1cad759487f678f2b694866e2608c4b99aea

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

LOG: [llvm] Use *Set::contains (NFC)

Added: 


Modified: 
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
llvm/lib/Transforms/Scalar/JumpThreading.cpp
llvm/lib/Transforms/Scalar/LoopRerollPass.cpp
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp 
b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 62e3e5ad0a52..5cf5e9463b45 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1244,7 +1244,7 @@ static bool InstrBreaksNonThrowing(Instruction , const 
SCCNodeSet ) {
   // I is a may-throw call to a function inside our SCC. This doesn't
   // invalidate our current working assumption that the SCC is no-throw; we
   // just have to scan that other function.
-  if (SCCNodes.count(Callee) > 0)
+  if (SCCNodes.contains(Callee))
 return false;
 }
   }
@@ -1264,7 +1264,7 @@ static bool InstrBreaksNoFree(Instruction , const 
SCCNodeSet ) {
   if (Callee->doesNotFreeMemory())
 return false;
 
-  if (SCCNodes.count(Callee) > 0)
+  if (SCCNodes.contains(Callee))
 return false;
 
   return true;

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 8750e83623e6..a3d86e26fe23 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2523,7 +2523,7 @@ Instruction 
*InstCombinerImpl::optimizeBitCastFromPhi(CastInst ,
 if (BCI == )
   RetVal = I;
   } else if (auto *PHI = dyn_cast(V)) {
-assert(OldPhiNodes.count(PHI) > 0);
+assert(OldPhiNodes.contains(PHI));
 (void) PHI;
   } else {
 llvm_unreachable("all uses should be handled");

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 08877797c53a..888166f1f53d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -502,7 +502,7 @@ static bool canRewriteGEPAsOffset(Value *Start, Value *Base,
 
   Value *V = WorkList.back();
 
-  if (Explored.count(V) != 0) {
+  if (Explored.contains(V)) {
 WorkList.pop_back();
 continue;
   }

diff  --git a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp 
b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
index d9416072793a..927c34180db9 100644
--- a/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
+++ b/llvm/lib/Transforms/Instrumentation/ControlHeightReduction.cpp
@@ -731,7 +731,7 @@ static Instruction* getBranchInsertPoint(RegInfo ) {
 }
   }
   for (Instruction  : *EntryBB) {
-if (EntryBlockSelectSet.count() > 0) {
+if (EntryBlockSelectSet.contains()) {
   assert( == HoistPoint &&
  "HoistPoint must be the first one in Selects");
   break;
@@ -1304,17 +1304,17 @@ void CHR::classifyBiasedScopes(CHRScope *Scope, 
CHRScope *OutermostScope) {
   for (RegInfo  : Scope->RegInfos) {
 if (RI.HasBranch) {
   Region *R = RI.R;
-  if (TrueBiasedRegionsGlobal.count(R) > 0)
+  if (TrueBiasedRegionsGlobal.contains(R))
 OutermostScope->TrueBiasedRegions.insert(R);
-  else if (FalseBiasedRegionsGlobal.count(R) > 0)
+  else if (FalseBiasedRegionsGlobal.contains(R))
 OutermostScope->FalseBiasedRegions.insert(R);
   else
 llvm_unreachable("Must be biased");
 }
 for (SelectInst *SI : RI.Selects) {
-  if (TrueBiasedSelectsGlobal.count(SI) > 0)
+  if (TrueBiasedSelectsGlobal.contains(SI))
 OutermostScope->TrueBiasedSelects.insert(SI);
-  else if (FalseBiasedSelectsGlobal.count(SI) > 0)
+  else if (FalseBiasedSelectsGlobal.contains(SI))
 OutermostScope->FalseBiasedSelects.insert(SI);
   else
 llvm_unreachable("Must be biased");
@@ -1397,8 +1397,8 @@ void CHR::setCHRRegions(CHRScope *Scope, CHRScope 
*OutermostScope) {
 DenseSet HoistStops;
 bool IsHoisted = false;
 if (RI.HasBranch) {
-  assert((OutermostScope->TrueBiasedRegions.count(R) > 0 ||
-  OutermostScope->FalseBiasedRegions.count(R) > 0) &&
+  assert((OutermostScope->TrueBiasedRegions.contains(R) ||
+  

[llvm-branch-commits] [llvm] 8febb2e - [CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC)

2021-01-07 Thread Kazu Hirata via llvm-branch-commits

Author: Kazu Hirata
Date: 2021-01-07T20:29:32-08:00
New Revision: 8febb2e0f56107b3256999c9e1520fdc51fcd1b4

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

LOG: [CodeGen] Remove unused function isCallerPreservedOrConstPhysReg (NFC)

The last use of the function was removed on Oct 20, 2018 in commit
8d6ff4c0af843e1a61b76d89812aed91e358de34.

Added: 


Modified: 
llvm/include/llvm/CodeGen/MachineRegisterInfo.h
llvm/lib/CodeGen/MachineRegisterInfo.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h 
b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
index a4da62d0a50f..a1a67058cc55 100644
--- a/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -625,10 +625,6 @@ class MachineRegisterInfo {
   /// function. Writing to a constant register has no effect.
   bool isConstantPhysReg(MCRegister PhysReg) const;
 
-  /// Returns true if either isConstantPhysReg or TRI->isCallerPreservedPhysReg
-  /// returns true. This is a utility member function.
-  bool isCallerPreservedOrConstPhysReg(MCRegister PhysReg) const;
-
   /// Get an iterator over the pressure sets affected by the given physical or
   /// virtual register. If RegUnit is physical, it must be a register unit 
(from
   /// MCRegUnitIterator).

diff  --git a/llvm/lib/CodeGen/MachineRegisterInfo.cpp 
b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
index f5793c63acbf..9165d6d7bb10 100644
--- a/llvm/lib/CodeGen/MachineRegisterInfo.cpp
+++ b/llvm/lib/CodeGen/MachineRegisterInfo.cpp
@@ -532,13 +532,6 @@ bool MachineRegisterInfo::isConstantPhysReg(MCRegister 
PhysReg) const {
   return true;
 }
 
-bool
-MachineRegisterInfo::isCallerPreservedOrConstPhysReg(MCRegister PhysReg) const 
{
-  const TargetRegisterInfo *TRI = getTargetRegisterInfo();
-  return isConstantPhysReg(PhysReg) ||
-  TRI->isCallerPreservedPhysReg(PhysReg, *MF);
-}
-
 /// markUsesInDebugValueAsUndef - Mark every DBG_VALUE referencing the
 /// specified register as undefined which causes the DBG_VALUE to be
 /// deleted during LiveDebugVariables analysis.



___
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] 495b301 - [gn build] Port 6b0ee02747e

2021-01-07 Thread LLVM GN Syncbot via llvm-branch-commits

Author: LLVM GN Syncbot
Date: 2021-01-08T04:23:02Z
New Revision: 495b301de6ed9990e6e04e603a61b16639d5ad6f

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

LOG: [gn build] Port 6b0ee02747e

Added: 


Modified: 
llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn 
b/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
index 49ec784224b1..90da3924ae68 100644
--- a/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
@@ -24,14 +24,19 @@ static_library("Analysis") {
 "Consumed.cpp",
 "Dominators.cpp",
 "ExprMutationAnalyzer.cpp",
+"HTMLPathDiagnosticConsumer.cpp",
 "IssueHash.cpp",
 "LiveVariables.cpp",
 "ObjCNoReturn.cpp",
 "PathDiagnostic.cpp",
+"PlistHTMLPathDiagnosticConsumer.cpp",
+"PlistPathDiagnosticConsumer.cpp",
 "PostOrderCFGView.cpp",
 "ProgramPoint.cpp",
 "ReachableCode.cpp",
 "RetainSummaryManager.cpp",
+"SarifPathDiagnosticConsumer.cpp",
+"TextPathDiagnosticConsumer.cpp",
 "ThreadSafety.cpp",
 "ThreadSafetyCommon.cpp",
 "ThreadSafetyLogical.cpp",

diff  --git a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn 
b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
index c16c37d47b28..44be3eee1310 100644
--- a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
@@ -39,11 +39,9 @@ static_library("Core") {
 "ExprEngineCallAndReturn.cpp",
 "ExprEngineObjC.cpp",
 "FunctionSummary.cpp",
-"HTMLDiagnostics.cpp",
 "LoopUnrolling.cpp",
 "LoopWidening.cpp",
 "MemRegion.cpp",
-"PlistDiagnostics.cpp",
 "ProgramState.cpp",
 "RangeConstraintManager.cpp",
 "RangedConstraintManager.cpp",
@@ -51,12 +49,10 @@ static_library("Core") {
 "SMTConstraintManager.cpp",
 "SValBuilder.cpp",
 "SVals.cpp",
-"SarifDiagnostics.cpp",
 "SimpleConstraintManager.cpp",
 "SimpleSValBuilder.cpp",
 "Store.cpp",
 "SymbolManager.cpp",
-"TextDiagnostics.cpp",
 "WorkList.cpp",
   ]
 }



___
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] 6b0ee02 - Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""""

2021-01-07 Thread Artem Dergachev via llvm-branch-commits

Author: Artem Dergachev
Date: 2021-01-07T20:22:22-08:00
New Revision: 6b0ee02747ed22d41e175d15f27025183341e6f8

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

LOG: Revert "Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic 
consumer implementations to libAnalysis.

This reverts commit b12f26733a4259c90e5f387aceb9f23c35e003b8.

Fix dead include that looked like another missed circular dependency.

Added: 
clang/include/clang/Analysis/CrossTUAnalysisHelper.h
clang/include/clang/Analysis/PathDiagnosticConsumers.def
clang/include/clang/Analysis/PathDiagnosticConsumers.h
clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
clang/lib/Analysis/TextPathDiagnosticConsumer.cpp

Modified: 
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/include/clang/module.modulemap
clang/lib/Analysis/CMakeLists.txt
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/CMakeLists.txt
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp



diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
new file mode 100644
index ..500e78ddedcf
--- /dev/null
+++ b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
@@ -0,0 +1,41 @@
+//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
+#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
+
+#include "llvm/ADT/Optional.h"
+#include "clang/Basic/SourceManager.h"
+
+namespace clang {
+
+class ASTUnit;
+
+/// This class is an abstract interface acting as a bridge between
+/// an analysis that requires lookups across translation units (a user
+/// of that interface) and the facility that implements such lookups
+/// (an implementation of that interface). This is useful to break direct
+/// link-time dependencies between the (possibly shared) libraries in which
+/// the user and the implementation live.
+class CrossTUAnalysisHelper {
+public:
+  /// Determine the original source location in the original TU for an
+  /// imported source location.
+  /// \p ToLoc Source location in the imported-to AST.
+  /// \return Source location in the imported-from AST and the corresponding
+  /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit
+  /// object that is returned here).
+  /// If any error happens (ToLoc is a non-imported source location) empty is
+  /// returned.
+  virtual llvm::Optional>
+  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 
0;
+
+  virtual ~CrossTUAnalysisHelper() {}
+};
+} // namespace clang
+
+#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H

diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def 
b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
new file mode 100644
index ..33d2072fcf31
--- /dev/null
+++ b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
@@ -0,0 +1,50 @@
+//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file defines the set of path diagnostic consumers - objects that
+// implement 
diff erent representations of static analysis results.
+//
+//===--===//
+
+#ifndef ANALYSIS_DIAGNOSTICS
+#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATEFN)
+#endif
+
+ANALYSIS_DIAGNOSTICS(HTML, "html", "Output analysis results using HTML",
+  

[llvm-branch-commits] [lldb] 2ff36e7 - lldb subprogram_ranges.test - remove dependence on temp file name

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T20:04:22-08:00
New Revision: 2ff36e79291486b489ae26418daa1b123473b405

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

LOG: lldb subprogram_ranges.test - remove dependence on temp file name

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test 
b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
index a6fa5f8ce7a5..740cd35b0f3b 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
@@ -16,4 +16,4 @@
 
 b main
 # CHECK: (lldb) b main
-# CHECK-NEXT: Breakpoint 1: where = subprogram_ranges.test.tmp.out`main + 6 at 
main.c:2:7
+# CHECK-NEXT: Breakpoint 1: where = {{.*}}`main + 6 at main.c:2:7



___
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] 4a3c2ba - Fix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses the test temp paths instead)

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T19:57:14-08:00
New Revision: 4a3c2ba890460a209b289dca525e9de6f8ad0af3

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

LOG: Fix print-dot-ddg.ll so it doesn't try to write to the source tree (& uses 
the test temp paths instead)

Added: 


Modified: 
llvm/test/Analysis/DDG/print-dot-ddg.ll

Removed: 




diff  --git a/llvm/test/Analysis/DDG/print-dot-ddg.ll 
b/llvm/test/Analysis/DDG/print-dot-ddg.ll
index 8a4d55bc2e8b..939fde1639c5 100644
--- a/llvm/test/Analysis/DDG/print-dot-ddg.ll
+++ b/llvm/test/Analysis/DDG/print-dot-ddg.ll
@@ -1,7 +1,7 @@
-; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg 
-dot-ddg-filename-prefix=out.full < %s 2>&1 > /dev/null
-; RUN: FileCheck %s -input-file=out.full.foo.for.body.dot
-; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg 
-dot-ddg-filename-prefix=out.only -dot-ddg-only < %s 2>&1 > /dev/null
-; RUN: FileCheck %s -input-file=out.only.foo.for.body.dot 
-check-prefix=CHECK-ONLY
+; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=%t < 
%s 2>&1 > /dev/null
+; RUN: FileCheck %s -input-file=%t.foo.for.body.dot
+; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg -dot-ddg-filename-prefix=%t 
-dot-ddg-only < %s 2>&1 > /dev/null
+; RUN: FileCheck %s -input-file=%t.foo.for.body.dot -check-prefix=CHECK-ONLY
 
 target datalayout = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512"
 



___
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] [lldb] 696775d - Fix subprogram_ranges.test by explicitly using lld

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T19:53:17-08:00
New Revision: 696775d96ecd20aacb7935541995a5554bb32ba8

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

LOG: Fix subprogram_ranges.test by explicitly using lld

Seems consistent with the way other tests in this directory do linking

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test 
b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
index 13186e39b9d1..a6fa5f8ce7a5 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
+++ b/lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test
@@ -1,6 +1,8 @@
 # REQUIRES: x86
-# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o 
%t.out
-# RUN: %lldb -b -s %s %t.out 2>&1 | FileCheck %s
+# REQUIRES: lld
+# RUN: %clang -target x86_64-pc-linux -g -O0 %S/Inputs/subprogram_ranges.s -o 
%t.o -c
+# RUN: ld.lld %t.o -o %t
+# RUN: %lldb -b -s %s %t 2>&1 | FileCheck %s
 
 # Test breaking on symbols and printing variables when a DW_TAG_subprogram uses
 # DW_AT_ranges instead of DW_AT_low_pc/DW_AT_high_pc.  While the assembly here



___
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] [lld] b14ad90 - [LLD][COFF] Simplify function. NFC.

2021-01-07 Thread Alexandre Ganea via llvm-branch-commits

Author: Alexandre Ganea
Date: 2021-01-07T22:37:11-05:00
New Revision: b14ad90b137980125170b64fdf6be270811e5fc7

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

LOG: [LLD][COFF] Simplify function. NFC.

Added: 


Modified: 
lld/COFF/DebugTypes.cpp
lld/COFF/DebugTypes.h

Removed: 




diff  --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index d3996eabca7d..52c24aaf214f 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -696,7 +696,7 @@ void TpiSource::mergeUniqueTypeRecords(ArrayRef 
typeRecords,
 
 void TpiSource::remapTpiWithGHashes(GHashState *g) {
   assert(config->debugGHashes && "ghashes must be enabled");
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   tpiMap = indexMapStorage;
   ipiMap = indexMapStorage;
   mergeUniqueTypeRecords(file->debugTypes);
@@ -761,13 +761,13 @@ void TypeServerSource::remapTpiWithGHashes(GHashState *g) 
{
   // propagate errors, those should've been handled during ghash loading.
   pdb::PDBFile  = pdbInputFile->session->getPDBFile();
   pdb::TpiStream  = check(pdbFile.getPDBTpiStream());
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   tpiMap = indexMapStorage;
   mergeUniqueTypeRecords(typeArrayToBytes(tpi.typeArray()));
   if (pdbFile.hasPDBIpiStream()) {
 pdb::TpiStream  = check(pdbFile.getPDBIpiStream());
 ipiSrc->indexMapStorage.resize(ipiSrc->ghashes.size());
-ipiSrc->fillMapFromGHashes(g, ipiSrc->indexMapStorage);
+ipiSrc->fillMapFromGHashes(g);
 ipiMap = ipiSrc->indexMapStorage;
 ipiSrc->tpiMap = tpiMap;
 ipiSrc->ipiMap = ipiMap;
@@ -842,7 +842,7 @@ void UsePrecompSource::loadGHashes() {
 }
 
 void UsePrecompSource::remapTpiWithGHashes(GHashState *g) {
-  fillMapFromGHashes(g, indexMapStorage);
+  fillMapFromGHashes(g);
   // This object was compiled with /Yu, so process the corresponding
   // precompiled headers object (/Yc) first. Some type indices in the current
   // object are referencing data in the precompiled headers object, so we need
@@ -1149,14 +1149,14 @@ static TypeIndex loadPdbTypeIndexFromCell(GHashState *g,
 
 // Fill in a TPI or IPI index map using ghashes. For each source type, use its
 // ghash to lookup its final type index in the PDB, and store that in the map.
-void TpiSource::fillMapFromGHashes(GHashState *g,
-   SmallVectorImpl ) {
+void TpiSource::fillMapFromGHashes(GHashState *g) {
   for (size_t i = 0, e = ghashes.size(); i < e; ++i) {
 TypeIndex fakeCellIndex = indexMapStorage[i];
 if (fakeCellIndex.isSimple())
-  mapToFill[i] = fakeCellIndex;
+  indexMapStorage[i] = fakeCellIndex;
 else
-  mapToFill[i] = loadPdbTypeIndexFromCell(g, fakeCellIndex.toArrayIndex());
+  indexMapStorage[i] =
+  loadPdbTypeIndexFromCell(g, fakeCellIndex.toArrayIndex());
   }
 }
 

diff  --git a/lld/COFF/DebugTypes.h b/lld/COFF/DebugTypes.h
index 42485df06f87..faad30b141e9 100644
--- a/lld/COFF/DebugTypes.h
+++ b/lld/COFF/DebugTypes.h
@@ -83,8 +83,7 @@ class TpiSource {
 
   // Use the ghash table to construct a map from source type index to
   // destination PDB type index. Usable for either TPI or IPI.
-  void fillMapFromGHashes(GHashState *m,
-  llvm::SmallVectorImpl );
+  void fillMapFromGHashes(GHashState *m);
 
   // Copies ghashes from a vector into an array. These are long lived, so it's
   // worth the time to copy these into an appropriately sized vector to reduce



___
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] [mlir] f02e61a - Fix MLIR DRR matching when attributes are interleaved with operands

2021-01-07 Thread Mehdi Amini via llvm-branch-commits

Author: Mehdi Amini
Date: 2021-01-08T03:18:26Z
New Revision: f02e61a8b957871292e092aa440964c0f4e2bb21

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

LOG: Fix MLIR DRR matching when attributes are interleaved with operands

The ODSOperand indexing should ignore the attributes.

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

Added: 


Modified: 
mlir/test/mlir-tblgen/rewriter-indexing.td
mlir/tools/mlir-tblgen/RewriterGen.cpp

Removed: 




diff  --git a/mlir/test/mlir-tblgen/rewriter-indexing.td 
b/mlir/test/mlir-tblgen/rewriter-indexing.td
index c21b04f6d0f6..a6b403285765 100644
--- a/mlir/test/mlir-tblgen/rewriter-indexing.td
+++ b/mlir/test/mlir-tblgen/rewriter-indexing.td
@@ -51,6 +51,9 @@ def test2 : Pat<(COp $attr1, $op1, $attr2, (AOp $op2)),
 
 // Check rewriting with a DAG subtree in the result and remapping a location.
 // CHECK: struct test3 : public ::mlir::RewritePattern {
+// We expect ODSOperand 0 here, the attribute before the operand in BOp
+// definition shouldn't shift the counter.
+// CHECK: op1 = (*castedOp0.getODSOperands(0).begin()).getDefiningOp();
 // CHECK: rewriter.create((*a.getODSResults(0).begin()).getLoc()
 def test3 : Pat<(BOp $attr, (AOp:$a $input)),
 (BOp $attr, (AOp $input), (location $a))>;

diff  --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp 
b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 9fca15b416ba..1a665174 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -83,9 +83,10 @@ class PatternEmitter {
   void emitOpMatch(DagNode tree, StringRef opName, int depth);
 
   // Emits C++ statements for matching the `argIndex`-th argument of the given
-  // DAG `tree` as an operand.
+  // DAG `tree` as an operand. operandIndex is the index in the DAG excluding
+  // the preceding attributes.
   void emitOperandMatch(DagNode tree, StringRef opName, int argIndex,
-int depth);
+int operandIndex, int depth);
 
   // Emits C++ statements for matching the `argIndex`-th argument of the given
   // DAG `tree` as an attribute.
@@ -379,7 +380,7 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef 
opName, int depth) {
 // Next handle DAG leaf: operand or attribute
 if (opArg.is()) {
   // emitOperandMatch's argument indexing counts attributes.
-  emitOperandMatch(tree, castedName, i, depth);
+  emitOperandMatch(tree, castedName, i, nextOperand, depth);
   ++nextOperand;
 } else if (opArg.is()) {
   emitAttributeMatch(tree, opName, i, depth);
@@ -393,7 +394,8 @@ void PatternEmitter::emitOpMatch(DagNode tree, StringRef 
opName, int depth) {
 }
 
 void PatternEmitter::emitOperandMatch(DagNode tree, StringRef opName,
-  int argIndex, int depth) {
+  int argIndex, int operandIndex,
+  int depth) {
   Operator  = tree.getDialectOp(opMap);
   auto *operand = op.getArg(argIndex).get();
   auto matcher = tree.getArgAsLeaf(argIndex);
@@ -418,7 +420,7 @@ void PatternEmitter::emitOperandMatch(DagNode tree, 
StringRef opName,
 PrintFatalError(loc, error);
   }
   auto self = formatv("(*{0}.getODSOperands({1}).begin()).getType()",
-  opName, argIndex);
+  opName, operandIndex);
   emitMatchCheck(
   opName,
   tgfmt(constraint.getConditionTemplate(), (self)),



___
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] 2759041 - [gn build] (manually) merge a whole bunch of libc++ header files

2021-01-07 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-07T22:09:35-05:00
New Revision: 2759041786e4fe0dfb3b4fe9a3107395be738b95

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

LOG: [gn build] (manually) merge a whole bunch of libc++ header files

I noticed __availability was missing, so I manually diffed the
file lists and put all recently(ish) added headers:
* __availability from 2eadbc86142ba
* concepts from 601f7631827ae
* execution from 0a06eb911b830
* numbers from 4f6c4b473c4a5

Also remove libcxx_install_support_headers like the CMake build did in
6706342f48bea, and unconditionally copy
support/win32/{limits_msvc_win32.h,locale_win32.h} like the CMake
build always did as far as I can tell.

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index ac217956886a..64253c6e72df 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -2,11 +2,6 @@ import("//clang/resource_dir.gni")
 import("//libcxx/config.gni")
 import("//llvm/utils/gn/build/write_cmake_config.gni")
 
-declare_args() {
-  # Install libc++ support headers.
-  libcxx_install_support_headers = true
-}
-
 libcxx_needs_site_config =
 libcxx_abi_version != 1 || libcxx_abi_namespace != "" || 
libcxx_abi_unstable
 
@@ -54,6 +49,7 @@ if (libcxx_needs_site_config) {
 
 copy("include") {
   sources = [
+"__availability",
 "__bit_reference",
 "__bsd_locale_defaults.h",
 "__bsd_locale_fallbacks.h",
@@ -104,6 +100,7 @@ copy("include") {
 "compare",
 "complex",
 "complex.h",
+"concepts",
 "condition_variable",
 "csetjmp",
 "csignal",
@@ -122,6 +119,7 @@ copy("include") {
 "deque",
 "errno.h",
 "exception",
+"execution",
 "experimental/__config",
 "experimental/__memory",
 "experimental/algorithm",
@@ -174,6 +172,7 @@ copy("include") {
 "module.modulemap",
 "mutex",
 "new",
+"numbers",
 "numeric",
 "optional",
 "ostream",
@@ -200,6 +199,24 @@ copy("include") {
 "string.h",
 "string_view",
 "strstream",
+"support/android/locale_bionic.h",
+"support/fuchsia/xlocale.h",
+"support/ibm/limits.h",
+"support/ibm/locale_mgmt_aix.h",
+"support/ibm/nanosleep.h",
+"support/ibm/support.h",
+"support/ibm/xlocale.h",
+"support/musl/xlocale.h",
+"support/newlib/xlocale.h",
+"support/nuttx/xlocale.h",
+"support/solaris/floatingpoint.h",
+"support/solaris/wchar.h",
+"support/solaris/xlocale.h",
+"support/win32/limits_msvc_win32.h",
+"support/win32/locale_win32.h",
+"support/xlocale/__nop_locale_mgmt.h",
+"support/xlocale/__posix_l_fallback.h",
+"support/xlocale/__strtonum_fallback.h",
 "system_error",
 "tgmath.h",
 "thread",
@@ -234,31 +251,5 @@ copy("include") {
   } else {
 deps += [ ":copy_config" ]
   }
-  if (libcxx_install_support_headers) {
-sources += [
-  "support/android/locale_bionic.h",
-  "support/fuchsia/xlocale.h",
-  "support/ibm/limits.h",
-  "support/ibm/locale_mgmt_aix.h",
-  "support/ibm/nanosleep.h",
-  "support/ibm/support.h",
-  "support/ibm/xlocale.h",
-  "support/musl/xlocale.h",
-  "support/newlib/xlocale.h",
-  "support/nuttx/xlocale.h",
-  "support/solaris/floatingpoint.h",
-  "support/solaris/wchar.h",
-  "support/solaris/xlocale.h",
-  "support/xlocale/__nop_locale_mgmt.h",
-  "support/xlocale/__posix_l_fallback.h",
-  "support/xlocale/__strtonum_fallback.h",
-]
-if (target_os == "win") {
-  sources += [
-"support/win32/limits_msvc_win32.h",
-"support/win32/locale_win32.h",
-  ]
-}
-  }
   outputs = [ "$root_build_dir/include/c++/v1/{{source_target_relative}}" ]
 }



___
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] ab81489 - [gn build] Port b12f26733a4

2021-01-07 Thread LLVM GN Syncbot via llvm-branch-commits

Author: LLVM GN Syncbot
Date: 2021-01-08T02:19:24Z
New Revision: ab814896dc8a9d55c49ed20d87e39cac2dc6882b

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

LOG: [gn build] Port b12f26733a4

Added: 


Modified: 
llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn 
b/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
index 90da3924ae68..49ec784224b1 100644
--- a/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/Analysis/BUILD.gn
@@ -24,19 +24,14 @@ static_library("Analysis") {
 "Consumed.cpp",
 "Dominators.cpp",
 "ExprMutationAnalyzer.cpp",
-"HTMLPathDiagnosticConsumer.cpp",
 "IssueHash.cpp",
 "LiveVariables.cpp",
 "ObjCNoReturn.cpp",
 "PathDiagnostic.cpp",
-"PlistHTMLPathDiagnosticConsumer.cpp",
-"PlistPathDiagnosticConsumer.cpp",
 "PostOrderCFGView.cpp",
 "ProgramPoint.cpp",
 "ReachableCode.cpp",
 "RetainSummaryManager.cpp",
-"SarifPathDiagnosticConsumer.cpp",
-"TextPathDiagnosticConsumer.cpp",
 "ThreadSafety.cpp",
 "ThreadSafetyCommon.cpp",
 "ThreadSafetyLogical.cpp",

diff  --git a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn 
b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
index 44be3eee1310..c16c37d47b28 100644
--- a/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/lib/StaticAnalyzer/Core/BUILD.gn
@@ -39,9 +39,11 @@ static_library("Core") {
 "ExprEngineCallAndReturn.cpp",
 "ExprEngineObjC.cpp",
 "FunctionSummary.cpp",
+"HTMLDiagnostics.cpp",
 "LoopUnrolling.cpp",
 "LoopWidening.cpp",
 "MemRegion.cpp",
+"PlistDiagnostics.cpp",
 "ProgramState.cpp",
 "RangeConstraintManager.cpp",
 "RangedConstraintManager.cpp",
@@ -49,10 +51,12 @@ static_library("Core") {
 "SMTConstraintManager.cpp",
 "SValBuilder.cpp",
 "SVals.cpp",
+"SarifDiagnostics.cpp",
 "SimpleConstraintManager.cpp",
 "SimpleSValBuilder.cpp",
 "Store.cpp",
 "SymbolManager.cpp",
+"TextDiagnostics.cpp",
 "WorkList.cpp",
   ]
 }



___
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] b12f267 - Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T18:18:23-08:00
New Revision: b12f26733a4259c90e5f387aceb9f23c35e003b8

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

LOG: Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer 
implementations to libAnalysis."""

This reverts commit d2ddc694ff94743d9735aaf07edcaf6db8aaca04.

This still contains a circular dependency between Analysis and CrossTU:

$ grep -r include.*Analysis clang/include/clang/CrossTU
clang/include/clang/CrossTU/CrossTranslationUnit.h:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"
$ grep -r include.*CrossTU clang/lib/Analysis
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp:
  #include "clang/CrossTU/CrossTranslationUnit.h"
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp:
  #include "clang/Analysis/CrossTUAnalysisHelper.h"

Added: 
clang/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h
clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp
clang/lib/StaticAnalyzer/Core/TextDiagnostics.cpp

Modified: 
clang/include/clang/CrossTU/CrossTranslationUnit.h
clang/include/clang/StaticAnalyzer/Core/Analyses.def
clang/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h
clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
clang/include/clang/module.modulemap
clang/lib/Analysis/CMakeLists.txt
clang/lib/CrossTU/CrossTranslationUnit.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/lib/StaticAnalyzer/Core/CMakeLists.txt
clang/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp

Removed: 
clang/include/clang/Analysis/CrossTUAnalysisHelper.h
clang/include/clang/Analysis/PathDiagnosticConsumers.def
clang/include/clang/Analysis/PathDiagnosticConsumers.h
clang/lib/Analysis/HTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistHTMLPathDiagnosticConsumer.cpp
clang/lib/Analysis/PlistPathDiagnosticConsumer.cpp
clang/lib/Analysis/SarifPathDiagnosticConsumer.cpp
clang/lib/Analysis/TextPathDiagnosticConsumer.cpp



diff  --git a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h 
b/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
deleted file mode 100644
index 500e78ddedcf..
--- a/clang/include/clang/Analysis/CrossTUAnalysisHelper.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//===- CrossTUAnalysisHelper.h - Abstraction layer for CTU --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-#ifndef LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-#define LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H
-
-#include "llvm/ADT/Optional.h"
-#include "clang/Basic/SourceManager.h"
-
-namespace clang {
-
-class ASTUnit;
-
-/// This class is an abstract interface acting as a bridge between
-/// an analysis that requires lookups across translation units (a user
-/// of that interface) and the facility that implements such lookups
-/// (an implementation of that interface). This is useful to break direct
-/// link-time dependencies between the (possibly shared) libraries in which
-/// the user and the implementation live.
-class CrossTUAnalysisHelper {
-public:
-  /// Determine the original source location in the original TU for an
-  /// imported source location.
-  /// \p ToLoc Source location in the imported-to AST.
-  /// \return Source location in the imported-from AST and the corresponding
-  /// ASTUnit object (the AST was loaded from a file using an internal ASTUnit
-  /// object that is returned here).
-  /// If any error happens (ToLoc is a non-imported source location) empty is
-  /// returned.
-  virtual llvm::Optional>
-  getImportedFromSourceLocationWithPreprocessor(SourceLocation ToLoc) const = 
0;
-
-  virtual ~CrossTUAnalysisHelper() {}
-};
-} // namespace clang
-
-#endif // LLVM_CLANG_ANALYSIS_CROSS_TU_HELPER_H

diff  --git a/clang/include/clang/Analysis/PathDiagnosticConsumers.def 
b/clang/include/clang/Analysis/PathDiagnosticConsumers.def
deleted file mode 100644
index 33d2072fcf31..
--- a/clang/include/clang/Analysis/PathDiagnosticConsumers.def
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- PathDiagnosticConsumers.def - Visualizing warnings --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//

[llvm-branch-commits] [compiler-rt] 658a1be - [builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS

2021-01-07 Thread Ryan Prichard via llvm-branch-commits

Author: Ryan Prichard
Date: 2021-01-07T17:53:44-08:00
New Revision: 658a1be76ba2e9880bc1dd530869a45be452344c

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

LOG: [builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS

On Android, when the builtins are linked into a binary, they are
typically linked using -Wl,--exclude-libs so that the symbols aren't
reexported. For the NDK, compiler-rt's default behavior (build the
builtins archive with -fvisibility=hidden) is better so that builtins
are hidden even without -Wl,--exclude-libs.

Android needs the builtins with non-hidden symbols only for a special
case: for backwards compatibility with old binaries, the libc.so and
libm.so DSOs in the platform need to export some builtins for arm32 and
32-bit x86. See D56977.

Control the behavior with a new flag,
`COMPILER_RT_BUILTINS_HIDE_SYMBOLS`, that behaves similarly to the
`*_HERMETIC_STATIC_LIBRARY` in libunwind/libcxx/libcxxabi, so that
Android can build a special builtins variant for libc.so/libm.so.

Unlike the hermetic flags for other projects, this new flag is enabled
by default.

Reviewed By: compnerd, MaskRay

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

Added: 


Modified: 
compiler-rt/lib/builtins/CMakeLists.txt

Removed: 




diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index 5259e951dff3..b511a9a987b3 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -47,6 +47,9 @@ endif()
 
 include(builtin-config-ix)
 
+option(COMPILER_RT_BUILTINS_HIDE_SYMBOLS
+  "Do not export any symbols from the static library." ON)
+
 # TODO: Need to add a mechanism for logging errors when builtin source files 
are
 # added to a sub-directory and not this CMakeLists file.
 set(GENERIC_SOURCES
@@ -666,7 +669,7 @@ else ()
   append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC BUILTIN_CFLAGS)
 endif()
 append_list_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin 
BUILTIN_CFLAGS)
-if(NOT ANDROID)
+if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS)
   append_list_if(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG 
-fvisibility=hidden BUILTIN_CFLAGS)
 endif()
 if(NOT COMPILER_RT_DEBUG)
@@ -676,7 +679,7 @@ else ()
 
   set(BUILTIN_DEFS "")
 
-  if(NOT ANDROID)
+  if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS)
 append_list_if(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG VISIBILITY_HIDDEN 
BUILTIN_DEFS)
   endif()
 



___
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] 48baa7f - [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

2021-01-07 Thread via llvm-branch-commits

Author: clementval
Date: 2021-01-07T20:08:20-05:00
New Revision: 48baa7f5b11cbe6b00711864a19cd8b722f5940d

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

LOG: [clang] Add powerpc64le-none-linux-gnu to gnu toolchain for PPC64

While trying to compile clang and openmp with a freshly built clang with the 
gcc/7.4.0
toolchain on the Summit supercomputer I face some error because of the triple 
under which
the GCC toolchain is installed was not present in for PPC64LE triples.
This patch add the powerpc64le-none-linux-gnu used on system like Summit and 
Ascent.

Reviewed By: jdenny

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

Added: 


Modified: 
clang/lib/Driver/ToolChains/Gnu.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index 336ee13b2df5..164cf6e7 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2161,7 +2161,8 @@ void 
Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
   static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"};
   static const char *const PPC64LETriples[] = {
   "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu",
-  "powerpc64le-suse-linux", "ppc64le-redhat-linux"};
+  "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux",
+  "ppc64le-redhat-linux"};
 
   static const char *const RISCV32LibDirs[] = {"/lib32", "/lib"};
   static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",



___
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] 8dddcc7 - [Cloning] Copy metadata of global declarations

2021-01-07 Thread Ruiling Song via llvm-branch-commits

Author: Ruiling Song
Date: 2021-01-08T08:21:18+08:00
New Revision: 8dddcc762dd98d53b9406b36e92f62502834187c

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

LOG: [Cloning] Copy metadata of global declarations

We have modules with metadata on declarations, and out-of-tree passes
use that metadata, and we need to clone those modules. We really expect
such metadata is kept during the clone operation.

Reviewed by: arsenm, aprantl

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

Added: 
llvm/test/Other/copy-metadata-of-declaration.ll

Modified: 
llvm/lib/Transforms/Utils/CloneModule.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/CloneModule.cpp 
b/llvm/lib/Transforms/Utils/CloneModule.cpp
index 2c8c3abb2922..a6327bbf21bc 100644
--- a/llvm/lib/Transforms/Utils/CloneModule.cpp
+++ b/llvm/lib/Transforms/Utils/CloneModule.cpp
@@ -117,10 +117,17 @@ std::unique_ptr llvm::CloneModule(
   //
   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I) {
+GlobalVariable *GV = cast(VMap[&*I]);
+
+SmallVector, 1> MDs;
+I->getAllMetadata(MDs);
+for (auto MD : MDs)
+  GV->addMetadata(MD.first,
+  *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs));
+
 if (I->isDeclaration())
   continue;
 
-GlobalVariable *GV = cast(VMap[&*I]);
 if (!ShouldCloneDefinition(&*I)) {
   // Skip after setting the correct linkage for an external reference.
   GV->setLinkage(GlobalValue::ExternalLinkage);
@@ -129,12 +136,6 @@ std::unique_ptr llvm::CloneModule(
 if (I->hasInitializer())
   GV->setInitializer(MapValue(I->getInitializer(), VMap));
 
-SmallVector, 1> MDs;
-I->getAllMetadata(MDs);
-for (auto MD : MDs)
-  GV->addMetadata(MD.first,
-  *MapMetadata(MD.second, VMap, RF_MoveDistinctMDs));
-
 copyComdat(GV, &*I);
   }
 

diff  --git a/llvm/test/Other/copy-metadata-of-declaration.ll 
b/llvm/test/Other/copy-metadata-of-declaration.ll
new file mode 100644
index ..aed8db75f6d8
--- /dev/null
+++ b/llvm/test/Other/copy-metadata-of-declaration.ll
@@ -0,0 +1,10 @@
+; RUN: opt -run-twice -verify -S -o - %s | FileCheck %s
+
+; This test is used to check metadata attached to global variable declarations
+; are copied when CloneModule(). This is required by out-of-tree passes.
+
+; CHECK: @g = external addrspace(64) global i32, !spirv.InOut !0
+
+@g = external addrspace(64) global i32, !spirv.InOut !0
+
+!0 = !{i32 1}



___
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] [lld] 6acfc3a - Fix build after eaadb41db6233cf1c9e882d74a31c1f9d6e211ff when the MSVC libs are not in PATH.

2021-01-07 Thread Alexandre Ganea via llvm-branch-commits

Author: Alexandre Ganea
Date: 2021-01-07T18:52:00-05:00
New Revision: 6acfc3a78210639367ab8345a9af04e97692a661

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

LOG: Fix build after eaadb41db6233cf1c9e882d74a31c1f9d6e211ff when the MSVC 
libs are not in PATH.

Added: 


Modified: 
lld/test/COFF/precomp-ghash.test

Removed: 




diff  --git a/lld/test/COFF/precomp-ghash.test 
b/lld/test/COFF/precomp-ghash.test
index e9d1984ac40d..6dcd8a35002e 100644
--- a/lld/test/COFF/precomp-ghash.test
+++ b/lld/test/COFF/precomp-ghash.test
@@ -4,7 +4,7 @@
 
 RUN: lld-link %p/Inputs/precomp-ghash-precomp.obj \
 RUN:%p/Inputs/precomp-ghash-obj1.obj\
-RUN:%p/Inputs/precomp-ghash-obj2.obj /debug:ghash /out:%t.exe /pdb:%t.pdb
+RUN:%p/Inputs/precomp-ghash-obj2.obj /debug:ghash /out:%t.exe /pdb:%t.pdb 
/nodefaultlib /force
 RUN: llvm-pdbutil dump -types -ids %t.pdb | FileCheck %s
 
 ; These object files were generated via the following inputs and commands:
@@ -44,10 +44,10 @@ RUN: llvm-pdbutil dump -types -ids %t.pdb | FileCheck %s
 CHECK:   Types (TPI Stream)
 CHECK-NEXT: 
 CHECK:   0x1003 | LF_MFUNCTION
-CHECK:   0x274F | LF_PROCEDURE
+CHECK:   0x1377 | LF_PROCEDURE
 CHECK: Types (IPI Stream) 
 CHECK-NEXT: 
-CHECK:   0x189D | LF_FUNC_ID [size = 20]
-CHECK-NEXT:   name = main, type = 0x274F, parent scope = 
-CHECK-NEXT:  0x189E | LF_MFUNC_ID [size = 20]
+CHECK:   0x10A5 | LF_FUNC_ID [size = 20]
+CHECK-NEXT:   name = main, type = 0x1377, parent scope = 
+CHECK-NEXT:  0x10A6 | LF_MFUNC_ID [size = 20]
 CHECK-NEXT:   name = {ctor}, type = 0x1003, class type = 0x1000



___
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] 946bc50 - [RISCV] Define the vfsqrt RVV intrinsics

2021-01-07 Thread Evandro Menezes via llvm-branch-commits

Author: Evandro Menezes
Date: 2021-01-07T17:29:29-06:00
New Revision: 946bc50e4cbbc998c77e091c7956e996a7d409f0

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

LOG: [RISCV] Define the vfsqrt RVV intrinsics

Define the `vfsqrt` IR intrinsics for the respective V instructions.

Authored-by: Roger Ferrer Ibanez 
Co-Authored-by: Evandro Menezes 

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

Added: 
llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv32.ll
llvm/test/CodeGen/RISCV/rvv/vfsqrt-rv64.ll

Modified: 
llvm/include/llvm/IR/IntrinsicsRISCV.td
llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Removed: 




diff  --git a/llvm/include/llvm/IR/IntrinsicsRISCV.td 
b/llvm/include/llvm/IR/IntrinsicsRISCV.td
index fe0d6b00a3c2..a28f8eb5ab08 100644
--- a/llvm/include/llvm/IR/IntrinsicsRISCV.td
+++ b/llvm/include/llvm/IR/IntrinsicsRISCV.td
@@ -189,6 +189,19 @@ let TargetPrefix = "riscv" in {
  LLVMPointerType>, llvm_anyvector_ty,
  LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, 
llvm_anyint_ty],
 [NoCapture>, IntrWriteMem]>, RISCVVIntrinsic;
+  // For destination vector type is the same as source vector.
+  // Input: (vector_in, vl)
+  class RISCVUnaryAANoMask
+: Intrinsic<[llvm_anyvector_ty],
+[LLVMMatchType<0>, llvm_anyint_ty],
+[IntrNoMem]>, RISCVVIntrinsic;
+  // For destination vector type is the same as first source vector (with 
mask).
+  // Input: (vector_in, mask, vl)
+  class RISCVUnaryAAMask
+: Intrinsic<[llvm_anyvector_ty],
+[LLVMMatchType<0>, LLVMMatchType<0>,
+ LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>, 
llvm_anyint_ty],
+[IntrNoMem]>, RISCVVIntrinsic;
   // For destination vector type is the same as first and second source vector.
   // Input: (vector_in, vector_in, vl)
   class RISCVBinaryAAANoMask
@@ -210,7 +223,6 @@ let TargetPrefix = "riscv" in {
 [IntrNoMem]>, RISCVVIntrinsic {
 let ExtendOperand = 2;
   }
-
   // For destination vector type is the same as first source vector (with 
mask).
   // Input: (maskedoff, vector_in, vector_in/scalar_in, mask, vl)
   class RISCVBinaryAAXMask
@@ -326,7 +338,6 @@ let TargetPrefix = "riscv" in {
 [IntrNoMem, IntrHasSideEffects]>, RISCVVIntrinsic {
 let ExtendOperand = 3;
   }
-
   class RISCVTernaryAAAXNoMask
 : Intrinsic<[llvm_anyvector_ty],
 [LLVMMatchType<0>, LLVMMatchType<0>, llvm_anyint_ty,
@@ -470,7 +481,10 @@ let TargetPrefix = "riscv" in {
 def "int_riscv_" # NAME : RISCVIStore;
 def "int_riscv_" # NAME # "_mask" : RISCVIStoreMask;
   }
-
+  multiclass RISCVUnaryAA {
+def "int_riscv_" # NAME : RISCVUnaryAANoMask;
+def "int_riscv_" # NAME # "_mask" : RISCVUnaryAAMask;
+  }
   // AAX means the destination type(A) is the same as the first source
   // type(A). X means any type for the second source operand.
   multiclass RISCVBinaryAAX {
@@ -685,6 +699,8 @@ let TargetPrefix = "riscv" in {
   defm vfwmsac : RISCVTernaryWide;
   defm vfwnmsac : RISCVTernaryWide;
 
+  defm vfsqrt : RISCVUnaryAA;
+
   defm vfmin : RISCVBinaryAAX;
   defm vfmax : RISCVBinaryAAX;
 

diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td 
b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 62d887524950..2557b49f0c1c 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -1097,6 +1097,15 @@ multiclass VPseudoUnaryV_F_NoDummyMask {
   }
 }
 
+multiclass VPseudoUnaryV_V {
+  foreach m = MxList.m in {
+let VLMul = m.value in {
+  def "_V_" # m.MX : VPseudoUnaryNoMask;
+  def "_V_" # m.MX # "_MASK" : VPseudoUnaryMask;
+}
+  }
+}
+
 multiclass PseudoUnaryV_VF2 {
   defvar constraints = "@earlyclobber $rd";
   foreach m = MxList.m[1-6] in
@@ -1688,6 +1697,18 @@ multiclass VPatUnaryV_VF vtilist> {
+  foreach vti = vtilist in {
+def : VPatUnaryNoMask;
+def : VPatUnaryMask;
+  }
+}
+
 multiclass VPatNullaryV
 {
   foreach vti = AllIntegerVectors in {
@@ -1712,7 +1733,6 @@ multiclass VPatNullaryM {
 (NoX0 GPR:$vl), mti.SEW)>;
 }
 
-
 multiclass VPatBinary;
 defm PseudoVFWMSAC : VPseudoTernaryW_VV_VX;
 defm PseudoVFWNMSAC: VPseudoTernaryW_VV_VX;
 
+//===--===//
+// 14.8. Vector Floating-Point Square-Root Instruction
+//===--===//
+defm PseudoVFSQRT  : VPseudoUnaryV_V;
+
 
//===--===//
 // 14.11. Vector Floating-Point Min/Max Instructions
 

[llvm-branch-commits] [llvm] d59f97b - [SimplifyCFG] removeUnwindEdge(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:27+03:00
New Revision: d59f97bb3a652565ac074e76da2b6b54816880f3

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

LOG: [SimplifyCFG] removeUnwindEdge(): switch to non-permissive DomTree updates

No actual changes needed, Catchswitch cannot unwind to one of its catchpads.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 9f8cec997168..1c81be897d93 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2347,7 +2347,7 @@ void llvm::removeUnwindEdge(BasicBlock *BB, 
DomTreeUpdater *DTU) {
   TI->replaceAllUsesWith(NewTI);
   TI->eraseFromParent();
   if (DTU)
-DTU->applyUpdatesPermissive({{DominatorTree::Delete, BB, UnwindDest}});
+DTU->applyUpdates({{DominatorTree::Delete, BB, UnwindDest}});
 }
 
 /// removeUnreachableBlocks - Remove blocks that are not reachable, even



___
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] f0eba8c - [SimplifyCFG] changeToCall(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:27+03:00
New Revision: f0eba8ce2d4027a890751b7617e98730d7d682f6

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

LOG: [SimplifyCFG] changeToCall(): switch to non-permissive DomTree updates

No actual changes needed, normal and unwind destinations of an invoke
can never be identical.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 5b9d5d343d7f..9f8cec997168 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2110,7 +2110,7 @@ void llvm::changeToCall(InvokeInst *II, DomTreeUpdater 
*DTU) {
   UnwindDestBB->removePredecessor(BB);
   II->eraseFromParent();
   if (DTU)
-DTU->applyUpdatesPermissive({{DominatorTree::Delete, BB, UnwindDestBB}});
+DTU->applyUpdates({{DominatorTree::Delete, BB, UnwindDestBB}});
 }
 
 BasicBlock *llvm::changeToInvokeAndSplitBasicBlock(CallInst *CI,



___
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] be0a31d - [SimplifyCFG] DeleteDeadBlocks(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:27+03:00
New Revision: be0a31d13bcf28577f65b8e189a8bb105b000274

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

LOG: [SimplifyCFG] DeleteDeadBlocks(): switch to non-permissive DomTree updates

No actual changes needed, DetatchDeadBlocks() was already doing the right thing.

Added: 


Modified: 
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp 
b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 4d99067438ad..0b3a25902c69 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -105,7 +105,7 @@ void llvm::DeleteDeadBlocks(ArrayRef  BBs, 
DomTreeUpdater *DTU,
   DetatchDeadBlocks(BBs, DTU ?  : nullptr, KeepOneInputPHIs);
 
   if (DTU)
-DTU->applyUpdatesPermissive(Updates);
+DTU->applyUpdates(Updates);
 
   for (BasicBlock *BB : BBs)
 if (DTU)



___
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] 6618921 - [SimplifyCFG] MergeBlockIntoPredecessor(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:26+03:00
New Revision: 66189212bbb0351ae98bbda70bd2cd819e86fd17

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

LOG: [SimplifyCFG] MergeBlockIntoPredecessor(): switch to non-permissive 
DomTree updates

... which requires not deleting edges that were just deleted already,
by not processing the same successor more than once.

Added: 


Modified: 
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp 
b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 09888db063e2..4d99067438ad 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -230,19 +230,21 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, 
DomTreeUpdater *DTU,
   // These dominator edges will be redirected from Pred.
   std::vector Updates;
   if (DTU) {
-Updates.reserve(1 + (2 * succ_size(BB)));
+SmallSetVector UniqueSuccessors(succ_begin(BB),
+ succ_end(BB));
+Updates.reserve(1 + (2 * UniqueSuccessors.size()));
 // Add insert edges first. Experimentally, for the particular case of two
 // blocks that can be merged, with a single successor and single 
predecessor
 // respectively, it is beneficial to have all insert updates first. 
Deleting
 // edges first may lead to unreachable blocks, followed by inserting edges
 // making the blocks reachable again. Such DT updates lead to high compile
 // times. We add inserts before deletes here to reduce compile time.
-for (auto I = succ_begin(BB), E = succ_end(BB); I != E; ++I)
+for (BasicBlock *UniqueSuccessor : UniqueSuccessors)
   // This successor of BB may already have PredBB as a predecessor.
-  if (!llvm::is_contained(successors(PredBB), *I))
-Updates.push_back({DominatorTree::Insert, PredBB, *I});
-for (auto I = succ_begin(BB), E = succ_end(BB); I != E; ++I)
-  Updates.push_back({DominatorTree::Delete, BB, *I});
+  if (!llvm::is_contained(successors(PredBB), UniqueSuccessor))
+Updates.push_back({DominatorTree::Insert, PredBB, UniqueSuccessor});
+for (BasicBlock *UniqueSuccessor : UniqueSuccessors)
+  Updates.push_back({DominatorTree::Delete, BB, UniqueSuccessor});
 Updates.push_back({DominatorTree::Delete, PredBB, BB});
   }
 
@@ -303,7 +305,7 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, 
DomTreeUpdater *DTU,
isa(BB->getTerminator()) &&
"The successor list of BB isn't empty before "
"applying corresponding DTU updates.");
-DTU->applyUpdatesPermissive(Updates);
+DTU->applyUpdates(Updates);
 DTU->deleteBB(BB);
   } else {
 BB->eraseFromParent(); // Nuke BB if DTU is 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] 05adc73 - [SimplifyCFG] changeToUnreachable(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:26+03:00
New Revision: 05adc73db053fd79e64901e359e6ee783d772a80

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

LOG: [SimplifyCFG] changeToUnreachable(): switch to non-permissive DomTree 
updates

... which requires not deleting edges that were just deleted already,
by not processing the same predecessor more than once.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 220a4d43b491..5b9d5d343d7f 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2025,19 +2025,18 @@ unsigned llvm::changeToUnreachable(Instruction *I, bool 
UseLLVMTrap,
bool PreserveLCSSA, DomTreeUpdater *DTU,
MemorySSAUpdater *MSSAU) {
   BasicBlock *BB = I->getParent();
-  std::vector  Updates;
 
   if (MSSAU)
 MSSAU->changeToUnreachable(I);
 
+  SmallSetVector UniqueSuccessors;
+
   // Loop over all of the successors, removing BB's entry from any PHI
   // nodes.
-  if (DTU)
-Updates.reserve(BB->getTerminator()->getNumSuccessors());
   for (BasicBlock *Successor : successors(BB)) {
 Successor->removePredecessor(BB, PreserveLCSSA);
 if (DTU)
-  Updates.push_back({DominatorTree::Delete, BB, Successor});
+  UniqueSuccessors.insert(Successor);
   }
   // Insert a call to llvm.trap right before this.  This turns the undefined
   // behavior into a hard fail instead of falling through into random code.
@@ -2059,8 +2058,13 @@ unsigned llvm::changeToUnreachable(Instruction *I, bool 
UseLLVMTrap,
 BB->getInstList().erase(BBI++);
 ++NumInstrsRemoved;
   }
-  if (DTU)
-DTU->applyUpdatesPermissive(Updates);
+  if (DTU) {
+SmallVector Updates;
+Updates.reserve(UniqueSuccessors.size());
+for (BasicBlock *UniqueSuccessor : UniqueSuccessors)
+  Updates.push_back({DominatorTree::Delete, BB, UniqueSuccessor});
+DTU->applyUpdates(Updates);
+  }
   return NumInstrsRemoved;
 }
 



___
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] 6984781 - [NFC][SimplifyCFG] Add a test with an undef cond branch to identical destinations

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:26+03:00
New Revision: 6984781df9b584febce51b7740c8738a076f5692

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

LOG: [NFC][SimplifyCFG] Add a test with an undef cond branch to identical 
destinations

Added: 
llvm/test/Transforms/SimplifyCFG/change-to-unreachable-matching-successor.ll

Modified: 


Removed: 




diff  --git 
a/llvm/test/Transforms/SimplifyCFG/change-to-unreachable-matching-successor.ll 
b/llvm/test/Transforms/SimplifyCFG/change-to-unreachable-matching-successor.ll
new file mode 100644
index ..4fd017d6780f
--- /dev/null
+++ 
b/llvm/test/Transforms/SimplifyCFG/change-to-unreachable-matching-successor.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | 
FileCheck %s
+
+declare void @llvm.assume(i1)
+
+define void @fn(i1 %c) {
+; CHECK-LABEL: @fn(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:unreachable
+;
+entry:
+  call void @llvm.assume(i1 undef)
+  br i1 %c, label %bb1, label %bb1
+bb1:
+  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] [llvm] 7600d7c - [SimplifyCFG] removeUnreachableBlocks(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:26+03:00
New Revision: 7600d7c7be07ee78543522d0fbd1e92e672a0327

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

LOG: [SimplifyCFG] removeUnreachableBlocks(): switch to non-permissive DomTree 
updates

... which requires not deleting edges that were just deleted already,
by not processing the same predecessor more than once.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 7c962edba3ca..220a4d43b491 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2376,12 +2376,16 @@ bool llvm::removeUnreachableBlocks(Function , 
DomTreeUpdater *DTU,
   // their internal references. Update DTU if available.
   std::vector Updates;
   for (auto *BB : DeadBlockSet) {
+SmallSetVector UniqueSuccessors;
 for (BasicBlock *Successor : successors(BB)) {
   if (!DeadBlockSet.count(Successor))
 Successor->removePredecessor(BB);
   if (DTU)
-Updates.push_back({DominatorTree::Delete, BB, Successor});
+UniqueSuccessors.insert(Successor);
 }
+if (DTU)
+  for (auto *UniqueSuccessor : UniqueSuccessors)
+Updates.push_back({DominatorTree::Delete, BB, UniqueSuccessor});
 BB->dropAllReferences();
 if (DTU) {
   Instruction *TI = BB->getTerminator();
@@ -2398,7 +2402,7 @@ bool llvm::removeUnreachableBlocks(Function , 
DomTreeUpdater *DTU,
   }
 
   if (DTU) {
-DTU->applyUpdatesPermissive(Updates);
+DTU->applyUpdates(Updates);
 bool Deleted = false;
 for (auto *BB : DeadBlockSet) {
   if (DTU->isBBPendingDeletion(BB))



___
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] f8875c3 - [NFC][SimplifyCFG] Add test with an unreachable block with two identical successors

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:25+03:00
New Revision: f8875c313c381764a9734dbd6e94539e8837d9f7

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

LOG: [NFC][SimplifyCFG] Add test with an unreachable block with two identical 
successors

Added: 
llvm/test/Transforms/SimplifyCFG/unreachable-matching-successor.ll

Modified: 


Removed: 




diff  --git 
a/llvm/test/Transforms/SimplifyCFG/unreachable-matching-successor.ll 
b/llvm/test/Transforms/SimplifyCFG/unreachable-matching-successor.ll
new file mode 100644
index ..25a4ab7203f5
--- /dev/null
+++ b/llvm/test/Transforms/SimplifyCFG/unreachable-matching-successor.ll
@@ -0,0 +1,16 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | 
FileCheck %s
+
+define void @fn(i1 %c) {
+; CHECK-LABEL: @fn(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:ret void
+;
+entry:
+  ret void
+
+unreachable_bb0:
+  br i1 %c, label %unreachable_bb1, label %unreachable_bb1
+unreachable_bb1:
+  br label %unreachable_bb0
+}



___
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] 1f9b591 - [SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock(): switch to non-permissive DomTree updates

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:25+03:00
New Revision: 1f9b591ee66fe5abd6f63990b085e1f1f559d8d9

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

LOG: [SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock(): switch to 
non-permissive DomTree updates

... which requires not deleting edges that were just deleted already,
by not processing the same predecessor more than once.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 38cfee31c35d..7c962edba3ca 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -1048,11 +1048,13 @@ bool 
llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
   if (DTU) {
 Updates.push_back({DominatorTree::Delete, BB, Succ});
 // All predecessors of BB will be moved to Succ.
-for (auto I = pred_begin(BB), E = pred_end(BB); I != E; ++I) {
-  Updates.push_back({DominatorTree::Delete, *I, BB});
+SmallSetVector Predecessors(pred_begin(BB), pred_end(BB));
+Updates.reserve(Updates.size() + 2 * Predecessors.size());
+for (auto *Predecessor : Predecessors) {
+  Updates.push_back({DominatorTree::Delete, Predecessor, BB});
   // This predecessor of BB may already have Succ as a successor.
-  if (!llvm::is_contained(successors(*I), Succ))
-Updates.push_back({DominatorTree::Insert, *I, Succ});
+  if (!llvm::is_contained(successors(Predecessor), Succ))
+Updates.push_back({DominatorTree::Insert, Predecessor, Succ});
 }
   }
 
@@ -1109,7 +,7 @@ bool 
llvm::TryToSimplifyUncondBranchFromEmptyBlock(BasicBlock *BB,
"applying corresponding DTU updates.");
 
   if (DTU) {
-DTU->applyUpdatesPermissive(Updates);
+DTU->applyUpdates(Updates);
 DTU->deleteBB(BB);
   } else {
 BB->eraseFromParent(); // Delete the old basic block.



___
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] b382272 - [SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `indirectbr` handling

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:25+03:00
New Revision: b3822728fae2e3755d6daff7fc31fbac16e61fe4

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

LOG: [SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree 
updates in `indirectbr` handling

... which requires not deleting edges that were just deleted already.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 5ce0e29cadab..38cfee31c35d 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -329,22 +329,20 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
 if (auto *BA =
   dyn_cast(IBI->getAddress()->stripPointerCasts())) {
   BasicBlock *TheOnlyDest = BA->getBasicBlock();
-  std::vector  Updates;
-  if (DTU)
-Updates.reserve(IBI->getNumDestinations() - 1);
+  SmallSetVector RemovedSuccessors;
 
   // Insert the new branch.
   Builder.CreateBr(TheOnlyDest);
 
+  BasicBlock *SuccToKeep = TheOnlyDest;
   for (unsigned i = 0, e = IBI->getNumDestinations(); i != e; ++i) {
-if (IBI->getDestination(i) == TheOnlyDest) {
-  TheOnlyDest = nullptr;
+BasicBlock *DestBB = IBI->getDestination(i);
+if (DTU && DestBB != TheOnlyDest)
+  RemovedSuccessors.insert(DestBB);
+if (IBI->getDestination(i) == SuccToKeep) {
+  SuccToKeep = nullptr;
 } else {
-  BasicBlock *ParentBB = IBI->getParent();
-  BasicBlock *DestBB = IBI->getDestination(i);
-  DestBB->removePredecessor(ParentBB);
-  if (DTU)
-Updates.push_back({DominatorTree::Delete, ParentBB, DestBB});
+  DestBB->removePredecessor(BB);
 }
   }
   Value *Address = IBI->getAddress();
@@ -361,13 +359,18 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
   // If we didn't find our destination in the IBI successor list, then we
   // have undefined behavior.  Replace the unconditional branch with an
   // 'unreachable' instruction.
-  if (TheOnlyDest) {
+  if (SuccToKeep) {
 BB->getTerminator()->eraseFromParent();
 new UnreachableInst(BB->getContext(), BB);
   }
 
-  if (DTU)
-DTU->applyUpdatesPermissive(Updates);
+  if (DTU) {
+std::vector Updates;
+Updates.reserve(RemovedSuccessors.size());
+for (auto *RemovedSuccessor : RemovedSuccessors)
+  Updates.push_back({DominatorTree::Delete, BB, RemovedSuccessor});
+DTU->applyUpdates(Updates);
+  }
   return true;
 }
   }



___
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] 8b9a0e6 - [NFC][SimlifyCFG] Add some indirectbr-of-blockaddress tests

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:25+03:00
New Revision: 8b9a0e6f7ed2fa3293ba5cd2c2fb1acd21db6e2d

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

LOG: [NFC][SimlifyCFG] Add some indirectbr-of-blockaddress tests

Added: 


Modified: 
llvm/test/Transforms/SimplifyCFG/indirectbr.ll

Removed: 




diff  --git a/llvm/test/Transforms/SimplifyCFG/indirectbr.ll 
b/llvm/test/Transforms/SimplifyCFG/indirectbr.ll
index 52ef6b77166c..3c82f5a64ee3 100644
--- a/llvm/test/Transforms/SimplifyCFG/indirectbr.ll
+++ b/llvm/test/Transforms/SimplifyCFG/indirectbr.ll
@@ -1,17 +1,33 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | 
FileCheck %s
 
 ; SimplifyCFG should eliminate redundant indirectbr edges.
 
-; CHECK: indbrtest0
-; CHECK: indirectbr i8* %t, [label %BB0, label %BB1, label %BB2]
-; CHECK: %x = phi i32 [ 0, %BB0 ], [ 1, %entry ]
-
 declare void @foo()
 declare void @A()
 declare void @B(i32)
 declare void @C()
 
 define void @indbrtest0(i8** %P, i8** %Q) {
+; CHECK-LABEL: @indbrtest0(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:store i8* blockaddress(@indbrtest0, [[BB0:%.*]]), i8** 
[[P:%.*]], align 8
+; CHECK-NEXT:store i8* blockaddress(@indbrtest0, [[BB1:%.*]]), i8** [[P]], 
align 8
+; CHECK-NEXT:store i8* blockaddress(@indbrtest0, [[BB2:%.*]]), i8** [[P]], 
align 8
+; CHECK-NEXT:call void @foo()
+; CHECK-NEXT:[[T:%.*]] = load i8*, i8** [[Q:%.*]], align 8
+; CHECK-NEXT:indirectbr i8* [[T]], [label [[BB0]], label [[BB1]], label 
%BB2]
+; CHECK:   BB0:
+; CHECK-NEXT:call void @A()
+; CHECK-NEXT:br label [[BB1]]
+; CHECK:   BB1:
+; CHECK-NEXT:[[X:%.*]] = phi i32 [ 0, [[BB0]] ], [ 1, [[ENTRY:%.*]] ]
+; CHECK-NEXT:call void @B(i32 [[X]])
+; CHECK-NEXT:ret void
+; CHECK:   BB2:
+; CHECK-NEXT:call void @C()
+; CHECK-NEXT:ret void
+;
 entry:
   store i8* blockaddress(@indbrtest0, %BB0), i8** %P
   store i8* blockaddress(@indbrtest0, %BB1), i8** %P
@@ -35,10 +51,17 @@ BB2:
 ; better if it removed the branch altogether, but simplifycfdg currently misses
 ; that because the predecessor is the entry block.
 
-; CHECK: indbrtest1
-; CHECK: br label %BB0
 
 define void @indbrtest1(i8** %P, i8** %Q) {
+; CHECK-LABEL: @indbrtest1(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:store i8* blockaddress(@indbrtest1, [[BB0:%.*]]), i8** 
[[P:%.*]], align 8
+; CHECK-NEXT:call void @foo()
+; CHECK-NEXT:br label [[BB0]]
+; CHECK:   BB0:
+; CHECK-NEXT:call void @A()
+; CHECK-NEXT:ret void
+;
 entry:
   store i8* blockaddress(@indbrtest1, %BB0), i8** %P
   call void @foo()
@@ -52,11 +75,12 @@ BB0:
 ; SimplifyCFG should notice that BB0 does not have its address taken and
 ; remove it from entry's successor list.
 
-; CHECK: indbrtest2
-; CHECK: entry:
-; CHECK-NEXT: unreachable
 
 define void @indbrtest2(i8* %t) {
+; CHECK-LABEL: @indbrtest2(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:unreachable
+;
 entry:
   indirectbr i8* %t, [label %BB0, label %BB0]
 BB0:
@@ -77,13 +101,17 @@ BB0:
 ; SimplifyCFG should turn the indirectbr into a conditional branch on the
 ; condition of the select.
 
-; CHECK-LABEL: @indbrtest3(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br i1 %cond, label %L1, label %L2
-; CHECK-NOT: indirectbr
-; CHECK-NOT: br
-; CHECK-NOT: L3:
 define void @indbrtest3(i1 %cond, i8* %address) nounwind {
+; CHECK-LABEL: @indbrtest3(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br i1 [[COND:%.*]], label [[L1:%.*]], label [[L2:%.*]]
+; CHECK:   L1:
+; CHECK-NEXT:call void @A()
+; CHECK-NEXT:ret void
+; CHECK:   L2:
+; CHECK-NEXT:call void @C()
+; CHECK-NEXT:ret void
+;
 entry:
   %indirect.goto.dest = select i1 %cond, i8* blockaddress(@indbrtest3, %L1), 
i8* blockaddress(@indbrtest3, %L2)
   indirectbr i8* %indirect.goto.dest, [label %L1, label %L2, label %L3]
@@ -104,10 +132,14 @@ L3:
 ; As in @indbrtest1, it should really remove the branch entirely, but it 
doesn't
 ; because it's in the entry block.
 
-; CHECK-LABEL: @indbrtest4(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: br label %L1
 define void @indbrtest4(i1 %cond) nounwind {
+; CHECK-LABEL: @indbrtest4(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:br label [[L1:%.*]]
+; CHECK:   L1:
+; CHECK-NEXT:call void @A()
+; CHECK-NEXT:ret void
+;
 entry:
   %indirect.goto.dest = select i1 %cond, i8* blockaddress(@indbrtest4, %L1), 
i8* blockaddress(@indbrtest4, %L1)
   indirectbr i8* %indirect.goto.dest, [label %L1, label %L2, label %L3]
@@ -126,11 +158,11 @@ L3:
 ; SimplifyCFG should turn the indirectbr into an unreachable because neither
 ; destination is listed as a successor.
 
-; CHECK-LABEL: @indbrtest5(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: unreachable

[llvm-branch-commits] [llvm] 36593a3 - [SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree updates in `SwitchInst` handling

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:24+03:00
New Revision: 36593a30a40b52e8040d821bbd294ef6758cf9cf

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

LOG: [SimplifyCFG] ConstantFoldTerminator(): switch to non-permissive DomTree 
updates in `SwitchInst` handling

... which requires not deleting edges that will still be present.

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index 107929e801d9..5ce0e29cadab 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -231,9 +231,6 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
 i = SI->removeCase(i);
 e = SI->case_end();
 Changed = true;
-if (DTU)
-  DTU->applyUpdatesPermissive(
-  {{DominatorTree::Delete, ParentBB, DefaultDest}});
 continue;
   }
 
@@ -259,19 +256,19 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
   // Insert the new branch.
   Builder.CreateBr(TheOnlyDest);
   BasicBlock *BB = SI->getParent();
-  std::vector  Updates;
-  if (DTU)
-Updates.reserve(SI->getNumSuccessors() - 1);
+
+  SmallSetVector RemovedSuccessors;
 
   // Remove entries from PHI nodes which we no longer branch to...
+  BasicBlock *SuccToKeep = TheOnlyDest;
   for (BasicBlock *Succ : successors(SI)) {
+if (DTU && Succ != TheOnlyDest)
+  RemovedSuccessors.insert(Succ);
 // Found case matching a constant operand?
-if (Succ == TheOnlyDest) {
-  TheOnlyDest = nullptr; // Don't modify the first branch to 
TheOnlyDest
+if (Succ == SuccToKeep) {
+  SuccToKeep = nullptr; // Don't modify the first branch to TheOnlyDest
 } else {
   Succ->removePredecessor(BB);
-  if (DTU)
-Updates.push_back({DominatorTree::Delete, BB, Succ});
 }
   }
 
@@ -280,8 +277,13 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
   SI->eraseFromParent();
   if (DeleteDeadConditions)
 RecursivelyDeleteTriviallyDeadInstructions(Cond, TLI);
-  if (DTU)
-DTU->applyUpdatesPermissive(Updates);
+  if (DTU) {
+std::vector Updates;
+Updates.reserve(RemovedSuccessors.size());
+for (auto *RemovedSuccessor : RemovedSuccessors)
+  Updates.push_back({DominatorTree::Delete, BB, RemovedSuccessor});
+DTU->applyUpdates(Updates);
+  }
   return true;
 }
 



___
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] 16ab8e5 - [SimplifyCFG] ConstantFoldTerminator(): handle matching destinations of condbr earlier

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:24+03:00
New Revision: 16ab8e5f6dbbeb5b8e900677f4a64c9924ecd7ba

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

LOG: [SimplifyCFG] ConstantFoldTerminator(): handle matching destinations of 
condbr earlier

We need to handle this case before dealing with the case of constant
branch condition, because if the destinations match, latter fold
would try to remove the DomTree edge that would still be present.

This allows to make that particular DomTree update non-permissive

Added: 


Modified: 
llvm/lib/Transforms/Utils/Local.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/Local.cpp 
b/llvm/lib/Transforms/Utils/Local.cpp
index e3bdfbae9287..107929e801d9 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -134,27 +134,10 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
   // Branch - See if we are conditional jumping on constant
   if (auto *BI = dyn_cast(T)) {
 if (BI->isUnconditional()) return false;  // Can't optimize uncond branch
+
 BasicBlock *Dest1 = BI->getSuccessor(0);
 BasicBlock *Dest2 = BI->getSuccessor(1);
 
-if (auto *Cond = dyn_cast(BI->getCondition())) {
-  // Are we branching on constant?
-  // YES.  Change to unconditional branch...
-  BasicBlock *Destination = Cond->getZExtValue() ? Dest1 : Dest2;
-  BasicBlock *OldDest = Cond->getZExtValue() ? Dest2 : Dest1;
-
-  // Let the basic block know that we are letting go of it.  Based on this,
-  // it will adjust it's PHI nodes.
-  OldDest->removePredecessor(BB);
-
-  // Replace the conditional branch with an unconditional one.
-  Builder.CreateBr(Destination);
-  BI->eraseFromParent();
-  if (DTU)
-DTU->applyUpdatesPermissive({{DominatorTree::Delete, BB, OldDest}});
-  return true;
-}
-
 if (Dest2 == Dest1) {   // Conditional branch to same location?
   // This branch matches something like this:
   // br bool %cond, label %Dest, label %Dest
@@ -172,6 +155,25 @@ bool llvm::ConstantFoldTerminator(BasicBlock *BB, bool 
DeleteDeadConditions,
 RecursivelyDeleteTriviallyDeadInstructions(Cond, TLI);
   return true;
 }
+
+if (auto *Cond = dyn_cast(BI->getCondition())) {
+  // Are we branching on constant?
+  // YES.  Change to unconditional branch...
+  BasicBlock *Destination = Cond->getZExtValue() ? Dest1 : Dest2;
+  BasicBlock *OldDest = Cond->getZExtValue() ? Dest2 : Dest1;
+
+  // Let the basic block know that we are letting go of it.  Based on this,
+  // it will adjust it's PHI nodes.
+  OldDest->removePredecessor(BB);
+
+  // Replace the conditional branch with an unconditional one.
+  Builder.CreateBr(Destination);
+  BI->eraseFromParent();
+  if (DTU)
+DTU->applyUpdates({{DominatorTree::Delete, BB, OldDest}});
+  return true;
+}
+
 return false;
   }
 



___
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] 087be53 - [NFC][SimplifyCFG] Add a test with cond br on constant w/ identical destinations

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-08T02:15:24+03:00
New Revision: 087be536feab0aacc043aed52bee2e48e90e538c

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

LOG: [NFC][SimplifyCFG] Add a test with cond br on constant w/ identical 
destinations

Added: 


Modified: 
llvm/test/Transforms/SimplifyCFG/branch-fold.ll

Removed: 




diff  --git a/llvm/test/Transforms/SimplifyCFG/branch-fold.ll 
b/llvm/test/Transforms/SimplifyCFG/branch-fold.ll
index a4ac23bada70..5b9f20b97d4e 100644
--- a/llvm/test/Transforms/SimplifyCFG/branch-fold.ll
+++ b/llvm/test/Transforms/SimplifyCFG/branch-fold.ll
@@ -1,35 +1,59 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
 ; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | 
FileCheck %s
 
 define void @test(i32* %P, i32* %Q, i1 %A, i1 %B) {
-; CHECK: test
-; CHECK: br i1
-; CHECK-NOT: br i1
-; CHECK: ret
-; CHECK: ret
+; CHECK-LABEL: @test(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:[[A_NOT:%.*]] = xor i1 [[A:%.*]], true
+; CHECK-NEXT:[[BRMERGE:%.*]] = or i1 [[A_NOT]], [[B:%.*]]
+; CHECK-NEXT:br i1 [[BRMERGE]], label [[B:%.*]], label [[C:%.*]]
+; CHECK:   b:
+; CHECK-NEXT:store i32 123, i32* [[P:%.*]], align 4
+; CHECK-NEXT:ret void
+; CHECK:   c:
+; CHECK-NEXT:ret void
+;
 
 entry:
-br i1 %A, label %a, label %b
+  br i1 %A, label %a, label %b
 a:
-br i1 %B, label %b, label %c
+  br i1 %B, label %b, label %c
 b:
-store i32 123, i32* %P
-ret void
+  store i32 123, i32* %P
+  ret void
 c:
-ret void
+  ret void
 }
 
 ; rdar://10554090
 define zeroext i1 @test2(i64 %i0, i64 %i1) nounwind uwtable readonly ssp {
+; CHECK-LABEL: @test2(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:[[AND_I_I:%.*]] = and i64 [[I0:%.*]], 281474976710655
+; CHECK-NEXT:[[AND_I11_I:%.*]] = and i64 [[I1:%.*]], 281474976710655
+; CHECK-NEXT:[[OR_COND:%.*]] = icmp eq i64 [[AND_I_I]], [[AND_I11_I]]
+; CHECK-NEXT:br i1 [[OR_COND]], label [[C:%.*]], label [[A:%.*]]
+; CHECK:   a:
+; CHECK-NEXT:[[SHR_I4_I:%.*]] = lshr i64 [[I0]], 48
+; CHECK-NEXT:[[AND_I5_I:%.*]] = and i64 [[SHR_I4_I]], 32767
+; CHECK-NEXT:[[SHR_I_I:%.*]] = lshr i64 [[I1]], 48
+; CHECK-NEXT:[[AND_I2_I:%.*]] = and i64 [[SHR_I_I]], 32767
+; CHECK-NEXT:[[CMP9_I:%.*]] = icmp ult i64 [[AND_I5_I]], [[AND_I2_I]]
+; CHECK-NEXT:[[PHITMP:%.*]] = icmp uge i64 [[AND_I2_I]], [[AND_I5_I]]
+; CHECK-NEXT:[[NOT_COND:%.*]] = xor i1 [[CMP9_I]], true
+; CHECK-NEXT:[[AND_COND:%.*]] = and i1 [[NOT_COND]], [[PHITMP]]
+; CHECK-NEXT:br label [[C]]
+; CHECK:   c:
+; CHECK-NEXT:[[O2:%.*]] = phi i1 [ [[AND_COND]], [[A]] ], [ false, 
[[ENTRY:%.*]] ]
+; CHECK-NEXT:ret i1 [[O2]]
+;
 entry:
-; CHECK: test2
-; CHECK: br i1
   %and.i.i = and i64 %i0, 281474976710655
   %and.i11.i = and i64 %i1, 281474976710655
   %or.cond = icmp eq i64 %and.i.i, %and.i11.i
   br i1 %or.cond, label %c, label %a
 
 a:
-; CHECK: br
   %shr.i4.i = lshr i64 %i0, 48
   %and.i5.i = and i64 %shr.i4.i, 32767
   %shr.i.i = lshr i64 %i1, 48
@@ -38,7 +62,6 @@ a:
   br i1 %cmp9.i, label %c, label %b
 
 b:
-; CHECK-NOT: br
   %shr.i13.i9 = lshr i64 %i1, 48
   %and.i14.i10 = and i64 %shr.i13.i9, 32767
   %shr.i.i11 = lshr i64 %i0, 48
@@ -53,6 +76,10 @@ c:
 
 ; PR13180
 define void @pr13180(i8 %p) {
+; CHECK-LABEL: @pr13180(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:unreachable
+;
 entry:
   %tobool = icmp eq i8 %p, 0
   br i1 %tobool, label %cond.false, label %cond.true
@@ -68,3 +95,18 @@ cond.end: ; preds = 
%cond.false, %cond.t
   %cond = phi i1 [ undef, %cond.true ], [ %phitmp, %cond.false ]
   unreachable
 }
+
+declare void @foo()
+define void @test3() {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:call void @foo()
+; CHECK-NEXT:ret void
+;
+entry:
+  br i1 0, label %bb0, label %bb0
+
+bb0:
+  call void @foo()
+  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] [llvm] 9ccf13c - [NewPM][NVPTX] Port NVPTX opt passes

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T15:12:35-08:00
New Revision: 9ccf13c36d1c450bc9a74bd04c9730df56f8bd73

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

LOG: [NewPM][NVPTX] Port NVPTX opt passes

There are only two used in the IR optimization pipeline.
Port these and add them to the default pipeline.

Similar to https://reviews.llvm.org/D93863.

I added -mtriple to some tests since under the new PM, the passes are
only available when the TargetMachine is specified.

Reviewed By: rnk

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

Added: 


Modified: 
llvm/lib/Target/NVPTX/NVPTX.h
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
llvm/lib/Target/NVPTX/NVVMReflect.cpp
llvm/test/CodeGen/NVPTX/intrinsic-old.ll
llvm/test/CodeGen/NVPTX/nvvm-reflect-module-flag.ll
llvm/test/CodeGen/NVPTX/nvvm-reflect.ll
llvm/tools/opt/opt.cpp

Removed: 




diff  --git a/llvm/lib/Target/NVPTX/NVPTX.h b/llvm/lib/Target/NVPTX/NVPTX.h
index dfe0b9cb5ee6..c2fd090da084 100644
--- a/llvm/lib/Target/NVPTX/NVPTX.h
+++ b/llvm/lib/Target/NVPTX/NVPTX.h
@@ -14,6 +14,7 @@
 #ifndef LLVM_LIB_TARGET_NVPTX_NVPTX_H
 #define LLVM_LIB_TARGET_NVPTX_NVPTX_H
 
+#include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CodeGen.h"
 
@@ -47,6 +48,24 @@ FunctionPass *createNVPTXLowerAllocaPass();
 MachineFunctionPass *createNVPTXPeephole();
 MachineFunctionPass *createNVPTXProxyRegErasurePass();
 
+struct NVVMIntrRangePass : PassInfoMixin {
+  NVVMIntrRangePass();
+  NVVMIntrRangePass(unsigned SmVersion) : SmVersion(SmVersion) {}
+  PreservedAnalyses run(Function , FunctionAnalysisManager );
+
+private:
+  unsigned SmVersion;
+};
+
+struct NVVMReflectPass : PassInfoMixin {
+  NVVMReflectPass();
+  NVVMReflectPass(unsigned SmVersion) : SmVersion(SmVersion) {}
+  PreservedAnalyses run(Function , FunctionAnalysisManager );
+
+private:
+  unsigned SmVersion;
+};
+
 namespace NVPTX {
 enum DrvInterface {
   NVCL,

diff  --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp 
b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index 21da566b639f..f1a82f1cf607 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -24,6 +24,7 @@
 #include "llvm/CodeGen/TargetPassConfig.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/Pass.h"
+#include "llvm/Passes/PassBuilder.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/TargetRegistry.h"
 #include "llvm/Target/TargetMachine.h"
@@ -205,6 +206,32 @@ void 
NVPTXTargetMachine::adjustPassManager(PassManagerBuilder ) {
 });
 }
 
+void NVPTXTargetMachine::registerPassBuilderCallbacks(PassBuilder ,
+  bool DebugPassManager) {
+  PB.registerPipelineParsingCallback(
+  [](StringRef PassName, FunctionPassManager ,
+ ArrayRef) {
+if (PassName == "nvvm-reflect") {
+  PM.addPass(NVVMReflectPass());
+  return true;
+}
+if (PassName == "nvvm-intr-range") {
+  PM.addPass(NVVMIntrRangePass());
+  return true;
+}
+return false;
+  });
+
+  PB.registerPipelineStartEPCallback(
+  [this, DebugPassManager](ModulePassManager ,
+   PassBuilder::OptimizationLevel Level) {
+FunctionPassManager FPM(DebugPassManager);
+FPM.addPass(NVVMReflectPass(Subtarget.getSmVersion()));
+FPM.addPass(NVVMIntrRangePass(Subtarget.getSmVersion()));
+PM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
+  });
+}
+
 TargetTransformInfo
 NVPTXTargetMachine::getTargetTransformInfo(const Function ) {
   return TargetTransformInfo(NVPTXTTIImpl(this, F));

diff  --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h 
b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
index 5b1e77958eb1..bef541c2b28d 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.h
@@ -62,6 +62,8 @@ class NVPTXTargetMachine : public LLVMTargetMachine {
   }
 
   void adjustPassManager(PassManagerBuilder &) override;
+  void registerPassBuilderCallbacks(PassBuilder ,
+bool DebugPassManager) override;
 
   TargetTransformInfo getTargetTransformInfo(const Function ) override;
 

diff  --git a/llvm/lib/Target/NVPTX/NVVMIntrRange.cpp 
b/llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
index baaedc7ac87c..5381646434eb 100644
--- a/llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
+++ b/llvm/lib/Target/NVPTX/NVVMIntrRange.cpp
@@ -17,6 +17,7 @@
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Intrinsics.h"
 #include "llvm/IR/IntrinsicsNVPTX.h"
+#include "llvm/IR/PassManager.h"
 

[llvm-branch-commits] [libcxx] ff1b6f9 - [libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.

2021-01-07 Thread Arthur O'Dwyer via llvm-branch-commits

Author: Arthur O'Dwyer
Date: 2021-01-07T18:11:46-05:00
New Revision: ff1b6f9ff27cc4d5607ea2b5daa980a1c553236b

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

LOG: [libc++] Alphabetize generate_feature_test_macro_components.py. NFCI.

For ease of comparing our list with the official SD-6 list, which is 
alphabetized.
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations#library-feature-test-macros
This also alphabetizes the lists of headers in which the macros are
defined, which harmlessly alters many comments in .
Also drive-by-fix some trivial flake8 warnings.

Added: 


Modified: 
libcxx/include/version
libcxx/utils/generate_feature_test_macro_components.py

Removed: 




diff  --git a/libcxx/include/version b/libcxx/include/version
index dde6ca165b35..39e307e93bc2 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -15,13 +15,13 @@
 
 Macro name  Value   Headers
 __cpp_lib_addressof_constexpr   201603L 
-__cpp_lib_allocator_traits_is_always_equal  201411L  
 
- 
 
-  

-
 
+__cpp_lib_allocator_traits_is_always_equal  201411L  
 
+  

+  

+
 
 __cpp_lib_any   201606L 
 __cpp_lib_apply 201603L 
-__cpp_lib_array_constexpr   201811L  

+__cpp_lib_array_constexpr   201811L  

 201603L // C++17
 __cpp_lib_as_const  201510L 
 __cpp_lib_atomic_flag_test  201907L 
@@ -53,9 +53,9 @@ __cpp_lib_constexpr_utility 
201811L 
 __cpp_lib_destroying_delete 201806L 
 __cpp_lib_enable_shared_from_this   201603L 
 __cpp_lib_endian201907L 
-__cpp_lib_erase_if  202002L  
 
- 
 
- 
 
+__cpp_lib_erase_if  202002L  
 
+  

+
  
 __cpp_lib_exchange_function 201304L 
 __cpp_lib_execution 201603L 
 __cpp_lib_filesystem201703L 
@@ -89,8 +89,8 @@ __cpp_lib_math_special_functions
201603L 
 __cpp_lib_memory_resource   201603L 

 __cpp_lib_node_extract  201606L   

 
-__cpp_lib_nonmember_container_access201411L  
 
- 
 
+__cpp_lib_nonmember_container_access201411L  
 
+ 
 
   

 
  
 __cpp_lib_not_fn201603L 
@@ -119,7 +119,7 @@ __cpp_lib_transformation_trait_aliases  
201304L 
 __cpp_lib_transparent_operators 201510L 
 201210L // C++14
 __cpp_lib_tuple_element_t   201402L 
-__cpp_lib_tuples_by_type201304L  

+__cpp_lib_tuples_by_type201304L  

 __cpp_lib_type_trait_variable_templates 201510L 
 __cpp_lib_uncaught_exceptions   201411L 
 __cpp_lib_unordered_map_try_emplace 201411L 

diff  --git a/libcxx/utils/generate_feature_test_macro_components.py 
b/libcxx/utils/generate_feature_test_macro_components.py
index 2302dc4ec505..37d8a95dd9ae 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -1,8 +1,7 @@
 #!/usr/bin/env python
 
 import os
-import tempfile
-from builtins import int, range
+from builtins import 

[llvm-branch-commits] [llvm] b2dafd4 - [NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T15:04:28-08:00
New Revision: b2dafd44ca7a975e3d58d68f3a24e36b2ceb2e1e

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

LOG: [NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline

In https://reviews.llvm.org/D88138 this was incorrectly added with
registerOptimizerLastEPCallback(), when it should be
registerLoopOptimizerEndEPCallback(), matching the legacy PM's
EP_LoopOptimizerEnd.

Reviewed By: rnk

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

Added: 


Modified: 
llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp

Removed: 




diff  --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp 
b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index 23c047e0c23b..ba0f45fe09f7 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -287,13 +287,9 @@ void 
HexagonTargetMachine::registerPassBuilderCallbacks(PassBuilder ,
   [=](LoopPassManager , PassBuilder::OptimizationLevel Level) {
 LPM.addPass(HexagonLoopIdiomRecognitionPass());
   });
-  PB.registerOptimizerLastEPCallback(
-  [=](ModulePassManager , PassBuilder::OptimizationLevel Level) {
-LoopPassManager LPM(DebugPassManager);
-FunctionPassManager FPM(DebugPassManager);
+  PB.registerLoopOptimizerEndEPCallback(
+  [=](LoopPassManager , PassBuilder::OptimizationLevel Level) {
 LPM.addPass(HexagonVectorLoopCarriedReusePass());
-FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM)));
-MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
   });
 }
 



___
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] [lldb] 15f5971 - [LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detection

2021-01-07 Thread Luís Marques via llvm-branch-commits

Author: Luís Marques
Date: 2021-01-07T23:02:55Z
New Revision: 15f5971150684b656005cfd5b744c1a34477ff60

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

LOG: [LLDB][RISCV] Add RISC-V ArchSpec and rv32/rv64 variant detection

Adds the RISC-V ArchSpec bits contributed by @simoncook as part of D62732,
plus logic to distinguish between riscv32 and riscv64 based on ELF class.

The patch follows the implementation approach previously used for MIPS.
It defines RISC-V architecture subtypes and inspects the ELF header,
namely the ELF class, to detect the right subtype.

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

Added: 
lldb/test/Shell/ObjectFile/ELF/riscv-arch.yaml

Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index a727d5ca4f79..b35766d3d9cf 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -92,6 +92,12 @@ class ArchSpec {
 eARM_abi_hard_float = 0x0400
   };
 
+  enum RISCVSubType {
+eRISCVSubType_unknown,
+eRISCVSubType_riscv32,
+eRISCVSubType_riscv64,
+  };
+
   enum Core {
 eCore_arm_generic,
 eCore_arm_armv4,
@@ -184,6 +190,9 @@ class ArchSpec {
 eCore_hexagon_hexagonv4,
 eCore_hexagon_hexagonv5,
 
+eCore_riscv32,
+eCore_riscv64,
+
 eCore_uknownMach32,
 eCore_uknownMach64,
 

diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp 
b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index 82a08a235084..cad9ce218b10 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -296,9 +296,23 @@ static uint32_t mipsVariantFromElfFlags (const 
elf::ELFHeader ) {
   return arch_variant;
 }
 
+static uint32_t riscvVariantFromElfFlags(const elf::ELFHeader ) {
+  uint32_t fileclass = header.e_ident[EI_CLASS];
+  switch (fileclass) {
+  case llvm::ELF::ELFCLASS32:
+return ArchSpec::eRISCVSubType_riscv32;
+  case llvm::ELF::ELFCLASS64:
+return ArchSpec::eRISCVSubType_riscv64;
+  default:
+return ArchSpec::eRISCVSubType_unknown;
+  }
+}
+
 static uint32_t subTypeFromElfHeader(const elf::ELFHeader ) {
   if (header.e_machine == llvm::ELF::EM_MIPS)
 return mipsVariantFromElfFlags(header);
+  else if (header.e_machine == llvm::ELF::EM_RISCV)
+return riscvVariantFromElfFlags(header);
 
   return LLDB_INVALID_CPUTYPE;
 }

diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index b0cbb269b18b..8025f37c4b38 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -212,6 +212,11 @@ static const CoreDefinition g_core_definitions[] = {
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::hexagon,
  ArchSpec::eCore_hexagon_hexagonv5, "hexagonv5"},
 
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::riscv32, ArchSpec::eCore_riscv32,
+ "riscv32"},
+{eByteOrderLittle, 8, 2, 4, llvm::Triple::riscv64, ArchSpec::eCore_riscv64,
+ "riscv64"},
+
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::UnknownArch,
  ArchSpec::eCore_uknownMach32, "unknown-mach-32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::UnknownArch,
@@ -395,6 +400,10 @@ static const ArchDefinitionEntry g_elf_arch_entries[] = {
  0xu, 0xu}, // ARC
 {ArchSpec::eCore_avr, llvm::ELF::EM_AVR, LLDB_INVALID_CPUTYPE,
  0xu, 0xu}, // AVR
+{ArchSpec::eCore_riscv32, llvm::ELF::EM_RISCV,
+ ArchSpec::eRISCVSubType_riscv32, 0xu, 0xu}, // riscv32
+{ArchSpec::eCore_riscv64, llvm::ELF::EM_RISCV,
+ ArchSpec::eRISCVSubType_riscv64, 0xu, 0xu}, // riscv64
 };
 
 static const ArchDefinition g_elf_arch_def = {

diff  --git a/lldb/test/Shell/ObjectFile/ELF/riscv-arch.yaml 
b/lldb/test/Shell/ObjectFile/ELF/riscv-arch.yaml
new file mode 100644
index ..7fbf2059c74e
--- /dev/null
+++ b/lldb/test/Shell/ObjectFile/ELF/riscv-arch.yaml
@@ -0,0 +1,24 @@
+# RUN: yaml2obj --docnum=1 %s > %t32
+# RUN: yaml2obj --docnum=2 %s > %t64
+# RUN: lldb-test object-file %t32 | FileCheck --check-prefix=CHECK-RV32 %s
+# RUN: lldb-test object-file %t64 | FileCheck --check-prefix=CHECK-RV64 %s
+
+# CHECK-RV32: Architecture: riscv32--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS32
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
+...
+
+# CHECK-RV64: Architecture: riscv64--
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_RISCV
+...




[llvm-branch-commits] [llvm] 0992bf4 - [NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T15:00:19-08:00
New Revision: 0992bf4e3f904e465fd8520b9852e305efd86809

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

LOG: [NewPM][Hexagon] Fix HexagonVectorLoopCarriedReusePass position in pipeline

In https://reviews.llvm.org/D88138 this was incorrectly added with
registerOptimizerLastEPCallback(), when it should be
registerLoopOptimizerEndEPCallback(), matching the legacy PM's
EP_LoopOptimizerEnd.

Reviewed By: rnk

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

Added: 


Modified: 
llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp

Removed: 




diff  --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp 
b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
index 23c047e0c23b..ba0f45fe09f7 100644
--- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp
@@ -287,13 +287,9 @@ void 
HexagonTargetMachine::registerPassBuilderCallbacks(PassBuilder ,
   [=](LoopPassManager , PassBuilder::OptimizationLevel Level) {
 LPM.addPass(HexagonLoopIdiomRecognitionPass());
   });
-  PB.registerOptimizerLastEPCallback(
-  [=](ModulePassManager , PassBuilder::OptimizationLevel Level) {
-LoopPassManager LPM(DebugPassManager);
-FunctionPassManager FPM(DebugPassManager);
+  PB.registerLoopOptimizerEndEPCallback(
+  [=](LoopPassManager , PassBuilder::OptimizationLevel Level) {
 LPM.addPass(HexagonVectorLoopCarriedReusePass());
-FPM.addPass(createFunctionToLoopPassAdaptor(std::move(LPM)));
-MPM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
   });
 }
 



___
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] [openmp] 2ce1681 - [OpenMP] Always print error messages in libomptarget CUDA plugin

2021-01-07 Thread via llvm-branch-commits

Author: Joseph Huber
Date: 2021-01-07T17:47:32-05:00
New Revision: 2ce16810f28379b0a56f7036895a04e18d6b4506

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

LOG: [OpenMP] Always print error messages in libomptarget CUDA plugin

Summary:
Currently error messages from the CUDA plugins are only printed to the user if 
they have debugging enabled. Change this behaviour to always print the messages 
that result in offloading failure. This improves the error messages by 
indidcating what happened when the error occurs in the plugin library, such as 
a segmentation fault on the device.

Reviewed by: jdoerfert

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

Added: 


Modified: 
openmp/libomptarget/plugins/cuda/src/rtl.cpp

Removed: 




diff  --git a/openmp/libomptarget/plugins/cuda/src/rtl.cpp 
b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
index 4fac6a76710e..a22195bae966 100644
--- a/openmp/libomptarget/plugins/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/cuda/src/rtl.cpp
@@ -33,18 +33,29 @@
   const char *errStr = nullptr;
\
   CUresult errStr_status = cuGetErrorString(err, ); 
\
   if (errStr_status == CUDA_ERROR_INVALID_VALUE)   
\
-DP("Unrecognized CUDA error code: %d\n", err); 
\
+REPORT("Unrecognized CUDA error code: %d\n", err); 
\
   else if (errStr_status == CUDA_SUCCESS)  
\
-DP("CUDA error is: %s\n", errStr); 
\
+REPORT("CUDA error is: %s\n", errStr); 
\
   else {   
\
-DP("Unresolved CUDA error code: %d\n", err);   
\
-DP("Unsuccessful cuGetErrorString return status: %d\n",
\
-   errStr_status); 
\
+REPORT("Unresolved CUDA error code: %d\n", err);   
\
+REPORT("Unsuccessful cuGetErrorString return status: %d\n",
\
+   errStr_status); 
\
   }
\
+} else {   
\
+  const char *errStr = nullptr;
\
+  CUresult errStr_status = cuGetErrorString(err, ); 
\
+  if (errStr_status == CUDA_SUCCESS)   
\
+REPORT("%s \n", errStr);   
\
 }  
\
   } while (false)
 #else // OMPTARGET_DEBUG
-#define CUDA_ERR_STRING(err) {}
+#define CUDA_ERR_STRING(err)   
\
+  do { 
\
+const char *errStr = nullptr;  
\
+CUresult errStr_status = cuGetErrorString(err, );   
\
+if (errStr_status == CUDA_SUCCESS) 
\
+  REPORT("%s \n", errStr); 
\
+  } while (false)
 #endif // OMPTARGET_DEBUG
 
 #include "../../common/elf_common.c"
@@ -90,7 +101,7 @@ bool checkResult(CUresult Err, const char *ErrMsg) {
   if (Err == CUDA_SUCCESS)
 return true;
 
-  DP("%s", ErrMsg);
+  REPORT("%s", ErrMsg);
   CUDA_ERR_STRING(Err);
   return false;
 }
@@ -101,9 +112,9 @@ int memcpyDtoD(const void *SrcPtr, void *DstPtr, int64_t 
Size,
   cuMemcpyDtoDAsync((CUdeviceptr)DstPtr, (CUdeviceptr)SrcPtr, Size, 
Stream);
 
   if (Err != CUDA_SUCCESS) {
-DP("Error when copying data from device to device. Pointers: src "
-   "= " DPxMOD ", dst = " DPxMOD ", size = %" PRId64 "\n",
-   DPxPTR(SrcPtr), DPxPTR(DstPtr), Size);
+REPORT("Error when copying data from device to device. Pointers: src "
+   "= " DPxMOD ", dst = " DPxMOD ", size = %" PRId64 "\n",
+   DPxPTR(SrcPtr), DPxPTR(DstPtr), Size);
 CUDA_ERR_STRING(Err);
 return OFFLOAD_FAIL;
   }
@@ -501,12 +512,11 @@ class DeviceRTLTy {
   DeviceData[DeviceId].BlocksPerGrid = EnvTeamLimit;
 }
 
-if (getDebugLevel() || (getInfoLevel() & OMP_INFOTYPE_PLUGIN_KERNEL))
-  INFO(DeviceId,
-   "Device supports up to %d CUDA blocks and %d threads with a "
-   "warp size of %d\n",
-   DeviceData[DeviceId].BlocksPerGrid,
-   DeviceData[DeviceId].ThreadsPerBlock, 

[llvm-branch-commits] [clang] f78d6af - [hip] Enable HIP compilation with ` on MSVC.

2021-01-07 Thread Michael Liao via llvm-branch-commits

Author: Michael Liao
Date: 2021-01-07T17:41:28-05:00
New Revision: f78d6af7319aa676a0f9f6cbb982f21c96e9aac5

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

LOG: [hip] Enable HIP compilation with ` on MSVC.

- MSVC has different `` implementation which calls into functions
  declared in ``. Provide their device-side implementation to enable
  `` compilation on HIP Windows.

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

Added: 


Modified: 
clang/lib/Headers/__clang_hip_cmath.h

Removed: 




diff  --git a/clang/lib/Headers/__clang_hip_cmath.h 
b/clang/lib/Headers/__clang_hip_cmath.h
index 3a702587ee17..128d64e271b8 100644
--- a/clang/lib/Headers/__clang_hip_cmath.h
+++ b/clang/lib/Headers/__clang_hip_cmath.h
@@ -624,6 +624,34 @@ _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 #endif
 
+// Define device-side math functions from  on MSVC.
+#if defined(_MSC_VER)
+#if defined(__cplusplus)
+extern "C" {
+#endif // defined(__cplusplus)
+__DEVICE__ __attribute__((overloadable)) double _Cosh(double x, double y) {
+  return cosh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FCosh(float x, float y) {
+  return coshf(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) short _Dtest(double *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) short _FDtest(float *p) {
+  return fpclassify(*p);
+}
+__DEVICE__ __attribute__((overloadable)) double _Sinh(double x, double y) {
+  return sinh(x) * y;
+}
+__DEVICE__ __attribute__((overloadable)) float _FSinh(float x, float y) {
+  return sinhf(x) * y;
+}
+#if defined(__cplusplus)
+}
+#endif // defined(__cplusplus)
+#endif // defined(_MSC_VER)
+
 #pragma pop_macro("__DEVICE__")
 
 #endif // __CLANG_HIP_CMATH_H__



___
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] 2cbbc6e - GlobalISel: Fail legalization on narrowing extload below memory size

2021-01-07 Thread Matt Arsenault via llvm-branch-commits

Author: Matt Arsenault
Date: 2021-01-07T17:40:34-05:00
New Revision: 2cbbc6e87c4b565a54c9bb85e34d464acb608f16

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

LOG: GlobalISel: Fail legalization on narrowing extload below memory size

Added: 


Modified: 
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir

Removed: 




diff  --git a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp 
b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
index 7b346a1bbbec..61b2611866f2 100644
--- a/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
@@ -962,10 +962,15 @@ LegalizerHelper::LegalizeResult 
LegalizerHelper::narrowScalar(MachineInstr ,
 
 Register TmpReg = MRI.createGenericVirtualRegister(NarrowTy);
 auto  = **MI.memoperands_begin();
-if (MMO.getSizeInBits() == NarrowSize) {
+unsigned MemSize = MMO.getSizeInBits();
+
+if (MemSize == NarrowSize) {
   MIRBuilder.buildLoad(TmpReg, PtrReg, MMO);
-} else {
+} else if (MemSize < NarrowSize) {
   MIRBuilder.buildLoadInstr(MI.getOpcode(), TmpReg, PtrReg, MMO);
+} else if (MemSize > NarrowSize) {
+  // FIXME: Need to split the load.
+  return UnableToLegalize;
 }
 
 if (ZExt)

diff  --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir 
b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir
index b6633adbd79c..236dcf42f851 100644
--- a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-sextload-global.mir
@@ -11,6 +11,7 @@
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s32>) = G_SEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: 
test_sextload_global_v2i32_from_4)
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s64>) = G_SEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: 
test_sextload_global_v2i64_from_4)
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s64>) = G_SEXTLOAD %0:_(p1) :: (load 8, addrspace 1) (in function: 
test_sextload_global_v2i64_from_8)
+# ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(s128) 
= G_SEXTLOAD %0:_(p1) :: (load 8, addrspace 1) (in function: 
test_sextload_global_s128_8)
 # ERR-NOT: remark
 
 ---
@@ -315,3 +316,22 @@ body: |
 %1:_(<2 x s64>) = G_SEXTLOAD %0 :: (load 8, addrspace 1)
 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
 ...
+
+---
+name: test_sextload_global_s128_8
+body: |
+  bb.0:
+liveins: $vgpr0_vgpr1
+
+; GFX8-LABEL: name: test_sextload_global_s128_8
+; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
+; GFX8: [[SEXTLOAD:%[0-9]+]]:_(s128) = G_SEXTLOAD [[COPY]](p1) :: (load 8, 
addrspace 1)
+; GFX8: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[SEXTLOAD]](s128)
+; GFX6-LABEL: name: test_sextload_global_s128_8
+; GFX6: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
+; GFX6: [[SEXTLOAD:%[0-9]+]]:_(s128) = G_SEXTLOAD [[COPY]](p1) :: (load 8, 
addrspace 1)
+; GFX6: $vgpr0_vgpr1_vgpr2_vgpr3 = COPY [[SEXTLOAD]](s128)
+%0:_(p1) = COPY $vgpr0_vgpr1
+%1:_(s128) = G_SEXTLOAD %0 :: (load 8, addrspace 1)
+$vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
+...

diff  --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir 
b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir
index 80ea67233550..4177d2e2bba7 100644
--- a/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/legalize-zextload-global.mir
@@ -11,6 +11,7 @@
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s32>) = G_ZEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: 
test_zextload_global_v2i32_from_4)
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s64>) = G_ZEXTLOAD %0:_(p1) :: (load 4, addrspace 1) (in function: 
test_zextload_global_v2i64_from_4)
 # ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(<2 x 
s64>) = G_ZEXTLOAD %0:_(p1) :: (load 8, addrspace 1) (in function: 
test_zextload_global_v2i64_from_8)
+# ERR-NEXT: remark: :0:0: unable to legalize instruction: %1:_(s128) 
= G_ZEXTLOAD %0:_(p1) :: (load 8, addrspace 1) (in function: 
test_zextload_global_s128_8)
 # ERR-NOT: remark
 
 ---
@@ -315,3 +316,22 @@ body: |
 %1:_(<2 x s64>) = G_ZEXTLOAD %0 :: (load 8, addrspace 1)
 $vgpr0_vgpr1_vgpr2_vgpr3 = COPY %1
 ...
+
+---
+name: test_zextload_global_s128_8
+body: |
+  bb.0:
+liveins: $vgpr0_vgpr1
+
+; GFX8-LABEL: name: test_zextload_global_s128_8
+; GFX8: [[COPY:%[0-9]+]]:_(p1) = COPY $vgpr0_vgpr1
+; GFX8: [[ZEXTLOAD:%[0-9]+]]:_(s128) = G_ZEXTLOAD 

[llvm-branch-commits] [libcxx] c01202a - [libc++] Fix typo in run-buildbot

2021-01-07 Thread Louis Dionne via llvm-branch-commits

Author: Louis Dionne
Date: 2021-01-07T17:37:09-05:00
New Revision: c01202a7efdd73fed280755184762b0ef8a5b78a

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

LOG: [libc++] Fix typo in run-buildbot

The installation directory was never meant to contain a brace.

Added: 


Modified: 
libcxx/utils/ci/run-buildbot

Removed: 




diff  --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index 3a394de4f2d0..8b5dd46f697c 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -58,7 +58,7 @@ done
 
 MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
 BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
-INSTALL_DIR="${BUILD_DIR}/install}"
+INSTALL_DIR="${BUILD_DIR}/install"
 
 function clean() {
 rm -rf "${BUILD_DIR}"



___
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] [lldb] 274afac - lldb: Add support for DW_AT_ranges on DW_TAG_subprograms

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T14:28:03-08:00
New Revision: 274afac9a17f43e5396a0d6c7a0741702596a7bd

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

LOG: lldb: Add support for DW_AT_ranges on DW_TAG_subprograms

gcc already produces debug info with this form
-freorder-block-and-partition
clang produces this sort of thing with -fbasic-block-sections and with a
coming-soon tweak to use ranges in DWARFv5 where they can allow greater
reuse of debug_addr than the low/high_pc forms.

This fixes the case of breaking on a function name, but leaves broken
printing a variable - a follow-up commit will add that and improve the
test case to match.

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

Added: 
lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s
lldb/test/Shell/SymbolFile/DWARF/subprogram_ranges.test

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 3eca911f4837..421298802645 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -687,13 +687,15 @@ const char *DWARFDebugInfoEntry::GetPubname(const 
DWARFUnit *cu) const {
 /// table, except that the actual DIE offset for the function is placed in the
 /// table instead of the compile unit offset.
 void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
-const DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
+DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
   if (m_tag) {
 if (m_tag == DW_TAG_subprogram) {
-  dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
-  dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
-  if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS)) {
-debug_aranges->AppendRange(GetOffset(), lo_pc, hi_pc);
+  DWARFRangeList ranges;
+  GetAttributeAddressRanges(cu, ranges,
+/*check_hi_lo_pc=*/true);
+  for (const auto  : ranges) {
+debug_aranges->AppendRange(GetOffset(), r.GetRangeBase(),
+   r.GetRangeEnd());
   }
 }
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
index 534d92e1feb9..0ba56a0a4161 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
@@ -42,7 +42,7 @@ class DWARFDebugInfoEntry {
   bool operator==(const DWARFDebugInfoEntry ) const;
   bool operator!=(const DWARFDebugInfoEntry ) const;
 
-  void BuildFunctionAddressRangeTable(const DWARFUnit *cu,
+  void BuildFunctionAddressRangeTable(DWARFUnit *cu,
   DWARFDebugAranges *debug_aranges) const;
 
   bool Extract(const lldb_private::DWARFDataExtractor ,

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s 
b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s
new file mode 100644
index ..1ff883c67f9e
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/Inputs/subprogram_ranges.s
@@ -0,0 +1,159 @@
+   .text
+   .file   "main.c"
+   .globl  main# -- Begin function main
+   .p2align4, 0x90
+   .type   main,@function
+main:   # @main
+.Lfunc_begin0:
+   .file   1 "/usr/local/google/home/blaikie/dev/scratch" "main.c"
+   .loc1 1 0   # main.c:1:0
+   .cfi_startproc
+# %bb.0:# %entry
+   pushq   %rbp
+   .cfi_def_cfa_offset 16
+   .cfi_offset %rbp, -16
+   movq%rsp, %rbp
+   .cfi_def_cfa_register %rbp
+   xorl%eax, %eax
+.Ltmp0:
+   .loc1 2 7 prologue_end  # main.c:2:7
+   movl$3, -4(%rbp)
+   .loc1 3 1   # main.c:3:1
+   popq%rbp
+   .cfi_def_cfa %rsp, 8
+   retq
+.Ltmp1:
+.Lfunc_end0:
+   .size   main, .Lfunc_end0-main
+   .cfi_endproc
+# -- End function
+   .section.debug_abbrev,"",@progbits
+   .byte   1   # Abbreviation Code
+   .byte   17  # DW_TAG_compile_unit
+   .byte   1   # DW_CHILDREN_yes
+   .byte   37  # DW_AT_producer
+   .byte   14  # DW_FORM_strp
+   .byte   19  # DW_AT_language
+   .byte  

[llvm-branch-commits] [lld] eaadb41 - [LLD][COFF] When using PCH.OBJ, ensure func_id records indices are remapped under /DEBUG:GHASH

2021-01-07 Thread Alexandre Ganea via llvm-branch-commits

Author: Alexandre Ganea
Date: 2021-01-07T17:27:13-05:00
New Revision: eaadb41db6233cf1c9e882d74a31c1f9d6e211ff

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

LOG: [LLD][COFF] When using PCH.OBJ, ensure func_id records indices are 
remapped under /DEBUG:GHASH

Before this patch, when using LLD with /DEBUG:GHASH and MSVC precomp.OBJ files, 
we had a bunch of:

lld-link: warning: S_[GL]PROC32ID record in blabla.obj refers to PDB item index 
0x206ED1 which is not a LF[M]FUNC_ID record

This was caused by LF_FUNC_ID and LF_MFUNC_ID which didn't have correct mapping 
to the corresponding TPI records. The root issue was that the indexMapStorage 
was improperly re-assembled in UsePrecompSource::remapTpiWithGHashes.

After this patch, /DEBUG and /DEBUG:GHASH produce exactly the same debug infos 
in the PDB.

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

Added: 
lld/test/COFF/Inputs/precomp-ghash-obj1.obj
lld/test/COFF/Inputs/precomp-ghash-obj2.obj
lld/test/COFF/Inputs/precomp-ghash-precomp.obj
lld/test/COFF/precomp-ghash.test

Modified: 
lld/COFF/DebugTypes.cpp

Removed: 




diff  --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index 0c8bfd8ae5b8..d3996eabca7d 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -532,7 +532,7 @@ Error UsePrecompSource::mergeInPrecompHeaderObj() {
  TypeIndex::FirstNonSimpleIndex);
   assert(precompDependency.getTypesCount() <= precompSrc->tpiMap.size());
   // Use the previously remapped index map from the precompiled headers.
-  indexMapStorage.append(precompSrc->tpiMap.begin(),
+  indexMapStorage.insert(indexMapStorage.begin(), precompSrc->tpiMap.begin(),
  precompSrc->tpiMap.begin() +
  precompDependency.getTypesCount());
 
@@ -842,6 +842,7 @@ void UsePrecompSource::loadGHashes() {
 }
 
 void UsePrecompSource::remapTpiWithGHashes(GHashState *g) {
+  fillMapFromGHashes(g, indexMapStorage);
   // This object was compiled with /Yu, so process the corresponding
   // precompiled headers object (/Yc) first. Some type indices in the current
   // object are referencing data in the precompiled headers object, so we need
@@ -851,7 +852,6 @@ void UsePrecompSource::remapTpiWithGHashes(GHashState *g) {
 return;
   }
 
-  fillMapFromGHashes(g, indexMapStorage);
   tpiMap = indexMapStorage;
   ipiMap = indexMapStorage;
   mergeUniqueTypeRecords(file->debugTypes,

diff  --git a/lld/test/COFF/Inputs/precomp-ghash-obj1.obj 
b/lld/test/COFF/Inputs/precomp-ghash-obj1.obj
new file mode 100644
index ..078593e05f66
Binary files /dev/null and b/lld/test/COFF/Inputs/precomp-ghash-obj1.obj 
diff er

diff  --git a/lld/test/COFF/Inputs/precomp-ghash-obj2.obj 
b/lld/test/COFF/Inputs/precomp-ghash-obj2.obj
new file mode 100644
index ..f9cff3b9dfad
Binary files /dev/null and b/lld/test/COFF/Inputs/precomp-ghash-obj2.obj 
diff er

diff  --git a/lld/test/COFF/Inputs/precomp-ghash-precomp.obj 
b/lld/test/COFF/Inputs/precomp-ghash-precomp.obj
new file mode 100644
index ..b28ff77f19aa
Binary files /dev/null and b/lld/test/COFF/Inputs/precomp-ghash-precomp.obj 
diff er

diff  --git a/lld/test/COFF/precomp-ghash.test 
b/lld/test/COFF/precomp-ghash.test
new file mode 100644
index ..e9d1984ac40d
--- /dev/null
+++ b/lld/test/COFF/precomp-ghash.test
@@ -0,0 +1,53 @@
+
+# This test ensures that under /DEBUG:GHASH, IPI records LF_FUNC_ID/LF_MFUNC_ID
+# have properly remapped indices to corresponding TPI records.
+
+RUN: lld-link %p/Inputs/precomp-ghash-precomp.obj \
+RUN:%p/Inputs/precomp-ghash-obj1.obj\
+RUN:%p/Inputs/precomp-ghash-obj2.obj /debug:ghash /out:%t.exe /pdb:%t.pdb
+RUN: llvm-pdbutil dump -types -ids %t.pdb | FileCheck %s
+
+; These object files were generated via the following inputs and commands:
+; --
+; // precomp-ghash-obj.h
+; namespace NS {
+;   struct Foo {
+; explicit Foo(int x) : X(x) {}
+; int X;
+;   };
+;
+;   int func(const Foo );
+; }
+; --
+; // precomp-ghash-obj1.cpp
+; #include "precomp-ghash-obj.h"
+;
+; int main(int argc, char **argv) {
+;   NS::Foo f(argc);
+;   return NS::func(f);
+; }
+; --
+; // precomp-ghash-obj2.cpp
+; #include "precomp-ghash-obj.h"
+;
+; int NS::func(const Foo ) {
+;   return 2 * f.X;
+; }
+; --
+; // precomp-ghash-precomp.cpp
+; #include "precomp-ghash-obj.h"
+; --
+; $ cl /c /Z7 /GS- precomp-ghash-precomp.cpp /Ycprecomp-ghash-obj.h
+; $ cl /c /Z7 /GS- precomp-ghash-obj1.cpp /Yuprecomp-ghash-obj.h
+; $ cl /c /Z7 /GS- precomp-ghash-obj2.cpp 

[llvm-branch-commits] [llvm] 973c35d - [TableGen] Make CodeGenDAGPatterns::getSDNodeNamed take a StringRef instead of const std::string &.

2021-01-07 Thread Craig Topper via llvm-branch-commits

Author: Craig Topper
Date: 2021-01-07T14:20:16-08:00
New Revision: 973c35d3384ace023000eb2f86a2543ab9eb

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

LOG: [TableGen] Make CodeGenDAGPatterns::getSDNodeNamed take a StringRef 
instead of const std::string &.

All callers use a string literal and the getDef method the string
is passed to already takes a StringRef.

Added: 


Modified: 
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.h

Removed: 




diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp 
b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 6b6e1ec7b04d..2f8abe6dffed 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3088,7 +3088,7 @@ CodeGenDAGPatterns::CodeGenDAGPatterns(RecordKeeper ,
   VerifyInstructionFlags();
 }
 
-Record *CodeGenDAGPatterns::getSDNodeNamed(const std::string ) const {
+Record *CodeGenDAGPatterns::getSDNodeNamed(StringRef Name) const {
   Record *N = Records.getDef(Name);
   if (!N || !N->isSubClassOf("SDNode"))
 PrintFatalError("Error getting SDNode '" + Name + "'!");

diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h 
b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index c0c45a74de66..bc939fe9acc1 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -1176,7 +1176,7 @@ class CodeGenDAGPatterns {
   const CodeGenTarget () const { return Target; }
   const TypeSetByHwMode () const { return LegalVTS; }
 
-  Record *getSDNodeNamed(const std::string ) const;
+  Record *getSDNodeNamed(StringRef Name) const;
 
   const SDNodeInfo (Record *R) const {
 auto F = SDNodes.find(R);



___
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] 3503c85 - Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124

2021-01-07 Thread David Blaikie via llvm-branch-commits

Author: David Blaikie
Date: 2021-01-07T14:18:19-08:00
New Revision: 3503c856819efc01ce210fa56e597ddfb7a4c1a1

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

LOG: Fixup Asserts+!AbiBreakingChecks fallout from db33f85c7124

Added: 


Modified: 
llvm/include/llvm/IR/ValueHandle.h
llvm/unittests/IR/ValueHandleTest.cpp
llvm/unittests/Support/DataExtractorTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/IR/ValueHandle.h 
b/llvm/include/llvm/IR/ValueHandle.h
index 1324053800c7..a88b28ac7e62 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -486,7 +486,9 @@ class PoisoningVH
 #endif
 
   ValueTy *getValPtr() const {
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
 assert(!Poisoned && "Accessed a poisoned value handle!");
+#endif
 return static_cast(getRawValPtr());
   }
   void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }

diff  --git a/llvm/unittests/IR/ValueHandleTest.cpp 
b/llvm/unittests/IR/ValueHandleTest.cpp
index 1aed8e1a1ee7..8eb6b5f89a40 100644
--- a/llvm/unittests/IR/ValueHandleTest.cpp
+++ b/llvm/unittests/IR/ValueHandleTest.cpp
@@ -186,7 +186,7 @@ TEST_F(ValueHandle, AssertingVH_ReducesToPointer) {
   EXPECT_EQ(sizeof(CastInst *), sizeof(AssertingVH));
 }
 
-#else  // !NDEBUG
+#elif LLVM_ENABLE_ABI_BREAKING_CHECKS // && !NDEBUG
 
 #ifdef GTEST_HAS_DEATH_TEST
 
@@ -530,6 +530,7 @@ TEST_F(ValueHandle, TrackingVH_Tracks) {
 }
 
 #ifdef GTEST_HAS_DEATH_TEST
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
 
 TEST_F(ValueHandle, PoisoningVH_Asserts) {
   PoisoningVH VH(BitcastV.get());
@@ -549,6 +550,8 @@ TEST_F(ValueHandle, PoisoningVH_Asserts) {
   // Don't clear anything out here as destroying the handles should be fine.
 }
 
+#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
+
 TEST_F(ValueHandle, TrackingVH_Asserts) {
   {
 TrackingVH VH(BitcastV.get());

diff  --git a/llvm/unittests/Support/DataExtractorTest.cpp 
b/llvm/unittests/Support/DataExtractorTest.cpp
index 278e5885916c..41c40648b85e 100644
--- a/llvm/unittests/Support/DataExtractorTest.cpp
+++ b/llvm/unittests/Support/DataExtractorTest.cpp
@@ -214,7 +214,8 @@ TEST(DataExtractorTest, Cursor_chaining) {
   EXPECT_THAT_ERROR(C.takeError(), Succeeded());
 }
 
-#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG)
+#if defined(GTEST_HAS_DEATH_TEST) && defined(_DEBUG) &&
\
+LLVM_ENABLE_ABI_BREAKING_CHECKS
 TEST(DataExtractorDeathTest, Cursor) {
   DataExtractor DE(StringRef("AB"), false, 8);
 



___
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] 1a2eaeb - [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no clones

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T14:06:35-08:00
New Revision: 1a2eaebc09c6a200f93b8beb37130c8b8aab3934

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

LOG: [CoroSplit][NewPM] Don't call LazyCallGraph functions to split when no 
clones

Apparently there can be no clones, as happens in
coro-retcon-unreachable.ll.

The alternative is to allow no split functions in
addSplitRefRecursiveFunctions(), but it seems better to have the caller
make sure it's not accidentally splitting no functions out.

Reviewed By: rnk

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

Added: 


Modified: 
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp 
b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 6fd894d4bcfa..e0bee13d83b4 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -1748,24 +1748,26 @@ static void updateCallGraphAfterCoroutineSplit(
 End->eraseFromParent();
   }
 
-  switch (Shape.ABI) {
-  case coro::ABI::Switch:
-// Each clone in the Switch lowering is independent of the other clones. 
Let
-// the LazyCallGraph know about each one separately.
-for (Function *Clone : Clones)
-  CG.addSplitFunction(N.getFunction(), *Clone);
-break;
-  case coro::ABI::Async:
-  case coro::ABI::Retcon:
-  case coro::ABI::RetconOnce:
-// Each clone in the Async/Retcon lowering references of the other clones.
-// Let the LazyCallGraph know about all of them at once.
-CG.addSplitRefRecursiveFunctions(N.getFunction(), Clones);
-break;
-  }
+  if (!Clones.empty()) {
+switch (Shape.ABI) {
+case coro::ABI::Switch:
+  // Each clone in the Switch lowering is independent of the other clones.
+  // Let the LazyCallGraph know about each one separately.
+  for (Function *Clone : Clones)
+CG.addSplitFunction(N.getFunction(), *Clone);
+  break;
+case coro::ABI::Async:
+case coro::ABI::Retcon:
+case coro::ABI::RetconOnce:
+  // Each clone in the Async/Retcon lowering references of the other 
clones.
+  // Let the LazyCallGraph know about all of them at once.
+  CG.addSplitRefRecursiveFunctions(N.getFunction(), Clones);
+  break;
+}
 
-  // Let the CGSCC infra handle the changes to the original function.
-  updateCGAndAnalysisManagerForCGSCCPass(CG, C, N, AM, UR, FAM);
+// Let the CGSCC infra handle the changes to the original function.
+updateCGAndAnalysisManagerForCGSCCPass(CG, C, N, AM, UR, FAM);
+  }
 
   // Do some cleanup and let the CGSCC infra see if we've cleaned up any edges
   // to the split functions.

diff  --git a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll 
b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
index 27ee2fd540a4..4a1c44061b48 100644
--- a/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
+++ b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -coro-early -coro-split -S | FileCheck %s
+; RUN: opt < %s -passes='function(coro-early),cgscc(coro-split)' -S | 
FileCheck %s
 target datalayout = "E-p:64:64"
 
 %swift.type = type { i64 }



___
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] d002cd4 - [test] Move coro-retcon-unreachable.ll into llvm/test

2021-01-07 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2021-01-07T14:06:01-08:00
New Revision: d002cd4e0f10f20c4f8b419ffa23d782636e46d8

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

LOG: [test] Move coro-retcon-unreachable.ll into llvm/test

Reviewed By: rjmccall

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

Added: 
llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll

Modified: 


Removed: 
clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll



diff  --git a/clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll 
b/llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll
similarity index 100%
rename from clang/test/CodeGenCoroutines/coro-retcon-unreachable.ll
rename to llvm/test/Transforms/Coroutines/coro-retcon-unreachable.ll



___
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] [libcxxabi] 85f86e8 - [libc++abi] Simplify __gxx_personality_v0

2021-01-07 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2021-01-07T14:05:46-08:00
New Revision: 85f86e8a3cf9e05347691fdde30e9e98a6657d92

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

LOG: [libc++abi] Simplify __gxx_personality_v0

In three cases we call `scan_eh_tab` to parse LSDA:

* `actions & _UA_SEARCH_PHASE`
* `actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && 
!native_exception`
* `actions & _UA_CLEANUP_PHASE && !(actions & _UA_HANDLER_FRAME)`

Check
`actions & _UA_CLEANUP_PHASE && actions & _UA_HANDLER_FRAME && 
native_exception` first,
then we can move three `scan_eh_tab` into one place.

Another simplification is that we can check whether the result of `scan_eh_tab`
is `_UA_CONTINUE_UNWIND` or `_UA_FATAL_PHASE1_ERROR` first. Then many of the
original checks will be dead and can thus be deleted.

Reviewed By: #libc_abi, ldionne

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

Added: 


Modified: 
libcxxabi/src/cxa_personality.cpp

Removed: 




diff  --git a/libcxxabi/src/cxa_personality.cpp 
b/libcxxabi/src/cxa_personality.cpp
index f27625776111..45639ec03bcd 100644
--- a/libcxxabi/src/cxa_personality.cpp
+++ b/libcxxabi/src/cxa_personality.cpp
@@ -962,78 +962,51 @@ __gxx_personality_v0
 bool native_exception = (exceptionClass & get_vendor_and_language) ==
 (kOurExceptionClass & get_vendor_and_language);
 scan_results results;
+// Process a catch handler for a native exception first.
+if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) &&
+native_exception) {
+// Reload the results from the phase 1 cache.
+__cxa_exception* exception_header =
+(__cxa_exception*)(unwind_exception + 1) - 1;
+results.ttypeIndex = exception_header->handlerSwitchValue;
+results.actionRecord = exception_header->actionRecord;
+results.languageSpecificData = exception_header->languageSpecificData;
+results.landingPad =
+reinterpret_cast(exception_header->catchTemp);
+results.adjustedPtr = exception_header->adjustedPtr;
+
+// Jump to the handler.
+set_registers(unwind_exception, context, results);
+return _URC_INSTALL_CONTEXT;
+}
+
+// In other cases we need to scan LSDA.
+scan_eh_tab(results, actions, native_exception, unwind_exception, context);
+if (results.reason == _URC_CONTINUE_UNWIND ||
+results.reason == _URC_FATAL_PHASE1_ERROR)
+return results.reason;
+
 if (actions & _UA_SEARCH_PHASE)
 {
 // Phase 1 search:  All we're looking for in phase 1 is a handler that
 //   halts unwinding
-scan_eh_tab(results, actions, native_exception, unwind_exception, 
context);
-if (results.reason == _URC_HANDLER_FOUND)
-{
-// Found one.  Can we cache the results somewhere to optimize 
phase 2?
-if (native_exception)
-{
-__cxa_exception* exception_header = 
(__cxa_exception*)(unwind_exception+1) - 1;
-exception_header->handlerSwitchValue = 
static_cast(results.ttypeIndex);
-exception_header->actionRecord = results.actionRecord;
-exception_header->languageSpecificData = 
results.languageSpecificData;
-exception_header->catchTemp = 
reinterpret_cast(results.landingPad);
-exception_header->adjustedPtr = results.adjustedPtr;
-}
-return _URC_HANDLER_FOUND;
+assert(results.reason == _URC_HANDLER_FOUND);
+if (native_exception) {
+// For a native exception, cache the LSDA result.
+__cxa_exception* exc = (__cxa_exception*)(unwind_exception + 1) - 
1;
+exc->handlerSwitchValue = static_cast(results.ttypeIndex);
+exc->actionRecord = results.actionRecord;
+exc->languageSpecificData = results.languageSpecificData;
+exc->catchTemp = reinterpret_cast(results.landingPad);
+exc->adjustedPtr = results.adjustedPtr;
 }
-// Did not find a catching-handler.  Return the results of the scan
-//(normally _URC_CONTINUE_UNWIND, but could have been 
_URC_FATAL_PHASE1_ERROR
-// if we were called improperly).
-return results.reason;
+return _URC_HANDLER_FOUND;
 }
-if (actions & _UA_CLEANUP_PHASE)
-{
-// Phase 2 search:
-//  Did we find a catching handler in phase 1?
-if (actions & _UA_HANDLER_FRAME)
-{
-// Yes, phase 1 said we have a catching handler here.
-// Did we cache the results of the scan?
-if (native_exception)
-{
-// Yes, reload the results from the cache.
-

[llvm-branch-commits] [clang] 63b42a0 - [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

2021-01-07 Thread Shilei Tian via llvm-branch-commits

Author: Jeroen Dobbelaere
Date: 2021-01-07T16:39:17-05:00
New Revision: 63b42a0514567d24df617e4587e80e4564ebf120

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

LOG: [NFC] clang/test/openMP/target_codegen.cpp should not depend on ssa name

This makes the test more robust to other changes.

Reviewed By: tianshilei1992

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

Added: 


Modified: 
clang/test/OpenMP/target_codegen.cpp

Removed: 




diff  --git a/clang/test/OpenMP/target_codegen.cpp 
b/clang/test/OpenMP/target_codegen.cpp
index c504ff6b7ac6..7dafa6ba13d4 100644
--- a/clang/test/OpenMP/target_codegen.cpp
+++ b/clang/test/OpenMP/target_codegen.cpp
@@ -397,7 +397,7 @@ int foo(int n) {
 // CHECK-DAG: [[RET:%.+]] = call i32 
@__tgt_target_nowait_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE:%.+]], i8* 
@{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i64* [[SIZE:%.+]], 
i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), 
i8** null, i8** null)
 // CHECK-DAG: [[DEVICE]] = sext i32 [[DEV:%.+]] to i64
 // CHECK-DAG: [[DEV]] = load i32, i32* [[DEVADDR:%.+]], align
-// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
%12, i32 0, i32 2
+// CHECK-DAG: [[DEVADDR]] = getelementptr inbounds [[ANON_T]], [[ANON_T]]* 
{{%.+}}, i32 0, i32 2
 // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[BPRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* 
[[PRADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0
 // CHECK-DAG: [[SIZE]] = getelementptr inbounds [2 x i64], [2 x i64]* 
[[SIZEADDR:%.+]], i[[SZ]] 0, i[[SZ]] 0



___
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] 1f9b6ef - GlobalISel: Add combine for G_UREM by power of 2

2021-01-07 Thread Matt Arsenault via llvm-branch-commits

Author: Matt Arsenault
Date: 2021-01-07T16:36:35-05:00
New Revision: 1f9b6ef91ffd8ea487aa083d146c7568e7243457

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

LOG: GlobalISel: Add combine for G_UREM by power of 2

Really I want this in the legalizer, but this is a start.

Added: 
llvm/test/CodeGen/AMDGPU/GlobalISel/combine-urem-pow-2.mir

Modified: 
llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
llvm/include/llvm/Target/GlobalISel/Combine.td
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i32.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/urem.i64.ll

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h 
b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
index 432587ea46c4..0d240e90820f 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h
@@ -400,6 +400,9 @@ class CombinerHelper {
   /// Check if operand \p OpIdx is undef.
   bool matchOperandIsUndef(MachineInstr , unsigned OpIdx);
 
+  /// Check if operand \p OpIdx is known to be a power of 2.
+  bool matchOperandIsKnownToBeAPowerOfTwo(MachineInstr , unsigned OpIdx);
+
   /// Erase \p MI
   bool eraseInst(MachineInstr );
 
@@ -459,6 +462,9 @@ class CombinerHelper {
   bool matchPtrAddZero(MachineInstr );
   bool applyPtrAddZero(MachineInstr );
 
+  /// Combine G_UREM x, (known power of 2) to an add and bitmasking.
+  bool applySimplifyURemByPow2(MachineInstr );
+
   bool matchCombineInsertVecElts(MachineInstr ,
  SmallVectorImpl );
 

diff  --git a/llvm/include/llvm/Target/GlobalISel/Combine.td 
b/llvm/include/llvm/Target/GlobalISel/Combine.td
index 32aec75af1fa..e352e499d47c 100644
--- a/llvm/include/llvm/Target/GlobalISel/Combine.td
+++ b/llvm/include/llvm/Target/GlobalISel/Combine.td
@@ -296,6 +296,13 @@ def binop_left_to_zero: GICombineRule<
   (apply [{ return Helper.replaceSingleDefInstWithOperand(*${root}, 1); }])
 >;
 
+def urem_pow2_to_mask : GICombineRule<
+  (defs root:$root),
+  (match (wip_match_opcode G_UREM):$root,
+[{ return Helper.matchOperandIsKnownToBeAPowerOfTwo(*${root}, 2); }]),
+  (apply [{ return Helper.applySimplifyURemByPow2(*${root}); }])
+>;
+
 // Fold (x op 0) - > 0
 def binop_right_to_zero: GICombineRule<
   (defs root:$root),
@@ -560,7 +567,7 @@ def identity_combines : GICombineGroup<[select_same_val, 
right_identity_zero,
 def const_combines : GICombineGroup<[constant_fp_op, const_ptradd_to_i2p]>;
 
 def known_bits_simplifications : GICombineGroup<[
-  redundant_and, redundant_sext_inreg, redundant_or]>;
+  redundant_and, redundant_sext_inreg, redundant_or, urem_pow2_to_mask]>;
 
 def width_reduction_combines : GICombineGroup<[reduce_shl_of_extend]>;
 

diff  --git a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp 
b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
index abc23da3d418..bbcf32a73fe0 100644
--- a/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
@@ -2580,6 +2580,12 @@ bool CombinerHelper::matchOperandIsUndef(MachineInstr 
, unsigned OpIdx) {
  getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, MO.getReg(), MRI);
 }
 
+bool CombinerHelper::matchOperandIsKnownToBeAPowerOfTwo(MachineInstr ,
+unsigned OpIdx) {
+  MachineOperand  = MI.getOperand(OpIdx);
+  return isKnownToBeAPowerOfTwo(MO.getReg(), MRI, KB);
+}
+
 bool CombinerHelper::replaceInstWithFConstant(MachineInstr , double C) {
   assert(MI.getNumDefs() == 1 && "Expected only one def?");
   Builder.setInstr(MI);
@@ -3130,6 +3136,22 @@ bool CombinerHelper::applyPtrAddZero(MachineInstr ) {
   return true;
 }
 
+/// The second source operand is known to be a power of 2.
+bool CombinerHelper::applySimplifyURemByPow2(MachineInstr ) {
+  Register DstReg = MI.getOperand(0).getReg();
+  Register Src0 = MI.getOperand(1).getReg();
+  Register Pow2Src1 = MI.getOperand(2).getReg();
+  LLT Ty = MRI.getType(DstReg);
+  Builder.setInstrAndDebugLoc(MI);
+
+  // Fold (urem x, pow2) -> (and x, pow2-1)
+  auto NegOne = Builder.buildConstant(Ty, -1);
+  auto Add = Builder.buildAdd(Ty, Pow2Src1, NegOne);
+  Builder.buildAnd(DstReg, Src0, Add);
+  MI.eraseFromParent();
+  return true;
+}
+
 bool CombinerHelper::tryCombine(MachineInstr ) {
   if (tryCombineCopy(MI))
 return true;

diff  --git a/llvm/test/CodeGen/AMDGPU/GlobalISel/combine-urem-pow-2.mir 
b/llvm/test/CodeGen/AMDGPU/GlobalISel/combine-urem-pow-2.mir
new file mode 100644
index ..f92e32dab08f
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/GlobalISel/combine-urem-pow-2.mir
@@ -0,0 +1,156 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: 

[llvm-branch-commits] [debuginfo-tests] 9e1aaa9 - Fix check-gdb-mlir-support build after MLIR API changed to take Context as first argument

2021-01-07 Thread Mehdi Amini via llvm-branch-commits

Author: Mehdi Amini
Date: 2021-01-07T21:30:39Z
New Revision: 9e1aaa9943b814c22ae03f4abb3171dac8062801

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

LOG: Fix check-gdb-mlir-support build after MLIR API changed to take Context as 
first argument

Added: 


Modified: 
debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp

Removed: 




diff  --git a/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp 
b/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
index a65f62404de8..629ef1668c8f 100644
--- a/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
+++ b/debuginfo-tests/llvm-prettyprinters/gdb/mlir-support.cpp
@@ -15,13 +15,13 @@ mlir::Value Value({reinterpret_cast(0x8),
 mlir::Type Type(nullptr);
 mlir::Type IndexType = mlir::IndexType::get();
 mlir::Type IntegerType =
-mlir::IntegerType::get(3, mlir::IntegerType::Unsigned, );
+mlir::IntegerType::get(, 3, mlir::IntegerType::Unsigned);
 mlir::Type FloatType = mlir::Float32Type::get();
 mlir::Type MemRefType = mlir::MemRefType::get({4, 5}, FloatType);
 mlir::Type UnrankedMemRefType = mlir::UnrankedMemRefType::get(IntegerType, 6);
 mlir::Type VectorType = mlir::VectorType::get({1, 2}, FloatType);
 mlir::Type TupleType =
-mlir::TupleType::get(mlir::TypeRange({IndexType, FloatType}), );
+mlir::TupleType::get(, mlir::TypeRange({IndexType, FloatType}));
 
 auto UnknownLoc = mlir::UnknownLoc::get();
 auto FileLineColLoc = mlir::FileLineColLoc::get("file", 7, 8, );



___
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] [debuginfo-tests] 476db17 - Fix include path for check-gdb-mlir-support to include the MLIR binary dir

2021-01-07 Thread Mehdi Amini via llvm-branch-commits

Author: Mehdi Amini
Date: 2021-01-07T21:29:09Z
New Revision: 476db17dcb64ef3ec6e247f4b1c673b57f61a367

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

LOG: Fix include path for check-gdb-mlir-support to include the MLIR binary dir

This fixes a build failure:

fatal error: 'mlir/IR/BuiltinTypes.h.inc' file not found

Added: 


Modified: 
debuginfo-tests/CMakeLists.txt

Removed: 




diff  --git a/debuginfo-tests/CMakeLists.txt b/debuginfo-tests/CMakeLists.txt
index 4b6af5212fc8..0abbe4604a79 100644
--- a/debuginfo-tests/CMakeLists.txt
+++ b/debuginfo-tests/CMakeLists.txt
@@ -26,7 +26,9 @@ if ("mlir" IN_LIST LLVM_ENABLE_PROJECTS)
   add_llvm_executable(check-gdb-mlir-support
 llvm-prettyprinters/gdb/mlir-support.cpp
   )
-  target_include_directories(check-gdb-mlir-support PRIVATE 
${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include)
+  target_include_directories(check-gdb-mlir-support PRIVATE
+   ${LLVM_EXTERNAL_MLIR_SOURCE_DIR}/include
+   ${LLVM_BINARY_DIR}/tools/mlir/include)
   target_link_libraries(check-gdb-mlir-support PRIVATE MLIRIR)
   list(APPEND DEBUGINFO_TEST_DEPS check-gdb-mlir-support)
   set(MLIR_SOURCE_DIR  ${LLVM_EXTERNAL_MLIR_SOURCE_DIR})



___
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] 0b0f2e6 - [OpenMP][FIX] Avoid string literal comparison, use `StringRef::equal`

2021-01-07 Thread Johannes Doerfert via llvm-branch-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:53:20-06:00
New Revision: 0b0f2e6ee0c3e52398a0d0c4a5131d4a23d8b1ee

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

LOG: [OpenMP][FIX] Avoid string literal comparison, use `StringRef::equal`

Added: 


Modified: 
llvm/lib/Frontend/OpenMP/OMPContext.cpp

Removed: 




diff  --git a/llvm/lib/Frontend/OpenMP/OMPContext.cpp 
b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
index 39f047015d19..11d8da097c6c 100644
--- a/llvm/lib/Frontend/OpenMP/OMPContext.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPContext.cpp
@@ -63,7 +63,8 @@ OMPContext::OMPContext(bool IsDeviceCompilation, Triple 
TargetTriple) {
   if (TraitSelector::TraitSelectorEnum == TraitSelector::device_arch) {
\
 if (TargetTriple.getArch() == TargetTriple.getArchTypeForLLVMName(Str))
\
   ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
-if (Str == "x86_64" && TargetTriple.getArch() == Triple::x86_64)   
\
+if (StringRef(Str) == StringRef("x86_64") &&   
\
+TargetTriple.getArch() == Triple::x86_64)  
\
   ActiveTraits.set(unsigned(TraitProperty::Enum)); 
\
   }
 #include "llvm/Frontend/OpenMP/OMPKinds.def"



___
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] [mlir] 70b841a - [mlir] Adds argument attributes for using LLVM's sret and byval attributes

2021-01-07 Thread Eric Schweitz via llvm-branch-commits

Author: Eric Schweitz
Date: 2021-01-07T12:52:14-08:00
New Revision: 70b841ac317765c5c504334f7a22ac085f14ac2d

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

LOG: [mlir] Adds argument attributes for using LLVM's sret and byval attributes
to the conversion of LLVM IR dialect. These attributes are used in FIR to
support the lowering of Fortran using target-specific calling conventions.

Add roundtrip tests.

Add changes per review comments/concerns.

Reviewed By: ftynse

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

Added: 


Modified: 
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Dialect/LLVMIR/func.mlir
mlir/test/Target/llvmir-invalid.mlir

Removed: 




diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 7700867bb461..492025ba37b4 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1102,6 +1102,22 @@ LogicalResult 
ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
   llvm::AttrBuilder().addAlignmentAttr(llvm::Align(attr.getInt(;
 }
 
+if (auto attr = func.getArgAttrOfType(argIdx, "llvm.sret")) {
+  auto argTy = mlirArg.getType();
+  if (!argTy.isa())
+return func.emitError(
+"llvm.sret attribute attached to LLVM non-pointer argument");
+  llvmArg.addAttr(llvm::Attribute::AttrKind::StructRet);
+}
+
+if (auto attr = func.getArgAttrOfType(argIdx, "llvm.byval")) {
+  auto argTy = mlirArg.getType();
+  if (!argTy.isa())
+return func.emitError(
+"llvm.byval attribute attached to LLVM non-pointer argument");
+  llvmArg.addAttr(llvm::Attribute::AttrKind::ByVal);
+}
+
 valueMapping[mlirArg] = 
 argIdx++;
   }

diff  --git a/mlir/test/Dialect/LLVMIR/func.mlir 
b/mlir/test/Dialect/LLVMIR/func.mlir
index 72e117d57a91..d9d7e17a9b50 100644
--- a/mlir/test/Dialect/LLVMIR/func.mlir
+++ b/mlir/test/Dialect/LLVMIR/func.mlir
@@ -87,6 +87,16 @@ module {
 llvm.return
   }
 
+  // CHECK: llvm.func @byvalattr(%{{.*}}: !llvm.ptr {llvm.byval})
+  llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval}) {
+llvm.return
+  }
+
+  // CHECK: llvm.func @sretattr(%{{.*}}: !llvm.ptr {llvm.sret})
+  llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret}) {
+llvm.return
+  }
+
   // CHECK: llvm.func @variadic(...)
   llvm.func @variadic(...)
 

diff  --git a/mlir/test/Target/llvmir-invalid.mlir 
b/mlir/test/Target/llvmir-invalid.mlir
index 14117594e2f8..fcd98ef4b143 100644
--- a/mlir/test/Target/llvmir-invalid.mlir
+++ b/mlir/test/Target/llvmir-invalid.mlir
@@ -14,6 +14,19 @@ llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.noalias 
= true}) -> !llvm.f
 
 // -
 
+// expected-error @+1 {{llvm.sret attribute attached to LLVM non-pointer 
argument}}
+llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.sret}) -> !llvm.float {
+  llvm.return %arg0 : !llvm.float
+}
+// -
+
+// expected-error @+1 {{llvm.byval attribute attached to LLVM non-pointer 
argument}}
+llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.byval}) -> !llvm.float {
+  llvm.return %arg0 : !llvm.float
+}
+
+// -
+
 // expected-error @+1 {{llvm.align attribute attached to LLVM non-pointer 
argument}}
 llvm.func @invalid_align(%arg0 : !llvm.float {llvm.align = 4}) -> !llvm.float {
   llvm.return %arg0 : !llvm.float



___
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] ce7f30b - [llvm-pdbutil] Don't crash when printing unknown CodeView type records

2021-01-07 Thread Alexandre Ganea via llvm-branch-commits

Author: Alexandre Ganea
Date: 2021-01-07T15:44:55-05:00
New Revision: ce7f30b2a874386a0ce089c98327acb65e87b04d

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

LOG: [llvm-pdbutil] Don't crash when printing unknown CodeView type records

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

Added: 
llvm/test/tools/llvm-pdbutil/Inputs/unknown-record.obj
llvm/test/tools/llvm-pdbutil/unknown-records.test

Modified: 
llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
llvm/tools/llvm-pdbutil/FormatUtil.cpp
llvm/tools/llvm-pdbutil/FormatUtil.h

Removed: 




diff  --git a/llvm/test/tools/llvm-pdbutil/Inputs/unknown-record.obj 
b/llvm/test/tools/llvm-pdbutil/Inputs/unknown-record.obj
new file mode 100644
index ..0be00ffdd922
Binary files /dev/null and 
b/llvm/test/tools/llvm-pdbutil/Inputs/unknown-record.obj 
diff er

diff  --git a/llvm/test/tools/llvm-pdbutil/unknown-records.test 
b/llvm/test/tools/llvm-pdbutil/unknown-records.test
new file mode 100644
index ..9773b85a0cd7
--- /dev/null
+++ b/llvm/test/tools/llvm-pdbutil/unknown-records.test
@@ -0,0 +1,3 @@
+; REQUIRES: diasdk
+; RUN: llvm-pdbutil dump -all %p/Inputs/unknown-record.obj | FileCheck %s
+; CHECK: UNKNOWN RECORD (0x1609)

diff  --git a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp 
b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
index aa185e8a2f22..3d8a86f34922 100644
--- a/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
+++ b/llvm/tools/llvm-pdbutil/DumpOutputStyle.cpp
@@ -738,21 +738,17 @@ namespace {
 constexpr uint32_t kNoneUdtKind = 0;
 constexpr uint32_t kSimpleUdtKind = 1;
 constexpr uint32_t kUnknownUdtKind = 2;
-const StringRef NoneLabel("");
-const StringRef SimpleLabel("");
-const StringRef UnknownLabel("");
-
 } // namespace
 
-static StringRef getUdtStatLabel(uint32_t Kind) {
+static std::string getUdtStatLabel(uint32_t Kind) {
   if (Kind == kNoneUdtKind)
-return NoneLabel;
+return "";
 
   if (Kind == kSimpleUdtKind)
-return SimpleLabel;
+return "";
 
   if (Kind == kUnknownUdtKind)
-return UnknownLabel;
+return "";
 
   return formatTypeLeafKind(static_cast(Kind));
 }
@@ -760,7 +756,7 @@ static StringRef getUdtStatLabel(uint32_t Kind) {
 static uint32_t getLongestTypeLeafName(const StatCollection ) {
   size_t L = 0;
   for (const auto  : Stats.Individual) {
-StringRef Label = getUdtStatLabel(Stat.first);
+std::string Label = getUdtStatLabel(Stat.first);
 L = std::max(L, Label.size());
   }
   return static_cast(L);
@@ -869,7 +865,7 @@ Error DumpOutputStyle::dumpUdtStats() {
 
   P.formatLine("{0}", fmt_repeat('-', TableWidth));
   for (const auto  : UdtTargetStats.getStatsSortedBySize()) {
-StringRef Label = getUdtStatLabel(Stat.first);
+std::string Label = getUdtStatLabel(Stat.first);
 P.formatLine("{0} | {1:N}  {2:N}",
  fmt_align(Label, AlignStyle::Right, FieldWidth),
  fmt_align(Stat.second.Count, AlignStyle::Right, CD),

diff  --git a/llvm/tools/llvm-pdbutil/FormatUtil.cpp 
b/llvm/tools/llvm-pdbutil/FormatUtil.cpp
index c9ef19609496..b4837398f1d0 100644
--- a/llvm/tools/llvm-pdbutil/FormatUtil.cpp
+++ b/llvm/tools/llvm-pdbutil/FormatUtil.cpp
@@ -156,16 +156,17 @@ std::string llvm::pdb::formatSymbolKind(SymbolKind K) {
   return formatUnknownEnum(K);
 }
 
-StringRef llvm::pdb::formatTypeLeafKind(TypeLeafKind K) {
+std::string llvm::pdb::formatTypeLeafKind(TypeLeafKind K) {
   switch (K) {
 #define TYPE_RECORD(EnumName, value, name) 
\
   case EnumName:   
\
 return #EnumName;
 #include "llvm/DebugInfo/CodeView/CodeViewTypes.def"
   default:
-llvm_unreachable("Unknown type leaf kind!");
+return formatv("UNKNOWN RECORD ({0:X})",
+   static_cast>(K))
+.str();
   }
-  return "";
 }
 
 std::string llvm::pdb::formatSegmentOffset(uint16_t Segment, uint32_t Offset) {

diff  --git a/llvm/tools/llvm-pdbutil/FormatUtil.h 
b/llvm/tools/llvm-pdbutil/FormatUtil.h
index 133a0eb40e12..b99ccec215b5 100644
--- a/llvm/tools/llvm-pdbutil/FormatUtil.h
+++ b/llvm/tools/llvm-pdbutil/FormatUtil.h
@@ -66,7 +66,7 @@ std::string typesetStringList(uint32_t IndentLevel,
 std::string formatChunkKind(codeview::DebugSubsectionKind Kind,
 bool Friendly = true);
 std::string formatSymbolKind(codeview::SymbolKind K);
-StringRef formatTypeLeafKind(codeview::TypeLeafKind K);
+std::string formatTypeLeafKind(codeview::TypeLeafKind K);
 
 /// Returns the number of digits in the given integer.
 inline int NumDigits(uint64_t N) {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [clang] 6e71015 - [OpenMP][Docs] Mark finished features as done

2021-01-07 Thread Johannes Doerfert via llvm-branch-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:39:18-06:00
New Revision: 6e7101530dae78efd7b5cdffc1338790ed3e5705

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

LOG: [OpenMP][Docs] Mark finished features as done

Reviewed By: ABataev

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

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index afa357a4d873..f0d8e8741304 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -193,7 +193,7 @@ implementation.
 
+--+--+--+---+
 | device extension | implicitly map 'this' (this[:1])  
   | :good:`done` | D55982  
  |
 
+--+--+--+---+
-| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`worked on`|   
|
+| device extension | allow access to the reference count 
(omp_target_is_present)  | :part:`done` |   
|
 
+--+--+--+---+
 | device extension | requires directive
   | :part:`partial`  | 
  |
 
+--+--+--+---+
@@ -215,7 +215,7 @@ implementation.
 
+--+--+--+---+
 | device extension | support close modifier on map clause  
   | :good:`done` | D55719,D55892   
  |
 
+--+--+--+---+
-| device extension | teams construct on the host device
   | :part:`worked on`| Clang part is done, r371553.
  |
+| device extension | teams construct on the host device
   | :part:`done` | r371553 
  |
 
+--+--+--+---+
 | device extension | support non-contiguous array sections for 
target update  | :good:`done` | 
  |
 
+--+--+--+---+



___
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] 275f30d - [clang] Change builtin object size when subobject is invalid

2021-01-07 Thread George Burgess IV via llvm-branch-commits

Author: Jeffrey T Mott
Date: 2021-01-07T12:34:07-08:00
New Revision: 275f30df8ad6de75e1f29e4b33eaeb67686caf0d

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

LOG: [clang] Change builtin object size when subobject is invalid

Motivating example:

```
  struct { int v[10]; } t[10];

  __builtin_object_size(
  [0].v[11], // access past end of subobject
  1// request remaining bytes of closest surrounding
   // subobject
  );
```

In GCC, this returns 0. https://godbolt.org/z/7TeGs7

In current clang, however, this returns 356, the number of bytes
remaining in the whole variable, as if the `type` was 0 instead of 1.
https://godbolt.org/z/6Kffox

This patch checks for the specific case where we're requesting a
subobject's size (type 1) but the subobject is invalid.

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

Added: 


Modified: 
clang/lib/AST/ExprConstant.cpp
clang/test/CodeGen/object-size.c

Removed: 




diff  --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 56181bbe1166..b153e22259f7 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -11408,9 +11408,9 @@ static bool tryEvaluateBuiltinObjectSize(const Expr *E, 
unsigned Type,
   return false;
   }
 
-  // If we point to before the start of the object, there are no accessible
-  // bytes.
-  if (LVal.getLValueOffset().isNegative()) {
+  // If we point outside of the object, there are no accessible bytes.
+  if (LVal.getLValueOffset().isNegative() ||
+  ((Type & 1) && !LVal.Designator.isValidSubobject())) {
 Size = 0;
 return true;
   }

diff  --git a/clang/test/CodeGen/object-size.c 
b/clang/test/CodeGen/object-size.c
index ff54b11a0f04..dbf286138454 100644
--- a/clang/test/CodeGen/object-size.c
+++ b/clang/test/CodeGen/object-size.c
@@ -310,7 +310,7 @@ void test24() {
 void test25() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0x1000, 2);
@@ -321,7 +321,7 @@ void test25() {
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* {{.*}}, i1 true, i1 true, i1
   gi = OBJECT_SIZE_BUILTIN((void*)0 + 0x1000, 2);
@@ -337,7 +337,7 @@ void test26() {
 
   // CHECK: store i32 316
   gi = OBJECT_SIZE_BUILTIN([1].v[11], 0);
-  // CHECK: store i32 312
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([1].v[12], 1);
   // CHECK: store i32 308
   gi = OBJECT_SIZE_BUILTIN([1].v[13], 2);
@@ -433,7 +433,7 @@ void test29(struct DynStructVar *dv, struct DynStruct0 *d0,
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 0);
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 1);
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 true, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN(d0->snd, 2);
@@ -518,7 +518,7 @@ void test31() {
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
-  // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1
+  // CHECK: store i32 0
   gi = OBJECT_SIZE_BUILTIN([9].snd[0], 1);
 
   // CHECK: call i64 @llvm.objectsize.i64.p0i8(i8* %{{.*}}, i1 false, i1 true, 
i1



___
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] [openmp] 9ae171b - [OpenMP][Docs] Add remarks intro section

2021-01-07 Thread Johannes Doerfert via llvm-branch-commits

Author: Johannes Doerfert
Date: 2021-01-07T14:31:17-06:00
New Revision: 9ae171bcd38cdefa64c9dd5d763d16007eebcd0d

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

LOG: [OpenMP][Docs] Add remarks intro section

Reviewed By: jhuber6

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

Added: 


Modified: 
openmp/docs/remarks/OptimizationRemarks.rst

Removed: 




diff  --git a/openmp/docs/remarks/OptimizationRemarks.rst 
b/openmp/docs/remarks/OptimizationRemarks.rst
index 997a9a6d98c2..4c256fd99694 100644
--- a/openmp/docs/remarks/OptimizationRemarks.rst
+++ b/openmp/docs/remarks/OptimizationRemarks.rst
@@ -1,6 +1,31 @@
 OpenMP Optimization Remarks
 ===
 
+The :doc:`OpenMP-Aware optimization pass ` is able to
+generate compiler remarks for performed and missed optimisations. To emit them,
+pass ``-Rpass=openmp-opt``, ``-Rpass-analysis=openmp-opt``, and
+``-Rpass-missed=openmp-opt`` to the Clang invocation.  For more information and
+features of the remark system the clang documentation should be consulted:
+
++ `Clang options to emit optimization reports 
`_
++ `Clang diagnostic and remark flags 
`_
++ The `-foptimization-record-file flag
+  
`_
+  and the `-fsave-optimization-record flag
+  
`_
+
+
+.. _ompXXX:
+
+Some OpenMP remarks start with a "tag", like `[OMP100]`, which indicates that
+there is further information about them on this page. To directly jump to the
+respective entry, navigate to
+`https://openmp.llvm.org/docs/remarks/OptimizationRemarks.html#ompXXX 
`_ where 
`XXX` is
+the three digit code shown in the tag.
+
+
+
+
 
 .. _omp100:
 .. _omp_no_external_caller_in_target_region:



___
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] [openmp] abb174b - [OpenMP] Add example in Libomptarget Information docs

2021-01-07 Thread Joseph Huber via llvm-branch-commits

Author: Joseph Huber
Date: 2021-01-07T15:00:51-05:00
New Revision: abb174bbc100437556fd386d920a9939723e0647

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

LOG: [OpenMP] Add example in Libomptarget Information docs

Add an example to the OpenMP Documentation on the LIBOMPTARGET_INFO environment 
variable

Reviewed By: jdoerfert

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

Added: 


Modified: 
openmp/docs/design/Runtimes.rst

Removed: 




diff  --git a/openmp/docs/design/Runtimes.rst b/openmp/docs/design/Runtimes.rst
index c9f3a55c0067..1d52b6b8378c 100644
--- a/openmp/docs/design/Runtimes.rst
+++ b/openmp/docs/design/Runtimes.rst
@@ -98,6 +98,85 @@ Or, to enable every flag run with every bit set.
 
$ env LIBOMPTARGET_INFO=-1 ./your-application
 
+For example, given a small application implementing the ``ZAXPY`` BLAS routine,
+``Libomptarget`` can provide useful information about data mappings and thread
+usages.
+
+.. code-block:: c++
+
+#include 
+
+using complex = std::complex;
+
+void zaxpy(complex *X, complex *Y, complex D, std::size_t N) {
+#pragma omp target teams distribute parallel for
+  for (std::size_t i = 0; i < N; ++i)
+Y[i] = D * X[i] + Y[i];
+}
+
+int main() {
+  const std::size_t N = 1024;
+  complex X[N], Y[N], D;
+#pragma omp target data map(to:X[0 : N]) map(tofrom:Y[0 : N])
+  zaxpy(X, Y, D, N);
+}
+
+Compiling this code targeting ``nvptx64`` with all information enabled will
+provide the following output from the runtime library.
+
+.. code-block:: console
+
+$ clang++ -fopenmp -fopenmp-targets=nvptx64 -O3 -gline-tables-only 
zaxpy.cpp -o zaxpy
+$ env LIBOMPTARGET_INFO=-1 ./zaxpy
+
+.. code-block:: text
+
+Info: Device supports up to 65536 CUDA blocks and 1024 threads with a warp 
size of 32
+Info: Entering OpenMP data region at zaxpy.cpp:14:1 with 2 arguments:
+Info: to(X[0:N])[16384] 
+Info: tofrom(Y[0:N])[16384] 
+Info: OpenMP Host-Device pointer mappings after block at zaxpy.cpp:14:1:
+Info: Host Ptr   Target Ptr Size (B) RefCount Declaration
+Info: 0x7fff963f4000 0x7fd225004000 163841Y[0:N] at 
zaxpy.cpp:13:17
+Info: 0x7fff963f8000 0x7fd22500 163841X[0:N] at 
zaxpy.cpp:13:11
+Info: Entering OpenMP kernel at zaxpy.cpp:6:1 with 4 arguments:
+Info: firstprivate(N)[8] (implicit)
+Info: use_address(Y)[0] (implicit)
+Info: tofrom(D)[16] (implicit)
+Info: use_address(X)[0] (implicit)
+Info: Mapping exists (implicit) with HstPtrBegin=0x7ffe37d8be80, 
+  TgtPtrBegin=0x7f90ff004000, Size=0, updated RefCount=2, Name=Y
+Info: Mapping exists (implicit) with HstPtrBegin=0x7ffe37d8fe80, 
+  TgtPtrBegin=0x7f90ff00, Size=0, updated RefCount=2, Name=X
+Info: Launching kernel 
__omp_offloading_fd02_c2c4ac1a__Z5daxpyPNSt3__17complexIdEES2_S1_m_l6
+  with 8 blocks and 128 threads in SPMD mode
+Info: OpenMP Host-Device pointer mappings after block at zaxpy.cpp:6:1:
+Info: Host Ptr   Target Ptr Size (B) RefCount Declaration
+Info: 0x7fff963f4000 0x7fd225004000 163841Y[0:N] at 
zaxpy.cpp:13:17
+Info: 0x7fff963f8000 0x7fd22500 163841X[0:N] at 
zaxpy.cpp:13:11
+Info: Exiting OpenMP data region at zaxpy.cpp:14:1 with 2 arguments:
+Info: to(X[0:N])[16384] 
+Info: tofrom(Y[0:N])[16384] 
+
+From this information, we can see the OpenMP kernel being launched on the CUDA
+device with enough threads and blocks for all ``1024`` iterations of the loop 
in
+simplified :doc:`SPMD Mode `. The information from the OpenMP data
+region shows the two arrays ``X`` and ``Y`` being copied from the host to the
+device. This creates an entry in the host-device mapping table associating the
+host pointers to the newly created device data. The data mappings in the OpenMP
+device kernel show the default mappings being used for all the variables used
+implicitly on the device. Because ``X`` and ``Y`` are already mapped in the
+device's table, no new entries are created. Additionally, the default mapping
+shows that ``D`` will be copied back from the device once the OpenMP device
+kernel region ends even though it isn't written to. Finally, at the end of the
+OpenMP data region the entries for ``X`` and ``Y`` are removed from the table.
+
+.. toctree::
+   :hidden:
+   :maxdepth: 1
+
+   Offloading
+
 LLVM/OpenMP Target Host Runtime Plugins (``libomptarget.rtl.``)
 ---
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org

[llvm-branch-commits] [clang] ad55d5c - Simplify vectorcall argument classification of HVAs, NFC

2021-01-07 Thread Reid Kleckner via llvm-branch-commits

Author: Reid Kleckner
Date: 2021-01-07T11:14:18-08:00
New Revision: ad55d5c3f32f6598f8ac30b68f4961d82cdb1fed

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

LOG: Simplify vectorcall argument classification of HVAs, NFC

This reduces the number of `WinX86_64ABIInfo::classify` call sites from
3 to 1. The call sites were similar, but passed different values for
FreeSSERegs. Use variables instead of `if`s to manage that argument.

Added: 


Modified: 
clang/lib/CodeGen/TargetInfo.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index c6d8942208e8..d36c7344e284 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -1089,11 +1089,6 @@ struct CCState {
   unsigned FreeSSERegs = 0;
 };
 
-enum {
-  // Vectorcall only allows the first 6 parameters to be passed in registers.
-  VectorcallMaxParamNumAsReg = 6
-};
-
 /// X86_32ABIInfo - The X86-32 ABI information.
 class X86_32ABIInfo : public SwiftABIInfo {
   enum Class {
@@ -2405,10 +2400,8 @@ class WinX86_64ABIInfo : public SwiftABIInfo {
 private:
   ABIArgInfo classify(QualType Ty, unsigned , bool IsReturnType,
   bool IsVectorCall, bool IsRegCall) const;
-  ABIArgInfo reclassifyHvaArgType(QualType Ty, unsigned ,
-  const ABIArgInfo ) const;
-  void computeVectorCallArgs(CGFunctionInfo , unsigned FreeSSERegs,
- bool IsVectorCall, bool IsRegCall) const;
+  ABIArgInfo reclassifyHvaArgForVectorCall(QualType Ty, unsigned ,
+   const ABIArgInfo ) const;
 
   X86AVXABILevel AVXLevel;
 
@@ -4163,10 +4156,8 @@ Address X86_64ABIInfo::EmitMSVAArg(CodeGenFunction , 
Address VAListAddr,
   /*allowHigherAlign*/ false);
 }
 
-ABIArgInfo
-WinX86_64ABIInfo::reclassifyHvaArgType(QualType Ty, unsigned ,
-const ABIArgInfo ) const {
-  // Assumes vectorCall calling convention.
+ABIArgInfo WinX86_64ABIInfo::reclassifyHvaArgForVectorCall(
+QualType Ty, unsigned , const ABIArgInfo ) const {
   const Type *Base = nullptr;
   uint64_t NumElts = 0;
 
@@ -4299,31 +4290,6 @@ ABIArgInfo WinX86_64ABIInfo::classify(QualType Ty, 
unsigned ,
   return ABIArgInfo::getDirect();
 }
 
-void WinX86_64ABIInfo::computeVectorCallArgs(CGFunctionInfo ,
- unsigned FreeSSERegs,
- bool IsVectorCall,
- bool IsRegCall) const {
-  unsigned Count = 0;
-  for (auto  : FI.arguments()) {
-// Vectorcall in x64 only permits the first 6 arguments to be passed
-// as XMM/YMM registers.
-if (Count < VectorcallMaxParamNumAsReg)
-  I.info = classify(I.type, FreeSSERegs, false, IsVectorCall, IsRegCall);
-else {
-  // Since these cannot be passed in registers, pretend no registers
-  // are left.
-  unsigned ZeroSSERegsAvail = 0;
-  I.info = classify(I.type, /*FreeSSERegs=*/ZeroSSERegsAvail, false,
-IsVectorCall, IsRegCall);
-}
-++Count;
-  }
-
-  for (auto  : FI.arguments()) {
-I.info = reclassifyHvaArgType(I.type, FreeSSERegs, I.info);
-  }
-}
-
 void WinX86_64ABIInfo::computeInfo(CGFunctionInfo ) const {
   const unsigned CC = FI.getCallingConvention();
   bool IsVectorCall = CC == llvm::CallingConv::X86_VectorCall;
@@ -4358,13 +4324,25 @@ void WinX86_64ABIInfo::computeInfo(CGFunctionInfo ) 
const {
 FreeSSERegs = 16;
   }
 
+  unsigned ArgNum = 0;
+  unsigned ZeroSSERegs = 0;
+  for (auto  : FI.arguments()) {
+// Vectorcall in x64 only permits the first 6 arguments to be passed as
+// XMM/YMM registers. After the sixth argument, pretend no vector
+// registers are left.
+unsigned *MaybeFreeSSERegs =
+(IsVectorCall && ArgNum >= 6) ?  : 
+I.info =
+classify(I.type, *MaybeFreeSSERegs, false, IsVectorCall, IsRegCall);
+++ArgNum;
+  }
+
   if (IsVectorCall) {
-computeVectorCallArgs(FI, FreeSSERegs, IsVectorCall, IsRegCall);
-  } else {
+// For vectorcall, assign aggregate HVAs to any free vector registers in a
+// second pass.
 for (auto  : FI.arguments())
-  I.info = classify(I.type, FreeSSERegs, false, IsVectorCall, IsRegCall);
+  I.info = reclassifyHvaArgForVectorCall(I.type, FreeSSERegs, I.info);
   }
-
 }
 
 Address WinX86_64ABIInfo::EmitVAArg(CodeGenFunction , Address VAListAddr,



___
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] 4c7148d - [SLP] remove opcode identifier for reduction; NFC

2021-01-07 Thread Sanjay Patel via llvm-branch-commits

Author: Sanjay Patel
Date: 2021-01-07T14:07:27-05:00
New Revision: 4c7148d75cd7e75f169251cdab3e013819344cfd

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

LOG: [SLP] remove opcode identifier for reduction; NFC

Another step towards allowing intrinsics in reduction matching.

Added: 


Modified: 
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp 
b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 8d6453f277ea..c8e5fdb458ff 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -772,7 +772,7 @@ class BoUpSLP {
   /// effectively impossible for the backend to undo.
   /// TODO: If load combining is allowed in the IR optimizer, this analysis
   ///   may not be necessary.
-  bool isLoadCombineReductionCandidate(unsigned ReductionOpcode) const;
+  bool isLoadCombineReductionCandidate(RecurKind RdxKind) const;
 
   /// Assume that a vector of stores of bitwise-or/shifted/zexted loaded values
   /// can be load combined in the backend. Load combining may not be allowed in
@@ -3896,8 +3896,8 @@ static bool isLoadCombineCandidateImpl(Value *Root, 
unsigned NumElts,
   return true;
 }
 
-bool BoUpSLP::isLoadCombineReductionCandidate(unsigned RdxOpcode) const {
-  if (RdxOpcode != Instruction::Or)
+bool BoUpSLP::isLoadCombineReductionCandidate(RecurKind RdxKind) const {
+  if (RdxKind != RecurKind::Or)
 return false;
 
   unsigned NumElts = VectorizableTree[0]->Scalars.size();
@@ -6987,7 +6987,7 @@ class HorizontalReduction {
   }
   if (V.isTreeTinyAndNotFullyVectorizable())
 break;
-  if (V.isLoadCombineReductionCandidate(RdxTreeInst.getOpcode()))
+  if (V.isLoadCombineReductionCandidate(RdxTreeInst.getKind()))
 break;
 
   V.computeMinimumValueSizes();



___
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] [mlir] 906efee - [mlir] don't match the text produced only in debug mode in Python tests

2021-01-07 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2021-01-07T19:57:28+01:00
New Revision: 906efeec0a471be522588bd7cbb7f61459b2b437

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

LOG: [mlir] don't match the text produced only in debug mode in Python tests

Some Python bindings tests were using FileCheck to match parts of the
error description produced only in the debug compilation mode. Remove
these parts (but keep the main message) to ensure tests also pass when
running them in the release compilation mode.

Reviewed By: mehdi_amini

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

Added: 


Modified: 
mlir/test/Bindings/Python/ir_attributes.py
mlir/test/Bindings/Python/ir_operation.py

Removed: 




diff  --git a/mlir/test/Bindings/Python/ir_attributes.py 
b/mlir/test/Bindings/Python/ir_attributes.py
index ce85dc3cf87a..91b0a92e989f 100644
--- a/mlir/test/Bindings/Python/ir_attributes.py
+++ b/mlir/test/Bindings/Python/ir_attributes.py
@@ -371,7 +371,7 @@ def testArrayAttr():
 try:
   ArrayAttr.get([42])
 except RuntimeError as e:
-  # CHECK: Error: Invalid attribute when attempting to create an 
ArrayAttribute (Unable to cast Python instance of type  to C++ 
type 'mlir::python::PyAttribute')
+  # CHECK: Error: Invalid attribute when attempting to create an 
ArrayAttribute
   print("Error: ", e)
 run(testArrayAttr)
 

diff  --git a/mlir/test/Bindings/Python/ir_operation.py 
b/mlir/test/Bindings/Python/ir_operation.py
index ba54e83f65e8..034b28ec25bf 100644
--- a/mlir/test/Bindings/Python/ir_operation.py
+++ b/mlir/test/Bindings/Python/ir_operation.py
@@ -566,17 +566,17 @@ def testCreateWithInvalidAttributes():
 try:
   Operation.create("module", attributes={None:StringAttr.get("name")})
 except Exception as e:
-  # CHECK: Invalid attribute key (not a string) when attempting to create 
the operation "module" (Unable to cast Python instance of type  to C++ type
+  # CHECK: Invalid attribute key (not a string) when attempting to create 
the operation "module"
   print(e)
 try:
   Operation.create("module", attributes={42:StringAttr.get("name")})
 except Exception as e:
-  # CHECK: Invalid attribute key (not a string) when attempting to create 
the operation "module" (Unable to cast Python instance of type  to 
C++ type
+  # CHECK: Invalid attribute key (not a string) when attempting to create 
the operation "module"
   print(e)
 try:
   Operation.create("module", attributes={"some_key":ctx})
 except Exception as e:
-  # CHECK: Invalid attribute value for the key "some_key" when attempting 
to create the operation "module" (Unable to cast Python instance of type  to C++ type 'mlir::python::PyAttribute')
+  # CHECK: Invalid attribute value for the key "some_key" when attempting 
to create the operation "module"
   print(e)
 try:
   Operation.create("module", attributes={"some_key":None})



___
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] [lld] 5c38ae3 - [WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION

2021-01-07 Thread Wouter van Oortmerssen via llvm-branch-commits

Author: Wouter van Oortmerssen
Date: 2021-01-07T10:31:38-08:00
New Revision: 5c38ae36c58f5b6bb4a32e9ec2187fde86cf94b8

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

LOG: [WebAssembly] Fixed byval args missing DWARF DW_AT_LOCATION

A struct in C passed by value did not get debug information. Such values are 
currently
lowered to a Wasm local even in -O0 (not to an alloca like on other archs), 
which becomes
a Target Index operand (TI_LOCAL). The DWARF writing code was not emitting 
locations
in for TI's specifically if the location is a single range (not a list).

In addition, the ExplicitLocals pass which removes the ARGUMENT pseudo 
instructions did
not update the associated DBG_VALUEs, and couldn't even find these values since 
the code
assumed such instructions are adjacent, which is not the case here.

Also fixed asm printing of TIs needed by a test.

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

Added: 
llvm/test/MC/WebAssembly/debug-byval-struct.ll

Modified: 
lld/test/wasm/debuginfo.test
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
llvm/test/CodeGen/WebAssembly/dbgvalue.ll

Removed: 




diff  --git a/lld/test/wasm/debuginfo.test b/lld/test/wasm/debuginfo.test
index 94d183a3c1d4..9cb1cc31e515 100644
--- a/lld/test/wasm/debuginfo.test
+++ b/lld/test/wasm/debuginfo.test
@@ -21,6 +21,7 @@ CHECK-NEXT:DW_AT_decl_line(3)
 CHECK-NEXT:DW_AT_prototyped(true)
 
 CHECK: DW_TAG_formal_parameter
+CHECK-NEXT:  DW_AT_location (DW_OP_WASM_location 0x0 0x0, 
DW_OP_stack_value)
 CHECK-NEXT:  DW_AT_name("t")
 CHECK-NEXT:  DW_AT_decl_file   
("/Users/yury/llvmwasm{{(/|\\)}}hi.c")
 CHECK-NEXT:  DW_AT_decl_line   (3)
@@ -45,7 +46,7 @@ CHECK-NEXT:  DW_AT_name   ("hi_foo.c")
 
 CHECK:   DW_TAG_variable
 CHECK-NEXT:DW_AT_name  ("y")
-CHECK-NEXT:DW_AT_type  (0x00a7 "int[2]")
+CHECK-NEXT:DW_AT_type  (0x00ac "int[2]")
 CHECK-NEXT:DW_AT_external  (true)
 CHECK-NEXT:DW_AT_decl_file ("{{.*}}hi_foo.c")
 CHECK-NEXT:DW_AT_decl_line (1)
@@ -67,7 +68,7 @@ CHECK-NEXT:DW_AT_encoding 
(DW_ATE_unsigned)
 
 CHECK:   DW_TAG_variable
 CHECK-NEXT:DW_AT_name  ("z")
-CHECK-NEXT:DW_AT_type  (0x00a7 "int[2]")
+CHECK-NEXT:DW_AT_type  (0x00ac "int[2]")
 CHECK-NEXT:DW_AT_external  (true)
 CHECK-NEXT:DW_AT_decl_file ("{{.*}}hi_foo.c")
 CHECK-NEXT:DW_AT_decl_line (8)
@@ -82,6 +83,7 @@ CHECK-NEXT:DW_AT_decl_file
("{{.*}}hi_foo.c")
 CHECK-NEXT:DW_AT_decl_line (3)
 
 CHECK: DW_TAG_formal_parameter
+CHECK-NEXT:  DW_AT_location (DW_OP_WASM_location 0x0 0x0, 
DW_OP_stack_value)
 CHECK-NEXT:  DW_AT_name("p")
 CHECK-NEXT:  DW_AT_decl_file   ("{{.*}}hi_foo.c")
 CHECK-NEXT:  DW_AT_decl_line   (3)

diff  --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp 
b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 85a5d0c59b83..d72a91825061 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -948,6 +948,8 @@ static bool emitDebugValueComment(const MachineInstr *MI, 
AsmPrinter ) {
   } else if (MI->getDebugOperand(0).isTargetIndex()) {
 auto Op = MI->getDebugOperand(0);
 OS << "!target-index(" << Op.getIndex() << "," << Op.getOffset() << ")";
+// NOTE: Want this comment at start of line, don't emit with AddComment.
+AP.OutStreamer->emitRawComment(OS.str());
 return true;
   } else {
 Register Reg;

diff  --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp 
b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index ea279e4914b0..befc4bba19a2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -720,6 +720,13 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const 
DbgVariable ,
   addConstantFPValue(*VariableDie, DVal->getConstantFP());
 } else if (DVal->isConstantInt()) {
   addConstantValue(*VariableDie, DVal->getConstantInt(), DV.getType());
+} else if (DVal->isTargetIndexLocation()) {
+  DIELoc *Loc = new (DIEValueAllocator) DIELoc;
+  DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
+  const DIBasicType *BT = dyn_cast(
+  

[llvm-branch-commits] [llvm] c9122dd - CodeGen: Refactor regallocator command line and target selection

2021-01-07 Thread Matt Arsenault via llvm-branch-commits

Author: Matt Arsenault
Date: 2021-01-07T13:13:25-05:00
New Revision: c9122ddef5213fbdd2d82c473a74e1742010f62f

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

LOG: CodeGen: Refactor regallocator command line and target selection

Make the sequence of passes to select and rewrite instructions to
physical registers be a target callback. This is to prepare to allow
targets to split register allocation into multiple phases.

Added: 


Modified: 
llvm/include/llvm/CodeGen/TargetPassConfig.h
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/TargetPassConfig.h 
b/llvm/include/llvm/CodeGen/TargetPassConfig.h
index 0cbb758a7ee8..b4787710379f 100644
--- a/llvm/include/llvm/CodeGen/TargetPassConfig.h
+++ b/llvm/include/llvm/CodeGen/TargetPassConfig.h
@@ -460,10 +460,10 @@ class TargetPassConfig : public ImmutablePass {
   /// regalloc pass.
   virtual FunctionPass *createRegAllocPass(bool Optimized);
 
-  /// Add core register alloator passes which do the actual register assignment
+  /// Add core register allocator passes which do the actual register 
assignment
   /// and rewriting. \returns true if any passes were added.
-  virtual bool addRegAssignmentFast();
-  virtual bool addRegAssignmentOptimized();
+  virtual bool addRegAssignAndRewriteFast();
+  virtual bool addRegAssignAndRewriteOptimized();
 };
 
 void registerCodeGenCallback(PassInstrumentationCallbacks ,

diff  --git a/llvm/lib/CodeGen/TargetPassConfig.cpp 
b/llvm/lib/CodeGen/TargetPassConfig.cpp
index 41d96b9e6016..e844d03854e2 100644
--- a/llvm/lib/CodeGen/TargetPassConfig.cpp
+++ b/llvm/lib/CodeGen/TargetPassConfig.cpp
@@ -1308,7 +1308,7 @@ FunctionPass *TargetPassConfig::createRegAllocPass(bool 
Optimized) {
   return createTargetRegisterAllocator(Optimized);
 }
 
-bool TargetPassConfig::addRegAssignmentFast() {
+bool TargetPassConfig::addRegAssignAndRewriteFast() {
   if (RegAlloc !=  &&
   RegAlloc != )
 report_fatal_error("Must use fast (default) register allocator for 
unoptimized regalloc.");
@@ -1317,7 +1317,7 @@ bool TargetPassConfig::addRegAssignmentFast() {
   return true;
 }
 
-bool TargetPassConfig::addRegAssignmentOptimized() {
+bool TargetPassConfig::addRegAssignAndRewriteOptimized() {
   // Add the selected register allocation pass.
   addPass(createRegAllocPass(true));
 
@@ -1327,12 +1327,6 @@ bool TargetPassConfig::addRegAssignmentOptimized() {
   // Finally rewrite virtual registers.
   addPass();
 
-  // Perform stack slot coloring and post-ra machine LICM.
-  //
-  // FIXME: Re-enable coloring with register when it's capable of adding
-  // kill markers.
-  addPass();
-
   return true;
 }
 
@@ -1348,7 +1342,7 @@ void TargetPassConfig::addFastRegAlloc() {
   addPass(, false);
   addPass(, false);
 
-  addRegAssignmentFast();
+  addRegAssignAndRewriteFast();
 }
 
 /// Add standard target-independent passes that are tightly coupled with
@@ -1391,7 +1385,13 @@ void TargetPassConfig::addOptimizedRegAlloc() {
   // PreRA instruction scheduling.
   addPass();
 
-  if (addRegAssignmentOptimized()) {
+  if (addRegAssignAndRewriteOptimized()) {
+// Perform stack slot coloring and post-ra machine LICM.
+//
+// FIXME: Re-enable coloring with register when it's capable of adding
+// kill markers.
+addPass();
+
 // Allow targets to expand pseudo instructions depending on the choice of
 // registers before MachineCopyPropagation.
 addPostRewrite();

diff  --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp 
b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index 85709eb731e2..21da566b639f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -170,11 +170,11 @@ class NVPTXPassConfig : public TargetPassConfig {
   void addFastRegAlloc() override;
   void addOptimizedRegAlloc() override;
 
-  bool addRegAssignmentFast() override {
+  bool addRegAssignAndRewriteFast() override {
 llvm_unreachable("should not be used");
   }
 
-  bool addRegAssignmentOptimized() override {
+  bool addRegAssignAndRewriteOptimized() override {
 llvm_unreachable("should not be used");
   }
 

diff  --git a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp 
b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
index 71e8e1485b75..af16d799d1dc 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp
@@ -326,10 +326,10 @@ class WebAssemblyPassConfig final : public 
TargetPassConfig {
   void addPreEmitPass() override;
 
   // No reg alloc
-  bool addRegAssignmentFast() override { return false; }
+  

[llvm-branch-commits] [llvm] cf5415c - [PGO][PGSO] Let unroll hints take precedence over PGSO.

2021-01-07 Thread Hiroshi Yamauchi via llvm-branch-commits

Author: Hiroshi Yamauchi
Date: 2021-01-07T10:10:31-08:00
New Revision: cf5415c727dda0ea4b27ee16347d170f118b037b

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

LOG: [PGO][PGSO] Let unroll hints take precedence over PGSO.

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

Added: 


Modified: 
llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp 
b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index 4cce05d595a8..d09f1ee22a75 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -218,8 +218,10 @@ TargetTransformInfo::UnrollingPreferences 
llvm::gatherUnrollingPreferences(
 
   // Apply size attributes
   bool OptForSize = L->getHeader()->getParent()->hasOptSize() ||
-llvm::shouldOptimizeForSize(L->getHeader(), PSI, BFI,
-PGSOQueryType::IRPass);
+// Let unroll hints / pragmas take precedence over PGSO.
+(hasUnrollTransformation(L) != TM_ForcedByUser &&
+ llvm::shouldOptimizeForSize(L->getHeader(), PSI, BFI,
+ PGSOQueryType::IRPass));
   if (OptForSize) {
 UP.Threshold = UP.OptSizeThreshold;
 UP.PartialThreshold = UP.PartialOptSizeThreshold;

diff  --git a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll 
b/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
index e219349fb093..884981bf8bf0 100644
--- a/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
+++ b/llvm/test/Transforms/LoopUnroll/unroll-opt-attribute.ll
@@ -158,6 +158,38 @@ for.end:  ; preds 
= %for.body
 ; NPGSO-NOT:  phi
 ; NPGSO-NOT:  icmp
 
+;/ TEST 6 //
+
+; This test tests that unroll hints take precedence over PGSO and that this 
loop
+; gets unrolled even though it's cold.
+
+define i32 @Test6() !prof !14 {
+entry:
+  br label %for.body
+
+for.body: ; preds = %for.body, %entry
+  %i.05 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
+  %arrayidx = getelementptr inbounds [24 x i32], [24 x i32]* @tab, i32 0, i32 
%i.05
+  store i32 %i.05, i32* %arrayidx, align 4
+  %inc = add nuw nsw i32 %i.05, 1
+  %exitcond = icmp eq i32 %inc, 24
+  br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !15
+
+for.end:  ; preds = %for.body
+  ret i32 42
+}
+
+; PGSO-LABEL: @Test6
+; PGSO:  store
+; PGSO:  store
+; PGSO:  store
+; PGSO:  store
+; NPGSO-LABEL: @Test6
+; NPGSO:  store
+; NPGSO:  store
+; NPGSO:  store
+; NPGSO:  store
+
 !llvm.module.flags = !{!0}
 !0 = !{i32 1, !"ProfileSummary", !1}
 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
@@ -174,3 +206,5 @@ for.end:  ; preds = 
%for.body
 !12 = !{i32 999000, i64 100, i32 1}
 !13 = !{i32 99, i64 1, i32 2}
 !14 = !{!"function_entry_count", i64 0}
+!15 = !{!15, !16}
+!16 = !{!"llvm.loop.unroll.count", i32 4}



___
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] d015445 - Silence warning: comparison of integers of different signs: 'const unsigned int' and 'const long' [-Wsign-compare]

2021-01-07 Thread Alexandre Ganea via llvm-branch-commits

Author: Alexandre Ganea
Date: 2021-01-07T13:01:06-05:00
New Revision: d0154456e61c5ab79e25fc9b8bb684ebdca3a7c2

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

LOG: Silence warning: comparison of integers of different signs: 'const 
unsigned int' and 'const long' [-Wsign-compare]

(off_t being a signed type)

Added: 


Modified: 
clang/unittests/Basic/FileEntryTest.cpp

Removed: 




diff  --git a/clang/unittests/Basic/FileEntryTest.cpp 
b/clang/unittests/Basic/FileEntryTest.cpp
index a3e03e6c7c29..16c8e57d9a17 100644
--- a/clang/unittests/Basic/FileEntryTest.cpp
+++ b/clang/unittests/Basic/FileEntryTest.cpp
@@ -57,7 +57,7 @@ struct RefMaps {
 
 TEST(FileEntryTest, Constructor) {
   FileEntry FE;
-  EXPECT_EQ(0U, FE.getSize());
+  EXPECT_EQ(0, FE.getSize());
   EXPECT_EQ(0, FE.getModificationTime());
   EXPECT_EQ(nullptr, FE.getDir());
   EXPECT_EQ(0U, FE.getUniqueID().getDevice());



___
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] ee57d30 - [NFC] Removed unused prefixes from CodeGen/AMDGPU

2021-01-07 Thread Mircea Trofin via llvm-branch-commits

Author: Mircea Trofin
Date: 2021-01-07T09:48:14-08:00
New Revision: ee57d30f4487548d844cc3ffa5895bd3c6b38585

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

LOG: [NFC] Removed unused prefixes from CodeGen/AMDGPU

Last bulk batch.

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

Added: 


Modified: 
llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll
llvm/test/CodeGen/AMDGPU/uaddsat.ll
llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll
llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
llvm/test/CodeGen/AMDGPU/usubsat.ll
llvm/test/CodeGen/AMDGPU/v_mac.ll
llvm/test/CodeGen/AMDGPU/v_madak_f16.ll
llvm/test/CodeGen/AMDGPU/vccz-corrupt-bug-workaround.mir
llvm/test/CodeGen/AMDGPU/vector-alloca.ll
llvm/test/CodeGen/AMDGPU/vgpr-spill.mir
llvm/test/CodeGen/AMDGPU/widen-smrd-loads.ll
llvm/test/CodeGen/AMDGPU/wqm.ll
llvm/test/CodeGen/AMDGPU/xnor.ll
llvm/test/CodeGen/AMDGPU/zero_extend.ll

Removed: 




diff  --git a/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll 
b/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll
index 112c49953561..8027c89ef374 100644
--- a/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll
+++ b/llvm/test/CodeGen/AMDGPU/trunc-store-i1.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck 
-enable-var-scope -check-prefixes=GCN,SI %s
-; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global 
-verify-machineinstrs< %s | FileCheck -enable-var-scope -check-prefixes=GCN,VI 
%s
+; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck 
-enable-var-scope --check-prefix=GCN %s
+; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global 
-verify-machineinstrs< %s | FileCheck -enable-var-scope --check-prefix=GCN %s
 
 
 ; GCN-LABEL: {{^}}global_truncstore_i32_to_i1:

diff  --git a/llvm/test/CodeGen/AMDGPU/uaddsat.ll 
b/llvm/test/CodeGen/AMDGPU/uaddsat.ll
index 56e4123e182a..5447d5ea0b75 100644
--- a/llvm/test/CodeGen/AMDGPU/uaddsat.ll
+++ b/llvm/test/CodeGen/AMDGPU/uaddsat.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck 
-check-prefixes=GCN,GFX6 %s
-; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck 
-check-prefixes=GCN,GFX8 %s
-; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck 
-check-prefixes=GCN,GFX9 %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=tahiti < %s | FileCheck 
--check-prefix=GFX6 %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=fiji < %s | FileCheck 
--check-prefix=GFX8 %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx900 < %s | FileCheck 
--check-prefix=GFX9 %s
 
 define i8 @v_uaddsat_i8(i8 %lhs, i8 %rhs) {
 ; GFX6-LABEL: v_uaddsat_i8:

diff  --git a/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll 
b/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll
index d2799d731752..aa1971a3fdbe 100644
--- a/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll
+++ b/llvm/test/CodeGen/AMDGPU/uint_to_fp.i64.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck 
-check-prefix=GCN -check-prefix=SI -check-prefix=FUNC %s
-; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global 
-verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=VI 
-check-prefix=FUNC %s
+; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck 
--check-prefixes=GCN,FUNC %s
+; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global 
-verify-machineinstrs < %s | FileCheck --check-prefixes=GCN,FUNC %s
 
 ; FIXME: This should be merged with uint_to_fp.ll, but s_uint_to_fp_v2i64 
crashes on r600
 

diff  --git a/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll 
b/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
index 562c63ecdb56..8fd7c2070fda 100644
--- a/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
+++ b/llvm/test/CodeGen/AMDGPU/unstructured-cfg-def-use-issue.ll
@@ -1,6 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -mtriple=amdgcn-amdhsa -verify-machineinstrs 
-simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck -check-prefix=GCN 
-check-prefix=SI %s
+; RUN: llc -mtriple=amdgcn-amdhsa -verify-machineinstrs 
-simplifycfg-require-and-preserve-domtree=1 < %s | FileCheck -check-prefix=GCN 
%s
 ; RUN: opt -S -si-annotate-control-flow -mtriple=amdgcn-amdhsa 
-verify-machineinstrs -simplifycfg-require-and-preserve-domtree=1 < %s | 
FileCheck -check-prefix=SI-OPT %s
 
 define hidden void @widget() {

diff  --git a/llvm/test/CodeGen/AMDGPU/unsupported-calls.ll 
b/llvm/test/CodeGen/AMDGPU/unsupported-calls.ll
index 44c33347c9b5..62a2c1348c41 

[llvm-branch-commits] [mlir] 41e31ea - Fix GCC5 build, require explicit this->... in this call inside a lambda (NFC)

2021-01-07 Thread Mehdi Amini via llvm-branch-commits

Author: Mehdi Amini
Date: 2021-01-07T17:44:42Z
New Revision: 41e31eac14c239970a220f81de5fdd3b231b5184

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

LOG: Fix GCC5 build, require explicit this->... in this call inside a lambda 
(NFC)

Error was:

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp:2247:36: error: cannot call member 
function 'mlir::LLVM::FastmathFlags mlir::LLVM::FMFAttr::getFlags() const' 
without object
 return bitEnumContains(getFlags(), flag);
^

Added: 


Modified: 
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Removed: 




diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp 
b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index b7f7789ee44b..cc57b1803f26 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -2244,7 +2244,7 @@ static constexpr const FastmathFlags FastmathFlagsList[] 
= {
 void FMFAttr::print(DialectAsmPrinter ) const {
   printer << "fastmath<";
   auto flags = llvm::make_filter_range(FastmathFlagsList, [&](auto flag) {
-return bitEnumContains(getFlags(), flag);
+return bitEnumContains(this->getFlags(), flag);
   });
   llvm::interleaveComma(flags, printer,
 [&](auto flag) { printer << stringifyEnum(flag); });



___
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] [mlir] bd78f4e - [mlir] revert 82f5ee3c3e601daad5

2021-01-07 Thread Eric Schweitz via llvm-branch-commits

Author: Eric Schweitz
Date: 2021-01-07T09:38:21-08:00
New Revision: bd78f4e93212f2b9bea233905faa2a85bf7bdba7

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

LOG: [mlir] revert 82f5ee3c3e601daad5

Added: 


Modified: 
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Dialect/LLVMIR/func.mlir
mlir/test/Target/llvmir-invalid.mlir

Removed: 




diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 86f4e7e3e2c4..7700867bb461 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1102,22 +1102,6 @@ LogicalResult 
ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
   llvm::AttrBuilder().addAlignmentAttr(llvm::Align(attr.getInt(;
 }
 
-if (auto attr = func.getArgAttrOfType(argIdx, "llvm.sret")) {
-  auto argTy = mlirArg.getType().dyn_cast();
-  if (!argTy.isa())
-return func.emitError(
-"llvm.sret attribute attached to LLVM non-pointer argument");
-  llvmArg.addAttr(llvm::Attribute::AttrKind::StructRet);
-}
-
-if (auto attr = func.getArgAttrOfType(argIdx, "llvm.byval")) {
-  auto argTy = mlirArg.getType().dyn_cast();
-  if (!argTy.isa())
-return func.emitError(
-"llvm.byval attribute attached to LLVM non-pointer argument");
-  llvmArg.addAttr(llvm::Attribute::AttrKind::ByVal);
-}
-
 valueMapping[mlirArg] = 
 argIdx++;
   }

diff  --git a/mlir/test/Dialect/LLVMIR/func.mlir 
b/mlir/test/Dialect/LLVMIR/func.mlir
index 2cec1bca1f74..65dc33cc1c4f 100644
--- a/mlir/test/Dialect/LLVMIR/func.mlir
+++ b/mlir/test/Dialect/LLVMIR/func.mlir
@@ -87,16 +87,6 @@ module {
 llvm.return
   }
 
-  // CHECK: llvm.func @byvalattr(%{{.*}}: !llvm.ptr {llvm.byval})
-  llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval}) {
-llvm.return
-  }
-
-  // CHECK: llvm.func @sretattr(%{{.*}}: !llvm.ptr {llvm.sret})
-  llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret}) {
-llvm.return
-  }
-
   // CHECK: llvm.func @variadic(...)
   llvm.func @variadic(...)
 

diff  --git a/mlir/test/Target/llvmir-invalid.mlir 
b/mlir/test/Target/llvmir-invalid.mlir
index fcd98ef4b143..14117594e2f8 100644
--- a/mlir/test/Target/llvmir-invalid.mlir
+++ b/mlir/test/Target/llvmir-invalid.mlir
@@ -14,19 +14,6 @@ llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.noalias 
= true}) -> !llvm.f
 
 // -
 
-// expected-error @+1 {{llvm.sret attribute attached to LLVM non-pointer 
argument}}
-llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.sret}) -> !llvm.float {
-  llvm.return %arg0 : !llvm.float
-}
-// -
-
-// expected-error @+1 {{llvm.byval attribute attached to LLVM non-pointer 
argument}}
-llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.byval}) -> !llvm.float {
-  llvm.return %arg0 : !llvm.float
-}
-
-// -
-
 // expected-error @+1 {{llvm.align attribute attached to LLVM non-pointer 
argument}}
 llvm.func @invalid_align(%arg0 : !llvm.float {llvm.align = 4}) -> !llvm.float {
   llvm.return %arg0 : !llvm.float



___
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] ebcc8dc - [Coverage] Refactor three tests from commit rG9f2967bcfe2f

2021-01-07 Thread Alan Phipps via llvm-branch-commits

Author: Alan Phipps
Date: 2021-01-07T11:18:31-06:00
New Revision: ebcc8dcb68aa37f34a87641b0c8b73086712a3cf

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

LOG: [Coverage] Refactor three tests from commit rG9f2967bcfe2f

Refactor three tests to not depend on other test files as input but to instead
refer to "Inputs" subdirectory.

Added: 
llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
llvm/test/tools/llvm-cov/branch-c-general.test

Modified: 
llvm/test/tools/llvm-cov/branch-export-json.test
llvm/test/tools/llvm-cov/branch-export-lcov.test
llvm/test/tools/llvm-cov/branch-noShowBranch.test

Removed: 
llvm/test/tools/llvm-cov/branch-c-general.c



diff  --git a/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c 
b/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
new file mode 100644
index ..2e7e773e5c39
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-c-general.c
@@ -0,0 +1,260 @@
+// Test visualization of general branch constructs in C.
+
+
+
+
+
+void simple_loops() {
+  int i;
+  for (i = 0; i < 100; ++i) {
+  }
+  while (i > 0)
+i--;
+  do {} while (i++ < 75);
+
+}
+
+void conditionals() {
+  for (int i = 0; i < 100; ++i) {
+if (i % 2) {
+  if (i) {}
+} else if (i % 3) {
+  if (i) {}
+} else {
+  if (i) {}
+}
+
+if (1 && i) {}
+if (0 || i) {}
+  }
+
+}
+
+void early_exits() {
+  int i = 0;
+
+  if (i) {}
+
+  while (i < 100) {
+i++;
+if (i > 50)
+  break;
+if (i % 2)
+  continue;
+  }
+
+  if (i) {}
+
+  do {
+if (i > 75)
+  return;
+else
+  i++;
+  } while (i < 100);
+
+  if (i) {}
+
+}
+
+void jumps() {
+  int i;
+
+  for (i = 0; i < 2; ++i) {
+goto outofloop;
+// Never reached -> no weights
+if (i) {}
+  }
+
+outofloop:
+  if (i) {}
+
+  goto loop1;
+
+  while (i) {
+  loop1:
+if (i) {}
+  }
+
+  goto loop2;
+first:
+second:
+third:
+  i++;
+  if (i < 3)
+goto loop2;
+
+  while (i < 3) {
+  loop2:
+switch (i) {
+case 0:
+  goto first;
+case 1:
+  goto second;
+case 2:
+  goto third;
+}
+  }
+
+  for (i = 0; i < 10; ++i) {
+goto withinloop;
+// never reached -> no weights
+if (i) {}
+  withinloop:
+if (i) {}
+  }
+
+}
+
+void switches() {
+  static int weights[] = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};
+
+  // No cases -> no weights
+  switch (weights[0]) {
+  default:
+break;
+  }
+
+  for (int i = 0, len = sizeof(weights) / sizeof(weights[0]); i < len; ++i) {
+switch (i[weights]) {
+case 1:
+  if (i) {}
+  // fallthrough
+case 2:
+  if (i) {}
+  break;
+case 3:
+  if (i) {}
+  continue;
+case 4:
+  if (i) {}
+  switch (i) {
+  case 6 ... 9:
+if (i) {}
+continue;
+  }
+
+default:
+  if (i == len - 1)
+return;
+}
+  }
+
+  // Never reached -> no weights
+  if (weights[0]) {}
+
+}
+
+void big_switch() {
+  for (int i = 0; i < 32; ++i) {
+switch (1 << i) {
+case (1 << 0):
+  if (i) {}
+  // fallthrough
+case (1 << 1):
+  if (i) {}
+  break;
+case (1 << 2) ... (1 << 12):
+  if (i) {}
+  break;
+  // The branch for the large case range above appears after the case body.
+
+case (1 << 13):
+  if (i) {}
+  break;
+case (1 << 14) ... (1 << 28):
+  if (i) {}
+  break;
+// The branch for the large case range above appears after the case body.
+
+case (1 << 29) ... ((1 << 29) + 1):
+  if (i) {}
+  break;
+default:
+  if (i) {}
+  break;
+}
+  }
+
+}
+
+void boolean_operators() {
+  int v;
+  for (int i = 0; i < 100; ++i) {
+v = i % 3 || i;
+
+v = i % 3 && i;
+
+v = i % 3 || i % 2 || i;
+
+v = i % 2 && i % 3 && i;
+  }
+
+}
+
+void boolop_loops() {
+  int i = 100;
+
+  while (i && i > 50)
+i--;
+
+  while ((i % 2) || (i > 0))
+i--;
+
+  for (i = 100; i && i > 50; --i);
+
+  for (; (i % 2) || (i > 0); --i);
+
+}
+
+void conditional_operator() {
+  int i = 100;
+
+  int j = i < 50 ? i : 1;
+
+  int k = i ?: 0;
+
+}
+
+void do_fallthrough() {
+  for (int i = 0; i < 10; ++i) {
+int j = 0;
+do {
+  // The number of exits out of this do-loop via the break statement
+  // exceeds the counter value for the loop (which does not include the
+  // fallthrough count). Make sure that does not violate any assertions.
+  if (i < 8) break;
+  j++;
+} while (j < 2);
+  }
+}
+
+static void static_func() {
+  for (int i = 0; i < 10; ++i) {
+  }
+}
+
+
+
+
+
+
+
+
+
+
+int main(int argc, const char *argv[]) {
+  simple_loops();
+  conditionals();
+  early_exits();
+  jumps();
+  switches();
+  big_switch();
+  boolean_operators();
+  boolop_loops();
+  

[llvm-branch-commits] [clang] 43043ad - Add element-type to the Vector TypeLoc types.

2021-01-07 Thread Erich Keane via llvm-branch-commits

Author: Erich Keane
Date: 2021-01-07T09:14:36-08:00
New Revision: 43043adcfbc60945646b791d7162e5a1307a5318

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

LOG: Add element-type to the Vector TypeLoc types.

As shown by bug 48540, GCC vector types would cause a crash when the
declaration hada ParenType. This was because the walking of the
declaration would try to expand the 'inner' type, but there was no
ability to get it from the vector type.  This patch adds that element
type access to the vector type loc objects.

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

Added: 


Modified: 
clang/include/clang/AST/TypeLoc.h
clang/lib/Sema/SemaType.cpp
clang/lib/Sema/TreeTransform.h
clang/test/SemaCXX/vector.cpp

Removed: 




diff  --git a/clang/include/clang/AST/TypeLoc.h 
b/clang/include/clang/AST/TypeLoc.h
index 4c320ce26e4f..65e95d52c303 100644
--- a/clang/include/clang/AST/TypeLoc.h
+++ b/clang/include/clang/AST/TypeLoc.h
@@ -1749,30 +1749,79 @@ class DependentAddressSpaceTypeLoc
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
-class VectorTypeLoc : public InheritingConcreteTypeLoc {
+struct VectorTypeLocInfo {
+  SourceLocation NameLoc;
+};
+
+class VectorTypeLoc : public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 // FIXME: size expression and attribute locations (or keyword if we
 // ever fully support altivec syntax).
 class DependentVectorTypeLoc
-: public InheritingConcreteTypeLoc {};
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
 
-// FIXME: size expression and attribute locations.
-class ExtVectorTypeLoc : public InheritingConcreteTypeLoc {
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
+// FIXME: size expression and attribute locations.
+class ExtVectorTypeLoc
+: public InheritingConcreteTypeLoc {};
+
 // FIXME: attribute locations.
 // For some reason, this isn't a subtype of VectorType.
-class DependentSizedExtVectorTypeLoc :
-public InheritingConcreteTypeLoc {
+class DependentSizedExtVectorTypeLoc
+: public ConcreteTypeLoc {
+public:
+  SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; }
+
+  void setNameLoc(SourceLocation Loc) { this->getLocalData()->NameLoc = Loc; }
+
+  SourceRange getLocalSourceRange() const {
+return SourceRange(getNameLoc(), getNameLoc());
+  }
+
+  void initializeLocal(ASTContext , SourceLocation Loc) {
+setNameLoc(Loc);
+  }
+
+  TypeLoc getElementLoc() const { return getInnerTypeLoc(); }
+
+  QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
 
 struct MatrixTypeLocInfo {

diff  --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index f51c616169f5..fe775b82a1d6 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -6135,6 +6135,17 @@ namespace {
 void VisitMacroQualifiedTypeLoc(MacroQualifiedTypeLoc TL) {
   TL.setExpansionLoc(Chunk.Loc);
 }
+void VisitVectorTypeLoc(VectorTypeLoc TL) { TL.setNameLoc(Chunk.Loc); }
+void VisitDependentVectorTypeLoc(DependentVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void VisitExtVectorTypeLoc(ExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
+void
+VisitDependentSizedExtVectorTypeLoc(DependentSizedExtVectorTypeLoc TL) {
+  TL.setNameLoc(Chunk.Loc);
+}
 
 void VisitTypeLoc(TypeLoc TL) {
   llvm_unreachable("unsupported TypeLoc kind in declarator!");

diff  --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 2cc8b9c8324f..0a596e50658b 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -5178,7 +5178,7 @@ template 
 QualType TreeTransform::TransformDependentVectorType(
 TypeLocBuilder , DependentVectorTypeLoc TL) {
   const 

[llvm-branch-commits] [clang] acbb365 - [AST][NFC] Silence GCC warning about multiline comments

2021-01-07 Thread Thomas Preud'homme via llvm-branch-commits

Author: Thomas Preud'homme
Date: 2021-01-07T17:11:49Z
New Revision: acbb3652931a735a861b756075b1cc86fd041761

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

LOG: [AST][NFC] Silence GCC warning about multiline comments

Remove continuation line in code snippet to prevent GCC warning about
multiline comments (-Wcomment) when building a project using libclang
with GCC.

Reviewed By: rjmccall

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

Added: 


Modified: 
clang/include/clang/AST/DeclOpenMP.h

Removed: 




diff  --git a/clang/include/clang/AST/DeclOpenMP.h 
b/clang/include/clang/AST/DeclOpenMP.h
index e595ec98d914..4aa5bde92e12 100644
--- a/clang/include/clang/AST/DeclOpenMP.h
+++ b/clang/include/clang/AST/DeclOpenMP.h
@@ -163,7 +163,7 @@ class OMPThreadPrivateDecl final : public 
OMPDeclarativeDirective {
 /// 'float':
 ///
 /// \code
-/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in) \
+/// #pragma omp declare reduction (foo : int,float : omp_out += omp_in)
 /// initializer (omp_priv = 0)
 /// \endcode
 ///



___
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] [mlir] f88fab5 - [mlir] NFC: fix trivial typos

2021-01-07 Thread Kazuaki Ishizaki via llvm-branch-commits

Author: Kazuaki Ishizaki
Date: 2021-01-08T02:10:12+09:00
New Revision: f88fab500689852d06dd6e30ea1a8425ed7fd0e4

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

LOG: [mlir] NFC: fix trivial typos

fix typo under include and lib directories

Reviewed By: antiagainst

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

Added: 


Modified: 
mlir/include/mlir-c/Support.h
mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
mlir/include/mlir/Dialect/Async/IR/AsyncOps.td
mlir/include/mlir/Dialect/SCF/SCFOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVGLSLOps.td
mlir/include/mlir/Dialect/StandardOps/IR/Ops.td
mlir/include/mlir/Dialect/StandardOps/Transforms/Passes.td
mlir/include/mlir/Dialect/Tosa/Utils/QuantUtils.h
mlir/include/mlir/Dialect/Vector/VectorOps.td
mlir/include/mlir/IR/ImplicitLocOpBuilder.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/Pass/PassRegistry.h
mlir/include/mlir/Support/IndentedOstream.h
mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
mlir/include/mlir/Target/LLVMIR/TypeTranslation.h
mlir/include/mlir/Transforms/Bufferize.h
mlir/lib/Analysis/AffineStructures.cpp
mlir/lib/Bindings/Python/IRModules.cpp
mlir/lib/CAPI/Transforms/Passes.cpp
mlir/lib/Conversion/GPUCommon/ConvertKernelFuncToBlob.cpp
mlir/lib/Conversion/PDLToPDLInterp/Predicate.h
mlir/lib/Conversion/SPIRVToLLVM/ConvertLaunchFuncToLLVMCalls.cpp
mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp
mlir/lib/Dialect/LLVMIR/IR/TypeDetail.h
mlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
mlir/lib/Dialect/Linalg/Transforms/Sparsification.cpp
mlir/lib/Dialect/PDL/IR/PDL.cpp
mlir/lib/Dialect/SPIRV/IR/SPIRVTypes.cpp
mlir/lib/Dialect/SPIRV/Linking/ModuleCombiner/ModuleCombiner.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/lib/Dialect/StandardOps/Transforms/ExpandOps.cpp
mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/IR/AsmPrinter.cpp
mlir/lib/Rewrite/ByteCode.h
mlir/lib/Target/SPIRV/Serialization.cpp
mlir/lib/Transforms/BufferUtils.cpp
mlir/lib/Transforms/Utils/FoldUtils.cpp
mlir/lib/Transforms/Utils/LoopUtils.cpp
mlir/lib/Transforms/Utils/RegionUtils.cpp

Removed: 




diff  --git a/mlir/include/mlir-c/Support.h b/mlir/include/mlir-c/Support.h
index 072b96051e01..6b5927afc431 100644
--- a/mlir/include/mlir-c/Support.h
+++ b/mlir/include/mlir-c/Support.h
@@ -76,7 +76,7 @@ mlirStringRefCreateFromCString(const char *str);
  *
  * This function is called back by the functions that need to return a 
reference
  * to the portion of the string with the following arguments:
- *   - an MlirStringRef represening the current portion of the string
+ *   - an MlirStringRef representing the current portion of the string
  *   - a pointer to user data forwarded from the printing call.
  */
 typedef void (*MlirStringCallback)(MlirStringRef, void *);

diff  --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h 
b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
index bc70736c7d3b..859eadadd7a8 100644
--- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
+++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVMPass.h
@@ -24,7 +24,7 @@ class OperationPass;
 /// the host module code to LLVM.
 ///
 /// This transformation creates a sequence of global variables that are later
-/// linked to the varables in the kernel module, and a series of copies to/from
+/// linked to the variables in the kernel module, and a series of copies 
to/from
 /// them to emulate the memory transfer from the host or to the device sides. 
It
 /// also converts the remaining Standard dialect into LLVM dialect, emitting C
 /// wrappers.

diff  --git a/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td 
b/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
index 6353a0001d4c..b1a42e99126c 100644
--- a/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
+++ b/mlir/include/mlir/Dialect/ArmSVE/ArmSVE.td
@@ -165,7 +165,7 @@ def SmmlaOp : ArmSVE_Op<"smmla",
 AllTypesMatch<["src1", "src2"]>,
 AllTypesMatch<["acc", "dst"]>,
   ]> {
-  let summary = "Matrix-matrix mutiply and accumulate op";
+  let summary = "Matrix-matrix multiply and accumulate op";
   let description = [{
 SMMLA: Signed integer matrix multiply-accumulate.
 
@@ -228,7 +228,7 @@ def UmmlaOp : ArmSVE_Op<"ummla",
 AllTypesMatch<["src1", "src2"]>,
 AllTypesMatch<["acc", "dst"]>,
   ]> {
-  let summary = "Matrix-matrix mutiply and accumulate op";
+  let summary = "Matrix-matrix multiply and accumulate op";
   let 

[llvm-branch-commits] [clang] 59fce6b - [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function attribute id changes

2021-01-07 Thread Lucas Prates via llvm-branch-commits

Author: Jeroen Dobbelaere
Date: 2021-01-07T17:08:15Z
New Revision: 59fce6b0661647062918a47bdb1874950d3938d5

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

LOG: [NFC] make clang/test/CodeGen/arm_neon_intrinsics.c resistent to function 
attribute id changes

When introducing support for @llvm.experimental.noalias.scope.decl, this tests 
started failing because it checks
(for no good reason) for a function attribute id of '#8' which now becomes '#9'

Reviewed By: pratlucas

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

Added: 


Modified: 
clang/test/CodeGen/arm_neon_intrinsics.c

Removed: 




diff  --git a/clang/test/CodeGen/arm_neon_intrinsics.c 
b/clang/test/CodeGen/arm_neon_intrinsics.c
index 9d3f35f48bb76..56e105a41962e 100644
--- a/clang/test/CodeGen/arm_neon_intrinsics.c
+++ b/clang/test/CodeGen/arm_neon_intrinsics.c
@@ -7114,7 +7114,7 @@ uint64x2_t test_vmlal_u32(uint64x2_t a, uint32x2_t b, 
uint32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 int32x4_t test_vmlal_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7127,7 +7127,7 @@ int32x4_t test_vmlal_lane_s16(int32x4_t a, int16x4_t b, 
int16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmulls.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 int64x2_t test_vmlal_lane_s32(int64x2_t a, int32x2_t b, int32x2_t c) {
@@ -7140,7 +7140,7 @@ int64x2_t test_vmlal_lane_s32(int64x2_t a, int32x2_t b, 
int32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmullu.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[ADD]]
 uint32x4_t test_vmlal_lane_u16(uint32x4_t a, uint16x4_t b, uint16x4_t c) {
@@ -7153,7 +7153,7 @@ uint32x4_t test_vmlal_lane_u16(uint32x4_t a, uint16x4_t 
b, uint16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <2 x i32> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <2 x i64> @llvm.arm.neon.vmullu.v2i64(<2 x 
i32> [[B]], <2 x i32> [[LANE]])
 // CHECK:   [[ADD:%.*]] = add <2 x i64> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <2 x i64> [[ADD]]
 uint64x2_t test_vmlal_lane_u32(uint64x2_t a, uint32x2_t b, uint32x2_t c) {
@@ -7618,7 +7618,7 @@ uint64x2_t test_vmlsl_u32(uint64x2_t a, uint32x2_t b, 
uint32x2_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <4 x i16> [[TMP1]], <4 x i16> 
[[TMP1]], <4 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <4 x i16> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = bitcast <4 x i16> [[LANE]] to <8 x i8>
-// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]]) #8
+// CHECK:   [[VMULL2_I:%.*]] = call <4 x i32> @llvm.arm.neon.vmulls.v4i32(<4 x 
i16> [[B]], <4 x i16> [[LANE]])
 // CHECK:   [[SUB:%.*]] = sub <4 x i32> [[A:%.*]], [[VMULL2_I]]
 // CHECK:   ret <4 x i32> [[SUB]]
 int32x4_t test_vmlsl_lane_s16(int32x4_t a, int16x4_t b, int16x4_t c) {
@@ -7631,7 +7631,7 @@ int32x4_t test_vmlsl_lane_s16(int32x4_t a, int16x4_t b, 
int16x4_t c) {
 // CHECK:   [[LANE:%.*]] = shufflevector <2 x i32> [[TMP1]], <2 x i32> 
[[TMP1]], <2 x i32> 
 // CHECK:   [[TMP2:%.*]] = bitcast <2 x i32> [[B:%.*]] to <8 x i8>
 // CHECK:   [[TMP3:%.*]] = 

[llvm-branch-commits] [mlir] 82f5ee3 - Adds argument attributes for using LLVM's sret and byval attributes to

2021-01-07 Thread Eric Schweitz via llvm-branch-commits

Author: Eric Schweitz
Date: 2021-01-07T09:03:16-08:00
New Revision: 82f5ee3c3e601daad546c320a98d9e7860d6347d

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

LOG: Adds argument attributes for using LLVM's sret and byval attributes to
the conversion of LLVM IR dialect. These attributes are used in FIR to
support the lowering of Fortran using target-specific calling
conventions.

Add roundtrip tests. Add changes per review comments/concerns.

Reviewed By: ftynse

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

Added: 


Modified: 
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Dialect/LLVMIR/func.mlir
mlir/test/Target/llvmir-invalid.mlir

Removed: 




diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 7700867bb461..86f4e7e3e2c4 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -1102,6 +1102,22 @@ LogicalResult 
ModuleTranslation::convertOneFunction(LLVMFuncOp func) {
   llvm::AttrBuilder().addAlignmentAttr(llvm::Align(attr.getInt(;
 }
 
+if (auto attr = func.getArgAttrOfType(argIdx, "llvm.sret")) {
+  auto argTy = mlirArg.getType().dyn_cast();
+  if (!argTy.isa())
+return func.emitError(
+"llvm.sret attribute attached to LLVM non-pointer argument");
+  llvmArg.addAttr(llvm::Attribute::AttrKind::StructRet);
+}
+
+if (auto attr = func.getArgAttrOfType(argIdx, "llvm.byval")) {
+  auto argTy = mlirArg.getType().dyn_cast();
+  if (!argTy.isa())
+return func.emitError(
+"llvm.byval attribute attached to LLVM non-pointer argument");
+  llvmArg.addAttr(llvm::Attribute::AttrKind::ByVal);
+}
+
 valueMapping[mlirArg] = 
 argIdx++;
   }

diff  --git a/mlir/test/Dialect/LLVMIR/func.mlir 
b/mlir/test/Dialect/LLVMIR/func.mlir
index 65dc33cc1c4f..2cec1bca1f74 100644
--- a/mlir/test/Dialect/LLVMIR/func.mlir
+++ b/mlir/test/Dialect/LLVMIR/func.mlir
@@ -87,6 +87,16 @@ module {
 llvm.return
   }
 
+  // CHECK: llvm.func @byvalattr(%{{.*}}: !llvm.ptr {llvm.byval})
+  llvm.func @byvalattr(%arg0: !llvm.ptr {llvm.byval}) {
+llvm.return
+  }
+
+  // CHECK: llvm.func @sretattr(%{{.*}}: !llvm.ptr {llvm.sret})
+  llvm.func @sretattr(%arg0: !llvm.ptr {llvm.sret}) {
+llvm.return
+  }
+
   // CHECK: llvm.func @variadic(...)
   llvm.func @variadic(...)
 

diff  --git a/mlir/test/Target/llvmir-invalid.mlir 
b/mlir/test/Target/llvmir-invalid.mlir
index 14117594e2f8..fcd98ef4b143 100644
--- a/mlir/test/Target/llvmir-invalid.mlir
+++ b/mlir/test/Target/llvmir-invalid.mlir
@@ -14,6 +14,19 @@ llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.noalias 
= true}) -> !llvm.f
 
 // -
 
+// expected-error @+1 {{llvm.sret attribute attached to LLVM non-pointer 
argument}}
+llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.sret}) -> !llvm.float {
+  llvm.return %arg0 : !llvm.float
+}
+// -
+
+// expected-error @+1 {{llvm.byval attribute attached to LLVM non-pointer 
argument}}
+llvm.func @invalid_noalias(%arg0 : !llvm.float {llvm.byval}) -> !llvm.float {
+  llvm.return %arg0 : !llvm.float
+}
+
+// -
+
 // expected-error @+1 {{llvm.align attribute attached to LLVM non-pointer 
argument}}
 llvm.func @invalid_align(%arg0 : !llvm.float {llvm.align = 4}) -> !llvm.float {
   llvm.return %arg0 : !llvm.float



___
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] db33f85 - [IR] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to guard ABI changes.

2021-01-07 Thread Varun Gandhi via llvm-branch-commits

Author: Varun Gandhi
Date: 2021-01-07T08:42:00-08:00
New Revision: db33f85c7124443e140d0118289fc141bab0c68d

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

LOG: [IR] Use LLVM_ENABLE_ABI_BREAKING_CHECKS to guard ABI changes.

Incorrect usage of NDEBUG to guard ABI changes can prevent clients
from enabling assertions for their C++ code while having assertions in
LLVM turned off. So we use LLVM_ENABLE_ABI_BREAKING_CHECKS instead, as
described in llvm/docs/ProgrammersManual.rst. Most types already use this
macro, however, there were a couple of stragglers in ValueHandle.h, which
are fixed by this revision.

Reviewed By: dblaikie, dexonsmith

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

Added: 


Modified: 
llvm/include/llvm/IR/ValueHandle.h

Removed: 




diff  --git a/llvm/include/llvm/IR/ValueHandle.h 
b/llvm/include/llvm/IR/ValueHandle.h
index badc1ca8d1f6..1324053800c7 100644
--- a/llvm/include/llvm/IR/ValueHandle.h
+++ b/llvm/include/llvm/IR/ValueHandle.h
@@ -258,13 +258,13 @@ template <> struct simplify_type {
 /// class turns into a trivial wrapper around a pointer.
 template 
 class AssertingVH
-#ifndef NDEBUG
-  : public ValueHandleBase
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
+: public ValueHandleBase
 #endif
-  {
+{
   friend struct DenseMapInfo>;
 
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   Value *getRawValPtr() const { return ValueHandleBase::getValPtr(); }
   void setRawValPtr(Value *P) { ValueHandleBase::operator=(P); }
 #else
@@ -280,7 +280,7 @@ class AssertingVH
   void setValPtr(ValueTy *P) { setRawValPtr(GetAsValue(P)); }
 
 public:
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   AssertingVH() : ValueHandleBase(Assert) {}
   AssertingVH(ValueTy *P) : ValueHandleBase(Assert, GetAsValue(P)) {}
   AssertingVH(const AssertingVH ) : ValueHandleBase(Assert, RHS) {}
@@ -443,7 +443,7 @@ class CallbackVH : public ValueHandleBase {
 /// class turns into a trivial wrapper around a pointer.
 template 
 class PoisoningVH
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
 final : public CallbackVH
 #endif
 {
@@ -453,7 +453,7 @@ class PoisoningVH
   static Value *GetAsValue(Value *V) { return V; }
   static Value *GetAsValue(const Value *V) { return const_cast(V); }
 
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   /// A flag tracking whether this value has been poisoned.
   ///
   /// On delete and RAUW, we leave the value pointer alone so that as a raw
@@ -478,7 +478,7 @@ class PoisoningVH
 Poisoned = true;
 RemoveFromUseList();
   }
-#else // NDEBUG
+#else // LLVM_ENABLE_ABI_BREAKING_CHECKS
   Value *ThePtr = nullptr;
 
   Value *getRawValPtr() const { return ThePtr; }
@@ -493,7 +493,7 @@ class PoisoningVH
 
 public:
   PoisoningVH() = default;
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
   PoisoningVH(ValueTy *P) : CallbackVH(GetAsValue(P)) {}
   PoisoningVH(const PoisoningVH )
   : CallbackVH(RHS), Poisoned(RHS.Poisoned) {}



___
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] e881a25 - [NFC] Removed unused prefixes in CodeGen/AMDGPU

2021-01-07 Thread Mircea Trofin via llvm-branch-commits

Author: Mircea Trofin
Date: 2021-01-07T08:00:11-08:00
New Revision: e881a25f1e110b259030745b3592418ea0c8efe8

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

LOG: [NFC] Removed unused prefixes in CodeGen/AMDGPU

This covers tests starting with s.

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

Added: 


Modified: 
llvm/test/CodeGen/AMDGPU/s_code_end.ll
llvm/test/CodeGen/AMDGPU/saddo.ll
llvm/test/CodeGen/AMDGPU/saddsat.ll
llvm/test/CodeGen/AMDGPU/scalar_to_vector.ll
llvm/test/CodeGen/AMDGPU/schedule-regpressure-limit2.ll
llvm/test/CodeGen/AMDGPU/scratch-simple.ll
llvm/test/CodeGen/AMDGPU/sdiv.ll
llvm/test/CodeGen/AMDGPU/sdwa-vop2-64bit.mir
llvm/test/CodeGen/AMDGPU/select-fabs-fneg-extract-legacy.ll
llvm/test/CodeGen/AMDGPU/select.f16.ll
llvm/test/CodeGen/AMDGPU/sendmsg-m0-hazard.mir
llvm/test/CodeGen/AMDGPU/setcc-fneg-constant.ll
llvm/test/CodeGen/AMDGPU/setcc64.ll
llvm/test/CodeGen/AMDGPU/sext-in-reg.ll
llvm/test/CodeGen/AMDGPU/shift-i64-opts.ll
llvm/test/CodeGen/AMDGPU/shl.ll
llvm/test/CodeGen/AMDGPU/shl.v2i16.ll
llvm/test/CodeGen/AMDGPU/shl_add_ptr_csub.ll
llvm/test/CodeGen/AMDGPU/shl_add_ptr_global.ll
llvm/test/CodeGen/AMDGPU/shrink-add-sub-constant.ll
llvm/test/CodeGen/AMDGPU/sibling-call.ll
llvm/test/CodeGen/AMDGPU/sign_extend.ll
llvm/test/CodeGen/AMDGPU/sint_to_fp.i64.ll
llvm/test/CodeGen/AMDGPU/skip-branch-trap.ll
llvm/test/CodeGen/AMDGPU/smrd.ll
llvm/test/CodeGen/AMDGPU/spill-agpr-partially-undef.mir
llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll
llvm/test/CodeGen/AMDGPU/spill-special-sgpr.mir
llvm/test/CodeGen/AMDGPU/ssubsat.ll
llvm/test/CodeGen/AMDGPU/store-local.128.ll
llvm/test/CodeGen/AMDGPU/store-local.96.ll
llvm/test/CodeGen/AMDGPU/store-weird-sizes.ll
llvm/test/CodeGen/AMDGPU/sub.v2i16.ll

Removed: 




diff  --git a/llvm/test/CodeGen/AMDGPU/s_code_end.ll 
b/llvm/test/CodeGen/AMDGPU/s_code_end.ll
index 80f49427f56e..2c7ce12f8f30 100644
--- a/llvm/test/CodeGen/AMDGPU/s_code_end.ll
+++ b/llvm/test/CodeGen/AMDGPU/s_code_end.ll
@@ -1,7 +1,7 @@
-; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END,GFX10END-ASM %s
-; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=obj < %s | 
llvm-objdump --arch=amdgcn --mcpu=gfx1010 -d - | FileCheck 
--check-prefixes=GCN,GCN-OBJ,GFX10END,GFX10END-OBJ %s
-; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END,GFX10END-ASM %s
-; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10NOEND,GFX10NOEND-ASM %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END-ASM %s
+; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1010 -filetype=obj < %s | 
llvm-objdump --arch=amdgcn --mcpu=gfx1010 -d - | FileCheck 
--check-prefixes=GCN,GCN-OBJ,GFX10END-OBJ %s
+; RUN: llc -mtriple=amdgcn-amd-amdpal -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10END-ASM %s
+; RUN: llc -mtriple=amdgcn-mesa-mesa3d -mcpu=gfx1010 -asm-verbose=0 < %s | 
FileCheck -check-prefixes=GCN,GCN-ASM,GFX10NOEND %s
 ; RUN: llc -mtriple=amdgcn-- -mcpu=gfx1010 -filetype=obj < %s | llvm-objdump 
--arch=amdgcn --mcpu=gfx1010 -d - | FileCheck 
--check-prefixes=GCN,GCN-OBJ,GFX10NOEND,GFX10NOEND-OBJ %s
 
 ; GCN:a_kernel1{{>?}}:

diff  --git a/llvm/test/CodeGen/AMDGPU/saddo.ll 
b/llvm/test/CodeGen/AMDGPU/saddo.ll
index d01dbbfce000..0a223e8ba2c2 100644
--- a/llvm/test/CodeGen/AMDGPU/saddo.ll
+++ b/llvm/test/CodeGen/AMDGPU/saddo.ll
@@ -1,7 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn 
-mcpu=tahiti -verify-machineinstrs | FileCheck %s 
-check-prefixes=FUNC,GCN,SICIVI,SI
-; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga 
-verify-machineinstrs | FileCheck %s -check-prefixes=FUNC,GCN,SICIVI,VI
-; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn 
-mcpu=gfx900 -verify-machineinstrs | FileCheck %s -check-prefixes=FUNC,GCN,GFX9
+; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn 
-mcpu=tahiti -verify-machineinstrs | FileCheck %s --check-prefix=SI
+; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn -mcpu=tonga 
-verify-machineinstrs | FileCheck %s --check-prefix=VI
+; RUN: llc < %s -amdgpu-scalarize-global-loads=false -march=amdgcn 
-mcpu=gfx900 -verify-machineinstrs | FileCheck %s --check-prefix=GFX9
 
 
 declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, 

[llvm-branch-commits] [llvm] f401335 - [SVE] Add unpacked scalable floating point ZIP/UZP/TRN patterns

2021-01-07 Thread Cameron McInally via llvm-branch-commits

Author: Cameron McInally
Date: 2021-01-07T09:56:53-06:00
New Revision: f4013359b3da2c78e94a64245de8638460f96c1a

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

LOG: [SVE] Add unpacked scalable floating point ZIP/UZP/TRN patterns

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

Added: 


Modified: 
llvm/lib/Target/AArch64/SVEInstrFormats.td
llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td 
b/llvm/lib/Target/AArch64/SVEInstrFormats.td
index 1020a81a3494..b4416135eeb5 100644
--- a/llvm/lib/Target/AArch64/SVEInstrFormats.td
+++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td
@@ -2270,6 +2270,8 @@ multiclass sve_int_perm_bin_perm_zz opc, string 
asm,
   def : SVE_2_Op_Pat(NAME # 
_H)>;
   def : SVE_2_Op_Pat(NAME # 
_S)>;
   def : SVE_2_Op_Pat(NAME # 
_S)>;
+  def : SVE_2_Op_Pat(NAME # 
_D)>;
+  def : SVE_2_Op_Pat(NAME # 
_D)>;
   def : SVE_2_Op_Pat(NAME # 
_D)>;
 
   def : SVE_2_Op_Pat(NAME 
# _H)>;

diff  --git a/llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll 
b/llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
index b248d209f44a..9f0d71e6a7b6 100644
--- a/llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
+++ b/llvm/test/CodeGen/AArch64/sve-intrinsics-perm-select.ll
@@ -1277,6 +1277,15 @@ define  @trn1_i64( 
%a,  %b
   ret  %out
 }
 
+define  @trn1_f16_v2( %a,  %b) {
+; CHECK-LABEL: trn1_f16_v2:
+; CHECK: trn1 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.trn1.nxv2f16( %a,
+  %b)
+  ret  %out
+}
+
 define  @trn1_f16_v4( %a,  %b) {
 ; CHECK-LABEL: trn1_f16_v4:
 ; CHECK: trn1 z0.s, z0.s, z1.s
@@ -1304,6 +1313,15 @@ define  @trn1_f16( 
%a, 
   ret  %out
 }
 
+define  @trn1_f32_v2( %a,  %b) {
+; CHECK-LABEL: trn1_f32_v2:
+; CHECK: trn1 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.trn1.nxv2f32( %a,
+   %b)
+  ret  %out
+}
+
 define  @trn1_f32( %a,  %b) {
 ; CHECK-LABEL: trn1_f32:
 ; CHECK: trn1 z0.s, z0.s, z1.s
@@ -1398,6 +1416,15 @@ define  @trn2_i64( 
%a,  %b
   ret  %out
 }
 
+define  @trn2_f16_v2( %a,  %b) {
+; CHECK-LABEL: trn2_f16_v2:
+; CHECK: trn2 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.trn2.nxv2f16( %a,
+  %b)
+  ret  %out
+}
+
 define  @trn2_f16_v4( %a,  %b) {
 ; CHECK-LABEL: trn2_f16_v4:
 ; CHECK: trn2 z0.s, z0.s, z1.s
@@ -1425,6 +1452,15 @@ define  @trn2_f16( 
%a, 
   ret  %out
 }
 
+define  @trn2_f32_v2( %a,  %b) {
+; CHECK-LABEL: trn2_f32_v2:
+; CHECK: trn2 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.trn2.nxv2f32( %a,
+   %b)
+  ret  %out
+}
+
 define  @trn2_f32( %a,  %b) {
 ; CHECK-LABEL: trn2_f32:
 ; CHECK: trn2 z0.s, z0.s, z1.s
@@ -1519,6 +1555,15 @@ define  @uzp1_i64( 
%a,  %b
   ret  %out
 }
 
+define  @uzp1_f16_v2( %a,  %b) {
+; CHECK-LABEL: uzp1_f16_v2:
+; CHECK: uzp1 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.uzp1.nxv2f16( %a,
+  %b)
+  ret  %out
+}
+
 define  @uzp1_f16_v4( %a,  %b) {
 ; CHECK-LABEL: uzp1_f16_v4:
 ; CHECK: uzp1 z0.s, z0.s, z1.s
@@ -1546,6 +1591,15 @@ define  @uzp1_f16( 
%a, 
   ret  %out
 }
 
+define  @uzp1_f32_v2( %a,  %b) {
+; CHECK-LABEL: uzp1_f32_v2:
+; CHECK: uzp1 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.uzp1.nxv2f32( %a,
+   %b)
+  ret  %out
+}
+
 define  @uzp1_f32( %a,  %b) {
 ; CHECK-LABEL: uzp1_f32:
 ; CHECK: uzp1 z0.s, z0.s, z1.s
@@ -1640,6 +1694,15 @@ define  @uzp2_i64( 
%a,  %b
   ret  %out
 }
 
+define  @uzp2_f16_v2( %a,  %b) {
+; CHECK-LABEL: uzp2_f16_v2:
+; CHECK: uzp2 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.uzp2.nxv2f16( %a,
+  %b)
+  ret  %out
+}
+
 define  @uzp2_f16_v4( %a,  %b) {
 ; CHECK-LABEL: uzp2_f16_v4:
 ; CHECK: uzp2 z0.s, z0.s, z1.s
@@ -1667,6 +1730,15 @@ define  @uzp2_f16( 
%a, 
   ret  %out
 }
 
+define  @uzp2_f32_v2( %a,  %b) {
+; CHECK-LABEL: uzp2_f32_v2:
+; CHECK: uzp2 z0.d, z0.d, z1.d
+; CHECK-NEXT: ret
+  %out = call  @llvm.aarch64.sve.uzp2.nxv2f32( %a,
+   %b)
+  ret  %out
+}
+
 define  @uzp2_f32( %a,  %b) {
 ; CHECK-LABEL: uzp2_f32:
 ; CHECK: uzp2 z0.s, z0.s, z1.s
@@ -1761,6 +1833,15 @@ define  @zip1_i64( 
%a,  %b
   ret  %out
 }
 
+define  @zip1_f16_v2( %a,  %b) {
+; CHECK-LABEL: zip1_f16_v2:
+; CHECK: zip1 z0.d, 

[llvm-branch-commits] [llvm] 573d578 - [DDG] Data Dependence Graph - DOT printer tests

2021-01-07 Thread Bardia Mahjour via llvm-branch-commits

Author: Bardia Mahjour
Date: 2021-01-07T10:51:14-05:00
New Revision: 573d5782482841e16588e81be687ea6bcf3624fa

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

LOG: [DDG] Data Dependence Graph - DOT printer tests

Adds some tests to check the formatting of the dot
file produced when using -dot-ddg.

Reviewed By: Meinersbur

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

Added: 
llvm/test/Analysis/DDG/print-dot-ddg.ll

Modified: 


Removed: 




diff  --git a/llvm/test/Analysis/DDG/print-dot-ddg.ll 
b/llvm/test/Analysis/DDG/print-dot-ddg.ll
new file mode 100644
index ..8a4d55bc2e8b
--- /dev/null
+++ b/llvm/test/Analysis/DDG/print-dot-ddg.ll
@@ -0,0 +1,74 @@
+; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg 
-dot-ddg-filename-prefix=out.full < %s 2>&1 > /dev/null
+; RUN: FileCheck %s -input-file=out.full.foo.for.body.dot
+; RUN: opt -aa-pipeline=basic-aa -passes=dot-ddg 
-dot-ddg-filename-prefix=out.only -dot-ddg-only < %s 2>&1 > /dev/null
+; RUN: FileCheck %s -input-file=out.only.foo.for.body.dot 
-check-prefix=CHECK-ONLY
+
+target datalayout = "e-m:e-i64:64-n32:64-v256:256:256-v512:512:512"
+
+; Test the dot graph printer for a non-trivial DDG graph generated from
+; the following test case. In particular it tests that pi-blocks are
+; printed properly and that multiple memory dependencies on a single edge
+; are shown in the full dot graph.
+;
+; void foo(float * restrict A, float * restrict B, int n) {
+;   for (int i = 0; i < n; i++) {
+; A[i] = A[i] + B[i];
+; B[i+1] = A[i] + 1;
+;   }
+; }
+
+
+; CHECK: digraph "DDG for 'foo.for.body'"
+; CHECK-NEXT: label="DDG for 'foo.for.body'";
+; CHECK: {{Node0x.*}} [shape=record,label="{\\nroot\n}"]
+; CHECK: {{Node0x.*}} -> {{Node0x.*}}[label="[rooted]"]
+; CHECK-COUNT-6: {{Node0x.*}} -> {{Node0x.*}}[label="[def-use]"]
+; CHECK-NOT: {{Node0x.*}} -> {{Node0x.*}}[label="[def-use]"]
+; CHECK: [shape=record,label="{\\n  %arrayidx10 = 
getelementptr inbounds float, float* %B, i64 %indvars.iv.next\n}"];
+; CHECK: [shape=record,label="{\\n  %arrayidx = 
getelementptr inbounds float, float* %A, i64 %indvars.iv\n  %0 = load float, 
float* %arrayidx, align 4\n}"];
+; CHECK: {{Node0x.*}} -> {{Node0x.*}}[label="[consistent anti [0|<]!, 
consistent input [0|<]!]"]
+; CHECK: [shape=record,label="{\\n--- start of nodes in 
pi-block ---\n\\n  %1 = load float, float* 
%arrayidx2, align 4\n\n\\n  %add = fadd fast float 
%0, %1\n\n\\n  store float %add, float* %arrayidx4, 
align 4\n\n\\n  %2 = load float, float* %arrayidx6, 
align 4\n  %add7 = fadd fast float %2, 
1.00e+00\n\n\\n  store float %add7, float* 
%arrayidx10, align 4\n--- end of nodes in pi-block ---\n}"];
+
+; CHECK-ONLY: digraph "DDG for 'foo.for.body'"
+; CHECK-ONLY-NEXT: label="DDG for 'foo.for.body'";
+; CHECK-ONLY: [shape=record,label="{pi-block\nwith\n2 nodes\n}"];
+; CHECK-ONLY-COUNT-6: {{Node0x.*}} -> {{Node0x.*}}[label="[def-use]"];
+; CHECK-NOT: {{Node0x.*}} -> {{Node0x.*}}[label="[def-use]"];
+; CHECK-ONLY: [shape=record,label="{  %arrayidx10 = getelementptr inbounds 
float, float* %B, i64 %indvars.iv.next\n}"];
+; CHECK-ONLY: [shape=record,label="{  %arrayidx = getelementptr inbounds 
float, float* %A, i64 %indvars.iv\n  %0 = load float, float* %arrayidx, align 
4\n}"];
+; CHECK-ONLY: {{Node0x.*}} -> {{Node0x.*}}[label="[memory]"]
+; CHECK-ONLY: [shape=record,label="{pi-block\nwith\n5 nodes\n}"];
+
+define void @foo(float* noalias %A, float* noalias %B, i32 signext %n) {
+entry:
+  %cmp1 = icmp sgt i32 %n, 0
+  br i1 %cmp1, label %for.body.preheader, label %for.end
+
+for.body.preheader:   ; preds = %entry
+  %wide.trip.count = zext i32 %n to i64
+  br label %for.body
+
+for.body: ; preds = 
%for.body.preheader, %for.body
+  %indvars.iv = phi i64 [ 0, %for.body.preheader ], [ %indvars.iv.next, 
%for.body ]
+  %arrayidx = getelementptr inbounds float, float* %A, i64 %indvars.iv
+  %0 = load float, float* %arrayidx, align 4
+  %arrayidx2 = getelementptr inbounds float, float* %B, i64 %indvars.iv
+  %1 = load float, float* %arrayidx2, align 4
+  %add = fadd fast float %0, %1
+  %arrayidx4 = getelementptr inbounds float, float* %A, i64 %indvars.iv
+  store float %add, float* %arrayidx4, align 4
+  %arrayidx6 = getelementptr inbounds float, float* %A, i64 %indvars.iv
+  %2 = load float, float* %arrayidx6, align 4
+  %add7 = fadd fast float %2, 1.00e+00
+  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+  %arrayidx10 = getelementptr inbounds float, float* %B, i64 %indvars.iv.next
+  store float %add7, float* %arrayidx10, align 4
+  %exitcond = icmp ne i64 %indvars.iv.next, %wide.trip.count
+  br i1 %exitcond, label %for.body, label %for.end.loopexit
+
+for.end.loopexit:

[llvm-branch-commits] [llvm] 6b7d5a9 - AMDGPU/GlobalISel: Start cleaning up calling convention lowering

2021-01-07 Thread Matt Arsenault via llvm-branch-commits

Author: Matt Arsenault
Date: 2021-01-07T10:36:45-05:00
New Revision: 6b7d5a928f5e0d5321b641909f84cb238e8194b8

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

LOG: AMDGPU/GlobalISel: Start cleaning up calling convention lowering

There are various hacks working around limitations in
handleAssignments, and the logical split between different parts isn't
correct. Start separating the type legalization to satisfy going
through the DAG infrastructure from the code required to split into
register types. The type splitting should be moved to generic code.

Added: 


Modified: 
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
llvm/lib/Target/AMDGPU/AMDGPUCallLowering.h
llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call-non-fixed.ll
llvm/test/CodeGen/AMDGPU/GlobalISel/irtranslator-call.ll

Removed: 




diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp 
b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
index bf8e57d591e1..a6790c9ac975 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUCallLowering.cpp
@@ -248,18 +248,18 @@ struct AMDGPUOutgoingArgHandler : public 
AMDGPUValueHandler {
   }
 
   void assignValueToAddress(const CallLowering::ArgInfo , Register Addr,
-uint64_t Size, MachinePointerInfo ,
+uint64_t MemSize, MachinePointerInfo ,
 CCValAssign ) override {
 Register ValVReg = VA.getLocInfo() != CCValAssign::LocInfo::FPExt
? extendRegister(Arg.Regs[0], VA)
: Arg.Regs[0];
 
-// If we extended we might need to adjust the MMO's Size.
+// If we extended the value type we might need to adjust the MMO's
+// Size. This happens if ComputeValueVTs widened a small type value to a
+// legal register type (e.g. s8->s16)
 const LLT RegTy = MRI.getType(ValVReg);
-if (RegTy.getSizeInBytes() > Size)
-  Size = RegTy.getSizeInBytes();
-
-assignValueToAddress(ValVReg, Addr, Size, MPO, VA);
+MemSize = std::min(MemSize, (uint64_t)RegTy.getSizeInBytes());
+assignValueToAddress(ValVReg, Addr, MemSize, MPO, VA);
   }
 };
 }
@@ -282,49 +282,64 @@ static ISD::NodeType extOpcodeToISDExtOpcode(unsigned 
MIOpc) {
   }
 }
 
-void AMDGPUCallLowering::splitToValueTypes(
-  MachineIRBuilder ,
-  const ArgInfo ,
-  SmallVectorImpl ,
-  const DataLayout , CallingConv::ID CallConv,
-  bool IsOutgoing,
-  SplitArgTy PerformArgSplit) const {
+// FIXME: This should move to generic code.
+void AMDGPUCallLowering::splitToValueTypes(MachineIRBuilder ,
+   const ArgInfo ,
+   SmallVectorImpl ,
+   const DataLayout ,
+   CallingConv::ID CallConv) const {
   const SITargetLowering  = *getTLI();
   LLVMContext  = OrigArg.Ty->getContext();
 
-  if (OrigArg.Ty->isVoidTy())
-return;
-
   SmallVector SplitVTs;
   ComputeValueVTs(TLI, DL, OrigArg.Ty, SplitVTs);
 
   assert(OrigArg.Regs.size() == SplitVTs.size());
 
-  int SplitIdx = 0;
-  for (EVT VT : SplitVTs) {
-Register Reg = OrigArg.Regs[SplitIdx];
-Type *Ty = VT.getTypeForEVT(Ctx);
-LLT LLTy = getLLTForType(*Ty, DL);
+  if (SplitVTs.size() == 0)
+return;
 
-if (IsOutgoing && VT.isScalarInteger()) {
-  unsigned ExtendOp = TargetOpcode::G_ANYEXT;
-  if (OrigArg.Flags[0].isSExt()) {
-assert(OrigArg.Regs.size() == 1 && "expect only simple return values");
-ExtendOp = TargetOpcode::G_SEXT;
-  } else if (OrigArg.Flags[0].isZExt()) {
-assert(OrigArg.Regs.size() == 1 && "expect only simple return values");
-ExtendOp = TargetOpcode::G_ZEXT;
-  }
+  if (SplitVTs.size() == 1) {
+// No splitting to do, but we want to replace the original type (e.g. [1 x
+// double] -> double).
+SplitArgs.emplace_back(OrigArg.Regs[0], SplitVTs[0].getTypeForEVT(Ctx),
+   OrigArg.Flags[0], OrigArg.IsFixed);
+return;
+  }
 
-  EVT ExtVT = TLI.getTypeForExtReturn(Ctx, VT,
-  extOpcodeToISDExtOpcode(ExtendOp));
-  if (ExtVT.getSizeInBits() != VT.getSizeInBits()) {
-VT = ExtVT;
-Ty = ExtVT.getTypeForEVT(Ctx);
-LLTy = getLLTForType(*Ty, DL);
-Reg = B.buildInstr(ExtendOp, {LLTy}, {Reg}).getReg(0);
-  }
-}
+  // Create one ArgInfo for each virtual register in the original ArgInfo.
+  assert(OrigArg.Regs.size() == SplitVTs.size() && "Regs / types mismatch");
+
+  bool NeedsRegBlock = TLI.functionArgumentNeedsConsecutiveRegisters(
+  OrigArg.Ty, CallConv, false);
+  for (unsigned i = 0, e = SplitVTs.size(); i < 

[llvm-branch-commits] [llvm] ebfe4de - [DDG] Fix duplicate edge removal during pi-block formation

2021-01-07 Thread Bardia Mahjour via llvm-branch-commits

Author: Bardia Mahjour
Date: 2021-01-07T10:31:11-05:00
New Revision: ebfe4de2c04b09d3ae935325e6c02c68f2965b00

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

LOG: [DDG] Fix duplicate edge removal during pi-block formation

When creating pi-blocks we try to avoid creating duplicate edges
between outside nodes and the pi-block when an edge is of the
same kind and direction as another one that has already been
created. We do this by keeping track of the edges in an
enumerated array called EdgeAlreadyCreated. The problem is that
this array is declared local to the loop that iterates over the
nodes in the pi-block, so the information gets lost every time a
new inside-node is iterated over. The fix is to move the
declaration to the outer loop.

Reviewed By: Meinersbur

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

Added: 


Modified: 
llvm/lib/Analysis/DependenceGraphBuilder.cpp
llvm/unittests/Analysis/DDGTest.cpp

Removed: 




diff  --git a/llvm/lib/Analysis/DependenceGraphBuilder.cpp 
b/llvm/lib/Analysis/DependenceGraphBuilder.cpp
index fbf0f6651599..04a34472659c 100644
--- a/llvm/lib/Analysis/DependenceGraphBuilder.cpp
+++ b/llvm/lib/Analysis/DependenceGraphBuilder.cpp
@@ -140,75 +140,74 @@ template  void 
AbstractDependenceGraphBuilder::createPiBlocks() {
   if (*N == PiNode || NodesInSCC.count(N))
 continue;
 
-  for (NodeType *SCCNode : NL) {
-
-enum Direction {
-  Incoming,  // Incoming edges to the SCC
-  Outgoing,  // Edges going ot of the SCC
-  DirectionCount // To make the enum usable as an array index.
-};
-
-// Use these flags to help us avoid creating redundant edges. If there
-// are more than one edges from an outside node to inside nodes, we 
only
-// keep one edge from that node to the pi-block node. Similarly, if
-// there are more than one edges from inside nodes to an outside node,
-// we only keep one edge from the pi-block node to the outside node.
-// There is a flag defined for each direction (incoming vs outgoing) 
and
-// for each type of edge supported, using a two-dimensional boolean
-// array.
-using EdgeKind = typename EdgeType::EdgeKind;
-EnumeratedArray EdgeAlreadyCreated[DirectionCount]{
-false, false};
-
-auto createEdgeOfKind = [this](NodeType , NodeType ,
-   const EdgeKind K) {
-  switch (K) {
-  case EdgeKind::RegisterDefUse:
-createDefUseEdge(Src, Dst);
-break;
-  case EdgeKind::MemoryDependence:
-createMemoryEdge(Src, Dst);
-break;
-  case EdgeKind::Rooted:
-createRootedEdge(Src, Dst);
-break;
-  default:
-llvm_unreachable("Unsupported type of edge.");
-  }
-};
-
-auto reconnectEdges = [&](NodeType *Src, NodeType *Dst, NodeType *New,
-  const Direction Dir) {
-  if (!Src->hasEdgeTo(*Dst))
-return;
-  LLVM_DEBUG(dbgs()
- << "reconnecting("
- << (Dir == Direction::Incoming ? "incoming)" : 
"outgoing)")
- << ":\nSrc:" << *Src << "\nDst:" << *Dst
- << "\nNew:" << *New << "\n");
-  assert((Dir == Direction::Incoming || Dir == Direction::Outgoing) &&
- "Invalid direction.");
-
-  SmallVector EL;
-  Src->findEdgesTo(*Dst, EL);
-  for (EdgeType *OldEdge : EL) {
-EdgeKind Kind = OldEdge->getKind();
-if (!EdgeAlreadyCreated[Dir][Kind]) {
-  if (Dir == Direction::Incoming) {
-createEdgeOfKind(*Src, *New, Kind);
-LLVM_DEBUG(dbgs() << "created edge from Src to New.\n");
-  } else if (Dir == Direction::Outgoing) {
-createEdgeOfKind(*New, *Dst, Kind);
-LLVM_DEBUG(dbgs() << "created edge from New to Dst.\n");
-  }
-  EdgeAlreadyCreated[Dir][Kind] = true;
+  enum Direction {
+Incoming,  // Incoming edges to the SCC
+Outgoing,  // Edges going ot of the SCC
+DirectionCount // To make the enum usable as an array index.
+  };
+
+  // Use these flags to help us avoid creating redundant edges. If there
+  // are more than one edges from an outside node to inside nodes, we only
+  // keep one edge from that node to the pi-block node. Similarly, if
+  // there are more than one edges from inside nodes to an outside node,
+  // we only keep one edge from the pi-block node to the outside node.
+  // There is a flag defined for 

[llvm-branch-commits] [llvm] 6be1fd6 - [SimplifyCFG] FoldValueComparisonIntoPredecessors(): drop reachable errneous assert

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-07T18:05:04+03:00
New Revision: 6be1fd6b20f3418543a50ce9b04ab4a49585a7eb

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

LOG: [SimplifyCFG] FoldValueComparisonIntoPredecessors(): drop reachable 
errneous assert

I have added it in d15d81c because it *seemed* correct, was holding
for all the tests so far, and was validating the fix added in the same
commit, but as David Major is pointing out (with a reproducer),
the assertion isn't really correct after all. So remove it.

Note that the d15d81c still fine.

Added: 

llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll

Modified: 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp 
b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 3fbc22a85be4..9aedb918ac32 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1261,7 +1261,6 @@ bool 
SimplifyCFGOpt::FoldValueComparisonIntoPredecessors(Instruction *TI,
   // Okay, at this point, we know which new successor Pred will get.  Make
   // sure we update the number of entries in the PHI nodes for these
   // successors.
-  assert(!NewSuccessors.empty() && "Should be adding some new 
successors.");
   for (const std::pair  :
NewSuccessors) {
 for (auto I : seq(0, NewSuccessor.second)) {

diff  --git 
a/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
 
b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
new file mode 100644
index ..03490c9ac34b
--- /dev/null
+++ 
b/llvm/test/Transforms/SimplifyCFG/FoldValueComparisonIntoPredecessors-no-new-successors.ll
@@ -0,0 +1,35 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -simplifycfg -simplifycfg-require-and-preserve-domtree=1 < %s | 
FileCheck %s
+
+define void @widget(i32 %arg) {
+; CHECK-LABEL: @widget(
+; CHECK-NEXT:  bb:
+; CHECK-NEXT:[[SWITCH:%.*]] = icmp ult i32 [[ARG:%.*]], 2
+; CHECK-NEXT:br i1 [[SWITCH]], label [[BB2:%.*]], label [[INFLOOP:%.*]]
+; CHECK:   bb2:
+; CHECK-NEXT:ret void
+; CHECK:   infloop:
+; CHECK-NEXT:br label [[INFLOOP]]
+;
+bb:
+  %tmp = icmp eq i32 %arg, 0
+  br i1 %tmp, label %bb2, label %bb1
+
+bb1:  ; preds = %bb1
+  %tmp4 = icmp eq i32 %arg, 1
+  br i1 %tmp4, label %bb6, label %bb5
+
+bb5:  ; preds = %bb5, %bb5
+  switch i32 %arg, label %bb5 [
+  i32 0, label %bb9
+  ]
+
+bb2:
+  ret void
+
+bb6:  ; preds = %bb1
+  ret void
+
+bb9:  ; preds = %bb5
+  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] [llvm] 8dee0b4 - [llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of globals w/ comdat/non-external linkage

2021-01-07 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2021-01-07T18:05:03+03:00
New Revision: 8dee0b4bd6376f5518accf45e9ecc4a44a4c8481

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

LOG: [llvm-reduce] ReduceGlobalVarInitializers delta pass: fix handling of 
globals w/ comdat/non-external linkage

Much like with ReduceFunctionBodies delta pass,
we need to remove comdat and set linkage to external,
else verifier will complain, and our deltas are invalid.

Added: 


Modified: 
llvm/test/Reduce/remove-global-vars.ll
llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp

Removed: 




diff  --git a/llvm/test/Reduce/remove-global-vars.ll 
b/llvm/test/Reduce/remove-global-vars.ll
index d078cad6b995..e791fd50bf7c 100644
--- a/llvm/test/Reduce/remove-global-vars.ll
+++ b/llvm/test/Reduce/remove-global-vars.ll
@@ -4,16 +4,25 @@
 ; RUN: llvm-reduce --test FileCheck --test-arg 
--check-prefixes=CHECK-ALL,CHECK-INTERESTINGNESS --test-arg %s --test-arg 
--input-file %s -o %t
 ; RUN: cat %t | FileCheck --check-prefixes=CHECK-ALL,CHECK-FINAL 
--implicit-check-not=uninteresting %s
 
+$interesting5 = comdat any
+
 ; CHECK-INTERESTINGNESS: @interesting = {{.*}}global i32{{.*}}, align 4
 ; CHECK-INTERESTINGNESS: @interesting2 = global i32 0, align 4
 ; CHECK-INTERESTINGNESS: @interesting3 = {{.*}}global i32{{.*}}, align 4
+; CHECK-INTERESTINGNESS: @interesting4 = {{.*}}constant i32{{.*}}, align 4
+; CHECK-INTERESTINGNESS: @interesting5 = {{.*}}global i32{{.*}}, align 4
 
 ; CHECK-FINAL: @interesting = external global i32, align 4
 ; CHECK-FINAL: @interesting2 = global i32 0, align 4
 ; CHECK-FINAL: @interesting3 = external global i32, align 4
+; CHECK-FINAL: @interesting4 = external dso_local constant i32, align 4
+; CHECK-FINAL: @interesting5 = external global i32, align 4
 @interesting = global i32 0, align 4
 @interesting2 = global i32 0, align 4
 @interesting3 = external global i32, align 4
+@interesting4 = private constant i32 2, align 4
+@interesting5 = global i32 2, align 4, comdat
+
 @uninteresting = global i32 1, align 4
 @uninteresting2 = external global i32, align 4
 

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp 
b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
index 1128710f64c4..fd5a5d1f02c6 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceGlobalVarInitializers.cpp
@@ -13,6 +13,7 @@
 
 #include "ReduceGlobalVarInitializers.h"
 #include "llvm/IR/Constants.h"
+#include "llvm/IR/GlobalValue.h"
 
 using namespace llvm;
 
@@ -23,8 +24,11 @@ static void extractGVsFromModule(std::vector 
ChunksToKeep,
 
   // Drop initializers of out-of-chunk GVs
   for (auto  : Program->globals())
-if (GV.hasInitializer() && !O.shouldKeep())
+if (GV.hasInitializer() && !O.shouldKeep()) {
   GV.setInitializer(nullptr);
+  GV.setLinkage(GlobalValue::LinkageTypes::ExternalLinkage);
+  GV.setComdat(nullptr);
+}
 }
 
 /// Counts the amount of initialized GVs and displays their



___
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] 048f184 - [SplitEdge] Add new parameter to SplitEdge to name the newly created basic block

2021-01-07 Thread Sidharth Baveja via llvm-branch-commits

Author: Sidharth Baveja
Date: 2021-01-07T14:49:23Z
New Revision: 048f184ee488cdc8dadc0b8f9d1def9e6b469a73

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

LOG: [SplitEdge] Add new parameter to SplitEdge to name the newly created basic 
block

Summary:
Currently SplitEdge does not support passing in parameter which allows you to
name the newly created BasicBlock.

This patch updates the function such that the name of the block can be passed
in, if users of this utility decide to do so.

Reviewed By: Whitney, bmahjour, asbirlea, jamieschmeiser

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

Added: 


Modified: 
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp

Removed: 




diff  --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h 
b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 64c569de1f58..a1d5ee8fb91b 100644
--- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -196,7 +196,8 @@ struct CriticalEdgeSplittingOptions {
 /// to.
 BasicBlock *SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
   const CriticalEdgeSplittingOptions  =
-  CriticalEdgeSplittingOptions());
+  CriticalEdgeSplittingOptions(),
+  const Twine  = "");
 
 inline BasicBlock *
 SplitCriticalEdge(BasicBlock *BB, succ_iterator SI,
@@ -248,7 +249,8 @@ unsigned SplitAllCriticalEdges(Function ,
 /// basic block between \p From and \p To.
 BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To,
   DominatorTree *DT = nullptr, LoopInfo *LI = nullptr,
-  MemorySSAUpdater *MSSAU = nullptr);
+  MemorySSAUpdater *MSSAU = nullptr,
+  const Twine  = "");
 
 /// Split the specified block at the specified instruction.
 ///

diff  --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp 
b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index 5b8bc184daca..09888db063e2 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -495,14 +495,16 @@ void llvm::ReplaceInstWithInst(Instruction *From, 
Instruction *To) {
 }
 
 BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock *Succ, DominatorTree 
*DT,
-LoopInfo *LI, MemorySSAUpdater *MSSAU) {
+LoopInfo *LI, MemorySSAUpdater *MSSAU,
+const Twine ) {
   unsigned SuccNum = GetSuccessorNumber(BB, Succ);
 
   // If this is a critical edge, let SplitCriticalEdge do it.
   Instruction *LatchTerm = BB->getTerminator();
   if (SplitCriticalEdge(
   LatchTerm, SuccNum,
-  CriticalEdgeSplittingOptions(DT, LI, MSSAU).setPreserveLCSSA()))
+  CriticalEdgeSplittingOptions(DT, LI, MSSAU).setPreserveLCSSA(),
+  BBName))
 return LatchTerm->getSuccessor(SuccNum);
 
   // If the edge isn't critical, then BB has a single successor or Succ has a
@@ -512,14 +514,15 @@ BasicBlock *llvm::SplitEdge(BasicBlock *BB, BasicBlock 
*Succ, DominatorTree *DT,
 // block.
 assert(SP == BB && "CFG broken");
 SP = nullptr;
-return SplitBlock(Succ, >front(), DT, LI, MSSAU, "", 
/*Before=*/true);
+return SplitBlock(Succ, >front(), DT, LI, MSSAU, BBName,
+  /*Before=*/true);
   }
 
   // Otherwise, if BB has a single successor, split it at the bottom of the
   // block.
   assert(BB->getTerminator()->getNumSuccessors() == 1 &&
  "Should have a single succ!");
-  return SplitBlock(BB, BB->getTerminator(), DT, LI, MSSAU);
+  return SplitBlock(BB, BB->getTerminator(), DT, LI, MSSAU, BBName);
 }
 
 unsigned

diff  --git a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp 
b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
index e42f469ad32c..c9f08e5a9ed5 100644
--- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -134,9 +134,9 @@ static void createPHIsForSplitLoopExit(ArrayRef Preds,
   }
 }
 
-BasicBlock *
-llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
-const CriticalEdgeSplittingOptions ) {
+BasicBlock *llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
+const CriticalEdgeSplittingOptions 
,
+const Twine ) {
   if (!isCriticalEdge(TI, SuccNum, Options.MergeIdenticalEdges))
 return nullptr;
 
@@ -196,8 +196,13 @@ llvm::SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
   }
 
   // Create a new basic block, linking it into the 

[llvm-branch-commits] [llvm] aa7968a - [TableGen] Add field kind to the RecordVal class.

2021-01-07 Thread Paul C. Anagnostopoulos via llvm-branch-commits

Author: Paul C. Anagnostopoulos
Date: 2021-01-07T09:31:27-05:00
New Revision: aa7968a87b65f97c1245348f6c2a75fc9e420bb5

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

LOG: [TableGen] Add field kind to the RecordVal class.

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

Added: 


Modified: 
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/JSONBackend.cpp
llvm/lib/TableGen/Record.cpp
llvm/lib/TableGen/TGParser.cpp
llvm/utils/TableGen/CodeEmitterGen.cpp
llvm/utils/TableGen/FixedLenDecoderEmitter.cpp

Removed: 




diff  --git a/llvm/include/llvm/TableGen/Record.h 
b/llvm/include/llvm/TableGen/Record.h
index a0c5b2778547..8dea76fb64a2 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1369,14 +1369,22 @@ class DagInit final : public TypedInit, public 
FoldingSetNode,
 class RecordVal {
   friend class Record;
 
+public:
+  enum FieldKind {
+FK_Normal,// A normal record field.
+FK_NonconcreteOK, // A field that can be nonconcrete ('field' keyword).
+FK_TemplateArg,   // A template argument.
+  };
+
+private:
   Init *Name;
   SMLoc Loc; // Source location of definition of name.
-  PointerIntPair TyAndPrefix;
+  PointerIntPair TyAndKind;
   Init *Value;
 
 public:
-  RecordVal(Init *N, RecTy *T, bool P);
-  RecordVal(Init *N, SMLoc Loc, RecTy *T, bool P);
+  RecordVal(Init *N, RecTy *T, FieldKind K);
+  RecordVal(Init *N, SMLoc Loc, RecTy *T, FieldKind K);
 
   /// Get the name of the field as a StringRef.
   StringRef getName() const;
@@ -1392,10 +1400,18 @@ class RecordVal {
   /// Get the source location of the point where the field was defined.
   const SMLoc () const { return Loc; }
 
-  bool getPrefix() const { return TyAndPrefix.getInt(); }
+  /// Is this a field where nonconcrete values are okay?
+  bool isNonconcreteOK() const {
+return TyAndKind.getInt() == FK_NonconcreteOK;
+  }
+
+  /// Is this a template argument?
+  bool isTemplateArg() const {
+return TyAndKind.getInt() == FK_TemplateArg;
+  }
 
   /// Get the type of the field value as a RecTy.
-  RecTy *getType() const { return TyAndPrefix.getPointer(); }
+  RecTy *getType() const { return TyAndKind.getPointer(); }
 
   /// Get the type of the field for printing purposes.
   std::string getPrintType() const;

diff  --git a/llvm/lib/TableGen/JSONBackend.cpp 
b/llvm/lib/TableGen/JSONBackend.cpp
index 131650f987fb..8ddfd9f04524 100644
--- a/llvm/lib/TableGen/JSONBackend.cpp
+++ b/llvm/lib/TableGen/JSONBackend.cpp
@@ -144,7 +144,7 @@ void JSONEmitter::run(raw_ostream ) {
 for (const RecordVal  : Def.getValues()) {
   if (!Def.isTemplateArg(RV.getNameInit())) {
 auto Name = RV.getNameInitAsString();
-if (RV.getPrefix())
+if (RV.isNonconcreteOK())
   fields.push_back(Name);
 obj[Name] = translateInit(*RV.getValue());
   }

diff  --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp
index 6b19454e95d9..d047b7bdf1cd 100644
--- a/llvm/lib/TableGen/Record.cpp
+++ b/llvm/lib/TableGen/Record.cpp
@@ -2141,16 +2141,16 @@ std::string DagInit::getAsString() const {
 //Other implementations
 
//===--===//
 
-RecordVal::RecordVal(Init *N, RecTy *T, bool P)
-  : Name(N), TyAndPrefix(T, P) {
+RecordVal::RecordVal(Init *N, RecTy *T, FieldKind K)
+: Name(N), TyAndKind(T, K) {
   setValue(UnsetInit::get());
   assert(Value && "Cannot create unset value for current type!");
 }
 
 // This constructor accepts the same arguments as the above, but also
 // a source location.
-RecordVal::RecordVal(Init *N, SMLoc Loc, RecTy *T, bool P)
-: Name(N), Loc(Loc), TyAndPrefix(T, P) {
+RecordVal::RecordVal(Init *N, SMLoc Loc, RecTy *T, FieldKind K)
+: Name(N), Loc(Loc), TyAndKind(T, K) {
   setValue(UnsetInit::get());
   assert(Value && "Cannot create unset value for current type!");
 }
@@ -2170,7 +2170,7 @@ std::string RecordVal::getPrintType() const {
   return "string";
 }
   } else {
-return TyAndPrefix.getPointer()->getAsString();
+return TyAndKind.getPointer()->getAsString();
   }
 }
 
@@ -2227,7 +2227,7 @@ LLVM_DUMP_METHOD void RecordVal::dump() const { errs() << 
*this; }
 #endif
 
 void RecordVal::print(raw_ostream , bool PrintSem) const {
-  if (getPrefix()) OS << "field ";
+  if (isNonconcreteOK()) OS << "field ";
   OS << getPrintType() << " " << getNameInitAsString();
 
   if (getValue())
@@ -2368,10 +2368,10 @@ raw_ostream ::operator<<(raw_ostream , const 
Record ) {
   OS << "\n";
 
   for (const RecordVal  : R.getValues())
-if (Val.getPrefix() && !R.isTemplateArg(Val.getNameInit()))
+if (Val.isNonconcreteOK() && !R.isTemplateArg(Val.getNameInit()))
   OS << 

[llvm-branch-commits] [flang] b73736a - [flang][openacc] Enforce delcare directive restriction

2021-01-07 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2021-01-07T09:28:55-05:00
New Revision: b73736a4048172c48b6b5c23d1321f230d442306

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

LOG: [flang][openacc] Enforce delcare directive restriction

Add semantic check for most of the restrictions for the declare directive.

Reviewed By: kiranktp

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

Added: 
flang/test/Semantics/acc-declare-validity.f90

Modified: 
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/acc-clause-validity.f90

Removed: 




diff  --git a/flang/lib/Semantics/check-acc-structure.cpp 
b/flang/lib/Semantics/check-acc-structure.cpp
index 45499a69e604..2f3138d11f80 100644
--- a/flang/lib/Semantics/check-acc-structure.cpp
+++ b/flang/lib/Semantics/check-acc-structure.cpp
@@ -134,9 +134,30 @@ void AccStructureChecker::Enter(
 }
 
 void AccStructureChecker::Leave(
-const parser::OpenACCStandaloneDeclarativeConstruct &) {
+const parser::OpenACCStandaloneDeclarativeConstruct ) {
   // Restriction - line 2409
   CheckAtLeastOneClause();
+
+  // Restriction - line 2417-2418 - In a Fortran module declaration section,
+  // only create, copyin, device_resident, and link clauses are allowed.
+  const auto {std::get(x.t)};
+  const auto {context_.FindScope(declarativeDir.source)};
+  const Scope {GetProgramUnitContaining(scope)};
+  if (containingScope.kind() == Scope::Kind::Module) {
+for (auto cl : GetContext().actualClauses) {
+  if (cl != llvm::acc::Clause::ACCC_create &&
+  cl != llvm::acc::Clause::ACCC_copyin &&
+  cl != llvm::acc::Clause::ACCC_device_resident &&
+  cl != llvm::acc::Clause::ACCC_link)
+context_.Say(GetContext().directiveSource,
+"%s clause is not allowed on the %s directive in module "
+"declaration "
+"section"_err_en_US,
+parser::ToUpperCaseLetters(
+llvm::acc::getOpenACCClauseName(cl).str()),
+ContextDirectiveAsFortran());
+}
+  }
   dirContext_.pop_back();
 }
 

diff  --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index e10d797d0308..81e0ee61df4a 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -124,6 +124,7 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
 
   bool Pre(const parser::OpenACCRoutineConstruct &);
   bool Pre(const parser::AccBindClause &);
+  void Post(const parser::OpenACCStandaloneDeclarativeConstruct &);
 
   void Post(const parser::AccBeginBlockDirective &) {
 GetContext().withinConstruct = true;
@@ -215,6 +216,7 @@ class AccAttributeVisitor : 
DirectiveAttributeVisitor {
   void CheckMultipleAppearances(
   const parser::Name &, const Symbol &, Symbol::Flag);
   void AllowOnlyArrayAndSubArray(const parser::AccObjectList );
+  void DoNotAllowAssumedSizedArray(const parser::AccObjectList );
 };
 
 // Data-sharing and Data-mapping attributes for data-refs in OpenMP construct
@@ -470,6 +472,60 @@ bool AccAttributeVisitor::Pre(const 
parser::OpenACCDeclarativeConstruct ) {
   return true;
 }
 
+static const parser::AccObjectList (
+const parser::AccClause ) {
+  if (const auto *copyClause =
+  std::get_if()) {
+return copyClause->v;
+  } else if (const auto *createClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+createClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *copyinClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+copyinClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *copyoutClause =
+ std::get_if()) {
+const Fortran::parser::AccObjectListWithModifier  =
+copyoutClause->v;
+const Fortran::parser::AccObjectList  =
+std::get(listWithModifier.t);
+return accObjectList;
+  } else if (const auto *presentClause =
+ std::get_if()) {
+return presentClause->v;
+  } else if (const auto *deviceptrClause =
+ std::get_if(
+ )) {
+return deviceptrClause->v;
+  } else if (const auto *deviceResidentClause =
+ std::get_if(
+ )) {
+return deviceResidentClause->v;
+  } else if (const auto *linkClause =
+ std::get_if()) {
+return linkClause->v;
+  } else {
+llvm_unreachable("Clause without object list!");
+  }
+}
+
+void AccAttributeVisitor::Post(
+

[llvm-branch-commits] [llvm] 037b058 - [AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of dyn_cast<> for dereferenced pointer. NFCI.

2021-01-07 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-07T14:21:55Z
New Revision: 037b058e41979fa5e6ffd209033dfe72abb97b53

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

LOG: [AArch64] SVEIntrinsicOpts - use range loop and cast<> instead of 
dyn_cast<> for dereferenced pointer. NFCI.

Don't directly dereference a dyn_cast<> - use cast<> so we assert for the 
correct type.

Also, simplify the for loop to a range loop.

Fixes clang static analyzer warning.

Added: 


Modified: 
llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp

Removed: 




diff  --git a/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp 
b/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
index 67fc4ee0a29d..8e8b12c07bbf 100644
--- a/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
+++ b/llvm/lib/Target/AArch64/SVEIntrinsicOpts.cpp
@@ -248,10 +248,8 @@ bool SVEIntrinsicOpts::runOnModule(Module ) {
 case Intrinsic::aarch64_sve_ptest_any:
 case Intrinsic::aarch64_sve_ptest_first:
 case Intrinsic::aarch64_sve_ptest_last:
-  for (auto I = F.user_begin(), E = F.user_end(); I != E;) {
-auto *Inst = dyn_cast(*I++);
-Functions.insert(Inst->getFunction());
-  }
+  for (User *U : F.users())
+Functions.insert(cast(U)->getFunction());
   break;
 default:
   break;



___
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] fa6d897 - [Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead store. NFCI.

2021-01-07 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2021-01-07T14:21:54Z
New Revision: fa6d8977999096b2a3ae1357aa38ddf73abaf414

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

LOG: [Analysis] MemoryDepChecker::couldPreventStoreLoadForward - remove dead 
store. NFCI.

As we're breaking from the loop when clamping MaxVF, clang static analyzer was 
warning that the VF iterator was being updated and never used.

Added: 


Modified: 
llvm/lib/Analysis/LoopAccessAnalysis.cpp

Removed: 




diff  --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp 
b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index be340a3b3130..76e172534176 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -1338,7 +1338,7 @@ bool 
MemoryDepChecker::couldPreventStoreLoadForward(uint64_t Distance,
 // If the number of vector iteration between the store and the load are
 // small we could incur conflicts.
 if (Distance % VF && Distance / VF < NumItersForStoreLoadThroughMemory) {
-  MaxVFWithoutSLForwardIssues = (VF >>= 1);
+  MaxVFWithoutSLForwardIssues = (VF >> 1);
   break;
 }
   }



___
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] [flang] a2957f8 - [flang][driver] Rename driver tests (nfc)

2021-01-07 Thread Andrzej Warzynski via llvm-branch-commits

Author: Andrzej Warzynski
Date: 2021-01-07T14:05:48Z
New Revision: a2957f80f87f36ac8cfca06dec1c2defbe709876

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

LOG: [flang][driver] Rename driver tests (nfc)

As per [1]:
```
File names should use dashes, not underscores.
```

This patch updates the names of Flang driver tests accordingly.

[1] https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md

Added: 
flang/test/Driver/no-files.f90
flang/test/Driver/version-test.f90
flang/test/Flang-Driver/macro-def-undef.f90
flang/test/Flang-Driver/macro-multiline.f90

Modified: 


Removed: 
flang/test/Driver/no_files.f90
flang/test/Driver/version_test.f90
flang/test/Flang-Driver/macro_def_undef.f90
flang/test/Flang-Driver/macro_multiline.f90



diff  --git a/flang/test/Driver/no_files.f90 b/flang/test/Driver/no-files.f90
similarity index 100%
rename from flang/test/Driver/no_files.f90
rename to flang/test/Driver/no-files.f90

diff  --git a/flang/test/Driver/version_test.f90 
b/flang/test/Driver/version-test.f90
similarity index 100%
rename from flang/test/Driver/version_test.f90
rename to flang/test/Driver/version-test.f90

diff  --git a/flang/test/Flang-Driver/macro_def_undef.f90 
b/flang/test/Flang-Driver/macro-def-undef.f90
similarity index 100%
rename from flang/test/Flang-Driver/macro_def_undef.f90
rename to flang/test/Flang-Driver/macro-def-undef.f90

diff  --git a/flang/test/Flang-Driver/macro_multiline.f90 
b/flang/test/Flang-Driver/macro-multiline.f90
similarity index 100%
rename from flang/test/Flang-Driver/macro_multiline.f90
rename to flang/test/Flang-Driver/macro-multiline.f90



___
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] 01c190e - [AArch64][CostModel]Fix gather scatter cost model

2021-01-07 Thread Caroline Concatto via llvm-branch-commits

Author: Caroline Concatto
Date: 2021-01-07T14:02:08Z
New Revision: 01c190e907ca4752f7ba2a1390a8c91a48b322d1

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

LOG: [AArch64][CostModel]Fix gather scatter cost model

This patch fixes a bug introduced in the patch:
https://reviews.llvm.org/D93030

This patch pulls the test for scalable vector to be the first instruction
to be checked. This avoids the Gather and Scatter cost model for AArch64 to
compute the number of vector elements for something that is not a vector and
therefore crashing.

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-gather.ll
llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-scatter.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp 
b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index aaf7371c7933..68d382fb784b 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -773,13 +773,13 @@ AArch64TTIImpl::enableMemCmpExpansion(bool OptSize, bool 
IsZeroCmp) const {
 unsigned AArch64TTIImpl::getGatherScatterOpCost(
 unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask,
 Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I) {
+
+  if (!isa(DataTy))
+return BaseT::getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
+ Alignment, CostKind, I);
   auto *VT = cast(DataTy);
   auto LT = TLI->getTypeLegalizationCost(DL, DataTy);
   ElementCount LegalVF = LT.second.getVectorElementCount();
-  if (!LegalVF.isScalable())
-return BaseT::getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
- Alignment, CostKind, I);
-
   Optional MaxNumVScale = getMaxVScale();
   assert(MaxNumVScale && "Expected valid max vscale value");
 

diff  --git 
a/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-gather.ll 
b/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-gather.ll
index 38b41b731dd0..83e6ab9932b0 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-gather.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-gather.ll
@@ -32,6 +32,18 @@ define <4 x i32> @masked_gather_v4i32(<4 x i32*> %ld, <4 x 
i1> %masks, <4 x i32>
   ret <4 x i32> %res
 }
 
+; Check it properly falls back to BasicTTIImpl when legalized MVT is not a 
vector
+define <1 x i128> @masked_gather_v1i128(<1 x i128*> %ld, <1 x i1> %masks, <1 x 
i128> %passthru) {
+; CHECK-LABEL: 'masked_gather_v1i128'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction:   %res 
= call <1 x i128> @llvm.masked.gather.v1i128.v1p0i128(<1 x i128*> %ld, i32 0, 
<1 x i1> %masks, <1 x i128> %passthru)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction:   ret 
<1 x i128> %res
+
+  %res = call <1 x i128> @llvm.masked.gather.v1i128.v1p0i128(<1 x i128*> %ld, 
i32 0, <1 x i1> %masks, <1 x i128> %passthru)
+  ret <1 x i128> %res
+}
+
 declare  @llvm.masked.gather.nxv4i32( 
%ptrs, i32 %align,  %masks,  %passthru)
 declare  @llvm.masked.gather.nxv8i32( 
%ptrs, i32 %align,  %masks,  %passthru)
 declare <4 x i32> @llvm.masked.gather.v4i32(<4 x i32*> %ptrs, i32 %align, <4 x 
i1> %masks, <4 x i32> %passthru)
+declare <1 x i128> @llvm.masked.gather.v1i128.v1p0i128(<1 x i128*>, i32, <1 x 
i1>, <1 x i128>)
+

diff  --git 
a/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-scatter.ll 
b/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-scatter.ll
index 4370922e4bf7..fa0002483a1f 100644
--- a/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-scatter.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-scatter.ll
@@ -35,6 +35,17 @@ define void @masked_scatter_v4i32(<4 x i32> %data, <4 x 
i32*> %ptrs, <4 x i1> %m
   ret void
 }
 
+; Check it properly falls back to BasicTTIImpl when legalized MVT is not a 
vector
+define void @masked_scatter_v1i128(<1 x i128> %data, <1 x i128*> %ptrs, <1 x 
i1> %masks) {
+; CHECK-LABEL: 'masked_scatter_v1i128'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction:   call 
void @llvm.masked.scatter.v1i128.v1p0i128(<1 x i128> %data, <1 x i128*> %ptrs, 
i32 0, <1 x i1> %masks)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction:   ret 
void
+
+  call void @llvm.masked.scatter.v1i128.v1p0i128(<1 x i128> %data, <1 x i128*> 
%ptrs, i32 0, <1 x i1> %masks)
+  ret void
+}
+
 declare void @llvm.masked.scatter.nxv4i32( %data,  %ptrs, i32 %align,  %masks)
 declare void @llvm.masked.scatter.nxv8i32( %data,  %ptrs, i32 %align,  

[llvm-branch-commits] [clang] fcd1e35 - [clang][cli] NFC: Make parsing macro reusable

2021-01-07 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2021-01-07T14:25:48+01:00
New Revision: fcd1e35e4cc6887c3fb880126e60676458e60680

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

LOG: [clang][cli] NFC: Make parsing macro reusable

This is necessary for a future patch, where we start using this macro in 
another function.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 8b641aabd1af..348f5582bde2 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1399,32 +1399,42 @@ static bool checkVerifyPrefixes(const 
std::vector ,
   return Success;
 }
 
-bool CompilerInvocation::parseSimpleArgs(const ArgList ,
- DiagnosticsEngine ) {
-  bool Success = true;
-
-#define OPTION_WITH_MARSHALLING(   
\
-PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,
\
-HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH,   
\
-DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, 
\
-MERGER, EXTRACTOR, TABLE_INDEX)
\
+#define PARSE_OPTION_WITH_MARSHALLING(ARGS, DIAGS, SUCCESS, ID, FLAGS, PARAM,  
\
+  SHOULD_PARSE, KEYPATH, DEFAULT_VALUE,
\
+  IMPLIED_CHECK, IMPLIED_VALUE,
\
+  NORMALIZER, MERGER, TABLE_INDEX) 
\
   if ((FLAGS)::CC1Option) {
\
 this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE);  
\
 if (IMPLIED_CHECK) 
\
   this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE);
\
 if (SHOULD_PARSE)  
\
   if (auto MaybeValue =
\
-  NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success)) 
\
+  NORMALIZER(OPT_##ID, TABLE_INDEX, ARGS, DIAGS, SUCCESS)) 
\
 this->KEYPATH = MERGER(
\
 this->KEYPATH, static_castKEYPATH)>(*MaybeValue)); 
\
   }
 
+bool CompilerInvocation::parseSimpleArgs(const ArgList ,
+ DiagnosticsEngine ) {
+  bool Success = true;
+
+#define OPTION_WITH_MARSHALLING(   
\
+PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,
\
+HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH,   
\
+DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, 
\
+MERGER, EXTRACTOR, TABLE_INDEX)
\
+  PARSE_OPTION_WITH_MARSHALLING(Args, Diags, Success, ID, FLAGS, PARAM,
\
+SHOULD_PARSE, KEYPATH, DEFAULT_VALUE,  
\
+IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER,  
\
+MERGER, TABLE_INDEX)
 #include "clang/Driver/Options.inc"
 #undef OPTION_WITH_MARSHALLING
 
   return Success;
 }
 
+#undef PARSE_OPTION_WITH_MARSHALLING
+
 bool clang::ParseDiagnosticArgs(DiagnosticOptions , ArgList ,
 DiagnosticsEngine *Diags,
 bool DefaultDiagColor) {



___
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] [mlir] a7cbc32 - [mlir] remove a use of deprecated OpState::setAttr

2021-01-07 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2021-01-07T14:20:36+01:00
New Revision: a7cbc32a916a64e9f61106956ed3866a6086ae6b

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

LOG: [mlir] remove a use of deprecated OpState::setAttr

Added: 


Modified: 
mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp

Removed: 




diff  --git a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp 
b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
index 5e270881656c..51f34661bece 100644
--- a/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
+++ b/mlir/lib/Conversion/StandardToLLVM/StandardToLLVM.cpp
@@ -1894,7 +1894,7 @@ struct ConstantOpLowering : public 
ConvertOpToLLVMPattern {
   for (const NamedAttribute  : op->getAttrs()) {
 if (attr.first.strref() == "value")
   continue;
-newOp.setAttr(attr.first, attr.second);
+newOp->setAttr(attr.first, attr.second);
   }
   rewriter.replaceOp(op, newOp->getResults());
   return success();



___
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] 75d6363 - [clang][cli] NFC: Move parseSimpleArgs

2021-01-07 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2021-01-07T14:15:08+01:00
New Revision: 75d63630ebb197c338801d6b100ae2e06800c4ce

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

LOG: [clang][cli] NFC: Move parseSimpleArgs

This patch moves `parseSimpleArgs` closer to `ParseDiagnosticArgs` so that 
sharing the parsing macro between them can be done more locally in a future 
patch.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 7f3e39ede281..8b641aabd1af 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1399,6 +1399,32 @@ static bool checkVerifyPrefixes(const 
std::vector ,
   return Success;
 }
 
+bool CompilerInvocation::parseSimpleArgs(const ArgList ,
+ DiagnosticsEngine ) {
+  bool Success = true;
+
+#define OPTION_WITH_MARSHALLING(   
\
+PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,
\
+HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH,   
\
+DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, 
\
+MERGER, EXTRACTOR, TABLE_INDEX)
\
+  if ((FLAGS)::CC1Option) {
\
+this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE);  
\
+if (IMPLIED_CHECK) 
\
+  this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE);
\
+if (SHOULD_PARSE)  
\
+  if (auto MaybeValue =
\
+  NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success)) 
\
+this->KEYPATH = MERGER(
\
+this->KEYPATH, static_castKEYPATH)>(*MaybeValue)); 
\
+  }
+
+#include "clang/Driver/Options.inc"
+#undef OPTION_WITH_MARSHALLING
+
+  return Success;
+}
+
 bool clang::ParseDiagnosticArgs(DiagnosticOptions , ArgList ,
 DiagnosticsEngine *Diags,
 bool DefaultDiagColor) {
@@ -2971,32 +2997,6 @@ static void ParseTargetArgs(TargetOptions , ArgList 
,
   }
 }
 
-bool CompilerInvocation::parseSimpleArgs(const ArgList ,
- DiagnosticsEngine ) {
-  bool Success = true;
-
-#define OPTION_WITH_MARSHALLING(   
\
-PREFIX_TYPE, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,
\
-HELPTEXT, METAVAR, VALUES, SPELLING, SHOULD_PARSE, ALWAYS_EMIT, KEYPATH,   
\
-DEFAULT_VALUE, IMPLIED_CHECK, IMPLIED_VALUE, NORMALIZER, DENORMALIZER, 
\
-MERGER, EXTRACTOR, TABLE_INDEX)
\
-  if ((FLAGS)::CC1Option) {
\
-this->KEYPATH = MERGER(this->KEYPATH, DEFAULT_VALUE);  
\
-if (IMPLIED_CHECK) 
\
-  this->KEYPATH = MERGER(this->KEYPATH, IMPLIED_VALUE);
\
-if (SHOULD_PARSE)  
\
-  if (auto MaybeValue = \
-NORMALIZER(OPT_##ID, TABLE_INDEX, Args, Diags, Success))\
-this->KEYPATH = MERGER(
\
-this->KEYPATH, static_castKEYPATH)>(*MaybeValue)); 
\
-  }
-
-#include "clang/Driver/Options.inc"
-#undef OPTION_WITH_MARSHALLING
-
-  return Success;
-}
-
 bool CompilerInvocation::CreateFromArgs(CompilerInvocation ,
 ArrayRef CommandLineArgs,
 DiagnosticsEngine ,



___
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] e72cdc5 - [clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs

2021-01-07 Thread Jan Svoboda via llvm-branch-commits

Author: Jan Svoboda
Date: 2021-01-07T14:15:08+01:00
New Revision: e72cdc5ba1e65ecd8632663b6604eb9be8d1a162

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

LOG: [clang][cli] NFC: Ensure non-null DiagnosticsEngine in ParseDiagnosticArgs

Before this patch, ParseDiagnosticArgs can be called with a nullptr 
DiagnosticsEngine *. This happens early on in the compilation process, where no 
proper DiagnosticEngine exists, because the diagnostic options (passed through 
command line) are not known yet.

This patch ensures nullptr is replaced by an ignoring DiagnosticEngine in 
ParseDiagnosticArgs, which allows to switch from pointer to a reference in some 
utility functions.

Besides simplifying the code, this patch enables a future patch (D84673) that 
ports diagnostic options to the new marshalling infrastructure.

Reviewed By: dexonsmith

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

Added: 


Modified: 
clang/lib/Frontend/CompilerInvocation.cpp

Removed: 




diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 7fb7ec896e64..7f3e39ede281 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -830,7 +830,7 @@ GenerateOptimizationRemarkRegex(DiagnosticsEngine , 
ArgList ,
 
 static bool parseDiagnosticLevelMask(StringRef FlagName,
  const std::vector ,
- DiagnosticsEngine *Diags,
+ DiagnosticsEngine ,
  DiagnosticLevelMask ) {
   bool Success = true;
   for (const auto  : Levels) {
@@ -843,8 +843,7 @@ static bool parseDiagnosticLevelMask(StringRef FlagName,
 .Default(DiagnosticLevelMask::None);
 if (PM == DiagnosticLevelMask::None) {
   Success = false;
-  if (Diags)
-Diags->Report(diag::err_drv_invalid_value) << FlagName << Level;
+  Diags.Report(diag::err_drv_invalid_value) << FlagName << Level;
 }
 M = M | PM;
   }
@@ -1383,7 +1382,7 @@ static bool parseShowColorsArgs(const ArgList , bool 
DefaultColor) {
 }
 
 static bool checkVerifyPrefixes(const std::vector ,
-DiagnosticsEngine *Diags) {
+DiagnosticsEngine ) {
   bool Success = true;
   for (const auto  : VerifyPrefixes) {
 // Every prefix must start with a letter and contain only alphanumeric
@@ -1393,10 +1392,8 @@ static bool checkVerifyPrefixes(const 
std::vector ,
 });
 if (BadChar != Prefix.end() || !isLetter(Prefix[0])) {
   Success = false;
-  if (Diags) {
-Diags->Report(diag::err_drv_invalid_value) << "-verify=" << Prefix;
-Diags->Report(diag::note_drv_verify_prefix_spelling);
-  }
+  Diags.Report(diag::err_drv_invalid_value) << "-verify=" << Prefix;
+  Diags.Report(diag::note_drv_verify_prefix_spelling);
 }
   }
   return Success;
@@ -1405,6 +1402,13 @@ static bool checkVerifyPrefixes(const 
std::vector ,
 bool clang::ParseDiagnosticArgs(DiagnosticOptions , ArgList ,
 DiagnosticsEngine *Diags,
 bool DefaultDiagColor) {
+  Optional IgnoringDiags;
+  if (!Diags) {
+IgnoringDiags.emplace(new DiagnosticIDs(), new DiagnosticOptions(),
+  new IgnoringDiagConsumer());
+Diags = &*IgnoringDiags;
+  }
+
   bool Success = true;
 
   Opts.DiagnosticLogFile =
@@ -1439,10 +1443,9 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions , 
ArgList ,
 Opts.setShowOverloads(Ovl_All);
   else {
 Success = false;
-if (Diags)
-  Diags->Report(diag::err_drv_invalid_value)
-  << Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
-  << ShowOverloads;
+Diags->Report(diag::err_drv_invalid_value)
+<< Args.getLastArg(OPT_fshow_overloads_EQ)->getAsString(Args)
+<< ShowOverloads;
   }
 
   StringRef ShowCategory =
@@ -1455,10 +1458,9 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions , 
ArgList ,
 Opts.ShowCategories = 2;
   else {
 Success = false;
-if (Diags)
-  Diags->Report(diag::err_drv_invalid_value)
-  << Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
-  << ShowCategory;
+Diags->Report(diag::err_drv_invalid_value)
+<< Args.getLastArg(OPT_fdiagnostics_show_category)->getAsString(Args)
+<< ShowCategory;
   }
 
   StringRef Format =
@@ -1474,10 +1476,9 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions , 
ArgList ,
 Opts.setFormat(DiagnosticOptions::Vi);
   else {
 Success = false;
-if (Diags)
-  Diags->Report(diag::err_drv_invalid_value)
-  << Args.getLastArg(OPT_fdiagnostics_format)->getAsString(Args)
-   

  1   2   >