[llvm-branch-commits] [llvm] 28fdeea - [PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.

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

Author: Esme-Yi
Date: 2020-12-07T05:19:06Z
New Revision: 28fdeea9522fd2538773dc0d969dcb155b067e2e

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

LOG: [PowerPC] Add support for intrinsics dcbfps and dcbstps in P10.

Summary: This patch added support for the intrinsics llvm.ppc.dcbfps and 
llvm.ppc.dcbstps.
dcbfps and dcbstps are actually extended mnemonics of dcbf.
dcbfps RA,RB ---> dcbf RA,RB,4
dcbstps RA,RB ---> dcbf RA,RB,6

Reviewed By: amyk, steven.zhang

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

Added: 
llvm/test/CodeGen/PowerPC/dcbf-p10.ll

Modified: 
llvm/include/llvm/IR/IntrinsicsPowerPC.td
llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
llvm/lib/Target/PowerPC/PPCInstrInfo.td

Removed: 




diff  --git a/llvm/include/llvm/IR/IntrinsicsPowerPC.td 
b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
index fa5000d42482..8db5c15fe761 100644
--- a/llvm/include/llvm/IR/IntrinsicsPowerPC.td
+++ b/llvm/include/llvm/IR/IntrinsicsPowerPC.td
@@ -18,10 +18,12 @@
 let TargetPrefix = "ppc" in {  // All intrinsics start with "llvm.ppc.".
   // dcba/dcbf/dcbi/dcbst/dcbt/dcbz/dcbzl(PPC970) instructions.
   def int_ppc_dcba  : Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbf  : GCCBuiltin<"__builtin_dcbf">,
-  Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbfl : Intrinsic<[], [llvm_ptr_ty], []>;
-  def int_ppc_dcbflp: Intrinsic<[], [llvm_ptr_ty], []>;
+  def int_ppc_dcbf : GCCBuiltin<"__builtin_dcbf">,
+  Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbfl : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbflp : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbfps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
+  def int_ppc_dcbstps : Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly]>;
   def int_ppc_dcbi  : Intrinsic<[], [llvm_ptr_ty], []>;
   def int_ppc_dcbst : Intrinsic<[], [llvm_ptr_ty], []>;
   def int_ppc_dcbt  : Intrinsic<[], [llvm_ptr_ty],

diff  --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp 
b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
index 748716126836..2ff87c20ab25 100644
--- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
+++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
@@ -774,12 +774,18 @@ void PPCAsmParser::ProcessInstruction(MCInst ,
   }
   case PPC::DCBFx:
   case PPC::DCBFL:
-  case PPC::DCBFLP: {
+  case PPC::DCBFLP:
+  case PPC::DCBFPS:
+  case PPC::DCBSTPS: {
 int L = 0;
 if (Opcode == PPC::DCBFL)
   L = 1;
 else if (Opcode == PPC::DCBFLP)
   L = 3;
+else if (Opcode == PPC::DCBFPS)
+  L = 4;
+else if (Opcode == PPC::DCBSTPS)
+  L = 6;
 
 MCInst TmpInst;
 TmpInst.setOpcode(PPC::DCBF);

diff  --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp 
b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
index 1a481efbc3b5..e77d7b3d892c 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp
@@ -184,12 +184,18 @@ void PPCInstPrinter::printInst(const MCInst *MI, uint64_t 
Address,
 
   if (MI->getOpcode() == PPC::DCBF) {
 unsigned char L = MI->getOperand(0).getImm();
-if (!L || L == 1 || L == 3) {
-  O << "\tdcbf";
-  if (L == 1 || L == 3)
+if (!L || L == 1 || L == 3 || L == 4 || L == 6) {
+  O << "\tdcb";
+  if (L != 6)
+O << "f";
+  if (L == 1)
 O << "l";
   if (L == 3)
-O << "p";
+O << "lp";
+  if (L == 4)
+O << "ps";
+  if (L == 6)
+O << "stps";
   O << " ";
 
   printOperand(MI, 1, O);

diff  --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td 
b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
index 2dc575923da7..c388ae75950f 100644
--- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td
+++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td
@@ -4609,6 +4609,16 @@ def : Pat<(int_ppc_dcbfl xoaddr:$dst),
 def : Pat<(int_ppc_dcbflp xoaddr:$dst),
   (DCBF 3, xoaddr:$dst)>;
 
+let Predicates = [IsISA3_1] in {
+  def DCBFPS  : PPCAsmPseudo<"dcbfps $dst", (ins memrr:$dst)>;
+  def DCBSTPS : PPCAsmPseudo<"dcbstps $dst", (ins memrr:$dst)>;
+
+  def : Pat<(int_ppc_dcbfps xoaddr:$dst),
+(DCBF 4, xoaddr:$dst)>;
+  def : Pat<(int_ppc_dcbstps xoaddr:$dst),
+(DCBF 6, xoaddr:$dst)>;
+}
+
 def : InstAlias<"crset $bx", (CREQV crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>;
 def : InstAlias<"crclr $bx", (CRXOR crbitrc:$bx, crbitrc:$bx, crbitrc:$bx)>;
 def : InstAlias<"crmove $bx, $by", (CROR crbitrc:$bx, crbitrc:$by, 
crbitrc:$by)>;

diff  --git a/llvm/test/CodeGen/PowerPC/dcbf-p10.ll 
b/llvm/test/CodeGen/PowerPC/dcbf-p10.ll
new file mode 100644
index 

[llvm-branch-commits] [mlir] c11d868 - [MLIR, OpenMP] Added support for lowering MasterOp to LLVMIR

2020-12-06 Thread Sourabh Singh Tomar via llvm-branch-commits

Author: Sourabh Singh Tomar
Date: 2020-12-07T10:23:54+05:30
New Revision: c11d868a39cbb7ff535eed906e181a18c02001eb

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

LOG: [MLIR,OpenMP] Added support for lowering MasterOp to LLVMIR

Some Ops in OMP dialect have regions associated with them i.e
`ParallelOp` `MasterOp`. Lowering of these regions involves interfacing
with `OMPIRBuilder` using callbacks, yet there still exist opportunities
for sharing common code in between.

This patch factors out common code into a separate function and adds
support for lowering `MasterOp` using that. Lowering of `ParallelOp` is
also modified appropriately.

Reviewed By: ftynse

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

Added: 


Modified: 
mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
mlir/test/Target/openmp-llvm.mlir

Removed: 




diff  --git a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h 
b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
index 45c09ce83d26..996c8de06e37 100644
--- a/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
+++ b/mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h
@@ -91,7 +91,15 @@ class ModuleTranslation {
 llvm::IRBuilder<> );
   virtual LogicalResult convertOmpParallel(Operation ,
llvm::IRBuilder<> );
-
+  virtual LogicalResult convertOmpMaster(Operation ,
+ llvm::IRBuilder<> );
+  void convertOmpOpRegions(Region ,
+   DenseMap ,
+   DenseMap ,
+   llvm::Instruction *codeGenIPBBTI,
+   llvm::BasicBlock ,
+   llvm::IRBuilder<> ,
+   LogicalResult );
   /// Converts the type from MLIR LLVM dialect to LLVM.
   llvm::Type *convertType(LLVMType type);
 

diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp 
b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index e73ac109079d..c20b19f2d5ca 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -385,6 +385,9 @@ LogicalResult
 ModuleTranslation::convertOmpParallel(Operation ,
   llvm::IRBuilder<> ) {
   using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
+  // TODO: support error propagation in OpenMPIRBuilder and use it instead of
+  // relying on captured variables.
+  LogicalResult bodyGenStatus = success();
 
   auto bodyGenCB = [&](InsertPointTy allocaIP, InsertPointTy codeGenIP,
llvm::BasicBlock ) {
@@ -402,31 +405,10 @@ ModuleTranslation::convertOmpParallel(Operation ,
   blockMapping[] = llvmBB;
 }
 
-// Then, convert blocks one by one in topological order to ensure
-// defs are converted before uses.
-llvm::SetVector blocks = topologicalSort(region);
-for (auto indexedBB : llvm::enumerate(blocks)) {
-  Block *bb = indexedBB.value();
-  llvm::BasicBlock *curLLVMBB = blockMapping[bb];
-  if (bb->isEntryBlock()) {
-assert(codeGenIPBBTI->getNumSuccessors() == 1 &&
-   "OpenMPIRBuilder provided entry block has multiple successors");
-assert(codeGenIPBBTI->getSuccessor(0) ==  &&
-   "ContinuationIP is not the successor of OpenMPIRBuilder "
-   "provided entry block");
-codeGenIPBBTI->setSuccessor(0, curLLVMBB);
-  }
-
-  // TODO: Error not returned up the hierarchy
-  if (failed(convertBlock(*bb, /*ignoreArguments=*/indexedBB.index() == 
0)))
-return;
-}
-
+convertOmpOpRegions(region, valueMapping, blockMapping, codeGenIPBBTI,
+continuationIP, builder, bodyGenStatus);
 ompContinuationIPStack.pop_back();
 
-// Finally, after all blocks have been traversed and values mapped,
-// connect the PHI nodes to the results of preceding blocks.
-connectPHINodes(region, valueMapping, blockMapping);
   };
 
   // TODO: Perform appropriate actions according to the data-sharing
@@ -459,12 +441,79 @@ ModuleTranslation::convertOmpParallel(Operation ,
   // entry or the alloca insertion point as provided by the body callback
   // above.
   llvm::OpenMPIRBuilder::InsertPointTy allocaIP(builder.saveIP());
+  if (failed(bodyGenStatus))
+return failure();
   builder.restoreIP(
   ompBuilder->createParallel(builder, allocaIP, bodyGenCB, privCB, finiCB,
  ifCond, numThreads, pbKind, isCancellable));
   return success();
 }
 
+void ModuleTranslation::convertOmpOpRegions(
+Region , DenseMap ,
+DenseMap ,
+llvm::Instruction *codeGenIPBBTI, llvm::BasicBlock 

[llvm-branch-commits] [clang] 5755522 - Sema.h: delete unused variables/functions/type aliases

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

Author: Fangrui Song
Date: 2020-12-06T20:39:01-08:00
New Revision: 5755522b5a8be69d8a9f3b05c5e7078298d0d581

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

LOG: Sema.h: delete unused variables/functions/type aliases

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaTemplate.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index c2fc5dface7f..4eddd07f66d0 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -1072,10 +1072,6 @@ class Sema final {
   /// have been declared.
   bool GlobalNewDeleteDeclared;
 
-  /// A flag to indicate that we're in a context that permits abstract
-  /// references to fields.  This is really a
-  bool AllowAbstractFieldReference;
-
   /// Describes how the expressions currently being parsed are
   /// evaluated at run-time, if at all.
   enum class ExpressionEvaluationContext {
@@ -1134,9 +1130,6 @@ class Sema final {
 /// Whether the enclosing context needed a cleanup.
 CleanupInfo ParentCleanup;
 
-/// Whether we are in a decltype expression.
-bool IsDecltype;
-
 /// The number of active cleanup objects when we entered
 /// this expression evaluation context.
 unsigned NumCleanupObjects;
@@ -1635,7 +1628,6 @@ class Sema final {
 llvm::Optional ImmediateDiag;
 llvm::Optional PartialDiagId;
   };
-  using DiagBuilderT = SemaDiagnosticBuilder;
 
   /// Is the last error level diagnostic immediate. This is used to determined
   /// whether the next info diagnostic should be immediate.
@@ -2810,12 +2802,6 @@ class Sema final {
   /// and partial specializations are visible, and diagnose if not.
   void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec);
 
-  /// We've found a use of a template specialization that would select a
-  /// partial specialization. Check that the partial specialization is visible,
-  /// and diagnose if not.
-  void checkPartialSpecializationVisibility(SourceLocation Loc,
-NamedDecl *Spec);
-
   /// Retrieve a suitable printing policy for diagnostics.
   PrintingPolicy getPrintingPolicy() const {
 return getPrintingPolicy(Context, PP);

diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 5710f9e3daad..a465c6594851 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -4,14 +4,3 @@ void 
Sema::checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec) {
 
   ExplicitSpecializationVisibilityChecker(*this, Loc).check(Spec);
 }
-
-/// Check whether a template partial specialization that we've discovered
-/// is hidden, and produce suitable diagnostics if so.
-void Sema::checkPartialSpecializationVisibility(SourceLocation Loc,
-NamedDecl *Spec) {
-  llvm::SmallVector Modules;
-  if (!hasVisibleDeclaration(Spec, ))
-diagnoseMissingImport(Loc, Spec, Spec->getLocation(), Modules,
-  MissingImportKind::PartialSpecialization,
-  /*Recover*/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] 192fb1b - [Sema] Delete unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T20:16:00-08:00
New Revision: 192fb1bd8ac6a59fb2efd528038fd13c53e9ff46

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

LOG: [Sema] Delete unused declarations

Notes about some declarations:

* clang::Sema::endsWithnarrowing: deleted by rC148381
* clang::Sema::ConvertIntegerToTypeWarnOnOverflow: deleted by rC214678
* clang::Sema::FreePackedContext: deleted by rC268085
* clang::Sema::ComputeDefaulted*: deleted by rC296067

Added: 


Modified: 
clang/include/clang/Sema/CodeCompleteConsumer.h
clang/include/clang/Sema/Initialization.h
clang/include/clang/Sema/Sema.h

Removed: 




diff  --git a/clang/include/clang/Sema/CodeCompleteConsumer.h 
b/clang/include/clang/Sema/CodeCompleteConsumer.h
index 7293784f894b..87646ab95025 100644
--- a/clang/include/clang/Sema/CodeCompleteConsumer.h
+++ b/clang/include/clang/Sema/CodeCompleteConsumer.h
@@ -992,9 +992,6 @@ inline bool operator>=(const CodeCompletionResult ,
   return !(X < Y);
 }
 
-raw_ostream <<(raw_ostream ,
-  const CodeCompletionString );
-
 /// Abstract interface for a consumer of code-completion
 /// information.
 class CodeCompleteConsumer {

diff  --git a/clang/include/clang/Sema/Initialization.h 
b/clang/include/clang/Sema/Initialization.h
index 2245c1505001..8115f69f4df3 100644
--- a/clang/include/clang/Sema/Initialization.h
+++ b/clang/include/clang/Sema/Initialization.h
@@ -1226,17 +1226,6 @@ class InitializationSequence {
   /// constructor.
   bool isConstructorInitialization() const;
 
-  /// Returns whether the last step in this initialization sequence is a
-  /// narrowing conversion, defined by C++0x [dcl.init.list]p7.
-  ///
-  /// If this function returns true, *isInitializerConstant will be set to
-  /// describe whether *Initializer was a constant expression.  If
-  /// *isInitializerConstant is set to true, *ConstantValue will be set to the
-  /// evaluated value of *Initializer.
-  bool endsWithNarrowing(ASTContext , const Expr *Initializer,
- bool *isInitializerConstant,
- APValue *ConstantValue) const;
-
   /// Add a new step in the initialization that resolves the address
   /// of an overloaded function to a specific function declaration.
   ///
@@ -1362,10 +1351,6 @@ class InitializationSequence {
   /// from a zero constant.
   void AddOCLZeroOpaqueTypeStep(QualType T);
 
-  /// Add a step to initialize by zero types defined in the
-  /// cl_intel_device_side_avc_motion_estimation OpenCL extension
-  void AddOCLIntelSubgroupAVCZeroInitStep(QualType T);
-
   /// Add steps to unwrap a initializer list for a reference around a
   /// single element and rewrap it at the end.
   void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic);

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 980be69cb1a5..c2fc5dface7f 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -455,11 +455,7 @@ class Sema final {
 std::string SectionName;
 bool Valid = false;
 SourceLocation PragmaLocation;
-
-void Act(SourceLocation PragmaLocation,
- PragmaClangSectionAction Action,
- StringLiteral* Name);
-   };
+  };
 
PragmaClangSection PragmaClangBSSSection;
PragmaClangSection PragmaClangDataSection;
@@ -5713,45 +5709,6 @@ class Sema final {
 }
   };
 
-  /// Determine what sort of exception specification a defaulted
-  /// copy constructor of a class will have.
-  ImplicitExceptionSpecification
-  ComputeDefaultedDefaultCtorExceptionSpec(SourceLocation Loc,
-   CXXMethodDecl *MD);
-
-  /// Determine what sort of exception specification a defaulted
-  /// default constructor of a class will have, and whether the parameter
-  /// will be const.
-  ImplicitExceptionSpecification
-  ComputeDefaultedCopyCtorExceptionSpec(CXXMethodDecl *MD);
-
-  /// Determine what sort of exception specification a defaulted
-  /// copy assignment operator of a class will have, and whether the
-  /// parameter will be const.
-  ImplicitExceptionSpecification
-  ComputeDefaultedCopyAssignmentExceptionSpec(CXXMethodDecl *MD);
-
-  /// Determine what sort of exception specification a defaulted move
-  /// constructor of a class will have.
-  ImplicitExceptionSpecification
-  ComputeDefaultedMoveCtorExceptionSpec(CXXMethodDecl *MD);
-
-  /// Determine what sort of exception specification a defaulted move
-  /// assignment operator of a class will have.
-  ImplicitExceptionSpecification
-  ComputeDefaultedMoveAssignmentExceptionSpec(CXXMethodDecl *MD);
-
-  /// Determine what sort of exception specification a defaulted
-  /// destructor of a class will have.
-  

[llvm-branch-commits] [llvm] 365c405 - [CSKY 2/n] Add basic tablegen infra for CSKY

2020-12-06 Thread Zi Xuan Wu via llvm-branch-commits

Author: Zi Xuan Wu
Date: 2020-12-07T11:56:09+08:00
New Revision: 365c405411461cbaa6abed6746e68faeb3f00995

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

LOG: [CSKY 2/n] Add basic tablegen infra for CSKY

This introduce basic tablegen infra such as 
CSKY{InstrFormats,InstrInfo,RegisterInfo,}.td.
For now, only add instruction definitions for basic CSKY ISA operations, and 
the instruction format and register info are almost complete.

Our initial target is a working MC layer rather than codegen, so appropriate 
SelectionDAG patterns will come later.

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

Added: 
llvm/lib/Target/CSKY/CSKY.td
llvm/lib/Target/CSKY/CSKYInstrFormats.td
llvm/lib/Target/CSKY/CSKYInstrInfo.td
llvm/lib/Target/CSKY/CSKYRegisterInfo.td

Modified: 
llvm/lib/Target/CSKY/CMakeLists.txt

Removed: 




diff  --git a/llvm/lib/Target/CSKY/CMakeLists.txt 
b/llvm/lib/Target/CSKY/CMakeLists.txt
index 51b7b02e727b..390b8ea4c8ce 100644
--- a/llvm/lib/Target/CSKY/CMakeLists.txt
+++ b/llvm/lib/Target/CSKY/CMakeLists.txt
@@ -1,5 +1,12 @@
 add_llvm_component_group(CSKY)
 
+set(LLVM_TARGET_DEFINITIONS CSKY.td)
+
+tablegen(LLVM CSKYGenRegisterInfo.inc -gen-register-info)
+tablegen(LLVM CSKYGenInstrInfo.inc -gen-instr-info)
+
+add_public_tablegen_target(CSKYCommonTableGen)
+
 add_llvm_target(CSKYCodeGen
   CSKYTargetMachine.cpp
 

diff  --git a/llvm/lib/Target/CSKY/CSKY.td b/llvm/lib/Target/CSKY/CSKY.td
new file mode 100644
index ..da6151befa1b
--- /dev/null
+++ b/llvm/lib/Target/CSKY/CSKY.td
@@ -0,0 +1,32 @@
+//===-- CSKY.td - Describe the CSKY Target Machine -*- tablegen 
-*-===//
+//
+// 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
+//
+//===--===//
+
+include "llvm/Target/Target.td"
+
+//===--===//
+// Registers, calling conventions, instruction descriptions.
+//===--===//
+
+include "CSKYRegisterInfo.td"
+include "CSKYInstrInfo.td"
+
+//===--===//
+// CSKY processors supported.
+//===--===//
+
+def : ProcessorModel<"generic-csky", NoSchedModel, []>;
+
+//===--===//
+// Define the CSKY target.
+//===--===//
+
+def CSKYInstrInfo : InstrInfo;
+
+def CSKY : Target {
+  let InstructionSet = CSKYInstrInfo;
+}

diff  --git a/llvm/lib/Target/CSKY/CSKYInstrFormats.td 
b/llvm/lib/Target/CSKY/CSKYInstrFormats.td
new file mode 100644
index ..86f9dd0b7da3
--- /dev/null
+++ b/llvm/lib/Target/CSKY/CSKYInstrFormats.td
@@ -0,0 +1,528 @@
+//===-- CSKYInstrFormats.td - CSKY Instruction Formats -*- tablegen 
-*-===//
+//
+// 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
+//
+//===--===//
+
+class AddrMode val> {
+  bits<5> Value = val;
+}
+
+def AddrModeNone : AddrMode<0>;
+def AddrMode32B : AddrMode<1>;   // ld32.b, ld32.bs, st32.b, st32.bs, +4kb
+def AddrMode32H : AddrMode<2>;   // ld32.h, ld32.hs, st32.h, st32.hs, +8kb
+def AddrMode32WD : AddrMode<3>;  // ld32.w, st32.w, ld32.d, st32.d, +16kb
+def AddrMode16B : AddrMode<4>;   // ld16.b, +32b
+def AddrMode16H : AddrMode<5>;   // ld16.h, +64b
+def AddrMode16W : AddrMode<6>;   // ld16.w, +128b or +1kb
+def AddrMode32SDF : AddrMode<7>; // flds, fldd, +1kb
+
+class CSKYInst pattern> : Instruction {
+  let Namespace = "CSKY";
+  int Size = sz;
+  AddrMode AM = am;
+
+  let OutOperandList = outs;
+  let InOperandList = ins;
+  let AsmString = asmstr;
+  let Pattern = pattern;
+  let Itinerary = NoItinerary;
+  let TSFlags{4 - 0} = AM.Value;
+}
+
+class CSKYPseudo pattern>
+: CSKYInst {
+  let isCodeGenOnly = 1;
+  let isPseudo = 1;
+}
+
+class CSKY32Inst opcode, dag outs, dag ins, string asmstr,
+ list pattern>
+: CSKYInst {
+  field bits<32> Inst;
+  let Inst{31 - 26} = opcode;
+}
+
+// CSKY 32-bit instruction
+// Format< OP[6] | Offset[26] >
+// Instruction(1): bsr32
+class J opcode, dag outs, dag ins, string op, list pattern>
+: CSKY32Inst {
+  bits<26> offset;
+  let Inst{25 - 0} = offset;
+}
+
+// Format< OP[6] | RZ[5] | 

[llvm-branch-commits] [llvm] efdd463 - [PowerPC] Fix chain for i1-to-fp operation

2020-12-06 Thread Qiu Chaofan via llvm-branch-commits

Author: Qiu Chaofan
Date: 2020-12-07T10:38:56+08:00
New Revision: efdd4630507edfe13851475de5d16cc248aacd15

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

LOG: [PowerPC] Fix chain for i1-to-fp operation

A simple SELECT is used for converting i1 to floating types on ppc32,
but in constrained cases, the chain is not handled properly. This patch
will fix that.

Reviewed By: steven.zhang

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

Added: 
llvm/test/CodeGen/PowerPC/i1-to-fp-chain.ll

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

Removed: 




diff  --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp 
b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
index c5dbacde6fa5..90968a3ef8a7 100644
--- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp
@@ -8718,10 +8718,15 @@ SDValue PPCTargetLowering::LowerINT_TO_FP(SDValue Op,
   if (Op.getValueType() != MVT::f32 && Op.getValueType() != MVT::f64)
 return SDValue();
 
-  if (Src.getValueType() == MVT::i1)
-return DAG.getNode(ISD::SELECT, dl, Op.getValueType(), Src,
-   DAG.getConstantFP(1.0, dl, Op.getValueType()),
-   DAG.getConstantFP(0.0, dl, Op.getValueType()));
+  if (Src.getValueType() == MVT::i1) {
+SDValue Sel = DAG.getNode(ISD::SELECT, dl, Op.getValueType(), Src,
+  DAG.getConstantFP(1.0, dl, Op.getValueType()),
+  DAG.getConstantFP(0.0, dl, Op.getValueType()));
+if (IsStrict)
+  return DAG.getMergeValues({Sel, Chain}, dl);
+else
+  return Sel;
+  }
 
   // If we have direct moves, we can do all the conversion, skip the store/load
   // however, without FPCVT we can't do most conversions.

diff  --git a/llvm/test/CodeGen/PowerPC/i1-to-fp-chain.ll 
b/llvm/test/CodeGen/PowerPC/i1-to-fp-chain.ll
new file mode 100644
index ..082c23941cf7
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/i1-to-fp-chain.ll
@@ -0,0 +1,59 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=ppc32 < %s | FileCheck %s
+
+@foo = dso_local global double 0.00e+00, align 8
+
+; Verify the cases won't crash because of missing chains
+
+define double @u1tofp(i1 %i, double %d) #0 {
+; CHECK-LABEL: u1tofp:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:li 4, .LCPI0_0@l
+; CHECK-NEXT:andi. 3, 3, 1
+; CHECK-NEXT:addis 3, 4, .LCPI0_0@ha
+; CHECK-NEXT:li 4, .LCPI0_1@l
+; CHECK-NEXT:addis 4, 4, .LCPI0_1@ha
+; CHECK-NEXT:bc 12, 1, .LBB0_1
+; CHECK-NEXT:b .LBB0_2
+; CHECK-NEXT:  .LBB0_1: # %entry
+; CHECK-NEXT:addi 3, 4, 0
+; CHECK-NEXT:  .LBB0_2: # %entry
+; CHECK-NEXT:fmr 0, 1
+; CHECK-NEXT:lfs 1, 0(3)
+; CHECK-NEXT:lis 3, foo@ha
+; CHECK-NEXT:stfd 0, foo@l(3)
+; CHECK-NEXT:blr
+entry:
+  %conv = tail call double @llvm.experimental.constrained.uitofp.f64.i1(i1 %i, 
metadata !"round.dynamic", metadata !"fpexcept.strict") #0
+  store volatile double %d, double* @foo, align 8
+  ret double %conv
+}
+
+define double @s1tofp(i1 %i, double %d) #0 {
+; CHECK-LABEL: s1tofp:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:li 4, .LCPI1_0@l
+; CHECK-NEXT:andi. 3, 3, 1
+; CHECK-NEXT:addis 3, 4, .LCPI1_0@ha
+; CHECK-NEXT:li 4, .LCPI1_1@l
+; CHECK-NEXT:addis 4, 4, .LCPI1_1@ha
+; CHECK-NEXT:bc 12, 1, .LBB1_1
+; CHECK-NEXT:b .LBB1_2
+; CHECK-NEXT:  .LBB1_1: # %entry
+; CHECK-NEXT:addi 3, 4, 0
+; CHECK-NEXT:  .LBB1_2: # %entry
+; CHECK-NEXT:fmr 0, 1
+; CHECK-NEXT:lfs 1, 0(3)
+; CHECK-NEXT:lis 3, foo@ha
+; CHECK-NEXT:stfd 0, foo@l(3)
+; CHECK-NEXT:blr
+entry:
+  %conv = tail call double @llvm.experimental.constrained.sitofp.f64.i1(i1 %i, 
metadata !"round.dynamic", metadata !"fpexcept.strict") #0
+  store volatile double %d, double* @foo, align 8
+  ret double %conv
+}
+
+declare double @llvm.experimental.constrained.uitofp.f64.i1(i1, metadata, 
metadata)
+declare double @llvm.experimental.constrained.sitofp.f64.i1(i1, metadata, 
metadata)
+
+attributes #0 = { strictfp }



___
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] 216689a - [Coroutines] Add DW_OP_deref for transformed dbg.value intrinsic.

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

Author: Jun Ma
Date: 2020-12-07T10:24:44+08:00
New Revision: 216689ace71dee579c0e42f67978beb25f5f7df0

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

LOG: [Coroutines] Add DW_OP_deref for transformed dbg.value intrinsic.

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

Added: 


Modified: 
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll

Removed: 




diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp 
b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 1a000c1913c6..48d52ff1d8df 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -1289,7 +1289,9 @@ static Instruction *insertSpills(const FrameDataInfo 
,
   // that control flow can be later changed by other passes.
   auto *DI = cast(FirstDbgDecl);
   BasicBlock *CurrentBlock = I->getParent();
-  DIB.insertDbgValueIntrinsic(G, DI->getVariable(), DI->getExpression(),
+  auto *DerefExpr =
+  DIExpression::append(DI->getExpression(), dwarf::DW_OP_deref);
+  DIB.insertDbgValueIntrinsic(G, DI->getVariable(), DerefExpr,
   DI->getDebugLoc(),
   &*CurrentBlock->getFirstInsertionPt());
   SeenDbgBBs.insert(CurrentBlock);

diff  --git a/llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll 
b/llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
index 00a77cb790dc..68d496c880ff 100644
--- a/llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
+++ b/llvm/test/Transforms/Coroutines/coro-debug-frame-variable.ll
@@ -37,8 +37,8 @@
 ; CHECK: call void @llvm.dbg.declare(metadata i32* [[IGEP]], metadata 
![[IVAR:[0-9]+]], metadata !DIExpression()), !dbg ![[IDBGLOC:[0-9]+]]
 ; CHECK: call void @llvm.dbg.declare(metadata [10 x i32]* [[XGEP]], 
metadata ![[XVAR:[0-9]+]], metadata !DIExpression()), !dbg ![[IDBGLOC]]
 ; CHECK:   await.ready:
-; CHECK: call void @llvm.dbg.value(metadata [10 x i32]* [[XGEP]], 
metadata ![[XVAR]], metadata !DIExpression()), !dbg ![[IDBGLOC]]
-; CHECK: call void @llvm.dbg.value(metadata i32* [[IGEP]], metadata 
![[IVAR]], metadata !DIExpression()), !dbg ![[IDBGLOC]]
+; CHECK: call void @llvm.dbg.value(metadata [10 x i32]* [[XGEP]], 
metadata ![[XVAR]], metadata !DIExpression(DW_OP_deref)), !dbg ![[IDBGLOC]]
+; CHECK: call void @llvm.dbg.value(metadata i32* [[IGEP]], metadata 
![[IVAR]], metadata !DIExpression(DW_OP_deref)), !dbg ![[IDBGLOC]]
 ; CHECK: call void @llvm.dbg.declare(metadata i32* %j, metadata 
![[JVAR:[0-9]+]], metadata !DIExpression()), !dbg ![[JDBGLOC:[0-9]+]]
 ;
 ; CHECK-LABEL: define internal fastcc void @f.resume({{.*}}) {
@@ -50,8 +50,8 @@
 ; CHECK: call void @llvm.dbg.declare(metadata i32* [[IGEP_RESUME]], 
metadata ![[IVAR_RESUME:[0-9]+]], metadata !DIExpression()), !dbg 
![[IDBGLOC_RESUME:[0-9]+]]
 ; CHECK: call void @llvm.dbg.declare(metadata [10 x i32]* 
[[XGEP_RESUME]], metadata ![[XVAR_RESUME:[0-9]+]], metadata !DIExpression()), 
!dbg ![[IDBGLOC_RESUME]]
 ; CHECK:   await.ready:
-; CHECK: call void @llvm.dbg.value(metadata [10 x i32]* 
[[XGEP_RESUME]], metadata ![[XVAR_RESUME]], metadata !DIExpression()), !dbg 
![[IDBGLOC_RESUME]]
-; CHECK: call void @llvm.dbg.value(metadata i32* [[IGEP_RESUME]], 
metadata ![[IVAR_RESUME]], metadata !DIExpression()), !dbg ![[IDBGLOC_RESUME]]
+; CHECK: call void @llvm.dbg.value(metadata [10 x i32]* 
[[XGEP_RESUME]], metadata ![[XVAR_RESUME]], metadata 
!DIExpression(DW_OP_deref)), !dbg ![[IDBGLOC_RESUME]]
+; CHECK: call void @llvm.dbg.value(metadata i32* [[IGEP_RESUME]], 
metadata ![[IVAR_RESUME]], metadata !DIExpression(DW_OP_deref)), !dbg 
![[IDBGLOC_RESUME]]
 ; CHECK: call void @llvm.dbg.declare(metadata i32* %j, metadata 
![[JVAR_RESUME:[0-9]+]], metadata !DIExpression()), !dbg 
![[JDBGLOC_RESUME:[0-9]+]]
 ;
 ; CHECK: ![[IVAR]] = !DILocalVariable(name: "i"
@@ -247,4 +247,4 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, 
i8, i64, i1 immarg)
 !19 = !DILocation(line: 42, column: 8, scope: !7)
 !20 = !DILocation(line: 43, column: 3, scope: !7)
 !21 = !DILocation(line: 43, column: 8, scope: !7)
-!22 = distinct !DILexicalBlock(scope: !8, file: !1, line: 23, column: 12)
\ No newline at end of file
+!22 = distinct !DILexicalBlock(scope: !8, file: !1, line: 23, column: 12)



___
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] eee30a6 - [CodeGen] Modify the refineIndexType(...)'s code to fix a bug in D90942.

2020-12-06 Thread Bing1 Yu via llvm-branch-commits

Author: Bing1 Yu
Date: 2020-12-07T08:49:07+08:00
New Revision: eee30a6dceb6da8467fa3e0a7cd35b5a221bed0f

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

LOG: [CodeGen] Modify the refineIndexType(...)'s code to fix a bug in D90942.

In previous code, when refineIndexType(...) is called and Index is undef, 
Index.getOperand(0) will raise a assertion fail.

Reviewed By: pengfei

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

Added: 
llvm/test/CodeGen/X86/combine-undef-index-mscatter.ll

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

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index c40c2502f536..5481c52a5b12 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -9413,9 +9413,9 @@ bool refineUniformBase(SDValue , SDValue , 
SelectionDAG ) {
 bool refineIndexType(MaskedScatterSDNode *MSC, SDValue , bool Scaled,
  SelectionDAG ) {
   const TargetLowering  = DAG.getTargetLoweringInfo();
-  SDValue Op = Index.getOperand(0);
 
   if (Index.getOpcode() == ISD::ZERO_EXTEND) {
+SDValue Op = Index.getOperand(0);
 MSC->setIndexType(Scaled ? ISD::UNSIGNED_SCALED : ISD::UNSIGNED_UNSCALED);
 if (TLI.shouldRemoveExtendFromGSIndex(Op.getValueType())) {
   Index = Op;
@@ -9424,6 +9424,7 @@ bool refineIndexType(MaskedScatterSDNode *MSC, SDValue 
, bool Scaled,
   }
 
   if (Index.getOpcode() == ISD::SIGN_EXTEND) {
+SDValue Op = Index.getOperand(0);
 MSC->setIndexType(Scaled ? ISD::SIGNED_SCALED : ISD::SIGNED_UNSCALED);
 if (TLI.shouldRemoveExtendFromGSIndex(Op.getValueType())) {
   Index = Op;

diff  --git a/llvm/test/CodeGen/X86/combine-undef-index-mscatter.ll 
b/llvm/test/CodeGen/X86/combine-undef-index-mscatter.ll
new file mode 100644
index ..0b8ec5a0200c
--- /dev/null
+++ b/llvm/test/CodeGen/X86/combine-undef-index-mscatter.ll
@@ -0,0 +1,37 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=avx512f | FileCheck %s
+
+define void @main(<24 x float*> %x)
+; CHECK-LABEL: main:
+; CHECK:   # %bb.0: # %entry
+; CHECK-NEXT:vmovq %rcx, %xmm0
+; CHECK-NEXT:vmovq %rdx, %xmm1
+; CHECK-NEXT:vpunpcklqdq {{.*#+}} xmm0 = xmm1[0],xmm0[0]
+; CHECK-NEXT:vmovq %rsi, %xmm1
+; CHECK-NEXT:vmovq %rdi, %xmm2
+; CHECK-NEXT:vpunpcklqdq {{.*#+}} xmm1 = xmm2[0],xmm1[0]
+; CHECK-NEXT:vinserti128 $1, %xmm0, %ymm1, %ymm0
+; CHECK-NEXT:vmovq %r9, %xmm1
+; CHECK-NEXT:vmovq %r8, %xmm2
+; CHECK-NEXT:vpunpcklqdq {{.*#+}} xmm1 = xmm2[0],xmm1[0]
+; CHECK-NEXT:vinserti128 $1, {{[0-9]+}}(%rsp), %ymm1, %ymm1
+; CHECK-NEXT:vinserti64x4 $1, %ymm1, %zmm0, %zmm0
+; CHECK-NEXT:vmovups {{[0-9]+}}(%rsp), %zmm1
+; CHECK-NEXT:vmovups {{[0-9]+}}(%rsp), %zmm2
+; CHECK-NEXT:kxnorw %k0, %k0, %k1
+; CHECK-NEXT:vbroadcastf128 {{.*#+}} ymm3 = 
[8.33005607E-1,8.435871E-1,1.69435993E-1,8.33005607E-1,8.33005607E-1,8.435871E-1,1.69435993E-1,8.33005607E-1]
+; CHECK-NEXT:# ymm3 = mem[0,1,0,1]
+; CHECK-NEXT:kxnorw %k0, %k0, %k2
+; CHECK-NEXT:vscatterqps %ymm3, (,%zmm0) {%k2}
+; CHECK-NEXT:kxnorw %k0, %k0, %k2
+; CHECK-NEXT:vscatterqps %ymm3, (,%zmm2) {%k2}
+; CHECK-NEXT:vscatterqps %ymm3, (,%zmm1) {%k1}
+; CHECK-NEXT:vzeroupper
+; CHECK-NEXT:retq
+{
+entry:
+  call void @llvm.masked.scatter.v24f32.v24p0f32(<24 x float> , <24 x 
float*> %x, i32 4, <24 x i1> )
+  ret void
+}
+
+declare void @llvm.masked.scatter.v24f32.v24p0f32(<24 x float>, <24 x float*>, 
i32 immarg, <24 x i1>)



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


[llvm-branch-commits] [compiler-rt] 377ba7b - [compiler-rt][AArch64] Put outline atomic helpers into dedicated dir.

2020-12-06 Thread Pavel Iliin via llvm-branch-commits

Author: Pavel Iliin
Date: 2020-12-07T00:28:09Z
New Revision: 377ba7be933fe5012a0b096c6995f2c1d7776729

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

LOG: [compiler-rt][AArch64] Put outline atomic helpers into dedicated dir.

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

Added: 


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

Removed: 




diff  --git a/compiler-rt/lib/builtins/CMakeLists.txt 
b/compiler-rt/lib/builtins/CMakeLists.txt
index 99cdeac13a66..8bb367e6ce41 100644
--- a/compiler-rt/lib/builtins/CMakeLists.txt
+++ b/compiler-rt/lib/builtins/CMakeLists.txt
@@ -513,12 +513,14 @@ if(NOT ANDROID)
 endif()
 append_list_if(COMPILER_RT_HAS_ASM_LSE -DHAS_ASM_LSE CUSTOM_FLAGS)
 string(REPLACE " " "\t" CUSTOM_FLAGS "${CUSTOM_FLAGS}")
+set(OA_HELPERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/outline_atomic_helpers.dir")
+file(MAKE_DIRECTORY ${OA_HELPERS_DIR})
 
 foreach(pat cas swp ldadd ldclr ldeor ldset)
   foreach(size 1 2 4 8 16)
 foreach(model 1 2 3 4)
   if(pat STREQUAL "cas" OR NOT size STREQUAL "16")
-set(helper_asm outline_atomic_${pat}${size}_${model}.S)
+set(helper_asm 
${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S)
 add_custom_command(
   OUTPUT ${helper_asm}
   COMMAND ${CMAKE_C_COMPILER} -E ${CUSTOM_FLAGS} -DL_${pat} 
-DSIZE=${size} -DMODEL=${model}



___
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] 71d43d3 - [llvm-readobj] Delete unused declaration

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

Author: Fangrui Song
Date: 2020-12-06T15:54:17-08:00
New Revision: 71d43d314cb4b8d149268da64ca6534606082806

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

LOG: [llvm-readobj] Delete unused declaration

Added: 


Modified: 
llvm/tools/llvm-readobj/COFFDumper.cpp

Removed: 




diff  --git a/llvm/tools/llvm-readobj/COFFDumper.cpp 
b/llvm/tools/llvm-readobj/COFFDumper.cpp
index 144ecf56d50a..684967f93393 100644
--- a/llvm/tools/llvm-readobj/COFFDumper.cpp
+++ b/llvm/tools/llvm-readobj/COFFDumper.cpp
@@ -128,7 +128,6 @@ class COFFDumper : public ObjDumper {
 
   void printCodeViewSymbolSection(StringRef SectionName, const SectionRef 
);
   void printCodeViewTypeSection(StringRef SectionName, const SectionRef 
);
-  StringRef getTypeName(TypeIndex Ty);
   StringRef getFileNameForFileOffset(uint32_t FileOffset);
   void printFileNameForOffset(StringRef Label, uint32_t FileOffset);
   void printTypeIndex(StringRef FieldName, TypeIndex TI) {



___
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] 9c53b2a - [MC] Delete unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T15:36:39-08:00
New Revision: 9c53b2adc8c032f025ad871c8f9a0aeaf23453a8

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

LOG: [MC] Delete unused declarations

Notes:

* llvm::createAsmStreamer: it has been moved to TargetRegistry.h
* (anon ns)::WasmObjectWriter::updateCustomSectionRelocations: remnant of D46335
* COFFAsmParser::ParseSEHRegisterNumber: remnant of D66625
* llvm::CodeViewContext::isValidCVFileNumber: accidentally added by r279847

Added: 


Modified: 
llvm/include/llvm/MC/MCCodeView.h
llvm/include/llvm/MC/MCMachObjectWriter.h
llvm/include/llvm/MC/MCStreamer.h
llvm/lib/MC/MCParser/COFFAsmParser.cpp
llvm/lib/MC/MCParser/MasmParser.cpp
llvm/lib/MC/WasmObjectWriter.cpp

Removed: 




diff  --git a/llvm/include/llvm/MC/MCCodeView.h 
b/llvm/include/llvm/MC/MCCodeView.h
index 2126354cded6..5770f370341d 100644
--- a/llvm/include/llvm/MC/MCCodeView.h
+++ b/llvm/include/llvm/MC/MCCodeView.h
@@ -166,8 +166,6 @@ class CodeViewContext {
unsigned FileNo, unsigned Line, unsigned Column,
bool PrologueEnd, bool IsStmt);
 
-  bool isValidCVFileNumber(unsigned FileNumber);
-
   /// Add a line entry.
   void addLineEntry(const MCCVLoc );
 

diff  --git a/llvm/include/llvm/MC/MCMachObjectWriter.h 
b/llvm/include/llvm/MC/MCMachObjectWriter.h
index 6cdccd43712f..f4f9c474cdcd 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -235,16 +235,6 @@ class MachObjectWriter : public MCObjectWriter {
 Relocations[Sec].push_back(P);
   }
 
-  void recordScatteredRelocation(const MCAssembler ,
- const MCAsmLayout ,
- const MCFragment *Fragment,
- const MCFixup , MCValue Target,
- unsigned Log2Size, uint64_t );
-
-  void recordTLVPRelocation(const MCAssembler , const MCAsmLayout ,
-const MCFragment *Fragment, const MCFixup ,
-MCValue Target, uint64_t );
-
   void recordRelocation(MCAssembler , const MCAsmLayout ,
 const MCFragment *Fragment, const MCFixup ,
 MCValue Target, uint64_t ) override;

diff  --git a/llvm/include/llvm/MC/MCStreamer.h 
b/llvm/include/llvm/MC/MCStreamer.h
index 9581a08fc5cf..bb533bc2eca8 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -1080,28 +1080,6 @@ class MCStreamer {
 /// timing the assembler front end.
 MCStreamer *createNullStreamer(MCContext );
 
-/// Create a machine code streamer which will print out assembly for the native
-/// target, suitable for compiling with a native assembler.
-///
-/// \param InstPrint - If given, the instruction printer to use. If not given
-/// the MCInst representation will be printed.  This method takes ownership of
-/// InstPrint.
-///
-/// \param CE - If given, a code emitter to use to show the instruction
-/// encoding inline with the assembly. This method takes ownership of \p CE.
-///
-/// \param TAB - If given, a target asm backend to use to show the fixup
-/// information in conjunction with encoding information. This method takes
-/// ownership of \p TAB.
-///
-/// \param ShowInst - Whether to show the MCInst representation inline with
-/// the assembly.
-MCStreamer *createAsmStreamer(MCContext ,
-  std::unique_ptr OS,
-  bool isVerboseAsm, bool useDwarfDirectory,
-  MCInstPrinter *InstPrint, MCCodeEmitter *CE,
-  MCAsmBackend *TAB, bool ShowInst);
-
 } // end namespace llvm
 
 #endif // LLVM_MC_MCSTREAMER_H

diff  --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp 
b/llvm/lib/MC/MCParser/COFFAsmParser.cpp
index 1d966ff8632a..3ac6a883417e 100644
--- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp
@@ -142,7 +142,6 @@ class COFFAsmParser : public MCAsmParserExtension {
   bool ParseSEHDirectiveEndProlog(StringRef, SMLoc);
 
   bool ParseAtUnwindOrAtExcept(bool , bool );
-  bool ParseSEHRegisterNumber(unsigned );
   bool ParseDirectiveSymbolAttribute(StringRef Directive, SMLoc);
 
 public:

diff  --git a/llvm/lib/MC/MCParser/MasmParser.cpp 
b/llvm/lib/MC/MCParser/MasmParser.cpp
index 63aebbc5a7ba..e5d8039f5f34 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -783,8 +783,6 @@ class MasmParser : public MCAsmParser {
   /// def_range types parsed by this class.
   StringMap CVDefRangeTypeMap;
 
-  bool parseInitValue(unsigned Size);
-
   // ".ascii", ".asciz", ".string"
   bool parseDirectiveAscii(StringRef IDVal, bool 

[llvm-branch-commits] [lld] 4701cb4 - [lld] Delete unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T15:26:37-08:00
New Revision: 4701cb41ed7f1bba01a4fd94a9bf13271112de58

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

LOG: [lld] Delete unused declarations

Notes:

* runMSVCLinker: remnant of r338615
* wasm markSymbol: remnant of r374275
* wasm addDataAddressGlobal: accidentally added by r372779
* MachO Writer::createSymtabContents: accidentally added by D76839

Added: 


Modified: 
lld/COFF/Driver.h
lld/MachO/Writer.cpp
lld/wasm/MarkLive.cpp
lld/wasm/SyntheticSections.h

Removed: 




diff  --git a/lld/COFF/Driver.h b/lld/COFF/Driver.h
index 5de05a1ef325..dc766eeac8ed 100644
--- a/lld/COFF/Driver.h
+++ b/lld/COFF/Driver.h
@@ -96,9 +96,6 @@ class LinkerDriver {
 private:
   std::unique_ptr tar; // for /linkrepro
 
-  // Opens a file. Path has to be resolved already.
-  MemoryBufferRef openFile(StringRef path);
-
   // Searches a file from search paths.
   Optional findFile(StringRef filename);
   Optional findLib(StringRef filename);
@@ -206,8 +203,6 @@ void checkFailIfMismatch(StringRef arg, InputFile *source);
 MemoryBufferRef convertResToCOFF(ArrayRef mbs,
  ArrayRef objs);
 
-void runMSVCLinker(std::string rsp, ArrayRef objects);
-
 // Create enum with OPT_xxx values for each option in Options.td
 enum {
   OPT_INVALID = 0,

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 254e2787e893..fc4e36c9eb5e 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -46,7 +46,6 @@ class Writer {
   void createOutputSections();
   void createLoadCommands();
   void assignAddresses(OutputSegment *);
-  void createSymtabContents();
 
   void openFile();
   void writeSections();

diff  --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp
index 046041bab472..62d1298838d6 100644
--- a/lld/wasm/MarkLive.cpp
+++ b/lld/wasm/MarkLive.cpp
@@ -43,7 +43,6 @@ class MarkLive {
 private:
   void enqueue(Symbol *sym);
   void enqueueInitFunctions(const ObjFile *sym);
-  void markSymbol(Symbol *sym);
   void mark();
   bool isCallCtorsLive();
 

diff  --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h
index af0566e02e90..f9ec7f288dbd 100644
--- a/lld/wasm/SyntheticSections.h
+++ b/lld/wasm/SyntheticSections.h
@@ -203,7 +203,6 @@ class GlobalSection : public SyntheticSection {
   void assignIndexes() override;
   void writeBody() override;
   void addGlobal(InputGlobal *global);
-  void addDataAddressGlobal(DefinedData *global);
 
   // Add an internal GOT entry global that corresponds to the given symbol.
   // Normally GOT entries are imported and assigned by the external dynamic



___
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] 305fcc9 - [LoopIdiomRecognize] Merge a conditional operator with an earlier if and remove an extra temporary variable. NFC

2020-12-06 Thread Craig Topper via llvm-branch-commits

Author: Craig Topper
Date: 2020-12-06T15:23:18-08:00
New Revision: 305fcc91225b5c8fa840e8d94d01af1f70bc5445

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

LOG: [LoopIdiomRecognize] Merge a conditional operator with an earlier if and 
remove an extra temporary variable. NFC

The CountPrev variable was only used to forward a value from
the if statement to the conditional operator under the same
condition.

While there move some variable declarations to their first
assignment.

Added: 


Modified: 
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp 
b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 526f1fe2388f..7e69cc5beffe 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1717,11 +1717,13 @@ void LoopIdiomRecognize::transformLoopToCountable(
   // Step 1: Insert the CTLZ/CTTZ instruction at the end of the preheader block
   IRBuilder<> Builder(PreheaderBr);
   Builder.SetCurrentDebugLocation(DL);
-  Value *FFS, *Count, *CountPrev, *NewCount, *InitXNext;
 
   //   Count = BitWidth - CTLZ(InitX);
+  //   NewCount = Count;
   // If there are uses of CntPhi create:
-  //   CountPrev = BitWidth - CTLZ(InitX >> 1);
+  //   NewCount = BitWidth - CTLZ(InitX >> 1);
+  //   Count = NewCount + 1;
+  Value *InitXNext;
   if (IsCntPhiUsedOutsideLoop) {
 if (DefX->getOpcode() == Instruction::AShr)
   InitXNext =
@@ -1736,21 +1738,18 @@ void LoopIdiomRecognize::transformLoopToCountable(
   llvm_unreachable("Unexpected opcode!");
   } else
 InitXNext = InitX;
-  FFS = createFFSIntrinsic(Builder, InitXNext, DL, ZeroCheck, IntrinID);
-  Count = Builder.CreateSub(
-  ConstantInt::get(FFS->getType(),
-   FFS->getType()->getIntegerBitWidth()),
+  Value *FFS = createFFSIntrinsic(Builder, InitXNext, DL, ZeroCheck, IntrinID);
+  Value *Count = Builder.CreateSub(
+  ConstantInt::get(FFS->getType(), FFS->getType()->getIntegerBitWidth()),
   FFS);
+  Value *NewCount = Count;
   if (IsCntPhiUsedOutsideLoop) {
-CountPrev = Count;
-Count = Builder.CreateAdd(
-CountPrev,
-ConstantInt::get(CountPrev->getType(), 1));
+NewCount = Count;
+Count = Builder.CreateAdd(Count, ConstantInt::get(Count->getType(), 1));
   }
 
-  NewCount = Builder.CreateZExtOrTrunc(
-  IsCntPhiUsedOutsideLoop ? CountPrev : Count,
-  cast(CntInst->getType()));
+  NewCount = Builder.CreateZExtOrTrunc(NewCount,
+   cast(CntInst->getType()));
 
   // If the counter's initial value is not zero, insert Add Inst.
   Value *CntInitVal = CntPhi->getIncomingValueForBlock(Preheader);



___
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] 6785ca0 - [llvm-c] Delete unimplemented llvm-c/LinkTimeOptimizer.h

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

Author: Fangrui Song
Date: 2020-12-06T15:18:25-08:00
New Revision: 6785ca01248ce271dfff16e03cce82f649fa14f7

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

LOG: [llvm-c] Delete unimplemented llvm-c/LinkTimeOptimizer.h

The file was added in 2007 but the functions have never been implemented.
Having the file can only cause confusion to existing C API (llvm-c/lto.h) users.

Added: 


Modified: 
llvm/tools/llvm-c-test/include-all.c

Removed: 
llvm/include/llvm-c/LinkTimeOptimizer.h



diff  --git a/llvm/include/llvm-c/LinkTimeOptimizer.h 
b/llvm/include/llvm-c/LinkTimeOptimizer.h
deleted file mode 100644
index 9ae65b8fe5e0..
--- a/llvm/include/llvm-c/LinkTimeOptimizer.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface ---*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-//
-// This header provides a C API to use the LLVM link time optimization
-// library. This is intended to be used by linkers which are C-only in
-// their implementation for performing LTO.
-//
-//===--===//
-
-#ifndef LLVM_C_LINKTIMEOPTIMIZER_H
-#define LLVM_C_LINKTIMEOPTIMIZER_H
-
-#include "llvm-c/ExternC.h"
-
-LLVM_C_EXTERN_C_BEGIN
-
-/**
- * @defgroup LLVMCLinkTimeOptimizer Link Time Optimization
- * @ingroup LLVMC
- *
- * @{
- */
-
-  /// This provides a dummy type for pointers to the LTO object.
-  typedef void* llvm_lto_t;
-
-  /// This provides a C-visible enumerator to manage status codes.
-  /// This should map exactly onto the C++ enumerator LTOStatus.
-  typedef enum llvm_lto_status {
-LLVM_LTO_UNKNOWN,
-LLVM_LTO_OPT_SUCCESS,
-LLVM_LTO_READ_SUCCESS,
-LLVM_LTO_READ_FAILURE,
-LLVM_LTO_WRITE_FAILURE,
-LLVM_LTO_NO_TARGET,
-LLVM_LTO_NO_WORK,
-LLVM_LTO_MODULE_MERGE_FAILURE,
-LLVM_LTO_ASM_FAILURE,
-
-//  Added C-specific error codes
-LLVM_LTO_NULL_OBJECT
-  } llvm_lto_status_t;
-
-  /// This provides C interface to initialize link time optimizer. This allows
-  /// linker to use dlopen() interface to dynamically load LinkTimeOptimizer.
-  /// extern "C" helps, because dlopen() interface uses name to find the 
symbol.
-  extern llvm_lto_t llvm_create_optimizer(void);
-  extern void llvm_destroy_optimizer(llvm_lto_t lto);
-
-  extern llvm_lto_status_t llvm_read_object_file
-(llvm_lto_t lto, const char* input_filename);
-  extern llvm_lto_status_t llvm_optimize_modules
-(llvm_lto_t lto, const char* output_filename);
-
-/**
- * @}
- */
-
-  LLVM_C_EXTERN_C_END
-
-#endif

diff  --git a/llvm/tools/llvm-c-test/include-all.c 
b/llvm/tools/llvm-c-test/include-all.c
index b109b11491d3..27b11fb7e0f6 100644
--- a/llvm/tools/llvm-c-test/include-all.c
+++ b/llvm/tools/llvm-c-test/include-all.c
@@ -29,7 +29,6 @@
 #include "llvm-c/Initialization.h"
 #include "llvm-c/IRReader.h"
 #include "llvm-c/Linker.h"
-#include "llvm-c/LinkTimeOptimizer.h"
 #include "llvm-c/Object.h"
 #include "llvm-c/Orc.h"
 #include "llvm-c/Remarks.h"



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


[llvm-branch-commits] [llvm] 9fe1809 - [X86] Delete 3 unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T15:13:39-08:00
New Revision: 9fe1809f8cac141fdb5cf7e6e05ef1ea4818343c

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

LOG: [X86] Delete 3 unused declarations

Added: 


Modified: 
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/lib/Target/X86/X86FrameLowering.h
llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp

Removed: 




diff  --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp 
b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 21771e9d4171..406327e46f32 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -1138,7 +1138,6 @@ class X86AsmParser : public MCTargetAsmParser {
   bool parseDirectiveFPOStackAlign(SMLoc L);
   bool parseDirectiveFPOEndPrologue(SMLoc L);
   bool parseDirectiveFPOEndProc(SMLoc L);
-  bool parseDirectiveFPOData(SMLoc L);
 
   /// SEH directives.
   bool parseSEHRegisterNumber(unsigned RegClassID, unsigned );

diff  --git a/llvm/lib/Target/X86/X86FrameLowering.h 
b/llvm/lib/Target/X86/X86FrameLowering.h
index 72a0fc1608be..f77a4843bba4 100644
--- a/llvm/lib/Target/X86/X86FrameLowering.h
+++ b/llvm/lib/Target/X86/X86FrameLowering.h
@@ -224,13 +224,6 @@ class X86FrameLowering : public TargetFrameLowering {
const DebugLoc , uint64_t Offset,
uint64_t Align) const;
 
-  /// Emit a stub to later inline the target stack probe.
-  MachineInstr *emitStackProbeInlineStub(MachineFunction ,
- MachineBasicBlock ,
- MachineBasicBlock::iterator MBBI,
- const DebugLoc ,
- bool InProlog) const;
-
   /// Aligns the stack pointer by ANDing it with -MaxAlign.
   void BuildStackAlignAND(MachineBasicBlock ,
   MachineBasicBlock::iterator MBBI, const DebugLoc ,

diff  --git a/llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp 
b/llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp
index 12aaabcc7964..810fee052b5a 100644
--- a/llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp
+++ b/llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp
@@ -171,8 +171,6 @@ class X86LoadValueInjectionLoadHardeningPass : public 
MachineFunctionPass {
  NodeSet  /* in, out */) const;
   std::unique_ptr
   trimMitigatedEdges(std::unique_ptr Graph) const;
-  void findAndCutEdges(MachineGadgetGraph ,
-   EdgeSet  /* out */) const;
   int insertFences(MachineFunction , MachineGadgetGraph ,
EdgeSet  /* in, out */) const;
   bool instrUsesRegToAccessMemory(const MachineInstr , unsigned Reg) const;



___
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] 2d03c8e - [CodeGen] Delete 4 unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T15:02:18-08:00
New Revision: 2d03c8e2c8982a2352884e379c822b7b66847118

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

LOG: [CodeGen] Delete 4 unused declarations

Added: 


Modified: 
llvm/include/llvm/CodeGen/RDFGraph.h
llvm/include/llvm/CodeGen/SelectionDAGISel.h
llvm/lib/CodeGen/WasmEHPrepare.cpp

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/RDFGraph.h 
b/llvm/include/llvm/CodeGen/RDFGraph.h
index 585f43e116f9..00d6ec93d555 100644
--- a/llvm/include/llvm/CodeGen/RDFGraph.h
+++ b/llvm/include/llvm/CodeGen/RDFGraph.h
@@ -753,10 +753,6 @@ namespace rdf {
 
 NodeAddr getNextRelated(NodeAddr IA,
 NodeAddr RA) const;
-NodeAddr getNextImp(NodeAddr IA,
-NodeAddr RA, bool Create);
-NodeAddr getNextImp(NodeAddr IA,
-NodeAddr RA) const;
 NodeAddr getNextShadow(NodeAddr IA,
 NodeAddr RA, bool Create);
 NodeAddr getNextShadow(NodeAddr IA,

diff  --git a/llvm/include/llvm/CodeGen/SelectionDAGISel.h 
b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
index 3bfbf3765e4f..84bb11edd715 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGISel.h
@@ -323,8 +323,6 @@ class SelectionDAGISel : public MachineFunctionPass {
   SDNode *MorphNode(SDNode *Node, unsigned TargetOpc, SDVTList VTList,
 ArrayRef Ops, unsigned EmitNodeInfo);
 
-  SDNode *MutateStrictFPToFP(SDNode *Node, unsigned NewOpc);
-
   /// Prepares the landing pad to take incoming values or do other EH
   /// personality specific tasks. Returns true if the block should be
   /// instruction selected, false if no code should be emitted for it.

diff  --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp 
b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 171ba78203ec..2a0dfffaa512 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -124,7 +124,6 @@ class WasmEHPrepare : public FunctionPass {
   void setupEHPadFunctions(Function );
   void prepareEHPad(BasicBlock *BB, bool NeedPersonality, bool NeedLSDA = 
false,
 unsigned Index = 0);
-  void prepareTerminateCleanupPad(BasicBlock *BB);
 
 public:
   static char ID; // Pass identification, replacement for typeid



___
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] 0e0d616 - [CodeGen] Delete 15 unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T14:55:04-08:00
New Revision: 0e0d616fa28ff7a109bda1d323a14bd19723d0dd

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

LOG: [CodeGen] Delete 15 unused declarations

Notes about a few declarations:

* LiveVariables::RegisterDefIsDead: deleted by r47927
* createForwardControlFlowIntegrityPass, createJumpInstrTablesPass: deleted by 
r230780
* RegScavenger::setLiveInsUsed: deleted by r292543
* ScheduleDAGInstrs::{toggleKillFlag,startBlockForKills}: deleted by r304055
* Localizer::shouldLocalize: remnant of D75207
* DwarfDebug::addSectionLabel: deleted by r373273

Added: 


Modified: 
llvm/include/llvm/CodeGen/FastISel.h
llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
llvm/include/llvm/CodeGen/LexicalScopes.h
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/CodeGen/RDFRegisters.h
llvm/include/llvm/CodeGen/ResourcePriorityQueue.h
llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/Support/YAMLParser.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h

Removed: 




diff  --git a/llvm/include/llvm/CodeGen/FastISel.h 
b/llvm/include/llvm/CodeGen/FastISel.h
index 5c1ebc7af177..0463272ea0a8 100644
--- a/llvm/include/llvm/CodeGen/FastISel.h
+++ b/llvm/include/llvm/CodeGen/FastISel.h
@@ -524,7 +524,6 @@ class FastISel {
   bool selectFreeze(const User *I);
   bool selectCast(const User *I, unsigned Opcode);
   bool selectExtractValue(const User *U);
-  bool selectInsertValue(const User *I);
   bool selectXRayCustomEvent(const CallInst *II);
   bool selectXRayTypedEvent(const CallInst *II);
 

diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h 
b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
index 20db2c423754..eafed3760738 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h
@@ -44,7 +44,6 @@ class GISelKnownBits : public GISelChangeObserver {
 public:
   GISelKnownBits(MachineFunction , unsigned MaxDepth = 6);
   virtual ~GISelKnownBits() = default;
-  void setMF(MachineFunction );
 
   const MachineFunction () const {
 return MF;

diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h 
b/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
index e59bf1b91262..690e84f79a6b 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Legalizer.h
@@ -64,9 +64,6 @@ class Legalizer : public MachineFunctionPass {
 MachineFunctionProperties::Property::NoPHIs);
   }
 
-  bool combineExtracts(MachineInstr , MachineRegisterInfo ,
-   const TargetInstrInfo );
-
   bool runOnMachineFunction(MachineFunction ) override;
 
   static MFResult

diff  --git a/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h 
b/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
index 67e450641eaf..57f6c03f75aa 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Localizer.h
@@ -52,9 +52,6 @@ class Localizer : public MachineFunctionPass {
   /// TTI used for getting remat costs for instructions.
   TargetTransformInfo *TTI;
 
-  /// Check whether or not \p MI needs to be moved close to its uses.
-  bool shouldLocalize(const MachineInstr );
-
   /// Check if \p MOUse is used in the same basic block as \p Def.
   /// If the use is in the same block, we say it is local.
   /// When the use is not local, \p InsertMBB will contain the basic

diff  --git a/llvm/include/llvm/CodeGen/LexicalScopes.h 
b/llvm/include/llvm/CodeGen/LexicalScopes.h
index bac850d327ef..9617ba80c138 100644
--- a/llvm/include/llvm/CodeGen/LexicalScopes.h
+++ b/llvm/include/llvm/CodeGen/LexicalScopes.h
@@ -194,9 +194,6 @@ class LexicalScopes {
 return I != LexicalScopeMap.end() ? >second : nullptr;
   }
 
-  /// dump - Print data structures to dbgs().
-  void dump() const;
-
   /// getOrCreateAbstractScope - Find or create an abstract lexical scope.
   LexicalScope *getOrCreateAbstractScope(const DILocalScope *Scope);
 

diff  --git a/llvm/include/llvm/CodeGen/Passes.h 
b/llvm/include/llvm/CodeGen/Passes.h
index e33e62dc8e7c..e3aa32bffb71 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -391,10 +391,6 @@ namespace llvm {
   /// createJumpInstrTables - This pass creates jump-instruction tables.
   ModulePass *createJumpInstrTablesPass();
 
-  /// createForwardControlFlowIntegrityPass - This pass adds control-flow
-  /// integrity.
-  ModulePass *createForwardControlFlowIntegrityPass();
-
   /// InterleavedAccess Pass - This pass identifies and matches 

[llvm-branch-commits] [clang] a2f9221 - [TableGen] Delete 11 unused declarations

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

Author: Fangrui Song
Date: 2020-12-06T13:21:07-08:00
New Revision: a2f922140f5380571fb74179f2bf622b3b925697

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

LOG: [TableGen] Delete 11 unused declarations

Added: 


Modified: 
clang/utils/TableGen/NeonEmitter.cpp
clang/utils/TableGen/TableGenBackends.h
llvm/include/llvm/TableGen/Record.h
llvm/lib/TableGen/DetailedRecordsBackend.cpp
llvm/lib/TableGen/JSONBackend.cpp
llvm/utils/TableGen/CodeGenDAGPatterns.h
llvm/utils/TableGen/GICombinerEmitter.cpp
llvm/utils/TableGen/GlobalISelEmitter.cpp
llvm/utils/TableGen/SubtargetEmitter.cpp

Removed: 




diff  --git a/clang/utils/TableGen/NeonEmitter.cpp 
b/clang/utils/TableGen/NeonEmitter.cpp
index d5bf59ef04ad..e8340d976f5e 100644
--- a/clang/utils/TableGen/NeonEmitter.cpp
+++ b/clang/utils/TableGen/NeonEmitter.cpp
@@ -580,21 +580,18 @@ class NeonEmitter {
 ClassMap[NoTestOpI] = ClassNoTest;
   }
 
-  // run - Emit arm_neon.h.inc
+  // Emit arm_neon.h.inc
   void run(raw_ostream );
 
-  // runFP16 - Emit arm_fp16.h.inc
+  // Emit arm_fp16.h.inc
   void runFP16(raw_ostream );
 
-  // runBF16 - Emit arm_bf16.h.inc
+  // Emit arm_bf16.h.inc
   void runBF16(raw_ostream );
 
-  // runHeader - Emit all the __builtin prototypes used in arm_neon.h,
-  // arm_fp16.h and arm_bf16.h
+  // Emit all the __builtin prototypes used in arm_neon.h, arm_fp16.h and
+  // arm_bf16.h
   void runHeader(raw_ostream );
-
-  // runTests - Emit tests for all the Neon intrinsics.
-  void runTests(raw_ostream );
 };
 
 } // end anonymous namespace

diff  --git a/clang/utils/TableGen/TableGenBackends.h 
b/clang/utils/TableGen/TableGenBackends.h
index dc4476cdff44..33a06bfe4469 100644
--- a/clang/utils/TableGen/TableGenBackends.h
+++ b/clang/utils/TableGen/TableGenBackends.h
@@ -93,9 +93,6 @@ void EmitFP16(llvm::RecordKeeper , llvm::raw_ostream 
);
 void EmitBF16(llvm::RecordKeeper , llvm::raw_ostream );
 void EmitNeonSema(llvm::RecordKeeper , llvm::raw_ostream );
 void EmitNeonTest(llvm::RecordKeeper , llvm::raw_ostream );
-void EmitNeon2(llvm::RecordKeeper , llvm::raw_ostream );
-void EmitNeonSema2(llvm::RecordKeeper , llvm::raw_ostream );
-void EmitNeonTest2(llvm::RecordKeeper , llvm::raw_ostream );
 
 void EmitSveHeader(llvm::RecordKeeper , llvm::raw_ostream );
 void EmitSveBuiltins(llvm::RecordKeeper , llvm::raw_ostream );

diff  --git a/llvm/include/llvm/TableGen/Record.h 
b/llvm/include/llvm/TableGen/Record.h
index 1c3ec5fb21f5..fe552331b385 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -1608,7 +1608,6 @@ class Record {
 return IsAnonymous;
   }
 
-  void print(raw_ostream ) const;
   void dump() const;
 
   
//======//

diff  --git a/llvm/lib/TableGen/DetailedRecordsBackend.cpp 
b/llvm/lib/TableGen/DetailedRecordsBackend.cpp
index 1b6b675081ed..2c3c3358b347 100644
--- a/llvm/lib/TableGen/DetailedRecordsBackend.cpp
+++ b/llvm/lib/TableGen/DetailedRecordsBackend.cpp
@@ -52,7 +52,6 @@ class DetailedRecordsEmitter {
   void printTemplateArgs(Record *Rec, raw_ostream );
   void printSuperclasses(Record *Rec, raw_ostream );
   void printFields(Record *Rec, raw_ostream );
-  std::string formatLocation(const SMLoc Loc);
 }; // emitter class
 
 } // anonymous namespace

diff  --git a/llvm/lib/TableGen/JSONBackend.cpp 
b/llvm/lib/TableGen/JSONBackend.cpp
index ea82934e5d3b..131650f987fb 100644
--- a/llvm/lib/TableGen/JSONBackend.cpp
+++ b/llvm/lib/TableGen/JSONBackend.cpp
@@ -29,7 +29,6 @@ class JSONEmitter {
   RecordKeeper 
 
   json::Value translateInit(const Init );
-  json::Array listSuperclasses(const Record );
 
 public:
   JSONEmitter(RecordKeeper );

diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h 
b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index 7a0da531469e..c0c45a74de66 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -436,8 +436,6 @@ class ScopedName {
   unsigned getScope() const { return Scope; }
   const std::string () const { return Identifier; }
 
-  std::string getFullName() const;
-
   bool operator==(const ScopedName ) const;
   bool operator!=(const ScopedName ) const;
 };

diff  --git a/llvm/utils/TableGen/GICombinerEmitter.cpp 
b/llvm/utils/TableGen/GICombinerEmitter.cpp
index 5f091467636d..c3bbfd28f965 100644
--- a/llvm/utils/TableGen/GICombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GICombinerEmitter.cpp
@@ -615,7 +615,6 @@ class GICombinerEmitter {
   /// response to the generated cl::opt.
   void emitNameMatcher(raw_ostream ) const;
 
-  void generateDeclarationsCodeForTree(raw_ostream , const GIMatchTree 
) const;
   void generateCodeForTree(raw_ostream , const GIMatchTree ,
 

[llvm-branch-commits] [llvm] 2832f35 - [Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper

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

Author: Fangrui Song
Date: 2020-12-06T13:04:01-08:00
New Revision: 2832f3528c6915b14f5267c092e7821ed783f449

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

LOG: [Transforms] Delete unused declarations from NewGVN/CoroSplit/ValueMapper

Added: 


Modified: 
llvm/lib/Transforms/Coroutines/CoroInternal.h
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/lib/Transforms/Utils/ValueMapper.cpp

Removed: 




diff  --git a/llvm/lib/Transforms/Coroutines/CoroInternal.h 
b/llvm/lib/Transforms/Coroutines/CoroInternal.h
index e2f129c38d92..d08ed0aaa4b0 100644
--- a/llvm/lib/Transforms/Coroutines/CoroInternal.h
+++ b/llvm/lib/Transforms/Coroutines/CoroInternal.h
@@ -47,8 +47,6 @@ namespace coro {
 
 bool declaresIntrinsics(const Module ,
 const std::initializer_list);
-void replaceAllCoroAllocs(CoroBeginInst *CB, bool Replacement);
-void replaceAllCoroFrees(CoroBeginInst *CB, Value *Replacement);
 void replaceCoroFree(CoroIdInst *CoroId, bool Elide);
 void updateCallGraph(Function , ArrayRef Funcs,
  CallGraph , CallGraphSCC );

diff  --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp 
b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 34ee70a6d380..7c4a204e953d 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -104,7 +104,6 @@ class CoroCloner {
   ValueToValueMapTy VMap;
   IRBuilder<> Builder;
   Value *NewFramePtr = nullptr;
-  Value *SwiftErrorSlot = nullptr;
 
   /// The active suspend instruction; meaningful only for continuation and 
async
   /// ABIs.
@@ -152,7 +151,6 @@ class CoroCloner {
 llvm_unreachable("Unknown CoroCloner::Kind enum");
   }
 
-  void createDeclaration();
   void replaceEntryBlock();
   Value *deriveNewFramePointer();
   void replaceRetconOrAsyncSuspendUses();
@@ -160,7 +158,6 @@ class CoroCloner {
   void replaceCoroEnds();
   void replaceSwiftErrorOps();
   void handleFinalSuspend();
-  void maybeFreeContinuationStorage();
 };
 
 } // end anonymous namespace

diff  --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp 
b/llvm/lib/Transforms/Scalar/NewGVN.cpp
index f422d1b51b99..85b59838b486 100644
--- a/llvm/lib/Transforms/Scalar/NewGVN.cpp
+++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp
@@ -835,7 +835,6 @@ class NewGVN {
   BasicBlock *getBlockForValue(Value *V) const;
   void deleteExpression(const Expression *E) const;
   MemoryUseOrDef *getMemoryAccess(const Instruction *) const;
-  MemoryAccess *getDefiningAccess(const MemoryAccess *) const;
   MemoryPhi *getMemoryAccess(const BasicBlock *) const;
   template  T *getMinDFSOfRange(const Range &) const;
 

diff  --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp 
b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index fac7b555e975..8ab272e756c1 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -167,11 +167,9 @@ class Mapper {
   void flush();
 
 private:
-  void mapGlobalInitializer(GlobalVariable , Constant );
   void mapAppendingVariable(GlobalVariable , Constant *InitPrefix,
 bool IsOldCtorDtor,
 ArrayRef NewMembers);
-  void mapGlobalIndirectSymbol(GlobalIndirectSymbol , Constant );
 
   ValueToValueMapTy () { return *MCs[CurrentMCID].VM; }
   ValueMaterializer *getMaterializer() { return MCs[CurrentMCID].Materializer; 
}



___
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] f19876c - [ConstraintElimination] Bail out if system gets too big.

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

Author: Florian Hahn
Date: 2020-12-06T20:19:15Z
New Revision: f19876c5366136da942b733d6e4b435fb19863a3

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

LOG: [ConstraintElimination] Bail out if system gets too big.

For some inputs, the constraint system can grow quite large during
solving, because it replaces complex constraints with one or more
simpler constraints. This adds a cut-off to avoid compile-time explosion
on problematic inputs.

Added: 
llvm/test/Transforms/ConstraintElimination/large-system-growth.ll

Modified: 
llvm/include/llvm/Analysis/ConstraintSystem.h
llvm/lib/Analysis/ConstraintSystem.cpp

Removed: 




diff  --git a/llvm/include/llvm/Analysis/ConstraintSystem.h 
b/llvm/include/llvm/Analysis/ConstraintSystem.h
index 2e55d5d456743..83c1fb4485fdc 100644
--- a/llvm/include/llvm/Analysis/ConstraintSystem.h
+++ b/llvm/include/llvm/Analysis/ConstraintSystem.h
@@ -79,6 +79,9 @@ class ConstraintSystem {
   bool isConditionImplied(SmallVector R);
 
   void popLastConstraint() { Constraints.pop_back(); }
+
+  /// Returns the number of rows in the constraint system.
+  unsigned size() const { return Constraints.size(); }
 };
 } // namespace llvm
 

diff  --git a/llvm/lib/Analysis/ConstraintSystem.cpp 
b/llvm/lib/Analysis/ConstraintSystem.cpp
index f3a28347ded46..1d582802f8e7c 100644
--- a/llvm/lib/Analysis/ConstraintSystem.cpp
+++ b/llvm/lib/Analysis/ConstraintSystem.cpp
@@ -84,6 +84,9 @@ bool ConstraintSystem::eliminateUsingFM() {
  .getZExtValue();
   }
   NewSystem.push_back(std::move(NR));
+  // Give up if the new system gets too big.
+  if (NewSystem.size() > 500)
+return false;
 }
   }
   Constraints = std::move(NewSystem);

diff  --git a/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll 
b/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll
new file mode 100644
index 0..e2d603ed74621
--- /dev/null
+++ b/llvm/test/Transforms/ConstraintElimination/large-system-growth.ll
@@ -0,0 +1,86 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -constraint-elimination -S %s | FileCheck %s
+
+; The system for the function below grows quite large. Check to make sure
+; we can handle that scenario.
+define void @test(i64 %x, i8* %y, i8* %z, i8* %w) {
+; CHECK-LABEL: @test(
+; CHECK-NEXT:[[TMP22:%.*]] = getelementptr inbounds i8, i8* [[Y:%.*]], i64 
[[X:%.*]]
+; CHECK-NEXT:[[TMP26:%.*]] = icmp ult i8* [[TMP22]], [[Z:%.*]]
+; CHECK-NEXT:br i1 [[TMP26]], label [[BB28:%.*]], label [[EARLY_EXIT:%.*]]
+; CHECK:   early.exit:
+; CHECK-NEXT:unreachable
+; CHECK:   bb28:
+; CHECK-NEXT:[[TMP29:%.*]] = getelementptr inbounds i8, i8* [[Y]], i64 
[[X]]
+; CHECK-NEXT:[[TMP30:%.*]] = icmp ult i8* [[TMP29]], [[Z]]
+; CHECK-NEXT:br i1 true, label [[EARLY_EXIT]], label [[BB32:%.*]]
+; CHECK:   bb32:
+; CHECK-NEXT:[[TMP33:%.*]] = icmp ult i8* [[TMP29]], [[Z]]
+; CHECK-NEXT:br i1 true, label [[BB35:%.*]], label [[EARLY_EXIT]]
+; CHECK:   bb35:
+; CHECK-NEXT:[[TMP36:%.*]] = icmp ult i8* [[Y]], [[Z]]
+; CHECK-NEXT:br i1 true, label [[EARLY_EXIT]], label [[BB38:%.*]]
+; CHECK:   bb38:
+; CHECK-NEXT:[[TMP41:%.*]] = icmp ult i8* [[Y]], [[Z]]
+; CHECK-NEXT:br i1 true, label [[EARLY_EXIT]], label [[BB43:%.*]]
+; CHECK:   bb43:
+; CHECK-NEXT:[[TMP47:%.*]] = getelementptr inbounds i8, i8* [[W:%.*]], i64 
[[X]]
+; CHECK-NEXT:[[TMP48:%.*]] = icmp ult i8* [[TMP47]], [[Y]]
+; CHECK-NEXT:br i1 [[TMP48]], label [[EARLY_EXIT]], label [[BB50:%.*]]
+; CHECK:   bb50:
+; CHECK-NEXT:[[TMP52:%.*]] = getelementptr inbounds i8, i8* [[W]], i64 
[[X]]
+; CHECK-NEXT:[[TMP53:%.*]] = icmp ult i8* [[TMP52]], [[Y]]
+; CHECK-NEXT:br i1 true, label [[EARLY_EXIT]], label [[BB55:%.*]]
+; CHECK:   bb55:
+; CHECK-NEXT:[[TMP57:%.*]] = icmp ult i8* [[W]], [[Y]]
+; CHECK-NEXT:br i1 true, label [[BB59:%.*]], label [[EARLY_EXIT]]
+; CHECK:   bb59:
+; CHECK-NEXT:[[TMP60:%.*]] = icmp ult i8* [[W]], [[Y]]
+; CHECK-NEXT:call void @use(i1 true)
+; CHECK-NEXT:ret void
+;
+  %tmp22 = getelementptr inbounds i8, i8* %y, i64 %x
+  %tmp26 = icmp ult i8* %tmp22, %z
+  br i1 %tmp26, label %bb28, label %early.exit
+
+early.exit:
+  unreachable
+
+bb28:
+  %tmp29 = getelementptr inbounds i8, i8* %y, i64 %x
+  %tmp30 = icmp ult i8* %tmp29, %z
+  br i1 %tmp30, label %early.exit, label %bb32
+
+bb32:
+  %tmp33 = icmp ult i8* %tmp29, %z
+  br i1 %tmp33, label %bb35, label %early.exit
+
+bb35:
+  %tmp36 = icmp ult i8* %y, %z
+  br i1 %tmp36, label %early.exit, label %bb38
+
+bb38:
+  %tmp41 = icmp ult i8* %y, %z
+  br i1 %tmp41, label %early.exit, label %bb43
+
+bb43:
+  %tmp47 = getelementptr 

[llvm-branch-commits] [llvm] d1c14dd - [gn build] Port 6b989a17107

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

Author: LLVM GN Syncbot
Date: 2020-12-06T20:12:22Z
New Revision: d1c14dd0fc95e8d3400dd447b516e073ba1efc07

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

LOG: [gn build] Port 6b989a17107

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 67755f9c7d00..c088d482ad6d 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Transforms/IPO/BUILD.gn
@@ -52,6 +52,7 @@ static_library("IPO") {
 "PassManagerBuilder.cpp",
 "PruneEH.cpp",
 "SCCP.cpp",
+"SampleContextTracker.cpp",
 "SampleProfile.cpp",
 "SampleProfileProbe.cpp",
 "StripDeadPrototypes.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] [llvm] 6b989a1 - [CSSPGO] Infrastructure for context-sensitive Sample PGO and Inlining

2020-12-06 Thread Wenlei He via llvm-branch-commits

Author: Wenlei He
Date: 2020-12-06T11:49:18-08:00
New Revision: 6b989a17107366a39a5362c561411caba10113a5

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

LOG: [CSSPGO] Infrastructure for context-sensitive Sample PGO and Inlining

This change adds the context-senstive sample PGO infracture described in CSSPGO 
RFC (https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s). It introduced an 
abstraction between input profile and profile loader that queries input profile 
for functions. Specifically, there's now the notion of base profile and context 
profile, and they are managed by the new SampleContextTracker for adjusting and 
merging profiles based on inline decisions. It works with top-down profiled 
guided inliner in profile loader (https://reviews.llvm.org/D70655) for better 
inlining with specialization and better post-inline profile fidelity. In the 
future, we can also expose this infrastructure to CGSCC inliner in order for it 
to take advantage of context-sensitive profile. This change is the consumption 
part of context-sensitive profile (The generation part is in this stack: 
https://reviews.llvm.org/D89707). We've seen good results internally in 
conjunction with Pseudo-probe (https://reviews.llvm.org/D86193). Pacthes for 
integration with Pseudo-probe coming up soon.

Currently the new infrastructure kick in when input profile contains the new 
context-sensitive profile; otherwise it's no-op and does not affect existing 
AutoFDO.

**Interface**

There're two sets of interfaces for query and tracking respectively exposed 
from SampleContextTracker. For query, now instead of simply getting a profile 
from input for a function, we can explicitly query base profile or context 
profile for given call path of a function. For tracking, there're separate APIs 
for marking context profile as inlined, or promoting and merging not inlined 
context profile.

- Query base profile (`getBaseSamplesFor`)
Base profile is the merged synthetic profile for function's CFG profile from 
any outstanding (not inlined) context. We can query base profile by function.

- Query context profile (`getContextSamplesFor`)
Context profile is a function's CFG profile for a given calling context. We can 
query context profile by context string.

- Track inlined context profile (`markContextSamplesInlined`)
When a function is inlined for given calling context, we need to mark the 
context profile for that context as inlined. This is to make sure we don't 
include inlined context profile when synthesizing base profile for that inlined 
function.

- Track not-inlined context profile (`promoteMergeContextSamplesTree`)
When a function is not inlined for given calling context, we need to promote 
the context profile tree so the not inlined context becomes top-level context. 
This preserve the sub-context under that function so later inline decision for 
that not inlined function will still have context profile for its call tree. 
Note that profile will be merged if needed when promoting a context profile 
tree if any of the node already exists at its promoted destination.

**Implementation**

Implementation-wise, `SampleContext` is created as abstraction for context. 
Currently it's a string for call path, and we can later optimize it to 
something more efficient, e.g. context id. Each `SampleContext` also has a 
`ContextState` indicating whether it's raw context profile from input, whether 
it's inlined or merged, whether it's synthetic profile created by compiler. 
Each `FunctionSamples` now has a `SampleContext` that tells whether it's base 
profile or context profile, and for context profile what is the context and 
state.

On top of the above context representation, a custom trie tree is implemented 
to track and manager context profiles. Specifically, `SampleContextTracker` is 
implemented that encapsulates a trie tree with `ContextTireNode` as node. Each 
node of the trie tree represents a frame in calling context, thus the path from 
root to a node represents a valid calling context. We also track 
`FunctionSamples` for each node, so this trie tree can serve efficient query 
for context profile. Accordingly, context profile tree promotion now becomes 
moving a subtree to be under the root of entire tree, and merge nodes for 
subtree if this move encounters existing nodes.

**Integration**

`SampleContextTracker` is now also integrated with AutoFDO, 
`SampleProfileReader` and `SampleProfileLoader`. When we detected input profile 
contains context-sensitive profile, `SampleContextTracker` will be used to 
track profiles, and all profile query will go to `SampleContextTracker` instead 
of `SampleProfileReader` automatically. Tracking APIs are called automatically 
for each inline decision from `SampleProfileLoader`.

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

Added: 

[llvm-branch-commits] [compiler-rt] 1408087 - [test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize-address-globals-dead-stripping

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

Author: Fangrui Song
Date: 2020-12-06T11:11:15-08:00
New Revision: 140808768d3e5c0f4e52dd42094650f5d282e34a

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

LOG: [test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with 
-fsanitize-address-globals-dead-stripping

r302591 dropped -fsanitize-address-globals-dead-stripping for ELF platforms
(to work around a gold<2.27 bug: 
https://sourceware.org/bugzilla/show_bug.cgi?id=19002)

Upgrade REQUIRES: from lto (COMPILER_RT_TEST_USE_LLD (set by Android, but 
rarely used elsewhere)) to lto-available.

Added: 


Modified: 
compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp

Removed: 




diff  --git a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp 
b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
index f6edc7032018..24dd1ae5b208 100644
--- a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
@@ -1,10 +1,11 @@
-// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld 
-ffunction-sections -fdata-sections -mllvm -asan-globals=0
-// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld 
-ffunction-sections -fdata-sections -mllvm -asan-globals=1
+/// Without instrumenting globals, --gc-sections drops the undefined symbol.
+// RUN: %clangxx_asan %s -o /dev/null -Wl,--gc-sections -fuse-ld=lld 
-ffunction-sections -fdata-sections -mllvm -asan-globals=0
+/// With -fsanitize-address-globals-dead-stripping and -fdata-sections, a 
garbage
+/// collectable custom metadata section is used for instrumented globals.
+// RUN: %clangxx_asan %s -o /dev/null -Wl,--gc-sections -fuse-ld=lld 
-ffunction-sections -fdata-sections -fsanitize-address-globals-dead-stripping
 
-// https://code.google.com/p/address-sanitizer/issues/detail?id=260
-// REQUIRES: lld
-// FIXME: This may pass on Android, with non-emulated-tls.
-// XFAIL: android
+// https://github.com/google/sanitizers/issues/260
+// REQUIRES: lld-available
 int undefined();
 
 // On i386 clang adds --export-dynamic when linking with ASan, which adds all



___
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] dde44f4 - [test] Fix asan/TestCases/Posix/lto-constmerge-odr.cpp when 'binutils_lto' is avaiable

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

Author: Fangrui Song
Date: 2020-12-06T10:31:40-08:00
New Revision: dde44f488c454b71d77ac022642b8711a8c340ca

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

LOG: [test] Fix asan/TestCases/Posix/lto-constmerge-odr.cpp when 'binutils_lto' 
is avaiable

If COMPILER_RT_TEST_USE_LLD is not set, config.use_lld will be False.
However, if feature 'binutils_lto' is available, lto_supported can still be 
True,
but config.target_cflags will not get -fuse-ld=lld from config.lto_flags

As a result, we may use clang -flto with system 'ld' which may not support the 
bitcode file, e.g.

  ld: error: /tmp/lto-constmerge-odr-44a1ee.o: Unknown attribute kind (70) 
(Producer: 'LLVM12.0.0git' Reader: 'LLVM 12.0.0git')
  // The system ld+LLVMgold.so do not support ATTR_KIND_MUSTPROGRESS (70).

Just require lld-available and add -fuse-ld=lld.

Added: 


Modified: 
compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp

Removed: 




diff  --git a/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp 
b/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp
index 9dc1397f6f0e..1370b5a8b136 100644
--- a/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp
@@ -1,7 +1,9 @@
-// RUN: %clangxx_asan -O3 -flto %s -o %t
+/// Instrumented globals are added to llvm.compiler.used, so LTO will not const
+/// merge them (which will cause spurious ODR violation).
+// RUN: %clangxx_asan -O3 -fuse-ld=lld -flto %s -o %t
 // RUN: %run %t 2>&1
 
-// REQUIRES: lto
+// REQUIRES: lld-available, lto
 
 int main(int argc, const char * argv[]) {
   struct { long width, height; } a = {16, 16};



___
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] ddb002d - [InstCombine] Remove replacePointer (NFC)

2020-12-06 Thread Kazu Hirata via llvm-branch-commits

Author: Kazu Hirata
Date: 2020-12-06T10:24:08-08:00
New Revision: ddb002d7c74c038b64dd9d3c3e4a4b58795cf1a6

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

LOG: [InstCombine] Remove replacePointer (NFC)

The declaration was introduced on Feb 10, 2017 in commit
ba01ed00fef32c48d8e2787a6feaf33568a80bfe without a corresponding
definition.

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstCombineInternal.h

Removed: 




diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h 
b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index e1a9e7515df04..6468e406c5277 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -182,11 +182,6 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
   bool replacedSelectWithOperand(SelectInst *SI, const ICmpInst *Icmp,
  const unsigned SIOpd);
 
-  /// Try to replace instruction \p I with value \p V which are pointers
-  /// in 
diff erent address space.
-  /// \return true if successful.
-  bool replacePointer(Instruction , Value *V);
-
   LoadInst *combineLoadToNewType(LoadInst , Type *NewTy,
  const Twine  = "");
 



___
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] 0101fb7 - [X86] Fold MOVMSK(ICMP_SGT(X, -1)) -> NOT(MOVMSK(X)))

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

Author: Simon Pilgrim
Date: 2020-12-06T17:56:41Z
New Revision: 0101fb73de71132bd5b25cfadc63974c692dbc5b

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

LOG: [X86] Fold MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X)))

Noticed while triaging PR37506

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/combine-movmsk.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 690eb39fa0d4..cb23f270c156 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -47378,7 +47378,7 @@ static SDValue combineMOVMSK(SDNode *N, SelectionDAG 
,
   Src.getOperand(0).getScalarValueSizeInBits() == EltWidth)
 return DAG.getNode(X86ISD::MOVMSK, SDLoc(N), VT, Src.getOperand(0));
 
-  // Fold movmsk(not(x)) -> not(movmsk) to improve folding of movmsk results
+  // Fold movmsk(not(x)) -> not(movmsk(x)) to improve folding of movmsk results
   // with scalar comparisons.
   if (SDValue NotSrc = IsNOT(Src, DAG)) {
 SDLoc DL(N);
@@ -47389,6 +47389,17 @@ static SDValue combineMOVMSK(SDNode *N, SelectionDAG 
,
DAG.getConstant(NotMask, DL, VT));
   }
 
+  // Fold movmsk(icmp_sgt(x,-1)) -> not(movmsk(x)) to improve folding of movmsk
+  // results with scalar comparisons.
+  if (Src.getOpcode() == X86ISD::PCMPGT &&
+  ISD::isBuildVectorAllOnes(Src.getOperand(1).getNode())) {
+SDLoc DL(N);
+APInt NotMask = APInt::getLowBitsSet(NumBits, NumElts);
+return DAG.getNode(ISD::XOR, DL, VT,
+   DAG.getNode(X86ISD::MOVMSK, DL, VT, Src.getOperand(0)),
+   DAG.getConstant(NotMask, DL, VT));
+  }
+
   // Simplify the inputs.
   const TargetLowering  = DAG.getTargetLoweringInfo();
   APInt DemandedMask(APInt::getAllOnesValue(NumBits));

diff  --git a/llvm/test/CodeGen/X86/combine-movmsk.ll 
b/llvm/test/CodeGen/X86/combine-movmsk.ll
index 7b5e057d6620..b93b747fb9d4 100644
--- a/llvm/test/CodeGen/X86/combine-movmsk.ll
+++ b/llvm/test/CodeGen/X86/combine-movmsk.ll
@@ -178,22 +178,20 @@ define i1 @pmovmskb_allof_bitcast_v4f32(<4 x float> %a0) {
   ret i1 %5
 }
 
-; FIXME: MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X)))
+; MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X)))
 define i1 @movmskps_allof_v4i32_positive(<4 x i32> %a0) {
 ; SSE-LABEL: movmskps_allof_v4i32_positive:
 ; SSE:   # %bb.0:
-; SSE-NEXT:pcmpeqd %xmm1, %xmm1
-; SSE-NEXT:pcmpgtd %xmm1, %xmm0
 ; SSE-NEXT:movmskps %xmm0, %eax
+; SSE-NEXT:xorl $15, %eax
 ; SSE-NEXT:cmpl $15, %eax
 ; SSE-NEXT:sete %al
 ; SSE-NEXT:retq
 ;
 ; AVX-LABEL: movmskps_allof_v4i32_positive:
 ; AVX:   # %bb.0:
-; AVX-NEXT:vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX-NEXT:vpcmpgtd %xmm1, %xmm0, %xmm0
 ; AVX-NEXT:vmovmskps %xmm0, %eax
+; AVX-NEXT:xorl $15, %eax
 ; AVX-NEXT:cmpl $15, %eax
 ; AVX-NEXT:sete %al
 ; AVX-NEXT:retq
@@ -208,19 +206,15 @@ define i1 @movmskps_allof_v4i32_positive(<4 x i32> %a0) {
 define i1 @pmovmskb_noneof_v16i8_positive(<16 x i8> %a0) {
 ; SSE-LABEL: pmovmskb_noneof_v16i8_positive:
 ; SSE:   # %bb.0:
-; SSE-NEXT:pcmpeqd %xmm1, %xmm1
-; SSE-NEXT:pcmpgtb %xmm1, %xmm0
 ; SSE-NEXT:pmovmskb %xmm0, %eax
-; SSE-NEXT:testl %eax, %eax
+; SSE-NEXT:xorl $65535, %eax # imm = 0x
 ; SSE-NEXT:sete %al
 ; SSE-NEXT:retq
 ;
 ; AVX-LABEL: pmovmskb_noneof_v16i8_positive:
 ; AVX:   # %bb.0:
-; AVX-NEXT:vpcmpeqd %xmm1, %xmm1, %xmm1
-; AVX-NEXT:vpcmpgtb %xmm1, %xmm0, %xmm0
 ; AVX-NEXT:vpmovmskb %xmm0, %eax
-; AVX-NEXT:testl %eax, %eax
+; AVX-NEXT:xorl $65535, %eax # imm = 0x
 ; AVX-NEXT:sete %al
 ; AVX-NEXT:retq
   %1 = icmp sgt <16 x i8> %a0, 



___
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] d6941a1 - [X86] Add tests for missing MOVMSK(ICMP_SGT(X, -1)) -> NOT(MOVMSK(X))) fold

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

Author: Simon Pilgrim
Date: 2020-12-06T17:48:27Z
New Revision: d6941a197941ace2b882d367e785218c27d9c843

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

LOG: [X86] Add tests for missing MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X))) fold

Noticed while triaging PR37506

Added: 


Modified: 
llvm/test/CodeGen/X86/combine-movmsk.ll

Removed: 




diff  --git a/llvm/test/CodeGen/X86/combine-movmsk.ll 
b/llvm/test/CodeGen/X86/combine-movmsk.ll
index 45e6f0e92198..7b5e057d6620 100644
--- a/llvm/test/CodeGen/X86/combine-movmsk.ll
+++ b/llvm/test/CodeGen/X86/combine-movmsk.ll
@@ -178,6 +178,58 @@ define i1 @pmovmskb_allof_bitcast_v4f32(<4 x float> %a0) {
   ret i1 %5
 }
 
+; FIXME: MOVMSK(ICMP_SGT(X,-1)) -> NOT(MOVMSK(X)))
+define i1 @movmskps_allof_v4i32_positive(<4 x i32> %a0) {
+; SSE-LABEL: movmskps_allof_v4i32_positive:
+; SSE:   # %bb.0:
+; SSE-NEXT:pcmpeqd %xmm1, %xmm1
+; SSE-NEXT:pcmpgtd %xmm1, %xmm0
+; SSE-NEXT:movmskps %xmm0, %eax
+; SSE-NEXT:cmpl $15, %eax
+; SSE-NEXT:sete %al
+; SSE-NEXT:retq
+;
+; AVX-LABEL: movmskps_allof_v4i32_positive:
+; AVX:   # %bb.0:
+; AVX-NEXT:vpcmpeqd %xmm1, %xmm1, %xmm1
+; AVX-NEXT:vpcmpgtd %xmm1, %xmm0, %xmm0
+; AVX-NEXT:vmovmskps %xmm0, %eax
+; AVX-NEXT:cmpl $15, %eax
+; AVX-NEXT:sete %al
+; AVX-NEXT:retq
+  %1 = icmp sgt <4 x i32> %a0, 
+  %2 = sext <4 x i1> %1 to <4 x i32>
+  %3 = bitcast <4 x i32> %2 to <4 x float>
+  %4 = tail call i32 @llvm.x86.sse.movmsk.ps(<4 x float> %3)
+  %5 = icmp eq i32 %4, 15
+  ret i1 %5
+}
+
+define i1 @pmovmskb_noneof_v16i8_positive(<16 x i8> %a0) {
+; SSE-LABEL: pmovmskb_noneof_v16i8_positive:
+; SSE:   # %bb.0:
+; SSE-NEXT:pcmpeqd %xmm1, %xmm1
+; SSE-NEXT:pcmpgtb %xmm1, %xmm0
+; SSE-NEXT:pmovmskb %xmm0, %eax
+; SSE-NEXT:testl %eax, %eax
+; SSE-NEXT:sete %al
+; SSE-NEXT:retq
+;
+; AVX-LABEL: pmovmskb_noneof_v16i8_positive:
+; AVX:   # %bb.0:
+; AVX-NEXT:vpcmpeqd %xmm1, %xmm1, %xmm1
+; AVX-NEXT:vpcmpgtb %xmm1, %xmm0, %xmm0
+; AVX-NEXT:vpmovmskb %xmm0, %eax
+; AVX-NEXT:testl %eax, %eax
+; AVX-NEXT:sete %al
+; AVX-NEXT:retq
+  %1 = icmp sgt <16 x i8> %a0, 
+  %2 = sext <16 x i1> %1 to <16 x i8>
+  %3 = tail call i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8> %2)
+  %4 = icmp eq i32 %3, 0
+  ret i1 %4
+}
+
 ; AND(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(AND(X,Y))
 ; XOR(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(XOR(X,Y))
 ; OR(MOVMSK(X),MOVMSK(Y)) -> MOVMSK(OR(X,Y))



___
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] ac522f8 - [DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)

2020-12-06 Thread Sanjay Patel via llvm-branch-commits

Author: Layton Kifer
Date: 2020-12-06T11:52:10-05:00
New Revision: ac522f87002ffc20d377e284080c9fa7f63216fc

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

LOG: [DAGCombiner] Fold (sext (not i1 x)) -> (add (zext i1 x), -1)

Move fold of (sext (not i1 x)) -> (add (zext i1 x), -1) from X86 to DAGCombiner 
to improve codegen on other targets.

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

Added: 


Modified: 
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/AArch64/select_const.ll
llvm/test/CodeGen/ARM/select_const.ll
llvm/test/CodeGen/PowerPC/select_const.ll
llvm/test/CodeGen/RISCV/sext-zext-trunc.ll
llvm/test/CodeGen/SystemZ/sext-zext.ll
llvm/test/CodeGen/X86/pr44140.ll

Removed: 




diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp 
b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index b1a3d849ed99..c40c2502f536 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10663,6 +10663,19 @@ SDValue DAGCombiner::visitSIGN_EXTEND(SDNode *N) {
 return DAG.getNode(ISD::ADD, DL, VT, Zext, DAG.getAllOnesConstant(DL, VT));
   }
 
+  // fold sext (not i1 X) -> add (zext i1 X), -1
+  // TODO: This could be extended to handle bool vectors.
+  if (N0.getValueType() == MVT::i1 && isBitwiseNot(N0) && N0.hasOneUse() &&
+  (!LegalOperations || (TLI.isOperationLegal(ISD::ZERO_EXTEND, VT) &&
+TLI.isOperationLegal(ISD::ADD, VT {
+// If we can eliminate the 'not', the sext form should be better
+if (SDValue NewXor = visitXOR(N0.getNode()))
+  return DAG.getNode(ISD::SIGN_EXTEND, DL, VT, NewXor);
+
+SDValue Zext = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N0.getOperand(0));
+return DAG.getNode(ISD::ADD, DL, VT, Zext, DAG.getAllOnesConstant(DL, VT));
+  }
+
   return SDValue();
 }
 

diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index bfd80690347d..690eb39fa0d4 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -46882,7 +46882,6 @@ static SDValue combineSext(SDNode *N, SelectionDAG ,
const X86Subtarget ) {
   SDValue N0 = N->getOperand(0);
   EVT VT = N->getValueType(0);
-  EVT InVT = N0.getValueType();
   SDLoc DL(N);
 
   // (i32 (sext (i8 (x86isd::setcc_carry -> (i32 (x86isd::setcc_carry))
@@ -46911,16 +46910,6 @@ static SDValue combineSext(SDNode *N, SelectionDAG 
,
   if (SDValue V = combineExtSetcc(N, DAG, Subtarget))
 return V;
 
-  if (InVT == MVT::i1 && N0.getOpcode() == ISD::XOR &&
-  isAllOnesConstant(N0.getOperand(1)) && N0.hasOneUse()) {
-// Invert and sign-extend a boolean is the same as zero-extend and subtract
-// 1 because 0 becomes -1 and 1 becomes 0. The subtract is efficiently
-// lowered with an LEA or a DEC. This is the same as: select Bool, 0, -1.
-// sext (xor Bool, -1) --> sub (zext Bool), 1
-SDValue Zext = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N0.getOperand(0));
-return DAG.getNode(ISD::SUB, DL, VT, Zext, DAG.getConstant(1, DL, VT));
-  }
-
   if (SDValue V = combineToExtendBoolVectorInReg(N, DAG, DCI, Subtarget))
 return V;
 

diff  --git a/llvm/test/CodeGen/AArch64/select_const.ll 
b/llvm/test/CodeGen/AArch64/select_const.ll
index affb8150ff85..945e7cdc35ad 100644
--- a/llvm/test/CodeGen/AArch64/select_const.ll
+++ b/llvm/test/CodeGen/AArch64/select_const.ll
@@ -68,8 +68,8 @@ define i32 @select_1_or_0_signext(i1 signext %cond) {
 define i32 @select_0_or_neg1(i1 %cond) {
 ; CHECK-LABEL: select_0_or_neg1:
 ; CHECK:   // %bb.0:
-; CHECK-NEXT:mvn w8, w0
-; CHECK-NEXT:sbfx w0, w8, #0, #1
+; CHECK-NEXT:and w8, w0, #0x1
+; CHECK-NEXT:sub w0, w8, #1 // =1
 ; CHECK-NEXT:ret
   %sel = select i1 %cond, i32 0, i32 -1
   ret i32 %sel
@@ -78,8 +78,7 @@ define i32 @select_0_or_neg1(i1 %cond) {
 define i32 @select_0_or_neg1_zeroext(i1 zeroext %cond) {
 ; CHECK-LABEL: select_0_or_neg1_zeroext:
 ; CHECK:   // %bb.0:
-; CHECK-NEXT:mvn w8, w0
-; CHECK-NEXT:sbfx w0, w8, #0, #1
+; CHECK-NEXT:sub w0, w0, #1 // =1
 ; CHECK-NEXT:ret
   %sel = select i1 %cond, i32 0, i32 -1
   ret i32 %sel

diff  --git a/llvm/test/CodeGen/ARM/select_const.ll 
b/llvm/test/CodeGen/ARM/select_const.ll
index 500426074736..03f538ea5313 100644
--- a/llvm/test/CodeGen/ARM/select_const.ll
+++ b/llvm/test/CodeGen/ARM/select_const.ll
@@ -137,23 +137,21 @@ define i32 @select_1_or_0_signext(i1 signext %cond) {
 define i32 @select_0_or_neg1(i1 %cond) {
 ; ARM-LABEL: select_0_or_neg1:
 ; ARM:   @ %bb.0:
-; ARM-NEXT:mov r1, #1
-; ARM-NEXT:bic r0, r1, r0
-; ARM-NEXT:rsb r0, r0, #0
+; 

[llvm-branch-commits] [llvm] 0b3e393 - [TableGen] [CodeGenTarget] Cache the target's instruction namespace.

2020-12-06 Thread Paul C. Anagnostopoulos via llvm-branch-commits

Author: Paul C. Anagnostopoulos
Date: 2020-12-06T11:08:30-05:00
New Revision: 0b3e393d6c8b0f6bb8a13b1a71aba796c87ed239

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

LOG: [TableGen] [CodeGenTarget] Cache the target's instruction namespace.

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

Added: 


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

Removed: 




diff  --git a/llvm/utils/TableGen/CodeGenTarget.cpp 
b/llvm/utils/TableGen/CodeGenTarget.cpp
index 794bb622dc99..d8e1d7f8cf0d 100644
--- a/llvm/utils/TableGen/CodeGenTarget.cpp
+++ b/llvm/utils/TableGen/CodeGenTarget.cpp
@@ -264,15 +264,20 @@ const StringRef CodeGenTarget::getName() const {
   return TargetRec->getName();
 }
 
+/// getInstNamespace - Find and return the target machine's instruction
+/// namespace. The namespace is cached because it is requested multiple times.
 StringRef CodeGenTarget::getInstNamespace() const {
-  for (const CodeGenInstruction *Inst : getInstructionsByEnumValue()) {
-// Make sure not to pick up "TargetOpcode" by accidentally getting
-// the namespace off the PHI instruction or something.
-if (Inst->Namespace != "TargetOpcode")
-  return Inst->Namespace;
+  if (InstNamespace.empty()) {
+for (const CodeGenInstruction *Inst : getInstructionsByEnumValue()) {
+  // We are not interested in the "TargetOpcode" namespace.
+  if (Inst->Namespace != "TargetOpcode") {
+InstNamespace = Inst->Namespace;
+break;
+  }
+}
   }
 
-  return "";
+  return InstNamespace;
 }
 
 StringRef CodeGenTarget::getRegNamespace() const {

diff  --git a/llvm/utils/TableGen/CodeGenTarget.h 
b/llvm/utils/TableGen/CodeGenTarget.h
index 44bc46a0a421..cc5bbe7a8bfe 100644
--- a/llvm/utils/TableGen/CodeGenTarget.h
+++ b/llvm/utils/TableGen/CodeGenTarget.h
@@ -60,6 +60,7 @@ class CodeGenTarget {
 
   mutable std::unique_ptr SchedModels;
 
+  mutable StringRef InstNamespace;
   mutable std::vector InstrsByEnum;
   mutable unsigned NumPseudoInstructions = 0;
 public:



___
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] e2279c2 - [libc++] [docs] Mark P1865 as complete since 11.0 as it was implemented together with P1135. Fix synopses in and .

2020-12-06 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2020-12-06T15:36:52+01:00
New Revision: e2279c2350b83650a858a541ff566eccd69d38ef

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

LOG: [libc++] [docs] Mark P1865 as complete since 11.0 as it was implemented 
together with P1135. Fix synopses in  and .

It was implemented in commit 54fa9ecd3088508b05b0c5b5cb52da8a3c188655 ([libc++] 
Implementation of C++20's P1135R6 for libcxx).

Added: 


Modified: 
libcxx/docs/Cxx2aStatusPaperStatus.csv
libcxx/include/barrier
libcxx/include/latch

Removed: 




diff  --git a/libcxx/docs/Cxx2aStatusPaperStatus.csv 
b/libcxx/docs/Cxx2aStatusPaperStatus.csv
index 3e027327b6ae..4efad23981cf 100644
--- a/libcxx/docs/Cxx2aStatusPaperStatus.csv
+++ b/libcxx/docs/Cxx2aStatusPaperStatus.csv
@@ -110,7 +110,7 @@
 "`P1004 `__","LWG","Making std::vector 
constexpr","Cologne","",""
 "`P1035 `__","LWG","Input Range 
Adaptors","Cologne","",""
 "`P1065 `__","LWG","Constexpr INVOKE","Cologne","",""
-"`P1135 `__","LWG","The C++20 Synchronization 
Library","Cologne","|Complete|",""
+"`P1135 `__","LWG","The C++20 Synchronization 
Library","Cologne","|Complete|","11.0"
 "`P1207 `__","LWG","Movability of Single-pass 
Iterators","Cologne","",""
 "`P1208 `__","LWG","Adopt source_location for 
C++20","Cologne","",""
 "`P1355 `__","LWG","Exposing a narrow contract for 
ceil2","Cologne","|Complete|","9.0"
@@ -151,7 +151,7 @@
 "`P1723 `__","LWG","Mandating the Standard Library: 
Clause 31 - Atomics library","Belfast","* *",""
 "`P1855 `__","LWG","Make \  
freestanding","Belfast","* *",""
 "`P1862 `__","LWG","Ranges adaptors for non-copyable 
iterators","Belfast","* *",""
-"`P1865 `__","LWG","Add max() to latch and 
barrier","Belfast","* *",""
+"`P1865 `__","LWG","Add max() to latch and 
barrier","Belfast","|Complete|","11.0"
 "`P1869 `__","LWG","Rename 'condition_variable_any' 
interruptible wait methods","Belfast","* *",""
 "`P1870 `__","LWG","forwarding-range is too 
subtle","Belfast","* *",""
 "`P1871 `__","LWG","Should concepts be enabled or 
disabled?","Belfast","* *",""

diff  --git a/libcxx/include/barrier b/libcxx/include/barrier
index ba9e8ea9bb84..be213a6895ef 100644
--- a/libcxx/include/barrier
+++ b/libcxx/include/barrier
@@ -22,6 +22,8 @@ namespace std
   public:
 using arrival_token = see below;
 
+static constexpr ptr
diff _t max() noexcept;
+
 constexpr explicit barrier(ptr
diff _t phase_count,
CompletionFunction f = CompletionFunction());
 ~barrier();

diff  --git a/libcxx/include/latch b/libcxx/include/latch
index b338f091316c..a894f8cafd1c 100644
--- a/libcxx/include/latch
+++ b/libcxx/include/latch
@@ -19,6 +19,8 @@ namespace std
   class latch
   {
   public:
+static constexpr ptr
diff _t max() noexcept;
+
 constexpr explicit latch(ptr
diff _t __expected);
 ~latch();
 



___
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] 94f6d36 - [InstCombine] avoid crash on phi with unreachable incoming block (PR48369)

2020-12-06 Thread Sanjay Patel via llvm-branch-commits

Author: Sanjay Patel
Date: 2020-12-06T09:31:47-05:00
New Revision: 94f6d365e4be0cf05930df0eedd2bfb23f6fce51

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

LOG: [InstCombine] avoid crash on phi with unreachable incoming block (PR48369)

Added: 


Modified: 
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/phi-select-constant.ll

Removed: 




diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp 
b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 92504da01cbf..cab6f1e5632f 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -1083,9 +1083,11 @@ Instruction *InstCombinerImpl::foldOpIntoPhi(Instruction 
, PHINode *PN) {
   // operation in that block.  However, if this is a critical edge, we would be
   // inserting the computation on some other paths (e.g. inside a loop).  Only
   // do this if the pred block is unconditionally branching into the phi block.
+  // Also, make sure that the pred block is not dead code.
   if (NonConstBB != nullptr) {
 BranchInst *BI = dyn_cast(NonConstBB->getTerminator());
-if (!BI || !BI->isUnconditional()) return nullptr;
+if (!BI || !BI->isUnconditional() || !DT.isReachableFromEntry(NonConstBB))
+  return nullptr;
   }
 
   // Okay, we can do the transformation: create the new PHI node.

diff  --git a/llvm/test/Transforms/InstCombine/phi-select-constant.ll 
b/llvm/test/Transforms/InstCombine/phi-select-constant.ll
index 9d1c973925bb..c65be75c0b4a 100644
--- a/llvm/test/Transforms/InstCombine/phi-select-constant.ll
+++ b/llvm/test/Transforms/InstCombine/phi-select-constant.ll
@@ -77,16 +77,16 @@ final:
 define <2 x i8> @vec3(i1 %cond1, i1 %cond2, <2 x i1> %x, <2 x i8> %y, <2 x i8> 
%z) {
 ; CHECK-LABEL: @vec3(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:[[PHITMP1:%.*]] = shufflevector <2 x i8> [[Z:%.*]], <2 x i8> 
[[Y:%.*]], <2 x i32> 
+; CHECK-NEXT:[[PHI_SEL1:%.*]] = shufflevector <2 x i8> [[Z:%.*]], <2 x i8> 
[[Y:%.*]], <2 x i32> 
 ; CHECK-NEXT:br i1 [[COND1:%.*]], label [[IF1:%.*]], label [[ELSE:%.*]]
 ; CHECK:   if1:
-; CHECK-NEXT:[[PHITMP2:%.*]] = shufflevector <2 x i8> [[Y]], <2 x i8> 
[[Z]], <2 x i32> 
+; CHECK-NEXT:[[PHI_SEL2:%.*]] = shufflevector <2 x i8> [[Y]], <2 x i8> 
[[Z]], <2 x i32> 
 ; CHECK-NEXT:br i1 [[COND2:%.*]], label [[IF2:%.*]], label [[ELSE]]
 ; CHECK:   if2:
-; CHECK-NEXT:[[PHITMP:%.*]] = select <2 x i1> [[X:%.*]], <2 x i8> [[Y]], 
<2 x i8> [[Z]]
+; CHECK-NEXT:[[PHI_SEL:%.*]] = select <2 x i1> [[X:%.*]], <2 x i8> [[Y]], 
<2 x i8> [[Z]]
 ; CHECK-NEXT:br label [[ELSE]]
 ; CHECK:   else:
-; CHECK-NEXT:[[PHI:%.*]] = phi <2 x i8> [ [[PHITMP]], [[IF2]] ], [ 
[[PHITMP1]], [[ENTRY:%.*]] ], [ [[PHITMP2]], [[IF1]] ]
+; CHECK-NEXT:[[PHI:%.*]] = phi <2 x i8> [ [[PHI_SEL]], [[IF2]] ], [ 
[[PHI_SEL1]], [[ENTRY:%.*]] ], [ [[PHI_SEL2]], [[IF1]] ]
 ; CHECK-NEXT:ret <2 x i8> [[PHI]]
 ;
 entry:
@@ -103,3 +103,37 @@ else:
   %sel = select <2 x i1> %phi, <2 x i8> %y, <2 x i8> %z
   ret <2 x i8> %sel
 }
+
+; Don't crash on unreachable IR.
+
+define void @PR48369(i32 %a, i32* %p) {
+; CHECK-LABEL: @PR48369(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:[[PHI_CMP:%.*]] = icmp sgt i32 [[A:%.*]], 0
+; CHECK-NEXT:br label [[BB1:%.*]]
+; CHECK:   bb1:
+; CHECK-NEXT:[[CMP:%.*]] = phi i1 [ [[PHI_CMP]], [[DEADBB:%.*]] ], [ true, 
[[ENTRY:%.*]] ]
+; CHECK-NEXT:[[SHL:%.*]] = select i1 [[CMP]], i32 256, i32 0
+; CHECK-NEXT:store i32 [[SHL]], i32* [[P:%.*]], align 4
+; CHECK-NEXT:br label [[END:%.*]]
+; CHECK:   deadbb:
+; CHECK-NEXT:br label [[BB1]]
+; CHECK:   end:
+; CHECK-NEXT:ret void
+;
+entry:
+  %phi.cmp = icmp sgt i32 %a, 0
+  br label %bb1
+
+bb1:
+  %cmp = phi i1 [ %phi.cmp, %deadbb ], [ true, %entry ]
+  %shl = select i1 %cmp, i32 256, i32 0
+  store i32 %shl, i32* %p
+  br label %end
+
+deadbb:
+  br label %bb1
+
+end:
+  ret void
+}



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


[llvm-branch-commits] [libcxx] f632673 - [libc++] [LWG3374] Mark `to_address(const Ptr& p)` overload `constexpr`.

2020-12-06 Thread Marek Kurdej via llvm-branch-commits

Author: Marek Kurdej
Date: 2020-12-06T15:26:26+01:00
New Revision: f6326736ba166f0a9bfa4e9be019f84fc3143651

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

LOG: [libc++] [LWG3374] Mark `to_address(const Ptr& p)` overload `constexpr`.

Reviewed By: ldionne, #libc

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

Added: 


Modified: 
libcxx/docs/Cxx2aStatusIssuesStatus.csv
libcxx/include/memory
libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp

Removed: 




diff  --git a/libcxx/docs/Cxx2aStatusIssuesStatus.csv 
b/libcxx/docs/Cxx2aStatusIssuesStatus.csv
index 4c78b1655631..4ef24005a3c0 100644
--- a/libcxx/docs/Cxx2aStatusIssuesStatus.csv
+++ b/libcxx/docs/Cxx2aStatusIssuesStatus.csv
@@ -278,7 +278,7 @@
 "`3371 `__","``visit_format_arg``\  and 
``make_format_args``\  are not hidden friends","Prague","",""
 "`3372 `__","``vformat_to``\  should not try to 
deduce ``Out``\  twice","Prague","",""
 "`3373 `__","``{to,from}_chars_result``\  and 
``format_to_n_result``\  need the  ""we really mean what we say"" 
wording","Prague","",""
-"`3374 `__","P0653 + P1006 should have made the 
other ``std::to_address``\  overload ``constexpr``\ ","Prague","",""
+"`3374 `__","P0653 + P1006 should have made the 
other ``std::to_address``\  overload ``constexpr``\ 
","Prague","|Complete|","12.0"
 "`3375 `__","``decay``\  in ``viewable_range``\  
should be ``remove_cvref``\ ","Prague","",""
 "`3377 `__","``elements_view::iterator``\  
befriends a specialization of itself","Prague","",""
 "`3379 `__","""``safe``\ "" in several library 
names is misleading","Prague","",""

diff  --git a/libcxx/include/memory b/libcxx/include/memory
index 402a735419c8..77d7b67112e3 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -46,7 +46,7 @@ struct pointer_traits
 };
 
 template  constexpr T* to_address(T* p) noexcept; // C++20
-template  auto to_address(const Ptr& p) noexcept; // C++20
+template  constexpr auto to_address(const Ptr& p) noexcept; // C++20
 
 template 
 struct allocator_traits
@@ -1077,7 +1077,7 @@ to_address(_Tp* __p) _NOEXCEPT
 }
 
 template 
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY constexpr
 auto
 to_address(const _Pointer& __p) _NOEXCEPT
 {

diff  --git 
a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp 
b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
index 2b9928f4df7e..26eba0e06cff 100644
--- a/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
+++ b/libcxx/test/std/utilities/memory/pointer.conversion/to_address.pass.cpp
@@ -11,7 +11,7 @@
 // UNSUPPORTED: c++03, c++11, c++14, c++17
 
 // template  constexpr T* to_address(T* p) noexcept;
-// template  auto to_address(const Ptr& p) noexcept;
+// template  constexpr auto to_address(const Ptr& p) noexcept;
 
 #include 
 #include 
@@ -22,10 +22,10 @@ class P1
 public:
 using element_type = int;
 
-explicit P1(int* p)
+constexpr explicit P1(int* p)
 : p_(p) { }
 
-int* operator->() const noexcept
+constexpr int* operator->() const noexcept
 { return p_; }
 
 private:
@@ -37,10 +37,10 @@ class P2
 public:
 using element_type = int;
 
-explicit P2(int* p)
+constexpr explicit P2(int* p)
 : p_(p) { }
 
-P1 operator->() const noexcept
+constexpr P1 operator->() const noexcept
 { return p_; }
 
 private:
@@ -50,10 +50,10 @@ class P2
 class P3
 {
 public:
-explicit P3(int* p)
+constexpr explicit P3(int* p)
 : p_(p) { }
 
-int* get() const noexcept
+constexpr int* get() const noexcept
 { return p_; }
 
 private:
@@ -65,7 +65,7 @@ namespace std
 template<>
 struct pointer_traits<::P3>
 {
-static int* to_address(const ::P3& p) noexcept
+static constexpr int* to_address(const ::P3& p) noexcept
 { return p.get(); }
 };
 }
@@ -73,13 +73,13 @@ struct pointer_traits<::P3>
 class P4
 {
 public:
-explicit P4(int* p)
+constexpr explicit P4(int* p)
 : p_(p) { }
 
-int* operator->() const noexcept
+constexpr int* operator->() const noexcept
 { return nullptr; }
 
-int* get() const noexcept
+constexpr int* get() const noexcept
 { return p_; }
 
 private:
@@ -91,7 +91,7 @@ namespace std
 template<>
 struct pointer_traits<::P4>
 {
-static int* to_address(const ::P4& p) noexcept
+constexpr static int* to_address(const ::P4& p) noexcept
 { return p.get(); }
 };
 }
@@ -99,23 +99,28 @@ struct pointer_traits<::P4>
 int n = 0;
 static_assert(std::to_address() == );
 
-int 

[llvm-branch-commits] [llvm] db90099 - [CostModel][X86] getGatherScatterOpCost - use default implementation for alt costkinds

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

Author: Simon Pilgrim
Date: 2020-12-06T14:08:26Z
New Revision: db900995ed15155062dec217569dbbffb6f49911

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

LOG: [CostModel][X86] getGatherScatterOpCost - use default implementation for 
alt costkinds

Noticed while looking at D92701 - we only really handle TCK_RecipThroughput 
gather/scatter costs - for now drop back to the default implementation for 
non-legal gathers/scatters.

Added: 


Modified: 
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp 
b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index 36a04a850110..6a52714fee41 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -4087,7 +4087,8 @@ int X86TTIImpl::getScatterOverhead() const {
   return 1024;
 }
 
-// Return an average cost of Gather / Scatter instruction, maybe improved later
+// Return an average cost of Gather / Scatter instruction, maybe improved 
later.
+// FIXME: Add TargetCostKind support.
 int X86TTIImpl::getGSVectorCost(unsigned Opcode, Type *SrcVTy, const Value 
*Ptr,
 Align Alignment, unsigned AddressSpace) {
 
@@ -4160,6 +4161,7 @@ int X86TTIImpl::getGSVectorCost(unsigned Opcode, Type 
*SrcVTy, const Value *Ptr,
 /// Alignment - Alignment for one element.
 /// AddressSpace - pointer[s] address space.
 ///
+/// FIXME: Add TargetCostKind support.
 int X86TTIImpl::getGSScalarCost(unsigned Opcode, Type *SrcVTy,
 bool VariableMask, Align Alignment,
 unsigned AddressSpace) {
@@ -4206,9 +4208,15 @@ int X86TTIImpl::getGatherScatterOpCost(unsigned Opcode, 
Type *SrcVTy,
Align Alignment,
TTI::TargetCostKind CostKind,
const Instruction *I = nullptr) {
-
-  if (CostKind != TTI::TCK_RecipThroughput)
-return 1;
+  if (CostKind != TTI::TCK_RecipThroughput) {
+if ((Opcode == Instruction::Load &&
+ isLegalMaskedGather(SrcVTy, Align(Alignment))) ||
+(Opcode == Instruction::Store &&
+ isLegalMaskedScatter(SrcVTy, Align(Alignment
+  return 1;
+return BaseT::getGatherScatterOpCost(Opcode, SrcVTy, Ptr, VariableMask,
+ Alignment, CostKind, I);
+  }
 
   assert(SrcVTy->isVectorTy() && "Unexpected data type for Gather/Scatter");
   unsigned VF = cast(SrcVTy)->getNumElements();

diff  --git a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll 
b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
index 4d0dbe544fb5..08d4a46896fe 100644
--- a/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
+++ b/llvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll
@@ -289,11 +289,11 @@ define void @maskedgather(<16 x float*> %va, <16 x i1> 
%vb, <16 x float> %vc) {
 ; LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret 
void
 ;
 ; SIZE-LABEL: 'maskedgather'
-; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v = 
call <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*> %va, i32 1, 
<16 x i1> %vb, <16 x float> %vc)
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: %v = 
call <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*> %va, i32 1, 
<16 x i1> %vb, <16 x float> %vc)
 ; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret 
void
 ;
 ; SIZE_LATE-LABEL: 'maskedgather'
-; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: 
%v = call <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*> %va, 
i32 1, <16 x i1> %vb, <16 x float> %vc)
+; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: 
%v = call <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*> %va, 
i32 1, <16 x i1> %vb, <16 x float> %vc)
 ; SIZE_LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: 
ret void
 ;
   %v = call <16 x float> @llvm.masked.gather.v16f32.v16p0f32(<16 x float*> 
%va, i32 1, <16 x i1> %vb, <16 x float> %vc)
@@ -310,11 +310,11 @@ define void @maskedscatter(<16 x float> %va, <16 x 
float*> %vb, <16 x i1> %vc) {
 ; LATE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: ret 
void
 ;
 ; SIZE-LABEL: 'maskedscatter'
-; SIZE-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: call 
void @llvm.masked.scatter.v16f32.v16p0f32(<16 x float> %va, <16 x float*> %vb, 
i32 1, <16 x i1> %vc)
+; SIZE-NEXT:  Cost Model: Found an estimated cost of 76 for instruction: call 
void 

[llvm-branch-commits] [openmp] e1b8e8a - [libomptarget][amdgpu] Skip device_State allocation when using bss global

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

Author: Jon Chesterfield
Date: 2020-12-06T12:13:56Z
New Revision: e1b8e8a1f4c35c8596956d56ffc9f1d91b64f780

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

LOG: [libomptarget][amdgpu] Skip device_State allocation when using bss global

Added: 


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

Removed: 




diff  --git a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp 
b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
index ea8770e4543a..e688ef7f41ec 100644
--- a/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins/amdgpu/src/rtl.cpp
@@ -1033,54 +1033,64 @@ __tgt_target_table 
*__tgt_rtl_load_binary_locked(int32_t device_id,
 
   DP("ATMI module successfully loaded!\n");
 
-  // Zero the pseudo-bss variable by calling into hsa
-  // Do this post-load to handle got
-  uint64_t device_State_bytes =
-  get_device_State_bytes((char *)image->ImageStart, img_size);
-  auto  = DeviceInfo.deviceStateStore[device_id];
-  if (device_State_bytes != 0) {
-
-if (dss.first.get() == nullptr) {
-  assert(dss.second == 0);
-  void *ptr = NULL;
-  atmi_status_t err =
-  atmi_calloc(, device_State_bytes, get_gpu_mem_place(device_id));
-  if (err != ATMI_STATUS_SUCCESS) {
-fprintf(stderr, "Failed to allocate device_state array\n");
-return NULL;
-  }
-  dss = {std::unique_ptr{ptr},
- device_State_bytes};
-}
-
-void *ptr = dss.first.get();
-if (device_State_bytes != dss.second) {
-  fprintf(stderr, "Inconsistent sizes of device_State unsupported\n");
-  exit(1);
-}
+  {
+// the device_State array is either large value in bss or a void* that
+// needs to be assigned to a pointer to an array of size device_state_bytes
 
 void *state_ptr;
 uint32_t state_ptr_size;
-err = atmi_interop_hsa_get_symbol_info(get_gpu_mem_place(device_id),
-   "omptarget_nvptx_device_State",
-   _ptr, _ptr_size);
+atmi_status_t err = atmi_interop_hsa_get_symbol_info(
+get_gpu_mem_place(device_id), "omptarget_nvptx_device_State",
+_ptr, _ptr_size);
 
 if (err != ATMI_STATUS_SUCCESS) {
-  fprintf(stderr, "failed to find device_state ptr\n");
+  fprintf(stderr, "failed to find device_state symbol\n");
   return NULL;
 }
-if (state_ptr_size != sizeof(void *)) {
+
+if (state_ptr_size < sizeof(void *)) {
   fprintf(stderr, "unexpected size of state_ptr %u != %zu\n",
   state_ptr_size, sizeof(void *));
   return NULL;
 }
 
-// write ptr to device memory so it can be used by later kernels
-err = DeviceInfo.freesignalpool_memcpy_h2d(state_ptr, , sizeof(void *),
-   device_id);
-if (err != ATMI_STATUS_SUCCESS) {
-  fprintf(stderr, "memcpy install of state_ptr failed\n");
-  return NULL;
+// if it's larger than a void*, assume it's a bss array and no further
+// initialization is required. Only try to set up a pointer for
+// sizeof(void*)
+if (state_ptr_size == sizeof(void *)) {
+  uint64_t device_State_bytes =
+  get_device_State_bytes((char *)image->ImageStart, img_size);
+  if (device_State_bytes == 0) {
+return NULL;
+  }
+
+  auto  = DeviceInfo.deviceStateStore[device_id];
+  if (dss.first.get() == nullptr) {
+assert(dss.second == 0);
+void *ptr = NULL;
+atmi_status_t err =
+atmi_calloc(, device_State_bytes, 
get_gpu_mem_place(device_id));
+if (err != ATMI_STATUS_SUCCESS) {
+  fprintf(stderr, "Failed to allocate device_state array\n");
+  return NULL;
+}
+dss = {std::unique_ptr{ptr},
+   device_State_bytes};
+  }
+
+  void *ptr = dss.first.get();
+  if (device_State_bytes != dss.second) {
+fprintf(stderr, "Inconsistent sizes of device_State unsupported\n");
+exit(1);
+  }
+
+  // write ptr to device memory so it can be used by later kernels
+  err = DeviceInfo.freesignalpool_memcpy_h2d(state_ptr, ,
+ sizeof(void *), device_id);
+  if (err != ATMI_STATUS_SUCCESS) {
+fprintf(stderr, "memcpy install of state_ptr failed\n");
+return NULL;
+  }
 }
   }
 



___
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] 467b669 - [TargetMachine] Delete asan workaround

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

Author: Fangrui Song
Date: 2020-12-06T00:33:11-08:00
New Revision: 467b6699155ed1d0385eb4e0b03b1715a6d5f0e5

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

LOG: [TargetMachine] Delete asan workaround

687b83ceabafe81970cd4639e7f0c89036402081 has fixed the X86FastISel bug.
We can revert the workaround now. Actually, the commit introduced a
bug that ppc64 should be excluded.

Added: 


Modified: 
llvm/lib/Target/TargetMachine.cpp

Removed: 




diff  --git a/llvm/lib/Target/TargetMachine.cpp 
b/llvm/lib/Target/TargetMachine.cpp
index 07a6e53c8f0f..ad0e90125258 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -163,11 +163,6 @@ bool TargetMachine::shouldAssumeDSOLocal(const Module ,
 // If the symbol is defined, it cannot be preempted.
 if (!GV->isDeclarationForLinker())
   return true;
-// FIXME Sanitizers do not call setDSOLocal appropriately. Fix sanitizers
-// and delete the hack.
-if (RM == Reloc::Static && !GV->isThreadLocal() &&
-M.getFunction("asan.module_ctor"))
-  return true;
   } else if (TT.isOSBinFormatELF()) {
 // If dso_local allows AsmPrinter::getSymbolPreferLocal to use a local
 // alias, set the flag. We cannot set dso_local for other global values,



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