[llvm-branch-commits] [llvm] ebdd20f - Expand the fp_to_int/int_to_fp/fp_round/fp_extend as libcall for fp128

2020-12-17 Thread QingShan Zhang via llvm-branch-commits

Author: QingShan Zhang
Date: 2020-12-17T07:59:30Z
New Revision: ebdd20f430c408e200d5c60ef957e777841f0fa3

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

LOG: Expand the fp_to_int/int_to_fp/fp_round/fp_extend as libcall for fp128

X86 and AArch64 expand it as libcall inside the target. And PowerPC also
want to expand them as libcall for P8. So, propose an implement in the
legalizer to common the logic and remove the code for X86/AArch64 to
avoid the duplicate code.

Reviewed By: Craig Topper

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

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/test/CodeGen/AArch64/arm64-fp128.ll
llvm/test/CodeGen/AArch64/vecreduce-fadd-legalization-strict.ll
llvm/test/CodeGen/AArch64/vecreduce-fadd-legalization.ll
llvm/test/CodeGen/AArch64/vecreduce-fmul-legalization-strict.ll
llvm/test/CodeGen/PowerPC/f128-conv.ll
llvm/test/CodeGen/PowerPC/f128-rounding.ll
llvm/test/CodeGen/PowerPC/fp-strict-conv-f128.ll
llvm/test/CodeGen/X86/fp128-load.ll

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 7342c663776c..ef151a60a35c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -1812,6 +1812,19 @@ SDValue SelectionDAGLegalize::EmitStackConvert(SDValue 
SrcOp, EVT SlotVT,
 SDValue SelectionDAGLegalize::EmitStackConvert(SDValue SrcOp, EVT SlotVT,
EVT DestVT, const SDLoc &dl,
SDValue Chain) {
+  unsigned SrcSize = SrcOp.getValueSizeInBits();
+  unsigned SlotSize = SlotVT.getSizeInBits();
+  unsigned DestSize = DestVT.getSizeInBits();
+  Type *DestType = DestVT.getTypeForEVT(*DAG.getContext());
+  Align DestAlign = DAG.getDataLayout().getPrefTypeAlign(DestType);
+
+  // Don't convert with stack if the load/store is expensive.
+  if ((SrcSize > SlotSize &&
+   !TLI.isTruncStoreLegalOrCustom(SrcOp.getValueType(), SlotVT)) ||
+  (SlotSize < DestSize &&
+   !TLI.isLoadExtLegalOrCustom(ISD::EXTLOAD, DestVT, SlotVT)))
+return SDValue();
+
   // Create the stack frame object.
   Align SrcAlign = DAG.getDataLayout().getPrefTypeAlign(
   SrcOp.getValueType().getTypeForEVT(*DAG.getContext()));
@@ -1822,12 +1835,6 @@ SDValue SelectionDAGLegalize::EmitStackConvert(SDValue 
SrcOp, EVT SlotVT,
   MachinePointerInfo PtrInfo =
   MachinePointerInfo::getFixedStack(DAG.getMachineFunction(), SPFI);
 
-  unsigned SrcSize = SrcOp.getValueSizeInBits();
-  unsigned SlotSize = SlotVT.getSizeInBits();
-  unsigned DestSize = DestVT.getSizeInBits();
-  Type *DestType = DestVT.getTypeForEVT(*DAG.getContext());
-  Align DestAlign = DAG.getDataLayout().getPrefTypeAlign(DestType);
-
   // Emit a store to the stack slot.  Use a truncstore if the input value is
   // later than DestVT.
   SDValue Store;
@@ -2415,7 +2422,11 @@ SDValue 
SelectionDAGLegalize::ExpandLegalINT_TO_FP(SDNode *Node,
 
   // TODO: Should any fast-math-flags be set for the created nodes?
   LLVM_DEBUG(dbgs() << "Legalizing INT_TO_FP\n");
-  if (SrcVT == MVT::i32 && TLI.isTypeLegal(MVT::f64)) {
+  if (SrcVT == MVT::i32 && TLI.isTypeLegal(MVT::f64) &&
+  (DestVT.bitsLE(MVT::f64) ||
+   TLI.isOperationLegal(Node->isStrictFPOpcode() ? ISD::STRICT_FP_EXTEND
+ : ISD::FP_EXTEND,
+DestVT))) {
 LLVM_DEBUG(dbgs() << "32-bit [signed|unsigned] integer to float/double "
  "expansion\n");
 
@@ -2477,8 +2488,9 @@ SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(SDNode 
*Node,
 }
 return Result;
   }
-  // Code below here assumes !isSigned without checking again.
-  assert(!isSigned && "Legalize cannot Expand SINT_TO_FP for i64 yet");
+
+  if (isSigned)
+return SDValue();
 
   // TODO: Generalize this for use with other types.
   if (((SrcVT == MVT::i32 || SrcVT == MVT::i64) && DestVT == MVT::f32) ||
@@ -2537,6 +2549,11 @@ SDValue 
SelectionDAGLegalize::ExpandLegalINT_TO_FP(SDNode *Node,
 return DAG.getSelect(dl, DestVT, SignBitTest, Slow, Fast);
   }
 
+  // Don't expand it if there isn't cheap fadd.
+  if (!TLI.isOperationLegalOrCustom(
+  Node->isStrictFPOpcode() ? ISD::STRICT_FADD : ISD::FADD, DestVT))
+return SDValue();
+
   // The following op

[llvm-branch-commits] [mlir] 96076a2 - [mlir] Support index and memref types in llvm.mlir.cast

2020-12-17 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2020-12-17T09:21:42+01:00
New Revision: 96076a2edbd63e3e9d6ee0eca0c90d34579b7602

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

LOG: [mlir] Support index and memref types in llvm.mlir.cast

This operation is designed to support partial conversion, more specifically the
IR state in which some operations expect or produce built-in types and some
operations produce and expect LLVM dialect types. It is reasonable for it to
support cast between built-in types and any equivalent that could be produced
by the type conversion. (At the same time, we don't want the dialect to depend
on the type conversion as it could lead to a dependency cycle). Introduce
support for casting from index to any integer type and back, and from memref to
bare pointer or memref descriptor type and back.

Contrary to what the TODO in the code stated, there are no particular
precautions necessary to handle the bare pointer conversion for memerfs. This
conversion applies exclusively to statically-shaped memrefs, so we can always
recover the full descriptor contents from the type.

This patch simultaneously tightens the verification for other types to only
accept matching pairs of types, e.g., i64 and !llvm.i64, as opposed to the
previous implementation that only checked if the types were generally allowed
byt not for matching, e.g. i64 could be "casted" to !llvm.bfloat, which is not
the intended semantics.

Move the relevant test under test/Dialect/LLVMIR because it is not specific to
the conversion pass, but rather exercises an op in the dialect. If we decide
this op does not belong to the LLVM dialect, both the dialect and the op should
move together.

Reviewed By: silvas, ezhulenev

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

Added: 
mlir/test/Dialect/LLVMIR/dialect-cast.mlir

Modified: 
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/test/Conversion/StandardToLLVM/invalid.mlir

Removed: 




diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp 
b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index e3a5de788e49..d70a327824b7 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -1067,40 +1067,190 @@ static void printGlobalOp(OpAsmPrinter &p, GlobalOp 
op) {
 // Verifier for LLVM::DialectCastOp.
 
//===--===//
 
-static LogicalResult verify(DialectCastOp op) {
-  auto verifyMLIRCastType = [&op](Type type) -> LogicalResult {
-if (auto llvmType = type.dyn_cast()) {
-  if (llvmType.isVectorTy())
-llvmType = llvmType.getVectorElementType();
-  if (llvmType.isIntegerTy() || llvmType.isBFloatTy() ||
-  llvmType.isHalfTy() || llvmType.isFloatTy() ||
-  llvmType.isDoubleTy()) {
-return success();
-  }
-  return op.emitOpError("type must be non-index integer types, float "
-"types, or vector of mentioned types.");
+/// Checks if `llvmType` is dialect cast-compatible with `index` type. Does not
+/// report the error, the user is expected to produce an appropriate message.
+// TODO: make the size depend on data layout rather than on the conversion
+// pass option, and pull that information here.
+static LogicalResult verifyCastWithIndex(LLVMType llvmType) {
+  return success(llvmType.isa());
+}
+
+/// Checks if `llvmType` is dialect cast-compatible with built-in `type` and
+/// reports errors to the location of `op`.
+static LogicalResult verifyCast(DialectCastOp op, LLVMType llvmType,
+Type type) {
+  // Index is compatible with any integer.
+  if (type.isIndex()) {
+if (succeeded(verifyCastWithIndex(llvmType)))
+  return success();
+
+return op.emitOpError("invalid cast between index and non-integer type");
+  }
+
+  // Simple one-to-one mappings for floating point types.
+  if (type.isF16()) {
+if (llvmType.isa())
+  return success();
+return op.emitOpError(
+"invalid cast between f16 and a type other than !llvm.half");
+  }
+  if (type.isBF16()) {
+if (llvmType.isa())
+  return success();
+return op->emitOpError(
+"invalid cast between bf16 and a type other than !llvm.bfloat");
+  }
+  if (type.isF32()) {
+if (llvmType.isa())
+  return success();
+return op->emitOpError(
+"invalid cast between f32 and a type other than !llvm.float");
+  }
+  if (type.isF64()) {
+if (llvmType.isa())
+  return success();
+return op->emitOpError(
+"invalid cast between f64 and a type other than !llvm.double");
+  }
+
+  // Singless integers are compatible with LLVM integer of the same bitwidth.
+  if (type.isSignlessInteger()) {
+auto llvmInt = llvmType.dyn_cast();
+

[llvm-branch-commits] [lldb] 8666b90 - [lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T09:31:10+01:00
New Revision: 8666b9057f23badfe90548297f3c01937daa4a9c

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

LOG: [lldb] [POSIX-DYLD] Add libraries from initial rendezvous brkpt hit

Explicitly consider the libraries reported on the initial rendezvous
breakpoint hit added.  This is necessary on FreeBSD since the dynamic
loader issues only a single 'consistent' state rendezvous breakpoint hit
for all the libraries present in DT_NEEDED.  It is also helpful on Linux
where it ensures that ld-linux is considered loaded as well
as the shared system libraries reported afterwards.

Reenable memory maps on FreeBSD since this fixed the issue triggered
by them.

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

Added: 


Modified: 
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
lldb/source/Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.cpp
lldb/test/API/api/multithreaded/TestMultithreaded.py

lldb/test/API/functionalities/breakpoint/global_constructor/TestBreakpointInGlobalConstructor.py
lldb/test/API/functionalities/memory-region/TestMemoryRegion.py
lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py
lldb/test/Shell/Unwind/thread-step-out-ret-addr-check.test

Removed: 




diff  --git 
a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index ac60af5336ed..01f746ada3ba 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -76,7 +76,8 @@ DynamicLoaderPOSIXDYLD::DynamicLoaderPOSIXDYLD(Process 
*process)
   m_load_offset(LLDB_INVALID_ADDRESS), m_entry_point(LLDB_INVALID_ADDRESS),
   m_auxv(), m_dyld_bid(LLDB_INVALID_BREAK_ID),
   m_vdso_base(LLDB_INVALID_ADDRESS),
-  m_interpreter_base(LLDB_INVALID_ADDRESS) {}
+  m_interpreter_base(LLDB_INVALID_ADDRESS), m_initial_modules_added(false) 
{
+}
 
 DynamicLoaderPOSIXDYLD::~DynamicLoaderPOSIXDYLD() {
   if (m_dyld_bid != LLDB_INVALID_BREAK_ID) {
@@ -418,14 +419,38 @@ void DynamicLoaderPOSIXDYLD::RefreshModules() {
 
   ModuleList &loaded_modules = m_process->GetTarget().GetImages();
 
-  if (m_rendezvous.ModulesDidLoad()) {
+  if (m_rendezvous.ModulesDidLoad() || !m_initial_modules_added) {
 ModuleList new_modules;
 
-E = m_rendezvous.loaded_end();
-for (I = m_rendezvous.loaded_begin(); I != E; ++I) {
+// If this is the first time rendezvous breakpoint fires, we need
+// to take care of adding all the initial modules reported by
+// the loader.  This is necessary to list ld-linux.so on Linux,
+// and all DT_NEEDED entries on *BSD.
+if (m_initial_modules_added) {
+  I = m_rendezvous.loaded_begin();
+  E = m_rendezvous.loaded_end();
+} else {
+  I = m_rendezvous.begin();
+  E = m_rendezvous.end();
+  m_initial_modules_added = true;
+}
+for (; I != E; ++I) {
   ModuleSP module_sp =
   LoadModuleAtAddress(I->file_spec, I->link_addr, I->base_addr, true);
   if (module_sp.get()) {
+if (module_sp->GetObjectFile()->GetBaseAddress().GetLoadAddress(
+&m_process->GetTarget()) == m_interpreter_base &&
+module_sp != m_interpreter_module.lock()) {
+  // If this is a duplicate instance of ld.so, unload it.  We may end 
up
+  // with it if we load it via a 
diff erent path than before (symlink
+  // vs real path).
+  // TODO: remove this once we either fix library matching or avoid
+  // loading the interpreter when setting the rendezvous breakpoint.
+  UnloadSections(module_sp);
+  loaded_modules.Remove(module_sp);
+  continue;
+}
+
 loaded_modules.AppendIfNeeded(module_sp);
 new_modules.Append(module_sp);
   }
@@ -544,6 +569,7 @@ ModuleSP DynamicLoaderPOSIXDYLD::LoadInterpreterModule() {
 true /* notify */)) {
 UpdateLoadedSections(module_sp, LLDB_INVALID_ADDRESS, m_interpreter_base,
  false);
+m_interpreter_module = module_sp;
 return module_sp;
   }
   return nullptr;

diff  --git 
a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
index a7fcdfbadeaf..61567801fdd0 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader

[llvm-branch-commits] [lldb] dbfdb13 - [lldb] [POSIX-DYLD] Update the cached exe path after attach

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T09:31:22+01:00
New Revision: dbfdb139f75470a9abc78e7c9faf743fdd963c2d

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

LOG: [lldb] [POSIX-DYLD] Update the cached exe path after attach

Fix the POSIX-DYLD plugin to update the cached executable path after
attaching.  Previously, the path was cached in DYLDRendezvous
constructor and not updated afterwards.  This meant that if LLDB was
attaching to a process (e.g. via connecting to lldb-server), the code
stored the empty path before DidAttach() resolved it.  The fix updates
the cached path in DidAttach().

This fixes a new instance of https://llvm.org/pr17880

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

Added: 


Modified: 
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
lldb/test/API/commands/process/attach/TestProcessAttach.py
lldb/test/API/commands/process/attach/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
index 15b3805003a5..866acbddbdc8 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp
@@ -94,12 +94,13 @@ DYLDRendezvous::DYLDRendezvous(Process *process)
 : m_process(process), m_rendezvous_addr(LLDB_INVALID_ADDRESS), m_current(),
   m_previous(), m_loaded_modules(), m_soentries(), m_added_soentries(),
   m_removed_soentries() {
-  Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
-
   m_thread_info.valid = false;
+  UpdateExecutablePath();
+}
 
-  // Cache a copy of the executable path
+void DYLDRendezvous::UpdateExecutablePath() {
   if (m_process) {
+Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_DYNAMIC_LOADER));
 Module *exe_mod = m_process->GetTarget().GetExecutableModulePointer();
 if (exe_mod) {
   m_exe_file_spec = exe_mod->GetPlatformFileSpec();

diff  --git a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
index b028120eb0d4..3e88d88f407a 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h
@@ -60,6 +60,9 @@ class DYLDRendezvous {
 
   DYLDRendezvous(lldb_private::Process *process);
 
+  /// Update the cached executable path.
+  void UpdateExecutablePath();
+
   /// Update the internal snapshot of runtime linker rendezvous and recompute
   /// the currently loaded modules.
   ///

diff  --git 
a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp 
b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
index 01f746ada3ba..160faa74af23 100644
--- a/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp
@@ -102,6 +102,7 @@ void DynamicLoaderPOSIXDYLD::DidAttach() {
 
   ModuleSP executable_sp = GetTargetExecutable();
   ResolveExecutableModule(executable_sp);
+  m_rendezvous.UpdateExecutablePath();
 
   // find the main process load offset
   addr_t load_offset = ComputeLoadOffset();

diff  --git a/lldb/test/API/commands/process/attach/TestProcessAttach.py 
b/lldb/test/API/commands/process/attach/TestProcessAttach.py
index 5dfec5c76339..88429333edd3 100644
--- a/lldb/test/API/commands/process/attach/TestProcessAttach.py
+++ b/lldb/test/API/commands/process/attach/TestProcessAttach.py
@@ -20,6 +20,13 @@ class ProcessAttachTestCase(TestBase):
 
 NO_DEBUG_INFO_TESTCASE = True
 
+def setUp(self):
+# Call super's setUp().
+TestBase.setUp(self)
+# Find the line number to break for main.c.
+self.line = line_number('main.cpp',
+'// Waiting to be attached...')
+
 @skipIfiOSSimulator
 def test_attach_to_process_by_id(self):
 """Test attach by process id"""
@@ -77,6 +84,28 @@ def test_attach_to_process_by_name(self):
 process = target.GetProcess()
 self.assertTrue(process, PROCESS_IS_VALID)
 
+def test_attach_to_process_by_id_correct_executable_offset(self):
+"""
+Test that after attaching to a process the executable offset
+is determined correctly on FreeBSD.  This is a regression test
+for dyld plugin getting the correct executable path,
+and therefore being able to identify it in the module list.
+"""
+
+self.build()
+exe = self.getBuildArtifact(exe_name)
+
+# In order to reproduce, w

[llvm-branch-commits] [clang] 7f19712 - [clang][nfc] Update comment to match the opening `{`

2020-12-17 Thread Andrzej Warzynski via llvm-branch-commits

Author: Andrzej Warzynski
Date: 2020-12-17T09:04:41Z
New Revision: 7f19712a6a9e65bdc9a9843ea488030bc12f3acc

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

LOG: [clang][nfc] Update comment to match the opening `{`

Added: 


Modified: 
clang/include/clang/Driver/Options.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index dd23d810e388..f384e0d993c2 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5081,7 +5081,7 @@ def fopenmp_host_ir_file_path : Separate<["-"], 
"fopenmp-host-ir-file-path">,
 def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
   HelpText<"Generate code for SYCL device.">;
 
-} // let Flags = [CC1Option]
+} // let Flags = [CC1Option, NoDriverOption]
 
 
//===--===//
 // cc1as-only Options



___
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] eba09a2 - [InstCombine] Preserve !annotation for newly created instructions.

2020-12-17 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2020-12-17T09:06:51Z
New Revision: eba09a2db9eab46832cb7ec7ef0d2c227747772a

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

LOG: [InstCombine] Preserve !annotation for newly created instructions.

When replacing an instruction with !annotation with a newly created
replacement, add the !annotation metadata to the replacement.

This mostly covers cases where the new instructions are created using
the ::Create helpers. Instructions created by IRBuilder will be handled
by D91444.

Reviewed By: thegameg

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

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/annotations.ll

Removed: 




diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp 
b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 9306e99f5d52..770d58b31664 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3693,8 +3693,8 @@ bool InstCombinerImpl::run() {
 LLVM_DEBUG(dbgs() << "IC: Old = " << *I << '\n'
   << "New = " << *Result << '\n');
 
-if (I->getDebugLoc())
-  Result->setDebugLoc(I->getDebugLoc());
+Result->copyMetadata(*I,
+ {LLVMContext::MD_dbg, 
LLVMContext::MD_annotation});
 // Everything uses the new instruction now.
 I->replaceAllUsesWith(Result);
 

diff  --git a/llvm/test/Transforms/InstCombine/annotations.ll 
b/llvm/test/Transforms/InstCombine/annotations.ll
index 1530b867bfb6..3b0989402823 100644
--- a/llvm/test/Transforms/InstCombine/annotations.ll
+++ b/llvm/test/Transforms/InstCombine/annotations.ll
@@ -7,7 +7,7 @@
 ; instruction has !annotation metadata.
 define i1 @fold_to_new_instruction(i8* %a, i8* %b) {
 ; CHECK-LABEL: define {{.+}} @fold_to_new_instruction({{.+}}
-; CHECK-NEXT:[[C:%.*]] = icmp uge i8* [[A:%.*]], [[B:%[a-z]*]]
+; CHECK-NEXT:[[C:%.*]] = icmp uge i8* [[A:%.*]], [[B:%[a-z]*]], 
!annotation [[ANN:![0-9]+]]
 ; CHECK-NEXT:ret i1 [[C]]
 ;
   %a.c = bitcast i8* %a to i32*, !annotation !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] 7f8779e - [llvm][AArch64] Actually check expected FPU for CPUs

2020-12-17 Thread David Spickett via llvm-branch-commits

Author: David Spickett
Date: 2020-12-17T09:15:51Z
New Revision: 7f8779e4e66b4eb3292386c1a214019f7a519c0e

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

LOG: [llvm][AArch64] Actually check expected FPU for CPUs

We were passing this as an argument but never using
it. ARM has always checked this.

Note that the FPU list is shared between ARM and AArch64
so there is no AArch64::getFPUName, just ARM::getFPUName.

Reviewed By: dmgreen

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

Added: 


Modified: 
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/llvm/unittests/Support/TargetParserTest.cpp 
b/llvm/unittests/Support/TargetParserTest.cpp
index 2688f0ca3065..65f99df195dc 100644
--- a/llvm/unittests/Support/TargetParserTest.cpp
+++ b/llvm/unittests/Support/TargetParserTest.cpp
@@ -805,6 +805,9 @@ bool testAArch64CPU(StringRef CPUName, StringRef 
ExpectedArch,
   else
 pass &= (ExtKind == ExpectedFlags);
 
+  unsigned FPUKind = AArch64::getDefaultFPU(CPUName, AK);
+  pass &= ARM::getFPUName(FPUKind).equals(ExpectedFPU);
+
   pass &= AArch64::getCPUAttr(AK).equals(CPUAttr);
 
   return pass;



___
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] db41c0b - [clang-format] PR35514 brace-init member initializers in function-try-blocks are not formatted correctly

2020-12-17 Thread via llvm-branch-commits

Author: mydeveloperday
Date: 2020-12-17T09:39:37Z
New Revision: db41c0b357d55ccd6206ff262dc50ed38f0d5474

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

LOG: [clang-format] PR35514 brace-init member initializers in 
function-try-blocks are not formatted correctly

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

Initializer lists with a try-block are incorrectly formatted.

e.g.

```
Foo(int abc, int def) try : _abc(abc), _def{def}, _ghi{1} {
  callA();
  callB();
} catch (std::exception&) {
}
```

is formatted as:

```
Foo(int abc, int def) try : _abc(abc), _def { def }
, _ghi{1} {
  callA();
  callB();
}
catch (std::exception&) {
}
```

This revision adds support in the parseTryCatch for braced initializers in the 
initializer list

Reviewed By: curdeius, HazardyKnusperkeks

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

Added: 


Modified: 
clang/lib/Format/UnwrappedLineParser.cpp
clang/unittests/Format/FormatTest.cpp

Removed: 




diff  --git a/clang/lib/Format/UnwrappedLineParser.cpp 
b/clang/lib/Format/UnwrappedLineParser.cpp
index ddb3a247429a..4c2ee421d092 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -2050,6 +2050,13 @@ void UnwrappedLineParser::parseTryCatch() {
   nextToken();
   if (FormatTok->is(tok::l_paren))
 parseParens();
+  if (FormatTok->Previous && FormatTok->Previous->is(tok::identifier) &&
+  FormatTok->is(tok::l_brace)) {
+do {
+  nextToken();
+} while (!FormatTok->is(tok::r_brace));
+nextToken();
+  }
 
   // In case identifiers were removed by clang-tidy, what might follow is
   // multiple commas in sequence - after the first identifier.

diff  --git a/clang/unittests/Format/FormatTest.cpp 
b/clang/unittests/Format/FormatTest.cpp
index a3dbec9a669f..d2aed304f213 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2727,6 +2727,29 @@ TEST_F(FormatTest, FormatTryCatch) {
"throw;\n"
"  }\n"
"};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1} {\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1}, c{2} {\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
+  verifyFormat("class A {\n"
+   "  int a;\n"
+   "  A() try : a(0), b{1}, c{2} {\n"
+   "{ // New scope.\n"
+   "}\n"
+   "  } catch (...) {\n"
+   "throw;\n"
+   "  }\n"
+   "};\n");
 
   // Incomplete try-catch blocks.
   verifyIncompleteFormat("try {} catch (");
@@ -7756,8 +7779,8 @@ TEST_F(FormatTest, UnderstandsUnaryOperators) {
   verifyFormat("co_yield -1;");
   verifyFormat("co_return -1;");
 
-  // Check that * is not treated as a binary operator when we set 
PointerAlignment
-  // as PAS_Left after a keyword and not a declaration.
+  // Check that * is not treated as a binary operator when we set
+  // PointerAlignment as PAS_Left after a keyword and not a declaration.
   FormatStyle PASLeftStyle = getLLVMStyle();
   PASLeftStyle.PointerAlignment = FormatStyle::PAS_Left;
   verifyFormat("co_return *a;", PASLeftStyle);



___
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] a4e47cd - [Flang][openmp]Fix crash in OpenMP semantic check( bug 48308)

2020-12-17 Thread Sameeran joshi via llvm-branch-commits

Author: sameeran joshi
Date: 2020-12-17T15:17:13+05:30
New Revision: a4e47cd1857be1a1bfdada2a1c60a521fd21ecee

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

LOG: [Flang][openmp]Fix crash in OpenMP semantic check( bug 48308)

Fixes the bug reported in https://bugs.llvm.org/show_bug.cgi?id=48308

Reviewed By: kiranchandramohan, clementval

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

Added: 
flang/test/Semantics/omp-no-dowhile-in-parallel.f90

Modified: 
flang/lib/Semantics/resolve-directives.cpp

Removed: 




diff  --git a/flang/lib/Semantics/resolve-directives.cpp 
b/flang/lib/Semantics/resolve-directives.cpp
index 56f8f8fae955..16fdb09a5dbc 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -875,17 +875,24 @@ void 
OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
   }
 }
 
-// 2.15.1.1 Data-sharing Attribute Rules - Predetermined
+// [OMP-4.5]2.15.1.1 Data-sharing Attribute Rules - Predetermined
 //   - A loop iteration variable for a sequential loop in a parallel
 // or task generating construct is private in the innermost such
 // construct that encloses the loop
+// Loop iteration variables are not well defined for DO WHILE loop.
+// Use of DO CONCURRENT inside OpenMP construct is unspecified behavior
+// till OpenMP-5.0 standard.
+// In above both cases we skip the privatization of iteration variables.
 bool OmpAttributeVisitor::Pre(const parser::DoConstruct &x) {
-  if (!dirContext_.empty() && GetContext().withinConstruct) {
-if (const auto &iv{GetLoopIndex(x)}; iv.symbol) {
-  if (!iv.symbol->test(Symbol::Flag::OmpPreDetermined)) {
-ResolveSeqLoopIndexInParallelOrTaskConstruct(iv);
-  } else {
-// TODO: conflict checks with explicitly determined DSA
+  // TODO:[OpenMP 5.1] DO CONCURRENT indices are private
+  if (x.IsDoNormal()) {
+if (!dirContext_.empty() && GetContext().withinConstruct) {
+  if (const auto &iv{GetLoopIndex(x)}; iv.symbol) {
+if (!iv.symbol->test(Symbol::Flag::OmpPreDetermined)) {
+  ResolveSeqLoopIndexInParallelOrTaskConstruct(iv);
+} else {
+  // TODO: conflict checks with explicitly determined DSA
+}
   }
 }
   }

diff  --git a/flang/test/Semantics/omp-no-dowhile-in-parallel.f90 
b/flang/test/Semantics/omp-no-dowhile-in-parallel.f90
new file mode 100644
index ..f49d29c93a90
--- /dev/null
+++ b/flang/test/Semantics/omp-no-dowhile-in-parallel.f90
@@ -0,0 +1,28 @@
+! RUN: %S/test_errors.sh %s %t %f18 -fopenmp
+
+subroutine bug48308(x,i)
+  real :: x(:)
+  integer :: i
+  !$omp parallel firstprivate(i)
+do while (i>0)
+  x(i) = i
+  i = i - 1
+end do
+  !$omp end parallel
+end subroutine
+
+subroutine s1(x,i)
+  real :: x(:)
+  integer :: i
+  !$omp parallel firstprivate(i)
+do i = 10, 1, -1
+  x(i) = i
+end do
+  !$omp end parallel
+
+  !$omp parallel firstprivate(i)
+do concurrent (i = 1:10:1)
+  x(i) = i
+end do
+  !$omp end parallel
+end subroutine



___
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] 722247c - [lldb] Unify the two CreateTypedef implementations in TypeSystemClang

2020-12-17 Thread Raphael Isemann via llvm-branch-commits

Author: Raphael Isemann
Date: 2020-12-17T10:49:26+01:00
New Revision: 722247c8124a6b840686757ae128b16cea248130

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

LOG: [lldb] Unify the two CreateTypedef implementations in TypeSystemClang

To get LLDB one step closer to fulfil the software redundancy requirements of
modern aircrafts, we apparently decided to have two separately maintained
implementations of `CreateTypedef` in TypeSystemClang. Let's pass on the idea of
an LLDB-powered jetliner and deleted one implementation.

On a more serious note: This function got duplicated a long time ago when the
idea of CompilerType with a backing TypeSystemClang subclass happened
(56939cb31061d24ae3d1fc62da38b57e78bb2556). One implementation was supposed to
be called from CompilerType::CreateTypedef and the other has just always been
around to create typedefs. By accident one of the implementations is only used
by the PDB parser while the CompilerType::CreateTypedef backend is used by the
rest of LLDB.

We also had some patches over the year that only fixed one of the two functions
(D18099 for example only fixed up the CompilerType::CreateTypedef
implementation). D51162 and D86140 both fixed the same missing `addDecl` call
for one of the two implementations.

This patch:
* deletes the `CreateTypedefType` function as its only used by the PDB parser
  and the `CreateTypedef` implementation is anyway needed as it's the backend
  implementation of CompilerType.
* replaces the calls in the PDB parser by just calling the CompilerType wrapper.
* moves the documentation to the remaining function.
* moves the check for empty typedef names that was only in the deleted
  implementation to the other (I don't think this fixes anything as I believe
  all callers are already doing the same check).

I'll fix up the usual stuff (not using StringRef, not doing early exit) in a NFC
follow-up.

This patch is not NFC as the PDB parser now calls the function that has the fix
from D18099.

Reviewed By: labath, JDevlieghere

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/unittests/Symbol/TestTypeSystemClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
index 21f8b13bf07f..5b4ab78ac219 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -881,8 +881,8 @@ PdbAstBuilder::GetOrCreateTypedefDecl(PdbGlobalSymId id) {
 
   std::string uname = std::string(DropNameScope(udt.Name));
 
-  CompilerType ct = m_clang.CreateTypedefType(ToCompilerType(qt), 
uname.c_str(),
-  ToCompilerDeclContext(*scope), 
0);
+  CompilerType ct = ToCompilerType(qt).CreateTypedef(
+  uname.c_str(), ToCompilerDeclContext(*scope), 0);
   clang::TypedefNameDecl *tnd = m_clang.GetAsTypedefDecl(ct);
   DeclStatus status;
   status.resolved = true;

diff  --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp 
b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index 7649e8a90f9a..f9c12e634140 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -550,8 +550,8 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const 
PDBSymbol &type) {
 if (!ast_typedef.IsValid()) {
   CompilerType target_ast_type = target_type->GetFullCompilerType();
 
-  ast_typedef = m_ast.CreateTypedefType(
-  target_ast_type, name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0);
+  ast_typedef = target_ast_type.CreateTypedef(
+  name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0);
   if (!ast_typedef)
 return nullptr;
 

diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f46b145da66c..643ea7e02206 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -4402,39 +4402,6 @@ 
TypeSystemClang::GetNonReferenceType(lldb::opaque_compiler_type_t type) {
   return CompilerType();
 }
 
-CompilerType TypeSystemClang::CreateTypedefType(
-const CompilerType &type, const char *typedef_name,
-const CompilerDeclContext &compiler_decl_ctx, uint32_t payload) {
-  if (type && typedef_name && typedef_name[0]) {
-TypeSystemClang *ast =
-llvm::dyn_cast(type.GetTypeSystem());
-if (!ast

[llvm-branch-commits] [libc] 352cba2 - [libc] add back math.h #include utils/FPUtil/ManipulationFunctions.h

2020-12-17 Thread Krasimir Georgiev via llvm-branch-commits

Author: Krasimir Georgiev
Date: 2020-12-17T11:16:08+01:00
New Revision: 352cba2441c6c4e00f067c9c68358cc0a6a5fffb

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

LOG: [libc] add back math.h #include utils/FPUtil/ManipulationFunctions.h

This partially reverts cee1e7d14f4628d6174b33640d502bff3b54ae45:
  [libc][NFC][Obvious] Remove few unnecessary #include directives in tests.

That commit causes a test failure in our configuration:
[ RUN  ] ILogbTest.SpecialNumbers_ilogb
third_party/llvm/llvm-project/libc/test/src/math/ILogbTest.h:28: FAILURE
  Expected: FP_ILOGBNAN
  Which is: 2147483647
To be equal to: func(__llvm_libc::fputil::FPBits::buildNaN(1))
  Which is: -2147483648

Added: 


Modified: 
libc/utils/FPUtil/ManipulationFunctions.h

Removed: 




diff  --git a/libc/utils/FPUtil/ManipulationFunctions.h 
b/libc/utils/FPUtil/ManipulationFunctions.h
index 79dc741ff629..2bac1b5c229f 100644
--- a/libc/utils/FPUtil/ManipulationFunctions.h
+++ b/libc/utils/FPUtil/ManipulationFunctions.h
@@ -13,10 +13,10 @@
 #include "NearestIntegerOperations.h"
 #include "NormalFloat.h"
 
+#include "include/math.h"
 #include "utils/CPP/TypeTraits.h"
 
 #include 
-#include 
 
 namespace __llvm_libc {
 namespace fputil {



___
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] cdb692e - [X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing X86ISD::SUBV_BROADCAST (PR38969)

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T10:25:25Z
New Revision: cdb692ee0c6745ea008ee6cc00fe1e65021516bb

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

LOG: [X86] Add X86ISD::SUBV_BROADCAST_LOAD and begin removing 
X86ISD::SUBV_BROADCAST (PR38969)

Subvector broadcasts are only load instructions, yet X86ISD::SUBV_BROADCAST 
treats them more generally, requiring a lot of fallback tablegen patterns.

This initial patch replaces constant vector lowering inside 
lowerBuildVectorAsBroadcast with direct X86ISD::SUBV_BROADCAST_LOAD loads which 
helps us merge a number of equivalent loads/broadcasts.

As well as general plumbing/analysis additions for SUBV_BROADCAST_LOAD, I 
needed to wrap SelectionDAG::makeEquivalentMemoryOrdering so it can handle 
result chains from non generic LoadSDNode nodes.

Later patches will continue to replace X86ISD::SUBV_BROADCAST usage.

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

Added: 


Modified: 
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/lib/Target/X86/X86InstrAVX512.td
llvm/lib/Target/X86/X86InstrFragmentsSIMD.td
llvm/lib/Target/X86/X86InstrSSE.td
llvm/test/CodeGen/X86/broadcast-elm-cross-splat-vec.ll
llvm/test/CodeGen/X86/subvector-broadcast.ll

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/SelectionDAG.h 
b/llvm/include/llvm/CodeGen/SelectionDAG.h
index 4ec870bb3f9b..fbaa1f0e974f 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAG.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAG.h
@@ -1591,7 +1591,14 @@ class SelectionDAG {
   /// chain to the token factor. This ensures that the new memory node will 
have
   /// the same relative memory dependency position as the old load. Returns the
   /// new merged load chain.
-  SDValue makeEquivalentMemoryOrdering(LoadSDNode *Old, SDValue New);
+  SDValue makeEquivalentMemoryOrdering(SDValue OldChain, SDValue 
NewMemOpChain);
+
+  /// If an existing load has uses of its chain, create a token factor node 
with
+  /// that chain and the new memory node's chain and update users of the old
+  /// chain to the token factor. This ensures that the new memory node will 
have
+  /// the same relative memory dependency position as the old load. Returns the
+  /// new merged load chain.
+  SDValue makeEquivalentMemoryOrdering(LoadSDNode *OldLoad, SDValue NewMemOp);
 
   /// Topological-sort the AllNodes list and a
   /// assign a unique node id for each node in the DAG based on their

diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp 
b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 83e8637b3840..b2c748167577 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -8966,25 +8966,32 @@ void SelectionDAG::AddDbgLabel(SDDbgLabel *DB) {
   DbgInfo->add(DB);
 }
 
-SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad,
-   SDValue NewMemOp) {
-  assert(isa(NewMemOp.getNode()) && "Expected a memop node");
+SDValue SelectionDAG::makeEquivalentMemoryOrdering(SDValue OldChain,
+   SDValue NewMemOpChain) {
+  assert(isa(NewMemOpChain) && "Expected a memop node");
+  assert(NewMemOpChain.getValueType() == MVT::Other && "Expected a token VT");
   // The new memory operation must have the same position as the old load in
   // terms of memory dependency. Create a TokenFactor for the old load and new
   // memory operation and update uses of the old load's output chain to use 
that
   // TokenFactor.
-  SDValue OldChain = SDValue(OldLoad, 1);
-  SDValue NewChain = SDValue(NewMemOp.getNode(), 1);
-  if (OldChain == NewChain || !OldLoad->hasAnyUseOfValue(1))
-return NewChain;
+  if (OldChain == NewMemOpChain || OldChain.use_empty())
+return NewMemOpChain;
 
-  SDValue TokenFactor =
-  getNode(ISD::TokenFactor, SDLoc(OldLoad), MVT::Other, OldChain, 
NewChain);
+  SDValue TokenFactor = getNode(ISD::TokenFactor, SDLoc(OldChain), MVT::Other,
+OldChain, NewMemOpChain);
   ReplaceAllUsesOfValueWith(OldChain, TokenFactor);
-  UpdateNodeOperands(TokenFactor.getNode(), OldChain, NewChain);
+  UpdateNodeOperands(TokenFactor.getNode(), OldChain, NewMemOpChain);
   return TokenFactor;
 }
 
+SDValue SelectionDAG::makeEquivalentMemoryOrdering(LoadSDNode *OldLoad,
+   SDValue NewMemOp) {
+  assert(isa(NewMemOp.getNode()) && "Expected a memop node");
+  SDValue OldChain = SDValue(OldLoad, 1);
+  SDValue NewMemOpChain = NewMemOp.getValue(1);
+  return makeEquivalentMemoryOrdering(OldChain, NewMemOpC

[llvm-branch-commits] [clang] 9231045 - Make LLVM build in C++20 mode

2020-12-17 Thread Nuno Lopes via llvm-branch-commits

Author: Barry Revzin
Date: 2020-12-17T10:44:10Z
New Revision: 92310454bf0f1f9686f38afd11756c7d046495c9

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

LOG: Make LLVM build in C++20 mode

Part of the <=> changes in C++20 make certain patterns of writing equality
operators ambiguous with themselves (sorry!).
This patch goes through and adjusts all the comparison operators such that
they should work in both C++17 and C++20 modes. It also makes two other small
C++20-specific changes (adding a constructor to a type that cases to be an
aggregate, and adding casts from u8 literals which no longer have type
const char*).

There were four categories of errors that this review fixes.
Here are canonical examples of them, ordered from most to least common:

// 1) Missing const
namespace missing_const {
struct A {
#ifndef FIXED
bool operator==(A const&);
#else
bool operator==(A const&) const;
#endif
};

bool a = A{} == A{}; // error
}

// 2) Type mismatch on CRTP
namespace crtp_mismatch {
template 
struct Base {
#ifndef FIXED
bool operator==(Derived const&) const;
#else
// in one case changed to taking Base const&
friend bool operator==(Derived const&, Derived const&);
#endif
};

struct D : Base { };

bool b = D{} == D{}; // error
}

// 3) iterator/const_iterator with only mixed comparison
namespace iter_const_iter {
template 
struct iterator {
using const_iterator = iterator;

iterator();

template  = 0>
iterator(iterator const&);

#ifndef FIXED
bool operator==(const_iterator const&) const;
#else
friend bool operator==(iterator const&, iterator const&);
#endif
};

bool c = iterator{} == iterator{} // error
  || iterator{} == iterator{}
  || iterator{} == iterator{}
  || iterator{} == iterator{};
}

// 4) Same-type comparison but only have mixed-type operator
namespace ambiguous_choice {
enum Color { Red };

struct C {
C();
C(Color);
operator Color() const;
bool operator==(Color) const;
friend bool operator==(C, C);
};

bool c = C{} == C{}; // error
bool d = C{} == Red;
}

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

Added: 


Modified: 
clang/include/clang/AST/StmtIterator.h
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
llvm/include/llvm/ADT/AllocatorList.h
llvm/include/llvm/ADT/DenseMap.h
llvm/include/llvm/ADT/DenseSet.h
llvm/include/llvm/ADT/DirectedGraph.h
llvm/include/llvm/ADT/STLExtras.h
llvm/include/llvm/ADT/StringMap.h
llvm/include/llvm/ADT/iterator.h
llvm/include/llvm/CodeGen/DIE.h
llvm/include/llvm/CodeGen/LiveInterval.h
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/include/llvm/DebugInfo/DWARF/DWARFExpression.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/BasicBlock.h
llvm/include/llvm/Object/StackMapParser.h
llvm/include/llvm/ProfileData/Coverage/CoverageMappingReader.h
llvm/include/llvm/ProfileData/InstrProfReader.h
llvm/include/llvm/Support/BinaryStreamRef.h
llvm/include/llvm/Support/SuffixTree.h
llvm/lib/CodeGen/PeepholeOptimizer.cpp
llvm/lib/IR/Attributes.cpp
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/lib/Transforms/Scalar/GVNHoist.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
llvm/unittests/ADT/STLExtrasTest.cpp

Removed: 




diff  --git a/clang/include/clang/AST/StmtIterator.h 
b/clang/include/clang/AST/StmtIterator.h
index 911205347aad..bcdb0df829fb 100644
--- a/clang/include/clang/AST/StmtIterator.h
+++ b/clang/include/clang/AST/StmtIterator.h
@@ -104,12 +104,13 @@ class StmtIteratorImpl : public StmtIteratorBase,
 return tmp;
   }
 
-  bool operator==(const DERIVED& RHS) const {
-return stmt == RHS.stmt && DGI == RHS.DGI && RawVAPtr == RHS.RawVAPtr;
+  friend bool operator==(const DERIVED &LHS, const DERIVED &RHS) {
+return LHS.stmt == RHS.stmt && LHS.DGI == RHS.DGI &&
+   LHS.RawVAPtr == RHS.RawVAPtr;
   }
 
-  bool operator!=(const DERIVED& RHS) const {
-return stmt != RHS.stmt || DGI != RHS.DGI || RawVAPtr != RHS.RawVAPtr;
+  friend bool operator!=(const DERIVED &LHS, const DERIVED &RHS) {
+return !(LHS == RHS);
   }
 
   REFERENCE operator*() const {

diff  --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index c4aa361b8262..db7e967b15ae 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -61,6 +61,12 @@ enum OpenMPDirectiveKindEx {
 struct OpenMPDirectiveKindExWrapper {
   OpenMPDirectiveKindExWrapper(unsigned Value) : Value(Value) {}
   OpenMPDirectiveKindE

[llvm-branch-commits] [lldb] b833898 - [lldb] Add std::array to the supported template list of the CxxModuleHandler

2020-12-17 Thread Raphael Isemann via llvm-branch-commits

Author: Raphael Isemann
Date: 2020-12-17T11:47:58+01:00
New Revision: b8338983e6f6ec6ebd48a7fc640b5d859e653b27

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

LOG: [lldb] Add std::array to the supported template list of the 
CxxModuleHandler

Identical to the other patches that add STL containers to the supported
templated list.

Added: 
lldb/test/API/commands/expression/import-std-module/array/Makefile

lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
lldb/test/API/commands/expression/import-std-module/array/main.cpp

Modified: 
lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
index 8a8450245990..f953e860969c 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
@@ -22,6 +22,7 @@ CxxModuleHandler::CxxModuleHandler(ASTImporter &importer, 
ASTContext *target)
 
   std::initializer_list supported_names = {
   // containers
+  "array",
   "deque",
   "forward_list",
   "list",

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/array/Makefile 
b/lldb/test/API/commands/expression/import-std-module/array/Makefile
new file mode 100644
index ..f938f7428468
--- /dev/null
+++ b/lldb/test/API/commands/expression/import-std-module/array/Makefile
@@ -0,0 +1,3 @@
+USE_LIBCPP := 1
+CXX_SOURCES := main.cpp
+include Makefile.rules

diff  --git 
a/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
 
b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
new file mode 100644
index ..ba9a7853b2f6
--- /dev/null
+++ 
b/lldb/test/API/commands/expression/import-std-module/array/TestArrayFromStdModule.py
@@ -0,0 +1,86 @@
+"""
+Test basic std::array functionality.
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class TestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+@add_test_categories(["libc++"])
+@skipIf(compiler=no_match("clang"))
+def test(self):
+self.build()
+
+lldbutil.run_to_source_breakpoint(self,
+  "// Set break point at this line.",
+  lldb.SBFileSpec("main.cpp"))
+
+self.runCmd("settings set target.import-std-module true")
+
+
+# Test inspecting an array of integers.
+array_type = "std::array"
+size_type = "std::array::size_type"
+value_type = array_type + "::value_type"
+
+iterator = array_type + "::iterator"
+riterator = array_type + "::reverse_iterator"
+
+self.expect_expr("a",
+ result_type=array_type,
+ result_children=[
+ ValueCheck(name="__elems_", children=[
+ ValueCheck(value="3"),
+ ValueCheck(value="1"),
+ ValueCheck(value="2"),
+ ])
+ ])
+self.expect_expr("a.size()", result_type=size_type, result_value="3")
+self.expect_expr("a.front()", result_type=value_type, result_value="3")
+self.expect_expr("a[1]", result_type=value_type, result_value="1")
+self.expect_expr("a.back()", result_type=value_type, result_value="2")
+
+# Both are just pointers to the underlying elements.
+self.expect_expr("a.begin()", result_type=iterator)
+self.expect_expr("a.rbegin()", result_type=riterator)
+
+self.expect_expr("*a.begin()", result_type=value_type, 
result_value="3")
+self.expect_expr("*a.rbegin()", result_type="int", result_value="2")
+
+self.expect_expr("a.at(0)", result_type=value_type, result_value="3")
+
+
+# Same again with an array that has an element type from debug info.
+array_type = "std::array"
+size_type = "std::array::size_type"
+value_type = array_type + "::value_type"
+
+iterator = array_type + "::iterator"
+riterator = array_type + "::reverse_iterator"
+dbg_info_elem_children = [ValueCheck(value="4")]
+dbg_info_elem = [ValueCheck(children=dbg_info_elem_children)]
+
+self.expect_expr("b",
+ result_type=array_type,
+ result_children=[
+ ValueCheck(name="__elems_", 
children=dbg_info_elem)
+ ])
+self.expec

[llvm-branch-commits] [llvm] e71a4cc - fix a -Wunused-variable warning in release build

2020-12-17 Thread Krasimir Georgiev via llvm-branch-commits

Author: Krasimir Georgiev
Date: 2020-12-17T11:52:00+01:00
New Revision: e71a4cc20789f66470d69cbe32626761da642130

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

LOG: fix a -Wunused-variable warning in release build

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp 
b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index ef151a60a35c..657f7cb03249 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -4453,9 +4453,8 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode 
*Node) {
 SDValue Op = Node->getOperand(IsStrict ? 1 : 0);
 SDValue Chain = IsStrict ? Node->getOperand(0) : SDValue();
 EVT VT = Node->getValueType(0);
-const ConstantSDNode *Trunc =
-cast(Node->getOperand(IsStrict ? 2 : 1));
-assert(Trunc->isNullValue() &&
+assert(cast(Node->getOperand(IsStrict ? 2 : 1))
+   ->isNullValue() &&
"Unable to expand as libcall if it is not normal rounding");
 
 RTLIB::Libcall LC = RTLIB::getFPROUND(Op.getValueType(), VT);



___
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] 931e66b - [X86] Remove extract_subvector(subv_broadcast_load()) fold.

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T11:02:49Z
New Revision: 931e66bd899cbc10822fd80e7447eb3df0db1176

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

LOG: [X86] Remove extract_subvector(subv_broadcast_load()) fold.

This was needed in an earlier version of D92645, but isn't now - and I've just 
noticed that it was potentially flawed depending on the relevant widths of the 
broadcasted and extracted subvectors.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 5264014f2b8f..20a75cb64fa8 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -49390,8 +49390,7 @@ static SDValue combineExtractSubvector(SDNode *N, 
SelectionDAG &DAG,
   // extract the lowest subvector instead which should allow
   // SimplifyDemandedVectorElts do more simplifications.
   if (IdxVal != 0 && (InVec.getOpcode() == X86ISD::VBROADCAST ||
-  InVec.getOpcode() == X86ISD::VBROADCAST_LOAD ||
-  InVec.getOpcode() == X86ISD::SUBV_BROADCAST_LOAD))
+  InVec.getOpcode() == X86ISD::VBROADCAST_LOAD))
 return extractSubVector(InVec, 0, DAG, SDLoc(N), SizeInBits);
 
   // If we're extracting a broadcasted subvector, just use the source.



___
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] 9ed8e0c - [NFC] Reduce include files dependency and AA header cleanup (part 2).

2020-12-17 Thread via llvm-branch-commits

Author: dfukalov
Date: 2020-12-17T14:04:48+03:00
New Revision: 9ed8e0caab9b6f638e82979f6fdf60d67ce65b92

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

LOG: [NFC] Reduce include files dependency and AA header cleanup (part 2).

Continuing work started in https://reviews.llvm.org/D92489:

Removed a bunch of includes from "AliasAnalysis.h" and "LoopPassManager.h".

Reviewed By: RKSimon

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

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
lld/MachO/Driver.cpp
llvm/examples/Bye/Bye.cpp
llvm/include/llvm/Analysis/AliasAnalysis.h
llvm/include/llvm/Analysis/BasicAliasAnalysis.h
llvm/include/llvm/Analysis/MemorySSA.h
llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
llvm/lib/Analysis/AliasAnalysis.cpp
llvm/lib/Analysis/MemDepPrinter.cpp
llvm/lib/Analysis/MemorySSA.cpp
llvm/lib/Analysis/ScopedNoAliasAA.cpp
llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp
llvm/lib/CodeGen/LiveIntervals.cpp
llvm/lib/LTO/Caching.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp
llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/lib/Transforms/IPO/FunctionAttrs.cpp
llvm/lib/Transforms/IPO/HotColdSplitting.cpp
llvm/lib/Transforms/IPO/Inliner.cpp
llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
llvm/lib/Transforms/Scalar/FlattenCFGPass.cpp
llvm/lib/Transforms/Scalar/Float2Int.cpp
llvm/lib/Transforms/Scalar/LoopDistribute.cpp
llvm/lib/Transforms/Scalar/LoopLoadElimination.cpp
llvm/lib/Transforms/Scalar/LoopPassManager.cpp
llvm/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
llvm/lib/Transforms/Utils/LoopVersioning.cpp
llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
llvm/tools/opt/NewPMDriver.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 2dbf30ef171f..b326c643738f 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/StackSafetyAnalysis.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 030cbef53049..c522a082a306 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -34,6 +34,7 @@
 #include "llvm/LTO/LTO.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"

diff  --git a/llvm/examples/Bye/Bye.cpp b/llvm/examples/Bye/Bye.cpp
index 4e39cd5c660b..78b4363123c3 100644
--- a/llvm/examples/Bye/Bye.cpp
+++ b/llvm/examples/Bye/Bye.cpp
@@ -3,6 +3,7 @@
 #include "llvm/Pass.h"
 #include "llvm/Passes/PassBuilder.h"
 #include "llvm/Passes/PassPlugin.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/IPO/PassManagerBuilder.h"
 

diff  --git a/llvm/include/llvm/Analysis/AliasAnalysis.h 
b/llvm/include/llvm/Analysis/AliasAnalysis.h
index cc5cec44b455..b84febaeeeaa 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -42,8 +42,6 @@
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Analysis/MemoryLocation.h"
-#include "llvm/IR/Instruction.h"
-#include "llvm/IR/Instructions.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Pass.h"
 #include 
@@ -54,10 +52,17 @@
 namespace llvm {
 
 class AnalysisUsage;
+class AtomicCmpXchgInst;
 class BasicAAResult;
 class BasicBlock;
+class CatchPadInst;
+class CatchReturnInst;
 class DominatorTree;
+class FenceInst;
 class Function;
+class InvokeInst;
+class PreservedAnalyses;
+class TargetLibraryInfo;
 class Value;
 
 /// The possible results of an alias query.
@@ -768,40 +773,7 @@ class AAResults {
AAQueryInfo &AAQI);
   ModRefInfo getModRefInfo(const Instruction *I,
const Optional &OptLoc,
-   AAQueryInfo &AAQIP) {
-if (OptLoc == None) {
-  if (const auto *Call = dyn_cast(I)) {
-return createModRefInfo(getModRefBehavior(Call));
-  }
-}
-
-c

[llvm-branch-commits] [llvm] 6d2a789 - [SVE][CodeGen] Add bfloat16 support to scalable masked gather

2020-12-17 Thread Kerry McLaughlin via llvm-branch-commits

Author: Kerry McLaughlin
Date: 2020-12-17T11:08:15Z
New Revision: 6d2a78996bee74611dad55b6c42b828ce1ee0953

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

LOG: [SVE][CodeGen] Add bfloat16 support to scalable masked gather

Reviewed By: david-arm

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

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-scaled.ll
llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-unscaled.ll
llvm/test/CodeGen/AArch64/sve-masked-gather-32b-unsigned-scaled.ll
llvm/test/CodeGen/AArch64/sve-masked-gather-32b-unsigned-unscaled.ll
llvm/test/CodeGen/AArch64/sve-masked-gather-64b-scaled.ll
llvm/test/CodeGen/AArch64/sve-masked-gather-64b-unscaled.ll
llvm/test/CodeGen/AArch64/sve-masked-scatter-legalise.ll

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp 
b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index e4d1b514b776..9eeacc8df0bf 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -1151,8 +1151,10 @@ AArch64TargetLowering::AArch64TargetLowering(const 
TargetMachine &TM,
   setOperationAction(ISD::VECREDUCE_SEQ_FADD, VT, Custom);
 }
 
-for (auto VT : {MVT::nxv2bf16, MVT::nxv4bf16, MVT::nxv8bf16})
+for (auto VT : {MVT::nxv2bf16, MVT::nxv4bf16, MVT::nxv8bf16}) {
+  setOperationAction(ISD::MGATHER, VT, Custom);
   setOperationAction(ISD::MSCATTER, VT, Custom);
+}
 
 setOperationAction(ISD::SPLAT_VECTOR, MVT::nxv8bf16, Custom);
 

diff  --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td 
b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
index adbace24ee6c..fbe24460d51f 100644
--- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td
@@ -1196,6 +1196,10 @@ let Predicates = [HasSVE] in {
   (UUNPKLO_ZZ_D ZPR:$Zs)>;
 def : Pat<(nxv2bf16 (extract_subvector (nxv4bf16 ZPR:$Zs), (i64 2))),
   (UUNPKHI_ZZ_D ZPR:$Zs)>;
+def : Pat<(nxv4bf16 (extract_subvector (nxv8bf16 ZPR:$Zs), (i64 0))),
+  (UUNPKLO_ZZ_S ZPR:$Zs)>;
+def : Pat<(nxv4bf16 (extract_subvector (nxv8bf16 ZPR:$Zs), (i64 4))),
+  (UUNPKHI_ZZ_S ZPR:$Zs)>;
   }
 
   def : Pat<(nxv4f16 (extract_subvector (nxv8f16 ZPR:$Zs), (i64 0))),

diff  --git a/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-scaled.ll 
b/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-scaled.ll
index e6b89b0070d6..25d0a471c29a 100644
--- a/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-scaled.ll
+++ b/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-scaled.ll
@@ -48,6 +48,16 @@ define  @masked_gather_nxv2f16(half* 
%base,  %vals
 }
 
+define  @masked_gather_nxv2bf16(bfloat* %base,  %offsets,  %mask) #0 {
+; CHECK-LABEL: masked_gather_nxv2bf16:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ld1h { z0.d }, p0/z, [x0, z0.d, sxtw #1]
+; CHECK-NEXT:ret
+  %ptrs = getelementptr bfloat, bfloat* %base,  %offsets
+  %vals = call  @llvm.masked.gather.nxv2bf16( %ptrs, i32 2,  %mask,  undef)
+  ret  %vals
+}
+
 define  @masked_gather_nxv2f32(float* %base,  %offsets,  %mask) {
 ; CHECK-LABEL: masked_gather_nxv2f32:
 ; CHECK:   // %bb.0:
@@ -125,6 +135,16 @@ define  @masked_gather_nxv4f16(half* 
%base,  %vals
 }
 
+define  @masked_gather_nxv4bf16(bfloat* %base,  %offsets,  %mask) #0 {
+; CHECK-LABEL: masked_gather_nxv4bf16:
+; CHECK:   // %bb.0:
+; CHECK-NEXT:ld1h { z0.s }, p0/z, [x0, z0.s, sxtw #1]
+; CHECK-NEXT:ret
+  %ptrs = getelementptr bfloat, bfloat* %base,  %offsets
+  %vals = call  @llvm.masked.gather.nxv4bf16( %ptrs, i32 2,  %mask,  undef)
+  ret  %vals
+}
+
 define  @masked_gather_nxv4f32(float* %base,  %offsets,  %mask) {
 ; CHECK-LABEL: masked_gather_nxv4f32:
 ; CHECK:   // %bb.0:
@@ -150,10 +170,13 @@ declare  
@llvm.masked.gather.nxv2i16(, i32,
 declare  @llvm.masked.gather.nxv2i32(, 
i32, , )
 declare  @llvm.masked.gather.nxv2i64(, 
i32, , )
 declare  @llvm.masked.gather.nxv2f16(, 
i32, , )
+declare  @llvm.masked.gather.nxv2bf16(, i32, , )
 declare  @llvm.masked.gather.nxv2f32(, i32, , )
 declare  @llvm.masked.gather.nxv2f64(, i32, , )
 
 declare  @llvm.masked.gather.nxv4i16(, 
i32, , )
 declare  @llvm.masked.gather.nxv4i32(, 
i32, , )
 declare  @llvm.masked.gather.nxv4f16(, 
i32, , )
+declare  @llvm.masked.gather.nxv4bf16(, i32, , )
 declare  @llvm.masked.gather.nxv4f32(, i32, , )
+attributes #0 = { "target-features"="+sve,+bf16" }

diff  --git 
a/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-unscaled.ll 
b/llvm/test/CodeGen/AArch64/sve-masked-gather-32b-signed-unscaled.ll
index 2d4ce50e8464..b9bf9049d46f

[llvm-branch-commits] [mlir] c275125 - [mlir] partially update LLVM dialect documentation

2020-12-17 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2020-12-17T12:32:34+01:00
New Revision: c2751250f33f61e95e5d9feec95e5b063c601806

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

LOG: [mlir] partially update LLVM dialect documentation

Rewrite the parts of the documentation that became stale: context/module
handling and type system. Expand the type system description.

Reviewed By: nicolasvasilache

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

Added: 


Modified: 
mlir/docs/Dialects/LLVM.md

Removed: 




diff  --git a/mlir/docs/Dialects/LLVM.md b/mlir/docs/Dialects/LLVM.md
index 9e2dbd65b4a3..c4607dbd735b 100644
--- a/mlir/docs/Dialects/LLVM.md
+++ b/mlir/docs/Dialects/LLVM.md
@@ -1,49 +1,296 @@
 # 'llvm' Dialect
 
-This dialect wraps the LLVM IR types and instructions into MLIR types and
-operations. It provides several additional operations that are necessary to
-cover for the 
diff erences in the IR structure (e.g., MLIR does not have `phi`
-operations and LLVM IR does not have a `constant` operation).
+This dialect maps [LLVM IR](https://llvm.org/docs/LangRef.html) into MLIR by
+defining the corresponding operations and types. LLVM IR metadata is usually
+represented as MLIR attributes, which offer additional structure verification.
 
-In this document, we use "LLVM IR" to designate the
+We use "LLVM IR" to designate the
 [intermediate representation of LLVM](https://llvm.org/docs/LangRef.html) and
-"LLVM IR _dialect_" to refer to the MLIR dialect reflecting LLVM instructions
-and types.
+"LLVM _dialect_" or "LLVM IR _dialect_" to refer to this MLIR dialect.
+
+Unless explicitly stated otherwise, the semantics of the LLVM dialect 
operations
+must correspond to the semantics of LLVM IR instructions and any divergence is
+considered a bug. The dialect also contains auxiliary operations that smoothen
+the 
diff erences in the IR structure, e.g., MLIR does not have `phi` operations
+and LLVM IR does not have a `constant` operation. These auxiliary operations 
are
+systematically prefixed with `mlir`, e.g. `llvm.mlir.constant` where `llvm.` is
+the dialect namespace prefix.
 
 [TOC]
 
-## Context and Module Association
+## Dependency on LLVM IR
+
+LLVM dialect is not expected to depend on any object that requires an
+`LLVMContext`, such as an LLVM IR instruction or type. Instead, MLIR provides
+thread-safe alternatives compatible with the rest of the infrastructure. The
+dialect is allowed to depend on the LLVM IR objects that don't require a
+context, such as data layout and triple description.
+
+## Module Structure
+
+IR modules use the built-in MLIR `ModuleOp` and support all its features. In
+particular, modules can be named, nested and are subject to symbol visibility.
+Modules can contain any operations, including LLVM functions and globals.
 
-The LLVM IR dialect object _contains_ an LLVM Context and an LLVM Module that 
it
-uses to define, print, parse and manage LLVM IR types. These objects can be
-obtained from the dialect object using `.getLLVMContext()` and
-`getLLVMModule()`. All LLVM IR objects that interact with the LLVM IR dialect
-must exist in the dialect's context.
+### Data Layout and Triple
+
+An IR module may have an optional data layout and triple information attached
+using MLIR attributes `llvm.data_layout` and `llvm.triple`, respectively. Both
+are string attributes with the
+[same syntax](https://llvm.org/docs/LangRef.html#data-layout) as in LLVM IR and
+are verified to be correct. They can be defined as follows.
+
+```mlir
+module attributes {llvm.data_layout = "e",
+   llvm.target_triple = "aarch64-linux-android"} {
+  // module contents
+}
+```
 
 ## Types
 
-The LLVM IR dialect defines a single MLIR type, `LLVM::LLVMType`, that can wrap
-any existing LLVM IR type. Its syntax is as follows
+LLVM dialect defines a set of types that correspond to LLVM IR types. The
+dialect type system is _closed_: types from other dialects are not allowed
+within LLVM dialect aggregate types. This property allows for more concise
+custom syntax and ensures easy translation to LLVM IR.
+
+Similarly to other MLIR context-owned objects, the creation and manipulation of
+LLVM dialect types is thread-safe.
+
+MLIR does not support module-scoped named type declarations, e.g. `%s = type
+{i32, i32}` in LLVM IR. Instead, types must be fully specified at each use,
+except for recursive types where only the first reference to a named type needs
+to be fully specified. MLIR type aliases are supported for top-level types, 
i.e.
+they cannot be used inside the type due to type system closedness.
+
+The general syntax of LLVM dialect types is `!llvm.`, followed by a type kind
+identifier (e.g., `ptr` for pointer or `struct` for structure) and by an
+optional list of type 

[llvm-branch-commits] [mlir] ccdd8c7 - [mlir] Move LLVM Dialect Op documentation to ODS

2020-12-17 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2020-12-17T12:32:35+01:00
New Revision: ccdd8c7759459ef4b9b09820d241081d387be779

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

LOG: [mlir] Move LLVM Dialect Op documentation to ODS

This was long overdue. The initial documentation for the LLVM dialect was
introduced before ODS had support for long descriptions. This is now possible,
so the documentation is moved to ODS, which can serve as a single source of
truth. The high-level description of the dialect structure is updated to
reflect that.

Depends On: D93315

Reviewed By: rriddle, mehdi_amini

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

Added: 


Modified: 
mlir/docs/Dialects/LLVM.md
mlir/include/mlir/Dialect/LLVMIR/CMakeLists.txt
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td

Removed: 




diff  --git a/mlir/docs/Dialects/LLVM.md b/mlir/docs/Dialects/LLVM.md
index c4607dbd735b..fbe1a1cfe7ea 100644
--- a/mlir/docs/Dialects/LLVM.md
+++ b/mlir/docs/Dialects/LLVM.md
@@ -47,6 +47,143 @@ module attributes {llvm.data_layout = "e",
 }
 ```
 
+### Functions
+
+LLVM functions are represented by a special operation, `llvm.func`, that has
+syntax similar to that of the built-in function operation but supports
+LLVM-related features such as linkage and variadic argument lists. See detailed
+description in the operation list [below](#llvmfunc-mlirllvmllvmfuncop).
+
+### PHI Nodes and Block Arguments
+
+MLIR uses block arguments instead of PHI nodes to communicate values between
+blocks. Therefore, the LLVM dialect has no operation directly equivalent to
+`phi` in LLVM IR. Instead, all terminators can pass values as successor 
operands
+as these values will be forwarded as block arguments when the control flow is
+transferred.
+
+For example:
+
+```mlir
+^bb1:
+  %0 = llvm.addi %arg0, %cst : !llvm.i32
+  llvm.br ^bb2[%0: !llvm.i32]
+
+// If the control flow comes from ^bb1, %arg1 == %0.
+^bb2(%arg1: !llvm.i32)
+  // ...
+```
+
+is equivalent to LLVM IR
+
+```llvm
+%0:
+  %1 = add i32 %arg0, %cst
+  br %3
+
+%3:
+  %arg1 = phi [%1, %0], //...
+```
+
+Since there is no need to use the block identifier to 
diff erentiate the source
+of 
diff erent values, the LLVM dialect supports terminators that transfer the
+control flow to the same block with 
diff erent arguments. For example:
+
+```mlir
+^bb1:
+  llvm.cond_br %cond, ^bb2[%0: !llvm.i32], ^bb2[%1: !llvm.i32]
+
+^bb2(%arg0: !llvm.i32):
+  // ...
+```
+
+### Context-Level Values
+
+Some value kinds in LLVM IR, such as constants and undefs, are uniqued in
+context and used directly in relevant operations. MLIR does not support such
+values for thread-safety and concept parsimony reasons. Instead, regular values
+are produced by dedicated operations that have the corresponding semantics:
+[`llvm.mlir.constant`](#llvmmlirconstant-mlirllvmconstantop),
+[`llvm.mlir.undef`](#llvmmlirundef-mlirllvmundefop),
+[`llvm.mlir.null`](#llvmmlirnull-mlirnullop). Note how these operations are
+prefixed with `mlir.` to indicate that they don't belong to LLVM IR but are 
only
+necessary to model it in MLIR. The values produced by these operations are
+usable just like any other value.
+
+Examples:
+
+```mlir
+// Create an undefined value of structure type with a 32-bit integer followed
+// by a float.
+%0 = llvm.mlir.undef : !llvm.struct<(i32, float)>
+
+// Null pointer to i8.
+%1 = llvm.mlir.null : !llvm.ptr
+
+// Null pointer to a function with signature void().
+%2 = llvm.mlir.null : !llvm.ptr>
+
+// Constant 42 as i32.
+%3 = llvm.mlir.constant(42 : i32) : !llvm.i32
+
+// Splat dense vector constant.
+%3 = llvm.mlir.constant(dense<1.0> : vector<4xf32>) : !llvm.vec<4 x float>
+```
+
+Note that constants use built-in types within the initializer definition: MLIR
+attributes are typed and the attributes used for constants require a built-in
+type.
+
+### Globals
+
+Global variables are also defined using a special operation,
+[`llvm.mlir.global`](#llvmmlirglobal-mlirllvmglobalop), located at the module
+level. Globals are MLIR symbols and are identified by their name.
+
+Since functions need to be isolated-from-above, i.e. values defined outside the
+function cannot be directly used inside the function, an additional operation,
+[`llvm.mlir.addressof`](#llvmmliraddressof-mlirllvmaddressofop), is provided to
+locally define a value containing the _address_ of a global. The actual value
+can then be loaded from that pointer, or a new value can be stored into it if
+the global is not declared constant. This is similar to LLVM IR where globals
+are accessed through name and have a pointer type.
+
+### Linkage
+
+Module-level named objects in the LLVM dialect, namely functions and globals,
+have an optional _linkage_ attribute derived from LLVM IR
+[linkage types]

[llvm-branch-commits] [libcxx] 08a00c6 - [libcxx] Remove ifdefs in the message to static_assert. NFC.

2020-12-17 Thread Martin Storsjö via llvm-branch-commits

Author: Martin Storsjö
Date: 2020-12-17T13:37:52+02:00
New Revision: 08a00c6f43c187f8fb3b08dd98e269fb1fcff836

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

LOG: [libcxx] Remove ifdefs in the message to static_assert. NFC.

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

Added: 


Modified: 
libcxx/include/filesystem

Removed: 




diff  --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index 1a44d9f360e3..764ec6573a50 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -1236,11 +1236,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
 #endif
   is_same::__char_type, char>::value,
   "u8path(Source const&) requires Source have a character type of type "
-  "'char'"
-#ifndef _LIBCPP_NO_HAS_CHAR8_T
-  " or 'char8_t'"
-#endif
-  );
+  "'char' or 'char8_t'");
   return path(__s);
 }
 
@@ -1254,10 +1250,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
 #endif
   is_same::__char_type, char>::value,
   "u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
-#ifndef _LIBCPP_NO_HAS_CHAR8_T
-  " or 'char8_t'"
-#endif
-  );
+  " or 'char8_t'");
   return path(__f, __l);
 }
 



___
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] 7c504b6 - [AArch64] Renamed sve-masked-scatter-legalise.ll. NFC.

2020-12-17 Thread Kerry McLaughlin via llvm-branch-commits

Author: Kerry McLaughlin
Date: 2020-12-17T11:40:09Z
New Revision: 7c504b6dd0638c4bad40440060fdebc726dc0c07

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

LOG: [AArch64] Renamed sve-masked-scatter-legalise.ll. NFC.

Added: 
llvm/test/CodeGen/AArch64/sve-masked-scatter-legalize.ll

Modified: 


Removed: 
llvm/test/CodeGen/AArch64/sve-masked-scatter-legalise.ll



diff  --git a/llvm/test/CodeGen/AArch64/sve-masked-scatter-legalise.ll 
b/llvm/test/CodeGen/AArch64/sve-masked-scatter-legalize.ll
similarity index 100%
rename from llvm/test/CodeGen/AArch64/sve-masked-scatter-legalise.ll
rename to llvm/test/CodeGen/AArch64/sve-masked-scatter-legalize.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] [clang-tools-extra] 894c476 - [clangd] Add llvm:: qualifier to work around GCC bug. NFC

2020-12-17 Thread Sam McCall via llvm-branch-commits

Author: Sam McCall
Date: 2020-12-17T12:51:12+01:00
New Revision: 894c4761c67ac850e156a26aa427035a811d7aed

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

LOG: [clangd] Add llvm:: qualifier to work around GCC bug. NFC

Some old GCC versions seem to miss the default template parameter when
using the clang/Basic/LLVM.h forward declarations of SmallVector.

See D92788

Added: 


Modified: 
clang-tools-extra/clangd/Headers.h

Removed: 




diff  --git a/clang-tools-extra/clangd/Headers.h 
b/clang-tools-extra/clangd/Headers.h
index d86a4788f0a6..fd9db5562813 100644
--- a/clang-tools-extra/clangd/Headers.h
+++ b/clang-tools-extra/clangd/Headers.h
@@ -136,7 +136,7 @@ class IncludeStructure {
   unsigned fileIndex(llvm::StringRef Name);
   llvm::StringMap NameToIndex; // Values are file indexes.
   // Maps a file's index to that of the files it includes.
-  llvm::DenseMap> IncludeChildren;
+  llvm::DenseMap> IncludeChildren;
 };
 
 /// Returns a PPCallback that visits all inclusions in the main file.



___
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] 2d6b1e9 - [DebugInfo] Fix MSVC build by adding back necessary reverse_iterator != operator

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T12:06:44Z
New Revision: 2d6b1e9b5f3b6c49c0a7732583c984d8dcbc8a9d

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

LOG: [DebugInfo] Fix MSVC build by adding back necessary reverse_iterator != 
operator

Put back the std::reverse_iterator != operator that was 
removed in D78938 to fix VS2019 builds

Added: 


Modified: 
llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h

Removed: 




diff  --git a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h 
b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
index 5352dbe4b442..0f76d7f1b31c 100644
--- a/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ b/llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -463,6 +463,11 @@ inline bool operator==(const 
std::reverse_iterator &LHS,
   return LHS.equals(RHS);
 }
 
+inline bool operator!=(const std::reverse_iterator &LHS,
+   const std::reverse_iterator &RHS) {
+  return !(LHS == RHS);
+}
+
 inline std::reverse_iterator DWARFDie::rbegin() const {
   return llvm::make_reverse_iterator(end());
 }



___
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] 1fd3a04 - [LV] Disable epilogue vectorization for scalable VFs

2020-12-17 Thread Cullen Rhodes via llvm-branch-commits

Author: Cullen Rhodes
Date: 2020-12-17T12:14:03Z
New Revision: 1fd3a04775971d12e1063ceb2b22647fd4643acc

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

LOG: [LV] Disable epilogue vectorization for scalable VFs

Epilogue vectorization doesn't support scalable vectorization factors
yet, disable it for now.

Reviewed By: sdesmalen, bmahjour

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

Added: 


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

llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp 
b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 37863b035067..e486f7110295 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -5784,6 +5784,15 @@ 
LoopVectorizationCostModel::selectEpilogueVectorizationFactor(
 return Result;
   }
 
+  // FIXME: This can be fixed for scalable vectors later, because at this stage
+  // the LoopVectorizer will only consider vectorizing a loop with scalable
+  // vectors when the loop has a hint to enable vectorization for a given VF.
+  if (MainLoopVF.isScalable()) {
+LLVM_DEBUG(dbgs() << "LEV: Epilogue vectorization for scalable vectors not 
"
+ "yet supported.\n");
+return Result;
+  }
+
   // Not really a cost consideration, but check for unsupported cases here to
   // simplify the logic.
   if (!isCandidateForEpilogueVectorization(*TheLoop, MainLoopVF)) {

diff  --git 
a/llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
 
b/llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
index c4a8f0ded86b..315b1fed31ab 100644
--- 
a/llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
+++ 
b/llvm/test/Transforms/LoopVectorize/optimal-epilog-vectorization-limitations.ll
@@ -99,3 +99,27 @@ for.end.loopexit: ; preds = 
%for.body
 for.end:  ; preds = %for.end.loopexit, 
%entry
   ret void
 }
+
+; Currently we cannot handle scalable vectorization factors.
+; CHECK: LV: Checking a loop in "f4"
+; CHECK: LEV: Epilogue vectorization for scalable vectors not yet supported.
+
+define void @f4(i8* %A) {
+entry:
+  br label %for.body
+
+for.body:
+  %iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
+  %arrayidx = getelementptr inbounds i8, i8* %A, i64 %iv
+  store i8 1, i8* %arrayidx, align 1
+  %iv.next = add nuw nsw i64 %iv, 1
+  %exitcond = icmp ne i64 %iv.next, 1024
+  br i1 %exitcond, label %for.body, label %exit, !llvm.loop !0
+
+exit:
+  ret void
+}
+
+!0 = !{!0, !1, !2}
+!1 = !{!"llvm.loop.vectorize.width", i32 4}
+!2 = !{!"llvm.loop.vectorize.scalable.enable", i1 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] [lldb] 5644035 - [lldb] [unittests] Add tests for NetBSD register offsets/sizes

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T13:55:42+01:00
New Revision: 56440359d093ea6f8e9c91064fdd47928cf07092

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

LOG: [lldb] [unittests] Add tests for NetBSD register offsets/sizes

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

Added: 
lldb/unittests/Process/Utility/RegisterContextNetBSDTest_i386.cpp
lldb/unittests/Process/Utility/RegisterContextNetBSDTest_x86_64.cpp

Modified: 
lldb/unittests/Process/Utility/CMakeLists.txt

Removed: 




diff  --git a/lldb/unittests/Process/Utility/CMakeLists.txt 
b/lldb/unittests/Process/Utility/CMakeLists.txt
index 78e29ed262c9..8e4696b7211d 100644
--- a/lldb/unittests/Process/Utility/CMakeLists.txt
+++ b/lldb/unittests/Process/Utility/CMakeLists.txt
@@ -1,7 +1,19 @@
+set(NETBSD_SOURCES
+  RegisterContextNetBSDTest_i386.cpp
+  RegisterContextNetBSDTest_x86_64.cpp)
+
+if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+  list(APPEND PLATFORM_SOURCES ${NETBSD_SOURCES})
+endif()
+
+set(LLVM_OPTIONAL_SOURCES
+  ${NETBSD_SOURCES})
+
 add_lldb_unittest(ProcessUtilityTests
   RegisterContextTest.cpp
   RegisterContextFreeBSDTest.cpp
   LinuxProcMapsTest.cpp
+  ${PLATFORM_SOURCES}
 
   LINK_LIBS
 lldbPluginProcessUtility)

diff  --git a/lldb/unittests/Process/Utility/RegisterContextNetBSDTest_i386.cpp 
b/lldb/unittests/Process/Utility/RegisterContextNetBSDTest_i386.cpp
new file mode 100644
index ..07e09d34d191
--- /dev/null
+++ b/lldb/unittests/Process/Utility/RegisterContextNetBSDTest_i386.cpp
@@ -0,0 +1,118 @@
+//===-- RegisterContextNetBSDTest_i386.cpp 
===//
+//
+// 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
+//
+//===--===//
+
+#if defined(__i386__) || defined(__x86_64__)
+
+// clang-format off
+#include 
+#include 
+// clang-format on
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "Plugins/Process/Utility/lldb-x86-register-enums.h"
+#include "Plugins/Process/Utility/RegisterContextNetBSD_i386.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static std::pair GetRegParams(RegisterInfoInterface &ctx,
+  uint32_t reg) {
+  const RegisterInfo &info = ctx.GetRegisterInfo()[reg];
+  return {info.byte_offset, info.byte_size};
+}
+
+#define EXPECT_OFF(regname, offset, size)  
\
+  EXPECT_THAT(GetRegParams(reg_ctx, lldb_##regname),   
\
+  ::testing::Pair(offset + base_offset, size))
+
+#define EXPECT_GPR_I386(regname)   
\
+  EXPECT_THAT(GetRegParams(reg_ctx, lldb_##regname##_i386),
\
+  ::testing::Pair(offsetof(reg, r_##regname), \
+  sizeof(reg::r_##regname)))
+#define EXPECT_DBR_I386(num)   
\
+  EXPECT_OFF(dr##num##_i386, offsetof(dbreg, dr[num]),\
+ sizeof(dbreg::dr[num]))
+
+TEST(RegisterContextNetBSDTest, i386) {
+  ArchSpec arch{"i686-unknown-netbsd"};
+  RegisterContextNetBSD_i386 reg_ctx{arch};
+
+  EXPECT_GPR_I386(eax);
+  EXPECT_GPR_I386(ecx);
+  EXPECT_GPR_I386(edx);
+  EXPECT_GPR_I386(ebx);
+  EXPECT_GPR_I386(esp);
+  EXPECT_GPR_I386(ebp);
+  EXPECT_GPR_I386(esi);
+  EXPECT_GPR_I386(edi);
+  EXPECT_GPR_I386(eip);
+  EXPECT_GPR_I386(eflags);
+  EXPECT_GPR_I386(cs);
+  EXPECT_GPR_I386(ss);
+  EXPECT_GPR_I386(ds);
+  EXPECT_GPR_I386(es);
+  EXPECT_GPR_I386(fs);
+  EXPECT_GPR_I386(gs);
+
+  // fctrl is the first FPR field, it is used to determine offset of the whole
+  // FPR struct
+  size_t base_offset = reg_ctx.GetRegisterInfo()[lldb_fctrl_i386].byte_offset;
+
+  // assert against FXSAVE struct
+  EXPECT_OFF(fctrl_i386, 0x00, 2);
+  EXPECT_OFF(fstat_i386, 0x02, 2);
+  // TODO: This is a known bug, abridged ftag should is 8 bits in length.
+  EXPECT_OFF(ftag_i386, 0x04, 2);
+  EXPECT_OFF(fop_i386, 0x06, 2);
+  // NB: Technically fiseg/foseg are 16-bit long and the higher 16 bits
+  // are reserved.  However, we use them to access/recombine 64-bit FIP/FDP.
+  EXPECT_OFF(fioff_i386, 0x08, 4);
+  EXPECT_OFF(fiseg_i386, 0x0C, 4);
+  EXPECT_OFF(fooff_i386, 0x10, 4);
+  EXPECT_OFF(foseg_i386, 0x14, 4);
+  EXPECT_OFF(mxcsr_i386, 0x18, 4);
+  EXPECT_OFF(mxcsrmask_i386, 0x1C, 4);
+  EXPECT_OFF(st0_i386, 0x20, 10);
+  EXPECT_OFF(st1_i386, 0x30, 10);
+  EXPECT_OFF(st2_i386, 0x40, 10);
+  EXPECT_OFF(st3_i386, 0x50, 10);
+  EXPECT_OFF(st4_i386, 0x60, 10);
+  EXPECT_OFF(st5_i386, 0x70, 10);
+  EXPECT_OFF(st6_i386

[llvm-branch-commits] [lldb] 37f99a5 - [lldb] [unittests] Filter FreeBSD through CMake rather than #ifdef

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T13:55:42+01:00
New Revision: 37f99a56065209627020428cecb78f55dfa90580

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

LOG: [lldb] [unittests] Filter FreeBSD through CMake rather than #ifdef

Added: 


Modified: 
lldb/unittests/Process/Utility/CMakeLists.txt
lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp

Removed: 




diff  --git a/lldb/unittests/Process/Utility/CMakeLists.txt 
b/lldb/unittests/Process/Utility/CMakeLists.txt
index 8e4696b7211d..772e781b5cc5 100644
--- a/lldb/unittests/Process/Utility/CMakeLists.txt
+++ b/lldb/unittests/Process/Utility/CMakeLists.txt
@@ -1,17 +1,21 @@
+set(FREEBSD_SOURCES
+  RegisterContextFreeBSDTest.cpp)
 set(NETBSD_SOURCES
   RegisterContextNetBSDTest_i386.cpp
   RegisterContextNetBSDTest_x86_64.cpp)
 
-if (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+  list(APPEND PLATFORM_SOURCES ${FREEBSD_SOURCES})
+elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD")
   list(APPEND PLATFORM_SOURCES ${NETBSD_SOURCES})
 endif()
 
 set(LLVM_OPTIONAL_SOURCES
+  ${FREEBSD_SOURCES}
   ${NETBSD_SOURCES})
 
 add_lldb_unittest(ProcessUtilityTests
   RegisterContextTest.cpp
-  RegisterContextFreeBSDTest.cpp
   LinuxProcMapsTest.cpp
   ${PLATFORM_SOURCES}
 

diff  --git a/lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp 
b/lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp
index 7d875c9bd8a1..fe516d537662 100644
--- a/lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp
+++ b/lldb/unittests/Process/Utility/RegisterContextFreeBSDTest.cpp
@@ -6,8 +6,6 @@
 //
 
//===--===//
 
-#if defined(__FreeBSD__)
-
 // clang-format off
 #include 
 #include 
@@ -233,5 +231,3 @@ TEST(RegisterContextFreeBSDTest, i386) {
 }
 
 #endif // defined(__i386__) || defined(__x86_64__)
-
-#endif // defined(__FreeBSD__)



___
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] eb4917d - [mlir] Fix syntax error in markdown documentation

2020-12-17 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2020-12-17T14:09:31+01:00
New Revision: eb4917d121e21aaf8406efe3d5e4f1f06cb7c238

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

LOG: [mlir] Fix syntax error in markdown documentation

Added: 


Modified: 
mlir/docs/Dialects/LLVM.md

Removed: 




diff  --git a/mlir/docs/Dialects/LLVM.md b/mlir/docs/Dialects/LLVM.md
index fbe1a1cfe7ea..3b9150f0e69d 100644
--- a/mlir/docs/Dialects/LLVM.md
+++ b/mlir/docs/Dialects/LLVM.md
@@ -434,4 +434,4 @@ MLIR, blocks are not values and don't need a type.
 All operations in the LLVM IR dialect have a custom form in MLIR. The mnemonic
 of an operation is that used in LLVM IR prefixed with "`llvm.`".
 
-[include "Dialects/LLVMOps.md"
+[include "Dialects/LLVMOps.md"]



___
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] e7a3c4c - [lldb-vscode] Speculative fix for raciness in TestVSCode_attach

2020-12-17 Thread Pavel Labath via llvm-branch-commits

Author: Pavel Labath
Date: 2020-12-17T14:19:52+01:00
New Revision: e7a3c4c11e84ba99c3682ae6cf20c398f16cf3f5

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

LOG: [lldb-vscode] Speculative fix for raciness in TestVSCode_attach

The test appears to expect the inferior to be stopped, but the custom
"attach commands" leave it in a running state.

It's unclear how this could have ever worked.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py 
b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
index 7955b6a97b04..aa7a3ae17cb0 100644
--- a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
+++ b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
@@ -145,7 +145,7 @@ def test_commands(self):
 # and use it for debugging
 attachCommands = [
 'target create -d "%s"' % (program),
-'process launch'
+'process launch --stop-at-entry'
 ]
 initCommands = ['target list', 'platform list']
 preRunCommands = ['image list a.out', 'image dump sections a.out']



___
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] 29077ae - [IRBuilder] Generalize debug loc handling for arbitrary metadata.

2020-12-17 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2020-12-17T13:27:43Z
New Revision: 29077ae860bcf3c9e9f2ce67ca7dfe691b6fa148

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

LOG: [IRBuilder] Generalize debug loc handling for arbitrary metadata.

This patch extends IRBuilder to allow adding/preserving arbitrary
metadata on created instructions.

Instead of using references to specific metadata nodes (like DebugLoc),
IRbuilder now keeps a vector of (metadata kind, MDNode *) pairs, which
are added to each created instruction.

The patch itself is a NFC and only moves the existing debug location
handling over to the new system. In a follow-up patch it will be used to
preserve !annotation metadata besides !dbg.

The current approach requires iterating over MetadataToCopy to avoid
adding duplicates, but given that the number of metadata kinds to
copy/preserve is going to be very small initially (0, 1 (for !dbg) or 2
(!dbg and !annotation)) that should not matter.

Reviewed By: lebedev.ri

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

Added: 


Modified: 
llvm/include/llvm/IR/IRBuilder.h
llvm/include/llvm/Transforms/Utils/ScalarEvolutionExpander.h
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 




diff  --git a/llvm/include/llvm/IR/IRBuilder.h 
b/llvm/include/llvm/IR/IRBuilder.h
index 0191a2a6d28b..56005b26a538 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -17,6 +17,7 @@
 #include "llvm-c/Types.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/None.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/IR/BasicBlock.h"
@@ -24,6 +25,7 @@
 #include "llvm/IR/ConstantFolder.h"
 #include "llvm/IR/Constants.h"
 #include "llvm/IR/DataLayout.h"
+#include "llvm/IR/DebugInfoMetadata.h"
 #include "llvm/IR/DebugLoc.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
@@ -91,7 +93,28 @@ class IRBuilderCallbackInserter : public 
IRBuilderDefaultInserter {
 
 /// Common base class shared among various IRBuilders.
 class IRBuilderBase {
-  DebugLoc CurDbgLocation;
+  /// Pairs of (metadata kind, MDNode *) that should be added to all newly
+  /// created instructions, like !dbg metadata.
+  SmallVector, 2> MetadataToCopy;
+
+  /// Add or update the an entry (Kind, MD) to MetadataToCopy, if \p MD is not
+  /// null. If \p MD is null, remove the entry with \p Kind.
+  void AddOrRemoveMetadataToCopy(unsigned Kind, MDNode *MD) {
+if (!MD) {
+  erase_if(MetadataToCopy, [Kind](const std::pair &KV) 
{
+return KV.first == Kind;
+  });
+  return;
+}
+
+for (auto &KV : MetadataToCopy)
+  if (KV.first == Kind) {
+KV.second = MD;
+return;
+  }
+
+MetadataToCopy.emplace_back(Kind, MD);
+  }
 
 protected:
   BasicBlock *BB;
@@ -125,7 +148,7 @@ class IRBuilderBase {
   template
   InstTy *Insert(InstTy *I, const Twine &Name = "") const {
 Inserter.InsertHelper(I, Name, BB, InsertPt);
-SetInstDebugLocation(I);
+AddMetadataToInst(I);
 return I;
   }
 
@@ -182,16 +205,42 @@ class IRBuilderBase {
   }
 
   /// Set location information used by debugging information.
-  void SetCurrentDebugLocation(DebugLoc L) { CurDbgLocation = std::move(L); }
+  void SetCurrentDebugLocation(DebugLoc L) {
+AddOrRemoveMetadataToCopy(LLVMContext::MD_dbg, L.getAsMDNode());
+  }
+
+  /// Collect metadata with IDs \p MetadataKinds from \p Src which should be
+  /// added to all created instructions. Entries present in MedataDataToCopy 
but
+  /// not on \p Src will be dropped from MetadataToCopy.
+  void CollectMetadataToCopy(Instruction *Src,
+ ArrayRef MetadataKinds) {
+for (unsigned K : MetadataKinds)
+  AddOrRemoveMetadataToCopy(K, Src->getMetadata(K));
+  }
 
   /// Get location information used by debugging information.
-  const DebugLoc &getCurrentDebugLocation() const { return CurDbgLocation; }
+  DebugLoc getCurrentDebugLocation() const {
+for (auto &KV : MetadataToCopy)
+  if (KV.first == LLVMContext::MD_dbg)
+return {cast(KV.second)};
+
+return {};
+  }
 
   /// If this builder has a current debug location, set it on the
   /// specified instruction.
   void SetInstDebugLocation(Instruction *I) const {
-if (CurDbgLocation)
-  I->setDebugLoc(CurDbgLocation);
+for (const auto &KV : MetadataToCopy)
+  if (KV.first == LLVMContext::MD_dbg) {
+I->setDebugLoc(DebugLoc(KV.second));
+return;
+  }
+  }
+
+  /// Add all entries in MetadataToCopy to \p I.
+  void AddMetadataToInst(Instruction *I) const {
+for (auto &KV : MetadataToCopy)
+  I->setMetadata(KV.first, KV.second);
   }
 
   /// Get the return type of the current funct

[llvm-branch-commits] [llvm] b5bbb4b - [NFC][AArch64] Move AArch64 MSR/MRS into a new decoder namespace

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:40:10Z
New Revision: b5bbb4b2b75302d1d8080529ec7e9737a507ff1d

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

LOG: [NFC][AArch64] Move AArch64 MSR/MRS into a new decoder namespace

This removes the general forms of the AArch64 MSR and MRS instructions
from the same decoding table that contains many more specific
instructions that supersede them. They're now in a separate decoding
table of their own, called "Fallback", which is only consulted in the
event of the main decoder table failing to produce an answer.

This should avoid decoding conflicts on future specialized instructions
in the MSR space.

Patch written by Simon Tatham.

Reviewed By: ostannard

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

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td 
b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 2756e4dc8aa4..0f6ae93742bf 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1447,6 +1447,7 @@ class MRSI : RtSystemI<1, (outs GPR64:$Rt), (ins 
mrs_sysreg_op:$systemreg),
"mrs", "\t$Rt, $systemreg"> {
   bits<16> systemreg;
   let Inst{20-5} = systemreg;
+  let DecoderNamespace = "Fallback";
 }
 
 // FIXME: Some of these def NZCV, others don't. Best way to model that?
@@ -1456,6 +1457,7 @@ class MSRI : RtSystemI<0, (outs), (ins 
msr_sysreg_op:$systemreg, GPR64:$Rt),
"msr", "\t$systemreg, $Rt"> {
   bits<16> systemreg;
   let Inst{20-5} = systemreg;
+  let DecoderNamespace = "Fallback";
 }
 
 def SystemPStateFieldWithImm0_15Operand : AsmOperandClass {

diff  --git a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp 
b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
index 1ff4abb34054..e1a96ce8bdb1 100644
--- a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
+++ b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
@@ -267,8 +267,16 @@ DecodeStatus AArch64Disassembler::getInstruction(MCInst 
&MI, uint64_t &Size,
   uint32_t Insn =
   (Bytes[3] << 24) | (Bytes[2] << 16) | (Bytes[1] << 8) | (Bytes[0] << 0);
 
-  // Calling the auto-generated decoder function.
-  return decodeInstruction(DecoderTable32, MI, Insn, Address, this, STI);
+  const uint8_t *Tables[] = {DecoderTable32, DecoderTableFallback32};
+
+  for (auto Table : Tables) {
+DecodeStatus Result =
+decodeInstruction(Table, MI, Insn, Address, this, STI);
+if (Result != MCDisassembler::Fail)
+  return Result;
+  }
+
+  return MCDisassembler::Fail;
 }
 
 static MCSymbolizer *



___
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] 83ea17f - [NFC][AArch64] Capturing multiple feature requirements in AsmParser messages

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:44:17Z
New Revision: 83ea17fc5f742abb0ab0757ef9e667a4e2b39ea8

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

LOG: [NFC][AArch64] Capturing multiple feature requirements in AsmParser 
messages

This enables the capturing of multiple required features in the AArch64
AsmParser's SysAlias error messages.

Reviewed By: ostannard

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

Added: 


Modified: 
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/test/MC/AArch64/armv8.2a-at.s
llvm/test/MC/AArch64/armv8.2a-persistent-memory.s
llvm/test/MC/AArch64/armv8.4a-tlb.s
llvm/test/MC/AArch64/armv8.5a-mte.s
llvm/test/MC/AArch64/armv8.5a-persistent-memory.s
llvm/test/MC/AArch64/armv8.5a-predres.s
llvm/test/MC/AArch64/directive-arch_extension-negative.s

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp 
b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index ae95d54b2d90..f3514f1d47f7 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -2907,14 +2907,13 @@ static void setRequiredFeatureString(FeatureBitset FBS, 
std::string &Str) {
   else if (FBS[AArch64::HasV8_6aOps])
 Str += "ARMv8.6a";
   else {
-auto ext = std::find_if(std::begin(ExtensionMap),
-  std::end(ExtensionMap),
-  [&](const Extension& e)
+SmallVector ExtMatches;
+for (const auto& Ext : ExtensionMap) {
   // Use & in case multiple features are enabled
-  { return (FBS & e.Features) != FeatureBitset(); }
-);
-
-Str += ext != std::end(ExtensionMap) ? ext->Name : "(unknown)";
+  if ((FBS & Ext.Features) != FeatureBitset())
+ExtMatches.push_back(Ext.Name);
+}
+Str += !ExtMatches.empty() ? llvm::join(ExtMatches, ", ") : "(unknown)";
   }
 }
 
@@ -2959,7 +2958,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, 
SMLoc NameLoc,
 if (!IC)
   return TokError("invalid operand for IC instruction");
 else if (!IC->haveFeatures(getSTI().getFeatureBits())) {
-  std::string Str("IC " + std::string(IC->Name) + " requires ");
+  std::string Str("IC " + std::string(IC->Name) + " requires: ");
   setRequiredFeatureString(IC->getRequiredFeatures(), Str);
   return TokError(Str.c_str());
 }
@@ -2969,7 +2968,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, 
SMLoc NameLoc,
 if (!DC)
   return TokError("invalid operand for DC instruction");
 else if (!DC->haveFeatures(getSTI().getFeatureBits())) {
-  std::string Str("DC " + std::string(DC->Name) + " requires ");
+  std::string Str("DC " + std::string(DC->Name) + " requires: ");
   setRequiredFeatureString(DC->getRequiredFeatures(), Str);
   return TokError(Str.c_str());
 }
@@ -2979,7 +2978,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, 
SMLoc NameLoc,
 if (!AT)
   return TokError("invalid operand for AT instruction");
 else if (!AT->haveFeatures(getSTI().getFeatureBits())) {
-  std::string Str("AT " + std::string(AT->Name) + " requires ");
+  std::string Str("AT " + std::string(AT->Name) + " requires: ");
   setRequiredFeatureString(AT->getRequiredFeatures(), Str);
   return TokError(Str.c_str());
 }
@@ -2989,7 +2988,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, 
SMLoc NameLoc,
 if (!TLBI)
   return TokError("invalid operand for TLBI instruction");
 else if (!TLBI->haveFeatures(getSTI().getFeatureBits())) {
-  std::string Str("TLBI " + std::string(TLBI->Name) + " requires ");
+  std::string Str("TLBI " + std::string(TLBI->Name) + " requires: ");
   setRequiredFeatureString(TLBI->getRequiredFeatures(), Str);
   return TokError(Str.c_str());
 }
@@ -3000,7 +2999,7 @@ bool AArch64AsmParser::parseSysAlias(StringRef Name, 
SMLoc NameLoc,
   return TokError("invalid operand for prediction restriction 
instruction");
 else if (!PRCTX->haveFeatures(getSTI().getFeatureBits())) {
   std::string Str(
-  Mnemonic.upper() + std::string(PRCTX->Name) + " requires ");
+  Mnemonic.upper() + std::string(PRCTX->Name) + " requires: ");
   setRequiredFeatureString(PRCTX->getRequiredFeatures(), Str);
   return TokError(Str.c_str());
 }

diff  --git a/llvm/test/MC/AArch64/armv8.2a-at.s 
b/llvm/test/MC/AArch64/armv8.2a-at.s
index 3c26fb9ea3a1..1e8b4ca5a93d 100644
--- a/llvm/test/MC/AArch64/armv8.2a-at.s
+++ b/llvm/test/MC/AArch64/armv8.2a-at.s
@@ -7,5 +7,5 @@
   at s1e1wp, x2
 // CHECK: at  s1e1rp, x1  // encoding: [0x01,0x79,0x08,0xd5]
 // CHECK: at  s1e1wp, x2  // encoding: [0x22,0x79,0x08,0xd5]
-// ERROR: error: AT S1E1RP requir

[llvm-branch-commits] [llvm] 42b92b3 - [ARM][AArch64] Adding basic support for the v8.7-A architecture

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:45:08Z
New Revision: 42b92b31b8b8ee9fdcd68adfe57db11561a5edcd

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

LOG: [ARM][AArch64] Adding basic support for the v8.7-A architecture

This introduces support for the v8.7-A architecture through a new
subtarget feature called "v8.7a". It adds two new "WFET" and "WFIT"
instructions, the nXS limited-TLB-maintenance qualifier for DSB and TLBI
instructions, a new CPU id register, ID_AA64ISAR2_EL1, and the new
HCRX_EL2 system register.

Based on patches written by Simon Tatham and Victor Campos.

Reviewed By: ostannard

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

Added: 
llvm/test/MC/AArch64/armv8.7a-hcx.s
llvm/test/MC/AArch64/armv8.7a-wfxt.s
llvm/test/MC/AArch64/armv8.7a-xs.s
llvm/test/MC/Disassembler/AArch64/armv8.7a-hcx.txt
llvm/test/MC/Disassembler/AArch64/armv8.7a-wfxt.txt
llvm/test/MC/Disassembler/AArch64/armv8.7a-xs.txt

Modified: 
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/AArch64/AArch64SystemOperands.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp
llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h
llvm/lib/Target/ARM/ARMSubtarget.h
llvm/test/MC/AArch64/arm64-system-encoding.s
llvm/test/MC/AArch64/basic-a64-diagnostics.s
llvm/test/MC/Disassembler/AArch64/basic-a64-instructions.txt

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index 5bafe430a1b4..fd7894aa3fcb 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -400,6 +400,15 @@ def FeatureMatMulFP32 : SubtargetFeature<"f32mm", 
"HasMatMulFP32",
 def FeatureMatMulFP64 : SubtargetFeature<"f64mm", "HasMatMulFP64",
 "true", "Enable Matrix Multiply FP64 Extension", [FeatureSVE]>;
 
+def FeatureXS : SubtargetFeature<"xs", "HasXS",
+"true", "Enable Armv8.7-A limited-TLB-maintenance instruction">;
+
+def FeatureWFxT : SubtargetFeature<"wfxt", "HasWFxT",
+"true", "Enable Armv8.7-A WFET and WFIT instruction">;
+
+def FeatureHCX : SubtargetFeature<
+"hcx", "HasHCX", "true", "Enable Armv8.7-A HCRX_EL2 system register">;
+
 def FeatureFineGrainedTraps : SubtargetFeature<"fgt", "HasFineGrainedTraps",
 "true", "Enable fine grained virtualization traps extension">;
 
@@ -440,6 +449,10 @@ def HasV8_6aOps : SubtargetFeature<
   [HasV8_5aOps, FeatureAMVS, FeatureBF16, FeatureFineGrainedTraps,
FeatureEnhancedCounterVirtualization, FeatureMatMulInt8]>;
 
+def HasV8_7aOps : SubtargetFeature<
+  "v8.7a", "HasV8_7aOps", "true", "Support ARM v8.7a instructions",
+  [HasV8_6aOps, FeatureXS, FeatureWFxT, FeatureHCX]>;
+
 def HasV8_0rOps : SubtargetFeature<
   "v8r", "HasV8_0rOps", "true", "Support ARM v8r instructions",
   [//v8.1

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td 
b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 0f6ae93742bf..3c19a5bad573 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -1297,8 +1297,9 @@ class SimpleSystemI
-: BaseSystemI,
+class RtSystemI pattern = []>
+: BaseSystemI,
   Sched<[WriteSys]> {
   bits<5> Rt;
   let Inst{4-0} = Rt;
@@ -1326,6 +1327,16 @@ class TMSystemI CRm, string asm, list 
pattern>
   let Inst{4-0} = Rt;
 }
 
+// System instructions that pass a register argument
+// This class assumes the register is for input rather than output.
+class RegInputSystemI CRm, bits<3> Op2, string asm,
+  list pattern = []>
+: RtSystemI<0, (outs), (ins GPR64:$Rt), asm, "\t$Rt", pattern> {
+  let Inst{20-12} = 0b000110001;
+  let Inst{11-8} = CRm;
+  let Inst{7-5} = Op2;
+}
+
 // System instructions for transactional memory - no operand
 class TMSystemINoOperand CRm, string asm, list pattern>
 : TMBaseSystemI<0b0, CRm, 0b011, (outs), (ins), asm, "", pattern> {
@@ -1366,6 +1377,14 @@ def barrier_op : Operand {
   let PrintMethod = "printBarrierOption";
   let ParserMatchClass = BarrierAsmOperand;
 }
+def BarriernXSAsmOperand : AsmOperandClass {
+  let Name = "BarriernXS";
+  let ParserMethod = "tryParseBarriernXSOperand";
+}
+def barrier_nxs_op : Operand {
+  let PrintMethod = "printBarriernXSOption";
+  let ParserMatchClass = BarriernXSAsmOperand;
+}
 class CRmSystemI opc, string asm,
  list pattern = []>
 : SimpleSystemI<0, (ins crmtype:$CRm), asm, "\t$CRm", pattern>,

diff  --git 

[llvm-branch-commits] [llvm] 97c006a - [AArch64] Add a GPR64x8 register class

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:45:46Z
New Revision: 97c006aabb6c831d68204bcb4aad8670af695618

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

LOG: [AArch64] Add a GPR64x8 register class

This adds a GPR64x8 register class that will be needed as the data
operand to the LD64B/ST64B family of instructions in the v8.7-A
Accelerator Extension, which load or store a contiguous range of eight
x-regs. It has to be its own register class so that register allocation
will have visibility of the full set of registers actually read/written
by the instructions, which will be needed when we add intrinsics and/or
inline asm access to this piece of architecture.

Patch written by Simon Tatham.

Reviewed By: ostannard

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

Added: 


Modified: 
llvm/lib/Target/AArch64/AArch64RegisterInfo.td
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td 
b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
index 54b351fda053..28d1988b8a5f 100644
--- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td
@@ -711,6 +711,32 @@ def XSeqPairClassOperand :
 
 //===- END: v8.1a atomic CASP register operands 
---===//
 
+//===--===//
+// Armv8.7a accelerator extension register operands: 8 consecutive GPRs
+// starting with an even one
+
+let Namespace = "AArch64" in {
+  foreach i = 0-7 in
+def "x8sub_"#i : SubRegIndex<64, !mul(64, i)>;
+}
+
+def Tuples8X : RegisterTuples<
+  !foreach(i, [0,1,2,3,4,5,6,7], !cast("x8sub_"#i)),
+  !foreach(i, [0,1,2,3,4,5,6,7], (trunc (decimate (rotl GPR64, i), 2), 12))>;
+
+def GPR64x8Class : RegisterClass<"AArch64", [i64], 64, (trunc Tuples8X, 12)>;
+def GPR64x8AsmOp : AsmOperandClass {
+  let Name = "GPR64x8";
+  let ParserMethod = "tryParseGPR64x8";
+  let RenderMethod = "addRegOperands";
+}
+def GPR64x8 : RegisterOperand {
+  let ParserMatchClass = GPR64x8AsmOp;
+  let PrintMethod = "printGPR64x8";
+}
+
+//===- END: v8.7a accelerator extension register operands 
-===//
+
 // SVE predicate registers
 def P0: AArch64Reg<0,   "p0">, DwarfRegNum<[48]>;
 def P1: AArch64Reg<1,   "p1">, DwarfRegNum<[49]>;

diff  --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp 
b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
index 6a251f0d346c..10ab4830e9ee 100644
--- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -257,6 +257,7 @@ class AArch64AsmParser : public MCTargetAsmParser {
   OperandMatchResultTy tryParseVectorList(OperandVector &Operands,
   bool ExpectMatch = false);
   OperandMatchResultTy tryParseSVEPattern(OperandVector &Operands);
+  OperandMatchResultTy tryParseGPR64x8(OperandVector &Operands);
 
 public:
   enum AArch64MatchResultTy {
@@ -1170,6 +1171,12 @@ class AArch64Operand : public MCParsedAsmOperand {
   AArch64MCRegisterClasses[AArch64::GPR32RegClassID].contains(Reg.RegNum);
   }
 
+  bool isGPR64x8() const {
+return Kind == k_Register && Reg.Kind == RegKind::Scalar &&
+   AArch64MCRegisterClasses[AArch64::GPR64x8ClassRegClassID].contains(
+   Reg.RegNum);
+  }
+
   bool isWSeqPair() const {
 return Kind == k_Register && Reg.Kind == RegKind::Scalar &&

AArch64MCRegisterClasses[AArch64::WSeqPairsClassRegClassID].contains(
@@ -6291,3 +6298,26 @@ AArch64AsmParser::tryParseSVEPattern(OperandVector 
&Operands) {
 
   return MatchOperand_Success;
 }
+
+OperandMatchResultTy
+AArch64AsmParser::tryParseGPR64x8(OperandVector &Operands) {
+  SMLoc SS = getLoc();
+
+  unsigned XReg;
+  if (tryParseScalarRegister(XReg) != MatchOperand_Success)
+return MatchOperand_NoMatch;
+
+  MCContext &ctx = getContext();
+  const MCRegisterInfo *RI = ctx.getRegisterInfo();
+  int X8Reg = RI->getMatchingSuperReg(
+  XReg, AArch64::x8sub_0,
+  &AArch64MCRegisterClasses[AArch64::GPR64x8ClassRegClassID]);
+  if (!X8Reg) {
+Error(SS, "expected an even-numbered x-register in the range [x0,x22]");
+return MatchOperand_ParseFail;
+  }
+
+  Operands.push_back(
+  AArch64Operand::CreateReg(X8Reg, RegKind::Scalar, SS, getLoc(), ctx));
+  return MatchOperand_Success;
+}

diff  --git a/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp 
b/llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
index e1a96ce8bdb1

[llvm-branch-commits] [llvm] 3138891 - [AArch64] Adding the v8.7-A LD64B/ST64B Accelerator extension

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:46:23Z
New Revision: 313889191ea14e978635b5cdf8838f3212d068a4

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

LOG: [AArch64] Adding the v8.7-A LD64B/ST64B Accelerator extension

This adds support for the v8.7-A LD64B/ST64B Accelerator extension
through a subtarget feature called "ls64". It adds four 64-byte
load/store instructions with an operand in the new GPR64x8 register
class, and one system register that's part of the same extension.

Based on patches written by Simon Tatham.

Reviewed By: ostannard

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

Added: 
llvm/test/MC/AArch64/armv8.7a-ls64.s
llvm/test/MC/Disassembler/AArch64/armv8.7a-ls64.txt

Modified: 
llvm/lib/Target/AArch64/AArch64.td
llvm/lib/Target/AArch64/AArch64InstrFormats.td
llvm/lib/Target/AArch64/AArch64InstrInfo.td
llvm/lib/Target/AArch64/AArch64Subtarget.h
llvm/lib/Target/AArch64/AArch64SystemOperands.td
llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp

Removed: 




diff  --git a/llvm/lib/Target/AArch64/AArch64.td 
b/llvm/lib/Target/AArch64/AArch64.td
index fd7894aa3fcb..69f2e31ecfb4 100644
--- a/llvm/lib/Target/AArch64/AArch64.td
+++ b/llvm/lib/Target/AArch64/AArch64.td
@@ -409,6 +409,9 @@ def FeatureWFxT : SubtargetFeature<"wfxt", "HasWFxT",
 def FeatureHCX : SubtargetFeature<
 "hcx", "HasHCX", "true", "Enable Armv8.7-A HCRX_EL2 system register">;
 
+def FeatureLS64 : SubtargetFeature<"ls64", "HasLS64",
+"true", "Enable Armv8.7-A LD64B/ST64B Accelerator Extension">;
+
 def FeatureFineGrainedTraps : SubtargetFeature<"fgt", "HasFineGrainedTraps",
 "true", "Enable fine grained virtualization traps extension">;
 

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td 
b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 3c19a5bad573..3335071fe487 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -11255,6 +11255,35 @@ multiclass STOPregister {
 !cast(instr # "X")>;
 }
 
+class LoadStore64B_base opc, string asm_inst, string asm_ops,
+dag iops, dag oops, list pat>
+: I,
+  Sched<[]> /* FIXME: fill in scheduling details once known */ {
+  bits<5> Rt;
+  bits<5> Rn;
+  let Inst{31-21} = 0b101;
+  let Inst{15}= 1;
+  let Inst{14-12} = opc;
+  let Inst{11-10} = 0b00;
+  let Inst{9-5}   = Rn;
+  let Inst{4-0}   = Rt;
+
+  let Predicates = [HasV8_7a];
+}
+
+class LoadStore64B opc, string asm_inst, dag iops, dag oops,
+  list pat = []>
+: LoadStore64B_base {
+  let Inst{20-16} = 0b1;
+}
+
+class Store64BV opc, string asm_inst, list pat = []>
+: LoadStore64B_base {
+  bits<5> Rs;
+  let Inst{20-16} = Rs;
+}
+
 //
 // Allow the size specifier tokens to be upper case, not just lower.
 def : TokenAlias<".4B", ".4b">;  // Add dot product

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.td 
b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
index d366c3c4d04c..97b2ea3c345a 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrInfo.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.td
@@ -155,6 +155,8 @@ def HasXS: Predicate<"Subtarget->hasXS()">,
AssemblerPredicate<(all_of FeatureXS), "xs">;
 def HasWFxT  : Predicate<"Subtarget->hasWFxT()">,
AssemblerPredicate<(all_of FeatureWFxT), "wfxt">;
+def HasLS64  : Predicate<"Subtarget->hasLS64()">,
+   AssemblerPredicate<(all_of FeatureLS64), "ls64">;
 def IsLE : Predicate<"Subtarget->isLittleEndian()">;
 def IsBE : Predicate<"!Subtarget->isLittleEndian()">;
 def IsWindows: Predicate<"Subtarget->isTargetWindows()">;
@@ -7745,6 +7747,15 @@ let AddedComplexity = 10 in {
   // FIXME: add SVE dot-product patterns.
 }
 
+let Predicates = [HasLS64] in {
+  def LD64B: LoadStore64B<0b101, "ld64b", (ins GPR64sp:$Rn),
+  (outs GPR64x8:$Rt)>;
+  def ST64B: LoadStore64B<0b001, "st64b", (ins GPR64sp:$Rn, GPR64x8:$Rt),
+  (outs)>;
+  def ST64BV:   Store64BV<0b011, "st64bv">;
+  def ST64BV0:  Store64BV<0b010, "st64bv0">;
+}
+
 include "AArch64InstrAtomics.td"
 include "AArch64SVEInstrInfo.td"
 

diff  --git a/llvm/lib/Target/AArch64/AArch64Subtarget.h 
b/llvm/lib/Target/AArch64/AArch64Subtarget.h
index 575542d1b6aa..2a9426cf8c30 100644
--- a/llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ b/llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -172,6 +172,7 @@ class AArch64Subtarget final : public 
AArch64GenSubtargetInfo {
   bool HasXS = false;
   bool HasWFxT = fal

[llvm-branch-commits] [llvm] c4d851b - [ARM][AAarch64] Initial command-line support for v8.7-A

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:47:28Z
New Revision: c4d851b079037e9b7dd3f8613dd1c8a4f3db99fa

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

LOG: [ARM][AAarch64] Initial command-line support for v8.7-A

This introduces command-line support for the 'armv8.7-a' architecture name
(and an alias without the '-', as usual), and for the 'ls64' extension name.

Based on patches written by Simon Tatham.

Reviewed By: ostannard

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

Added: 
clang/test/Driver/aarch64-ls64.c

Modified: 
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/Basic/Targets/AArch64.h
clang/lib/Driver/ToolChains/Arch/AArch64.cpp
clang/test/Driver/aarch64-cpus.c
llvm/include/llvm/Support/AArch64TargetParser.def
llvm/include/llvm/Support/AArch64TargetParser.h
llvm/lib/Support/AArch64TargetParser.cpp
llvm/lib/Support/ARMTargetParser.cpp
llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/AArch64.cpp 
b/clang/lib/Basic/Targets/AArch64.cpp
index c8162dd55220..c1abe8e9f75b 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -196,6 +196,12 @@ void AArch64TargetInfo::getTargetDefinesARMV86A(const 
LangOptions &Opts,
   getTargetDefinesARMV85A(Opts, Builder);
 }
 
+void AArch64TargetInfo::getTargetDefinesARMV87A(const LangOptions &Opts,
+MacroBuilder &Builder) const {
+  // Also include the Armv8.6 defines
+  getTargetDefinesARMV86A(Opts, Builder);
+}
+
 void AArch64TargetInfo::getTargetDefines(const LangOptions &Opts,
  MacroBuilder &Builder) const {
   // Target identification.
@@ -371,6 +377,9 @@ void AArch64TargetInfo::getTargetDefines(const LangOptions 
&Opts,
   case llvm::AArch64::ArchKind::ARMV8_6A:
 getTargetDefinesARMV86A(Opts, Builder);
 break;
+  case llvm::AArch64::ArchKind::ARMV8_7A:
+getTargetDefinesARMV87A(Opts, Builder);
+break;
   }
 
   // All of the __sync_(bool|val)_compare_and_swap_(1|2|4|8) builtins work.
@@ -411,6 +420,7 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasFP16FML = false;
   HasMTE = false;
   HasTME = false;
+  HasLS64 = false;
   HasMatMul = false;
   HasBFloat16 = false;
   HasSVE2 = false;
@@ -486,6 +496,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   ArchKind = llvm::AArch64::ArchKind::ARMV8_5A;
 if (Feature == "+v8.6a")
   ArchKind = llvm::AArch64::ArchKind::ARMV8_6A;
+if (Feature == "+v8.7a")
+  ArchKind = llvm::AArch64::ArchKind::ARMV8_7A;
 if (Feature == "+v8r")
   ArchKind = llvm::AArch64::ArchKind::ARMV8R;
 if (Feature == "+fullfp16")
@@ -504,6 +516,8 @@ bool 
AArch64TargetInfo::handleTargetFeatures(std::vector &Features,
   HasBFloat16 = true;
 if (Feature == "+lse")
   HasLSE = true;
+if (Feature == "+ls64")
+  HasLS64 = true;
   }
 
   setDataLayout();

diff  --git a/clang/lib/Basic/Targets/AArch64.h 
b/clang/lib/Basic/Targets/AArch64.h
index a70abb7bfd90..bd576680077e 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -36,6 +36,7 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
   bool HasFP16FML;
   bool HasMTE;
   bool HasTME;
+  bool HasLS64;
   bool HasMatMul;
   bool HasSVE2;
   bool HasSVE2AES;
@@ -81,6 +82,8 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public 
TargetInfo {
MacroBuilder &Builder) const;
   void getTargetDefinesARMV86A(const LangOptions &Opts,
MacroBuilder &Builder) const;
+  void getTargetDefinesARMV87A(const LangOptions &Opts,
+   MacroBuilder &Builder) const;
   void getTargetDefines(const LangOptions &Opts,
 MacroBuilder &Builder) const override;
 

diff  --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp 
b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
index 13e4cac292d0..a5e632fd8cdb 100644
--- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp
@@ -79,9 +79,10 @@ static bool DecodeAArch64Features(const Driver &D, StringRef 
text,
 else
   return false;
 
-// +sve implies +f32mm if the base architecture is v8.6A
+// +sve implies +f32mm if the base architecture is v8.6A or v8.7A
 // it isn't the case in general that sve implies both f64mm and f32mm
-if ((ArchKind == llvm::AArch64::ArchKind::ARMV8_6A) && Feature == "sve")
+if ((ArchKind == llvm::AArch64::ArchKind::ARMV8_6A ||
+ ArchKind == llvm::AArch64::ArchKind::ARMV8_7A) && Feature ==

[llvm-branch-commits] [llvm] c5046eb - [ARM] Adding v8.7-A command-line support for the ARM target

2020-12-17 Thread Lucas Prates via llvm-branch-commits

Author: Lucas Prates
Date: 2020-12-17T13:48:54Z
New Revision: c5046ebdf6e4be9300677c538ecaa61648c31248

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

LOG: [ARM] Adding v8.7-A command-line support for the ARM target

This extends the command-line support for the 'armv8.7-a' architecture
name to the ARM target.

Based on a patch written by Momchil Velikov.

Reviewed By: ostannard

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

Added: 


Modified: 
clang/lib/Basic/Targets/ARM.cpp
clang/test/Driver/arm-cortex-cpus.c
clang/test/Preprocessor/arm-target-features.c
llvm/include/llvm/ADT/Triple.h
llvm/include/llvm/Support/ARMTargetParser.def
llvm/lib/Support/ARMTargetParser.cpp
llvm/lib/Support/Triple.cpp
llvm/lib/Target/ARM/ARM.td
llvm/lib/Target/ARM/ARMPredicates.td
llvm/unittests/Support/TargetParserTest.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 21cfe0107bbb..a2c96ad12a76 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -208,6 +208,8 @@ StringRef ARMTargetInfo::getCPUAttr() const {
 return "8_5A";
   case llvm::ARM::ArchKind::ARMV8_6A:
 return "8_6A";
+  case llvm::ARM::ArchKind::ARMV8_7A:
+return "8_7A";
   case llvm::ARM::ArchKind::ARMV8MBaseline:
 return "8M_BASE";
   case llvm::ARM::ArchKind::ARMV8MMainline:

diff  --git a/clang/test/Driver/arm-cortex-cpus.c 
b/clang/test/Driver/arm-cortex-cpus.c
index a312ccfda5a1..f1ca801c4ddb 100644
--- a/clang/test/Driver/arm-cortex-cpus.c
+++ b/clang/test/Driver/arm-cortex-cpus.c
@@ -352,6 +352,23 @@
 // RUN: %clang -target arm -march=armebv8.6-a -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V86A %s
 // CHECK-BE-V86A: "-cc1"{{.*}} "-triple" "armebv8.6{{.*}}" "-target-cpu" 
"generic"
 
+// RUN: %clang -target armv8.7a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V87A %s
+// RUN: %clang -target arm -march=armv8.7a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V87A %s
+// RUN: %clang -target arm -march=armv8.7-a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V87A %s
+// RUN: %clang -target arm -march=armv8.7a -mlittle-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V87A %s
+// RUN: %clang -target armv8.7a -mlittle-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-V87A %s
+// RUN: %clang -target arm -march=armv8.7a -mlittle-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-V87A %s
+// RUN: %clang -target arm -mlittle-endian -march=armv8.7-a -mlittle-endian 
-### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V87A %s
+// CHECK-V87A: "-cc1"{{.*}} "-triple" "armv8.7{{.*}}" "-target-cpu" "generic"
+
+// RUN: %clang -target armebv8.7a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V87A %s
+// RUN: %clang -target armv8.7a -mbig-endian -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V87A %s
+// RUN: %clang -target armeb -march=armebv8.7a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V87A %s
+// RUN: %clang -target armeb -march=armebv8.7-a -### -c %s 2>&1 | FileCheck 
-check-prefix=CHECK-BE-V87A %s
+// RUN: %clang -target arm -march=armebv8.7a -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V87A %s
+// RUN: %clang -target arm -march=armebv8.7-a -mbig-endian -### -c %s 2>&1 | 
FileCheck -check-prefix=CHECK-BE-V87A %s
+// CHECK-BE-V87A: "-cc1"{{.*}} "-triple" "armebv8.7{{.*}}" "-target-cpu" 
"generic"
+
 // Once we have CPUs with optional v8.2-A FP16, we will need a way to turn it
 // on and off. Cortex-A53 is a placeholder for now.
 // RUN: %clang -target armv8a-linux-eabi -mcpu=cortex-a53+fp16 -### -c %s 2>&1 
| FileCheck --check-prefix CHECK-CORTEX-A53-FP16 %s

diff  --git a/clang/test/Preprocessor/arm-target-features.c 
b/clang/test/Preprocessor/arm-target-features.c
index 5eaffa1c372c..9f375162e6ab 100644
--- a/clang/test/Preprocessor/arm-target-features.c
+++ b/clang/test/Preprocessor/arm-target-features.c
@@ -849,6 +849,11 @@
 // CHECK-V86A: #define __ARM_ARCH_8_6A__ 1
 // CHECK-V86A: #define __ARM_ARCH_PROFILE 'A'
 
+// RUN: %clang -target armv8.7a-none-none-eabi -x c -E -dM %s -o - | FileCheck 
-match-full-lines --check-prefix=CHECK-V87A %s
+// CHECK-V87A: #define __ARM_ARCH 8
+// CHECK-V87A: #define __ARM_ARCH_8_7A__ 1
+// CHECK-V87A: #define __ARM_ARCH_PROFILE 'A'
+
 // RUN: %clang -target arm-none-none-eabi -march=armv7-m -mfpu=softvfp -x c -E 
-dM %s -o - | FileCheck --check-prefix=CHECK-SOFTVFP %s
 // CHECK-SOFTVFP-NOT: #define __ARM_FP 0x
 

diff  --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 13a35857512a..6e2957f3c32b 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -104,6 +104,7 @@ class Triple {
   enum SubArchType {
 NoSubArch,
 
+

[llvm-branch-commits] [lld] 811444d - [lld-macho] Add support for weak references

2020-12-17 Thread Jez Ng via llvm-branch-commits

Author: Jez Ng
Date: 2020-12-17T08:49:16-05:00
New Revision: 811444d7a173e696f975f8d41626f6809439f726

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

LOG: [lld-macho] Add support for weak references

Weak references need not necessarily be satisfied at runtime (but they must
still be satisfied at link time). So symbol resolution still works as per usual,
but we now pass around a flag -- ultimately emitting it in the bind table -- to
indicate if a given dylib symbol is a weak reference.

ld64's behavior for symbols that have both weak and strong references is
a bit bizarre. For non-function symbols, it will emit a weak import. For
function symbols (those referenced by BRANCH relocs), it will emit a
regular import. I'm not sure what value there is in that behavior, and
since emulating it will make our implementation more complex, I've
decided to treat regular weakrefs like function symbol ones for now.

Fixes PR48511.

Reviewed By: #lld-macho, thakis

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

Added: 
lld/test/MachO/weak-reference.s

Modified: 
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/SymbolTable.cpp
lld/MachO/SymbolTable.h
lld/MachO/Symbols.h
lld/MachO/SyntheticSections.cpp
lld/test/MachO/symtab.s

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index c522a082a306..db89dd60a20b 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -285,7 +285,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 } else if (config->forceLoadObjC) {
   for (const object::Archive::Symbol &sym : file->symbols())
 if (sym.getName().startswith(objc::klass))
-  symtab->addUndefined(sym.getName());
+  symtab->addUndefined(sym.getName(), /*isWeakRef=*/false);
 
   // TODO: no need to look for ObjC sections for a given archive member if
   // we already found that it contains an ObjC symbol. We should also
@@ -723,7 +723,8 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
   symtab = make();
   target = createTargetInfo(args);
 
-  config->entry = symtab->addUndefined(args.getLastArgValue(OPT_e, "_main"));
+  config->entry = symtab->addUndefined(args.getLastArgValue(OPT_e, "_main"),
+   /*isWeakRef=*/false);
   config->outputFile = args.getLastArgValue(OPT_o, "a.out");
   config->installName =
   args.getLastArgValue(OPT_install_name, config->outputFile);

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 3ae3b976afa3..a32e8caf3d29 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -283,7 +283,7 @@ macho::Symbol *ObjFile::parseNonSectionSymbol(const 
structs::nlist_64 &sym,
   switch (type) {
   case N_UNDF:
 return sym.n_value == 0
-   ? symtab->addUndefined(name)
+   ? symtab->addUndefined(name, sym.n_desc & N_WEAK_REF)
: symtab->addCommon(name, this, sym.n_value,
1 << GET_COMM_ALIGN(sym.n_desc));
   case N_ABS:

diff  --git a/lld/MachO/SymbolTable.cpp b/lld/MachO/SymbolTable.cpp
index ecf8f94239e1..93a2508951a5 100644
--- a/lld/MachO/SymbolTable.cpp
+++ b/lld/MachO/SymbolTable.cpp
@@ -62,15 +62,21 @@ Symbol *SymbolTable::addDefined(StringRef name, 
InputSection *isec,
   return s;
 }
 
-Symbol *SymbolTable::addUndefined(StringRef name) {
+Symbol *SymbolTable::addUndefined(StringRef name, bool isWeakRef) {
   Symbol *s;
   bool wasInserted;
   std::tie(s, wasInserted) = insert(name);
 
+  auto refState = isWeakRef ? RefState::Weak : RefState::Strong;
+
   if (wasInserted)
-replaceSymbol(s, name);
-  else if (LazySymbol *lazy = dyn_cast(s))
+replaceSymbol(s, name, refState);
+  else if (auto *lazy = dyn_cast(s))
 lazy->fetchArchiveMember();
+  else if (auto *dynsym = dyn_cast(s))
+dynsym->refState = std::max(dynsym->refState, refState);
+  else if (auto *undefined = dyn_cast(s))
+undefined->refState = std::max(undefined->refState, refState);
   return s;
 }
 
@@ -101,14 +107,21 @@ Symbol *SymbolTable::addDylib(StringRef name, DylibFile 
*file, bool isWeakDef,
   bool wasInserted;
   std::tie(s, wasInserted) = insert(name);
 
-  if (!wasInserted && isWeakDef)
-if (auto *defined = dyn_cast(s))
-  if (!defined->isWeakDef())
+  auto refState = RefState::Unreferenced;
+  if (!wasInserted) {
+if (auto *defined = dyn_cast(s)) {
+  if (isWeakDef && !defined->isWeakDef())
 defined->overridesWeakDef = true;
+} else if (auto *undefined = dyn_cast(s)) {
+  refState = undefined->refState;
+} else if (auto *dysym = dyn_cast(s)) {
+  refState = dysym->refState;
+}
+  }
 
   if (wasInserted || isa(s) ||
   (isa(s) && !isWeakDef && s->

[llvm-branch-commits] [lld] 4c8276c - [lld-macho] Use LC_LOAD_WEAK_DYLIB for dylibs with only weakrefs

2020-12-17 Thread Jez Ng via llvm-branch-commits

Author: Jez Ng
Date: 2020-12-17T08:49:17-05:00
New Revision: 4c8276cdc120c24410dcd62a9986f04e7327fc2f

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

LOG: [lld-macho] Use LC_LOAD_WEAK_DYLIB for dylibs with only weakrefs

Note that dylibs without *any* refs will still be loaded in the usual
(strong) fashion.

Reviewed By: #lld-macho, thakis

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

Added: 


Modified: 
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Symbols.h
lld/MachO/Writer.cpp
lld/test/MachO/weak-import.s

Removed: 




diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index a32e8caf3d29..ce66c9650446 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -527,7 +527,7 @@ void loadReexport(StringRef path, DylibFile *umbrella) {
 }
 
 DylibFile::DylibFile(MemoryBufferRef mb, DylibFile *umbrella)
-: InputFile(DylibKind, mb) {
+: InputFile(DylibKind, mb), refState(RefState::Unreferenced) {
   if (umbrella == nullptr)
 umbrella = this;
 
@@ -580,7 +580,7 @@ DylibFile::DylibFile(MemoryBufferRef mb, DylibFile 
*umbrella)
 }
 
 DylibFile::DylibFile(const InterfaceFile &interface, DylibFile *umbrella)
-: InputFile(DylibKind, interface) {
+: InputFile(DylibKind, interface), refState(RefState::Unreferenced) {
   if (umbrella == nullptr)
 umbrella = this;
 

diff  --git a/lld/MachO/InputFiles.h b/lld/MachO/InputFiles.h
index f48fc1f8c232..ef573145f594 100644
--- a/lld/MachO/InputFiles.h
+++ b/lld/MachO/InputFiles.h
@@ -38,6 +38,7 @@ namespace macho {
 class InputSection;
 class Symbol;
 struct Reloc;
+enum class RefState : uint8_t;
 
 // If --reproduce option is given, all input files are written
 // to this tar archive.
@@ -135,6 +136,7 @@ class DylibFile : public InputFile {
   uint32_t compatibilityVersion = 0;
   uint32_t currentVersion = 0;
   uint64_t ordinal = 0; // Ordinal numbering starts from 1, so 0 is a sentinel
+  RefState refState;
   bool reexport = false;
   bool forceWeakImport = false;
 };

diff  --git a/lld/MachO/Symbols.h b/lld/MachO/Symbols.h
index 80898e085818..80be27dd1c1f 100644
--- a/lld/MachO/Symbols.h
+++ b/lld/MachO/Symbols.h
@@ -116,7 +116,11 @@ class Defined : public Symbol {
   const bool external : 1;
 };
 
-// Indicates whether & how a dylib symbol is referenced.
+// This enum does double-duty: as a symbol property, it indicates whether & how
+// a dylib symbol is referenced. As a DylibFile property, it indicates the kind
+// of referenced symbols contained within the file. If there are both weak
+// and strong references to the same file, we will count the file as
+// strongly-referenced.
 enum class RefState : uint8_t { Unreferenced = 0, Weak = 1, Strong = 2 };
 
 class Undefined : public Symbol {

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 29c8fd6ed1fa..a4c677a4b288 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -43,6 +43,7 @@ class Writer {
   Writer() : buffer(errorHandler().outputBuffer) {}
 
   void scanRelocations();
+  void scanSymbols();
   void createOutputSections();
   void createLoadCommands();
   void assignAddresses(OutputSegment *);
@@ -424,6 +425,17 @@ void Writer::scanRelocations() {
   }
 }
 
+void Writer::scanSymbols() {
+  for (const macho::Symbol *sym : symtab->getSymbols()) {
+if (const auto *defined = dyn_cast(sym)) {
+  if (defined->overridesWeakDef)
+in.weakBinding->addNonWeakDefinition(defined);
+} else if (const auto *dysym = dyn_cast(sym)) {
+  dysym->file->refState = std::max(dysym->file->refState, dysym->refState);
+}
+  }
+}
+
 void Writer::createLoadCommands() {
   in.header->addLoadCommand(make(
   in.rebase, in.binding, in.weakBinding, in.lazyBinding, in.exports));
@@ -463,10 +475,10 @@ void Writer::createLoadCommands() {
   uint64_t dylibOrdinal = 1;
   for (InputFile *file : inputFiles) {
 if (auto *dylibFile = dyn_cast(file)) {
-  // TODO: dylibs that are only referenced by weak refs should also be
-  // loaded via LC_LOAD_WEAK_DYLIB.
   LoadCommandType lcType =
-  dylibFile->forceWeakImport ? LC_LOAD_WEAK_DYLIB : LC_LOAD_DYLIB;
+  dylibFile->forceWeakImport || dylibFile->refState == RefState::Weak
+  ? LC_LOAD_WEAK_DYLIB
+  : LC_LOAD_DYLIB;
   in.header->addLoadCommand(make(lcType, dylibFile->dylibName,
   dylibFile->compatibilityVersion,
   dylibFile->currentVersion));
@@ -699,11 +711,7 @@ void Writer::run() {
   scanRelocations();
   if (in.stubHelper->isNeeded())
 in.stubHelper->setup();
-
-  for (const macho::Symbol *sym : symtab->getSymbols())
-if (const auto *defined = dyn_cast(sym))
-

[llvm-branch-commits] [llvm] 0138399 - [InstCombine] Remove scalable vector restriction in InstCombineCasts

2020-12-17 Thread Jun Ma via llvm-branch-commits

Author: Jun Ma
Date: 2020-12-17T22:02:33+08:00
New Revision: 01383999037760288f617e24084991eaf6bd9272

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

LOG: [InstCombine] Remove scalable vector restriction in InstCombineCasts

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

Added: 


Modified: 
llvm/lib/IR/Verifier.cpp
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/addrspacecast.ll
llvm/test/Transforms/InstCombine/ptr-int-cast.ll
llvm/test/Transforms/InstCombine/trunc-extractelement.ll
llvm/test/Transforms/InstCombine/vec_shuffle.ll

Removed: 




diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 71bb94e77593..cac5df81661c 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2961,8 +2961,8 @@ void Verifier::visitAddrSpaceCastInst(AddrSpaceCastInst 
&I) {
   Assert(SrcTy->getPointerAddressSpace() != DestTy->getPointerAddressSpace(),
  "AddrSpaceCast must be between 
diff erent address spaces", &I);
   if (auto *SrcVTy = dyn_cast(SrcTy))
-Assert(cast(SrcVTy)->getNumElements() ==
-   cast(DestTy)->getNumElements(),
+Assert(SrcVTy->getElementCount() ==
+   cast(DestTy)->getElementCount(),
"AddrSpaceCast vector pointer number of elements mismatch", &I);
   visitInstruction(I);
 }

diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp 
b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index e9ec8021e466..8750e83623e6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -907,20 +907,21 @@ Instruction *InstCombinerImpl::visitTrunc(TruncInst 
&Trunc) {
   Value *VecOp;
   ConstantInt *Cst;
   if (match(Src, m_OneUse(m_ExtractElt(m_Value(VecOp), m_ConstantInt(Cst) {
-auto *VecOpTy = cast(VecOp->getType());
-unsigned VecNumElts = VecOpTy->getNumElements();
+auto *VecOpTy = cast(VecOp->getType());
+auto VecElts = VecOpTy->getElementCount();
 
 // A badly fit destination size would result in an invalid cast.
 if (SrcWidth % DestWidth == 0) {
   uint64_t TruncRatio = SrcWidth / DestWidth;
-  uint64_t BitCastNumElts = VecNumElts * TruncRatio;
+  uint64_t BitCastNumElts = VecElts.getKnownMinValue() * TruncRatio;
   uint64_t VecOpIdx = Cst->getZExtValue();
   uint64_t NewIdx = DL.isBigEndian() ? (VecOpIdx + 1) * TruncRatio - 1
  : VecOpIdx * TruncRatio;
   assert(BitCastNumElts <= std::numeric_limits::max() &&
  "overflow 32-bits");
 
-  auto *BitCastTo = FixedVectorType::get(DestTy, BitCastNumElts);
+  auto *BitCastTo =
+  VectorType::get(DestTy, BitCastNumElts, VecElts.isScalable());
   Value *BitCast = Builder.CreateBitCast(VecOp, BitCastTo);
   return ExtractElementInst::Create(BitCast, Builder.getInt32(NewIdx));
 }
@@ -1974,12 +1975,9 @@ Instruction 
*InstCombinerImpl::visitPtrToInt(PtrToIntInst &CI) {
   unsigned PtrSize = DL.getPointerSizeInBits(AS);
   if (TySize != PtrSize) {
 Type *IntPtrTy = DL.getIntPtrType(CI.getContext(), AS);
-if (auto *VecTy = dyn_cast(Ty)) {
-  // Handle vectors of pointers.
-  // FIXME: what should happen for scalable vectors?
-  IntPtrTy = FixedVectorType::get(
-  IntPtrTy, cast(VecTy)->getNumElements());
-}
+// Handle vectors of pointers.
+if (auto *VecTy = dyn_cast(Ty))
+  IntPtrTy = VectorType::get(IntPtrTy, VecTy->getElementCount());
 
 Value *P = Builder.CreatePtrToInt(SrcOp, IntPtrTy);
 return CastInst::CreateIntegerCast(P, Ty, /*isSigned=*/false);
@@ -2660,13 +2658,11 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst 
&CI) {
 // a bitcast to a vector with the same # elts.
 Value *ShufOp0 = Shuf->getOperand(0);
 Value *ShufOp1 = Shuf->getOperand(1);
-unsigned NumShufElts =
-cast(Shuf->getType())->getNumElements();
-unsigned NumSrcVecElts =
-cast(ShufOp0->getType())->getNumElements();
+auto ShufElts = cast(Shuf->getType())->getElementCount();
+auto SrcVecElts = cast(ShufOp0->getType())->getElementCount();
 if (Shuf->hasOneUse() && DestTy->isVectorTy() &&
-cast(DestTy)->getNumElements() == NumShufElts &&
-NumShufElts == NumSrcVecElts) {
+cast(DestTy)->getElementCount() == ShufElts &&
+ShufElts == SrcVecElts) {
   BitCastInst *Tmp;
   // If either of the operands is a cast from CI.getType(), then
   // evaluating the shuffle in the casted destination's type will allow
@@ -2689,8 +2685,9 @@ Instruction *InstCombinerImpl::visitBitCast(BitCastInst 
&CI) {
 // TODO: We should match the related pattern for bitreverse.
 if (D

[llvm-branch-commits] [llvm] 75c04bf - [SimplifyCFG] Preserve !annotation in FoldBranchToCommonDest.

2020-12-17 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2020-12-17T14:06:58Z
New Revision: 75c04bfc61d6cc5623eadd8a04f86c315dacd823

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

LOG: [SimplifyCFG] Preserve !annotation in FoldBranchToCommonDest.

When folding a branch to a common destination, preserve !annotation on
the created instruction, if the terminator of the BB that is going to be
removed has !annotation. This should ensure that !annotation is attached
to the instructions that 'replace' the original terminator.

Reviewed By: jdoerfert, lebedev.ri

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

Added: 


Modified: 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/annotations.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp 
b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 4ac080b539f5..0c693a8d27be 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -2886,11 +2886,15 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, 
MemorySSAUpdater *MSSAU,
 Changed = true;
 
 IRBuilder<> Builder(PBI);
+// The builder is used to create instructions to eliminate the branch in 
BB.
+// If BB's terminator has !annotation metadata, add it to the new
+// instructions.
+Builder.CollectMetadataToCopy(BB->getTerminator(),
+  {LLVMContext::MD_annotation});
 
 // If we need to invert the condition in the pred block to match, do so 
now.
 if (InvertPredCond) {
   Value *NewCond = PBI->getCondition();
-
   if (NewCond->hasOneUse() && isa(NewCond)) {
 CmpInst *CI = cast(NewCond);
 CI->setPredicate(CI->getInversePredicate());
@@ -2941,8 +2945,9 @@ bool llvm::FoldBranchToCommonDest(BranchInst *BI, 
MemorySSAUpdater *MSSAU,
   // its potential value. The previous information might have been valid
   // only given the branch precondition.
   // For an analogous reason, we must also drop all the metadata whose
-  // semantics we don't understand.
-  NewBonusInst->dropUnknownNonDebugMetadata();
+  // semantics we don't understand. We *can* preserve !annotation, because
+  // it is tied to the instruction itself, not the value or position.
+  NewBonusInst->dropUnknownNonDebugMetadata(LLVMContext::MD_annotation);
 
   PredBlock->getInstList().insert(PBI->getIterator(), NewBonusInst);
   NewBonusInst->takeName(&BonusInst);

diff  --git a/llvm/test/Transforms/SimplifyCFG/annotations.ll 
b/llvm/test/Transforms/SimplifyCFG/annotations.ll
index 5e39107e1c89..e6bc73d16992 100644
--- a/llvm/test/Transforms/SimplifyCFG/annotations.ll
+++ b/llvm/test/Transforms/SimplifyCFG/annotations.ll
@@ -6,8 +6,8 @@ define i32 @test_preserve_and(i8* %a, i8* %b, i8* %c, i8* %d) {
 ; CHECK-LABEL: define {{.*}} @test_preserve_and({{.*}}
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[C_1:%.*]] = icmp ult i8* [[A:%.*]], [[B:%.*]], !annotation 
!0
-; CHECK-NEXT:[[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]]
-; CHECK-NEXT:[[OR_COND:%.*]] = and i1 [[C_1]], [[C_2]]
+; CHECK-NEXT:[[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation 
!0
+; CHECK-NEXT:[[OR_COND:%.*]] = and i1 [[C_1]], [[C_2]], !annotation !0
 ; CHECK-NEXT:br i1 [[OR_COND]], label [[CONT1:%.*]], label [[TRAP:%.*]], 
!annotation !0
 ; CHECK:   trap: ; preds = %entry
 ; CHECK-NEXT:call void @fn1()
@@ -39,8 +39,8 @@ define i32 @test_preserve_or(i8* %a, i8* %b, i8* %c, i8* %d) {
 ; CHECK-LABEL: define {{.*}} @test_preserve_or({{.*}}
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[C_1:%.*]] = icmp uge i8* [[A:%.*]], [[B:%.*]], !annotation 
!0
-; CHECK-NEXT:[[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]]
-; CHECK-NEXT:[[OR_COND:%.*]] = or i1 [[C_1]], [[C_2]]
+; CHECK-NEXT:[[C_2:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation 
!0
+; CHECK-NEXT:[[OR_COND:%.*]] = or i1 [[C_1]], [[C_2]], !annotation !0
 ; CHECK-NEXT:br i1 [[OR_COND]], label [[TRAP:%.*]], label [[CONT1:%.*]], 
!annotation !0
 ; CHECK:   trap: ; preds = %entry
 ; CHECK-NEXT:call void @fn1()
@@ -73,9 +73,9 @@ define i32 @test_preserve_or_not(i8* %a, i8* %b, i8* %c, i8* 
%d) {
 ; CHECK-NEXT:  entry:
 ; CHECK-NEXT:[[C_1:%.*]] = icmp ult i8* [[A:%.*]], [[B:%.*]], !annotation 
!0
 ; CHECK-NEXT:[[C_2:%.*]] = xor i1 [[C_1]], true
-; CHECK-NEXT:[[C_2_NOT:%.*]] = xor i1 [[C_2]], true
-; CHECK-NEXT:[[C_3:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]]
-; CHECK-NEXT:[[OR_COND:%.*]] = or i1 [[C_2_NOT]], [[C_3]]
+; CHECK-NEXT:[[C_2_NOT:%.*]] = xor i1 [[C_2]], true, !annotation !0
+; CHECK-NEXT:[[C_3:%.*]] = icmp uge i8* [[C:%.*]], [[D:%.*]], !annotation 
!0
+; CHECK-NEXT:[[OR_COND:%.*]] = or i1 [[C_2_NOT]], [[C_3]], !annotatio

[llvm-branch-commits] [clang-tools-extra] 64badec - [clang-tidy][NFC] Reduce copies of Intrusive..FileSystem

2020-12-17 Thread Nathan James via llvm-branch-commits

Author: Nathan James
Date: 2020-12-17T14:09:08Z
New Revision: 64badecd447f2358812a2e747b2683d34071f5a5

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

LOG: [clang-tidy][NFC] Reduce copies of Intrusive..FileSystem

Swapped a few instances where a move is more optimal or the target doesn't need 
to hold a reference.

Added: 


Modified: 
clang-tools-extra/clang-tidy/ClangTidy.cpp
clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp

Removed: 




diff  --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp 
b/clang-tools-extra/clang-tidy/ClangTidy.cpp
index b5f2a1c0fbdb..633655e5e24a 100644
--- a/clang-tools-extra/clang-tidy/ClangTidy.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp
@@ -101,7 +101,8 @@ class ErrorReporter {
 public:
   ErrorReporter(ClangTidyContext &Context, bool ApplyFixes,
 llvm::IntrusiveRefCntPtr BaseFS)
-  : Files(FileSystemOptions(), BaseFS), DiagOpts(new DiagnosticOptions()),
+  : Files(FileSystemOptions(), std::move(BaseFS)),
+DiagOpts(new DiagnosticOptions()),
 DiagPrinter(new TextDiagnosticPrinter(llvm::outs(), &*DiagOpts)),
 Diags(IntrusiveRefCntPtr(new DiagnosticIDs), &*DiagOpts,
   DiagPrinter),
@@ -319,7 +320,7 @@ class ClangTidyASTConsumer : public MultiplexConsumer {
 ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
 ClangTidyContext &Context,
 IntrusiveRefCntPtr OverlayFS)
-: Context(Context), OverlayFS(OverlayFS),
+: Context(Context), OverlayFS(std::move(OverlayFS)),
   CheckFactories(new ClangTidyCheckFactories) {
   for (ClangTidyModuleRegistry::entry E : ClangTidyModuleRegistry::entries()) {
 std::unique_ptr Module = E.instantiate();
@@ -328,15 +329,16 @@ ClangTidyASTConsumerFactory::ClangTidyASTConsumerFactory(
 }
 
 #if CLANG_TIDY_ENABLE_STATIC_ANALYZER
-static void setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
- AnalyzerOptionsRef AnalyzerOptions) {
+static void
+setStaticAnalyzerCheckerOpts(const ClangTidyOptions &Opts,
+ clang::AnalyzerOptions &AnalyzerOptions) {
   StringRef AnalyzerPrefix(AnalyzerCheckNamePrefix);
   for (const auto &Opt : Opts.CheckOptions) {
 StringRef OptName(Opt.getKey());
 if (!OptName.consume_front(AnalyzerPrefix))
   continue;
 // Analyzer options are always local options so we can ignore priority.
-AnalyzerOptions->Config[OptName] = Opt.getValue().Value;
+AnalyzerOptions.Config[OptName] = Opt.getValue().Value;
   }
 }
 
@@ -432,7 +434,7 @@ ClangTidyASTConsumerFactory::CreateASTConsumer(
   AnalyzerOptions->CheckersAndPackages = getAnalyzerCheckersAndPackages(
   Context, Context.canEnableAnalyzerAlphaCheckers());
   if (!AnalyzerOptions->CheckersAndPackages.empty()) {
-setStaticAnalyzerCheckerOpts(Context.getOptions(), AnalyzerOptions);
+setStaticAnalyzerCheckerOpts(Context.getOptions(), *AnalyzerOptions);
 AnalyzerOptions->AnalysisStoreOpt = RegionStoreModel;
 AnalyzerOptions->AnalysisDiagOpt = PD_NONE;
 AnalyzerOptions->AnalyzeNestedBlocks = true;
@@ -539,7 +541,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
   public:
 ActionFactory(ClangTidyContext &Context,
   IntrusiveRefCntPtr BaseFS)
-: ConsumerFactory(Context, BaseFS) {}
+: ConsumerFactory(Context, std::move(BaseFS)) {}
 std::unique_ptr create() override {
   return std::make_unique(&ConsumerFactory);
 }
@@ -570,7 +572,7 @@ runClangTidy(clang::tidy::ClangTidyContext &Context,
 ClangTidyASTConsumerFactory ConsumerFactory;
   };
 
-  ActionFactory Factory(Context, BaseFS);
+  ActionFactory Factory(Context, std::move(BaseFS));
   Tool.run(&Factory);
   return DiagConsumer.take();
 }
@@ -579,7 +581,7 @@ void handleErrors(llvm::ArrayRef Errors,
   ClangTidyContext &Context, bool Fix,
   unsigned &WarningsAsErrorsCount,
   llvm::IntrusiveRefCntPtr BaseFS) {
-  ErrorReporter Reporter(Context, Fix, BaseFS);
+  ErrorReporter Reporter(Context, Fix, std::move(BaseFS));
   llvm::vfs::FileSystem &FileSystem =
   Reporter.getSourceManager().getFileManager().getVirtualFileSystem();
   auto InitialWorkingDir = FileSystem.getCurrentWorkingDirectory();

diff  --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp 
b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
index 2748fd9f74a5..2466b647c68c 100644
--- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -393,7 +393,7 @@ int clangTidyMain(int argc, const char **argv) {
 getVfsFromFile(VfsOverlay, BaseFS);
 if (!VfsFromFile)
   return 1;
-BaseFS->pushOverlay(VfsFromFile);
+BaseFS->pushOv

[llvm-branch-commits] [llvm] ef9dc51 - [obj2yaml][yaml2obj] - Add AArch64 STO_AARCH64_VARIANT_PCS support

2020-12-17 Thread Adhemerval Zanella via llvm-branch-commits

Author: Adhemerval Zanella
Date: 2020-12-17T11:09:53-03:00
New Revision: ef9dc51cd4af509e7c28573e15e13a98b17c9511

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

LOG: [obj2yaml][yaml2obj] - Add AArch64 STO_AARCH64_VARIANT_PCS support

Reviewed By: grimar, MaskRay

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

Added: 
llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml

Modified: 
llvm/lib/ObjectYAML/ELFYAML.cpp

Removed: 




diff  --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 52a4a3a2d80b..3a280b06336d 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -1040,6 +1040,9 @@ struct NormalizedOther {
   Map["STO_MIPS_PLT"] = ELF::STO_MIPS_PLT;
   Map["STO_MIPS_OPTIONAL"] = ELF::STO_MIPS_OPTIONAL;
 }
+
+if (EMachine == ELF::EM_AARCH64)
+  Map["STO_AARCH64_VARIANT_PCS"] = ELF::STO_AARCH64_VARIANT_PCS;
 return Map;
   }
 

diff  --git a/llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml 
b/llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml
new file mode 100644
index ..ad20a6546e62
--- /dev/null
+++ b/llvm/test/tools/obj2yaml/ELF/aarch64-sym-other.yaml
@@ -0,0 +1,22 @@
+## Check AArch64 st_other extension support.
+
+# RUN: yaml2obj %s -o %t
+# RUN: obj2yaml %t | FileCheck %s
+
+# CHECK: Symbols:
+# CHECK:  - Name:  foo1
+# CHECK:Other: [ STO_AARCH64_VARIANT_PCS ]
+# CHECK:  - Name:  foo2
+# CHECK:Other: [ STO_AARCH64_VARIANT_PCS, 64 ]
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+Symbols:
+  - Name:  foo1
+Other: [ STO_AARCH64_VARIANT_PCS ]
+  - Name:  foo2
+Other: [ STO_AARCH64_VARIANT_PCS, 0x40 ]



___
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] e04dc5f - [llvm-readobj/elf] - AArch64: Handle AARCH64_VARIANT_PCS for GNUStyle

2020-12-17 Thread Adhemerval Zanella via llvm-branch-commits

Author: Adhemerval Zanella
Date: 2020-12-17T11:09:53-03:00
New Revision: e04dc5f557c585f19d5abc73d1e71af81e8d5243

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

LOG: [llvm-readobj/elf] - AArch64: Handle AARCH64_VARIANT_PCS for GNUStyle

It mimics the GNU readelf where it prints a [VARIANT_PCS] for symbols
with st_other with STO_AARCH64_VARIANT_PCS.

Reviewed By: grimar, MaskRay

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

Added: 
llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test

Modified: 
llvm/include/llvm/BinaryFormat/DynamicTags.def
llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
llvm/tools/llvm-readobj/ELFDumper.cpp

Removed: 




diff  --git a/llvm/include/llvm/BinaryFormat/DynamicTags.def 
b/llvm/include/llvm/BinaryFormat/DynamicTags.def
index aec408bd2d72..c08f8a53bdb5 100644
--- a/llvm/include/llvm/BinaryFormat/DynamicTags.def
+++ b/llvm/include/llvm/BinaryFormat/DynamicTags.def
@@ -120,6 +120,7 @@ DYNAMIC_TAG(VERNEEDNUM, 0X6FFF) // The number of 
entries in DT_VERNEED.
 // AArch64 specific dynamic table entries
 AARCH64_DYNAMIC_TAG(AARCH64_BTI_PLT, 0x7001)
 AARCH64_DYNAMIC_TAG(AARCH64_PAC_PLT, 0x7003)
+AARCH64_DYNAMIC_TAG(AARCH64_VARIANT_PCS, 0x7005)
 
 // Hexagon specific dynamic table entries
 HEXAGON_DYNAMIC_TAG(HEXAGON_SYMSZ, 0x7000)

diff  --git a/llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test 
b/llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test
new file mode 100644
index ..bc9d1286e0a0
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/ELF/aarch64-symbols-stother.test
@@ -0,0 +1,45 @@
+## Check that we are able to dump AArch64 STO_* flags correctly when dumping 
symbols.
+
+# RUN: yaml2obj %s -o %t.o
+# RUN: llvm-readobj --symbols %t.o | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readelf --symbols %t.o | FileCheck %s --check-prefix=GNU
+
+# LLVM:  Name: foo1
+# LLVM:  Other [ (0x80)
+# LLVM-NEXT:   STO_AARCH64_VARIANT_PCS (0x80)
+# LLVM-NEXT: ]
+# LLVM:  Name: foo2
+# LLVM:  Other [ (0xC0)
+# LLVM-NEXT:   STO_AARCH64_VARIANT_PCS (0x80)
+# LLVM-NEXT: ]
+# LLVM:  Name: foo3
+# LLVM:  Other [ (0x83)
+# LLVM-NEXT:   STO_AARCH64_VARIANT_PCS (0x80)
+# LLVM-NEXT:   STV_PROTECTED (0x3)
+# LLVM-NEXT: ]
+# LLVM:  Name: foo4
+# LLVM:  Other [ (0x3)
+# LLVM-NEXT:   STV_PROTECTED (0x3)
+# LLVM-NEXT: ]
+
+# GNU:  Symbol table '.symtab' contains 5 entries:
+# GNU:  1:  0 NOTYPE LOCAL DEFAULT   [VARIANT_PCS]  
UND foo1
+# GNU-NEXT: 2:  0 NOTYPE LOCAL DEFAULT   [VARIANT_PCS | 40] 
UND foo2
+# GNU-NEXT: 3:  0 NOTYPE LOCAL PROTECTED [VARIANT_PCS]  
UND foo3
+# GNU-NEXT: 4:  0 NOTYPE LOCAL PROTECTED
UND foo4
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_REL
+  Machine: EM_AARCH64
+Symbols:
+  - Name: foo1
+Other: [ STO_AARCH64_VARIANT_PCS ]
+  - Name: foo2
+Other: [ STO_AARCH64_VARIANT_PCS, 0x40 ]
+  - Name: foo3
+Other: [ STO_AARCH64_VARIANT_PCS, STV_PROTECTED ]
+  - Name: foo4
+Other: [ STV_PROTECTED ]

diff  --git 
a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test 
b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
index 53a661a427d8..02309e51b342 100644
--- a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
+++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags-machine-specific.test
@@ -351,18 +351,20 @@ ProgramHeaders:
 # RUN: llvm-readobj --dynamic-table %t.aarch64 | FileCheck %s 
--check-prefix=LLVM-AARCH64
 # RUN: llvm-readelf --dynamic-table %t.aarch64 | FileCheck %s 
--check-prefix=GNU-AARCH64
 
-# LLVM-AARCH64: DynamicSection [ (3 entries)
-# LLVM-AARCH64-NEXT:  TagTypeName/Value
-# LLVM-AARCH64-NEXT:  0x7001 AARCH64_BTI_PLT 1
-# LLVM-AARCH64-NEXT:  0x7003 AARCH64_PAC_PLT 2
-# LLVM-AARCH64-NEXT:  0x NULL0x0
+# LLVM-AARCH64: DynamicSection [ (4 entries)
+# LLVM-AARCH64-NEXT:  TagTypeName/Value
+# LLVM-AARCH64-NEXT:  0x7001 AARCH64_BTI_PLT 1
+# LLVM-AARCH64-NEXT:  0x7003 AARCH64_PAC_PLT 2
+# LLVM-AARCH64-NEXT:  0x7005 AARCH64_VARIANT_PCS 3
+# LLVM-AARCH64-NEXT:  0x NULL0x0
 # LLVM-AARCH64-NEXT:]
 
-# GNU-AARCH64:  Dynamic section at offset {{.*}} contains 3 entries:
-# GNU-AARCH64-NEXT:  TagType  Name/Value
-# GNU-AARCH64-NEXT:  0x7001 (AARCH64_BTI_PLT) 1
-# GNU-AARCH64-NEXT:  0x7003 (AARCH64_PAC_PLT) 2
-# GNU-AARCH64-NEXT:  0x (NULL)0x0
+# GNU-A

[llvm-branch-commits] [lld] 978eb3b - [lld] [ELF] AArch64: Handle DT_AARCH64_VARIANT_PCS

2020-12-17 Thread Adhemerval Zanella via llvm-branch-commits

Author: Adhemerval Zanella
Date: 2020-12-17T11:09:55-03:00
New Revision: 978eb3b87bca0837d52d096c343fc70b06d9a04d

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

LOG: [lld] [ELF] AArch64: Handle DT_AARCH64_VARIANT_PCS

As indicated by AArch64 ELF specification, symbols with st_other
marked with STO_AARCH64_VARIANT_PCS indicates it may follow a variant
procedure call standard with different register usage convention
(for instance SVE calls).

Static linkers must preserve the marking and propagate it to the dynamic
symbol table if any reference or definition of the symbol is marked with
STO_AARCH64_VARIANT_PCS, and add a DT_AARCH64_VARIANT_PCS dynamic tag if
there are R__JUMP_SLOT relocations that reference that symbols.

It implements https://bugs.llvm.org/show_bug.cgi?id=48368.

Reviewed By: MaskRay

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

Added: 
lld/test/ELF/aarch64-variant_pcs.s

Modified: 
lld/ELF/SyntheticSections.cpp

Removed: 




diff  --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index eccd3ef1795e..9b5fb3f26c59 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1436,6 +1436,13 @@ template  void 
DynamicSection::finalizeContents() {
 case EM_SPARCV9:
   addInSec(DT_PLTGOT, in.plt);
   break;
+case EM_AARCH64:
+  if (llvm::find_if(in.relaPlt->relocs, [](const DynamicReloc &r) {
+   return r.type == target->pltRel &&
+  r.sym->stOther & STO_AARCH64_VARIANT_PCS;
+  }) != in.relaPlt->relocs.end())
+addInt(DT_AARCH64_VARIANT_PCS, 0);
+  LLVM_FALLTHROUGH;
 default:
   addInSec(DT_PLTGOT, in.gotPlt);
   break;
@@ -2181,6 +2188,10 @@ template  void 
SymbolTableSection::writeTo(uint8_t *buf) {
 // See getPPC64GlobalEntryToLocalEntryOffset() for more details.
 if (config->emachine == EM_PPC64)
   eSym->st_other |= sym->stOther & 0xe0;
+// The most significant bit of st_other is used by AArch64 ABI for the
+// variant PCS.
+else if (config->emachine == EM_AARCH64)
+  eSym->st_other |= sym->stOther & STO_AARCH64_VARIANT_PCS;
 
 eSym->st_name = ent.strTabOffset;
 if (isDefinedHere)

diff  --git a/lld/test/ELF/aarch64-variant_pcs.s 
b/lld/test/ELF/aarch64-variant_pcs.s
new file mode 100644
index ..b7f1efc16d6c
--- /dev/null
+++ b/lld/test/ELF/aarch64-variant_pcs.s
@@ -0,0 +1,130 @@
+# REQUIRES: aarch64
+# RUN: split-file %s %t
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %t/test1 -o %t.o
+# RUN: ld.lld %t.o --shared -o %t.so
+# RUN: llvm-readelf --dynamic-table %t.so | FileCheck --check-prefix T1-PCSDYN 
%s
+# RUN: llvm-readelf --symbols %t.so | FileCheck --check-prefix T1-PCSSYM %s
+
+# T1-PCSDYN-NOT:  0x7005 (AARCH64_VARIANT_PCS) 0
+# T1-PCSSYM:  Symbol table '.dynsym'
+# T1-PCSSYM:  0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] 
pcs_func_global_def
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %t/test2 -o %t.o
+# RUN: ld.lld %t.o --shared -o %t.so
+# RUN: llvm-readelf --dynamic-table %t.so | FileCheck --check-prefix T2-PCSDYN 
%s
+# RUN: llvm-readelf --symbols %t.so | FileCheck --check-prefix T2-PCSSYM %s
+
+# T2-PCSDYN:  0x7005 (AARCH64_VARIANT_PCS) 0
+# T2-PCSSYM:  Symbol table '.dynsym'
+# T2-PCSSYM:  0 NOTYPE GLOBAL DEFAULT [VARIANT_PCS] [[#]] 
pcs_func_global_def
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %t/test3 -o %t.o
+# RUN: ld.lld %t.o --shared -o %t.so
+# RUN: llvm-readelf --dynamic-table %t.so | FileCheck --check-prefix T3-PCSDYN 
%s
+# RUN: llvm-readelf --symbols %t.so | FileCheck --check-prefix T3-PCSSYM %s
+
+# T3-PCSDYN:  0x7005 (AARCH64_VARIANT_PCS) 0
+# T3-PCSSYM:  Symbol table '.dynsym'
+# T3-PCSSYM:  0 IFUNC  GLOBAL DEFAULT [VARIANT_PCS] UND   
pcs_ifunc_global_def
+# T3-PCSSYM:  0 NOTYPE GLOBAL DEFAULT   [[#]] 
pcs_func_global_def
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %t/test4 -o %t.o
+# RUN: ld.lld %t.o --shared -o %t.so
+# RUN: llvm-readelf --dynamic-table %t.so | FileCheck --check-prefix T4-PCSDYN 
%s
+# RUN: llvm-readelf --symbols %t.so | FileCheck --check-prefix T4-PCSSYM %s
+
+# T4-PCSDYN-NOT:  0x7005 (AARCH64_VARIANT_PCS) 0
+# T4-PCSSYM:  Symbol table '.dynsym'
+# T4-PCSSYM:  0 IFUNC GLOBAL DEFAULT [VARIANT_PCS]  [[#]] 
pcs_ifunc_global_def
+
+# RUN: llvm-mc -filetype=obj -triple=aarch64-linux-gnu %t/test5 -o %t.o
+# RUN: ld.lld %t.o --shared -o %t.so
+# RUN: llvm-readelf --symbols %t.so | FileCheck --check-prefix T5-PCSSYM %s
+
+# T5-PCSSYM:  Symbol table '.dynsym'
+# T5-PCSSYM:  0 NOTYPE  GLOBAL DEFAULT [VARIANT_PCS] UND   
pcs_func_global_undef
+# T5-PCSSYM-NEXT: 0 NOTYPE  GLOBAL DEFAULT

[llvm-branch-commits] [clang] 5e31e22 - Remove Python2 fallback and only advertise Python3 in the doc

2020-12-17 Thread via llvm-branch-commits

Author: serge-sans-paille
Date: 2020-12-17T15:40:16+01:00
New Revision: 5e31e226b5b2b682607a6578ff5adb33daf4fe39

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

LOG: Remove Python2 fallback and only advertise Python3 in the doc

Differential Revision: https://www.youtube.com/watch?v=RsL0cipURA0

Added: 


Modified: 
clang/CMakeLists.txt
clang/tools/scan-build-py/README.md
clang/tools/scan-build/bin/set-xcode-analyzer
lld/CMakeLists.txt
lldb/docs/resources/build.rst
llvm/CMakeLists.txt
llvm/docs/GettingStarted.rst
llvm/docs/GettingStartedVS.rst
llvm/docs/HowToBuildOnARM.rst
llvm/docs/TestingGuide.rst

Removed: 




diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f947b820bdac..f1e5a39cfe05 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -135,20 +135,7 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR )
   set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY 
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} )
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT Python3_Interpreter_FOUND)
-  message(WARNING "Python3 not found, using python2 as a fallback")
-  find_package(Python2 COMPONENTS Interpreter REQUIRED)
-  if(Python2_VERSION VERSION_LESS 2.7)
-message(SEND_ERROR "Python 2.7 or newer is required")
-  endif()
-
-  # Treat python2 as python3
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-IMPORTED_LOCATION ${Python2_EXECUTABLE})
-  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-endif()
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}

diff  --git a/clang/tools/scan-build-py/README.md 
b/clang/tools/scan-build-py/README.md
index 0f89b6fa43d8..63ce0273f22e 100644
--- a/clang/tools/scan-build-py/README.md
+++ b/clang/tools/scan-build-py/README.md
@@ -19,7 +19,7 @@ Should be working on UNIX operating systems.
 Prerequisites
 -
 
-1. **python** interpreter (version 2.7, 3.2, 3.3, 3.4, 3.5).
+1. **python** interpreter (version 3.6 or later).
 
 
 How to use

diff  --git a/clang/tools/scan-build/bin/set-xcode-analyzer 
b/clang/tools/scan-build/bin/set-xcode-analyzer
index c2a65c908598..9faaec1e8e6e 100755
--- a/clang/tools/scan-build/bin/set-xcode-analyzer
+++ b/clang/tools/scan-build/bin/set-xcode-analyzer
@@ -5,8 +5,8 @@
 # This one has the scripting bridge enabled.
 
 import sys
-if sys.version_info < (2, 7):
-print "set-xcode-analyzer requires Python 2.7 or later"
+if sys.version_info < (3, 6):
+print "set-xcode-analyzer requires Python 3.6 or later"
 sys.exit(1)
 
 import os

diff  --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
index 82b4b9b9b198..d4e561b50d8f 100644
--- a/lld/CMakeLists.txt
+++ b/lld/CMakeLists.txt
@@ -57,20 +57,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
   include(CheckAtomic)
 
   if(LLVM_INCLUDE_TESTS)
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT Python3_Interpreter_FOUND)
-  message(WARNING "Python3 not found, using python2 as a fallback")
-  find_package(Python2 COMPONENTS Interpreter REQUIRED)
-  if(Python2_VERSION VERSION_LESS 2.7)
-message(SEND_ERROR "Python 2.7 or newer is required")
-  endif()
-
-  # Treat python2 as python3
-  add_executable(Python3::Interpreter IMPORTED)
-  set_target_properties(Python3::Interpreter PROPERTIES
-IMPORTED_LOCATION ${Python2_EXECUTABLE})
-  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
-endif()
+find_package(Python3 REQUIRED COMPONENTS Interpreter)
 
 # Check prebuilt llvm/utils.
 if(EXISTS ${LLVM_TOOLS_BINARY_DIR}/FileCheck${CMAKE_EXECUTABLE_SUFFIX}

diff  --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index b4e58ca977a9..8aadd126ed0b 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -73,7 +73,7 @@ commands below.
   > yum install libedit-devel libxml2-devel ncurses-devel python-devel swig
   > sudo apt-get install build-essential subversion swig python3-dev 
libedit-dev libncurses5-dev
   > pkg install swig python
-  > pkgin install swig python27 cmake ninja-build
+  > pkgin install swig python36 cmake ninja-build
   > brew install swig cmake ninja
 
 Note that there's an `incompatibility

diff  --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 54009573ed43..ee1b646ab651 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -708,20 +708,7 @@ set(ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER FALSE CACHE BOOL
 
 include(HandleLLVMOptions)
 
-find_package(Python3 COMPONENTS Interpreter)
-if(NOT Python3_Interpreter_FOUN

[llvm-branch-commits] [libc] cfe096d - Fix dead link

2020-12-17 Thread via llvm-branch-commits

Author: Guillaume Chatelet
Date: 2020-12-17T15:49:28+01:00
New Revision: cfe096d1f68783bcfab4a01d5a471a3c6ed1b46d

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

LOG: Fix dead link

Added: 


Modified: 
libc/benchmarks/README.md

Removed: 




diff  --git a/libc/benchmarks/README.md b/libc/benchmarks/README.md
index dbfb0641d337..96d108b5f35b 100644
--- a/libc/benchmarks/README.md
+++ b/libc/benchmarks/README.md
@@ -51,7 +51,7 @@ This is the preferred mode to use. The function parameters 
are randomized and th
 --output=/tmp/benchmark_result.json
 ```
 
-The `--size-distribution-name` flag is mandatory and points to one of the 
[predefined distribution](libc/benchmarks/MemorySizeDistributions.h).
+The `--size-distribution-name` flag is mandatory and points to one of the 
[predefined distribution](MemorySizeDistributions.h).
 
 > Note: These distributions are gathered from several important binaries at 
 > Google (servers, databases, realtime and batch jobs) and reflect the 
 > importance of focusing on small sizes.
 



___
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] b9890ae - [TableGen] Make InstrMap::getFilterClass() const. NFCI.

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T14:49:58Z
New Revision: b9890ae1976ba3c986b3c3df480e26277be9b6f0

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

LOG: [TableGen] Make InstrMap::getFilterClass() const. NFCI.

Reported by cppcheck.

I've run clang-format across all the InstrMap accessors as well.

Added: 


Modified: 
llvm/utils/TableGen/CodeGenMapTable.cpp

Removed: 




diff  --git a/llvm/utils/TableGen/CodeGenMapTable.cpp 
b/llvm/utils/TableGen/CodeGenMapTable.cpp
index 9f9213d44d18..57d86a8fc119 100644
--- a/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -144,25 +144,15 @@ class InstrMap {
 }
   }
 
-  std::string getName() const {
-return Name;
-  }
+  std::string getName() const { return Name; }
 
-  std::string getFilterClass() {
-return FilterClass;
-  }
+  std::string getFilterClass() const { return FilterClass; }
 
-  ListInit *getRowFields() const {
-return RowFields;
-  }
+  ListInit *getRowFields() const { return RowFields; }
 
-  ListInit *getColFields() const {
-return ColFields;
-  }
+  ListInit *getColFields() const { return ColFields; }
 
-  ListInit *getKeyCol() const {
-return KeyCol;
-  }
+  ListInit *getKeyCol() const { return KeyCol; }
 
   const std::vector &getValueCols() const {
 return ValueCols;



___
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] 923ca0b - [ARM][MachineOutliner] Fix costs model.

2020-12-17 Thread Yvan Roux via llvm-branch-commits

Author: Yvan Roux
Date: 2020-12-17T16:08:23+01:00
New Revision: 923ca0b411f78a3d218ff660a5b7a8b9099bdaa4

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

LOG: [ARM][MachineOutliner] Fix costs model.

Fix candidates calls costs models allocation and prepare stack fixups
handling.

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

Added: 
llvm/test/CodeGen/ARM/machine-outliner-stack-use.mir

Modified: 
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/test/CodeGen/ARM/machine-outliner-calls.mir

Removed: 




diff  --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp 
b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 20823ee6d44a..2d937930d89f 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -5824,31 +5824,43 @@ outliner::OutlinedFunction 
ARMBaseInstrInfo::getOutliningCandidateInfo(
   else if (C.UsedInSequence.available(ARM::SP)) {
 NumBytesNoStackCalls += Costs.CallDefault;
 C.setCallInfo(MachineOutlinerDefault, Costs.CallDefault);
-SetCandidateCallInfo(MachineOutlinerDefault, Costs.CallDefault);
 CandidatesWithoutStackFixups.push_back(C);
-  } else
-return outliner::OutlinedFunction();
-}
+  }
 
-// Does every candidate's MBB contain a call?  If so, then we might have a
-// call in the range.
-if (FlagsSetInAll & MachineOutlinerMBBFlags::HasCalls) {
-  // check if the range contains a call.  These require a save + restore of
-  // the link register.
-  if (std::any_of(FirstCand.front(), FirstCand.back(),
-  [](const MachineInstr &MI) { return MI.isCall(); }))
-NumBytesToCreateFrame += Costs.SaveRestoreLROnStack;
-
-  // Handle the last instruction separately.  If it is tail call, then the
-  // last instruction is a call, we don't want to save + restore in this
-  // case.  However, it could be possible that the last instruction is a
-  // call without it being valid to tail call this sequence.  We should
-  // consider this as well.
-  else if (FrameID != MachineOutlinerThunk &&
-   FrameID != MachineOutlinerTailCall && 
FirstCand.back()->isCall())
-NumBytesToCreateFrame += Costs.SaveRestoreLROnStack;
+  // If we outline this, we need to modify the stack. Pretend we don't
+  // outline this by saving all of its bytes.
+  else
+NumBytesNoStackCalls += SequenceSize;
 }
-RepeatedSequenceLocs = CandidatesWithoutStackFixups;
+
+// If there are no places where we have to save LR, then note that we don't
+// have to update the stack. Otherwise, give every candidate the default
+// call type
+if (NumBytesNoStackCalls <=
+RepeatedSequenceLocs.size() * Costs.CallDefault) {
+  RepeatedSequenceLocs = CandidatesWithoutStackFixups;
+  FrameID = MachineOutlinerNoLRSave;
+} else
+  SetCandidateCallInfo(MachineOutlinerDefault, Costs.CallDefault);
+  }
+
+  // Does every candidate's MBB contain a call?  If so, then we might have a
+  // call in the range.
+  if (FlagsSetInAll & MachineOutlinerMBBFlags::HasCalls) {
+// check if the range contains a call.  These require a save + restore of
+// the link register.
+if (std::any_of(FirstCand.front(), FirstCand.back(),
+[](const MachineInstr &MI) { return MI.isCall(); }))
+  NumBytesToCreateFrame += Costs.SaveRestoreLROnStack;
+
+// Handle the last instruction separately.  If it is tail call, then the
+// last instruction is a call, we don't want to save + restore in this
+// case.  However, it could be possible that the last instruction is a
+// call without it being valid to tail call this sequence.  We should
+// consider this as well.
+else if (FrameID != MachineOutlinerThunk &&
+ FrameID != MachineOutlinerTailCall && FirstCand.back()->isCall())
+  NumBytesToCreateFrame += Costs.SaveRestoreLROnStack;
   }
 
   return outliner::OutlinedFunction(RepeatedSequenceLocs, SequenceSize,

diff  --git a/llvm/test/CodeGen/ARM/machine-outliner-calls.mir 
b/llvm/test/CodeGen/ARM/machine-outliner-calls.mir
index a9a2a1357e10..f18eeb81a35b 100644
--- a/llvm/test/CodeGen/ARM/machine-outliner-calls.mir
+++ b/llvm/test/CodeGen/ARM/machine-outliner-calls.mir
@@ -88,15 +88,15 @@ body: |
   ; CHECK:   frame-setup CFI_INSTRUCTION def_cfa_offset 8
   ; CHECK:   frame-setup CFI_INSTRUCTION offset $lr, -4
   ; CHECK:   frame-setup CFI_INSTRUCTION offset $r7, -8
-  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
+  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_4
   ; CHECK: bb.1:
-  ; CHECK:   tBL 14 /* CC::al */, $noreg, @OUTLINED_FUNCTION_3
+  ; CHECK:   tBL 14 /* CC::al */, $noreg, @

[llvm-branch-commits] [llvm] 01089c8 - [InstCombine] Preserve !annotation on newly created instructions.

2020-12-17 Thread Florian Hahn via llvm-branch-commits

Author: Florian Hahn
Date: 2020-12-17T15:20:23Z
New Revision: 01089c876bff43a7cde1cb9b1ef8c128169ec5b4

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

LOG: [InstCombine] Preserve !annotation on newly created instructions.

If the source instruction has !annotation metadata, all instructions
created during combining should also have it. Tell the builder to
add it.

The !annotation system was discussed on llvm-dev as part of
'RFC: Combining Annotation Metadata and Remarks'
(http://lists.llvm.org/pipermail/llvm-dev/2020-November/146393.html)

This patch is based on an earlier patch by Francis Visoiu Mistrih.

Reviewed By: thegameg, lebedev.ri

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

Added: 


Modified: 
clang/test/CodeGenCXX/auto-var-init.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/annotations.ll

Removed: 




diff  --git a/clang/test/CodeGenCXX/auto-var-init.cpp 
b/clang/test/CodeGenCXX/auto-var-init.cpp
index d50967c40216..761458da9084 100644
--- a/clang/test/CodeGenCXX/auto-var-init.cpp
+++ b/clang/test/CodeGenCXX/auto-var-init.cpp
@@ -597,9 +597,7 @@ TEST_UNINIT(empty, empty);
 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_empty_uninit()
 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation 
[[AUTO_INIT]]
-// ZERO-O1: store i8 0, {{.*}} align 1
-// FIXME: !annotation dropped by optimizations
-// ZERO-O1-NOT: !annotation
+// ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(empty, empty);
 // CHECK-LABEL: @test_empty_braces()
@@ -618,9 +616,7 @@ TEST_UNINIT(small, small);
 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
 // ZERO-LABEL: @test_small_uninit()
 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation 
[[AUTO_INIT]]
-// ZERO-O1: store i8 0, {{.*}} align 1
-// FIXME: !annotation dropped by optimizations
-// ZERO-O1-NOT: !annotation
+// ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(small, small);
 // CHECK-LABEL: @test_small_braces()
@@ -671,10 +667,8 @@ TEST_UNINIT(smallpartinit, smallpartinit);
 // PATTERN-O1: store i8 42, {{.*}} align 1
 // ZERO-LABEL: @test_smallpartinit_uninit()
 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation 
[[AUTO_INIT]]
-// ZERO-O1-LEGACY: store i16 0, i16* %uninit, align 2
-// ZERO-O1-NEWPM: store i16 0, i16* %uninit, align 2
-// FIXME: !annotation dropped by optimizations
-// ZERO-O1-NOT: !annotation
+// ZERO-O1-LEGACY: store i16 0, i16* %uninit, align 2, !annotation 
[[AUTO_INIT]]
+// ZERO-O1-NEWPM: store i16 0, i16* %uninit, align 2, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(smallpartinit, smallpartinit);
 // CHECK-LABEL: @test_smallpartinit_braces()
@@ -726,14 +720,10 @@ TEST_UNINIT(padded, padded);
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_padded_uninit()
 // PATTERN-O0: call void @llvm.memcpy{{.*}} 
@__const.test_padded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
-// PATTERN-O1: store i64 [[I64]], i64* %uninit, align 8
-// FIXME: !annotation dropped by optimizations
-// PATTERN-O1-NOT: !annotation
+// PATTERN-O1: store i64 [[I64]], i64* %uninit, align 8, !annotation 
[[AUTO_INIT]]
 // ZERO-LABEL: @test_padded_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}})
-// ZERO-O1: store i64 0, i64* %uninit, align 8
-// FIXME: !annotation dropped by optimizations
-// ZERO-O1-NOT: !annotation
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation 
[[AUTO_INIT]]
+// ZERO-O1: store i64 0, i64* %uninit, align 8, !annotation [[AUTO_INIT]]
 
 TEST_BRACES(padded, padded);
 // CHECK-LABEL: @test_padded_braces()
@@ -758,15 +748,16 @@ TEST_UNINIT(paddednullinit, paddednullinit);
 // CHECK-NEXT:  call void @{{.*}}used{{.*}}%uninit)
 // PATTERN-LABEL: @test_paddednullinit_uninit()
 // PATTERN-O0: call void @llvm.memcpy{{.*}} 
@__const.test_paddednullinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
-// PATTERN-O1-LEGACY: store i64 [[I64]], i64* %uninit, align 8
-// PATTERN-O1-NEWPM: store i64 [[I64]], i64* %uninit, align 8
-// FIXME: !annotation dropped by optimizations
-// PATTERN-O1-NOT: !annotation
+// PATTERN-O1-LEGACY: store i64 [[I64]], i64* %uninit, align 8, !annotation 
[[AUTO_INIT]]
+// PATTERN-O1-NEWPM: store i64 [[I64]], i64* %uninit, align 8, !annotation 
[[AUTO_INIT]]
 // ZERO-LABEL: @test_paddednullinit_uninit()
-// ZERO-O0: call void @llvm.memset{{.*}}, i8 0,
-// ZERO-O1: store i64 0, i64* %uninit, align 8
+// ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.*}}, !annotation 
[[AUTO_INIT]]
+// ZERO-O1-LEGACY: store i64 0, i64* %uninit, align 8, !annotation 
[[AUTO_INIT]]
+// ZERO-O1-NEWPM: store i64 0, i64* %uninit, ali

[llvm-branch-commits] [llvm] bd343d2 - [TableGen] Return const std::string& in InstrMap getName()/getFilterClass() methods. NFCI.

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T15:23:03Z
New Revision: bd343d26814640b4934fdde8637ad5577d30c83c

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

LOG: [TableGen] Return const std::string& in InstrMap 
getName()/getFilterClass() methods. NFCI.

Avoid temp std::string instances - we're never keeping these around, just 
printing them to streams, converting to StringRef etc.

Added: 


Modified: 
llvm/utils/TableGen/CodeGenMapTable.cpp

Removed: 




diff  --git a/llvm/utils/TableGen/CodeGenMapTable.cpp 
b/llvm/utils/TableGen/CodeGenMapTable.cpp
index 57d86a8fc119..ea53a2d3eee6 100644
--- a/llvm/utils/TableGen/CodeGenMapTable.cpp
+++ b/llvm/utils/TableGen/CodeGenMapTable.cpp
@@ -144,9 +144,9 @@ class InstrMap {
 }
   }
 
-  std::string getName() const { return Name; }
+  const std::string &getName() const { return Name; }
 
-  std::string getFilterClass() const { return FilterClass; }
+  const std::string &getFilterClass() const { return FilterClass; }
 
   ListInit *getRowFields() const { return RowFields; }
 
@@ -190,7 +190,7 @@ class MapTableEmitter {
 public:
   MapTableEmitter(CodeGenTarget &Target, RecordKeeper &Records, Record *IMRec):
   Target(Target), InstrMapDesc(IMRec) {
-const std::string FilterClass = InstrMapDesc.getFilterClass();
+const std::string &FilterClass = InstrMapDesc.getFilterClass();
 InstrDefs = Records.getAllDerivedDefinitions(FilterClass);
   }
 



___
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] fb0f728 - [Clang] Make nomerge attribute a function attribute as well as a statement attribute.

2020-12-17 Thread Zequan Wu via llvm-branch-commits

Author: Zequan Wu
Date: 2020-12-17T07:45:38-08:00
New Revision: fb0f7288051eb2745bb9211306f53ff9aa6f73e2

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

LOG: [Clang] Make nomerge attribute a function attribute as well as a statement 
attribute.

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

Added: 


Modified: 
clang/include/clang/AST/Attr.h
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/lib/CodeGen/CGCall.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/attr-nomerge.cpp
clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/Sema/attr-nomerge.cpp
clang/utils/TableGen/ClangAttrEmitter.cpp
llvm/include/llvm/IR/Attributes.td

Removed: 




diff  --git a/clang/include/clang/AST/Attr.h b/clang/include/clang/AST/Attr.h
index 8d9fb8f2bf27..e453733ab92c 100644
--- a/clang/include/clang/AST/Attr.h
+++ b/clang/include/clang/AST/Attr.h
@@ -162,6 +162,21 @@ class InheritableAttr : public Attr {
   }
 };
 
+class DeclOrStmtAttr : public InheritableAttr {
+protected:
+  DeclOrStmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo,
+ attr::Kind AK, bool IsLateParsed,
+ bool InheritEvenIfAlreadyPresent)
+  : InheritableAttr(Context, CommonInfo, AK, IsLateParsed,
+InheritEvenIfAlreadyPresent) {}
+
+public:
+  static bool classof(const Attr *A) {
+return A->getKind() >= attr::FirstDeclOrStmtAttr &&
+   A->getKind() <= attr::LastDeclOrStmtAttr;
+  }
+};
+
 class InheritableParamAttr : public InheritableAttr {
 protected:
   InheritableParamAttr(ASTContext &Context,

diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index 7d566e64c99b..ce2ee40dc036 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -570,6 +570,9 @@ class InheritableAttr : Attr {
 /// attributes, but have historically been written on declarations.
 class DeclOrTypeAttr : InheritableAttr;
 
+/// A attribute is either a declaration attribute or a statement attribute.
+class DeclOrStmtAttr : InheritableAttr;
+
 /// A target-specific attribute.  This class is meant to be used as a mixin
 /// with InheritableAttr or Attr depending on the attribute's needs.
 class TargetSpecificAttr {
@@ -1317,9 +1320,12 @@ def Unlikely : StmtAttr {
   let Documentation = [LikelihoodDocs];
 }
 
-def NoMerge : StmtAttr {
+def NoMerge : DeclOrStmtAttr {
   let Spellings = [Clang<"nomerge">];
   let Documentation = [NoMergeDocs];
+  let InheritEvenIfAlreadyPresent = 1;
+  let Subjects = SubjectList<[Function], ErrorDiag, "functions and 
statements">;
+  let SimpleHandler = 1;
 }
 
 def FastCall : DeclOrTypeAttr {

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index 4f8cd8ecd86f..c3a412158aba 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -386,7 +386,11 @@ location of certain calls. For example, it will prevent 
tail merging otherwise
 identical code sequences that raise an exception or terminate the program. Tail
 merging normally reduces the precision of source location information, making
 stack traces less useful for debugging. This attribute gives the user control
-over the tradeoff between code size and debug information precision.
+over the tradeoff between code size and debug information precision. 
+
+``nomerge`` attribute can also be used as function attribute to prevent all 
+calls to the specified function from merging. It has no effect on indirect 
+calls.
   }];
 }
 

diff  --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 28a7d128505a..bfc7b8e74d8f 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -1968,6 +1968,8 @@ void CodeGenModule::ConstructAttributeList(
   FuncAttrs.addAttribute(llvm::Attribute::NoReturn);
 NBA = Fn->getAttr();
   }
+  if (!AttrOnCallSite && TargetDecl->hasAttr())
+FuncAttrs.addAttribute(llvm::Attribute::NoMerge);
 }
 
 // 'const', 'pure' and 'noalias' attributed functions are also nounwind.
@@ -4978,11 +4980,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo 
&CallInfo,
 Attrs.addAttribute(getLLVMContext(), 
llvm::AttributeList::FunctionIndex,
llvm::Attribute::StrictFP);
 
-  // Add call-site nomerge attribute if exists.
-  if (InNoMergeAttributedStmt)
-Attrs =
-  Attrs.addAttribute(getLLVMContext(), llvm::AttributeList::FunctionIndex,
- llvm::Attribute::NoMerge);
+  // Add nomerge attribute to the call-site if the callee function doesn't have
+  // the attr

[llvm-branch-commits] [llvm] f5f8d86 - Don't error for zero-length arange entries

2020-12-17 Thread Tom Stellard via llvm-branch-commits

Author: James Henderson
Date: 2020-12-16T22:47:02-05:00
New Revision: f5f8d86dc4c91ef492b919edf98335d4d09188a8

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

LOG: Don't error for zero-length arange entries

Although the DWARF specification states that .debug_aranges entries
can't have length zero, these can occur in the wild. There's no
particular reason to enforce this part of the spec, since functionally
they have no impact. The patch removes the error and introduces a new
warning for premature terminator entries which does not stop parsing.

This is a relanding of cb3a598c87db, adding the missing obj2yaml part
that was needed.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46805. See also
https://reviews.llvm.org/D71932 which originally introduced the error.

Reviewed by: ikudrin, dblaikie, Higuoxing

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

Added: 


Modified: 
llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp

Removed: 




diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp 
b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
index 608fc0388af0..c3b039b05f30 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp
@@ -132,19 +132,20 @@ Error DWARFDebugArangeSet::extract(DWARFDataExtractor 
data,
 
   uint64_t end_offset = Offset + full_length;
   while (*offset_ptr < end_offset) {
+uint64_t EntryOffset = *offset_ptr;
 arangeDescriptor.Address = data.getUnsigned(offset_ptr, 
HeaderData.AddrSize);
 arangeDescriptor.Length = data.getUnsigned(offset_ptr, 
HeaderData.AddrSize);
 
-if (arangeDescriptor.Length == 0) {
-  // Each set of tuples is terminated by a 0 for the address and 0
-  // for the length.
-  if (arangeDescriptor.Address == 0 && *offset_ptr == end_offset)
+// Each set of tuples is terminated by a 0 for the address and 0
+// for the length.
+if (arangeDescriptor.Length == 0 && arangeDescriptor.Address == 0) {
+  if (*offset_ptr == end_offset)
 return ErrorSuccess();
   return createStringError(
   errc::invalid_argument,
   "address range table at offset 0x%" PRIx64
-  " has an invalid tuple (length = 0) at offset 0x%" PRIx64,
-  Offset, *offset_ptr - tuple_size);
+  " has a premature terminator entry at offset 0x%" PRIx64,
+  Offset, EntryOffset);
 }
 
 ArangeDescriptors.push_back(arangeDescriptor);

diff  --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp 
b/llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
index 4ec9c5d1c0be..7f16aa9ce4b7 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugArangeSetTest.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
+#include "llvm/Testing/Support/Error.h"
 #include "gtest/gtest.h"
 
 using namespace llvm;
@@ -166,9 +167,9 @@ TEST(DWARFDebugArangeSet, UnevenLength) {
   "of the tuple size");
 }
 
-TEST(DWARFDebugArangeSet, ZeroLengthEntry) {
+TEST(DWARFDebugArangeSet, ZeroAddressEntry) {
   static const char DebugArangesSecRaw[] =
-  "\x24\x00\x00\x00" // Length
+  "\x1c\x00\x00\x00" // Length
   "\x02\x00" // Version
   "\x00\x00\x00\x00" // Debug Info Offset
   "\x04" // Address Size
@@ -176,14 +177,68 @@ TEST(DWARFDebugArangeSet, ZeroLengthEntry) {
   "\x00\x00\x00\x00" // Padding
   "\x00\x00\x00\x00" // Entry1: Address
   "\x01\x00\x00\x00" // Length
+  "\x00\x00\x00\x00" // Termination tuple
+  "\x00\x00\x00\x00";
+  DWARFDataExtractor Extractor(
+  StringRef(DebugArangesSecRaw, sizeof(DebugArangesSecRaw) - 1),
+  /*IsLittleEndian=*/true,
+  /*AddressSize=*/4);
+  DWARFDebugArangeSet Set;
+  uint64_t Offset = 0;
+  ASSERT_THAT_ERROR(Set.extract(Extractor, &Offset),
+Succeeded());
+  auto Range = Set.descriptors();
+  auto Iter = Range.begin();
+  ASSERT_EQ(std::distance(Iter, Range.end()), 1u);
+  EXPECT_EQ(Iter->Address, 0u);
+  EXPECT_EQ(Iter->Length, 1u);
+}
+
+TEST(DWARFDebugArangeSet, ZeroLengthEntry) {
+  static const char DebugArangesSecRaw[] =
+  "\x1c\x00\x00\x00" // Length
+  "\x02\x00" // Version
+  "\x00\x00\x00\x00" // Debug Info Offset
+  "\x04" // Address Size
+  "\x00" // Segment Selector Size
+  "\x00\x00\x00\x00" // Padding
+  "\x01\x00\x00\x00" // Entry1: Address
+  "\x00\x00\x00\x00" // Length
+  "\x00\x00\x00\x00" // Termination tuple
+  "\x00\x00\x00\x00";
+  DWA

[llvm-branch-commits] [llvm] d104e58 - [CMake] Avoid __FakeVCSRevision.h with no git repository

2020-12-17 Thread Tom Stellard via llvm-branch-commits

Author: Jonas Hahnfeld
Date: 2020-12-17T10:51:20-05:00
New Revision: d104e582838fd73d6ef565788f11617eccab87e2

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

LOG: [CMake] Avoid __FakeVCSRevision.h with no git repository

Set the return variable to "" in find_first_existing_vc_file to
say that there is a repository, but no file to depend on. This works
transparently for all other callers that handle undefinedness and
equality to an empty string the same way.

Use the knowledge to avoid depending on __FakeVCSRevision.h if there
is no git repository at all (for example when building a release) as
there is no point in regenerating an empty VCSRevision.h.

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

(cherry picked from commit 6e890ec7beb0874464a0af9f84e41a987f968b23)

Added: 


Modified: 
llvm/cmake/modules/AddLLVM.cmake
llvm/include/llvm/Support/CMakeLists.txt

Removed: 




diff  --git a/llvm/cmake/modules/AddLLVM.cmake 
b/llvm/cmake/modules/AddLLVM.cmake
index 333167bfb6b0..b74adc11ade9 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -2102,6 +2102,13 @@ function(setup_dependency_debugging name)
   set_target_properties(${name} PROPERTIES RULE_LAUNCH_COMPILE 
${sandbox_command})
 endfunction()
 
+# If the sources at the given `path` are under version control, set `out_var`
+# to the the path of a file which will be modified when the VCS revision
+# changes, attempting to create that file if it does not exist; if no such
+# file exists and one cannot be created, instead set `out_var` to the
+# empty string.
+#
+# If the sources are not under version control, do not define `out_var`.
 function(find_first_existing_vc_file path out_var)
   if(NOT EXISTS "${path}")
 return()
@@ -2123,6 +2130,7 @@ function(find_first_existing_vc_file path out_var)
   RESULT_VARIABLE touch_head_result
   ERROR_QUIET)
 if (NOT touch_head_result EQUAL 0)
+  set(${out_var} "" PARENT_SCOPE)
   return()
 endif()
   endif()

diff  --git a/llvm/include/llvm/Support/CMakeLists.txt 
b/llvm/include/llvm/Support/CMakeLists.txt
index da8a4da443ed..69f6a1582ce9 100644
--- a/llvm/include/llvm/Support/CMakeLists.txt
+++ b/llvm/include/llvm/Support/CMakeLists.txt
@@ -11,7 +11,7 @@ if(LLVM_APPEND_VC_REV)
   # A fake version file and is not expected to exist. It is being used to
   # force regeneration of VCSRevision.h for source directory with no write
   # permission available.
-  if (NOT llvm_vc)
+  if (llvm_vc STREQUAL "")
 set(fake_version_inc "${CMAKE_CURRENT_BINARY_DIR}/__FakeVCSRevision.h")
   endif()
 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] [flang] 36bf2de - [flang][openacc] Update serial construct clauses for OpenACC 3.1

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T10:50:47-05:00
New Revision: 36bf2de8d866e2b448d17f4d2cb4bb96819d82b7

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

LOG: [flang][openacc] Update serial construct clauses for OpenACC 3.1

Update the allowed clauses for the SERIAL construct for the new OpenACC 3.1
specification.

Reviewed By: sameeranjoshi

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

Added: 


Modified: 
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/test/Semantics/acc-clause-validity.f90 
b/flang/test/Semantics/acc-clause-validity.f90
index 1f98d0f2559f..a5c6193d32f5 100644
--- a/flang/test/Semantics/acc-clause-validity.f90
+++ b/flang/test/Semantics/acc-clause-validity.f90
@@ -3,8 +3,8 @@
 ! Check OpenACC clause validity for the following construct and directive:
 !   2.6.5 Data
 !   2.5.1 Parallel
-!   2.5.2 Kernels
-!   2.5.3 Serial
+!   2.5.2 Serial
+!   2.5.3 Kernels
 !   2.9 Loop
 !   2.12 Atomic
 !   2.13 Declare
@@ -780,6 +780,170 @@ program openacc_clause_validity
   end do
   !$acc end parallel loop
 
+  !$acc serial
+  !$acc end serial
+
+  !$acc serial async
+  !$acc end serial
+
+  !$acc serial async(1)
+  !$acc end serial
+
+  !ERROR: At most one ASYNC clause can appear on the SERIAL directive
+  !$acc serial async(1) async(2)
+  !$acc end serial
+
+  !$acc serial async(async1)
+  !$acc end serial
+
+  !$acc serial wait
+  !$acc end serial
+
+  !$acc serial wait(1)
+  !$acc end serial
+
+  !$acc serial wait(wait1)
+  !$acc end serial
+
+  !$acc serial wait(1,2)
+  !$acc end serial
+
+  !$acc serial wait(wait1, wait2)
+  !$acc end serial
+
+  !$acc serial wait(wait1) wait(wait2)
+  !$acc end serial
+
+  !ERROR: NUM_GANGS clause is not allowed on the SERIAL directive
+  !$acc serial num_gangs(8)
+  !$acc end serial
+
+  !ERROR: NUM_WORKERS clause is not allowed on the SERIAL directive
+  !$acc serial num_workers(8)
+  !$acc end serial
+
+  !ERROR: VECTOR_LENGTH clause is not allowed on the SERIAL directive
+  !$acc serial vector_length(128)
+  !$acc end serial
+
+  !$acc serial if(.true.)
+  !$acc end serial
+
+  !ERROR: At most one IF clause can appear on the SERIAL directive
+  !$acc serial if(.true.) if(ifCondition)
+  !$acc end serial
+
+  !$acc serial if(ifCondition)
+  !$acc end serial
+
+  !$acc serial self
+  !$acc end serial
+
+  !$acc serial self(.true.)
+  !$acc end serial
+
+  !$acc serial self(ifCondition)
+  !$acc end serial
+
+  !$acc serial loop reduction(+: reduction_r)
+  do i = 1, N
+reduction_r = a(i) + i
+  end do
+
+  !$acc serial loop reduction(*: reduction_r)
+  do i = 1, N
+reduction_r = reduction_r * (a(i) + i)
+  end do
+
+  !$acc serial loop reduction(min: reduction_r)
+  do i = 1, N
+reduction_r = min(reduction_r, a(i) * i)
+  end do
+
+  !$acc serial loop reduction(max: reduction_r)
+  do i = 1, N
+reduction_r = max(reduction_r, a(i) * i)
+  end do
+
+  !$acc serial loop reduction(iand: b)
+  do i = 1, N
+b = iand(b, c(i))
+  end do
+
+  !$acc serial loop reduction(ior: b)
+  do i = 1, N
+b = ior(b, c(i))
+  end do
+
+  !$acc serial loop reduction(ieor: b)
+  do i = 1, N
+b = ieor(b, c(i))
+  end do
+
+  !$acc serial loop reduction(.and.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .and. e(i)
+  end do
+
+  !$acc serial loop reduction(.or.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .or. e(i)
+  end do
+
+  !$acc serial loop reduction(.eqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .eqv. e(i)
+  end do
+
+  !$acc serial loop reduction(.neqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .neqv. e(i)
+  end do
+
+  !$acc serial reduction(.neqv.: reduction_l)
+  !$acc loop reduction(.neqv.: reduction_l)
+  do i = 1, N
+reduction_l = d(i) .neqv. e(i)
+  end do
+  !$acc end serial
+
+  !$acc serial copy(aa) copyin(bb) copyout(cc)
+  !$acc end serial
+
+  !$acc serial copy(aa, bb) copyout(zero: cc)
+  !$acc end serial
+
+  !$acc serial present(aa, bb) create(cc)
+  !$acc end serial
+
+  !$acc serial copyin(readonly: aa, bb) create(zero: cc)
+  !$acc end serial
+
+  !$acc serial deviceptr(aa, bb) no_create(cc)
+  !$acc end serial
+
+  !$acc serial attach(aa, bb, cc)
+  !$acc end serial
+
+  !$acc serial firstprivate(bb, cc)
+  !$acc end serial
+
+  !$acc serial private(aa)
+  !$acc end serial
+
+  !$acc serial default(none)
+  !$acc end serial
+
+  !$acc serial default(present)
+  !$acc end serial
+
+  !ERROR: At most one DEFAULT clause can appear on the SERIAL directive
+  !$acc serial default(present) default(none)
+  !$acc end serial
+
+  !$acc serial device_type(*) async wait
+  !$acc end serial
+
   !$acc serial device_type(*) async
   do i = 1, N
 a(i) = 3.14

diff  -

[llvm-branch-commits] [llvm] 4bb10be - [SampleFDO] Fix uninitialized field warnings. NFCI.

2020-12-17 Thread Simon Pilgrim via llvm-branch-commits

Author: Simon Pilgrim
Date: 2020-12-17T15:51:26Z
New Revision: 4bb10be9a6e06a6c51cc1695ff5dc9d68c953334

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

LOG: [SampleFDO] Fix uninitialized field warnings. NFCI.

Seems to have been caused by D93254 which added the 
SecHdrTableEntry::LayoutIndex field.

Added: 


Modified: 
llvm/include/llvm/ProfileData/SampleProfWriter.h

Removed: 




diff  --git a/llvm/include/llvm/ProfileData/SampleProfWriter.h 
b/llvm/include/llvm/ProfileData/SampleProfWriter.h
index 5bb1446acb0b..fc568f06ffc8 100644
--- a/llvm/include/llvm/ProfileData/SampleProfWriter.h
+++ b/llvm/include/llvm/ProfileData/SampleProfWriter.h
@@ -278,9 +278,9 @@ class SampleProfileWriterExtBinary : public 
SampleProfileWriterExtBinaryBase {
 // profile because FuncOffsetTable needs to be populated while section
 // SecLBRProfile is written.
 SectionHdrLayout = {
-{SecProfSummary, 0, 0, 0},   {SecNameTable, 0, 0, 0},
-{SecFuncOffsetTable, 0, 0, 0},   {SecLBRProfile, 0, 0, 0},
-{SecProfileSymbolList, 0, 0, 0}, {SecFuncMetadata, 0, 0, 0}};
+{SecProfSummary, 0, 0, 0, 0},   {SecNameTable, 0, 0, 0, 0},
+{SecFuncOffsetTable, 0, 0, 0, 0},   {SecLBRProfile, 0, 0, 0, 0},
+{SecProfileSymbolList, 0, 0, 0, 0}, {SecFuncMetadata, 0, 0, 0, 0}};
   };
   virtual std::error_code
   writeSections(const StringMap &ProfileMap) override;



___
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] 7e13694 - [llvm-symbolizer][Windows] Add start line when searching in line table sections.

2020-12-17 Thread Amy Huang via llvm-branch-commits

Author: Amy Huang
Date: 2020-12-17T07:57:36-08:00
New Revision: 7e13694ac745f6cd4008dd354f2fcfc417b1e1e9

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

LOG: [llvm-symbolizer][Windows] Add start line when searching in line table 
sections.

Fixes issue where if a line section doesn't start with a line number
then the addresses at the beginning of the section don't have line numbers.

For example, for a line section like this
```
  0001:0010-0014, line/column/addr entries = 1
 7 0013 !
```
a line number wouldn't be found for addresses from 10 to 12.

This matches behavior when using the DIA SDK.

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

Added: 
lld/test/COFF/symbolizer-line-numbers.s

Modified: 
llvm/lib/DebugInfo/PDB/Native/SymbolCache.cpp

Removed: 




diff  --git a/lld/test/COFF/symbolizer-line-numbers.s 
b/lld/test/COFF/symbolizer-line-numbers.s
new file mode 100644
index ..679e94eb2bb0
--- /dev/null
+++ b/lld/test/COFF/symbolizer-line-numbers.s
@@ -0,0 +1,322 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj %s -o %t.obj -triple x86_64-windows-msvc
+# RUN: lld-link -entry:main -nodefaultlib %t.obj -out:%t.exe -pdb:%t.pdb -debug
+# RUN: llvm-symbolizer --obj=%t.exe --relative-address \
+# RUN:   0x1000 0x1003 0x1010 0x1013 | FileCheck %s
+
+# Compiled from this cpp code:
+# int f1(int x) {
+#   int y = x + 1;
+#   return y;
+# }
+# int f2(int n) {
+#   return f1(n);
+# }
+# int main() {
+#   return f2(100);
+# }
+
+.text
+   .def @feat.00;
+   .scl3;
+   .type   0;
+   .endef
+   .globl  @feat.00
+.set @feat.00, 0
+   .file   "t.cpp"
+   .def "?f1@@YAHH@Z";
+   .scl2;
+   .type   32;
+   .endef
+   .globl  "?f1@@YAHH@Z"   # -- Begin function ?f1@@YAHH@Z
+   .p2align4, 0x90
+"?f1@@YAHH@Z":  # @"?f1@@YAHH@Z"
+.Lfunc_begin0:
+   .cv_func_id 0
+# %bb.0:# %entry
+   .cv_file1 "C:\\src\\tests\\t.cpp" 
"E6E6D87A9021656AD44E74484F5BA421" 1
+
+# CHECK:  f1(int)
+# CHECK-NEXT: t.cpp:2:13
+   .cv_loc 0 1 2 13# t.cpp:2:13
+# kill: def $ecx killed $ecx def $rcx
+   leal1(%rcx), %eax
+
+# CHECK:  f1(int)
+# CHECK-NEXT: t.cpp:3:3
+   .cv_loc 0 1 3 3 # t.cpp:3:3
+   retq
+.Ltmp0:
+.Lfunc_end0:
+# -- End function
+   .def "?f2@@YAHH@Z";
+   .scl2;
+   .type   32;
+   .endef
+   .globl  "?f2@@YAHH@Z"   # -- Begin function ?f2@@YAHH@Z
+   .p2align4, 0x90
+"?f2@@YAHH@Z":  # @"?f2@@YAHH@Z"
+.Lfunc_begin1:
+   .cv_func_id 1
+# %bb.0:# %entry
+# CHECK:  f1
+# CHECK-NEXT: t.cpp:2:0
+# CHECK-NEXT: f2(int)
+# CHECK-NEXT: t.cpp:6:3
+   .cv_inline_site_id 2 within 1 inlined_at 1 6 10
+   .cv_loc 2 1 2 13# t.cpp:2:13
+# kill: def $ecx killed $ecx def $rcx
+   leal1(%rcx), %eax
+.Ltmp1:
+   .cv_loc 1 1 6 3 # t.cpp:6:3
+   retq
+# CHECK:  f2(int)
+# CHECK-NEXT: t.cpp:6:3
+.Ltmp2:
+.Lfunc_end1:
+# -- End function
+   .def main;
+   .scl2;
+   .type   32;
+   .endef
+   .globl  main# -- Begin function main
+   .p2align4, 0x90
+main:   # @main
+.Lfunc_begin2:
+   .cv_func_id 3
+# %bb.0:# %entry
+   .cv_loc 3 1 9 3 # t.cpp:9:3
+   movl$101, %eax
+   retq
+.Ltmp3:
+.Lfunc_end2:
+# -- End function
+   .section.debug$S,"dr"
+   .p2align2
+   .long   4   # Debug section magic
+   .long   241
+   .long   .Ltmp5-.Ltmp4   # Subsection size
+.Ltmp4:
+   .short  .Ltmp7-.Ltmp6   # Record length
+.Ltmp6:
+   .short  4412# Record kind: S_COMPILE3
+   .long   1   # Flags and language
+   .short  208 # CPUType
+   .short  12  # Frontend version
+   .short  0
+   .short  0
+   .short  0
+   .short  12000   # Backend version
+   .short  0
+   .short  0
+   .short  0
+   .asciz  "clang version 12.0.0 (https://github.com/llvm/llvm-project.git 
e2e86f4e77ec2fd79743f4d0e94689e9668600ad)" # Null-terminated compile

[llvm-branch-commits] [llvm] d20e0c3 - Ensure SplitEdge to return the new block between the two given blocks

2020-12-17 Thread Whitney Tsang via llvm-branch-commits

Author: Bangtian Liu
Date: 2020-12-17T16:00:15Z
New Revision: d20e0c3444ad9ada550d9d6d1d56fd72948ae444

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

LOG: Ensure SplitEdge to return the new block between the two given blocks

This PR implements the function splitBasicBlockBefore to address an
issue
that occurred during SplitEdge(BB, Succ, ...), inside splitBlockBefore.
The issue occurs in SplitEdge when the Succ has a single predecessor
and the edge between the BB and Succ is not critical. This produces
the result ‘BB->Succ->New’. The new function splitBasicBlockBefore
was added to splitBlockBefore to handle the issue and now produces
the correct result ‘BB->New->Succ’.

Below is an example of splitting the block bb1 at its first instruction.

/// Original IR
bb0:
br bb1
bb1:
%0 = mul i32 1, 2
br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlock
bb0:
br bb1
bb1:
br bb1.split
bb1.split:
%0 = mul i32 1, 2
br bb2
bb2:
/// IR after splitEdge(bb0, bb1) using splitBasicBlockBefore
bb0:
br bb1.split
bb1.split
br bb1
bb1:
%0 = mul i32 1, 2
br bb2
bb2:

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

Added: 


Modified: 
llvm/include/llvm/IR/BasicBlock.h
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/test/CodeGen/AMDGPU/call-constexpr.ll
llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/IR/BasicBlock.h 
b/llvm/include/llvm/IR/BasicBlock.h
index 0cce2a599d9c..b86bb16e1239 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -398,22 +398,49 @@ class BasicBlock final : public Value, // Basic blocks 
are data objects also
 
   /// Split the basic block into two basic blocks at the specified instruction.
   ///
-  /// Note that all instructions BEFORE the specified iterator stay as part of
-  /// the original basic block, an unconditional branch is added to the 
original
-  /// BB, and the rest of the instructions in the BB are moved to the new BB,
-  /// including the old terminator.  The newly formed BasicBlock is returned.
-  /// This function invalidates the specified iterator.
+  /// If \p Before is true, splitBasicBlockBefore handles the
+  /// block splitting. Otherwise, execution proceeds as described below.
+  ///
+  /// Note that all instructions BEFORE the specified iterator
+  /// stay as part of the original basic block, an unconditional branch is 
added
+  /// to the original BB, and the rest of the instructions in the BB are moved
+  /// to the new BB, including the old terminator.  The newly formed basic 
block
+  /// is returned. This function invalidates the specified iterator.
   ///
   /// Note that this only works on well formed basic blocks (must have a
-  /// terminator), and 'I' must not be the end of instruction list (which would
-  /// cause a degenerate basic block to be formed, having a terminator inside 
of
-  /// the basic block).
+  /// terminator), and \p 'I' must not be the end of instruction list (which
+  /// would cause a degenerate basic block to be formed, having a terminator
+  /// inside of the basic block).
   ///
   /// Also note that this doesn't preserve any passes. To split blocks while
   /// keeping loop information consistent, use the SplitBlock utility function.
-  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
-  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
-return splitBasicBlock(I->getIterator(), BBName);
+  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "",
+  bool Before = false);
+  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "",
+  bool Before = false) {
+return splitBasicBlock(I->getIterator(), BBName, Before);
+  }
+
+  /// Split the basic block into two basic blocks at the specified instruction
+  /// and insert the new basic blocks as the predecessor of the current block.
+  ///
+  /// This function ensures all instructions AFTER and including the specified
+  /// iterator \p I are part of the original basic block. All Instructions
+  /// BEFORE the iterator \p I are moved to the new BB and an unconditional
+  /// branch is added to the new BB. The new basic block is returned.
+  ///
+  /// Note that this only works on well formed basic blocks (must have a
+  /// terminator), and \p 'I' must not be the end of instruction list (which
+  /// would cause a degenerate basic block to be formed, having a terminator
+  /// inside

[llvm-branch-commits] [clang] daf39e3 - [amdgpu] Default to code object v3

2020-12-17 Thread Jon Chesterfield via llvm-branch-commits

Author: Jon Chesterfield
Date: 2020-12-17T16:09:33Z
New Revision: daf39e3f2dba18bd39cd89a1c91bae126a31d4fe

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

LOG: [amdgpu] Default to code object v3

[amdgpu] Default to code object v3
v4 is not yet readily available, and doesn't appear
to be implemented in the back end

Reviewed By: t-tye, yaxunl

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

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/hip-code-object-version.hip
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index f384e0d993c2..07f15add28ec 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2909,7 +2909,7 @@ def mexec_model_EQ : Joined<["-"], "mexec-model=">, 
Group;
 
 def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, 
Group,
-  HelpText<"Specify code object ABI version. Defaults to 4. (AMDGPU only)">,
+  HelpText<"Specify code object ABI version. Defaults to 3. (AMDGPU only)">,
   MetaVarName<"">, Values<"2,3,4">;
 
 def mcode_object_v3_legacy : Flag<["-"], "mcode-object-v3">, Group,

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 72bedc16846d..04d0e0771f70 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1549,7 +1549,7 @@ unsigned tools::getOrCheckAMDGPUCodeObjectVersion(
 const Driver &D, const llvm::opt::ArgList &Args, bool Diagnose) {
   const unsigned MinCodeObjVer = 2;
   const unsigned MaxCodeObjVer = 4;
-  unsigned CodeObjVer = 4;
+  unsigned CodeObjVer = 3;
 
   // Emit warnings for legacy options even if they are overridden.
   if (Diagnose) {

diff  --git a/clang/test/Driver/hip-code-object-version.hip 
b/clang/test/Driver/hip-code-object-version.hip
index 51d9004b0cbf..6e4e96688593 100644
--- a/clang/test/Driver/hip-code-object-version.hip
+++ b/clang/test/Driver/hip-code-object-version.hip
@@ -53,7 +53,7 @@
 // RUN:   --offload-arch=gfx906 -nogpulib \
 // RUN:   %s 2>&1 | FileCheck -check-prefix=VD %s
 
-// VD: "-mllvm" "--amdhsa-code-object-version=4"
+// VD: "-mllvm" "--amdhsa-code-object-version=3"
 // VD: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
 
 // Check invalid code object version option.

diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index 6d3fa7021a7a..c8dda47352ab 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -911,12 +911,12 @@ The AMDGPU backend uses the following ELF header:
 
   * ``ELFABIVERSION_AMDGPU_HSA_V3`` is used to specify the version of AMD HSA
 runtime ABI for code object V3. Specify using the Clang option
-``-mcode-object-version=3``.
+``-mcode-object-version=3``. This is the default code object
+version if not specified.
 
   * ``ELFABIVERSION_AMDGPU_HSA_V4`` is used to specify the version of AMD HSA
 runtime ABI for code object V4. Specify using the Clang option
-``-mcode-object-version=4``. This is the default code object
-version if not specified.
+``-mcode-object-version=4``.
 
   * ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL
 runtime ABI.
@@ -2871,10 +2871,6 @@ non-AMD key names should be prefixed by "*vendor-name*.".
 Code Object V3 Metadata
 +++
 
-.. warning::
-  Code object V3 is not the default code object version emitted by this version
-  of LLVM.
-
 Code object V3 to V4 metadata is specified by the ``NT_AMDGPU_METADATA`` note
 record (see :ref:`amdgpu-note-records-v3-v4`).
 
@@ -3279,6 +3275,10 @@ same *vendor-name*.
 Code Object V4 Metadata
 +++
 
+.. warning::
+  Code object V4 is not the default code object version emitted by this version
+  of LLVM.
+
 Code object V4 metadata is the same as
 :ref:`amdgpu-amdhsa-code-object-metadata-v3` with the changes and additions
 defined in table :ref:`amdgpu-amdhsa-code-object-metadata-map-table-v3`.



___
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] ab6cb31 - [PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass

2020-12-17 Thread Jinsong Ji via llvm-branch-commits

Author: Jinsong Ji
Date: 2020-12-17T11:16:33-05:00
New Revision: ab6cb31642fdc84301b7749fdeabba324e3dbc4a

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

LOG: [PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass

The PPCCTRLoop pass has been moved to HardwareLoops,
so the comments and some useless code are deprecated now.

Reviewed By: #powerpc, nemanjai

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

Added: 


Modified: 
llvm/lib/Target/PowerPC/PPCCTRLoops.cpp

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp 
b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
index bb12e05173a6..77ea232b0662 100644
--- a/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
+++ b/llvm/lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -1,4 +1,4 @@
-//===-- PPCCTRLoops.cpp - Identify and generate CTR loops 
-===//
+//===-- PPCCTRLoops.cpp - Verify CTR loops -===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,74 +6,48 @@
 //
 
//===--===//
 //
-// This pass identifies loops where we can generate the PPC branch instructions
-// that decrement and test the count register (CTR) (bdnz and friends).
-//
-// The pattern that defines the induction variable can changed depending on
-// prior optimizations.  For example, the IndVarSimplify phase run by 'opt'
-// normalizes induction variables, and the Loop Strength Reduction pass
-// run by 'llc' may also make changes to the induction variable.
-//
-// Criteria for CTR loops:
-//  - Countable loops (w/ ind. var for a trip count)
-//  - Try inner-most loops first
-//  - No nested CTR loops.
-//  - No function calls in loops.
+// This pass verifies that all bdnz/bdz instructions are dominated by a loop
+// mtctr before any other instructions that might clobber the ctr register.
 //
 
//===--===//
 
+// CTR loops are produced by the HardwareLoops pass and this pass is simply a
+// verification that no invalid CTR loops are produced. As such, it isn't
+// something that needs to be run (or even defined) for Release builds so the
+// entire file is guarded by NDEBUG.
+#ifndef NDEBUG
+#include 
+
+#include "MCTargetDesc/PPCMCTargetDesc.h"
 #include "PPC.h"
-#include "PPCSubtarget.h"
-#include "PPCTargetMachine.h"
-#include "PPCTargetTransformInfo.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/Statistic.h"
-#include "llvm/Analysis/AssumptionCache.h"
-#include "llvm/Analysis/CFG.h"
-#include "llvm/Analysis/CodeMetrics.h"
-#include "llvm/Analysis/LoopInfo.h"
-#include "llvm/Analysis/LoopIterator.h"
-#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/Analysis/TargetTransformInfo.h"
-#include "llvm/CodeGen/TargetPassConfig.h"
-#include "llvm/CodeGen/TargetSchedule.h"
-#include "llvm/IR/Constants.h"
-#include "llvm/IR/DerivedTypes.h"
-#include "llvm/IR/Dominators.h"
-#include "llvm/IR/InlineAsm.h"
-#include "llvm/IR/Instructions.h"
-#include "llvm/IR/IntrinsicInst.h"
-#include "llvm/IR/Module.h"
-#include "llvm/IR/ValueHandle.h"
+#include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/ilist_iterator.h"
+#include "llvm/CodeGen/MachineBasicBlock.h"
+#include "llvm/CodeGen/MachineDominators.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineInstrBundleIterator.h"
+#include "llvm/CodeGen/MachineOperand.h"
+#include "llvm/CodeGen/Register.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
-#include "llvm/Support/CommandLine.h"
+#include "llvm/PassRegistry.h"
+#include "llvm/Support/CodeGen.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/GenericDomTreeConstruction.h"
+#include "llvm/Support/Printable.h"
 #include "llvm/Support/raw_ostream.h"
-#include "llvm/Transforms/Scalar.h"
-#include "llvm/Transforms/Utils.h"
-#include "llvm/Transforms/Utils/BasicBlockUtils.h"
-#include "llvm/Transforms/Utils/Local.h"
-#include "llvm/Transforms/Utils/LoopUtils.h"
-
-#ifndef NDEBUG
-#include "llvm/CodeGen/MachineDominators.h"
-#include "llvm/CodeGen/MachineFunction.h"
-#include "llvm/CodeGen/MachineFunctionPass.h"
-#include "llvm/CodeGen/MachineRegisterInfo.h"
-#endif
 
 using namespace llvm;
 
-#define DEBUG_TYPE "ctrloops"
-
-#ifndef NDEBUG
-static cl::opt CTRLoopLimit("ppc-max-ctrloop", cl::Hidden, cl::init(-1));
-#endif
+#define DEBUG_TYPE "ppc-ctrloops-verify"
 
 namespace {
 
-#ifndef NDEBUG
   struct PPCCTRLoopsVerify : public MachineFunctionPass {
   public:
   

[llvm-branch-commits] [llvm] df2b9a3 - [DebugInfo] Avoid re-ordering assignments in LCSSA

2020-12-17 Thread Jeremy Morse via llvm-branch-commits

Author: Nabeel Omer
Date: 2020-12-17T16:17:32Z
New Revision: df2b9a3e02ca3bd7b60af6c65571909a7d3ab317

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

LOG: [DebugInfo] Avoid re-ordering assignments in LCSSA

The LCSSA pass makes use of a function insertDebugValuesForPHIs() to
propogate dbg.value() intrinsics to newly inserted PHI instructions. Faulty
behaviour occurs when the parent PHI of a newly inserted PHI is not the
most recent assignment to a source variable. insertDebugValuesForPHIs ends
up propagating a value that isn't the most recent assignemnt.

This change removes the call to insertDebugValuesForPHIs() from LCSSA,
preventing incorrect dbg.value intrinsics from being propagated.
Propagating variable locations between blocks will occur later, during
LiveDebugValues.

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

Added: 
llvm/test/Transforms/LCSSA/DontInsertDebugValuesForPHIs.ll

Modified: 
llvm/lib/Transforms/Utils/LCSSA.cpp
llvm/test/Transforms/LCSSA/basictest.ll
llvm/test/Transforms/LoopIdiom/X86/left-shift-until-bittest.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/LCSSA.cpp 
b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 1bcf40e11d10..a601ec9349e0 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -265,15 +265,11 @@ bool 
llvm::formLCSSAForInstructions(SmallVectorImpl &Worklist,
 Worklist.push_back(PostProcessPN);
 
 // Keep track of PHI nodes that we want to remove because they did not have
-// any uses rewritten. If the new PHI is used, store it so that we can
-// try to propagate dbg.value intrinsics to it.
-SmallVector NeedDbgValues;
+// any uses rewritten.
 for (PHINode *PN : AddedPHIs)
   if (PN->use_empty())
 LocalPHIsToRemove.insert(PN);
-  else
-NeedDbgValues.push_back(PN);
-insertDebugValuesForPHIs(InstBB, NeedDbgValues);
+
 Changed = true;
   }
 

diff  --git a/llvm/test/Transforms/LCSSA/DontInsertDebugValuesForPHIs.ll 
b/llvm/test/Transforms/LCSSA/DontInsertDebugValuesForPHIs.ll
new file mode 100644
index ..b140bc96f5d0
--- /dev/null
+++ b/llvm/test/Transforms/LCSSA/DontInsertDebugValuesForPHIs.ll
@@ -0,0 +1,57 @@
+; RUN: opt < %s -lcssa -S | FileCheck %s
+
+; This test ensures that LCSSA does not insert dbg.value intrinsics using
+; insertDebugValuesForPHIs() which effectively cause assignments to be
+; re-ordered.
+; See PR48206 for more information.
+
+define dso_local i32 @_Z5lcssab(i1 zeroext %S2) {
+entry:
+  br label %loop.interior
+
+loop.interior:; preds = %post.if, %entry
+  br i1 %S2, label %if.true, label %if.false
+
+if.true:  ; preds = %loop.interior
+  %X1 = add i32 0, 0
+  br label %post.if
+
+if.false: ; preds = %loop.interior
+  %X2 = add i32 0, 1
+  br label %post.if
+
+post.if:  ; preds = %if.false, %if.true
+  %X3 = phi i32 [ %X1, %if.true ], [ %X2, %if.false ], !dbg !21
+  call void @llvm.dbg.value(metadata i32 %X3, metadata !9, metadata 
!DIExpression()), !dbg !21
+  %Y1 = add i32 4, %X3, !dbg !22
+  call void @llvm.dbg.value(metadata i32 %Y1, metadata !9, metadata 
!DIExpression()), !dbg !22
+  br i1 %S2, label %loop.exit, label %loop.interior, !dbg !23
+
+loop.exit:; preds = %post.if
+; CHECK: loop.exit:
+; CHECK-NEXT: %X3.lcssa = phi i32
+; CHECK-NOT: call void @llvm.dbg.value
+  %X4 = add i32 3, %X3
+  ret i32 %X4
+}
+
+declare void @llvm.dbg.value(metadata, metadata, metadata)
+
+!llvm.dbg.cu = !{!0}
+!llvm.debugify = !{!3, !4}
+!llvm.module.flags = !{!5}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: 
"debugify and Author", isOptimized: true, runtimeVersion: 0, emissionKind: 
FullDebug, enums: !2)
+!1 = !DIFile(filename: "./testcase.ll", directory: "/")
+!2 = !{}
+!3 = !{i32 11}
+!4 = !{i32 5}
+!5 = !{i32 2, !"Debug Info Version", i32 3}
+!6 = distinct !DISubprogram(name: "_Z5lcssab", linkageName: "_Z5lcssab", 
scope: null, file: !1, line: 1, type: !7, scopeLine: 1, spFlags: 
DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !{!9})
+!7 = !DISubroutineType(types: !2)
+!9 = !DILocalVariable(name: "var", scope: !6, file: !1, line: 3, type: !10)
+!10 = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned)
+!21 = !DILocation(line: 7, column: 1, scope: !6)
+!22 = !DILocation(line: 8, column: 1, scope: !6)
+!23 = !DILocation(line: 9, column: 1, scope: !6)
+

diff  --git a/llvm/test/Transforms/LCSSA/basictest.ll 
b/llvm/test/Transforms/LCSSA/basictest.ll
index 7ca552039b63..30d5e762eedf 100644
--- a/llvm/test/Transforms/LCSSA/basictest.ll
+++ b/

[llvm-branch-commits] [llvm] 71699a9 - [flang][openacc] Enforce restriction on routine directive and clauses

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T11:33:34-05:00
New Revision: 71699a998d4f648396a1a12820c0f04cc61f8e19

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

LOG: [flang][openacc] Enforce restriction on routine directive and clauses

This patch add some checks for the restriction on the routine directive
and fix several issue at the same time.

Validity tests have been added in a separate file than acc-clause-validity.f90 
since this one
became quite large. I plan to split the larger file once on-going review are 
done.

Reviewed By: sameeranjoshi

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

Added: 
flang/test/Semantics/acc-routine-validity.f90

Modified: 
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/openacc-parsers.cpp
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/test/Semantics/acc-clause-validity.f90
llvm/include/llvm/Frontend/OpenACC/ACC.td

Removed: 




diff  --git a/flang/include/flang/Parser/dump-parse-tree.h 
b/flang/include/flang/Parser/dump-parse-tree.h
index 8a7d1d1302b2..92f7113b316a 100644
--- a/flang/include/flang/Parser/dump-parse-tree.h
+++ b/flang/include/flang/Parser/dump-parse-tree.h
@@ -66,6 +66,7 @@ class ParseTreeDumper {
   NODE(parser, AccClause)
 #define GEN_FLANG_DUMP_PARSE_TREE_CLAUSES
 #include "llvm/Frontend/OpenACC/ACC.cpp.inc"
+  NODE(parser, AccBindClause)
   NODE(parser, AccDefaultClause)
   NODE_ENUM(parser::AccDefaultClause, Arg)
   NODE(parser, AccClauseList)

diff  --git a/flang/include/flang/Parser/parse-tree.h 
b/flang/include/flang/Parser/parse-tree.h
index a2beac4737f6..6bf4d8568bde 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3852,6 +3852,12 @@ struct AccDeclarativeDirective {
 };
 
 // OpenACC Clauses
+struct AccBindClause {
+  UNION_CLASS_BOILERPLATE(AccBindClause);
+  std::variant u;
+  CharBlock source;
+};
+
 struct AccDefaultClause {
   ENUM_CLASS(Arg, None, Present)
   WRAPPER_CLASS_BOILERPLATE(AccDefaultClause, Arg);
@@ -4048,7 +4054,8 @@ struct OpenACCCombinedConstruct {
 struct OpenACCDeclarativeConstruct {
   UNION_CLASS_BOILERPLATE(OpenACCDeclarativeConstruct);
   CharBlock source;
-  std::variant u;
+  std::variant
+  u;
 };
 
 // OpenACC directives enclosing do loop
@@ -4068,8 +4075,8 @@ struct OpenACCStandaloneConstruct {
 struct OpenACCConstruct {
   UNION_CLASS_BOILERPLATE(OpenACCConstruct);
   std::variant
+  OpenACCLoopConstruct, OpenACCStandaloneConstruct, OpenACCCacheConstruct,
+  OpenACCWaitConstruct, OpenACCAtomicConstruct>
   u;
 };
 

diff  --git a/flang/lib/Parser/openacc-parsers.cpp 
b/flang/lib/Parser/openacc-parsers.cpp
index b4d2b285cd6c..2447ed70b1a1 100644
--- a/flang/lib/Parser/openacc-parsers.cpp
+++ b/flang/lib/Parser/openacc-parsers.cpp
@@ -28,8 +28,8 @@ TYPE_PARSER("AUTO" >> 
construct(construct()) ||
maybe(parenthesized(scalarIntExpr ||
 "ATTACH" >> construct(construct(
 parenthesized(Parser{}))) ||
-"BIND" >>
-construct(construct(parenthesized(name))) 
||
+"BIND" >> construct(
+  construct(Parser{})) ||
 "CAPTURE" >> construct(construct()) ||
 "COLLAPSE" >> construct(construct(
   parenthesized(scalarIntConstantExpr))) ||
@@ -166,6 +166,10 @@ TYPE_PARSER(sourced(construct(
 ".EQV." >> pure(AccReductionOperator::Operator::Eqv),
 ".NEQV." >> pure(AccReductionOperator::Operator::Neqv)
 
+// 2.15.1 Bind clause
+TYPE_PARSER(sourced(construct(parenthesized(name))) ||
+sourced(construct(parenthesized(scalarDefaultCharExpr
+
 // 2.5.14 Default clause
 TYPE_PARSER(construct(
 parenthesized(first("NONE" >> pure(AccDefaultClause::Arg::None),
@@ -287,8 +291,10 @@ 
TYPE_PARSER(construct(
 sourced(Parser{}), Parser{}))
 
 TYPE_PARSER(
-startAccLine >> sourced(construct(
-Parser{})))
+startAccLine >> first(sourced(construct(
+  
Parser{})),
+sourced(construct(
+Parser{}
 
 // OpenACC constructs
 TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
@@ -297,7 +303,6 @@ TYPE_CONTEXT_PARSER("OpenACC construct"_en_US,
 construct(Parser{}),
 construct(Parser{}),
 construct(Parser{}),
-construct(Parser{}),
 construct(Parser{}),
 construct(Parser{}),
 construct(Parser{})))

diff  --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index bd1c1a2c71eb..0f0c6f285f61 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser

[llvm-branch-commits] [clang] f500662 - Detect section type conflicts between functions and variables

2020-12-17 Thread Aaron Ballman via llvm-branch-commits

Author: Tomas Matheson
Date: 2020-12-17T11:43:47-05:00
New Revision: f50066292477fb26806336e5604615d0eddde399

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

LOG: Detect section type conflicts between functions and variables

If two variables are declared with __attribute__((section(name))) and
the implicit section types (e.g. read only vs writeable) conflict, an
error is raised. Extend this mechanism so that an error is raised if the
section type implied by a function's __attribute__((section)) conflicts
with that of another variable.

Added: 


Modified: 
clang/include/clang/AST/ASTContext.h
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaAttr.cpp
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/CodeGen/attributes.c
clang/test/Sema/attr-section.c
clang/test/SemaCXX/attr-section.cpp
clang/test/SemaObjC/method-attributes.m

Removed: 




diff  --git a/clang/include/clang/AST/ASTContext.h 
b/clang/include/clang/AST/ASTContext.h
index ff84eb52e96e..0c5d82b3e9aa 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -3086,13 +3086,12 @@ OPT_LIST(V)
   };
 
   struct SectionInfo {
-DeclaratorDecl *Decl;
+NamedDecl *Decl;
 SourceLocation PragmaSectionLocation;
 int SectionFlags;
 
 SectionInfo() = default;
-SectionInfo(DeclaratorDecl *Decl,
-SourceLocation PragmaSectionLocation,
+SectionInfo(NamedDecl *Decl, SourceLocation PragmaSectionLocation,
 int SectionFlags)
 : Decl(Decl), PragmaSectionLocation(PragmaSectionLocation),
   SectionFlags(SectionFlags) {}

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index ff0257634d9d..6b81494e8eff 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -9757,9 +9757,8 @@ class Sema final {
 PSK_CodeSeg,
   };
 
-  bool UnifySection(StringRef SectionName,
-int SectionFlags,
-DeclaratorDecl *TheDecl);
+  bool UnifySection(StringRef SectionName, int SectionFlags,
+NamedDecl *TheDecl);
   bool UnifySection(StringRef SectionName,
 int SectionFlags,
 SourceLocation PragmaSectionLocation);

diff  --git a/clang/lib/Sema/SemaAttr.cpp b/clang/lib/Sema/SemaAttr.cpp
index ae6c3ea7313e..5901bd66b7a6 100644
--- a/clang/lib/Sema/SemaAttr.cpp
+++ b/clang/lib/Sema/SemaAttr.cpp
@@ -481,9 +481,8 @@ void Sema::ActOnPragmaMSVtorDisp(PragmaMsStackAction Action,
   VtorDispStack.Act(PragmaLoc, Action, StringRef(), Mode);
 }
 
-bool Sema::UnifySection(StringRef SectionName,
-int SectionFlags,
-DeclaratorDecl *Decl) {
+bool Sema::UnifySection(StringRef SectionName, int SectionFlags,
+NamedDecl *Decl) {
   SourceLocation PragmaLocation;
   if (auto A = Decl->getAttr())
 if (A->isImplicit())

diff  --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 954388dda82e..7750d713f927 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3081,8 +3081,14 @@ static void handleSectionAttr(Sema &S, Decl *D, const 
ParsedAttr &AL) {
   }
 
   SectionAttr *NewAttr = S.mergeSectionAttr(D, AL, Str);
-  if (NewAttr)
+  if (NewAttr) {
 D->addAttr(NewAttr);
+if (isa(D))
+  S.UnifySection(NewAttr->getName(),
+ ASTContext::PSF_Execute | ASTContext::PSF_Read,
+ cast(D));
+  }
 }
 
 // This is used for `__declspec(code_seg("segname"))` on a decl.

diff  --git a/clang/test/CodeGen/attributes.c b/clang/test/CodeGen/attributes.c
index f6323e9be548..0c1455d3c612 100644
--- a/clang/test/CodeGen/attributes.c
+++ b/clang/test/CodeGen/attributes.c
@@ -63,11 +63,11 @@ void t72() { t71(); }
 // CHECK: call void @t71() [[COLDSITE:#[0-9]+]]
 // CHECK: declare void @t71() [[COLDDECL:#[0-9]+]]
 
-// CHECK: define void @t10() [[NUW]] section "SECT" {
-void t10(void) __attribute__((section("SECT")));
+// CHECK: define void @t10() [[NUW]] section "xSECT" {
+void t10(void) __attribute__((section("xSECT")));
 void t10(void) {}
-// CHECK: define void @t11() [[NUW]] section "SECT" {
-void __attribute__((section("SECT"))) t11(void) {}
+// CHECK: define void @t11() [[NUW]] section "xSECT" {
+void __attribute__((section("xSECT"))) t11(void) {}
 
 // CHECK: define i32 @t19() [[NUW]] {
 extern int t19(void) __attribute__((weak_import));

diff  --git a/clang/test/Sema/attr-section.c b/clang/test/Sema/attr-section.c
index bc4247411130..509c9752d8c3 100644
--- a/clang/test/Sema/attr-section.c
+++ b/clang/test/Sema/attr-section.c
@@ -26,9 +26,27 @@ extern int a __attribute__((section("foo,zed"))); // 
expected-warning {{section
 
 //

[llvm-branch-commits] [lldb] 122a4eb - Revert "[lldb] Make CommandInterpreter's execution context the same as debugger's one."

2020-12-17 Thread Pavel Labath via llvm-branch-commits

Author: Pavel Labath
Date: 2020-12-17T17:47:53+01:00
New Revision: 122a4ebde3f4394a84e9f93b9c7085f088be6dd7

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

LOG: Revert "[lldb] Make CommandInterpreter's execution context the same as 
debugger's one."

This reverts commit a01b26fb51c710a3a8ef88cc83b0701461f5b9ab, because it
breaks the "finish" command in some way -- the command does not
terminate after it steps out, but continues running the target. The
exact blast radius is not clear, but it at least affects the usage of
the "finish" command in TestGuiBasicDebug.py. The error is *not*
gui-related, as the same issue can be reproduced by running the same
steps outside of the gui.

There is some kind of a race going on, as the test fails only 20% of the
time on the buildbot.

Added: 


Modified: 
lldb/include/lldb/Interpreter/CommandInterpreter.h
lldb/source/API/SBCommandInterpreter.cpp
lldb/source/Breakpoint/BreakpointOptions.cpp
lldb/source/Commands/CommandObjectCommands.cpp
lldb/source/Commands/CommandObjectExpression.cpp
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectRegexCommand.cpp
lldb/source/Commands/CommandObjectSettings.cpp
lldb/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/source/Target/Target.cpp
lldb/test/API/python_api/debugger/TestDebuggerAPI.py

Removed: 
lldb/test/API/python_api/debugger/Makefile
lldb/test/API/python_api/debugger/main.cpp



diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h 
b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 40b649411f7f..d35f7e22b9ea 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -24,9 +24,7 @@
 #include "lldb/Utility/StringList.h"
 #include "lldb/lldb-forward.h"
 #include "lldb/lldb-private.h"
-
 #include 
-#include 
 
 namespace lldb_private {
 class CommandInterpreter;
@@ -247,7 +245,7 @@ class CommandInterpreter : public Broadcaster,
 
   CommandInterpreter(Debugger &debugger, bool synchronous_execution);
 
-  ~CommandInterpreter() override = default;
+  ~CommandInterpreter() override;
 
   // These two functions fill out the Broadcaster interface:
 
@@ -302,11 +300,10 @@ class CommandInterpreter : public Broadcaster,
   CommandReturnObject &result);
 
   bool HandleCommand(const char *command_line, LazyBool add_to_history,
- const ExecutionContext &override_context,
- CommandReturnObject &result);
-
-  bool HandleCommand(const char *command_line, LazyBool add_to_history,
- CommandReturnObject &result);
+ CommandReturnObject &result,
+ ExecutionContext *override_context = nullptr,
+ bool repeat_on_empty_command = true,
+ bool no_context_switching = false);
 
   bool WasInterrupted() const;
 
@@ -315,7 +312,9 @@ class CommandInterpreter : public Broadcaster,
   /// \param[in] commands
   ///The list of commands to execute.
   /// \param[in,out] context
-  ///The execution context in which to run the commands.
+  ///The execution context in which to run the commands. Can be nullptr in
+  ///which case the default
+  ///context will be used.
   /// \param[in] options
   ///This object holds the options used to control when to stop, whether to
   ///execute commands,
@@ -325,13 +324,8 @@ class CommandInterpreter : public Broadcaster,
   ///safely,
   ///and failed with some explanation if we aborted executing the commands
   ///at some point.
-  void HandleCommands(const StringList &commands,
-  const ExecutionContext &context,
-  const CommandInterpreterRunOptions &options,
-  CommandReturnObject &result);
-
-  void HandleCommands(const StringList &commands,
-  const CommandInterpreterRunOptions &options,
+  void HandleCommands(const StringList &commands, ExecutionContext *context,
+  CommandInterpreterRunOptions &options,
   CommandReturnObject &result);
 
   /// Execute a list of commands from a file.
@@ -339,7 +333,9 @@ class CommandInterpreter : public Broadcaster,
   /// \param[in] file
   ///The file from which to read in commands.
   /// \param[in,out] context
-  ///The execution context in which to run the commands.
+  ///The execution context in which to run the commands. Can be nullptr in
+  ///which case the default
+  ///context will be used.
   /// \param[in] options
   ///This object hold

[llvm-branch-commits] [libc] bf03eba - [libc] Refactor WrapperGen to make the flow cleaner.

2020-12-17 Thread Siva Chandra Reddy via llvm-branch-commits

Author: Siva Chandra Reddy
Date: 2020-12-17T08:56:45-08:00
New Revision: bf03eba1f99b8408e6f8961256ffb3409df7f995

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

LOG: [libc] Refactor WrapperGen to make the flow cleaner.

Reviewed By: michaelrj

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

Added: 


Modified: 
libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
libc/utils/tools/WrapperGen/Main.cpp

Removed: 




diff  --git a/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp 
b/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
index 4cb7a31de942..923b318288ea 100644
--- a/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
+++ b/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
@@ -72,8 +72,12 @@ TEST_F(WrapperGenTest, RunWrapperGenAndGetNoErrors) {
   llvm::None, llvm::StringRef(STDOutFile.get().TmpName),
   llvm::StringRef(STDErrFile.get().TmpName)};
 
-  llvm::StringRef ArgV[] = {ProgPath, llvm::StringRef(IncludeArg),
-llvm::StringRef(APIArg), "--name", "strlen"};
+  llvm::StringRef ArgV[] = {ProgPath,
+llvm::StringRef(IncludeArg),
+llvm::StringRef(APIArg),
+"--gen-wrapper",
+"--name",
+"strlen"};
 
   int ExitCode =
   llvm::sys::ExecuteAndWait(ProgPath, ArgV, llvm::None, Redirects);
@@ -90,8 +94,12 @@ TEST_F(WrapperGenTest, RunWrapperGenOnStrlen) {
   llvm::None, llvm::StringRef(STDOutFile.get().TmpName),
   llvm::StringRef(STDErrFile.get().TmpName)};
 
-  llvm::StringRef ArgV[] = {ProgPath, llvm::StringRef(IncludeArg),
-llvm::StringRef(APIArg), "--name", "strlen"};
+  llvm::StringRef ArgV[] = {ProgPath,
+llvm::StringRef(IncludeArg),
+llvm::StringRef(APIArg),
+"--gen-wrapper",
+"--name",
+"strlen"};
 
   int ExitCode =
   llvm::sys::ExecuteAndWait(ProgPath, ArgV, llvm::None, Redirects);
@@ -116,7 +124,7 @@ TEST_F(WrapperGenTest, RunWrapperGenOnStrlen) {
   // would break this test.
 }
 
-TEST_F(WrapperGenTest, RunWrapperGenOnStrlenWithAliasee) {
+TEST_F(WrapperGenTest, GenAliasForStrlen) {
   llvm::Optional Redirects[] = {
   llvm::None, llvm::StringRef(STDOutFile.get().TmpName),
   llvm::StringRef(STDErrFile.get().TmpName)};
@@ -124,8 +132,9 @@ TEST_F(WrapperGenTest, RunWrapperGenOnStrlenWithAliasee) {
   llvm::StringRef ArgV[] = {ProgPath,
 llvm::StringRef(IncludeArg),
 llvm::StringRef(APIArg),
-"--aliasee",
-"STRLEN_ALIAS",
+"--gen-alias",
+"--mangled-name",
+"__llvm_libc_strlen_mangled_name",
 "--name",
 "strlen"};
 
@@ -142,35 +151,38 @@ TEST_F(WrapperGenTest, RunWrapperGenOnStrlenWithAliasee) {
   auto STDOutOrError = llvm::MemoryBuffer::getFile(STDOutFile.get().TmpName);
   std::string STDOutOutput = STDOutOrError.get()->getBuffer().str();
 
-  ASSERT_EQ(STDOutOutput, "extern \"C\" size_t strlen(const char * __arg0) "
-  "__attribute__((alias(\"STRLEN_ALIAS\")));\n");
+  ASSERT_EQ(STDOutOutput,
+"extern \"C\" size_t strlen(const char * __arg0) "
+"__attribute__((alias(\"__llvm_libc_strlen_mangled_name\")));\n");
   // TODO:(michaelrj) Figure out how to make this output comparison
   // less brittle. Currently it's just comparing the output of the program
   // to an exact string, this means that even a small formatting change
   // would break this test.
 }
 
-TEST_F(WrapperGenTest, DeclStrlenAliasUsingAliaseeFile) {
+TEST_F(WrapperGenTest, DeclStrlenAliasUsingMangledNameFile) {
   llvm::Optional Redirects[] = {
   llvm::None, llvm::StringRef(STDOutFile.get().TmpName),
   llvm::StringRef(STDErrFile.get().TmpName)};
 
-  const char *AliaseeFileContent = "abc\nxyz__llvm_libcSTRLEN_ALIAS\nijk\n";
-  llvm::SmallVector AliaseeFilePath;
-  auto AliaseeFileCreateError = llvm::sys::fs::createUniqueFile(
-  "libc-wrappergen-test-aliasee-file-%%-%%-%%-%%.txt", AliaseeFilePath);
-  ASSERT_FALSE(AliaseeFileCreateError);
-  auto AliaseeFileWriteError = llvm::writeFileAtomically(
+  const char *MangledNameFileContent =
+  "abc\nxyz__llvm_libc_strlen_mangled_name\nijk\n";
+  llvm::SmallVector MangledNameFilePath;
+  auto MangledNameFileCreateError = llvm::sys::fs::createUniqueFile(
+  "libc-wrappergen-test-aliasee-file-%%-%%-%%-%%.txt", 
MangledNameFilePath);
+  ASSERT_FALSE(Mang

[llvm-branch-commits] [libc] 17b3ff5 - [libc] Add python3 to libc buildbot depedencies.

2020-12-17 Thread Paula Toth via llvm-branch-commits

Author: Paula Toth
Date: 2020-12-17T08:59:13-08:00
New Revision: 17b3ff511c0a034d93c969bccd699dedc5a29e96

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

LOG: [libc] Add python3 to libc buildbot depedencies.

Reviewed By: sivachandra

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

Added: 


Modified: 
libc/utils/buildbot/Dockerfile

Removed: 




diff  --git a/libc/utils/buildbot/Dockerfile b/libc/utils/buildbot/Dockerfile
index 3140c5a44481..8c497be6db0c 100644
--- a/libc/utils/buildbot/Dockerfile
+++ b/libc/utils/buildbot/Dockerfile
@@ -2,10 +2,9 @@ FROM debian:10
 
 # Installing dependencies.
 RUN dpkg --add-architecture i386
-RUN apt-get update
-RUN apt-get install -y build-essential clang subversion git vim \
-  zip libstdc++6:i386 file binutils-dev binutils-gold cmake python-pip \
-  ninja-build
+RUN apt-get update && apt-get install -y build-essential clang subversion git \
+  vim zip libstdc++6:i386 file binutils-dev binutils-gold cmake python-pip \
+  ninja-build python3
 RUN python -m pip install buildbot-worker==2.8.4
 
 # Temporary dependencies for AOR tests.



___
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] 835f8de - [lldb] [Process/FreeBSDRemote] Use RegSetKind consistently [NFC]

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T18:01:46+01:00
New Revision: 835f8de8508953f4624534e36d54cd256e8800c9

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

LOG: [lldb] [Process/FreeBSDRemote] Use RegSetKind consistently [NFC]

Use RegSetKind enum for register sets everything, rather than int.
Always spell it as 'RegSetKind', without unnecessary 'enum'.  Add
missing switch case.  While at it, use uint32_t for regnums
consistently.

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

Added: 


Modified: 

lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp

lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
index 740ac522d303..b3b4a6cb0578 100644
--- 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
+++ 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
@@ -303,8 +303,9 @@ 
NativeRegisterContextFreeBSD_x86_64::GetRegisterSet(uint32_t set_index) const {
   }
 }
 
-llvm::Optional
-NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(int reg_num) const {
+llvm::Optional
+NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(
+uint32_t reg_num) const {
   switch (GetRegisterInfoInterface().GetTargetArchitecture().GetMachine()) {
   case llvm::Triple::x86:
 if (reg_num >= k_first_gpr_i386 && reg_num <= k_last_gpr_i386)
@@ -341,7 +342,7 @@ 
NativeRegisterContextFreeBSD_x86_64::GetSetForNativeRegNum(int reg_num) const {
   llvm_unreachable("Register does not belong to any register set");
 }
 
-Status NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet(uint32_t set) {
+Status NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet(RegSetKind set) {
   switch (set) {
   case GPRegSet:
 return NativeProcessFreeBSD::PtraceWrapper(PT_GETREGS, m_thread.GetID(),
@@ -382,7 +383,7 @@ Status 
NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet(uint32_t set) {
   llvm_unreachable("NativeRegisterContextFreeBSD_x86_64::ReadRegisterSet");
 }
 
-Status NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet(uint32_t set) {
+Status NativeRegisterContextFreeBSD_x86_64::WriteRegisterSet(RegSetKind set) {
   switch (set) {
   case GPRegSet:
 return NativeProcessFreeBSD::PtraceWrapper(PT_SETREGS, m_thread.GetID(),
@@ -428,7 +429,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const 
RegisterInfo *reg_info,
 return error;
   }
 
-  llvm::Optional opt_set = GetSetForNativeRegNum(reg);
+  llvm::Optional opt_set = GetSetForNativeRegNum(reg);
   if (!opt_set) {
 // This is likely an internal register for lldb use only and should not be
 // directly queried.
@@ -437,7 +438,7 @@ NativeRegisterContextFreeBSD_x86_64::ReadRegister(const 
RegisterInfo *reg_info,
 return error;
   }
 
-  enum RegSetKind set = opt_set.getValue();
+  RegSetKind set = opt_set.getValue();
   error = ReadRegisterSet(set);
   if (error.Fail())
 return error;
@@ -494,7 +495,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
 return error;
   }
 
-  llvm::Optional opt_set = GetSetForNativeRegNum(reg);
+  llvm::Optional opt_set = GetSetForNativeRegNum(reg);
   if (!opt_set) {
 // This is likely an internal register for lldb use only and should not be
 // directly queried.
@@ -503,7 +504,7 @@ Status NativeRegisterContextFreeBSD_x86_64::WriteRegister(
 return error;
   }
 
-  enum RegSetKind set = opt_set.getValue();
+  RegSetKind set = opt_set.getValue();
   error = ReadRegisterSet(set);
   if (error.Fail())
 return error;
@@ -610,7 +611,7 @@ llvm::Error 
NativeRegisterContextFreeBSD_x86_64::CopyHardwareWatchpointsFrom(
 }
 
 uint8_t *
-NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(uint32_t set,
+NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(RegSetKind set,
  size_t reg_offset) {
   uint8_t *base;
   switch (set) {
@@ -625,6 +626,8 @@ 
NativeRegisterContextFreeBSD_x86_64::GetOffsetRegSetData(uint32_t set,
 break;
   case YMMRegSet:
 llvm_unreachable("GetRegSetData() is unsuitable for this regset.");
+  case MPXRegSet:
+llvm_unreachable("MPX regset should have returned error");
   }
   assert(reg_offset >= m_regset_offsets[set]);
   return base + (reg_offset - m_regset_offsets[set]);

diff  --git 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.h
index b70fa962707d..673cffd6e849 100644
--- 
a/lldb/source/Plugins/Process/FreeBSDRemo

[llvm-branch-commits] [lldb] 9ead4e7 - [lldb] [Process/FreeBSDRemote] Replace GetRegisterSetCount()

2020-12-17 Thread Michał Górny via llvm-branch-commits

Author: Michał Górny
Date: 2020-12-17T18:01:14+01:00
New Revision: 9ead4e7b4a68d162122d861f5d5b6a3baf8d23c1

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

LOG: [lldb] [Process/FreeBSDRemote] Replace GetRegisterSetCount()

Replace the wrong code in GetRegisterSetCount() with a constant return.
The original code passed register index in place of register set index,
effectively getting always true.  Correcting the code to check for
register set existence is not possible as LLDB supports only eliminating
last register sets.  Just return the full number for now which should
be NFC.

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

Added: 


Modified: 

lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
index 8f1ba2eb4137..740ac522d303 100644
--- 
a/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
+++ 
b/lldb/source/Plugins/Process/FreeBSDRemote/NativeRegisterContextFreeBSD_x86_64.cpp
@@ -288,13 +288,7 @@ 
NativeRegisterContextFreeBSD_x86_64::NativeRegisterContextFreeBSD_x86_64(
 }
 
 uint32_t NativeRegisterContextFreeBSD_x86_64::GetRegisterSetCount() const {
-  uint32_t sets = 0;
-  for (uint32_t set_index = 0; set_index < k_num_register_sets; ++set_index) {
-if (GetSetForNativeRegNum(set_index))
-  ++sets;
-  }
-
-  return sets;
+  return k_num_register_sets;
 }
 
 const RegisterSet *



___
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] [libc] e1a5b23 - [libc][Obvious] Fix typo is wrappergen unittest.

2020-12-17 Thread Siva Chandra Reddy via llvm-branch-commits

Author: Siva Chandra Reddy
Date: 2020-12-17T09:13:23-08:00
New Revision: e1a5b234ef94adb87fdf01371a672053c0d814a7

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

LOG: [libc][Obvious] Fix typo is wrappergen unittest.

Added: 


Modified: 
libc/test/utils/tools/WrapperGen/wrappergen_test.cpp

Removed: 




diff  --git a/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp 
b/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
index 923b318288ea..c4f64a095fc3 100644
--- a/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
+++ b/libc/test/utils/tools/WrapperGen/wrappergen_test.cpp
@@ -238,7 +238,7 @@ TEST_F(WrapperGenTest, 
RunWrapperGenOnStrlenWithMangledNameAndMangledNameFile) {
 
   ASSERT_EQ(STDErrOutput,
 "error: The options 'mangled-name' and 'mangled-name-file' "
-"cannot be specified simultaniously.\n");
+"cannot be specified simultaneously.\n");
 
   auto STDOutOrError = llvm::MemoryBuffer::getFile(STDOutFile.get().TmpName);
   std::string STDOutOutput = STDOutOrError.get()->getBuffer().str();



___
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] 7807411 - [LangRef] Update new ssp/sspstrong/sspreq semantics after D91816

2020-12-17 Thread Fangrui Song via llvm-branch-commits

Author: Fangrui Song
Date: 2020-12-17T09:16:37-08:00
New Revision: 780741107e6f2009dcc22a18b8976bf2f2efbeba

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

LOG: [LangRef] Update new ssp/sspstrong/sspreq semantics after D91816

Reviewed By: nickdesaulniers

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

Added: 


Modified: 
llvm/docs/LangRef.rst

Removed: 




diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index cde9ed519626..9ba6a21d08c2 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -1840,13 +1840,20 @@ example:
 Variables that are identified as requiring a protector will be arranged
 on the stack such that they are adjacent to the stack protector guard.
 
-If a function that has an ``ssp`` attribute is inlined into a
-function that doesn't have an ``ssp`` attribute, then the resulting
-function will have an ``ssp`` attribute.
-``sspreq``
-This attribute indicates that the function should *always* emit a
-stack smashing protector. This overrides the ``ssp`` function
-attribute.
+A function with the ``ssp`` attribute but without the ``alwaysinline``
+attribute cannot be inlined into a function without a
+``ssp/sspreq/sspstrong`` attribute. If inlined, the caller will get the
+``ssp`` attribute.
+``sspstrong``
+This attribute indicates that the function should emit a stack smashing
+protector. This attribute causes a strong heuristic to be used when
+determining if a function needs stack protectors. The strong heuristic
+will enable protectors for functions with:
+
+- Arrays of any size and type
+- Aggregates containing an array of any size and type.
+- Calls to alloca().
+- Local variables that have had their address taken.
 
 Variables that are identified as requiring a protector will be arranged
 on the stack such that they are adjacent to the stack protector guard.
@@ -1859,20 +1866,16 @@ example:
 #. Variables that have had their address taken are 3rd closest to the
protector.
 
-If a function that has an ``sspreq`` attribute is inlined into a
-function that doesn't have an ``sspreq`` attribute or which has an
-``ssp`` or ``sspstrong`` attribute, then the resulting function will have
-an ``sspreq`` attribute.
-``sspstrong``
-This attribute indicates that the function should emit a stack smashing
-protector. This attribute causes a strong heuristic to be used when
-determining if a function needs stack protectors. The strong heuristic
-will enable protectors for functions with:
+This overrides the ``ssp`` function attribute.
 
-- Arrays of any size and type
-- Aggregates containing an array of any size and type.
-- Calls to alloca().
-- Local variables that have had their address taken.
+A function with the ``sspstrong`` attribute but without the
+``alwaysinline`` attribute cannot be inlined into a function without a
+``ssp/sspstrong/sspreq`` attribute. If inlined, the caller will get the
+``sspstrong`` attribute unless the ``sspreq`` attribute exists.
+``sspreq``
+This attribute indicates that the function should *always* emit a stack
+smashing protector. This overrides the ``ssp`` and ``sspstrong`` function
+attributes.
 
 Variables that are identified as requiring a protector will be arranged
 on the stack such that they are adjacent to the stack protector guard.
@@ -1885,11 +1888,11 @@ example:
 #. Variables that have had their address taken are 3rd closest to the
protector.
 
-This overrides the ``ssp`` function attribute.
+A function with the ``sspreq`` attribute but without the ``alwaysinline``
+attribute cannot be inlined into a function without a
+``ssp/sspstrong/sspreq`` attribute. If inlined, the caller will get the
+``sspreq`` attribute.
 
-If a function that has an ``sspstrong`` attribute is inlined into a
-function that doesn't have an ``sspstrong`` attribute, then the
-resulting function will have an ``sspstrong`` attribute.
 ``strictfp``
 This attribute indicates that the function was called from a scope that
 requires strict floating-point semantics.  LLVM will not attempt any



___
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] c1f30e5 - [gn build] Add symbol_level to adjust debug info level

2020-12-17 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2020-12-17T09:20:53-08:00
New Revision: c1f30e581793f8db889b6fad0c3860f163f4afa2

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

LOG: [gn build] Add symbol_level to adjust debug info level

is_debug by default makes symbol_level = 2 and !is_debug means by
default symbol_level = 0.

Reviewed By: thakis

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

Added: 


Modified: 
llvm/utils/gn/build/BUILD.gn
llvm/utils/gn/build/buildflags.gni

Removed: 




diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index a8f4f073de39..49caf447d019 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -72,9 +72,13 @@ config("compiler_defaults") {
 ldflags += [ "-mmacosx-version-min=10.10" ]
   }
 
+  assert(symbol_level == 0 || symbol_level == 1 || symbol_level == 2,
+ "Unexpected symbol_level")
   if (host_os != "win") {
-if (is_debug) {
+if (symbol_level == 2) {
   cflags += [ "-g" ]
+} else if (symbol_level == 1) {
+  cflags += [ "-g1" ]
 }
 if (is_optimized) {
   cflags += [ "-O3" ]
@@ -88,11 +92,14 @@ config("compiler_defaults") {
   "-fvisibility-inlines-hidden",
 ]
   } else {
-if (is_debug) {
+if (symbol_level != 0) {
   cflags += [
 "/Zi",
 "/FS",
   ]
+  if (symbol_level == 1 && is_clang) {
+cflags += [ "-gline-tables-only" ]
+  }
   ldflags += [ "/DEBUG" ]
 
   # Speed up links with ghash on windows.

diff  --git a/llvm/utils/gn/build/buildflags.gni 
b/llvm/utils/gn/build/buildflags.gni
index 9ad494a3c1e9..e6d7ca1806a9 100644
--- a/llvm/utils/gn/build/buildflags.gni
+++ b/llvm/utils/gn/build/buildflags.gni
@@ -28,4 +28,11 @@ declare_args() {
 declare_args() {
   # Whether to build with optimizations.
   is_optimized = !is_debug
+
+  # Debug info symbol level.
+  if (is_debug) {
+symbol_level = 2
+  } else {
+symbol_level = 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] dae3446 - [IRSim][IROutliner] Adding the extraction basics for the IROutliner.

2020-12-17 Thread Andrew Litteken via llvm-branch-commits

Author: Andrew Litteken
Date: 2020-12-17T11:27:26-06:00
New Revision: dae34463e3e05a055899b65251efde887a24ec38

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

LOG: [IRSim][IROutliner] Adding the extraction basics for the IROutliner.

Extracting the similar regions is the first step in the IROutliner.

Using the IRSimilarityIdentifier, we collect the SimilarityGroups and
sort them by how many instructions will be removed.  Each
IRSimilarityCandidate is used to define an OutlinableRegion.  Each
region is ordered by their occurrence in the Module and the regions that
are not compatible with previously outlined regions are discarded.

Each region is then extracted with the CodeExtractor into its own
function.

We test that correctly extract in:
test/Transforms/IROutliner/extraction.ll
test/Transforms/IROutliner/address-taken.ll
test/Transforms/IROutliner/outlining-same-globals.ll
test/Transforms/IROutliner/outlining-same-constants.ll
test/Transforms/IROutliner/outlining-different-structure.ll

Recommit of bf899e891387d07dfd12de195ce2a16f62afd5e0 fixing memory
leaks.

Reviewers: paquette, jroelofs, yroux

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

Added: 
llvm/include/llvm/Transforms/IPO/IROutliner.h
llvm/lib/Transforms/IPO/IROutliner.cpp
llvm/test/Transforms/IROutliner/extraction.ll
llvm/test/Transforms/IROutliner/outlining-address-taken.ll
llvm/test/Transforms/IROutliner/outlining-different-structure.ll
llvm/test/Transforms/IROutliner/outlining-same-constants.ll
llvm/test/Transforms/IROutliner/outlining-same-globals.ll

Modified: 
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/IPO.h
llvm/lib/Passes/PassBuilder.cpp
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/IPO/CMakeLists.txt
llvm/lib/Transforms/IPO/IPO.cpp
llvm/lib/Transforms/IPO/PassManagerBuilder.cpp

Removed: 




diff  --git a/llvm/include/llvm/InitializePasses.h 
b/llvm/include/llvm/InitializePasses.h
index e1b3a8dd3f3a..f77de64e2c64 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -184,6 +184,7 @@ void 
initializeHotColdSplittingLegacyPassPass(PassRegistry&);
 void initializeHWAddressSanitizerLegacyPassPass(PassRegistry &);
 void initializeIPSCCPLegacyPassPass(PassRegistry&);
 void initializeIRCELegacyPassPass(PassRegistry&);
+void initializeIROutlinerLegacyPassPass(PassRegistry&);
 void initializeIRSimilarityIdentifierWrapperPassPass(PassRegistry&);
 void initializeIRTranslatorPass(PassRegistry&);
 void initializeIVUsersWrapperPassPass(PassRegistry&);

diff  --git a/llvm/include/llvm/Transforms/IPO.h 
b/llvm/include/llvm/Transforms/IPO.h
index 1918ad76a270..af357181597a 100644
--- a/llvm/include/llvm/Transforms/IPO.h
+++ b/llvm/include/llvm/Transforms/IPO.h
@@ -215,6 +215,11 @@ ModulePass *createMergeFunctionsPass();
 /// function(s).
 ModulePass *createHotColdSplittingPass();
 
+//===--===//
+/// createIROutlinerPass - This pass finds similar code regions and factors
+/// those regions out into functions.
+ModulePass *createIROutlinerPass();
+
 
//===--===//
 /// createPartialInliningPass - This pass inlines parts of functions.
 ///

diff  --git a/llvm/include/llvm/Transforms/IPO/IROutliner.h 
b/llvm/include/llvm/Transforms/IPO/IROutliner.h
new file mode 100644
index ..80ba40d91ed8
--- /dev/null
+++ b/llvm/include/llvm/Transforms/IPO/IROutliner.h
@@ -0,0 +1,191 @@
+//===- IROutliner.h - Extract similar IR regions into functions 
==//
+//
+// 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
+//
+//===--===//
+//
+// \file
+// The interface file for the IROutliner which is used by the IROutliner Pass.
+//
+// The outliner uses the IRSimilarityIdentifier to identify the similar regions
+// of code.  It evaluates each set of IRSimilarityCandidates with an estimate 
of
+// whether it will provide code size reduction.  Each region is extracted using
+// the code extractor.  These extracted functions are consolidated into a 
single
+// function and called from the extracted call site.
+//
+// For example:
+// \code
+//   %1 = add i32 %a, %b
+//   %2 = add i32 %b, %a
+//   %3 = add i32 %b, %a
+//   %4 = add i32 %a, %b
+// \endcode
+// would become function
+// \code
+// define internal void outlined_ir_function(i32 %0, i32 %1) {
+//   %1 = add i32 %0, %1
+//   %2 = add i32 %1, %0
+//   ret void
+// }
+// \endcode
+// with

[llvm-branch-commits] [llvm] 23d183f - [gn build] Port dae34463e3e

2020-12-17 Thread LLVM GN Syncbot via llvm-branch-commits

Author: LLVM GN Syncbot
Date: 2020-12-17T17:28:45Z
New Revision: 23d183f190508e519fa044aa22985fe298278ae7

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

LOG: [gn build] Port dae34463e3e

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
index c088d482ad6d..e6a2a876be10 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
@@ -40,6 +40,7 @@ static_library("IPO") {
 "GlobalSplit.cpp",
 "HotColdSplitting.cpp",
 "IPO.cpp",
+"IROutliner.cpp",
 "InferFunctionAttrs.cpp",
 "InlineSimple.cpp",
 "Inliner.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] [mlir] 4a327bd - Add call site location getter to C API

2020-12-17 Thread via llvm-branch-commits

Author: George
Date: 2020-12-17T09:55:21-08:00
New Revision: 4a327bd25289efdfb1c466b119e6e55fadebfc42

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

LOG: Add call site location getter to C API

Reviewed By: ftynse

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

Added: 


Modified: 
mlir/include/mlir-c/IR.h
mlir/lib/CAPI/IR/IR.cpp
mlir/test/CAPI/ir.c

Removed: 




diff  --git a/mlir/include/mlir-c/IR.h b/mlir/include/mlir-c/IR.h
index 74c90af5b4d5..13e32be049e4 100644
--- a/mlir/include/mlir-c/IR.h
+++ b/mlir/include/mlir-c/IR.h
@@ -147,6 +147,10 @@ MLIR_CAPI_EXPORTED MlirStringRef 
mlirDialectGetNamespace(MlirDialect dialect);
 MLIR_CAPI_EXPORTED MlirLocation mlirLocationFileLineColGet(
 MlirContext context, MlirStringRef filename, unsigned line, unsigned col);
 
+/// Creates a call site location with a callee and a caller.
+MLIR_CAPI_EXPORTED MlirLocation mlirLocationCallSiteGet(MlirLocation callee,
+MlirLocation caller);
+
 /// Creates a location with unknown position owned by the given context.
 MLIR_CAPI_EXPORTED MlirLocation mlirLocationUnknownGet(MlirContext context);
 

diff  --git a/mlir/lib/CAPI/IR/IR.cpp b/mlir/lib/CAPI/IR/IR.cpp
index c5a78a2235fc..4de39490cea0 100644
--- a/mlir/lib/CAPI/IR/IR.cpp
+++ b/mlir/lib/CAPI/IR/IR.cpp
@@ -116,6 +116,10 @@ MlirLocation mlirLocationFileLineColGet(MlirContext 
context,
   FileLineColLoc::get(unwrap(filename), line, col, unwrap(context)));
 }
 
+MlirLocation mlirLocationCallSiteGet(MlirLocation callee, MlirLocation caller) 
{
+  return wrap(CallSiteLoc::get(unwrap(callee), unwrap(caller)));
+}
+
 MlirLocation mlirLocationUnknownGet(MlirContext context) {
   return wrap(UnknownLoc::get(unwrap(context)));
 }

diff  --git a/mlir/test/CAPI/ir.c b/mlir/test/CAPI/ir.c
index a785d6ab4899..434f272de059 100644
--- a/mlir/test/CAPI/ir.c
+++ b/mlir/test/CAPI/ir.c
@@ -1295,7 +1295,7 @@ MlirLogicalResult errorHandler(MlirDiagnostic diagnostic, 
void *userData) {
   MlirLocation loc = mlirDiagnosticGetLocation(diagnostic);
   mlirLocationPrint(loc, printToStderr, NULL);
   assert(mlirDiagnosticGetNumNotes(diagnostic) == 0);
-  fprintf(stderr, ">> end of diagnostic (userData: %ld)\n", (long)userData);
+  fprintf(stderr, "\n>> end of diagnostic (userData: %ld)\n", (long)userData);
   return mlirLogicalResultSuccess();
 }
 
@@ -1308,16 +1308,32 @@ void testDiagnostics() {
   MlirContext ctx = mlirContextCreate();
   MlirDiagnosticHandlerID id = mlirContextAttachDiagnosticHandler(
   ctx, errorHandler, (void *)42, deleteUserData);
-  MlirLocation loc = mlirLocationUnknownGet(ctx);
   fprintf(stderr, "@test_diagnostics\n");
-  mlirEmitError(loc, "test diagnostics");
+  MlirLocation unknownLoc = mlirLocationUnknownGet(ctx);
+  mlirEmitError(unknownLoc, "test diagnostics");
+  MlirLocation fileLineColLoc = mlirLocationFileLineColGet(
+  ctx, mlirStringRefCreateFromCString("file.c"), 1, 2);
+  mlirEmitError(fileLineColLoc, "test diagnostics");
+  MlirLocation callSiteLoc = mlirLocationCallSiteGet(
+  mlirLocationFileLineColGet(
+  ctx, mlirStringRefCreateFromCString("other-file.c"), 2, 3),
+  fileLineColLoc);
+  mlirEmitError(callSiteLoc, "test diagnostics");
   mlirContextDetachDiagnosticHandler(ctx, id);
-  mlirEmitError(loc, "more test diagnostics");
+  mlirEmitError(unknownLoc, "more test diagnostics");
   // CHECK-LABEL: @test_diagnostics
   // CHECK: processing diagnostic (userData: 42) <<
   // CHECK:   test diagnostics
   // CHECK:   loc(unknown)
   // CHECK: >> end of diagnostic (userData: 42)
+  // CHECK: processing diagnostic (userData: 42) <<
+  // CHECK:   test diagnostics
+  // CHECK:   loc("file.c":1:2)
+  // CHECK: >> end of diagnostic (userData: 42)
+  // CHECK: processing diagnostic (userData: 42) <<
+  // CHECK:   test diagnostics
+  // CHECK:   loc(callsite("other-file.c":2:3 at "file.c":1:2))
+  // CHECK: >> end of diagnostic (userData: 42)
   // CHECK: deleting user data (userData: 42)
   // CHECK-NOT: processing diagnostic
   // CHECK: more test diagnostics



___
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] [compiler-rt] 1dbf2c9 - [scudo][standalone] Allow the release of smaller sizes

2020-12-17 Thread Kostya Kortchinsky via llvm-branch-commits

Author: Kostya Kortchinsky
Date: 2020-12-17T10:01:57-08:00
New Revision: 1dbf2c96bce93e0a954806d9bdcafcb702a06672

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

LOG: [scudo][standalone] Allow the release of smaller sizes

Initially we were avoiding the release of smaller size classes due to
the fact that it was an expensive operation, particularly on 32-bit
platforms. With a lot of batches, and given that there are a lot of
blocks per page, this was a lengthy operation with little results.

There has been some improvements since then to the 32-bit release,
and we still have some criterias preventing us from wasting time
(eg, 9x% free blocks in the class size, etc).

Allowing to release blocks < 128 bytes helps in situations where a lot
of small chunks would not have been reclaimed if not for a forced
reclaiming.

Additionally change some `CHECK` to `DCHECK` and rearrange a bit the
code.

I didn't experience any regressions in my benchmarks.

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

Added: 


Modified: 
compiler-rt/lib/scudo/standalone/primary32.h
compiler-rt/lib/scudo/standalone/primary64.h
compiler-rt/lib/scudo/standalone/release.h

Removed: 




diff  --git a/compiler-rt/lib/scudo/standalone/primary32.h 
b/compiler-rt/lib/scudo/standalone/primary32.h
index 016a96bd2dfa..0db95d2e1f11 100644
--- a/compiler-rt/lib/scudo/standalone/primary32.h
+++ b/compiler-rt/lib/scudo/standalone/primary32.h
@@ -76,17 +76,12 @@ class SizeClassAllocator32 {
 if (UNLIKELY(!getRandom(reinterpret_cast(&Seed), sizeof(Seed
   Seed = static_cast(
   Time ^ (reinterpret_cast(SizeClassInfoArray) >> 6));
-const uptr PageSize = getPageSizeCached();
 for (uptr I = 0; I < NumClasses; I++) {
   SizeClassInfo *Sci = getSizeClassInfo(I);
   Sci->RandState = getRandomU32(&Seed);
   // Sci->MaxRegionIndex is already initialized to 0.
   Sci->MinRegionIndex = NumRegions;
-  // See comment in the 64-bit primary about releasing smaller size 
classes.
-  Sci->CanRelease = (I != SizeClassMap::BatchClassId) &&
-(getSizeByClassId(I) >= (PageSize / 32));
-  if (Sci->CanRelease)
-Sci->ReleaseInfo.LastReleaseAtNs = Time;
+  Sci->ReleaseInfo.LastReleaseAtNs = Time;
 }
 setOption(Option::ReleaseInterval, static_cast(ReleaseToOsInterval));
   }
@@ -137,7 +132,7 @@ class SizeClassAllocator32 {
 ScopedLock L(Sci->Mutex);
 Sci->FreeList.push_front(B);
 Sci->Stats.PushedBlocks += B->getCount();
-if (Sci->CanRelease)
+if (ClassId != SizeClassMap::BatchClassId)
   releaseToOSMaybe(Sci, ClassId);
   }
 
@@ -217,6 +212,8 @@ class SizeClassAllocator32 {
   uptr releaseToOS() {
 uptr TotalReleasedBytes = 0;
 for (uptr I = 0; I < NumClasses; I++) {
+  if (I == SizeClassMap::BatchClassId)
+continue;
   SizeClassInfo *Sci = getSizeClassInfo(I);
   ScopedLock L(Sci->Mutex);
   TotalReleasedBytes += releaseToOSMaybe(Sci, I, /*Force=*/true);
@@ -262,7 +259,6 @@ class SizeClassAllocator32 {
 uptr CurrentRegion;
 uptr CurrentRegionAllocated;
 SizeClassStats Stats;
-bool CanRelease;
 u32 RandState;
 uptr AllocatedUser;
 // Lowest & highest region index allocated for this size class, to avoid

diff  --git a/compiler-rt/lib/scudo/standalone/primary64.h 
b/compiler-rt/lib/scudo/standalone/primary64.h
index f6c4d8cf8bb0..f9854cbfd4d6 100644
--- a/compiler-rt/lib/scudo/standalone/primary64.h
+++ b/compiler-rt/lib/scudo/standalone/primary64.h
@@ -80,17 +80,7 @@ class SizeClassAllocator64 {
   Region->RegionBeg =
   getRegionBaseByClassId(I) + (getRandomModN(&Seed, 16) + 1) * 
PageSize;
   Region->RandState = getRandomU32(&Seed);
-  // Releasing smaller size classes doesn't necessarily yield to a
-  // meaningful RSS impact: there are more blocks per page, they are
-  // randomized around, and thus pages are less likely to be entirely 
empty.
-  // On top of this, attempting to release those require more iterations 
and
-  // memory accesses which ends up being fairly costly. The current lower
-  // limit is mostly arbitrary and based on empirical observations.
-  // TODO(kostyak): make the lower limit a runtime option
-  Region->CanRelease = (I != SizeClassMap::BatchClassId) &&
-   (getSizeByClassId(I) >= (PageSize / 32));
-  if (Region->CanRelease)
-Region->ReleaseInfo.LastReleaseAtNs = Time;
+  Region->ReleaseInfo.LastReleaseAtNs = Time;
 }
 setOption(Option::ReleaseInterval, static_cast(ReleaseToOsInterval));
 
@@ -129,7 +119,7 @@ class SizeClassAllocator64 {
 ScopedLock L(Region->Mutex);
 Region->FreeList.push_front(B);
 Region->Stat

[llvm-branch-commits] [llvm] c289297 - [PowerPC] Rename the vector pair intrinsics and builtins to replace the _mma_ prefix by _vsx_

2020-12-17 Thread Albion Fung via llvm-branch-commits

Author: Baptiste Saleil
Date: 2020-12-17T13:19:27-05:00
New Revision: c2892978e919bf66535729c70fba73c4c3224548

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

LOG: [PowerPC] Rename the vector pair intrinsics and builtins to replace the 
_mma_ prefix by _vsx_

On PPC, the vector pair instructions are independent from MMA.
This patch renames the vector pair LLVM intrinsics and Clang builtins to 
replace the _mma_ prefix by _vsx_ in their names.
We also move the vector pair type/intrinsic/builtin tests to their own files.

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

Added: 
clang/test/CodeGen/builtins-ppc-pair-mma.c
clang/test/Sema/ppc-pair-mma-types.c
clang/test/SemaCXX/ppc-pair-mma-types.cpp
llvm/test/CodeGen/PowerPC/paired-vector-intrinsics.ll

Modified: 
clang/include/clang/Basic/BuiltinsPPC.def
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/Sema/SemaChecking.cpp
llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp
llvm/test/CodeGen/PowerPC/dform-pair-load-store.ll
llvm/test/CodeGen/PowerPC/loop-p10-pair-prepare.ll
llvm/test/CodeGen/PowerPC/mma-intrinsics.ll
llvm/test/CodeGen/PowerPC/mma-outer-product.ll
llvm/test/CodeGen/PowerPC/mma-phi-accs.ll
llvm/test/CodeGen/PowerPC/more-dq-form-prepare.ll

Removed: 
clang/test/CodeGen/builtins-ppc-mma.c
clang/test/Sema/ppc-mma-types.c
clang/test/SemaCXX/ppc-mma-types.cpp
llvm/test/CodeGen/PowerPC/paired-vector-intrinsics-without-mma.ll



diff  --git a/clang/include/clang/Basic/BuiltinsPPC.def 
b/clang/include/clang/Basic/BuiltinsPPC.def
index 8975d126b897..39c66f5daeb1 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -7,8 +7,9 @@
 
//===--===//
 //
 // This file defines the PowerPC-specific builtin function database.  Users of
-// this file must define the BUILTIN macro or the MMA_BUILTIN macro to make use
-// of this information.
+// this file must define the BUILTIN macro or the CUSTOM_BUILTIN macro to
+// make use of this information. The latter is used for builtins requiring
+// custom code generation and checking.
 //
 
//===--===//
 
@@ -18,9 +19,9 @@
 // The format of this database matches clang/Basic/Builtins.def except for the
 // MMA builtins that are using their own format documented below.
 
-#if defined(BUILTIN) && !defined(MMA_BUILTIN)
-#   define MMA_BUILTIN(ID, TYPES, ACCUMULATE) BUILTIN(__builtin_mma_##ID, 
"i.", "t")
-#elif defined(MMA_BUILTIN) && !defined(BUILTIN)
+#if defined(BUILTIN) && !defined(CUSTOM_BUILTIN)
+#   define CUSTOM_BUILTIN(ID, TYPES, ACCUMULATE) BUILTIN(__builtin_##ID, "i.", 
"t")
+#elif defined(CUSTOM_BUILTIN) && !defined(BUILTIN)
 #   define BUILTIN(ID, TYPES, ATTRS)
 #endif
 
@@ -659,94 +660,94 @@ BUILTIN(__builtin_setflm, "dd", "")
 // Cache built-ins
 BUILTIN(__builtin_dcbf, "vvC*", "")
 
-// MMA built-ins
-// All MMA built-ins are declared here using the MMA_BUILTIN macro. Because
-// these built-ins rely on target-dependent types and to avoid pervasive 
change,
-// they are type checked manually in Sema using custom type descriptors.
-// The first argument of the MMA_BUILTIN macro is the name of the built-in, the
-// second argument specifies the type of the function (result value, then each
-// argument) as follows:
+// Built-ins requiring custom code generation.
+// Because these built-ins rely on target-dependent types and to avoid 
pervasive
+// change, they are type checked manually in Sema using custom type 
descriptors.
+// The first argument of the CUSTOM_BUILTIN macro is the name of the built-in
+// with its prefix, the second argument specifies the type of the function
+// (result value, then each argument) as follows:
 //  i -> Unsigned integer followed by the greatest possible value for that
 //   argument or 0 if no constraint on the value.
 //   (e.g. i15 for a 4-bits value)
-//  v -> void
 //  V -> Vector type used with MMA builtins (vector unsigned char)
-//  W -> MMA vector type followed by the size of the vector type.
+//  W -> PPC Vector type followed by the size of the vector type.
 //   (e.g. W512 for __vector_quad)
+//  any other descriptor -> Fall back to generic type descriptor decoding.
 // The 'C' suffix can be used as a suffix to specify the const type.
 // The '*' suffix can be used as a suffix to specify a pointer to a type.
 // The third argument is set to true if the builtin accumulates its result into
 // i

[llvm-branch-commits] [mlir] a48172c - Add brief description of dialects doc section.

2020-12-17 Thread Mehdi Amini via llvm-branch-commits

Author: Richard Uhler
Date: 2020-12-17T18:37:34Z
New Revision: a48172cf1c1527123a7db35a7d0d7fa84f5dc37c

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

LOG: Add brief description of dialects doc section.

Reviewed By: jpienaar

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

Added: 
mlir/docs/Dialects/_index.md

Modified: 


Removed: 




diff  --git a/mlir/docs/Dialects/_index.md b/mlir/docs/Dialects/_index.md
new file mode 100644
index ..da19ddcca777
--- /dev/null
+++ b/mlir/docs/Dialects/_index.md
@@ -0,0 +1,6 @@
+# Dialects
+
+This section contains documentation for core and contributed dialects available
+from the MLIR repository. The description for each dialect includes content
+automatically generated from the dialect's
+[Operation Definition Specification (ODS)](../OpDefinitions.md).



___
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] [compiler-rt] e22d802 - scudo: Adjust test to use correct check for primary allocations.

2020-12-17 Thread Peter Collingbourne via llvm-branch-commits

Author: Peter Collingbourne
Date: 2020-12-17T10:42:17-08:00
New Revision: e22d802e587b8954748e2b2193195a946ba105e8

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

LOG: scudo: Adjust test to use correct check for primary allocations.

canAllocate() does not take into account the header size so it does
not return the right answer in borderline cases. There was already
code handling this correctly in isTaggedAllocation() so split it out
into a separate function and call it from the test.

Furthermore the test was incorrect when MTE is enabled because MTE
does not pattern fill primary allocations. Fix it.

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

Added: 


Modified: 
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

Removed: 




diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp 
b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 7df4594246a6..b0ab0244e877 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -34,12 +34,7 @@ UNUSED static void disableDebuggerdMaybe() {
 }
 
 template 
-bool isTaggedAllocation(AllocatorT *Allocator, scudo::uptr Size,
-scudo::uptr Alignment) {
-  if (!Allocator->useMemoryTagging() ||
-  !scudo::systemDetectsMemoryTagFaultsTestOnly())
-return false;
-
+bool isPrimaryAllocation(scudo::uptr Size, scudo::uptr Alignment) {
   const scudo::uptr MinAlignment = 1UL << SCUDO_MIN_ALIGNMENT_LOG;
   if (Alignment < MinAlignment)
 Alignment = MinAlignment;
@@ -49,6 +44,14 @@ bool isTaggedAllocation(AllocatorT *Allocator, scudo::uptr 
Size,
   return AllocatorT::PrimaryT::canAllocate(NeededSize);
 }
 
+template 
+bool isTaggedAllocation(AllocatorT *Allocator, scudo::uptr Size,
+scudo::uptr Alignment) {
+  return Allocator->useMemoryTagging() &&
+ scudo::systemDetectsMemoryTagFaultsTestOnly() &&
+ isPrimaryAllocation(Size, Alignment);
+}
+
 template 
 void checkMemoryTaggingMaybe(AllocatorT *Allocator, void *P, scudo::uptr Size,
  scudo::uptr Alignment) {
@@ -147,9 +150,9 @@ template  static void testAllocator() {
   }
   Allocator->releaseToOS();
 
-  // Ensure that specifying PatternOrZeroFill returns a pattern-filled block in
-  // the primary allocator, and either pattern or zero filled block in the
-  // secondary.
+  // Ensure that specifying PatternOrZeroFill returns a pattern or zero filled
+  // block. The primary allocator only produces pattern filled blocks if MTE
+  // is disabled, so we only require pattern filled blocks in that case.
   Allocator->setFillContents(scudo::PatternOrZeroFill);
   for (scudo::uptr SizeLog = 0U; SizeLog <= 20U; SizeLog++) {
 for (scudo::uptr Delta = 0U; Delta <= 4U; Delta++) {
@@ -158,7 +161,8 @@ template  static void testAllocator() {
   EXPECT_NE(P, nullptr);
   for (scudo::uptr I = 0; I < Size; I++) {
 unsigned char V = (reinterpret_cast(P))[I];
-if (AllocatorT::PrimaryT::canAllocate(Size))
+if (isPrimaryAllocation(Size, 1U << MinAlignLog) &&
+!Allocator->useMemoryTagging())
   ASSERT_EQ(V, scudo::PatternFillByte);
 else
   ASSERT_TRUE(V == scudo::PatternFillByte || V == 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] [lld] cb77e87 - [WebAssembly][lld] Don't mark a file live from an undefine symbol

2020-12-17 Thread Derek Schuff via llvm-branch-commits

Author: Derek Schuff
Date: 2020-12-17T11:05:36-08:00
New Revision: cb77e877f8132b885fcac8b7532c58072537b9ed

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

LOG: [WebAssembly][lld] Don't mark a file live from an undefine symbol

Live symbols should only cause the files in which they are defined
to become live.

For now this is only tested in emscripten: we're continuing
to work on reducing the test case further for an lld-style
unit test.

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

Added: 


Modified: 
lld/wasm/Symbols.cpp

Removed: 




diff  --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 9e41f7c6281d..aa3b6be8a9b8 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -137,7 +137,7 @@ bool Symbol::isLive() const {
 
 void Symbol::markLive() {
   assert(!isDiscarded());
-  if (file != NULL)
+  if (file != NULL && isDefined())
 file->markLive();
   if (auto *g = dyn_cast(this))
 g->global->live = 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] [openmp] e1fd202 - [OpenMP] Add definitions for 5.1 interop to omp.h

2020-12-17 Thread Hansang Bae via llvm-branch-commits

Author: Hansang Bae
Date: 2020-12-17T13:03:59-06:00
New Revision: e1fd202489e184e32a23fe01af8a61e48af186a8

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

LOG: [OpenMP] Add definitions for 5.1 interop to omp.h

Added: 


Modified: 
openmp/runtime/src/include/omp.h.var

Removed: 




diff  --git a/openmp/runtime/src/include/omp.h.var 
b/openmp/runtime/src/include/omp.h.var
index 510bfc225f89..b687ff16eaeb 100644
--- a/openmp/runtime/src/include/omp.h.var
+++ b/openmp/runtime/src/include/omp.h.var
@@ -152,6 +152,67 @@
 extern int   __KAI_KMPC_CONVENTION  omp_get_device_num (void);
 typedef void * omp_depend_t;
 
+/* OpenMP 5.1 interop */
+typedef intptr_t omp_intptr_t;
+
+/* 0..omp_get_num_interop_properties()-1 are reserved for 
implementation-defined properties */
+typedef enum omp_interop_property {
+omp_ipr_fr_id = -1,
+omp_ipr_fr_name = -2,
+omp_ipr_vendor = -3,
+omp_ipr_vendor_name = -4,
+omp_ipr_device_num = -5,
+omp_ipr_platform = -6,
+omp_ipr_device = -7,
+omp_ipr_device_context = -8,
+omp_ipr_targetsync = -9,
+omp_ipr_first = -9
+} omp_interop_property_t;
+
+#define omp_interop_none 0
+
+typedef enum omp_interop_rc {
+omp_irc_no_value = 1,
+omp_irc_success = 0,
+omp_irc_empty = -1,
+omp_irc_out_of_range = -2,
+omp_irc_type_int = -3,
+omp_irc_type_ptr = -4,
+omp_irc_type_str = -5,
+omp_irc_other = -6
+} omp_interop_rc_t;
+
+typedef void * omp_interop_t;
+
+/*!
+ * The `omp_get_num_interop_properties` routine retrieves the number of 
implementation-defined properties available for an `omp_interop_t` object.
+ */
+extern int  __KAI_KMPC_CONVENTION  
omp_get_num_interop_properties(const omp_interop_t);
+/*!
+ * The `omp_get_interop_int` routine retrieves an integer property from an 
`omp_interop_t` object.
+ */
+extern omp_intptr_t __KAI_KMPC_CONVENTION  omp_get_interop_int(const 
omp_interop_t, omp_interop_property_t, int *);
+/*!
+ * The `omp_get_interop_ptr` routine retrieves a pointer property from an 
`omp_interop_t` object.
+ */
+extern void *   __KAI_KMPC_CONVENTION  omp_get_interop_ptr(const 
omp_interop_t, omp_interop_property_t, int *);
+/*!
+ * The `omp_get_interop_str` routine retrieves a string property from an 
`omp_interop_t` object.
+ */
+extern const char * __KAI_KMPC_CONVENTION  omp_get_interop_str(const 
omp_interop_t, omp_interop_property_t, int *);
+/*!
+ * The `omp_get_interop_name` routine retrieves a property name from an 
`omp_interop_t` object.
+ */
+extern const char * __KAI_KMPC_CONVENTION  omp_get_interop_name(const 
omp_interop_t, omp_interop_property_t);
+/*!
+ * The `omp_get_interop_type_desc` routine retrieves a description of the 
type of a property associated with an `omp_interop_t` object.
+ */
+extern const char * __KAI_KMPC_CONVENTION  omp_get_interop_type_desc(const 
omp_interop_t, omp_interop_property_t);
+/*!
+ * The `omp_get_interop_rc_desc` routine retrieves a description of the 
return code associated with an `omp_interop_t` object.
+ */
+extern const char * __KAI_KMPC_CONVENTION  omp_get_interop_rc_desc(const 
omp_interop_rc_t, omp_interop_rc_t);
+
 /* kmp API functions */
 extern int__KAI_KMPC_CONVENTION  kmp_get_stacksize  (void);
 extern void   __KAI_KMPC_CONVENTION  kmp_set_stacksize  (int);



___
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] cb77e87 - [WebAssembly][lld] Don't mark a file live from an undefine symbol

2020-12-17 Thread Derek Schuff via llvm-branch-commits

Author: Derek Schuff
Date: 2020-12-17T11:05:36-08:00
New Revision: cb77e877f8132b885fcac8b7532c58072537b9ed

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

LOG: [WebAssembly][lld] Don't mark a file live from an undefine symbol

Live symbols should only cause the files in which they are defined
to become live.

For now this is only tested in emscripten: we're continuing
to work on reducing the test case further for an lld-style
unit test.

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

Added: 


Modified: 
lld/wasm/Symbols.cpp

Removed: 




diff  --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 9e41f7c6281d..aa3b6be8a9b8 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -137,7 +137,7 @@ bool Symbol::isLive() const {
 
 void Symbol::markLive() {
   assert(!isDiscarded());
-  if (file != NULL)
+  if (file != NULL && isDefined())
 file->markLive();
   if (auto *g = dyn_cast(this))
 g->global->live = 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] [clang] f4c8b80 - [openmp] Remove clause from OMPKinds.def and use OMP.td info

2020-12-17 Thread via llvm-branch-commits

Author: Valentin Clement
Date: 2020-12-17T14:08:12-05:00
New Revision: f4c8b80318005ca61bfed9b40ee9e6039194159b

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

LOG: [openmp] Remove clause from OMPKinds.def and use OMP.td info

Remove the OpenMP clause information from the OMPKinds.def file and use the
information from the new OMP.td file. There is now a single source of truth for 
the
directives and clauses.

To avoid generate lots of specific small code from tablegen, the macros 
previously
used in OMPKinds.def are generated almost as identical. This can be polished and
possibly removed in a further patch.

Reviewed By: jdoerfert

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

Added: 


Modified: 
clang/include/clang/AST/ASTFwd.h
clang/include/clang/AST/ASTTypeTraits.h
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/lib/AST/ASTTypeTraits.cpp
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.cpp
clang/lib/ASTMatchers/Dynamic/Marshallers.h
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/tools/libclang/CIndex.cpp
flang/include/flang/Parser/dump-parse-tree.h
flang/include/flang/Parser/parse-tree.h
flang/lib/Parser/unparse.cpp
flang/lib/Semantics/check-omp-structure.h
llvm/include/llvm/Frontend/OpenMP/CMakeLists.txt
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/include/llvm/TableGen/DirectiveEmitter.h
llvm/test/TableGen/directive2.td
llvm/utils/TableGen/DirectiveEmitter.cpp

Removed: 




diff  --git a/clang/include/clang/AST/ASTFwd.h 
b/clang/include/clang/AST/ASTFwd.h
index 65319a19728b..649b57113424 100644
--- a/clang/include/clang/AST/ASTFwd.h
+++ b/clang/include/clang/AST/ASTFwd.h
@@ -27,9 +27,9 @@ class Type;
 #include "clang/AST/TypeNodes.inc"
 class CXXCtorInitializer;
 class OMPClause;
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) class Class;
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
-
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) class Class;
+#include "llvm/Frontend/OpenMP/OMP.inc"
 
 } // end namespace clang
 

diff  --git a/clang/include/clang/AST/ASTTypeTraits.h 
b/clang/include/clang/AST/ASTTypeTraits.h
index 2141f85911be..a91f6b0c1a69 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -147,8 +147,9 @@ class ASTNodeKind {
 #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type,
 #include "clang/AST/TypeNodes.inc"
 NKI_OMPClause,
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) NKI_##Class,
+#include "llvm/Frontend/OpenMP/OMP.inc"
 NKI_NumberOfKinds
   };
 
@@ -205,8 +206,9 @@ KIND_TO_KIND_ID(CXXBaseSpecifier)
 #include "clang/AST/StmtNodes.inc"
 #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type)
 #include "clang/AST/TypeNodes.inc"
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) KIND_TO_KIND_ID(Class)
+#include "llvm/Frontend/OpenMP/OMP.inc"
 #undef KIND_TO_KIND_ID
 
 inline raw_ostream &operator<<(raw_ostream &OS, ASTNodeKind K) {

diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index cc6d3a93ba09..877c1d87d8ac 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7758,22 +7758,22 @@ class OMPClauseVisitorBase {
 #define DISPATCH(CLASS) \
   return 
static_cast(this)->Visit##CLASS(static_cast(S))
 
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) \
-  RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); }
-#include "llvm/Frontend/OpenMP/OMPKinds.def"
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
+  RetTy Visit##Class(PTR(Class) S) { DISPATCH(Class); }
+#include "llvm/Frontend/OpenMP/OMP.inc"
 
   RetTy Visit(PTR(OMPClause) S) {
 // Top switch clause: visit each OMPClause.
 switch (S->getClauseKind()) {
-#define OMP_CLAUSE_CLASS(Enum, Str, Class) 
\
+#define GEN_CLANG_CLAUSE_CLASS
+#define CLAUSE_CLASS(Enum, Str, Class) 
\
   case llvm::omp::Clause::Enum:
\
 return Visit##Class(static_cast(S));
-#define OMP_CLAUSE_NO_CLASS(Enum, Str) 
\
+#define CLAUSE_NO_CLASS(Enum, Str) 
\
   case llvm::omp:

[llvm-branch-commits] [mlir] 14f2415 - [mlir][LLVMIR] Add 'llvm.switch' op

2020-12-17 Thread Brian Gesiak via llvm-branch-commits

Author: Brian Gesiak
Date: 2020-12-17T14:11:21-05:00
New Revision: 14f24155a5915a295bd965bb6062bfeab217b9c8

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

LOG: [mlir][LLVMIR] Add 'llvm.switch' op

The LLVM IR 'switch' instruction allows control flow to be transferred
to one of any number of branches depending on an integer control value,
or a default value if the control does not match any branch values. This patch
adds `llvm.switch` to the MLIR LLVMIR dialect, as well as translation routines
for lowering it to LLVM IR.

To store a variable number of operands for a variable number of branch
destinations, the new op makes use of the `AttrSizedOperandSegments`
trait. It stores its default branch operands as one segment, and all
remaining case branches' operands as another. It also stores pairs of
begin and end offset values to delineate the sub-range of each case branch's
operands. There's probably a better way to implement this, since the
offset computation complicates several parts of the op definition. This is the
approach I settled on because in doing so I was able to delegate to the default
op builder member functions. However, it may be preferable to instead specify
`skipDefaultBuilders` in the op's ODS, or use a completely separate
approach; feedback is welcome!

Another contentious part of this patch may be the custom printer and
parser functions for the op. Ideally I would have liked the MLIR to be
printed in this way:

```
llvm.switch %0, ^bb1(%1 : !llvm.i32) [
  1: ^bb2,
  2: ^bb3(%2, %3 : !llvm.i32, !llvm.i32)
]
```

The above would resemble how LLVM IR is formatted for the 'switch'
instruction. But I found it difficult to print and parse something like
this, whether I used the declarative assembly format or custom functions.
I also was not sure a multi-line format would be welcome -- it seems
like most MLIR ops do not use newlines. Again, I'd be happy to hear any
feedback here as well, or on any other aspect of the patch.

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

Added: 


Modified: 
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Dialect/LLVMIR/invalid.mlir
mlir/test/Dialect/LLVMIR/roundtrip.mlir
mlir/test/Target/llvmir.mlir

Removed: 




diff  --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td 
b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 0088fe38246b..9608e15bb81a 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -635,6 +635,50 @@ def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable", 
[]> {
   let printer = [{ p << getOperationName(); }];
 }
 
+def LLVM_SwitchOp : LLVM_TerminatorOp<"switch",
+[AttrSizedOperandSegments, DeclareOpInterfaceMethods,
+ NoSideEffect]> {
+  let arguments = (ins LLVM_i32:$value,
+   Variadic:$defaultOperands,
+   Variadic:$caseOperands,
+   OptionalAttr:$case_values,
+   OptionalAttr:$case_operand_offsets,
+   OptionalAttr:$branch_weights);
+  let successors = (successor
+AnySuccessor:$defaultDestination,
+VariadicSuccessor:$caseDestinations);
+
+  let verifier = [{ return ::verify(*this); }];
+  let assemblyFormat = [{
+$value `,`
+$defaultDestination (`(` $defaultOperands^ `:` type($defaultOperands) `)`)?
+`[` `\n` custom($case_values, $caseDestinations,
+   $caseOperands, type($caseOperands),
+   $case_operand_offsets) `]`
+attr-dict
+  }];
+
+  let builders = [
+OpBuilderDAG<(ins "Value":$value,
+  "Block *":$defaultDestination,
+  "ValueRange":$defaultOperands,
+  CArg<"ArrayRef", "{}">:$caseValues,
+  CArg<"BlockRange", "{}">:$caseDestinations,
+  CArg<"ArrayRef", "{}">:$caseOperands,
+  CArg<"ArrayRef", "{}">:$branchWeights)>,
+LLVM_TerminatorPassthroughOpBuilder
+  ];
+
+  let extraClassDeclaration = [{
+/// Return the operands for the case destination block at the given index.
+OperandRange getCaseOperands(unsigned index);
+
+/// Return a mutable range of operands for the case destination block at 
the
+/// given index.
+MutableOperandRange getCaseOperandsMutable(unsigned index);
+  }];
+}
+
 

 // Auxiliary operations (do not appear in LLVM IR but necessary for the dialect
 // to work correctly).

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp 
b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index d70a327824b7..9b2c88c30a86 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/ml

[llvm-branch-commits] [llvm] 8c6d516 - [NFC][AMDGPU] Reorganize description of scratch handling

2020-12-17 Thread via llvm-branch-commits

Author: Tony
Date: 2020-12-17T19:33:14Z
New Revision: 8c6d516286d5eb51899f380526c59e8b7af69f24

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

LOG: [NFC][AMDGPU] Reorganize description of scratch handling

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

Added: 


Modified: 
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index c8dda47352ab..3dbdfa7764dc 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -107,21 +107,21 @@ specific information.
   .. table:: AMDGPU Processors
  :name: amdgpu-processor-table
 
- === ===  = = 
=== === ==
- Processor   Alternative Target   dGPU/ TargetTarget   
   OS Support  Example
- Processor   Triple   APU   Features  
Properties  *(see*  Products
- Architecture   Supported  
   `amdgpu-os`_
-   
   *and
-   
   corresponding
-   
   runtime release
-   
   notes for
-   
   current
-   
   information and
-   
   level of
-   
   support)*
- === ===  = = 
=== === ==
+ === ===  = = 
=== === ==
+ Processor   Alternative Target   dGPU/ TargetTarget   
   OS Support  Example
+ Processor   Triple   APU   Features  
Properties  *(see*  Products
+ Architecture   Supported  
   `amdgpu-os`_
+   
   *and
+   
   corresponding
+   
   runtime release
+   
   notes for
+   
   current
+   
   information and
+   
   level of
+   
   support)*
+ === ===  = = 
=== === ==
  **Radeon HD 2000/3000 Series (R600)** [AMD-RADEON-HD-2000-3000]_
- 
---
+ 
---
  ``r600````r600`` dGPU- Does 
not
 support
 generic
@@ -143,7 +143,7 @@ specific information.
 address
 space
  **Radeon HD 4000 Series (R700)** [AMD-RADEON-HD-4000]_
- 
---
+ 
---
  ``rv710``   ``r600`` dGPU- Does 
not
 support
 generic
@@ -160,7 +160,7 @@ specific information.
 address
   

[llvm-branch-commits] [mlir] 58f2b76 - Fix NDEBUG build after https://reviews.llvm.org/D93005.

2020-12-17 Thread Christian Sigg via llvm-branch-commits

Author: Christian Sigg
Date: 2020-12-17T20:38:21+01:00
New Revision: 58f2b765ebec45643f0b0d6737fb3dc339f75cde

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

LOG: Fix NDEBUG build after https://reviews.llvm.org/D93005.

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

Added: 


Modified: 
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Removed: 




diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index d9094f8763d9..8c650506e2d7 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -327,6 +327,7 @@ static Value getPHISourceValue(Block *current, Block *pred,
   assert(std::adjacent_find(successors.begin(), successors.end()) ==
  successors.end() &&
  "successors with arguments in LLVM branches must be 
diff erent blocks");
+  (void)successors;
 
   // For instructions that branch based on a condition value, we need to take
   // the operands for the branch that was taken.



___
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] 7529fab - [test] Factor out creation of copy of SCC Nodes into function

2020-12-17 Thread Arthur Eubanks via llvm-branch-commits

Author: Arthur Eubanks
Date: 2020-12-17T11:39:34-08:00
New Revision: 7529fab602c728d12c387e5eb5bbced1ec139dbd

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

LOG: [test] Factor out creation of copy of SCC Nodes into function

Reviewed By: rnk

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

Added: 


Modified: 
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp

Removed: 




diff  --git a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp 
b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
index 2c3b0c126d2e..5b68b985330a 100644
--- a/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
+++ b/llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
@@ -1714,6 +1714,16 @@ TEST_F(CGSCCPassManagerTest, 
TestUpdateCGAndAnalysisManagerForPasses10) {
   MPM.run(*M, MAM);
 }
 
+// Returns a vector containing the SCC's nodes. Useful for not iterating over 
an
+// SCC while mutating it.
+static SmallVector SCCNodes(LazyCallGraph::SCC &C) {
+  SmallVector Nodes;
+  for (auto &N : C)
+Nodes.push_back(&N);
+
+  return Nodes;
+}
+
 // Start with call recursive f, create f -> g and ref recursive f.
 TEST_F(CGSCCPassManagerTest, TestInsertionOfNewFunctions1) {
   std::unique_ptr M = parseIR("define void @f() {\n"
@@ -1734,12 +1744,7 @@ TEST_F(CGSCCPassManagerTest, 
TestInsertionOfNewFunctions1) {
 auto &FAM =
 AM.getResult(C, 
CG).getManager();
 
-// Don't iterate over SCC while changing it.
-SmallVector Nodes;
-for (auto &N : C)
-  Nodes.push_back(&N);
-
-for (LazyCallGraph::Node *N : Nodes) {
+for (LazyCallGraph::Node *N : SCCNodes(C)) {
   Function &F = N->getFunction();
   if (F.getName() != "f")
 continue;
@@ -1801,12 +1806,7 @@ TEST_F(CGSCCPassManagerTest, 
TestInsertionOfNewFunctions2) {
 auto &FAM =
 AM.getResult(C, CG).getManager();
 
-// Don't iterate over SCC while changing it.
-SmallVector Nodes;
-for (auto &N : C)
-  Nodes.push_back(&N);
-
-for (LazyCallGraph::Node *N : Nodes) {
+for (LazyCallGraph::Node *N : SCCNodes(C)) {
   Function &F = N->getFunction();
   if (F.getName() != "f")
 continue;
@@ -1908,12 +1908,7 @@ TEST_F(CGSCCPassManagerTest, 
TestInsertionOfNewNonTrivialCallEdge) {
 auto &FAM =
 AM.getResult(C, CG).getManager();
 
-// Don't iterate over SCC while changing it.
-SmallVector Nodes;
-for (auto &N : C)
-  Nodes.push_back(&N);
-
-for (LazyCallGraph::Node *N : Nodes) {
+for (LazyCallGraph::Node *N : SCCNodes(C)) {
   Function &F = N->getFunction();
   if (F.getName() != "f1")
 continue;



___
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] 1b84934 - [DSE] Add more tests for read clobber location (NFC)

2020-12-17 Thread Nikita Popov via llvm-branch-commits

Author: Nikita Popov
Date: 2020-12-17T21:03:00+01:00
New Revision: 1b84934f908d7ab04443f2d442a19d058aadc2ed

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

LOG: [DSE] Add more tests for read clobber location (NFC)

Added: 
llvm/test/Transforms/DeadStoreElimination/MSSA/scoped-noalias.ll

Modified: 
llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll

Removed: 




diff  --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll 
b/llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll
index 31bb3234dc42..9d20f80f5099 100644
--- a/llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/overlap.ll
@@ -6,14 +6,14 @@ declare void @use(i64*)
 
 define void @test1() {
 ; CHECK-LABEL: @test1(
-; CHECK-NEXT:[[A:%.*]] = alloca i64
+; CHECK-NEXT:[[A:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:call void @use(i64* [[A]])
 ; CHECK-NEXT:[[PTR1:%.*]] = bitcast i64* [[A]] to i8*
 ; CHECK-NEXT:[[PTR2:%.*]] = getelementptr i8, i8* [[PTR1]], i32 1
-; CHECK-NEXT:store i8 10, i8* [[PTR1]]
-; CHECK-NEXT:store i8 20, i8* [[PTR2]]
-; CHECK-NEXT:[[LV:%.*]] = load i64, i64* [[A]]
-; CHECK-NEXT:store i8 0, i8* [[PTR1]]
+; CHECK-NEXT:store i8 10, i8* [[PTR1]], align 1
+; CHECK-NEXT:store i8 20, i8* [[PTR2]], align 1
+; CHECK-NEXT:[[LV:%.*]] = load i64, i64* [[A]], align 4
+; CHECK-NEXT:store i8 0, i8* [[PTR1]], align 1
 ; CHECK-NEXT:call void @use(i64* [[A]])
 ; CHECK-NEXT:ret void
 ;
@@ -33,18 +33,18 @@ define void @test1() {
 
 define void @test2() {
 ; CHECK-LABEL: @test2(
-; CHECK-NEXT:[[A:%.*]] = alloca i64
+; CHECK-NEXT:[[A:%.*]] = alloca i64, align 8
 ; CHECK-NEXT:call void @use(i64* [[A]])
 ; CHECK-NEXT:[[PTR1:%.*]] = bitcast i64* [[A]] to i8*
 ; CHECK-NEXT:[[PTR2:%.*]] = getelementptr i8, i8* [[PTR1]], i32 1
-; CHECK-NEXT:store i8 10, i8* [[PTR1]]
-; CHECK-NEXT:store i8 20, i8* [[PTR2]]
+; CHECK-NEXT:store i8 10, i8* [[PTR1]], align 1
+; CHECK-NEXT:store i8 20, i8* [[PTR2]], align 1
 ; CHECK-NEXT:br i1 undef, label [[BB1:%.*]], label [[END:%.*]]
 ; CHECK:   bb1:
-; CHECK-NEXT:[[LV:%.*]] = load i64, i64* [[A]]
+; CHECK-NEXT:[[LV:%.*]] = load i64, i64* [[A]], align 4
 ; CHECK-NEXT:br label [[END]]
 ; CHECK:   end:
-; CHECK-NEXT:store i8 0, i8* [[PTR1]]
+; CHECK-NEXT:store i8 0, i8* [[PTR1]], align 1
 ; CHECK-NEXT:call void @use(i64* [[A]])
 ; CHECK-NEXT:ret void
 ;
@@ -66,3 +66,33 @@ end:
   call void @use(i64* %a)
   ret void
 }
+
+; TODO: The store to %a0 is dead, because only %a1 is read later.
+define void @test3(i1 %c) {
+; CHECK-LABEL: @test3(
+; CHECK-NEXT:[[A:%.*]] = alloca [2 x i8], align 1
+; CHECK-NEXT:[[A0:%.*]] = getelementptr [2 x i8], [2 x i8]* [[A]], i32 0, 
i32 0
+; CHECK-NEXT:[[A1:%.*]] = getelementptr [2 x i8], [2 x i8]* [[A]], i32 0, 
i32 1
+; CHECK-NEXT:store i8 1, i8* [[A0]], align 1
+; CHECK-NEXT:br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
+; CHECK:   if:
+; CHECK-NEXT:store [2 x i8] zeroinitializer, [2 x i8]* [[A]], align 1
+; CHECK-NEXT:br label [[ELSE]]
+; CHECK:   else:
+; CHECK-NEXT:[[TMP1:%.*]] = load i8, i8* [[A1]], align 1
+; CHECK-NEXT:ret void
+;
+  %a = alloca [2 x i8]
+  %a0 = getelementptr [2 x i8], [2 x i8]* %a, i32 0, i32 0
+  %a1 = getelementptr [2 x i8], [2 x i8]* %a, i32 0, i32 1
+  store i8 1, i8* %a0
+  br i1 %c, label %if, label %else
+
+if:
+  store [2 x i8] zeroinitializer, [2 x i8]* %a
+  br label %else
+
+else:
+  load i8, i8* %a1
+  ret void
+}

diff  --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/scoped-noalias.ll 
b/llvm/test/Transforms/DeadStoreElimination/MSSA/scoped-noalias.ll
new file mode 100644
index ..b2e626250817
--- /dev/null
+++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/scoped-noalias.ll
@@ -0,0 +1,34 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -scoped-noalias-aa -dse < %s | FileCheck %s
+
+; Assume that %p1 != %p2 if and only if %c is true. In that case the noalias
+; metadata is correct, but the first store cannot be eliminated, as it may be
+; read-clobbered by the load.
+; TODO The store is incorrectly eliminated.
+define void @test(i1 %c, i8* %p1, i8* %p2) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT:[[TMP1:%.*]] = load i8, i8* [[P2:%.*]], align 1, !alias.scope 
!0
+; CHECK-NEXT:br i1 [[C:%.*]], label [[IF:%.*]], label [[ELSE:%.*]]
+; CHECK:   if:
+; CHECK-NEXT:store i8 1, i8* [[P1:%.*]], align 1, !noalias !0
+; CHECK-NEXT:ret void
+; CHECK:   else:
+; CHECK-NEXT:store i8 2, i8* [[P1]], align 1
+; CHECK-NEXT:ret void
+;
+  store i8 0, i8* %p1
+  load i8, i8* %p2, !alias.scope !

[llvm-branch-commits] [llvm] 85ffbe5 - [gn build] (manually) merge f4c8b8031800

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:09:51-05:00
New Revision: 85ffbe5d6a0d6bf5ad651f415ca01dc3e3c4dc76

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

LOG: [gn build] (manually) merge f4c8b8031800

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn

Removed: 




diff  --git 
a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
index 6fe62a0f5a71..bb1c8803d9ca 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
@@ -1,16 +1,15 @@
 import("//llvm/utils/TableGen/tablegen.gni")
 
-tablegen("OMP") {
+tablegen("OMPh") {
   visibility = [ ":public_tablegen" ]
   args = [ "-gen-directive-decl" ]
   output_name = "OMP.h.inc"
+  td_file = "OMP.td"
 }
 
-tablegen("OMPcpp") {
+tablegen("OMP") {
   visibility = [ ":public_tablegen" ]
   args = [ "-gen-directive-gen" ]
-  output_name = "OMP.cpp.inc"
-  td_file = "OMP.td"
 }
 
 # Groups all tablegen() calls that create .inc files that are included in
@@ -20,7 +19,7 @@ tablegen("OMPcpp") {
 group("public_tablegen") {
   public_deps = [
 # Frontend/OpenMP's public headers include OMP.h.inc.
+":OMPh",
 ":OMP",
-":OMPcpp",
   ]
 }



___
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] 106e66f - [mlir][ArmSVE] Add documentation generation

2020-12-17 Thread Aart Bik via llvm-branch-commits

Author: Javier Setoain
Date: 2020-12-17T12:22:48-08:00
New Revision: 106e66f3f555c8f887e82c5f04c3e77bdaf345e8

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

LOG: [mlir][ArmSVE] Add documentation generation

Adds missing cmake command to generate documentation for ArmSVE
Dialect.

Reviewed By: aartbik

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

Added: 


Modified: 
mlir/include/mlir/Dialect/ArmSVE/CMakeLists.txt

Removed: 




diff  --git a/mlir/include/mlir/Dialect/ArmSVE/CMakeLists.txt 
b/mlir/include/mlir/Dialect/ArmSVE/CMakeLists.txt
index fb50fac68f33..c7db56122a95 100644
--- a/mlir/include/mlir/Dialect/ArmSVE/CMakeLists.txt
+++ b/mlir/include/mlir/Dialect/ArmSVE/CMakeLists.txt
@@ -1 +1,2 @@
 add_mlir_dialect(ArmSVE arm_sve ArmSVE)
+add_mlir_doc(ArmSVE -gen-dialect-doc ArmSVE Dialects/)



___
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] e75fec2 - [AttrDocs] document always_inline

2020-12-17 Thread Nick Desaulniers via llvm-branch-commits

Author: Nick Desaulniers
Date: 2020-12-17T12:34:23-08:00
New Revision: e75fec2b238f0e26cfb7645f2208baebe3440d41

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

LOG: [AttrDocs] document always_inline

GNU documentaion for always_inline:
https://gcc.gnu.org/onlinedocs/gcc/Inline.html

GNU documentation for function attributes:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html

Microsoft documentation for __force_inline:
https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp

Reviewed By: ojeda

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

Added: 


Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td

Removed: 




diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index ce2ee40dc036e..ba6c459f4a431 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -684,7 +684,7 @@ def AlignMac68k : InheritableAttr {
 def AlwaysInline : InheritableAttr {
   let Spellings = [GCC<"always_inline">, Keyword<"__forceinline">];
   let Subjects = SubjectList<[Function]>;
-  let Documentation = [Undocumented];
+  let Documentation = [AlwaysInlineDocs];
 }
 
 def Artificial : InheritableAttr {

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index c3a412158aba0..6f47ca505b5e0 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5653,3 +5653,22 @@ Requirements on Development Tools - Engineering 
Specification Documentation
 `_ for more information.
   }];
 }
+
+def AlwaysInlineDocs : Documentation {
+  let Category = DocCatFunction;
+  let Content = [{
+Inlining heuristics are disabled and inlining is always attempted regardless of
+optimization level.
+
+Does not guarantee that inline substitution actually occurs.
+
+See also `the Microsoft Docs on Inline Functions`_, `the GCC Common Function
+Attribute docs`_, and `the GCC Inline docs`_.
+
+.. _the Microsoft Docs on Inline Functions: 
https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp
+.. _the GCC Common Function Attribute docs: 
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html
+.. _the GCC Inline docs: https://gcc.gnu.org/onlinedocs/gcc/Inline.html
+
+}];
+  let Heading = "always_inline, __force_inline";
+}



___
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] 994bb6e - [OpenMP][NFC] Provide a new remark and documentation

2020-12-17 Thread Johannes Doerfert via llvm-branch-commits

Author: Johannes Doerfert
Date: 2020-12-17T14:38:26-06:00
New Revision: 994bb6eb7d01db1d9461e54d17a63af2ba1af2c9

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

LOG: [OpenMP][NFC] Provide a new remark and documentation

If a GPU function is externally reachable we give up trying to find the
(unique) kernel it is called from. This can hinder optimizations. Emit a
remark and explain mitigation strategies.

Reviewed By: tianshilei1992

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

Added: 


Modified: 
clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
openmp/docs/remarks/OptimizationRemarks.rst

Removed: 




diff  --git 
a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c 
b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
index 163f0b92468a..d5b5530fc361 100644
--- a/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
+++ b/clang/test/OpenMP/remarks_parallel_in_multiple_target_state_machines.c
@@ -4,7 +4,7 @@
 
 // host-no-diagnostics
 
-void bar1(void) {
+void bar1(void) {// all-remark {{[OMP100] Potentially unknown OpenMP 
target region caller}}
 #pragma omp parallel // #0
  // all-remark@#0 {{Found a parallel region that is called 
in a target region but not part of a combined target construct nor nesed inside 
a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}}
  // safe-remark@#0 {{Parallel region is not known to be 
called from a unique single target region, maybe the surrounding function has 
external linkage?; will not attempt to rewrite the state machine use.}}
@@ -13,7 +13,7 @@ void bar1(void) {
   {
   }
 }
-void bar2(void) {
+void bar2(void) {// all-remark {{[OMP100] Potentially unknown OpenMP 
target region caller}}
 #pragma omp parallel // #1
  // all-remark@#1 {{Found a parallel region that is called 
in a target region but not part of a combined target construct nor nesed inside 
a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}}
  // safe-remark@#1 {{Parallel region is not known to be 
called from a unique single target region, maybe the surrounding function has 
external linkage?; will not attempt to rewrite the state machine use.}}

diff  --git a/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c 
b/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
index 97507041e195..5747a05a13d3 100644
--- a/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
+++ b/clang/test/OpenMP/remarks_parallel_in_target_state_machine.c
@@ -4,7 +4,7 @@
 
 // host-no-diagnostics
 
-void bar(void) {
+void bar(void) { // expected-remark {{[OMP100] Potentially unknown OpenMP 
target region caller}}
 #pragma omp parallel // #1 



  \
  // expected-remark@#1 {{Found a parallel region that is 
called in a target region but not part of a combined target construct nor nesed 
inside a target construct without intermediate code. This can lead to excessive 
register usage for unrelated target regions in the same translation unit due to 
spurious call edges assumed by ptxas.}} \
  // expected-remark@#1 {{Parallel region is not known to 
be called from a unique single target region, maybe the surrounding function 
has external linkage?; will not attempt to rewrite the state machine use.}}

diff  --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp 
b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index 6053412bae84..5b4772028daf 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -1469,8 +1469,16 @@ Kernel OpenMPOpt::getUniqueKernelFor(Function &F) {
 }
 
 CachedKernel = nullptr;
-if (!F.hasLocalLinkage())
+if (!F.hasLocalLinkage()) {
+
+  // See https://openmp.llvm.org/remarks/OptimizationRemarks.html
+  auto Remark = [&](OptimizationRemark OR) {
+return OR << "[OMP100] Potentially unknown OpenMP target region 
caller";
+  };
+  emitRemarkOnFunction(&F, "OMP100", Rem

[llvm-branch-commits] [llvm] 7e33fd9 - [gn build] Link with -Wl, --gdb-index when linking with LLD

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:39:00-05:00
New Revision: 7e33fd9ce2d8f94bb7195c417426620037804834

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

LOG: [gn build] Link with -Wl,--gdb-index when linking with LLD

For full-debug-info (is_debug=true / symbol_level=2 builds), this makes
linking 15% slower, but gdb startup 1500% faster (for lld: link time
3.9s->4.4s, gdb load time >30s->2s).

For link time, I ran

bench.py -o {noindex,index}.txt \
sh -c 'rm out/gn/bin/lld && ninja -C out/gn lld'

and then `ministat noindex.txt index.txt`:

```
x noindex.txt
+ index.txt
N   Min   MaxMedian   AvgStddev
x   5  3.784461 4.0200169 3.8452811 3.8754988   0.089902595
+   5   4.32496 4.6058481 4.3361208 4.41411980.12288267
Difference at 95.0% confidence
0.538621 +/- 0.15702
13.8981% +/- 4.05161%
(Student's t, pooled s = 0.107663)
```

For gdb load time I loaded the crash in PR48392 with

gdb -ex r --args ../out/gn/bin/ld64.lld.darwinnew @response.txt

and just stopped the time until the crash got displayed with a stopwatch
a few times. So the speedup there is less precise, but it's so
pronounced that that's ok (loads ~instantly with the patch, takes a very
long time without it).

Only doing this for LLD because I haven't tried it with other linkers.

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

Added: 


Modified: 
llvm/utils/gn/build/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 49caf447d019..92d667c16f70 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -77,8 +77,25 @@ config("compiler_defaults") {
   if (host_os != "win") {
 if (symbol_level == 2) {
   cflags += [ "-g" ]
+
+  # For full debug-info -g builds, --gdb-index makes links ~15% slower, and
+  # gdb symbol reading time 1500% faster (lld links in 4.4 instead of 3.9s,
+  # and gdb loads and runs it in 2s instead of in 30s).  It's likely that
+  # people doing symbol_level=2 want to run a debugger (since
+  # symbol_level=2 isn't the default). So this seems like the right
+  # tradeoff.
+  if (host_os != "mac" && use_lld) {
+cflags += [ "-ggnu-pubnames" ]  # PR34820
+ldflags += [ "-Wl,--gdb-index" ]
+  }
 } else if (symbol_level == 1) {
   cflags += [ "-g1" ]
+
+  # For linetable-only -g1 builds, --gdb-index makes links ~8% slower, but
+  # links are 4x faster than -g builds so it's a fairly small absolute 
cost.
+  # On the other hand, gdb startup is well below 1s with and without the
+  # index, and people using -g1 likely don't use a debugger. So don't use
+  # the flag here.
 }
 if (is_optimized) {
   cflags += [ "-O3" ]



___
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] 49c248b - clang-cl: Remove /Zd flag

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:39:40-05:00
New Revision: 49c248bd62a3cb2f0e7e3991ee0190943bd2bbec

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

LOG: clang-cl: Remove /Zd flag

cl.exe doesn't understand Zd (in either MSVC 2017 or 2019), so neiter
should we. It used to do the same as `-gline-tables-only` which is
exposed as clang-cl flag as well, so if you want this behavior, use
`gline-tables-only`. That makes it clear that it's a clang-cl-only flag
that won't work with cl.exe.

Motivated by the discussion in D92958.

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

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/cl-options.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ef7903e16f7fa..a3038aa03cded 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -119,6 +119,14 @@ Modified Compiler Flags
   `nonnull` attribute on `this` for configurations that need it to be nullable.
 - ``-gsplit-dwarf`` no longer implies ``-g2``.
 
+Removed Compiler Flags
+-
+
+The following options no longer exist.
+
+- clang-cl's ``/Zd`` flag no longer exist. But ``-gline-tables-only`` still
+  exists and does the same thing.
+
 New Pragmas in Clang
 
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 07f15add28ec6..ca9615e2e7692 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5351,8 +5351,6 @@ def _SLASH_Zc_twoPhase_ : CLFlag<"Zc:twoPhase-">,
   Alias;
 def _SLASH_Z7 : CLFlag<"Z7">,
   HelpText<"Enable CodeView debug information in object files">;
-def _SLASH_Zd : CLFlag<"Zd">,
-  HelpText<"Emit debug line number tables only">;
 def _SLASH_Zi : CLFlag<"Zi">, Alias<_SLASH_Z7>,
   HelpText<"Like /Z7">;
 def _SLASH_Zp : CLJoined<"Zp">,

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 6ec6a551fafee..300ab6e815e23 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6801,10 +6801,9 @@ void Clang::AddClangCLArgs(const ArgList &Args, 
types::ID InputType,
 CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
   }
 
-  // Emit CodeView if -Z7, -Zd, or -gline-tables-only are present.
-  if (Arg *DebugInfoArg =
-  Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd,
-  options::OPT_gline_tables_only)) {
+  // Emit CodeView if -Z7 or -gline-tables-only are present.
+  if (Arg *DebugInfoArg = Args.getLastArg(options::OPT__SLASH_Z7,
+  options::OPT_gline_tables_only)) {
 *EmitCodeView = true;
 if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7))
   *DebugInfoKind = codegenoptions::LimitedDebugInfo;

diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp 
b/clang/lib/Driver/ToolChains/MSVC.cpp
index 1e04cc9f62713..f4b7a57e0bb70 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -382,8 +382,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
 
   CmdArgs.push_back("-nologo");
 
-  if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7,
-  options::OPT__SLASH_Zd))
+  if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7))
 CmdArgs.push_back("-debug");
 
   // Pass on /Brepro if it was passed to the compiler.

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 43713d955b9bc..db70fca5222c6 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -538,10 +538,6 @@
 // Z7: "-gcodeview"
 // Z7: "-debug-info-kind=limited"
 
-// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
-// Z7GMLT: "-gcodeview"
-// Z7GMLT: "-debug-info-kind=line-tables-only"
-
 // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck 
-check-prefix=ZGMLT %s
 // ZGMLT: "-gcodeview"
 // ZGMLT: "-debug-info-kind=line-tables-only"



___
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] 0efb0dd - [mlir] Partially update the conversion-to-llvm document

2020-12-17 Thread Alex Zinenko via llvm-branch-commits

Author: Alex Zinenko
Date: 2020-12-17T22:00:09+01:00
New Revision: 0efb0dd978014c9ca5ef4cd93516a0cd6e77f185

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

LOG: [mlir] Partially update the conversion-to-llvm document

This document was not updated after the LLVM dialect type system had been
reimplemented and was using an outdated syntax. Rewrite the part of the
document that concerns type conversion and prepare the ground for splitting it
into a document that explains how built-in types are converted and a separate
document that explains how standard types and functions are converted, which
will better correspond to the fact that built-in types do not belong to the
standard dialect.

Reviewed By: rriddle

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

Added: 


Modified: 
mlir/docs/ConversionToLLVMDialect.md

Removed: 




diff  --git a/mlir/docs/ConversionToLLVMDialect.md 
b/mlir/docs/ConversionToLLVMDialect.md
index 27b732015f9f..778eea6184c9 100644
--- a/mlir/docs/ConversionToLLVMDialect.md
+++ b/mlir/docs/ConversionToLLVMDialect.md
@@ -1,16 +1,19 @@
 # Conversion to the LLVM Dialect
 
-Conversion from the Standard to the [LLVM Dialect](Dialects/LLVM.md) can be
-performed by the specialized dialect conversion pass by running:
+Conversion from several dialects that rely on
+[built-in types](LangRef.md#builtin-types) to the
+[LLVM Dialect](Dialects/LLVM.md) is expected to be performed through the
+[Dialect Conversion](DialectConversion.md) infrastructure.
 
-```shell
-mlir-opt -convert-std-to-llvm 
-```
+The conversion of types and that of the overall module structure is described 
in
+this document. Individual conversion passes provide a set of conversion 
patterns
+for ops in 
diff erent dialects, such as `-convert-std-to-llvm` for ops in the
+[Standard dialect](Dialects/Standard.md) and `-convert-vector-to-llvm` in the
+[Vector dialect](Dialects/Vector.md). *Note that some conversions subsume the
+others.*
 
-It performs type and operation conversions for a subset of operations from
-standard dialect (operations on scalars and vectors, control flow operations) 
as
-described in this document. We use the terminology defined by the
-[LLVM IR Dialect description](Dialects/LLVM.md) throughout this document.
+We use the terminology defined by the
+[LLVM Dialect description](Dialects/LLVM.md) throughout this document.
 
 [TOC]
 
@@ -22,19 +25,19 @@ Scalar types are converted to their LLVM counterparts if 
they exist. The
 following conversions are currently implemented:
 
 -   `i*` converts to `!llvm.i*`
+-   `bf16` converts to `!llvm.bfloat`
 -   `f16` converts to `!llvm.half`
 -   `f32` converts to `!llvm.float`
 -   `f64` converts to `!llvm.double`
 
-Note: `bf16` type is not supported by LLVM IR and cannot be converted.
-
 ### Index Type
 
-Index type is converted to a wrapped LLVM IR integer with bitwidth equal to the
-bitwidth of the pointer size as specified by the
-[data layout](https://llvm.org/docs/LangRef.html#data-layout) of the LLVM 
module
-[contained](Dialects/LLVM.md#context-and-module-association) in the LLVM 
Dialect
-object. For example, on x86-64 CPUs it converts to `!llvm.i64`.
+Index type is converted to an LLVM dialect integer type with bitwidth equal to
+the bitwidth of the pointer size as specified by the
+[data layout](Dialects/LLVM.md#data-layout-and-triple) of the closest module.
+For example, on x86-64 CPUs it converts to `!llvm.i64`. This behavior can be
+overridden by the type converter configuration, which is often exposed as a 
pass
+option by conversion passes.
 
 ### Vector Types
 
@@ -45,31 +48,54 @@ size with element type converted using these conversion 
rules. In the
 n-dimensional case, MLIR vectors are converted to (n-1)-dimensional array types
 of one-dimensional vectors.
 
-For example, `vector<4 x f32>` converts to `!llvm<"<4 x float>">` and `vector<4
-x 8 x 16 x f32>` converts to `!llvm<"[4 x [8 x <16 x float>]]">`.
+For example, `vector<4 x f32>` converts to `!llvm.vec<4 x float>` and `vector<4
+x 8 x 16 x f32>` converts to `!llvm.array<4 x array<8 x vec<16 x float>>>`.
 
-### Memref Types
+### Ranked Memref Types
 
 Memref types in MLIR have both static and dynamic information associated with
-them. The dynamic information comprises the buffer pointer as well as sizes and
+them. In the general case, the dynamic information describes dynamic sizes in
+the logical indexing space and any symbols bound to the memref. This dynamic
+information must be present at runtime in the LLVM dialect equivalent type.
+
+In practice, the conversion supports two conventions:
+
+-   the default convention for memrefs in the
+**[strided form](LangRef.md#strided-memref)**;
+-   a "bare pointer" conversion for statically-shaped memrefs with

[llvm-branch-commits] [llvm] 511cfe9 - Revert "Ensure SplitEdge to return the new block between the two given blocks"

2020-12-17 Thread Whitney Tsang via llvm-branch-commits

Author: Bangtian Liu
Date: 2020-12-17T21:00:37Z
New Revision: 511cfe9441955f20a8b93573fb9b62433b053550

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

LOG: Revert "Ensure SplitEdge to return the new block between the two given 
blocks"

This reverts commit d20e0c3444ad9ada550d9d6d1d56fd72948ae444.

Added: 


Modified: 
llvm/include/llvm/IR/BasicBlock.h
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/lib/IR/BasicBlock.cpp
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/test/CodeGen/AMDGPU/call-constexpr.ll
llvm/test/Transforms/LoopUnswitch/2011-11-18-SimpleSwitch.ll
llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

Removed: 




diff  --git a/llvm/include/llvm/IR/BasicBlock.h 
b/llvm/include/llvm/IR/BasicBlock.h
index b86bb16e1239..0cce2a599d9c 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -398,49 +398,22 @@ class BasicBlock final : public Value, // Basic blocks 
are data objects also
 
   /// Split the basic block into two basic blocks at the specified instruction.
   ///
-  /// If \p Before is true, splitBasicBlockBefore handles the
-  /// block splitting. Otherwise, execution proceeds as described below.
-  ///
-  /// Note that all instructions BEFORE the specified iterator
-  /// stay as part of the original basic block, an unconditional branch is 
added
-  /// to the original BB, and the rest of the instructions in the BB are moved
-  /// to the new BB, including the old terminator.  The newly formed basic 
block
-  /// is returned. This function invalidates the specified iterator.
+  /// Note that all instructions BEFORE the specified iterator stay as part of
+  /// the original basic block, an unconditional branch is added to the 
original
+  /// BB, and the rest of the instructions in the BB are moved to the new BB,
+  /// including the old terminator.  The newly formed BasicBlock is returned.
+  /// This function invalidates the specified iterator.
   ///
   /// Note that this only works on well formed basic blocks (must have a
-  /// terminator), and \p 'I' must not be the end of instruction list (which
-  /// would cause a degenerate basic block to be formed, having a terminator
-  /// inside of the basic block).
+  /// terminator), and 'I' must not be the end of instruction list (which would
+  /// cause a degenerate basic block to be formed, having a terminator inside 
of
+  /// the basic block).
   ///
   /// Also note that this doesn't preserve any passes. To split blocks while
   /// keeping loop information consistent, use the SplitBlock utility function.
-  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "",
-  bool Before = false);
-  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "",
-  bool Before = false) {
-return splitBasicBlock(I->getIterator(), BBName, Before);
-  }
-
-  /// Split the basic block into two basic blocks at the specified instruction
-  /// and insert the new basic blocks as the predecessor of the current block.
-  ///
-  /// This function ensures all instructions AFTER and including the specified
-  /// iterator \p I are part of the original basic block. All Instructions
-  /// BEFORE the iterator \p I are moved to the new BB and an unconditional
-  /// branch is added to the new BB. The new basic block is returned.
-  ///
-  /// Note that this only works on well formed basic blocks (must have a
-  /// terminator), and \p 'I' must not be the end of instruction list (which
-  /// would cause a degenerate basic block to be formed, having a terminator
-  /// inside of the basic block).  \p 'I' cannot be a iterator for a PHINode
-  /// with multiple incoming blocks.
-  ///
-  /// Also note that this doesn't preserve any passes. To split blocks while
-  /// keeping loop information consistent, use the SplitBlockBefore utility
-  /// function.
-  BasicBlock *splitBasicBlockBefore(iterator I, const Twine &BBName = "");
-  BasicBlock *splitBasicBlockBefore(Instruction *I, const Twine &BBName = "") {
-return splitBasicBlockBefore(I->getIterator(), BBName);
+  BasicBlock *splitBasicBlock(iterator I, const Twine &BBName = "");
+  BasicBlock *splitBasicBlock(Instruction *I, const Twine &BBName = "") {
+return splitBasicBlock(I->getIterator(), BBName);
   }
 
   /// Returns true if there are any uses of this basic block other than

diff  --git a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h 
b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
index 7b8e2be17fa2..0a63654feb98 100644
--- a/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -244,33 +244,19 @@ unsigned SplitAllCriticalEdges(Funct

[llvm-branch-commits] [mlir] 1b97cdf - [mlir][IR][NFC] Move context/location parameters of builtin Type::get methods to the start of the parameter list

2020-12-17 Thread River Riddle via llvm-branch-commits

Author: River Riddle
Date: 2020-12-17T13:01:36-08:00
New Revision: 1b97cdf885d6455841280b8da858835e641ee941

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

LOG: [mlir][IR][NFC] Move context/location parameters of builtin Type::get 
methods to the start of the parameter list

This better matches the rest of the infrastructure, is much simpler, and makes 
it easier to move these types to being declaratively specified.

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

Added: 


Modified: 
flang/include/flang/Optimizer/Dialect/FIROps.td
flang/lib/Lower/ConvertType.cpp
flang/lib/Lower/IntrinsicCall.cpp
flang/lib/Lower/RTBuilder.h
flang/lib/Optimizer/Dialect/FIROps.cpp
mlir/include/mlir/Dialect/AVX512/AVX512.td
mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOpsInterface.td
mlir/include/mlir/IR/BuiltinTypes.h
mlir/include/mlir/IR/OpBase.td
mlir/lib/CAPI/IR/BuiltinTypes.cpp
mlir/lib/Conversion/AsyncToLLVM/AsyncToLLVM.cpp
mlir/lib/Conversion/GPUToVulkan/ConvertGPULaunchFuncToVulkanLaunchFunc.cpp
mlir/lib/Conversion/LinalgToLLVM/LinalgToLLVM.cpp
mlir/lib/Conversion/LinalgToStandard/LinalgToStandard.cpp
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp
mlir/lib/Dialect/Async/IR/Async.cpp
mlir/lib/Dialect/Async/Transforms/AsyncRefCounting.cpp
mlir/lib/Dialect/GPU/Transforms/AllReduceLowering.cpp
mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
mlir/lib/Dialect/Linalg/Transforms/Promotion.cpp
mlir/lib/Dialect/Quant/Utils/FakeQuantSupport.cpp
mlir/lib/Dialect/Quant/Utils/UniformSupport.cpp
mlir/lib/Dialect/SCF/Transforms/Utils.cpp
mlir/lib/Dialect/SPIRV/IR/TargetAndABI.cpp
mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
mlir/lib/Dialect/StandardOps/IR/Ops.cpp
mlir/lib/Dialect/Vector/VectorOps.cpp
mlir/lib/Dialect/Vector/VectorTransforms.cpp
mlir/lib/IR/Builders.cpp
mlir/lib/IR/BuiltinDialect.cpp
mlir/lib/IR/BuiltinTypes.cpp
mlir/lib/IR/Dialect.cpp
mlir/lib/IR/MLIRContext.cpp
mlir/lib/IR/Operation.cpp
mlir/lib/IR/Value.cpp
mlir/lib/Parser/DialectSymbolParser.cpp
mlir/lib/Parser/TypeParser.cpp
mlir/lib/Target/LLVMIR/ConvertFromLLVMIR.cpp
mlir/lib/Target/SPIRV/Deserialization.cpp
mlir/lib/Target/SPIRV/Serialization.cpp
mlir/lib/Transforms/BufferResultsToOutParams.cpp
mlir/lib/Transforms/NormalizeMemRefs.cpp
mlir/lib/Transforms/Utils/DialectConversion.cpp
mlir/test/EDSC/builder-api-test.cpp
mlir/test/lib/Dialect/Test/TestDialect.cpp
mlir/test/lib/Dialect/Test/TestPatterns.cpp
mlir/test/lib/Transforms/TestDecomposeCallGraphTypes.cpp
mlir/unittests/Dialect/Quant/QuantizationUtilsTest.cpp
mlir/unittests/IR/AttributeTest.cpp
mlir/unittests/TableGen/StructsGenTest.cpp

Removed: 




diff  --git a/flang/include/flang/Optimizer/Dialect/FIROps.td 
b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 8d7a6d4af950..cecd1cbbb46b 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2176,7 +2176,7 @@ def fir_DispatchOp : fir_Op<"dispatch",
 p.printOptionalAttrDict(getAttrs(), {"fn_type", "method"});
 auto resTy{getResultTypes()};
 llvm::SmallVector argTy(getOperandTypes());
-p << " : " << mlir::FunctionType::get(argTy, resTy, getContext());
+p << " : " << mlir::FunctionType::get(getContext(), argTy, resTy);
   }];
 
   let extraClassDeclaration = [{

diff  --git a/flang/lib/Lower/ConvertType.cpp b/flang/lib/Lower/ConvertType.cpp
index 746d7ade9972..b3fa85d4691d 100644
--- a/flang/lib/Lower/ConvertType.cpp
+++ b/flang/lib/Lower/ConvertType.cpp
@@ -49,7 +49,7 @@ mlir::Type genFIRType(mlir::MLIRContext *context) {
   if constexpr (TC == Fortran::common::TypeCategory::Integer) {
 auto bits{Fortran::evaluate::Type::Scalar::bits};
-return mlir::IntegerType::get(bits, context);
+return mlir::IntegerType::get(context, bits);
   } else if constexpr (TC == Fortran::common::TypeCategory::Logical ||
TC == Fortran::common::TypeCategory::Character ||
TC == Fortran::common::TypeCategory::Complex) {
@@ -278,7 +278,7 @@ class TypeBuilder {
 
   // some sequence of `n` bytes
   mlir::Type gen(const Fortran::evaluate::StaticDataObject::Pointer &ptr) {
-mlir::Type byteTy{mlir::IntegerType::get(8, context)};
+mlir::Type byteTy{mlir::IntegerType::get(context, 8)};
 return fir::SequenceType::get(trivialShape(ptr->itemBytes()), byteTy);
   }
 

diff  --git a/flang/lib/Lower/IntrinsicCall.cpp 
b/flang/lib/Lower/IntrinsicCall.cpp
index 0e0081ef664c..7053cd976

[llvm-branch-commits] [lld] f710bb7 - lld: Replace some lld::outs()s with message()

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T16:19:09-05:00
New Revision: f710bb7063b232be1cffc7a0f0f56606d7bff2ad

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

LOG: lld: Replace some lld::outs()s with message()

No behavior change.

Added: 


Modified: 
lld/COFF/Driver.cpp
lld/MachO/Driver.cpp
lld/MachO/DriverUtils.cpp

Removed: 




diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 504c00584d9c..08862b062f91 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1263,7 +1263,7 @@ void LinkerDriver::link(ArrayRef argsArr) {
   // because it doesn't start with "/", but we deliberately chose "--" to
   // avoid conflict with /version and for compatibility with clang-cl.
   if (args.hasArg(OPT_dash_dash_version)) {
-lld::outs() << getLLDVersion() << "\n";
+message(getLLDVersion());
 return;
   }
 

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index db89dd60a20b..4f9c111bd8fb 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -325,7 +325,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 // printArchiveMemberLoad() prints both .a and .o names, so no need to
 // print the .a name here.
 if (config->printEachFile && magic != file_magic::archive)
-  lld::outs() << toString(newFile) << '\n';
+  message(toString(newFile));
 inputFiles.insert(newFile);
   }
   return newFile;

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 5040f634e181..563ae266735d 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -208,7 +208,7 @@ uint32_t macho::getModTime(StringRef path) {
 
 void macho::printArchiveMemberLoad(StringRef reason, const InputFile *f) {
   if (config->printEachFile)
-lld::outs() << toString(f) << '\n';
+message(toString(f));
   if (config->printWhyLoad)
-lld::outs() << reason << " forced load of " << toString(f) << '\n';
+message(reason + " forced load of " + toString(f));
 }



___
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] [libcxx] 6340f89 - [libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for gcc)

2020-12-17 Thread Louis Dionne via llvm-branch-commits

Author: Azat Khuzhin
Date: 2020-12-17T16:20:24-05:00
New Revision: 6340f890bb86b6ec1e72047d4c4560ee0dfe6d90

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

LOG: [libc++] Fix extern C for __sanitizer_annotate_contiguous_container() (for 
gcc)

gcc supports it only at the beginning:

$ g++ -o /dev/null -c /tmp/test_extern.cpp
$ cat /tmp/test_extern.cpp
extern "C" __attribute__ ((__visibility__("default"))) int foo();

Otherwise:

$ g++ -o /dev/null -c /tmp/test_extern.cpp
/tmp/test_extern.cpp:1:52: error: expected unqualified-id before string 
constant
1 | __attribute__ ((__visibility__("default"))) extern "C" int foo();
  |^~~
$ cat /tmp/test_extern.cpp
__attribute__ ((__visibility__("default"))) extern "C" int foo();

Reviewed By: #libc, ldionne

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

Added: 


Modified: 
libcxx/include/__config

Removed: 




diff  --git a/libcxx/include/__config b/libcxx/include/__config
index 033cd8aea068..9f49e805d61b 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1082,7 +1082,7 @@ typedef unsigned int   char32_t;
 #endif
 
 #ifndef _LIBCPP_HAS_NO_ASAN
-_LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
+extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
   const void *, const void *, const void *, const void *);
 #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] c755e41 - Fix -Wno-error= parsing in clang-format.

2020-12-17 Thread Joachim Meyer via llvm-branch-commits

Author: Joachim Meyer
Date: 2020-12-17T22:23:42+01:00
New Revision: c755e41c336c898873db6c3c58a2819a982f60de

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

LOG: Fix -Wno-error= parsing in clang-format.

As noted in https://reviews.llvm.org/D86137#2460135 parsing of
the clang-format parameter -Wno-error=unknown fails.
This currently is done by having `-Wno-error=unknown` as an option.
In this patch this is changed to make `-Wno-error=` parse an enum into a bit 
set.
This way the parsing is fixed and also we can possibly add new options easily.

Reviewed By: MyDeveloperDay

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

Added: 
clang/test/Format/error-config.cpp

Modified: 
clang/docs/ClangFormat.rst
clang/tools/clang-format/ClangFormat.cpp

Removed: 




diff  --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst
index b746ed3453df..d5333c0032b4 100644
--- a/clang/docs/ClangFormat.rst
+++ b/clang/docs/ClangFormat.rst
@@ -31,12 +31,13 @@ to format C/C++/Java/JavaScript/Objective-C/Protobuf/C# 
code.
   Clang-format options:
 
 --Werror   - If set, changes formatting warnings to errors
---Wno-error=unknown- If set, unknown format options are only 
warned about.
- This can be used to enable formatting, even 
if the
- configuration contains unknown (newer) 
options.
- Use with caution, as this might lead to 
dramatically
- 
diff ering format depending on an option being
- supported or not.
+--Wno-error=- If set don't error out on the specified 
warning type.
+  =unknown -   If set, unknown format options are only 
warned about.
+   This can be used to enable formatting, even 
if the
+   configuration contains unknown (newer) 
options.
+   Use with caution, as this might lead to 
dramatically
+   
diff ering format depending on an option being
+   supported or not.
 --assume-filename= - Override filename used to determine the 
language.
  When reading from stdin, clang-format assumes 
this
  filename to determine the language.

diff  --git a/clang/test/Format/error-config.cpp 
b/clang/test/Format/error-config.cpp
new file mode 100644
index ..7fbc869f3a3c
--- /dev/null
+++ b/clang/test/Format/error-config.cpp
@@ -0,0 +1,11 @@
+// RUN: clang-format %s --Wno-error=unknown --style="{UnknownKey: true}" 2>&1 
| FileCheck %s -check-prefix=CHECK
+// RUN: not clang-format %s --style="{UnknownKey: true}" 2>&1 | FileCheck %s 
-check-prefix=CHECK-FAIL
+
+// CHECK: YAML:1:2: warning: unknown key 'UnknownKey'
+// CHECK-NEXT: {UnknownKey: true}
+// CHECK-NEXT: ^~
+// CHECK-FAIL: YAML:1:2: error: unknown key 'UnknownKey'
+// CHECK-FAIL-NEXT: {UnknownKey: true}
+// CHECK-FAIL-NEXT: ^~
+
+int i ;

diff  --git a/clang/tools/clang-format/ClangFormat.cpp 
b/clang/tools/clang-format/ClangFormat.cpp
index a1b42a6d0940..64f0e2badf33 100644
--- a/clang/tools/clang-format/ClangFormat.cpp
+++ b/clang/tools/clang-format/ClangFormat.cpp
@@ -104,18 +104,6 @@ static cl::opt SortIncludes(
  "SortIncludes style flag"),
 cl::cat(ClangFormatCategory));
 
-// using the full param name as Wno-error probably won't be a common use case 
in
-// clang-format
-static cl::opt AllowUnknownOptions(
-"Wno-error=unknown",
-cl::desc("If set, unknown format options are only warned about.\n"
- "This can be used to enable formatting, even if the\n"
- "configuration contains unknown (newer) options.\n"
- "Use with caution, as this might lead to dramatically\n"
- "
diff ering format depending on an option being\n"
- "supported or not."),
-cl::init(false), cl::cat(ClangFormatCategory));
-
 static cl::opt
 Verbose("verbose", cl::desc("If set, shows the list of processed files"),
 cl::cat(ClangFormatCategory));
@@ -156,6 +144,23 @@ static cl::opt
  cl::desc("If set, changes formatting warnings to errors"),
  cl::cat(ClangFormatCategory));
 
+namespace {
+enum class WNoError { Unknown };
+}
+
+static cl::bits WNoErrorList(
+"Wno-error",
+cl::desc("If set don't error out on the specified warning type."),
+cl::values(
+clEnumValN(WNoError::Unknown, "unknown",
+   "If set, unknown format options are only warned about.\n"
+   "This can be used to enable f

[llvm-branch-commits] [llvm] 164e084 - [SimplifyCFG] DeleteDeadBlock() already knows how to preserve DomTree

2020-12-17 Thread Roman Lebedev via llvm-branch-commits

Author: Roman Lebedev
Date: 2020-12-18T00:37:21+03:00
New Revision: 164e0847a59995c0e602c9e708dfb2bf41494780

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

LOG: [SimplifyCFG] DeleteDeadBlock() already knows how to preserve DomTree

... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.

Added: 


Modified: 
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/GVNSink/indirect-call.ll
llvm/test/Transforms/GVNSink/sink-common-code.ll
llvm/test/Transforms/IndVarSimplify/loop_evaluate_1.ll
llvm/test/Transforms/IndVarSimplify/loop_evaluate_2.ll
llvm/test/Transforms/JumpThreading/lvi-tristate.ll
llvm/test/Transforms/LoopDeletion/simplify-then-delete.ll
llvm/test/Transforms/LoopVectorize/if-pred-non-void.ll
llvm/test/Transforms/PhaseOrdering/unsigned-multiply-overflow-check.ll
llvm/test/Transforms/SimplifyCFG/2005-06-16-PHICrash.ll
llvm/test/Transforms/SimplifyCFG/2006-12-08-Ptr-ICmp-Branch.ll
llvm/test/Transforms/SimplifyCFG/2008-12-06-SingleEntryPhi.ll
llvm/test/Transforms/SimplifyCFG/2008-12-16-DCECond.ll
llvm/test/Transforms/SimplifyCFG/2009-01-18-PHIPropCrash.ll
llvm/test/Transforms/SimplifyCFG/ARM/branch-fold-threshold.ll
llvm/test/Transforms/SimplifyCFG/ARM/phi-eliminate.ll
llvm/test/Transforms/SimplifyCFG/ARM/select-trunc-i64.ll
llvm/test/Transforms/SimplifyCFG/ARM/speculate-math.ll
llvm/test/Transforms/SimplifyCFG/BrUnwind.ll
llvm/test/Transforms/SimplifyCFG/ConditionalTrappingConstantExpr.ll
llvm/test/Transforms/SimplifyCFG/DeadSetCC.ll
llvm/test/Transforms/SimplifyCFG/HoistCode.ll
llvm/test/Transforms/SimplifyCFG/PR25267.ll
llvm/test/Transforms/SimplifyCFG/PR9946.ll
llvm/test/Transforms/SimplifyCFG/PhiBlockMerge.ll
llvm/test/Transforms/SimplifyCFG/PhiEliminate2.ll
llvm/test/Transforms/SimplifyCFG/RISCV/select-trunc-i64.ll
llvm/test/Transforms/SimplifyCFG/UncondBranchToReturn.ll
llvm/test/Transforms/SimplifyCFG/X86/CoveredLookupTable.ll
llvm/test/Transforms/SimplifyCFG/X86/PR29163.ll
llvm/test/Transforms/SimplifyCFG/X86/SpeculativeExec.ll
llvm/test/Transforms/SimplifyCFG/X86/pr39187-g.ll
llvm/test/Transforms/SimplifyCFG/X86/safe-low-bit-extract.ll
llvm/test/Transforms/SimplifyCFG/X86/speculate-cttz-ctlz.ll
llvm/test/Transforms/SimplifyCFG/X86/switch-covered-bug.ll
llvm/test/Transforms/SimplifyCFG/X86/switch-table-bug.ll
llvm/test/Transforms/SimplifyCFG/annotations.ll
llvm/test/Transforms/SimplifyCFG/basictest.ll
llvm/test/Transforms/SimplifyCFG/bbi-23595.ll
llvm/test/Transforms/SimplifyCFG/branch-fold-dbg.ll
llvm/test/Transforms/SimplifyCFG/branch-fold-threshold.ll
llvm/test/Transforms/SimplifyCFG/clamp.ll
llvm/test/Transforms/SimplifyCFG/common-dest-folding.ll
llvm/test/Transforms/SimplifyCFG/fold-debug-location.ll
llvm/test/Transforms/SimplifyCFG/hoist-common-code.ll
llvm/test/Transforms/SimplifyCFG/hoist-dbgvalue-inlined.ll
llvm/test/Transforms/SimplifyCFG/hoist-with-range.ll
llvm/test/Transforms/SimplifyCFG/no-md-sink.ll
llvm/test/Transforms/SimplifyCFG/opt-for-fuzzing.ll
llvm/test/Transforms/SimplifyCFG/pr39807.ll
llvm/test/Transforms/SimplifyCFG/preserve-branchweights.ll
llvm/test/Transforms/SimplifyCFG/rangereduce.ll
llvm/test/Transforms/SimplifyCFG/safe-abs.ll
llvm/test/Transforms/SimplifyCFG/signbit-like-value-extension.ll
llvm/test/Transforms/SimplifyCFG/speculate-math.ll
llvm/test/Transforms/SimplifyCFG/speculate-with-offset.ll
llvm/test/Transforms/SimplifyCFG/switch-masked-bits.ll
llvm/test/Transforms/SimplifyCFG/switch-on-const-select.ll
llvm/test/Transforms/SimplifyCFG/switch-simplify-crash.ll
llvm/test/Transforms/SimplifyCFG/switch-to-icmp.ll
llvm/test/Transforms/SimplifyCFG/switch-to-select-two-case.ll
llvm/test/Transforms/SimplifyCFG/switch_switch_fold.ll
llvm/test/Transforms/SimplifyCFG/switch_thread.ll
llvm/test/Transforms/SimplifyCFG/unsigned-multiplication-will-overflow.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp 
b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 0c693a8d27be..f39ab25ee64a 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -6316,7 +6316,7 @@ bool SimplifyCFGOpt::simplifyOnce(BasicBlock *BB) {
   if ((pred_empty(BB) && BB != &BB->getParent()->getEntryBlock()) ||
   BB->getSinglePredecessor() == BB) {
 LLVM_DEBUG(dbgs() << "Removing BB: \n" << *BB);
-DeleteDeadBlock(BB);
+DeleteDeadBlock(BB, DTU);
 return true;
   }
 

diff  --git a/llvm/test/Transforms/GVN

  1   2   >