Update prebuilt Clang to match Android kernel.
Bug: 132428451
Change-Id: I8f6e2cb23f381fc0c02ddea99b867e58e925e5be
diff --git a/linux-x64/clang/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h b/linux-x64/clang/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
index f970acd..887c880 100644
--- a/linux-x64/clang/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
+++ b/linux-x64/clang/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
@@ -1,9 +1,8 @@
//===- AggressiveInstCombine.h - AggressiveInstCombine pass -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Coroutines.h b/linux-x64/clang/include/llvm/Transforms/Coroutines.h
index 51beb44..9df3ec0 100644
--- a/linux-x64/clang/include/llvm/Transforms/Coroutines.h
+++ b/linux-x64/clang/include/llvm/Transforms/Coroutines.h
@@ -1,9 +1,8 @@
//===-- Coroutines.h - Coroutine Transformations ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
// Declare accessor functions for coroutine lowering passes.
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO.h b/linux-x64/clang/include/llvm/Transforms/IPO.h
index 11d363b..4f7a1ba 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/AlwaysInliner.h b/linux-x64/clang/include/llvm/Transforms/IPO/AlwaysInliner.h
index b52c0fd..64e2523 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/AlwaysInliner.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/AlwaysInliner.h
@@ -1,9 +1,8 @@
//===-- AlwaysInliner.h - Pass to inline "always_inline" functions --------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
///
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/ArgumentPromotion.h b/linux-x64/clang/include/llvm/Transforms/IPO/ArgumentPromotion.h
index 49ca6cc..c8afb7b 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/ArgumentPromotion.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/ArgumentPromotion.h
@@ -1,9 +1,8 @@
//===- ArgumentPromotion.h - Promote by-reference arguments -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/CalledValuePropagation.h b/linux-x64/clang/include/llvm/Transforms/IPO/CalledValuePropagation.h
index 352bdc7..c2626d0 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/CalledValuePropagation.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/CalledValuePropagation.h
@@ -1,9 +1,8 @@
//===- CalledValuePropagation.h - Propagate called values -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/ConstantMerge.h b/linux-x64/clang/include/llvm/Transforms/IPO/ConstantMerge.h
index e04d3ae..12d38b5 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/ConstantMerge.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/ConstantMerge.h
@@ -1,9 +1,8 @@
//===- ConstantMerge.h - Merge duplicate global constants -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/CrossDSOCFI.h b/linux-x64/clang/include/llvm/Transforms/IPO/CrossDSOCFI.h
index 0979f5b..8440df6 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/CrossDSOCFI.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/CrossDSOCFI.h
@@ -1,9 +1,8 @@
//===-- CrossDSOCFI.cpp - Externalize this module's CFI checks --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/DeadArgumentElimination.h b/linux-x64/clang/include/llvm/Transforms/IPO/DeadArgumentElimination.h
index ba5666f..73797bc 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/DeadArgumentElimination.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/DeadArgumentElimination.h
@@ -1,9 +1,8 @@
//===- DeadArgumentElimination.h - Eliminate Dead Args ----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/ElimAvailExtern.h b/linux-x64/clang/include/llvm/Transforms/IPO/ElimAvailExtern.h
index 94cb954..92c319b 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/ElimAvailExtern.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/ElimAvailExtern.h
@@ -1,9 +1,8 @@
//===- ElimAvailExtern.h - Optimize Global Variables ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/ForceFunctionAttrs.h b/linux-x64/clang/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
index ff8a654..7379009 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
@@ -1,9 +1,8 @@
//===-- ForceFunctionAttrs.h - Force function attrs for debugging ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/FunctionAttrs.h b/linux-x64/clang/include/llvm/Transforms/IPO/FunctionAttrs.h
index 901fed7..ce61eea 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/FunctionAttrs.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/FunctionAttrs.h
@@ -1,9 +1,8 @@
//===- FunctionAttrs.h - Compute function attributes ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/FunctionImport.h b/linux-x64/clang/include/llvm/Transforms/IPO/FunctionImport.h
index af1aedd..bbf270c 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/FunctionImport.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/IPO/FunctionImport.h - ThinLTO importing -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -56,10 +55,14 @@
// to find at least one summary for the GUID that is global or a local
// in the referenced module for direct calls.
LocalLinkageNotInModule,
- // This corresponse to the NotEligibleToImport being set on the summary,
+ // This corresponds to the NotEligibleToImport being set on the summary,
// which can happen in a few different cases (e.g. local that can't be
// renamed or promoted because it is referenced on a llvm*.used variable).
- NotEligible
+ NotEligible,
+ // This corresponds to NoInline being set on the function summary,
+ // which will happen if it is known that the inliner will not be able
+ // to inline the function (e.g. it is marked with a NoInline attribute).
+ NoInline
};
/// Information optionally tracked for candidates the importer decided
@@ -172,6 +175,14 @@
const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,
function_ref<PrevailingType(GlobalValue::GUID)> isPrevailing);
+/// Compute dead symbols and run constant propagation in combined index
+/// after that.
+void computeDeadSymbolsWithConstProp(
+ ModuleSummaryIndex &Index,
+ const DenseSet<GlobalValue::GUID> &GUIDPreservedSymbols,
+ function_ref<PrevailingType(GlobalValue::GUID)> isPrevailing,
+ bool ImportEnabled);
+
/// Converts value \p GV to declaration, or replaces with a declaration if
/// it is an alias. Returns true if converted, false if replaced.
bool convertToDeclaration(GlobalValue &GV);
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalDCE.h b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalDCE.h
index 7ca241f..c434484 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalDCE.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalDCE.h
@@ -1,9 +1,8 @@
//===-- GlobalDCE.h - DCE unreachable internal functions ------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalOpt.h b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalOpt.h
index 5b48786..48a861f 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalOpt.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalOpt.h
@@ -1,9 +1,8 @@
//===- GlobalOpt.h - Optimize Global Variables ------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalSplit.h b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalSplit.h
index 56cefb7..690b23a 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/GlobalSplit.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/GlobalSplit.h
@@ -1,9 +1,8 @@
//===- GlobalSplit.h - global variable splitter -----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/HotColdSplitting.h b/linux-x64/clang/include/llvm/Transforms/IPO/HotColdSplitting.h
index 57e9a9e..7366884 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/HotColdSplitting.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/HotColdSplitting.h
@@ -1,9 +1,8 @@
//===- HotColdSplitting.h ---- Outline Cold Regions -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 pass outlines cold regions to a separate function.
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/InferFunctionAttrs.h b/linux-x64/clang/include/llvm/Transforms/IPO/InferFunctionAttrs.h
index 54e1c24..bb7907f 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/InferFunctionAttrs.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/InferFunctionAttrs.h
@@ -1,9 +1,8 @@
//===-- InferFunctionAttrs.h - Infer implicit function attributes ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
///
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/Inliner.h b/linux-x64/clang/include/llvm/Transforms/IPO/Inliner.h
index 610e450..8202b94 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/Inliner.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/Inliner.h
@@ -1,9 +1,8 @@
//===- Inliner.h - Inliner pass and infrastructure --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/Internalize.h b/linux-x64/clang/include/llvm/Transforms/IPO/Internalize.h
index 45d676d..a7efd3e 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/Internalize.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/Internalize.h
@@ -1,9 +1,8 @@
//====- Internalize.h - Internalization API ---------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/LowerTypeTests.h b/linux-x64/clang/include/llvm/Transforms/IPO/LowerTypeTests.h
index bc44838..39b23f5 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/LowerTypeTests.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/LowerTypeTests.h
@@ -1,9 +1,8 @@
//===- LowerTypeTests.h - type metadata lowering pass -----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/PartialInlining.h b/linux-x64/clang/include/llvm/Transforms/IPO/PartialInlining.h
index ec6dd36..3b8297d 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/PartialInlining.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/PartialInlining.h
@@ -1,9 +1,8 @@
//===- PartialInlining.h - Inline parts of functions ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/PassManagerBuilder.h b/linux-x64/clang/include/llvm/Transforms/IPO/PassManagerBuilder.h
index 276306f..f82cfdc 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/PassManagerBuilder.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/PassManagerBuilder.h
@@ -1,9 +1,8 @@
// llvm/Transforms/IPO/PassManagerBuilder.h - Build Standard Pass -*- C++ -*-=//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/SCCP.h b/linux-x64/clang/include/llvm/Transforms/IPO/SCCP.h
index fdb7865..3c40d44 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/SCCP.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/SCCP.h
@@ -1,9 +1,8 @@
//===- SCCP.h - Sparse Conditional Constant Propagation ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/SampleProfile.h b/linux-x64/clang/include/llvm/Transforms/IPO/SampleProfile.h
index cd5a056..a5ad445 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/SampleProfile.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/SampleProfile.h
@@ -1,9 +1,8 @@
//===- SampleProfile.h - SamplePGO pass ---------- --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -25,13 +24,16 @@
/// The sample profiler data loader pass.
class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
public:
- SampleProfileLoaderPass(std::string File = "", bool IsThinLTOPreLink = false)
- : ProfileFileName(File), IsThinLTOPreLink(IsThinLTOPreLink) {}
+ SampleProfileLoaderPass(std::string File = "", std::string RemappingFile = "",
+ bool IsThinLTOPreLink = false)
+ : ProfileFileName(File), ProfileRemappingFileName(RemappingFile),
+ IsThinLTOPreLink(IsThinLTOPreLink) {}
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
private:
std::string ProfileFileName;
+ std::string ProfileRemappingFileName;
bool IsThinLTOPreLink;
};
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/StripDeadPrototypes.h b/linux-x64/clang/include/llvm/Transforms/IPO/StripDeadPrototypes.h
index 5a05cd7..f4a15c3 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/StripDeadPrototypes.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/StripDeadPrototypes.h
@@ -1,9 +1,8 @@
//===-- StripDeadPrototypes.h - Remove unused function declarations -------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h b/linux-x64/clang/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h
index bf04bbf..7acb922 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/ThinLTOBitcodeWriter.h
@@ -1,9 +1,8 @@
//===- ThinLTOBitcodeWriter.h - Bitcode writing pass for ThinLTO ----------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/IPO/WholeProgramDevirt.h b/linux-x64/clang/include/llvm/Transforms/IPO/WholeProgramDevirt.h
index bf2c79b..509fcc8 100644
--- a/linux-x64/clang/include/llvm/Transforms/IPO/WholeProgramDevirt.h
+++ b/linux-x64/clang/include/llvm/Transforms/IPO/WholeProgramDevirt.h
@@ -1,9 +1,8 @@
//===- WholeProgramDevirt.h - Whole-program devirt pass ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombine.h b/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombine.h
index ab25fe0..8894d96 100644
--- a/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombine.h
+++ b/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombine.h
@@ -1,9 +1,8 @@
//===- InstCombine.h - InstCombine pass -------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombineWorklist.h b/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombineWorklist.h
index f860b4b..6c33bdb 100644
--- a/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombineWorklist.h
+++ b/linux-x64/clang/include/llvm/Transforms/InstCombine/InstCombineWorklist.h
@@ -1,9 +1,8 @@
//===- InstCombineWorklist.h - Worklist for InstCombine pass ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation.h
index d6d9529..29cb281 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation.h
@@ -1,9 +1,8 @@
//===- Transforms/Instrumentation.h - Instrumentation passes ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -24,9 +23,11 @@
namespace llvm {
+class Triple;
class FunctionPass;
class ModulePass;
class OptimizationRemarkEmitter;
+class Comdat;
/// Instrumentation passes often insert conditional checks into entry blocks.
/// Call this function before splitting the entry block to move instructions
@@ -36,6 +37,17 @@
BasicBlock::iterator PrepareToSplitEntryBlock(BasicBlock &BB,
BasicBlock::iterator IP);
+// Create a constant for Str so that we can pass it to the run-time lib.
+GlobalVariable *createPrivateGlobalForString(Module &M, StringRef Str,
+ bool AllowMerging,
+ const char *NamePrefix = "");
+
+// Returns F.getComdat() if it exists.
+// Otherwise creates a new comdat, sets F's comdat, and returns it.
+// Returns nullptr on failure.
+Comdat *GetOrCreateFunctionComdat(Function &F, Triple &T,
+ const std::string &ModuleId);
+
// Insert GCOV profiling instrumentation
struct GCOVOptions {
static GCOVOptions getDefault();
@@ -64,6 +76,12 @@
// Emit the exit block immediately after the start block, rather than after
// all of the function body's blocks.
bool ExitBlockBeforeBody;
+
+ // Regexes separated by a semi-colon to filter the files to instrument.
+ std::string Filter;
+
+ // Regexes separated by a semi-colon to filter the files to not instrument.
+ std::string Exclude;
};
ModulePass *createGCOVProfilerPass(const GCOVOptions &Options =
@@ -130,19 +148,12 @@
bool UseAfterScope = false);
ModulePass *createAddressSanitizerModulePass(bool CompileKernel = false,
bool Recover = false,
- bool UseGlobalsGC = true);
-
-// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
-FunctionPass *createMemorySanitizerPass(int TrackOrigins = 0,
- bool Recover = false,
- bool EnableKmsan = false);
+ bool UseGlobalsGC = true,
+ bool UseOdrIndicator = true);
FunctionPass *createHWAddressSanitizerPass(bool CompileKernel = false,
bool Recover = false);
-// Insert ThreadSanitizer (race detection) instrumentation
-FunctionPass *createThreadSanitizerPass();
-
// Insert DataFlowSanitizer (dynamic data flow analysis) instrumentation
ModulePass *createDataFlowSanitizerPass(
const std::vector<std::string> &ABIListFiles = std::vector<std::string>(),
@@ -210,7 +221,6 @@
assert(Scaled <= std::numeric_limits<uint32_t>::max() && "overflow 32-bits");
return Scaled;
}
-
} // end namespace llvm
#endif // LLVM_TRANSFORMS_INSTRUMENTATION_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/BoundsChecking.h
index 3d4f62c..120c6a8 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/BoundsChecking.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/BoundsChecking.h
@@ -1,9 +1,8 @@
//===- BoundsChecking.h - Bounds checking instrumentation -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/CGProfile.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/CGProfile.h
index c06c1a2..28fd380 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/CGProfile.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/CGProfile.h
@@ -1,9 +1,8 @@
//===- Transforms/Instrumentation/CGProfile.h -------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
index 460342d..18b4285 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/ControlHeightReduction.h
@@ -1,9 +1,8 @@
//===- ControlHeightReduction.h - Control Height Reduction ------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/GCOVProfiler.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/GCOVProfiler.h
index dd55fbe..b3971e4 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/GCOVProfiler.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/GCOVProfiler.h
@@ -1,9 +1,8 @@
//===- Transforms/Instrumentation/GCOVProfiler.h ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/InstrProfiling.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/InstrProfiling.h
index 13fb3db..4fad650 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/InstrProfiling.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/InstrProfiling.h
@@ -1,9 +1,8 @@
//===- Transforms/Instrumentation/InstrProfiling.h --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/MemorySanitizer.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
new file mode 100644
index 0000000..0739d9e
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -0,0 +1,50 @@
+//===- Transforms/Instrumentation/MemorySanitizer.h - MSan Pass -----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the memoy sanitizer pass.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
+#define LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H
+
+#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+
+namespace llvm {
+
+struct MemorySanitizerOptions {
+ MemorySanitizerOptions() = default;
+ MemorySanitizerOptions(int TrackOrigins, bool Recover, bool Kernel)
+ : TrackOrigins(TrackOrigins), Recover(Recover), Kernel(Kernel) {}
+ int TrackOrigins = 0;
+ bool Recover = false;
+ bool Kernel = false;
+};
+
+// Insert MemorySanitizer instrumentation (detection of uninitialized reads)
+FunctionPass *
+createMemorySanitizerLegacyPassPass(MemorySanitizerOptions Options = {});
+
+/// A function pass for msan instrumentation.
+///
+/// Instruments functions to detect unitialized reads. This function pass
+/// inserts calls to runtime library functions. If the functions aren't declared
+/// yet, the pass inserts the declarations. Otherwise the existing globals are
+/// used.
+struct MemorySanitizerPass : public PassInfoMixin<MemorySanitizerPass> {
+ MemorySanitizerPass(MemorySanitizerOptions Options) : Options(Options) {}
+
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+
+private:
+ MemorySanitizerOptions Options;
+};
+}
+
+#endif /* LLVM_TRANSFORMS_INSTRUMENTATION_MEMORYSANITIZER_H */
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
index c0b37c4..4f22e28 100644
--- a/linux-x64/clang/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/PGOInstrumentation.h
@@ -1,9 +1,8 @@
//===- Transforms/Instrumentation/PGOInstrumentation.h ----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -36,12 +35,14 @@
/// The profile annotation (profile-instr-use) pass for IR based PGO.
class PGOInstrumentationUse : public PassInfoMixin<PGOInstrumentationUse> {
public:
- PGOInstrumentationUse(std::string Filename = "");
+ PGOInstrumentationUse(std::string Filename = "",
+ std::string RemappingFilename = "");
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
private:
std::string ProfileFileName;
+ std::string ProfileRemappingFileName;
};
/// The indirect function call promotion pass.
diff --git a/linux-x64/clang/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h b/linux-x64/clang/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
new file mode 100644
index 0000000..b4e7d99
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h
@@ -0,0 +1,32 @@
+//===- Transforms/Instrumentation/ThreadSanitizer.h - TSan Pass -----------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the thread sanitizer pass.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H
+#define LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H
+
+#include "llvm/IR/PassManager.h"
+#include "llvm/Pass.h"
+
+namespace llvm {
+// Insert ThreadSanitizer (race detection) instrumentation
+FunctionPass *createThreadSanitizerLegacyPassPass();
+
+/// A function pass for tsan instrumentation.
+///
+/// Instruments functions to detect race conditions reads. This function pass
+/// inserts calls to runtime library functions. If the functions aren't declared
+/// yet, the pass inserts the declarations. Otherwise the existing globals are
+struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
+};
+} // namespace llvm
+#endif /* LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H */
diff --git a/linux-x64/clang/include/llvm/Transforms/ObjCARC.h b/linux-x64/clang/include/llvm/Transforms/ObjCARC.h
index 1897adc..2f114c7 100644
--- a/linux-x64/clang/include/llvm/Transforms/ObjCARC.h
+++ b/linux-x64/clang/include/llvm/Transforms/ObjCARC.h
@@ -1,9 +1,8 @@
//===-- ObjCARC.h - ObjCARC Scalar Transformations --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar.h b/linux-x64/clang/include/llvm/Transforms/Scalar.h
index 9491e1b..97a4c06 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar.h
@@ -1,9 +1,8 @@
//===-- Scalar.h - Scalar Transformations -----------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -26,7 +25,6 @@
class Pass;
class GetElementPtrInst;
class PassInfo;
-class TerminatorInst;
class TargetLowering;
class TargetMachine;
@@ -184,11 +182,12 @@
//
// LoopUnroll - This pass is a simple loop unrolling pass.
//
-Pass *createLoopUnrollPass(int OptLevel = 2, int Threshold = -1, int Count = -1,
+Pass *createLoopUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false,
+ int Threshold = -1, int Count = -1,
int AllowPartial = -1, int Runtime = -1,
int UpperBound = -1, int AllowPeeling = -1);
// Create an unrolling pass for full unrolling that uses exact trip count only.
-Pass *createSimpleLoopUnrollPass(int OptLevel = 2);
+Pass *createSimpleLoopUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false);
//===----------------------------------------------------------------------===//
//
@@ -360,6 +359,12 @@
//===----------------------------------------------------------------------===//
//
+// LowerWidenableCondition - Lower widenable condition to i1 true.
+//
+Pass *createLowerWidenableConditionPass();
+
+//===----------------------------------------------------------------------===//
+//
// MergeICmps - Merge integer comparison chains into a memcmp
//
Pass *createMergeICmpsPass();
@@ -394,12 +399,6 @@
//===----------------------------------------------------------------------===//
//
-// ScalarizerPass - Converts vector operations into scalar operations
-//
-FunctionPass *createScalarizerPass();
-
-//===----------------------------------------------------------------------===//
-//
// SeparateConstOffsetFromGEP - Split GEPs for better CSE
//
FunctionPass *createSeparateConstOffsetFromGEPPass(bool LowerGEP = false);
@@ -477,6 +476,7 @@
///===---------------------------------------------------------------------===//
ModulePass *createNameAnonGlobalPass();
+ModulePass *createCanonicalizeAliasesPass();
//===----------------------------------------------------------------------===//
//
@@ -491,6 +491,13 @@
// primarily to help other loop passes.
//
Pass *createLoopSimplifyCFGPass();
+
+//===----------------------------------------------------------------------===//
+//
+// WarnMissedTransformations - This pass emits warnings for leftover forced
+// transformations.
+//
+Pass *createWarnMissedTransformationsPass();
} // End llvm namespace
#endif
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/ADCE.h b/linux-x64/clang/include/llvm/Transforms/Scalar/ADCE.h
index f98af62..7d8b7ae 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/ADCE.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/ADCE.h
@@ -1,9 +1,8 @@
//===- ADCE.h - Aggressive dead code elimination ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h b/linux-x64/clang/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
index 6197503..fb1687e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/AlignmentFromAssumptions.h
@@ -1,9 +1,8 @@
//===---- AlignmentFromAssumptions.h ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/BDCE.h b/linux-x64/clang/include/llvm/Transforms/Scalar/BDCE.h
index d7d2730..996622b 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/BDCE.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/BDCE.h
@@ -1,9 +1,8 @@
//===---- BDCE.cpp - Bit-tracking dead code elimination ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/CallSiteSplitting.h b/linux-x64/clang/include/llvm/Transforms/Scalar/CallSiteSplitting.h
index b2ca2a1..b605563 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/CallSiteSplitting.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/CallSiteSplitting.h
@@ -1,9 +1,8 @@
//===- CallSiteSplitting..h - Callsite Splitting ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/ConstantHoisting.h b/linux-x64/clang/include/llvm/Transforms/Scalar/ConstantHoisting.h
index ba32e12..29311ca 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/ConstantHoisting.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/ConstantHoisting.h
@@ -1,9 +1,8 @@
//==- ConstantHoisting.h - Prepare code for expensive constants --*- C++ -*-==//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h b/linux-x64/clang/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
index 2093069..25795de 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/CorrelatedValuePropagation.h
@@ -1,9 +1,8 @@
//===- CorrelatedValuePropagation.h -----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/DCE.h b/linux-x64/clang/include/llvm/Transforms/Scalar/DCE.h
index 273346c..974e4b2 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/DCE.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/DCE.h
@@ -1,9 +1,8 @@
//===- DCE.h - Dead code elimination ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/DeadStoreElimination.h b/linux-x64/clang/include/llvm/Transforms/Scalar/DeadStoreElimination.h
index cfeb218..b66b0de 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/DeadStoreElimination.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/DeadStoreElimination.h
@@ -1,9 +1,8 @@
//===- DeadStoreElimination.h - Fast Dead Store Elimination -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/DivRemPairs.h b/linux-x64/clang/include/llvm/Transforms/Scalar/DivRemPairs.h
index 0a4346f..7401e02 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/DivRemPairs.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/DivRemPairs.h
@@ -1,9 +1,8 @@
//===- DivRemPairs.h - Hoist/decompose integer division and remainder -----===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/EarlyCSE.h b/linux-x64/clang/include/llvm/Transforms/Scalar/EarlyCSE.h
index faf03a4..1e7fd71 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/EarlyCSE.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/EarlyCSE.h
@@ -1,9 +1,8 @@
//===- EarlyCSE.h - Simple and fast CSE pass --------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/Float2Int.h b/linux-x64/clang/include/llvm/Transforms/Scalar/Float2Int.h
index 206ee98..06aeb83 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/Float2Int.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/Float2Int.h
@@ -1,9 +1,8 @@
//===-- Float2Int.h - Demote floating point ops to work on integers -------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/GVN.h b/linux-x64/clang/include/llvm/Transforms/Scalar/GVN.h
index c01a1d7..9fe00a9 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/GVN.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/GVN.h
@@ -1,9 +1,8 @@
//===- GVN.h - Eliminate redundant values and loads -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
@@ -27,6 +26,7 @@
#include "llvm/IR/Dominators.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/PassManager.h"
+#include "llvm/IR/ValueHandle.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
#include <cstdint>
@@ -180,7 +180,12 @@
// Map the block to reversed postorder traversal number. It is used to
// find back edge easily.
- DenseMap<const BasicBlock *, uint32_t> BlockRPONumber;
+ DenseMap<AssertingVH<BasicBlock>, uint32_t> BlockRPONumber;
+
+ // This is set 'true' initially and also when new blocks have been added to
+ // the function being analyzed. This boolean is used to control the updating
+ // of BlockRPONumber prior to accessing the contents of BlockRPONumber.
+ bool InvalidBlockRPONumbers = true;
using LoadDepVect = SmallVector<NonLocalDepResult, 64>;
using AvailValInBlkVect = SmallVector<gvn::AvailableValueInBlock, 64>;
@@ -237,7 +242,7 @@
}
// List of critical edges to be split between iterations.
- SmallVector<std::pair<TerminatorInst *, unsigned>, 4> toSplit;
+ SmallVector<std::pair<Instruction *, unsigned>, 4> toSplit;
// Helper functions of redundant load elimination
bool processLoad(LoadInst *L);
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/GVNExpression.h b/linux-x64/clang/include/llvm/Transforms/Scalar/GVNExpression.h
index 8b34696..3dc4515 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/GVNExpression.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/GVNExpression.h
@@ -1,9 +1,8 @@
//===- GVNExpression.h - GVN Expression classes -----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/GuardWidening.h b/linux-x64/clang/include/llvm/Transforms/Scalar/GuardWidening.h
index 2bc0940..3adea05 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/GuardWidening.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/GuardWidening.h
@@ -1,9 +1,8 @@
//===- GuardWidening.h - ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/IVUsersPrinter.h b/linux-x64/clang/include/llvm/Transforms/Scalar/IVUsersPrinter.h
index fad00d8..a1f20d9 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/IVUsersPrinter.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/IVUsersPrinter.h
@@ -1,9 +1,8 @@
//===- IVUsersPrinter.h - Induction Variable Users Printing -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/IndVarSimplify.h b/linux-x64/clang/include/llvm/Transforms/Scalar/IndVarSimplify.h
index e321c8f..3c20537 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/IndVarSimplify.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/IndVarSimplify.h
@@ -1,9 +1,8 @@
//===- IndVarSimplify.h - Induction Variable Simplification -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h b/linux-x64/clang/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
index 311c549..b1e7007 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/InductiveRangeCheckElimination.h
@@ -1,9 +1,8 @@
//===- InductiveRangeCheckElimination.h - IRCE ------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/InstSimplifyPass.h b/linux-x64/clang/include/llvm/Transforms/Scalar/InstSimplifyPass.h
index da79a13..0c30b62 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/InstSimplifyPass.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/InstSimplifyPass.h
@@ -1,9 +1,8 @@
//===- InstSimplifyPass.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/JumpThreading.h b/linux-x64/clang/include/llvm/Transforms/Scalar/JumpThreading.h
index c8376dd..0464d40 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/JumpThreading.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/JumpThreading.h
@@ -1,9 +1,8 @@
//===- JumpThreading.h - thread control through conditional BBs -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -23,7 +22,7 @@
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
-#include "llvm/IR/DomTreeUpdater.h"
+#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/IR/ValueHandle.h"
#include <memory>
#include <utility>
@@ -89,22 +88,9 @@
#else
SmallSet<AssertingVH<const BasicBlock>, 16> LoopHeaders;
#endif
- DenseSet<std::pair<Value *, BasicBlock *>> RecursionSet;
unsigned BBDupThreshold;
- // RAII helper for updating the recursion stack.
- struct RecursionSetRemover {
- DenseSet<std::pair<Value *, BasicBlock *>> &TheSet;
- std::pair<Value *, BasicBlock *> ThePair;
-
- RecursionSetRemover(DenseSet<std::pair<Value *, BasicBlock *>> &S,
- std::pair<Value *, BasicBlock *> P)
- : TheSet(S), ThePair(P) {}
-
- ~RecursionSetRemover() { TheSet.erase(ThePair); }
- };
-
public:
JumpThreadingPass(int T = -1);
@@ -128,11 +114,21 @@
bool DuplicateCondBranchOnPHIIntoPred(
BasicBlock *BB, const SmallVectorImpl<BasicBlock *> &PredBBs);
+ bool ComputeValueKnownInPredecessorsImpl(
+ Value *V, BasicBlock *BB, jumpthreading::PredValueInfo &Result,
+ jumpthreading::ConstantPreference Preference,
+ DenseSet<std::pair<Value *, BasicBlock *>> &RecursionSet,
+ Instruction *CxtI = nullptr);
bool
ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,
jumpthreading::PredValueInfo &Result,
jumpthreading::ConstantPreference Preference,
- Instruction *CxtI = nullptr);
+ Instruction *CxtI = nullptr) {
+ DenseSet<std::pair<Value *, BasicBlock *>> RecursionSet;
+ return ComputeValueKnownInPredecessorsImpl(V, BB, Result, Preference,
+ RecursionSet, CxtI);
+ }
+
bool ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
jumpthreading::ConstantPreference Preference,
Instruction *CxtI = nullptr);
@@ -142,7 +138,11 @@
bool ProcessImpliedCondition(BasicBlock *BB);
bool SimplifyPartiallyRedundantLoad(LoadInst *LI);
+ void UnfoldSelectInstr(BasicBlock *Pred, BasicBlock *BB, SelectInst *SI,
+ PHINode *SIUse, unsigned Idx);
+
bool TryToUnfoldSelect(CmpInst *CondCmp, BasicBlock *BB);
+ bool TryToUnfoldSelect(SwitchInst *SI, BasicBlock *BB);
bool TryToUnfoldSelectInCurrBB(BasicBlock *BB);
bool ProcessGuards(BasicBlock *BB);
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LICM.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LICM.h
index 68ad190..ea947ea 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LICM.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LICM.h
@@ -1,9 +1,8 @@
//===- LICM.h - Loop Invariant Code Motion Pass -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
index e1b3379..3f250fc 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopAccessAnalysisPrinter.h
@@ -1,9 +1,8 @@
//===- llvm/Analysis/LoopAccessAnalysisPrinter.h ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDataPrefetch.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
index e1ad67a..9ebd598 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDataPrefetch.h
@@ -1,10 +1,9 @@
//===-------- LoopDataPrefetch.h - Loop Data Prefetching Pass ---*- C++ -*-===//
//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDeletion.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDeletion.h
index 7b8cb1e..557616e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDeletion.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDeletion.h
@@ -1,9 +1,8 @@
//===- LoopDeletion.h - Loop Deletion ---------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDistribute.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDistribute.h
index 2bf1c9d..1a82176 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDistribute.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopDistribute.h
@@ -1,9 +1,8 @@
//===- LoopDistribute.cpp - Loop Distribution Pass --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
index 7added8..d2fff8b 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
@@ -1,9 +1,8 @@
//===- LoopIdiomRecognize.h - Loop Idiom Recognize Pass ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopInstSimplify.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopInstSimplify.h
index 04dc79c..f6e86d1 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopInstSimplify.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopInstSimplify.h
@@ -1,9 +1,8 @@
//===- LoopInstSimplify.h - Loop Inst Simplify Pass -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopLoadElimination.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopLoadElimination.h
index b0514a4..65b9aab 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopLoadElimination.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopLoadElimination.h
@@ -1,9 +1,8 @@
//===- LoopLoadElimination.h ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPassManager.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPassManager.h
index e54960d..61ec585 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPassManager.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPassManager.h
@@ -1,9 +1,8 @@
//===- LoopPassManager.h - Loop pass management -----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
@@ -352,7 +351,11 @@
continue;
PreservedAnalyses PassPA = Pass.run(*L, LAM, LAR, Updater);
- PI.runAfterPass<Loop>(Pass, *L);
+ // Do not pass deleted Loop into the instrumentation.
+ if (Updater.skipCurrentLoop())
+ PI.runAfterPassInvalidated<Loop>(Pass);
+ else
+ PI.runAfterPass<Loop>(Pass, *L);
// FIXME: We should verify the set of analyses relevant to Loop passes
// are preserved.
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPredication.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPredication.h
index 57398bd..252daaf 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPredication.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopPredication.h
@@ -1,9 +1,8 @@
//===- LoopPredication.h - Guard based loop predication pass ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopRotation.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopRotation.h
index ea8d561..254e607 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopRotation.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopRotation.h
@@ -1,9 +1,8 @@
//===- LoopRotation.h - Loop Rotation -------------------------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
index 7628c74..2d71859 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSimplifyCFG.h
@@ -1,9 +1,8 @@
//===- LoopSimplifyCFG.cpp - Loop CFG Simplification Pass -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSink.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSink.h
index 371a7c8..234c48c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSink.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopSink.h
@@ -1,9 +1,8 @@
//===- LoopSink.h - Loop Sink Pass ------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopStrengthReduce.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
index 62c038a..5cf805b 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopStrengthReduce.h
@@ -1,9 +1,8 @@
//===- LoopStrengthReduce.h - Loop Strength Reduce Pass ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
index fc69aa3..7920269 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollAndJamPass.h
@@ -1,9 +1,8 @@
//===- LoopUnrollAndJamPass.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollPass.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollPass.h
index 9848e0d..1445373 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollPass.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LoopUnrollPass.h
@@ -1,15 +1,15 @@
//===- LoopUnrollPass.h -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H
#define LLVM_TRANSFORMS_SCALAR_LOOPUNROLLPASS_H
+#include "llvm/ADT/Optional.h"
#include "llvm/Analysis/LoopAnalysisManager.h"
#include "llvm/IR/PassManager.h"
@@ -23,23 +23,90 @@
class LoopFullUnrollPass : public PassInfoMixin<LoopFullUnrollPass> {
const int OptLevel;
+ /// If false, use a cost model to determine whether unrolling of a loop is
+ /// profitable. If true, only loops that explicitly request unrolling via
+ /// metadata are considered. All other loops are skipped.
+ const bool OnlyWhenForced;
+
public:
- explicit LoopFullUnrollPass(int OptLevel = 2) : OptLevel(OptLevel) {}
+ explicit LoopFullUnrollPass(int OptLevel = 2, bool OnlyWhenForced = false)
+ : OptLevel(OptLevel), OnlyWhenForced(OnlyWhenForced) {}
PreservedAnalyses run(Loop &L, LoopAnalysisManager &AM,
LoopStandardAnalysisResults &AR, LPMUpdater &U);
};
+/// A set of parameters used to control various transforms performed by the
+/// LoopUnroll pass. Each of the boolean parameters can be set to:
+/// true - enabling the transformation.
+/// false - disabling the transformation.
+/// None - relying on a global default.
+///
+/// There is also OptLevel parameter, which is used for additional loop unroll
+/// tuning.
+///
+/// Intended use is to create a default object, modify parameters with
+/// additional setters and then pass it to LoopUnrollPass.
+///
+struct LoopUnrollOptions {
+ Optional<bool> AllowPartial;
+ Optional<bool> AllowPeeling;
+ Optional<bool> AllowRuntime;
+ Optional<bool> AllowUpperBound;
+ int OptLevel;
+
+ /// If false, use a cost model to determine whether unrolling of a loop is
+ /// profitable. If true, only loops that explicitly request unrolling via
+ /// metadata are considered. All other loops are skipped.
+ bool OnlyWhenForced;
+
+ LoopUnrollOptions(int OptLevel = 2, bool OnlyWhenForced = false)
+ : OptLevel(OptLevel), OnlyWhenForced(OnlyWhenForced) {}
+
+ /// Enables or disables partial unrolling. When disabled only full unrolling
+ /// is allowed.
+ LoopUnrollOptions &setPartial(bool Partial) {
+ AllowPartial = Partial;
+ return *this;
+ }
+
+ /// Enables or disables unrolling of loops with runtime trip count.
+ LoopUnrollOptions &setRuntime(bool Runtime) {
+ AllowRuntime = Runtime;
+ return *this;
+ }
+
+ /// Enables or disables loop peeling.
+ LoopUnrollOptions &setPeeling(bool Peeling) {
+ AllowPeeling = Peeling;
+ return *this;
+ }
+
+ /// Enables or disables the use of trip count upper bound
+ /// in loop unrolling.
+ LoopUnrollOptions &setUpperBound(bool UpperBound) {
+ AllowUpperBound = UpperBound;
+ return *this;
+ }
+
+ // Sets "optimization level" tuning parameter for loop unrolling.
+ LoopUnrollOptions &setOptLevel(int O) {
+ OptLevel = O;
+ return *this;
+ }
+};
+
/// Loop unroll pass that will support both full and partial unrolling.
/// It is a function pass to have access to function and module analyses.
/// It will also put loops into canonical form (simplified and LCSSA).
class LoopUnrollPass : public PassInfoMixin<LoopUnrollPass> {
- const int OptLevel;
+ LoopUnrollOptions UnrollOpts;
public:
/// This uses the target information (or flags) to control the thresholds for
/// different unrolling stategies but supports all of them.
- explicit LoopUnrollPass(int OptLevel = 2) : OptLevel(OptLevel) {}
+ explicit LoopUnrollPass(LoopUnrollOptions UnrollOpts = {})
+ : UnrollOpts(UnrollOpts) {}
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerAtomic.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerAtomic.h
index a4a2e7a..40f8ca5 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerAtomic.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerAtomic.h
@@ -1,9 +1,8 @@
//===- LowerAtomic.cpp - Lower atomic intrinsics ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
index b6ee652..4e47ff7 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerExpectIntrinsic.h
@@ -1,9 +1,8 @@
//===- LowerExpectIntrinsic.h - LowerExpectIntrinsic pass -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
index a9f19f6..ce97b9e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerGuardIntrinsic.h
@@ -1,9 +1,8 @@
//===--- LowerGuardIntrinsic.h - Lower the guard intrinsic ---------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/LowerWidenableCondition.h b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerWidenableCondition.h
new file mode 100644
index 0000000..7c1e64b
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/LowerWidenableCondition.h
@@ -0,0 +1,26 @@
+//===--- LowerWidenableCondition.h - Lower the guard intrinsic ---------------===//
+//
+// 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 pass lowers the llvm.widenable.condition intrinsic to default value
+// which is i1 true.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_TRANSFORMS_SCALAR_LOWERWIDENABLECONDITION_H
+#define LLVM_TRANSFORMS_SCALAR_LOWERWIDENABLECONDITION_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+struct LowerWidenableConditionPass : PassInfoMixin<LowerWidenableConditionPass> {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+}
+
+#endif //LLVM_TRANSFORMS_SCALAR_LOWERWIDENABLECONDITION_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h b/linux-x64/clang/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h
new file mode 100644
index 0000000..5251747
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/MakeGuardsExplicit.h
@@ -0,0 +1,46 @@
+//===-- MakeGuardsExplicit.h - Turn guard intrinsics into guard branches --===//
+//
+// 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 pass lowers the @llvm.experimental.guard intrinsic to the new form of
+// guard represented as widenable explicit branch to the deopt block. The
+// difference between this pass and LowerGuardIntrinsic is that after this pass
+// the guard represented as intrinsic:
+//
+// call void(i1, ...) @llvm.experimental.guard(i1 %old_cond) [ "deopt"() ]
+//
+// transforms to a guard represented as widenable explicit branch:
+//
+// %widenable_cond = call i1 @llvm.experimental.widenable.condition()
+// br i1 (%old_cond & %widenable_cond), label %guarded, label %deopt
+//
+// Here:
+// - The semantics of @llvm.experimental.widenable.condition allows to replace
+// %widenable_cond with the construction (%widenable_cond & %any_other_cond)
+// without loss of correctness;
+// - %guarded is the lower part of old guard intrinsic's parent block split by
+// the intrinsic call;
+// - %deopt is a block containing a sole call to @llvm.experimental.deoptimize
+// intrinsic.
+//
+// Therefore, this branch preserves the property of widenability.
+//
+//===----------------------------------------------------------------------===//
+#ifndef LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
+#define LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+struct MakeGuardsExplicitPass : public PassInfoMixin<MakeGuardsExplicitPass> {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+} // namespace llvm
+
+#endif //LLVM_TRANSFORMS_SCALAR_MAKEGUARDSEXPLICIT_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/MemCpyOptimizer.h b/linux-x64/clang/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
index 046c808..5386f58 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/MemCpyOptimizer.h
@@ -1,9 +1,8 @@
//===- MemCpyOptimizer.h - memcpy optimization ------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h b/linux-x64/clang/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
index 48df09c..9071a56 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h
@@ -1,9 +1,8 @@
//===- MergedLoadStoreMotion.h - merge and hoist/sink load/stores ---------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/NaryReassociate.h b/linux-x64/clang/include/llvm/Transforms/Scalar/NaryReassociate.h
index e835bd5..26f5fe1 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/NaryReassociate.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/NaryReassociate.h
@@ -1,9 +1,8 @@
//===- NaryReassociate.h - Reassociate n-ary expressions --------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/NewGVN.h b/linux-x64/clang/include/llvm/Transforms/Scalar/NewGVN.h
index 3f75418..1f3680f 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/NewGVN.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/NewGVN.h
@@ -1,9 +1,8 @@
//===- NewGVN.h - Global Value Numbering Pass -------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h b/linux-x64/clang/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
index 7f73831..fd5a06c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/PartiallyInlineLibCalls.h
@@ -1,9 +1,8 @@
//===--- PartiallyInlineLibCalls.h - Partially inline libcalls --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/Reassociate.h b/linux-x64/clang/include/llvm/Transforms/Scalar/Reassociate.h
index ba7586d..487471c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/Reassociate.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/Reassociate.h
@@ -1,9 +1,8 @@
//===- Reassociate.h - Reassociate binary expressions -----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h b/linux-x64/clang/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
index 128f176..12773c1 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/RewriteStatepointsForGC.h
@@ -1,9 +1,8 @@
//===- RewriteStatepointsForGC.h - ------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SCCP.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SCCP.h
index e434d41..0ffd983 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SCCP.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SCCP.h
@@ -1,9 +1,8 @@
//===- SCCP.cpp - Sparse Conditional Constant Propagation -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -31,7 +30,7 @@
namespace llvm {
-class Function;
+class PostDominatorTree;
/// This pass performs function-level constant propagation and merging.
class SCCPPass : public PassInfoMixin<SCCPPass> {
@@ -39,9 +38,15 @@
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
-bool runIPSCCP(
- Module &M, const DataLayout &DL, const TargetLibraryInfo *TLI,
- function_ref<std::unique_ptr<PredicateInfo>(Function &)> getPredicateInfo);
+/// Helper struct for bundling up the analysis results per function for IPSCCP.
+struct AnalysisResultsForFn {
+ std::unique_ptr<PredicateInfo> PredInfo;
+ DominatorTree *DT;
+ PostDominatorTree *PDT;
+};
+
+bool runIPSCCP(Module &M, const DataLayout &DL, const TargetLibraryInfo *TLI,
+ function_ref<AnalysisResultsForFn(Function &)> getAnalysis);
} // end namespace llvm
#endif // LLVM_TRANSFORMS_SCALAR_SCCP_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SROA.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SROA.h
index b36c6f4..bd3a072 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SROA.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SROA.h
@@ -1,9 +1,8 @@
//===- SROA.h - Scalar Replacement Of Aggregates ----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/Scalarizer.h b/linux-x64/clang/include/llvm/Transforms/Scalar/Scalarizer.h
new file mode 100644
index 0000000..8136313
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/Scalarizer.h
@@ -0,0 +1,34 @@
+//===- Scalarizer.h --- Scalarize vector operations -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+/// \file
+/// This pass converts vector operations into scalar operations, in order
+/// to expose optimization opportunities on the individual scalar operations.
+/// It is mainly intended for targets that do not have vector units, but it
+/// may also be useful for revectorizing code to different vector widths.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_SCALAR_SCALARIZER_H
+#define LLVM_TRANSFORMS_SCALAR_SCALARIZER_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class ScalarizerPass : public PassInfoMixin<ScalarizerPass> {
+public:
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+/// Create a legacy pass manager instance of the Scalarizer pass
+FunctionPass *createScalarizerPass();
+
+}
+
+#endif /* LLVM_TRANSFORMS_SCALAR_SCALARIZER_H */
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
index eed50ec..33c1faa 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SimpleLoopUnswitch.h
@@ -1,9 +1,8 @@
//===- SimpleLoopUnswitch.h - Hoist loop-invariant control flow -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SimplifyCFG.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SimplifyCFG.h
index ce0a35f..f9792d3 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SimplifyCFG.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SimplifyCFG.h
@@ -1,9 +1,8 @@
//===- SimplifyCFG.h - Simplify and canonicalize the CFG --------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/Sink.h b/linux-x64/clang/include/llvm/Transforms/Scalar/Sink.h
index f9b3cb0..6cbe964 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/Sink.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/Sink.h
@@ -1,9 +1,8 @@
//===-- Sink.h - Code Sinking -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h
index 4a0bfd7..3c7dafe 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculateAroundPHIs.h
@@ -1,9 +1,8 @@
//===- SpeculateAroundPHIs.h - Speculate around PHIs ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculativeExecution.h b/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculativeExecution.h
index d00e950..14da864 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculativeExecution.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/SpeculativeExecution.h
@@ -1,9 +1,8 @@
//===- SpeculativeExecution.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/TailRecursionElimination.h b/linux-x64/clang/include/llvm/Transforms/Scalar/TailRecursionElimination.h
index 793f9bc..9068676 100644
--- a/linux-x64/clang/include/llvm/Transforms/Scalar/TailRecursionElimination.h
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/TailRecursionElimination.h
@@ -1,9 +1,8 @@
//===---- TailRecursionElimination.h ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Scalar/WarnMissedTransforms.h b/linux-x64/clang/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
new file mode 100644
index 0000000..2d5942a
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
@@ -0,0 +1,37 @@
+//===- WarnMissedTransforms.h -----------------------------------*- 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
+//
+//===----------------------------------------------------------------------===//
+//
+// Emit warnings if forced code transformations have not been performed.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_SCALAR_WARNMISSEDTRANSFORMS_H
+#define LLVM_TRANSFORMS_SCALAR_WARNMISSEDTRANSFORMS_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+class Function;
+class Loop;
+class LPMUpdater;
+
+// New pass manager boilerplate.
+class WarnMissedTransformationsPass
+ : public PassInfoMixin<WarnMissedTransformationsPass> {
+public:
+ explicit WarnMissedTransformationsPass() {}
+
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+// Legacy pass manager boilerplate.
+Pass *createWarnMissedTransformationsPass();
+void initializeWarnMissedTransformationsLegacyPass(PassRegistry &);
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_SCALAR_WARNMISSEDTRANSFORMS_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils.h b/linux-x64/clang/include/llvm/Transforms/Utils.h
index 3785527..6e03453 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Utils.h - Utility Transformations --------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/ASanStackFrameLayout.h b/linux-x64/clang/include/llvm/Transforms/Utils/ASanStackFrameLayout.h
index eaad06a..0b570c0 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/ASanStackFrameLayout.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/ASanStackFrameLayout.h
@@ -1,9 +1,8 @@
//===- ASanStackFrameLayout.h - ComputeASanStackFrameLayout -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/AddDiscriminators.h b/linux-x64/clang/include/llvm/Transforms/Utils/AddDiscriminators.h
index 4dad06e..f512c6c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/AddDiscriminators.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/AddDiscriminators.h
@@ -1,9 +1,8 @@
//===- AddDiscriminators.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/BasicBlockUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/BasicBlockUtils.h
index dee1541..4e76328 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/BasicBlockUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/BasicBlockUtils.h
@@ -1,9 +1,8 @@
//===- Transform/Utils/BasicBlockUtils.h - BasicBlock Utils -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -18,9 +17,9 @@
// FIXME: Move to this file: BasicBlock::removePredecessor, BB::splitBasicBlock
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/CFG.h"
-#include "llvm/IR/DomTreeUpdater.h"
#include "llvm/IR/InstrTypes.h"
#include <cassert>
@@ -40,8 +39,27 @@
class TargetLibraryInfo;
class Value;
+/// Replace contents of every block in \p BBs with single unreachable
+/// instruction. If \p Updates is specified, collect all necessary DT updates
+/// into this vector. If \p KeepOneInputPHIs is true, one-input Phis in
+/// successors of blocks being deleted will be preserved.
+void DetatchDeadBlocks(ArrayRef <BasicBlock *> BBs,
+ SmallVectorImpl<DominatorTree::UpdateType> *Updates,
+ bool KeepOneInputPHIs = false);
+
/// Delete the specified block, which must have no predecessors.
-void DeleteDeadBlock(BasicBlock *BB, DomTreeUpdater *DTU = nullptr);
+void DeleteDeadBlock(BasicBlock *BB, DomTreeUpdater *DTU = nullptr,
+ bool KeepOneInputPHIs = false);
+
+/// Delete the specified blocks from \p BB. The set of deleted blocks must have
+/// no predecessors that are not being deleted themselves. \p BBs must have no
+/// duplicating blocks. If there are loops among this set of blocks, all
+/// relevant loop info updates should be done before this function is called.
+/// If \p KeepOneInputPHIs is true, one-input Phis in successors of blocks
+/// being deleted will be preserved.
+void DeleteDeadBlocks(ArrayRef <BasicBlock *> BBs,
+ DomTreeUpdater *DTU = nullptr,
+ bool KeepOneInputPHIs = false);
/// We know that BB has one predecessor. If there are any single-entry PHI nodes
/// in it, fold them away. This handles the case when all entries to the PHI
@@ -88,7 +106,7 @@
LoopInfo *LI;
MemorySSAUpdater *MSSAU;
bool MergeIdenticalEdges = false;
- bool DontDeleteUselessPHIs = false;
+ bool KeepOneInputPHIs = false;
bool PreserveLCSSA = false;
CriticalEdgeSplittingOptions(DominatorTree *DT = nullptr,
@@ -101,8 +119,8 @@
return *this;
}
- CriticalEdgeSplittingOptions &setDontDeleteUselessPHIs() {
- DontDeleteUselessPHIs = true;
+ CriticalEdgeSplittingOptions &setKeepOneInputPHIs() {
+ KeepOneInputPHIs = true;
return *this;
}
@@ -128,7 +146,7 @@
/// IndirectBrInst. Splitting these edges will almost always create an invalid
/// program because the address of the new block won't be the one that is jumped
/// to.
-BasicBlock *SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
+BasicBlock *SplitCriticalEdge(Instruction *TI, unsigned SuccNum,
const CriticalEdgeSplittingOptions &Options =
CriticalEdgeSplittingOptions());
@@ -148,7 +166,7 @@
const CriticalEdgeSplittingOptions &Options =
CriticalEdgeSplittingOptions()) {
bool MadeChange = false;
- TerminatorInst *TI = (*PI)->getTerminator();
+ Instruction *TI = (*PI)->getTerminator();
for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
if (TI->getSuccessor(i) == Succ)
MadeChange |= !!SplitCriticalEdge(TI, i, Options);
@@ -162,7 +180,7 @@
SplitCriticalEdge(BasicBlock *Src, BasicBlock *Dst,
const CriticalEdgeSplittingOptions &Options =
CriticalEdgeSplittingOptions()) {
- TerminatorInst *TI = Src->getTerminator();
+ Instruction *TI = Src->getTerminator();
unsigned i = 0;
while (true) {
assert(i != TI->getNumSuccessors() && "Edge doesn't exist!");
@@ -257,11 +275,11 @@
/// Returns the NewBasicBlock's terminator.
///
/// Updates DT and LI if given.
-TerminatorInst *SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore,
- bool Unreachable,
- MDNode *BranchWeights = nullptr,
- DominatorTree *DT = nullptr,
- LoopInfo *LI = nullptr);
+Instruction *SplitBlockAndInsertIfThen(Value *Cond, Instruction *SplitBefore,
+ bool Unreachable,
+ MDNode *BranchWeights = nullptr,
+ DominatorTree *DT = nullptr,
+ LoopInfo *LI = nullptr);
/// SplitBlockAndInsertIfThenElse is similar to SplitBlockAndInsertIfThen,
/// but also creates the ElseBlock.
@@ -278,8 +296,8 @@
/// SplitBefore
/// Tail
void SplitBlockAndInsertIfThenElse(Value *Cond, Instruction *SplitBefore,
- TerminatorInst **ThenTerm,
- TerminatorInst **ElseTerm,
+ Instruction **ThenTerm,
+ Instruction **ElseTerm,
MDNode *BranchWeights = nullptr);
/// Check whether BB is the merge point of a if-region.
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/BreakCriticalEdges.h b/linux-x64/clang/include/llvm/Transforms/Utils/BreakCriticalEdges.h
index 9cc81a1..3644f1e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/BreakCriticalEdges.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/BreakCriticalEdges.h
@@ -1,9 +1,8 @@
//===- BreakCriticalEdges.h - Critical Edge Elimination Pass --------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/BuildLibCalls.h b/linux-x64/clang/include/llvm/Transforms/Utils/BuildLibCalls.h
index bdcdf6f..6c61cbe 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/BuildLibCalls.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/BuildLibCalls.h
@@ -1,9 +1,8 @@
//===- BuildLibCalls.h - Utility builder for libcalls -----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -29,6 +28,7 @@
///
/// Returns true if any attributes were set and false otherwise.
bool inferLibFuncAttributes(Function &F, const TargetLibraryInfo &TLI);
+ bool inferLibFuncAttributes(Module *M, StringRef Name, const TargetLibraryInfo &TLI);
/// Check whether the overloaded unary floating point function
/// corresponding to \a Ty is available.
@@ -36,6 +36,12 @@
LibFunc DoubleFn, LibFunc FloatFn,
LibFunc LongDoubleFn);
+ /// Get the name of the overloaded unary floating point function
+ /// corresponding to \a Ty.
+ StringRef getUnaryFloatFn(const TargetLibraryInfo *TLI, Type *Ty,
+ LibFunc DoubleFn, LibFunc FloatFn,
+ LibFunc LongDoubleFn);
+
/// Return V if it is an i8*, otherwise cast it to i8*.
Value *castToCStr(Value *V, IRBuilder<> &B);
@@ -93,6 +99,13 @@
Value *emitUnaryFloatFnCall(Value *Op, StringRef Name, IRBuilder<> &B,
const AttributeList &Attrs);
+ /// Emit a call to the unary function DoubleFn, FloatFn or LongDoubleFn,
+ /// depending of the type of Op.
+ Value *emitUnaryFloatFnCall(Value *Op, const TargetLibraryInfo *TLI,
+ LibFunc DoubleFn, LibFunc FloatFn,
+ LibFunc LongDoubleFn, IRBuilder<> &B,
+ const AttributeList &Attrs);
+
/// Emit a call to the binary function named 'Name' (e.g. 'fmin'). This
/// function is known to take type matching 'Op1' and 'Op2' and return one
/// value with the same type. If 'Op1/Op2' are long double, 'l' is added as
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/BypassSlowDivision.h b/linux-x64/clang/include/llvm/Transforms/Utils/BypassSlowDivision.h
index 6eca5ed..4710559 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/BypassSlowDivision.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/BypassSlowDivision.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Utils/BypassSlowDivision.h ---------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/CallPromotionUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/CallPromotionUtils.h
index 6e8ece7..d9d171c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/CallPromotionUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/CallPromotionUtils.h
@@ -1,9 +1,8 @@
//===- CallPromotionUtils.h - Utilities for call promotion ------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/CanonicalizeAliases.h b/linux-x64/clang/include/llvm/Transforms/Utils/CanonicalizeAliases.h
new file mode 100644
index 0000000..8f23a04
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/CanonicalizeAliases.h
@@ -0,0 +1,31 @@
+//===-- CanonicalizeAliases.h - Alias Canonicalization Pass -----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file canonicalizes aliases.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_UTILS_CANONICALIZE_ALIASES_H
+#define LLVM_TRANSFORMS_UTILS_CANONICALIZE_ALIASES_H
+
+#include "llvm/IR/Module.h"
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+/// Simple pass that canonicalizes aliases.
+class CanonicalizeAliasesPass : public PassInfoMixin<CanonicalizeAliasesPass> {
+public:
+ CanonicalizeAliasesPass() = default;
+
+ PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
+};
+
+} // end namespace llvm
+
+#endif // LLVM_TRANSFORMS_UTILS_CANONICALIZE_ALIASESH
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/Cloning.h b/linux-x64/clang/include/llvm/Transforms/Utils/Cloning.h
index e4d6053..86775b1 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/Cloning.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/Cloning.h
@@ -1,9 +1,8 @@
//===- Cloning.h - Clone various parts of LLVM programs ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -47,9 +46,9 @@
class Module;
class ProfileSummaryInfo;
class ReturnInst;
+class DomTreeUpdater;
/// Return an exact copy of the specified module
-///
std::unique_ptr<Module> CloneModule(const Module &M);
std::unique_ptr<Module> CloneModule(const Module &M, ValueToValueMapTy &VMap);
@@ -61,17 +60,15 @@
CloneModule(const Module &M, ValueToValueMapTy &VMap,
function_ref<bool(const GlobalValue *)> ShouldCloneDefinition);
-/// ClonedCodeInfo - This struct can be used to capture information about code
+/// This struct can be used to capture information about code
/// being cloned, while it is being cloned.
struct ClonedCodeInfo {
- /// ContainsCalls - This is set to true if the cloned code contains a normal
- /// call instruction.
+ /// This is set to true if the cloned code contains a normal call instruction.
bool ContainsCalls = false;
- /// ContainsDynamicAllocas - This is set to true if the cloned code contains
- /// a 'dynamic' alloca. Dynamic allocas are allocas that are either not in
- /// the entry block or they are in the entry block but are not a constant
- /// size.
+ /// This is set to true if the cloned code contains a 'dynamic' alloca.
+ /// Dynamic allocas are allocas that are either not in the entry block or they
+ /// are in the entry block but are not a constant size.
bool ContainsDynamicAllocas = false;
/// All cloned call sites that have operand bundles attached are appended to
@@ -82,7 +79,7 @@
ClonedCodeInfo() = default;
};
-/// CloneBasicBlock - Return a copy of the specified basic block, but without
+/// Return a copy of the specified basic block, but without
/// embedding the block into a particular function. The block returned is an
/// exact copy of the specified basic block, without any remapping having been
/// performed. Because of this, this is only suitable for applications where
@@ -109,13 +106,12 @@
/// If you would like to collect additional information about the cloned
/// function, you can specify a ClonedCodeInfo object with the optional fifth
/// parameter.
-///
BasicBlock *CloneBasicBlock(const BasicBlock *BB, ValueToValueMapTy &VMap,
const Twine &NameSuffix = "", Function *F = nullptr,
ClonedCodeInfo *CodeInfo = nullptr,
DebugInfoFinder *DIFinder = nullptr);
-/// CloneFunction - Return a copy of the specified function and add it to that
+/// Return a copy of the specified function and add it to that
/// function's module. Also, any references specified in the VMap are changed
/// to refer to their mapped value instead of the original one. If any of the
/// arguments to the function are in the VMap, the arguments are deleted from
@@ -154,7 +150,7 @@
const char *NameSuffix = "",
ClonedCodeInfo *CodeInfo = nullptr);
-/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto,
+/// This works exactly like CloneFunctionInto,
/// except that it does some simple constant prop and DCE on the fly. The
/// effect of this is to copy significantly less code in cases where (for
/// example) a function call with constant arguments is inlined, and those
@@ -172,8 +168,8 @@
ClonedCodeInfo *CodeInfo = nullptr,
Instruction *TheCall = nullptr);
-/// InlineFunctionInfo - This class captures the data input to the
-/// InlineFunction call, and records the auxiliary results produced by it.
+/// This class captures the data input to the InlineFunction call, and records
+/// the auxiliary results produced by it.
class InlineFunctionInfo {
public:
explicit InlineFunctionInfo(CallGraph *cg = nullptr,
@@ -185,19 +181,19 @@
: CG(cg), GetAssumptionCache(GetAssumptionCache), PSI(PSI),
CallerBFI(CallerBFI), CalleeBFI(CalleeBFI) {}
- /// CG - If non-null, InlineFunction will update the callgraph to reflect the
+ /// If non-null, InlineFunction will update the callgraph to reflect the
/// changes it makes.
CallGraph *CG;
std::function<AssumptionCache &(Function &)> *GetAssumptionCache;
ProfileSummaryInfo *PSI;
BlockFrequencyInfo *CallerBFI, *CalleeBFI;
- /// StaticAllocas - InlineFunction fills this in with all static allocas that
- /// get copied into the caller.
+ /// InlineFunction fills this in with all static allocas that get copied into
+ /// the caller.
SmallVector<AllocaInst *, 4> StaticAllocas;
- /// InlinedCalls - InlineFunction fills this in with callsites that were
- /// inlined from the callee. This is only filled in if CG is non-null.
+ /// InlineFunction fills this in with callsites that were inlined from the
+ /// callee. This is only filled in if CG is non-null.
SmallVector<WeakTrackingVH, 8> InlinedCalls;
/// All of the new call sites inlined into the caller.
@@ -214,7 +210,7 @@
}
};
-/// InlineFunction - This function inlines the called function into the basic
+/// This function inlines the called function into the basic
/// block of the caller. This returns false if it is not possible to inline
/// this call. The program is still in a well defined state if this occurs
/// though.
@@ -266,11 +262,19 @@
/// we replace them with the uses of corresponding Phi inputs. ValueMapping
/// is used to map the original instructions from BB to their newly-created
/// copies. Returns the split block.
-BasicBlock *
-DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
- Instruction *StopAt,
- ValueToValueMapTy &ValueMapping,
- DominatorTree *DT = nullptr);
+BasicBlock *DuplicateInstructionsInSplitBetween(BasicBlock *BB,
+ BasicBlock *PredBB,
+ Instruction *StopAt,
+ ValueToValueMapTy &ValueMapping,
+ DomTreeUpdater &DTU);
+
+/// Updates profile information by adjusting the entry count by adding
+/// entryDelta then scaling callsite information by the new count divided by the
+/// old count. VMap is used during inlinng to also update the new clone
+void updateProfileCallee(
+ Function *Callee, int64_t entryDelta,
+ const ValueMap<const Value *, WeakTrackingVH> *VMap = nullptr);
+
} // end namespace llvm
#endif // LLVM_TRANSFORMS_UTILS_CLONING_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/CodeExtractor.h b/linux-x64/clang/include/llvm/Transforms/Utils/CodeExtractor.h
index 0e5254a..becbf0e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/CodeExtractor.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/CodeExtractor.h
@@ -1,9 +1,8 @@
//===- Transform/Utils/CodeExtractor.h - Code extraction util ---*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -18,6 +17,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include <limits>
namespace llvm {
@@ -26,6 +26,8 @@
class BlockFrequency;
class BlockFrequencyInfo;
class BranchProbabilityInfo;
+class AssumptionCache;
+class CallInst;
class DominatorTree;
class Function;
class Instruction;
@@ -55,6 +57,7 @@
const bool AggregateArgs;
BlockFrequencyInfo *BFI;
BranchProbabilityInfo *BPI;
+ AssumptionCache *AC;
// If true, varargs functions can be extracted.
bool AllowVarArgs;
@@ -64,6 +67,11 @@
unsigned NumExitBlocks = std::numeric_limits<unsigned>::max();
Type *RetTy;
+ // Suffix to use when creating extracted function (appended to the original
+ // function name + "."). If empty, the default is to use the entry block
+ // label, if non-empty, otherwise "extracted".
+ std::string Suffix;
+
public:
/// Create a code extractor for a sequence of blocks.
///
@@ -78,7 +86,9 @@
CodeExtractor(ArrayRef<BasicBlock *> BBs, DominatorTree *DT = nullptr,
bool AggregateArgs = false, BlockFrequencyInfo *BFI = nullptr,
BranchProbabilityInfo *BPI = nullptr,
- bool AllowVarArgs = false, bool AllowAlloca = false);
+ AssumptionCache *AC = nullptr,
+ bool AllowVarArgs = false, bool AllowAlloca = false,
+ std::string Suffix = "");
/// Create a code extractor for a loop body.
///
@@ -86,7 +96,9 @@
/// block sequence of the loop.
CodeExtractor(DominatorTree &DT, Loop &L, bool AggregateArgs = false,
BlockFrequencyInfo *BFI = nullptr,
- BranchProbabilityInfo *BPI = nullptr);
+ BranchProbabilityInfo *BPI = nullptr,
+ AssumptionCache *AC = nullptr,
+ std::string Suffix = "");
/// Perform the extraction, returning the new function.
///
@@ -139,7 +151,8 @@
BasicBlock *findOrCreateBlockForHoisting(BasicBlock *CommonExitBlock);
private:
- void severSplitPHINodes(BasicBlock *&Header);
+ void severSplitPHINodesOfEntry(BasicBlock *&Header);
+ void severSplitPHINodesOfExits(const SmallPtrSetImpl<BasicBlock *> &Exits);
void splitReturnBlocks();
Function *constructFunction(const ValueSet &inputs,
@@ -155,10 +168,9 @@
DenseMap<BasicBlock *, BlockFrequency> &ExitWeights,
BranchProbabilityInfo *BPI);
- void emitCallAndSwitchStatement(Function *newFunction,
- BasicBlock *newHeader,
- ValueSet &inputs,
- ValueSet &outputs);
+ CallInst *emitCallAndSwitchStatement(Function *newFunction,
+ BasicBlock *newHeader,
+ ValueSet &inputs, ValueSet &outputs);
};
} // end namespace llvm
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/CtorUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/CtorUtils.h
index 63e564d..3625ee6 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/CtorUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/CtorUtils.h
@@ -1,9 +1,8 @@
//===- CtorUtils.h - Helpers for working with global_ctors ------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/EntryExitInstrumenter.h b/linux-x64/clang/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
index f50c5c9..3913693 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/EntryExitInstrumenter.h
@@ -1,9 +1,8 @@
//===- EntryExitInstrumenter.h - Function Entry/Exit Instrumentation ------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/EscapeEnumerator.h b/linux-x64/clang/include/llvm/Transforms/Utils/EscapeEnumerator.h
index 1256dfd..e667796 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/EscapeEnumerator.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/EscapeEnumerator.h
@@ -1,9 +1,8 @@
//===-- EscapeEnumerator.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/Evaluator.h b/linux-x64/clang/include/llvm/Transforms/Utils/Evaluator.h
index 9908ae6..bffd65f 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/Evaluator.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/Evaluator.h
@@ -1,9 +1,8 @@
//===- Evaluator.h - LLVM IR evaluator --------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/FunctionComparator.h b/linux-x64/clang/include/llvm/Transforms/Utils/FunctionComparator.h
index 35ba095..4e2571b 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/FunctionComparator.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/FunctionComparator.h
@@ -1,9 +1,8 @@
//===- FunctionComparator.h - Function Comparator ---------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/FunctionImportUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/FunctionImportUtils.h
index b9fbef0..9c2a9ea 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/FunctionImportUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/FunctionImportUtils.h
@@ -1,9 +1,8 @@
//===- FunctionImportUtils.h - Importing support utilities -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -44,6 +43,11 @@
/// to promote any non-renamable values.
SmallPtrSet<GlobalValue *, 8> Used;
+ /// Keep track of any COMDATs that require renaming (because COMDAT
+ /// leader was promoted and renamed). Maps from original COMDAT to one
+ /// with new name.
+ DenseMap<const Comdat *, Comdat *> RenamedComdats;
+
/// Check if we should promote the given local value to global scope.
bool shouldPromoteLocalToGlobal(const GlobalValue *SGV);
@@ -114,6 +118,9 @@
Module &M, const ModuleSummaryIndex &Index,
SetVector<GlobalValue *> *GlobalsToImport = nullptr);
+/// Compute synthetic function entry counts.
+void computeSyntheticCounts(ModuleSummaryIndex &Index);
+
} // End llvm namespace
#endif
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/GlobalStatus.h b/linux-x64/clang/include/llvm/Transforms/Utils/GlobalStatus.h
index 8cc265b..519593c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/GlobalStatus.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/GlobalStatus.h
@@ -1,9 +1,8 @@
//===- GlobalStatus.h - Compute status info for globals ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/GuardUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/GuardUtils.h
index 537045e..3b365c5 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/GuardUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/GuardUtils.h
@@ -1,9 +1,8 @@
//===-- GuardUtils.h - Utils for work with guards ---------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
// Utils that are used to perform transformations related to guards and their
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h b/linux-x64/clang/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h
index b55a989..033ea05 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h
@@ -1,9 +1,8 @@
-//===-- ImportedFunctionsInliningStats.h ------------------------*- C++ -*-===//
+//===-- ImportedFunctionsInliningStatistics.h -------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
// Generating inliner statistics for imported functions, mostly useful for
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/IntegerDivision.h b/linux-x64/clang/include/llvm/Transforms/Utils/IntegerDivision.h
index 5d9927e..35cae9a 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/IntegerDivision.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/IntegerDivision.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LCSSA.h b/linux-x64/clang/include/llvm/Transforms/Utils/LCSSA.h
index fe717e5..b01c802 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LCSSA.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LCSSA.h
@@ -1,9 +1,8 @@
//===- LCSSA.h - Loop-closed SSA transform Pass -----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h b/linux-x64/clang/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
index c9df532..ff1537a 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LibCallsShrinkWrap.h
@@ -1,9 +1,8 @@
//===- LibCallsShrinkWrap.h - Shrink Wrap Library Calls -------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/Local.h b/linux-x64/clang/include/llvm/Transforms/Utils/Local.h
index f7da696..641b645 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/Local.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/Local.h
@@ -1,9 +1,8 @@
//===- Local.h - Functions to perform local transformations -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -21,12 +20,11 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
+#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/Utils/Local.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Constant.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
-#include "llvm/IR/DomTreeUpdater.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Operator.h"
@@ -174,6 +172,12 @@
bool SimplifyInstructionsInBlock(BasicBlock *BB,
const TargetLibraryInfo *TLI = nullptr);
+/// Replace all the uses of an SSA value in @llvm.dbg intrinsics with
+/// undef. This is useful for signaling that a variable, e.g. has been
+/// found dead and hence it's unavailable at a given program point.
+/// Returns true if the dbg values have been changed.
+bool replaceDbgUsesWithUndef(Instruction *I);
+
//===----------------------------------------------------------------------===//
// Control Flow Graph Restructuring.
//
@@ -336,6 +340,18 @@
/// Returns true if any debug users were updated.
bool salvageDebugInfo(Instruction &I);
+/// Implementation of salvageDebugInfo, applying only to instructions in
+/// \p Insns, rather than all debug users of \p I.
+bool salvageDebugInfoForDbgValues(Instruction &I,
+ ArrayRef<DbgVariableIntrinsic *> Insns);
+
+/// Given an instruction \p I and DIExpression \p DIExpr operating on it, write
+/// the effects of \p I into the returned DIExpression, or return nullptr if
+/// it cannot be salvaged. \p StackVal: whether DW_OP_stack_value should be
+/// appended to the expression.
+DIExpression *salvageDebugInfoImpl(Instruction &I, DIExpression *DIExpr,
+ bool StackVal);
+
/// Point debug users of \p From to \p To or salvage them. Use this function
/// only when replacing all uses of \p From with \p To, with a guarantee that
/// \p From is going to be deleted.
@@ -420,7 +436,7 @@
unsigned replaceDominatedUsesWith(Value *From, Value *To, DominatorTree &DT,
const BasicBlock *BB);
-/// Return true if the CallSite CS calls a gc leaf function.
+/// Return true if this call calls a gc leaf function.
///
/// A leaf function is a function that does not safepoint the thread during its
/// execution. During a call or invoke to such a function, the callers stack
@@ -428,7 +444,7 @@
///
/// Most passes can and should ignore this information, and it is only used
/// during lowering by the GC infrastructure.
-bool callsGCLeafFunction(ImmutableCallSite CS, const TargetLibraryInfo &TLI);
+bool callsGCLeafFunction(const CallBase *Call, const TargetLibraryInfo &TLI);
/// Copy a nonnull metadata node to a new load instruction.
///
@@ -446,6 +462,14 @@
/// Remove the debug intrinsic instructions for the given instruction.
void dropDebugUsers(Instruction &I);
+/// Hoist all of the instructions in the \p IfBlock to the dominant block
+/// \p DomBlock, by moving its instructions to the insertion point \p InsertPt.
+///
+/// The moved instructions receive the insertion point debug location values
+/// (DILocations) and their debug intrinsic instructions are removed.
+void hoistAllInstructionsInto(BasicBlock *DomBlock, Instruction *InsertPt,
+ BasicBlock *BB);
+
//===----------------------------------------------------------------------===//
// Intrinsic pattern matching
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LoopRotationUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/LoopRotationUtils.h
index 231e5bb..1e80722 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LoopRotationUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LoopRotationUtils.h
@@ -1,9 +1,8 @@
//===- LoopRotationUtils.h - Utilities to perform loop rotation -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -20,6 +19,7 @@
class DominatorTree;
class Loop;
class LoopInfo;
+class MemorySSAUpdater;
class ScalarEvolution;
struct SimplifyQuery;
class TargetTransformInfo;
@@ -32,8 +32,8 @@
/// LoopRotation. If it is true, the profitability heuristic will be ignored.
bool LoopRotation(Loop *L, LoopInfo *LI, const TargetTransformInfo *TTI,
AssumptionCache *AC, DominatorTree *DT, ScalarEvolution *SE,
- const SimplifyQuery &SQ, bool RotationOnly,
- unsigned Threshold, bool IsUtilMode);
+ MemorySSAUpdater *MSSAU, const SimplifyQuery &SQ,
+ bool RotationOnly, unsigned Threshold, bool IsUtilMode);
} // namespace llvm
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LoopSimplify.h b/linux-x64/clang/include/llvm/Transforms/Utils/LoopSimplify.h
index 166da27..938e46d 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LoopSimplify.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LoopSimplify.h
@@ -1,9 +1,8 @@
//===- LoopSimplify.h - Loop Canonicalization Pass --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LoopUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/LoopUtils.h
index c75a1de..a5883ac 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LoopUtils.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Utils/LoopUtils.h - Loop utilities -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -41,6 +40,8 @@
class DataLayout;
class Loop;
class LoopInfo;
+class MemoryAccess;
+class MemorySSAUpdater;
class OptimizationRemarkEmitter;
class PredicatedScalarEvolution;
class PredIteratorCache;
@@ -78,7 +79,8 @@
///
/// Looks at all instructions in the loop which have uses outside of the
/// current loop. For each, an LCSSA PHI node is inserted and the uses outside
-/// the loop are rewritten to use this node.
+/// the loop are rewritten to use this node. Sub-loops must be in LCSSA form
+/// already.
///
/// LoopInfo and DominatorTree are required and preserved.
///
@@ -109,8 +111,8 @@
/// arguments. Diagnostics is emitted via \p ORE. It returns changed status.
bool sinkRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *,
TargetLibraryInfo *, TargetTransformInfo *, Loop *,
- AliasSetTracker *, LoopSafetyInfo *,
- OptimizationRemarkEmitter *ORE);
+ AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *,
+ bool, int &, OptimizationRemarkEmitter *);
/// Walk the specified region of the CFG (defined by all blocks
/// dominated by the specified block, and that are in the current loop) in depth
@@ -122,7 +124,8 @@
/// ORE. It returns changed status.
bool hoistRegion(DomTreeNode *, AliasAnalysis *, LoopInfo *, DominatorTree *,
TargetLibraryInfo *, Loop *, AliasSetTracker *,
- LoopSafetyInfo *, OptimizationRemarkEmitter *ORE);
+ MemorySSAUpdater *, ICFLoopSafetyInfo *, bool, int &,
+ OptimizationRemarkEmitter *);
/// This function deletes dead loops. The caller of this function needs to
/// guarantee that the loop is infact dead.
@@ -146,13 +149,12 @@
/// LoopInfo, DominatorTree, Loop, AliasSet information for all instructions
/// of the loop and loop safety information as arguments.
/// Diagnostics is emitted via \p ORE. It returns changed status.
-bool promoteLoopAccessesToScalars(const SmallSetVector<Value *, 8> &,
- SmallVectorImpl<BasicBlock *> &,
- SmallVectorImpl<Instruction *> &,
- PredIteratorCache &, LoopInfo *,
- DominatorTree *, const TargetLibraryInfo *,
- Loop *, AliasSetTracker *, LoopSafetyInfo *,
- OptimizationRemarkEmitter *);
+bool promoteLoopAccessesToScalars(
+ const SmallSetVector<Value *, 8> &, SmallVectorImpl<BasicBlock *> &,
+ SmallVectorImpl<Instruction *> &, SmallVectorImpl<MemoryAccess *> &,
+ PredIteratorCache &, LoopInfo *, DominatorTree *, const TargetLibraryInfo *,
+ Loop *, AliasSetTracker *, MemorySSAUpdater *, ICFLoopSafetyInfo *,
+ OptimizationRemarkEmitter *);
/// Does a BFS from a given node to all of its children inside a given loop.
/// The returned vector of nodes includes the starting point.
@@ -167,9 +169,80 @@
/// If it has a value (e.g. {"llvm.distribute", 1} return the value as an
/// operand or null otherwise. If the string metadata is not found return
/// Optional's not-a-value.
-Optional<const MDOperand *> findStringMetadataForLoop(Loop *TheLoop,
+Optional<const MDOperand *> findStringMetadataForLoop(const Loop *TheLoop,
StringRef Name);
+/// Find named metadata for a loop with an integer value.
+llvm::Optional<int> getOptionalIntLoopAttribute(Loop *TheLoop, StringRef Name);
+
+/// Create a new loop identifier for a loop created from a loop transformation.
+///
+/// @param OrigLoopID The loop ID of the loop before the transformation.
+/// @param FollowupAttrs List of attribute names that contain attributes to be
+/// added to the new loop ID.
+/// @param InheritOptionsAttrsPrefix Selects which attributes should be inherited
+/// from the original loop. The following values
+/// are considered:
+/// nullptr : Inherit all attributes from @p OrigLoopID.
+/// "" : Do not inherit any attribute from @p OrigLoopID; only use
+/// those specified by a followup attribute.
+/// "<prefix>": Inherit all attributes except those which start with
+/// <prefix>; commonly used to remove metadata for the
+/// applied transformation.
+/// @param AlwaysNew If true, do not try to reuse OrigLoopID and never return
+/// None.
+///
+/// @return The loop ID for the after-transformation loop. The following values
+/// can be returned:
+/// None : No followup attribute was found; it is up to the
+/// transformation to choose attributes that make sense.
+/// @p OrigLoopID: The original identifier can be reused.
+/// nullptr : The new loop has no attributes.
+/// MDNode* : A new unique loop identifier.
+Optional<MDNode *>
+makeFollowupLoopID(MDNode *OrigLoopID, ArrayRef<StringRef> FollowupAttrs,
+ const char *InheritOptionsAttrsPrefix = "",
+ bool AlwaysNew = false);
+
+/// Look for the loop attribute that disables all transformation heuristic.
+bool hasDisableAllTransformsHint(const Loop *L);
+
+/// The mode sets how eager a transformation should be applied.
+enum TransformationMode {
+ /// The pass can use heuristics to determine whether a transformation should
+ /// be applied.
+ TM_Unspecified,
+
+ /// The transformation should be applied without considering a cost model.
+ TM_Enable,
+
+ /// The transformation should not be applied.
+ TM_Disable,
+
+ /// Force is a flag and should not be used alone.
+ TM_Force = 0x04,
+
+ /// The transformation was directed by the user, e.g. by a #pragma in
+ /// the source code. If the transformation could not be applied, a
+ /// warning should be emitted.
+ TM_ForcedByUser = TM_Enable | TM_Force,
+
+ /// The transformation must not be applied. For instance, `#pragma clang loop
+ /// unroll(disable)` explicitly forbids any unrolling to take place. Unlike
+ /// general loop metadata, it must not be dropped. Most passes should not
+ /// behave differently under TM_Disable and TM_SuppressedByUser.
+ TM_SuppressedByUser = TM_Disable | TM_Force
+};
+
+/// @{
+/// Get the mode for LLVM's supported loop transformations.
+TransformationMode hasUnrollTransformation(Loop *L);
+TransformationMode hasUnrollAndJamTransformation(Loop *L);
+TransformationMode hasVectorizeTransformation(Loop *L);
+TransformationMode hasDistributeTransformation(Loop *L);
+TransformationMode hasLICMVersioningTransformation(Loop *L);
+/// @}
+
/// Set input string into loop metadata by keeping other values intact.
void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
unsigned V = 0);
@@ -202,7 +275,9 @@
/// If \p ORE is set use it to emit optimization remarks.
bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
Loop *CurLoop, AliasSetTracker *CurAST,
- bool TargetExecutesOncePerLoop,
+ MemorySSAUpdater *MSSAU, bool TargetExecutesOncePerLoop,
+ bool NoOfMemAccessesTooLarge,
+ int *LicmMssaOptCap = nullptr,
OptimizationRemarkEmitter *ORE = nullptr);
/// Returns a Min/Max operation corresponding to MinMaxRecurrenceKind.
@@ -249,6 +324,23 @@
/// Flag set: NSW, NUW, exact, and all of fast-math.
void propagateIRFlags(Value *I, ArrayRef<Value *> VL, Value *OpValue = nullptr);
+/// Returns true if we can prove that \p S is defined and always negative in
+/// loop \p L.
+bool isKnownNegativeInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE);
+
+/// Returns true if we can prove that \p S is defined and always non-negative in
+/// loop \p L.
+bool isKnownNonNegativeInLoop(const SCEV *S, const Loop *L,
+ ScalarEvolution &SE);
+
+/// Returns true if \p S is defined and never is equal to signed/unsigned max.
+bool cannotBeMaxInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE,
+ bool Signed);
+
+/// Returns true if \p S is defined and never is equal to signed/unsigned min.
+bool cannotBeMinInLoop(const SCEV *S, const Loop *L, ScalarEvolution &SE,
+ bool Signed);
+
} // end namespace llvm
#endif // LLVM_TRANSFORMS_UTILS_LOOPUTILS_H
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LoopVersioning.h b/linux-x64/clang/include/llvm/Transforms/Utils/LoopVersioning.h
index fcd734b..355c4d7 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LoopVersioning.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LoopVersioning.h
@@ -1,9 +1,8 @@
//===- LoopVersioning.h - Utility to version a loop -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LowerInvoke.h b/linux-x64/clang/include/llvm/Transforms/Utils/LowerInvoke.h
index 12774c7..c1198b0 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LowerInvoke.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LowerInvoke.h
@@ -1,9 +1,8 @@
//===- LowerInvoke.h - Eliminate Invoke instructions ----------------------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/LowerMemIntrinsics.h b/linux-x64/clang/include/llvm/Transforms/Utils/LowerMemIntrinsics.h
index 2b7d0f6..8e9d7b5 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/LowerMemIntrinsics.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/LowerMemIntrinsics.h
@@ -1,9 +1,8 @@
-//===- llvm/Transforms/Utils/LowerMemintrinsics.h ---------------*- C++ -*-===//
+//===- llvm/Transforms/Utils/LowerMemIntrinsics.h ---------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/Mem2Reg.h b/linux-x64/clang/include/llvm/Transforms/Utils/Mem2Reg.h
index 4076843..76c1c2c 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/Mem2Reg.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/Mem2Reg.h
@@ -1,9 +1,8 @@
//===- Mem2Reg.h - The -mem2reg pass, a wrapper around the Utils lib ------===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/ModuleUtils.h b/linux-x64/clang/include/llvm/Transforms/Utils/ModuleUtils.h
index 14615c2..c69af55 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/ModuleUtils.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/ModuleUtils.h
@@ -1,9 +1,8 @@
//===-- ModuleUtils.h - Functions to manipulate Modules ---------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -22,6 +21,7 @@
template <typename T> class ArrayRef;
class Module;
class Function;
+class FunctionCallee;
class GlobalValue;
class GlobalVariable;
class Constant;
@@ -40,24 +40,36 @@
void appendToGlobalDtors(Module &M, Function *F, int Priority,
Constant *Data = nullptr);
-// Validate the result of Module::getOrInsertFunction called for an interface
-// function of given sanitizer. If the instrumented module defines a function
-// with the same name, their prototypes must match, otherwise
-// getOrInsertFunction returns a bitcast.
-Function *checkSanitizerInterfaceFunction(Constant *FuncOrBitcast);
-
-Function *declareSanitizerInitFunction(Module &M, StringRef InitName,
- ArrayRef<Type *> InitArgTypes);
+FunctionCallee declareSanitizerInitFunction(Module &M, StringRef InitName,
+ ArrayRef<Type *> InitArgTypes);
/// Creates sanitizer constructor function, and calls sanitizer's init
/// function from it.
/// \return Returns pair of pointers to constructor, and init functions
/// respectively.
-std::pair<Function *, Function *> createSanitizerCtorAndInitFunctions(
+std::pair<Function *, FunctionCallee> createSanitizerCtorAndInitFunctions(
Module &M, StringRef CtorName, StringRef InitName,
ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
StringRef VersionCheckName = StringRef());
+/// Creates sanitizer constructor function lazily. If a constructor and init
+/// function already exist, this function returns it. Otherwise it calls \c
+/// createSanitizerCtorAndInitFunctions. The FunctionsCreatedCallback is invoked
+/// in that case, passing the new Ctor and Init function.
+///
+/// \return Returns pair of pointers to constructor, and init functions
+/// respectively.
+std::pair<Function *, FunctionCallee> getOrCreateSanitizerCtorAndInitFunctions(
+ Module &M, StringRef CtorName, StringRef InitName,
+ ArrayRef<Type *> InitArgTypes, ArrayRef<Value *> InitArgs,
+ function_ref<void(Function *, FunctionCallee)> FunctionsCreatedCallback,
+ StringRef VersionCheckName = StringRef());
+
+// Creates and returns a sanitizer init function without argument if it doesn't
+// exist, and adds it to the global constructors list. Otherwise it returns the
+// existing function.
+Function *getOrCreateInitFunction(Module &M, StringRef Name);
+
/// Rename all the anon globals in the module using a hash computed from
/// the list of public globals in the module.
bool nameUnamedGlobals(Module &M);
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/NameAnonGlobals.h b/linux-x64/clang/include/llvm/Transforms/Utils/NameAnonGlobals.h
index 17fc902..659ebe3 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/NameAnonGlobals.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/NameAnonGlobals.h
@@ -1,9 +1,8 @@
//===-- NameAnonGlobals.h - Anonymous Global Naming Pass --------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/PredicateInfo.h b/linux-x64/clang/include/llvm/Transforms/Utils/PredicateInfo.h
index 2fc3808..da4a5dc 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/PredicateInfo.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/PredicateInfo.h
@@ -1,9 +1,8 @@
//===- PredicateInfo.h - Build PredicateInfo ----------------------*-C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
///
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/PromoteMemToReg.h b/linux-x64/clang/include/llvm/Transforms/Utils/PromoteMemToReg.h
index 5ddfbe2..b2b4507 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/PromoteMemToReg.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/PromoteMemToReg.h
@@ -1,9 +1,8 @@
//===- PromoteMemToReg.h - Promote Allocas to Scalars -----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdater.h b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdater.h
index 4a79116..22b2295 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdater.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdater.h
@@ -1,9 +1,8 @@
//===- SSAUpdater.h - Unstructured SSA Update Tool --------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -76,6 +75,10 @@
/// block.
bool HasValueForBlock(BasicBlock *BB) const;
+ /// Return the value for the specified block if the SSAUpdater has one,
+ /// otherwise return nullptr.
+ Value *FindValueForBlock(BasicBlock *BB) const;
+
/// Construct SSA form, materializing a value that is live at the end
/// of the specified block.
Value *GetValueAtEndOfBlock(BasicBlock *BB);
@@ -144,7 +147,7 @@
/// Insts is a list of loads and stores to promote, and Name is the basename
/// for the PHIs to insert. After this is complete, the loads and stores are
/// removed from the code.
- void run(const SmallVectorImpl<Instruction *> &Insts) const;
+ void run(const SmallVectorImpl<Instruction *> &Insts);
/// Return true if the specified instruction is in the Inst list.
///
@@ -155,7 +158,7 @@
/// This hook is invoked after all the stores are found and inserted as
/// available values.
- virtual void doExtraRewritesBeforeFinalDeletion() const {}
+ virtual void doExtraRewritesBeforeFinalDeletion() {}
/// Clients can choose to implement this to get notified right before
/// a load is RAUW'd another value.
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterBulk.h b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterBulk.h
index 53a608f..5d17d6f 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterBulk.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterBulk.h
@@ -1,9 +1,8 @@
//===- SSAUpdaterBulk.h - Unstructured SSA Update Tool ----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterImpl.h b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
index b7649ba..ee06893 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SSAUpdaterImpl.h
@@ -1,9 +1,8 @@
//===- SSAUpdaterImpl.h - SSA Updater Implementation ------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -357,10 +356,9 @@
BBInfo *Info = *I;
if (Info->DefBB != Info) {
- // Record the available value at join nodes to speed up subsequent
- // uses of this SSAUpdater for the same value.
- if (Info->NumPreds > 1)
- (*AvailableVals)[Info->BB] = Info->DefBB->AvailableVal;
+ // Record the available value to speed up subsequent uses of this
+ // SSAUpdater for the same value.
+ (*AvailableVals)[Info->BB] = Info->DefBB->AvailableVal;
continue;
}
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SanitizerStats.h b/linux-x64/clang/include/llvm/Transforms/Utils/SanitizerStats.h
index d36e342..14e8ae0 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SanitizerStats.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SanitizerStats.h
@@ -1,9 +1,8 @@
//===- SanitizerStats.h - Sanitizer statistics gathering -------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyIndVar.h b/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyIndVar.h
index a1dfed2..dec73ef 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyIndVar.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyIndVar.h
@@ -1,9 +1,8 @@
//===-- llvm/Transforms/Utils/SimplifyIndVar.h - Indvar Utils ---*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyLibCalls.h b/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyLibCalls.h
index 2b344f4..44eef09 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyLibCalls.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SimplifyLibCalls.h
@@ -1,9 +1,8 @@
//===- SimplifyLibCalls.h - Library call simplifier -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -77,21 +76,34 @@
OptimizationRemarkEmitter &ORE;
bool UnsafeFPShrink;
function_ref<void(Instruction *, Value *)> Replacer;
+ function_ref<void(Instruction *)> Eraser;
/// Internal wrapper for RAUW that is the default implementation.
///
/// Other users may provide an alternate function with this signature instead
/// of this one.
- static void replaceAllUsesWithDefault(Instruction *I, Value *With);
+ static void replaceAllUsesWithDefault(Instruction *I, Value *With) {
+ I->replaceAllUsesWith(With);
+ }
+
+ /// Internal wrapper for eraseFromParent that is the default implementation.
+ static void eraseFromParentDefault(Instruction *I) { I->eraseFromParent(); }
/// Replace an instruction's uses with a value using our replacer.
void replaceAllUsesWith(Instruction *I, Value *With);
+ /// Erase an instruction from its parent with our eraser.
+ void eraseFromParent(Instruction *I);
+
+ Value *foldMallocMemset(CallInst *Memset, IRBuilder<> &B);
+
public:
- LibCallSimplifier(const DataLayout &DL, const TargetLibraryInfo *TLI,
- OptimizationRemarkEmitter &ORE,
- function_ref<void(Instruction *, Value *)> Replacer =
- &replaceAllUsesWithDefault);
+ LibCallSimplifier(
+ const DataLayout &DL, const TargetLibraryInfo *TLI,
+ OptimizationRemarkEmitter &ORE,
+ function_ref<void(Instruction *, Value *)> Replacer =
+ &replaceAllUsesWithDefault,
+ function_ref<void(Instruction *)> Eraser = &eraseFromParentDefault);
/// optimizeCall - Take the given call instruction and return a more
/// optimal value to replace the instruction with or 0 if a more
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SplitModule.h b/linux-x64/clang/include/llvm/Transforms/Utils/SplitModule.h
index d2c31f2..7839c5d 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SplitModule.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SplitModule.h
@@ -1,9 +1,8 @@
//===- SplitModule.h - Split a module into partitions -----------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/SymbolRewriter.h b/linux-x64/clang/include/llvm/Transforms/Utils/SymbolRewriter.h
index 5f6488e..ce9dcaf 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/SymbolRewriter.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/SymbolRewriter.h
@@ -1,9 +1,8 @@
//===- SymbolRewriter.h - Symbol Rewriting Pass -----------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/linux-x64/clang/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index 222c601..f68534e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -1,9 +1,8 @@
//===-- UnifyFunctionExitNodes.h - Ensure fn's have one return --*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/UnrollLoop.h b/linux-x64/clang/include/llvm/Transforms/Utils/UnrollLoop.h
index a6b84af..8f3824e 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/UnrollLoop.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/UnrollLoop.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Utils/UnrollLoop.h - Unrolling utilities -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -35,6 +34,15 @@
using NewLoopsMap = SmallDenseMap<const Loop *, Loop *, 4>;
+/// @{
+/// Metadata attribute names
+const char *const LLVMLoopUnrollFollowupAll = "llvm.loop.unroll.followup_all";
+const char *const LLVMLoopUnrollFollowupUnrolled =
+ "llvm.loop.unroll.followup_unrolled";
+const char *const LLVMLoopUnrollFollowupRemainder =
+ "llvm.loop.unroll.followup_remainder";
+/// @}
+
const Loop* addClonedBlockToLoopInfo(BasicBlock *OriginalBB,
BasicBlock *ClonedBB, LoopInfo *LI,
NewLoopsMap &NewLoops);
@@ -61,15 +69,16 @@
unsigned PeelCount, bool UnrollRemainder,
LoopInfo *LI, ScalarEvolution *SE,
DominatorTree *DT, AssumptionCache *AC,
- OptimizationRemarkEmitter *ORE, bool PreserveLCSSA);
+ OptimizationRemarkEmitter *ORE, bool PreserveLCSSA,
+ Loop **RemainderLoop = nullptr);
bool UnrollRuntimeLoopRemainder(Loop *L, unsigned Count,
bool AllowExpensiveTripCount,
bool UseEpilogRemainder, bool UnrollRemainder,
- LoopInfo *LI,
- ScalarEvolution *SE, DominatorTree *DT,
- AssumptionCache *AC,
- bool PreserveLCSSA);
+ LoopInfo *LI, ScalarEvolution *SE,
+ DominatorTree *DT, AssumptionCache *AC,
+ bool PreserveLCSSA,
+ Loop **ResultLoop = nullptr);
void computePeelCount(Loop *L, unsigned LoopSize,
TargetTransformInfo::UnrollingPreferences &UP,
@@ -84,7 +93,8 @@
unsigned TripMultiple, bool UnrollRemainder,
LoopInfo *LI, ScalarEvolution *SE,
DominatorTree *DT, AssumptionCache *AC,
- OptimizationRemarkEmitter *ORE);
+ OptimizationRemarkEmitter *ORE,
+ Loop **EpilogueLoop = nullptr);
bool isSafeToUnrollAndJam(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
DependenceInfo &DI);
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/VNCoercion.h b/linux-x64/clang/include/llvm/Transforms/Utils/VNCoercion.h
index 1baa9b6..f67b9ed 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/VNCoercion.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/VNCoercion.h
@@ -1,9 +1,8 @@
//===- VNCoercion.h - Value Numbering Coercion Utilities --------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
/// \file / This file provides routines used by LLVM's value numbering passes to
diff --git a/linux-x64/clang/include/llvm/Transforms/Utils/ValueMapper.h b/linux-x64/clang/include/llvm/Transforms/Utils/ValueMapper.h
index 4ecb23e..1952a21 100644
--- a/linux-x64/clang/include/llvm/Transforms/Utils/ValueMapper.h
+++ b/linux-x64/clang/include/llvm/Transforms/Utils/ValueMapper.h
@@ -1,9 +1,8 @@
//===- ValueMapper.h - Remapping for constants and metadata -----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Vectorize.h b/linux-x64/clang/include/llvm/Transforms/Vectorize.h
index 950af7f..a411b56 100644
--- a/linux-x64/clang/include/llvm/Transforms/Vectorize.h
+++ b/linux-x64/clang/include/llvm/Transforms/Vectorize.h
@@ -1,9 +1,8 @@
//===-- Vectorize.h - Vectorization Transformations -------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -110,8 +109,8 @@
//
// LoopVectorize - Create a loop vectorization pass.
//
-Pass *createLoopVectorizePass(bool NoUnrolling = false,
- bool AlwaysVectorize = true);
+Pass *createLoopVectorizePass(bool InterleaveOnlyWhenForced = false,
+ bool VectorizeOnlyWhenForced = false);
//===----------------------------------------------------------------------===//
//
diff --git a/linux-x64/clang/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
new file mode 100644
index 0000000..f72c76c
--- /dev/null
+++ b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
@@ -0,0 +1,26 @@
+//===- LoadStoreVectorizer.cpp - GPU Load & Store Vectorizer --------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H
+#define LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H
+
+#include "llvm/IR/PassManager.h"
+
+namespace llvm {
+
+class LoadStoreVectorizerPass : public PassInfoMixin<LoadStoreVectorizerPass> {
+public:
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
+/// Create a legacy pass manager instance of the LoadStoreVectorizer pass
+Pass *createLoadStoreVectorizerPass();
+
+}
+
+#endif /* LLVM_TRANSFORMS_VECTORIZE_LOADSTOREVECTORIZER_H */
diff --git a/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index 2a62420..ea0a1c2 100644
--- a/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -1,9 +1,8 @@
//===- llvm/Transforms/Vectorize/LoopVectorizationLegality.h ----*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -95,17 +94,14 @@
FK_Enabled = 1, ///< Forcing enabled.
};
- LoopVectorizeHints(const Loop *L, bool DisableInterleaving,
+ LoopVectorizeHints(const Loop *L, bool InterleaveOnlyWhenForced,
OptimizationRemarkEmitter &ORE);
/// Mark the loop L as already vectorized by setting the width to 1.
- void setAlreadyVectorized() {
- IsVectorized.Value = 1;
- Hint Hints[] = {IsVectorized};
- writeHintsToMetadata(Hints);
- }
+ void setAlreadyVectorized();
- bool allowVectorization(Function *F, Loop *L, bool AlwaysVectorize) const;
+ bool allowVectorization(Function *F, Loop *L,
+ bool VectorizeOnlyWhenForced) const;
/// Dumps all the hint information.
void emitRemarkWithHints() const;
@@ -113,7 +109,12 @@
unsigned getWidth() const { return Width.Value; }
unsigned getInterleave() const { return Interleave.Value; }
unsigned getIsVectorized() const { return IsVectorized.Value; }
- enum ForceKind getForce() const { return (ForceKind)Force.Value; }
+ enum ForceKind getForce() const {
+ if ((ForceKind)Force.Value == FK_Undefined &&
+ hasDisableAllTransformsHint(TheLoop))
+ return FK_Disabled;
+ return (ForceKind)Force.Value;
+ }
/// If hints are provided that force vectorization, use the AlwaysPrint
/// pass name to force the frontend to print the diagnostic.
@@ -146,15 +147,6 @@
/// Checks string hint with one operand and set value if valid.
void setHint(StringRef Name, Metadata *Arg);
- /// Create a new hint from name / value pair.
- MDNode *createHintMetadata(StringRef Name, unsigned V) const;
-
- /// Matches metadata with hint name.
- bool matchesHintMetadataName(MDNode *Node, ArrayRef<Hint> HintTypes);
-
- /// Sets current hints into loop metadata, keeping other values intact.
- void writeHintsToMetadata(ArrayRef<Hint> HintTypes);
-
/// The loop these hints belong to.
const Loop *TheLoop;
@@ -241,6 +233,10 @@
/// If false, good old LV code.
bool canVectorize(bool UseVPlanNativePath);
+ /// Return true if we can vectorize this loop while folding its tail by
+ /// masking.
+ bool canFoldTailByMasking();
+
/// Returns the primary induction variable.
PHINode *getPrimaryInduction() { return PrimaryInduction; }
diff --git a/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorize.h b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorize.h
index d79d846..cdbe5f6 100644
--- a/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorize.h
+++ b/linux-x64/clang/include/llvm/Transforms/Vectorize/LoopVectorize.h
@@ -1,9 +1,8 @@
//===- LoopVectorize.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
//
@@ -78,12 +77,13 @@
/// The LoopVectorize Pass.
struct LoopVectorizePass : public PassInfoMixin<LoopVectorizePass> {
- bool DisableUnrolling = false;
+ /// If false, consider all loops for interleaving.
+ /// If true, only loops that explicitly request interleaving are considered.
+ bool InterleaveOnlyWhenForced = false;
- /// If true, consider all loops for vectorization.
- /// If false, only loops that explicitly request vectorization are
- /// considered.
- bool AlwaysVectorize = true;
+ /// If false, consider all loops for vectorization.
+ /// If true, only loops that explicitly request vectorization are considered.
+ bool VectorizeOnlyWhenForced = false;
ScalarEvolution *SE;
LoopInfo *LI;
diff --git a/linux-x64/clang/include/llvm/Transforms/Vectorize/SLPVectorizer.h b/linux-x64/clang/include/llvm/Transforms/Vectorize/SLPVectorizer.h
index 3152e81..9be7055 100644
--- a/linux-x64/clang/include/llvm/Transforms/Vectorize/SLPVectorizer.h
+++ b/linux-x64/clang/include/llvm/Transforms/Vectorize/SLPVectorizer.h
@@ -1,9 +1,8 @@
//===- SLPVectorizer.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 pass implements the Bottom Up SLP vectorizer. It detects consecutive