From 09dfc5713d7e2342bea4c8447d1ed76c85eb8225 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Fri, 20 Dec 2024 08:15:48 -0800 Subject: [PATCH 001/466] [mlir] Enable decoupling two kinds of greedy behavior. (#104649) The greedy rewriter is used in many different flows and it has a lot of convenience (work list management, debugging actions, tracing, etc). But it combines two kinds of greedy behavior 1) how ops are matched, 2) folding wherever it can. These are independent forms of greedy and leads to inefficiency. E.g., cases where one need to create different phases in lowering and is required to applying patterns in specific order split across different passes. Using the driver one ends up needlessly retrying folding/having multiple rounds of folding attempts, where one final run would have sufficed. Of course folks can locally avoid this behavior by just building their own, but this is also a common requested feature that folks keep on working around locally in suboptimal ways. For downstream users, there should be no behavioral change. Updating from the deprecated should just be a find and replace (e.g., `find ./ -type f -exec sed -i 's|applyPatternsAndFoldGreedily|applyPatternsGreedily|g' {} \;` variety) as the API arguments hasn't changed between the two. --- .../HLFIR/Transforms/InlineElementals.cpp | 2 +- .../HLFIR/Transforms/LowerHLFIRIntrinsics.cpp | 4 +- .../Transforms/OptimizedBufferization.cpp | 2 +- .../Transforms/SimplifyHLFIRIntrinsics.cpp | 2 +- .../Transforms/AlgebraicSimplification.cpp | 3 +- .../Transforms/AssumedRankOpConversion.cpp | 2 +- .../ConstantArgumentGlobalisation.cpp | 4 +- .../lib/Optimizer/Transforms/StackArrays.cpp | 4 +- mlir/docs/PatternRewriter.md | 2 +- .../lib/Standalone/StandalonePasses.cpp | 2 +- .../Transforms/GreedyPatternRewriteDriver.h | 72 ++++++++++++++----- mlir/lib/CAPI/Transforms/Rewrite.cpp | 3 +- .../ArithToAMDGPU/ArithToAMDGPU.cpp | 2 +- .../ArithToArmSME/ArithToArmSME.cpp | 3 +- .../ArmNeon2dToIntr/ArmNeon2dToIntr.cpp | 3 +- .../GPUToNVVM/LowerGpuOpsToNVVMOps.cpp | 2 +- .../GPUToROCDL/LowerGpuOpsToROCDLOps.cpp | 2 +- mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp | 3 +- .../ConvertShapeConstraints.cpp | 2 +- .../VectorToArmSME/VectorToArmSMEPass.cpp | 2 +- .../Conversion/VectorToGPU/VectorToGPU.cpp | 3 +- .../VectorToLLVM/ConvertVectorToLLVMPass.cpp | 2 +- .../Conversion/VectorToSCF/VectorToSCF.cpp | 6 +- .../VectorToXeGPU/VectorToXeGPU.cpp | 3 +- .../TransformOps/AffineTransformOps.cpp | 2 +- .../Transforms/AffineDataCopyGeneration.cpp | 2 +- .../Transforms/AffineExpandIndexOps.cpp | 3 +- .../AffineExpandIndexOpsAsAffine.cpp | 3 +- .../Transforms/SimplifyAffineStructures.cpp | 2 +- mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp | 4 +- mlir/lib/Dialect/Affine/Utils/Utils.cpp | 6 +- .../Transforms/IntRangeOptimizations.cpp | 4 +- .../ArmSME/Transforms/OuterProductFusion.cpp | 3 +- .../Transforms/LegalizeVectorStorage.cpp | 3 +- .../Async/Transforms/AsyncParallelFor.cpp | 2 +- .../BufferDeallocationSimplification.cpp | 4 +- .../Transforms/EmptyTensorToAllocTensor.cpp | 2 +- .../EmitC/Transforms/FormExpressions.cpp | 2 +- .../GPU/Transforms/DecomposeMemRefs.cpp | 3 +- .../GPU/Transforms/EliminateBarriers.cpp | 2 +- .../LLVMIR/Transforms/OptimizeForNVVM.cpp | 2 +- .../TransformOps/LinalgTransformOps.cpp | 2 +- .../Linalg/Transforms/BlockPackMatmul.cpp | 2 +- .../Dialect/Linalg/Transforms/Detensorize.cpp | 3 +- .../Linalg/Transforms/DropUnitDims.cpp | 2 +- .../Linalg/Transforms/ElementwiseOpFusion.cpp | 2 +- .../Linalg/Transforms/Generalization.cpp | 2 +- .../Transforms/InlineScalarOperands.cpp | 2 +- mlir/lib/Dialect/Linalg/Transforms/Loops.cpp | 2 +- .../Linalg/Transforms/NamedOpConversions.cpp | 2 +- .../Dialect/Linalg/Transforms/Specialize.cpp | 2 +- .../Dialect/Math/Transforms/UpliftToFMA.cpp | 3 +- .../Transforms/ExpandStridedMetadata.cpp | 2 +- .../MemRef/Transforms/FoldMemRefAliasOps.cpp | 2 +- .../ResolveShapedTypeResultDims.cpp | 4 +- .../lib/Dialect/SCF/Transforms/ForToWhile.cpp | 2 +- .../SCF/Transforms/LoopCanonicalization.cpp | 2 +- .../SCF/Transforms/LoopSpecialization.cpp | 2 +- .../SCF/Transforms/TileUsingInterface.cpp | 2 +- .../SPIRV/Transforms/CanonicalizeGLPass.cpp | 3 +- .../SPIRV/Transforms/SPIRVConversion.cpp | 8 +-- .../Transforms/SPIRVWebGPUTransforms.cpp | 3 +- .../Transforms/OutlineShapeComputation.cpp | 4 +- .../Transforms/RemoveShapeConstraints.cpp | 2 +- .../Transforms/SparseTensorPasses.cpp | 20 +++--- .../Tensor/Transforms/FoldTensorSubsetOps.cpp | 2 +- .../TosaLayerwiseConstantFoldPass.cpp | 2 +- .../Tosa/Transforms/TosaMakeBroadcastable.cpp | 2 +- .../Transforms/TosaOptionalDecompositions.cpp | 2 +- .../lib/Dialect/Transform/IR/TransformOps.cpp | 4 +- .../Vector/Transforms/LowerVectorMask.cpp | 2 +- .../Transforms/LowerVectorMultiReduction.cpp | 2 +- .../XeGPU/Transforms/XeGPUFoldAliasOps.cpp | 2 +- mlir/lib/Reducer/ReductionTreePass.cpp | 2 +- mlir/lib/Transforms/Canonicalizer.cpp | 2 +- .../Utils/GreedyPatternRewriteDriver.cpp | 16 ++--- .../Transforms/Utils/OneToNTypeConversion.cpp | 4 +- .../Transforms/test-operation-folder.mlir | 48 ++++++++++++- .../MathToVCIX/TestMathToVCIXConversion.cpp | 2 +- .../TestVectorReductionToSPIRVDotProd.cpp | 2 +- .../lib/Dialect/Affine/TestAffineDataCopy.cpp | 2 +- .../Dialect/ArmNeon/TestLowerToArmNeon.cpp | 2 +- mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp | 4 +- .../Linalg/TestDataLayoutPropagation.cpp | 3 +- .../Dialect/Linalg/TestLinalgDecomposeOps.cpp | 4 +- .../Linalg/TestLinalgElementwiseFusion.cpp | 28 ++++---- .../Linalg/TestLinalgFusionTransforms.cpp | 2 +- .../TestLinalgRankReduceContractionOps.cpp | 3 +- .../Dialect/Linalg/TestLinalgTransforms.cpp | 26 +++---- .../test/lib/Dialect/Linalg/TestPadFusion.cpp | 3 +- .../Math/TestAlgebraicSimplification.cpp | 2 +- mlir/test/lib/Dialect/Math/TestExpandMath.cpp | 2 +- .../Math/TestPolynomialApproximation.cpp | 2 +- .../lib/Dialect/MemRef/TestComposeSubView.cpp | 2 +- mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp | 8 +-- .../Mesh/TestReshardingSpmdization.cpp | 4 +- .../lib/Dialect/Mesh/TestSimplifications.cpp | 2 +- .../lib/Dialect/NVGPU/TestNVGPUTransforms.cpp | 2 +- mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp | 2 +- .../SCF/TestSCFWrapInZeroTripCheck.cpp | 2 +- .../lib/Dialect/SCF/TestUpliftWhileToFor.cpp | 2 +- .../Dialect/Tensor/TestTensorTransforms.cpp | 16 ++--- mlir/test/lib/Dialect/Test/TestPatterns.cpp | 16 +++-- mlir/test/lib/Dialect/Test/TestTraits.cpp | 4 +- mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp | 2 +- .../Dialect/Vector/TestVectorTransforms.cpp | 42 +++++------ mlir/test/lib/Rewrite/TestPDLByteCode.cpp | 4 +- mlir/test/lib/Tools/PDLL/TestPDLL.cpp | 2 +- .../lib/Transforms/TestCommutativityUtils.cpp | 2 +- .../Transforms/TestMakeIsolatedFromAbove.cpp | 6 +- 110 files changed, 313 insertions(+), 246 deletions(-) diff --git a/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp b/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp index 769e14b1316d6..b68fe6ee0c747 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp @@ -125,7 +125,7 @@ class InlineElementalsPass mlir::RewritePatternSet patterns(context); patterns.insert(context); - if (mlir::failed(mlir::applyPatternsAndFoldGreedily( + if (mlir::failed(mlir::applyPatternsGreedily( getOperation(), std::move(patterns), config))) { mlir::emitError(getOperation()->getLoc(), "failure in HLFIR elemental inlining"); diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp index 36fae90c83fd6..091ed7ed999df 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp @@ -520,8 +520,8 @@ class LowerHLFIRIntrinsics config.enableRegionSimplification = mlir::GreedySimplifyRegionLevel::Disabled; - if (mlir::failed(mlir::applyPatternsAndFoldGreedily( - module, std::move(patterns), config))) { + if (mlir::failed( + mlir::applyPatternsGreedily(module, std::move(patterns), config))) { mlir::emitError(mlir::UnknownLoc::get(context), "failure in HLFIR intrinsic lowering"); signalPassFailure(); diff --git a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp index c152c27c0a05b..bf3cf861e46f4 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp @@ -1372,7 +1372,7 @@ class OptimizedBufferizationPass // patterns.insert>(context); // patterns.insert>(context); - if (mlir::failed(mlir::applyPatternsAndFoldGreedily( + if (mlir::failed(mlir::applyPatternsGreedily( getOperation(), std::move(patterns), config))) { mlir::emitError(getOperation()->getLoc(), "failure in HLFIR optimized bufferization"); diff --git a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp index 28325bc8e5489..bf3d261e7e883 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp @@ -491,7 +491,7 @@ class SimplifyHLFIRIntrinsics patterns.insert(context); patterns.insert(context); - if (mlir::failed(mlir::applyPatternsAndFoldGreedily( + if (mlir::failed(mlir::applyPatternsGreedily( getOperation(), std::move(patterns), config))) { mlir::emitError(getOperation()->getLoc(), "failure in HLFIR intrinsic simplification"); diff --git a/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp b/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp index fd58375da618a..fab1f0299ede9 100644 --- a/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp +++ b/flang/lib/Optimizer/Transforms/AlgebraicSimplification.cpp @@ -39,8 +39,7 @@ struct AlgebraicSimplification void AlgebraicSimplification::runOnOperation() { RewritePatternSet patterns(&getContext()); populateMathAlgebraicSimplificationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns), - config); + (void)applyPatternsGreedily(getOperation(), std::move(patterns), config); } std::unique_ptr fir::createAlgebraicSimplificationPass() { diff --git a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp index 2c9c73e8a5394..eb59045a5fde7 100644 --- a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp @@ -154,7 +154,7 @@ class AssumedRankOpConversion mlir::GreedyRewriteConfig config; config.enableRegionSimplification = mlir::GreedySimplifyRegionLevel::Disabled; - (void)applyPatternsAndFoldGreedily(mod, std::move(patterns), config); + (void)applyPatternsGreedily(mod, std::move(patterns), config); } }; } // namespace diff --git a/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp b/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp index eef6f047fc1bf..562f3058f20f3 100644 --- a/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp +++ b/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp @@ -173,8 +173,8 @@ class ConstantArgumentGlobalisationOpt config.strictMode = mlir::GreedyRewriteStrictness::ExistingOps; patterns.insert(context, *di); - if (mlir::failed(mlir::applyPatternsAndFoldGreedily( - mod, std::move(patterns), config))) { + if (mlir::failed( + mlir::applyPatternsGreedily(mod, std::move(patterns), config))) { mlir::emitError(mod.getLoc(), "error in constant globalisation optimization\n"); signalPassFailure(); diff --git a/flang/lib/Optimizer/Transforms/StackArrays.cpp b/flang/lib/Optimizer/Transforms/StackArrays.cpp index 0c474f463f09c..f9281000d21f0 100644 --- a/flang/lib/Optimizer/Transforms/StackArrays.cpp +++ b/flang/lib/Optimizer/Transforms/StackArrays.cpp @@ -793,8 +793,8 @@ void StackArraysPass::runOnOperation() { config.enableRegionSimplification = mlir::GreedySimplifyRegionLevel::Disabled; patterns.insert(&context, *candidateOps); - if (mlir::failed(mlir::applyOpPatternsAndFold(opsToConvert, - std::move(patterns), config))) { + if (mlir::failed(mlir::applyOpPatternsGreedily( + opsToConvert, std::move(patterns), config))) { mlir::emitError(func->getLoc(), "error in stack arrays optimization\n"); signalPassFailure(); } diff --git a/mlir/docs/PatternRewriter.md b/mlir/docs/PatternRewriter.md index da392b8289332..d15e7e5a80678 100644 --- a/mlir/docs/PatternRewriter.md +++ b/mlir/docs/PatternRewriter.md @@ -358,7 +358,7 @@ which point the driver finishes. This driver comes in two fashions: -* `applyPatternsAndFoldGreedily` ("region-based driver") applies patterns to +* `applyPatternsGreedily` ("region-based driver") applies patterns to all ops in a given region or a given container op (but not the container op itself). I.e., the worklist is initialized with all containing ops. * `applyOpPatternsAndFold` ("op-based driver") applies patterns to the diff --git a/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp b/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp index 8166aa238bf2c..8c79a07537933 100644 --- a/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp +++ b/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp @@ -39,7 +39,7 @@ class StandaloneSwitchBarFoo RewritePatternSet patterns(&getContext()); patterns.add(&getContext()); FrozenRewritePatternSet patternSet(std::move(patterns)); - if (failed(applyPatternsAndFoldGreedily(getOperation(), patternSet))) + if (failed(applyPatternsGreedily(getOperation(), patternSet))) signalPassFailure(); } }; diff --git a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h index eaff85804f6b3..110b4f64856eb 100644 --- a/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h +++ b/mlir/include/mlir/Transforms/GreedyPatternRewriteDriver.h @@ -91,6 +91,13 @@ class GreedyRewriteConfig { /// An optional listener that should be notified about IR modifications. RewriterBase::Listener *listener = nullptr; + + /// Whether this should fold while greedily rewriting. + bool fold = true; + + /// If set to "true", constants are CSE'd (even across multiple regions that + /// are in a parent-ancestor relationship). + bool cseConstants = true; }; //===----------------------------------------------------------------------===// @@ -104,8 +111,8 @@ class GreedyRewriteConfig { /// The greedy rewrite may prematurely stop after a maximum number of /// iterations, which can be configured in the configuration parameter. /// -/// Also performs folding and simple dead-code elimination before attempting to -/// match any of the provided patterns. +/// Also performs simple dead-code elimination before attempting to match any of +/// the provided patterns. /// /// A region scope can be set in the configuration parameter. By default, the /// scope is set to the specified region. Only in-scope ops are added to the @@ -117,10 +124,20 @@ class GreedyRewriteConfig { /// /// Note: This method does not apply patterns to the region's parent operation. LogicalResult +applyPatternsGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, + GreedyRewriteConfig config = GreedyRewriteConfig(), + bool *changed = nullptr); +/// Same as `applyPatternsAndGreedily` above with folding. +/// FIXME: Remove this once transition to above is complieted. +LLVM_DEPRECATED("Use applyPatternsGreedily() instead", "applyPatternsGreedily") +inline LogicalResult applyPatternsAndFoldGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config = GreedyRewriteConfig(), - bool *changed = nullptr); + bool *changed = nullptr) { + config.fold = true; + return applyPatternsGreedily(region, patterns, config, changed); +} /// Rewrite ops nested under the given operation, which must be isolated from /// above, by repeatedly applying the highest benefit patterns in a greedy @@ -129,8 +146,8 @@ applyPatternsAndFoldGreedily(Region ®ion, /// The greedy rewrite may prematurely stop after a maximum number of /// iterations, which can be configured in the configuration parameter. /// -/// Also performs folding and simple dead-code elimination before attempting to -/// match any of the provided patterns. +/// Also performs simple dead-code elimination before attempting to match any of +/// the provided patterns. /// /// This overload runs a separate greedy rewrite for each region of the /// specified op. A region scope can be set in the configuration parameter. By @@ -147,23 +164,32 @@ applyPatternsAndFoldGreedily(Region ®ion, /// /// Note: This method does not apply patterns to the given operation itself. inline LogicalResult -applyPatternsAndFoldGreedily(Operation *op, - const FrozenRewritePatternSet &patterns, - GreedyRewriteConfig config = GreedyRewriteConfig(), - bool *changed = nullptr) { +applyPatternsGreedily(Operation *op, const FrozenRewritePatternSet &patterns, + GreedyRewriteConfig config = GreedyRewriteConfig(), + bool *changed = nullptr) { bool anyRegionChanged = false; bool failed = false; for (Region ®ion : op->getRegions()) { bool regionChanged; - failed |= - applyPatternsAndFoldGreedily(region, patterns, config, ®ionChanged) - .failed(); + failed |= applyPatternsGreedily(region, patterns, config, ®ionChanged) + .failed(); anyRegionChanged |= regionChanged; } if (changed) *changed = anyRegionChanged; return failure(failed); } +/// Same as `applyPatternsGreedily` above with folding. +/// FIXME: Remove this once transition to above is complieted. +LLVM_DEPRECATED("Use applyPatternsGreedily() instead", "applyPatternsGreedily") +inline LogicalResult +applyPatternsAndFoldGreedily(Operation *op, + const FrozenRewritePatternSet &patterns, + GreedyRewriteConfig config = GreedyRewriteConfig(), + bool *changed = nullptr) { + config.fold = true; + return applyPatternsGreedily(op, patterns, config, changed); +} /// Rewrite the specified ops by repeatedly applying the highest benefit /// patterns in a greedy worklist driven manner until a fixpoint is reached. @@ -171,8 +197,8 @@ applyPatternsAndFoldGreedily(Operation *op, /// The greedy rewrite may prematurely stop after a maximum number of /// iterations, which can be configured in the configuration parameter. /// -/// Also performs folding and simple dead-code elimination before attempting to -/// match any of the provided patterns. +/// Also performs simple dead-code elimination before attempting to match any of +/// the provided patterns. /// /// Newly created ops and other pre-existing ops that use results of rewritten /// ops or supply operands to such ops are also processed, unless such ops are @@ -180,24 +206,36 @@ applyPatternsAndFoldGreedily(Operation *op, /// regardless of `strictMode`). /// /// In addition to strictness, a region scope can be specified. Only ops within -/// the scope are simplified. This is similar to `applyPatternsAndFoldGreedily`, +/// the scope are simplified. This is similar to `applyPatternsGreedily`, /// where only ops within the given region/op are simplified by default. If no /// scope is specified, it is assumed to be the first common enclosing region of /// the given ops. /// /// Note that ops in `ops` could be erased as result of folding, becoming dead, /// or via pattern rewrites. If more far reaching simplification is desired, -/// `applyPatternsAndFoldGreedily` should be used. +/// `applyPatternsGreedily` should be used. /// /// Returns "success" if the iterative process converged (i.e., fixpoint was /// reached) and no more patterns can be matched. `changed` is set to "true" if /// the IR was modified at all. `allOpsErased` is set to "true" if all ops in /// `ops` were erased. LogicalResult +applyOpPatternsGreedily(ArrayRef ops, + const FrozenRewritePatternSet &patterns, + GreedyRewriteConfig config = GreedyRewriteConfig(), + bool *changed = nullptr, bool *allErased = nullptr); +/// Same as `applyOpPatternsGreedily` with folding. +/// FIXME: Remove this once transition to above is complieted. +LLVM_DEPRECATED("Use applyOpPatternsGreedily() instead", + "applyOpPatternsGreedily") +inline LogicalResult applyOpPatternsAndFold(ArrayRef ops, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config = GreedyRewriteConfig(), - bool *changed = nullptr, bool *allErased = nullptr); + bool *changed = nullptr, bool *allErased = nullptr) { + config.fold = true; + return applyOpPatternsGreedily(ops, patterns, config, changed, allErased); +} } // namespace mlir diff --git a/mlir/lib/CAPI/Transforms/Rewrite.cpp b/mlir/lib/CAPI/Transforms/Rewrite.cpp index 379f09cf5cc26..c4717ca613319 100644 --- a/mlir/lib/CAPI/Transforms/Rewrite.cpp +++ b/mlir/lib/CAPI/Transforms/Rewrite.cpp @@ -289,8 +289,7 @@ MlirLogicalResult mlirApplyPatternsAndFoldGreedily(MlirModule op, MlirFrozenRewritePatternSet patterns, MlirGreedyRewriteDriverConfig) { - return wrap( - mlir::applyPatternsAndFoldGreedily(unwrap(op), *unwrap(patterns))); + return wrap(mlir::applyPatternsGreedily(unwrap(op), *unwrap(patterns))); } //===----------------------------------------------------------------------===// diff --git a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp index 6b9cbaf57676c..a8283023afc53 100644 --- a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp +++ b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp @@ -385,6 +385,6 @@ void ArithToAMDGPUConversionPass::runOnOperation() { arith::populateArithToAMDGPUConversionPatterns( patterns, convertFP8Arithmetic, saturateFP8Truncf, allowPackedF16Rtz, *maybeChipset); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/lib/Conversion/ArithToArmSME/ArithToArmSME.cpp b/mlir/lib/Conversion/ArithToArmSME/ArithToArmSME.cpp index 5aa2a098b1762..cbe0b3fda3410 100644 --- a/mlir/lib/Conversion/ArithToArmSME/ArithToArmSME.cpp +++ b/mlir/lib/Conversion/ArithToArmSME/ArithToArmSME.cpp @@ -117,8 +117,7 @@ struct ArithToArmSMEConversionPass final void runOnOperation() override { RewritePatternSet patterns(&getContext()); arith::populateArithToArmSMEConversionPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp b/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp index bdbf276d79b22..de8bfd6a17103 100644 --- a/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp +++ b/mlir/lib/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.cpp @@ -59,8 +59,7 @@ class ConvertArmNeon2dToIntr RewritePatternSet patterns(context); populateConvertArmNeon2dToIntrPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp index b343cf71e3a2e..e022d3ce6f636 100644 --- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp +++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp @@ -271,7 +271,7 @@ struct LowerGpuOpsToNVVMOpsPass { RewritePatternSet patterns(m.getContext()); populateGpuRewritePatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(m, std::move(patterns)))) + if (failed(applyPatternsGreedily(m, std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp index aa4d3b70329fb..d52a86987b1ce 100644 --- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp +++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp @@ -271,7 +271,7 @@ struct LowerGpuOpsToROCDLOpsPass RewritePatternSet patterns(ctx); populateGpuRewritePatterns(patterns); arith::populateExpandBFloat16Patterns(patterns); - (void)applyPatternsAndFoldGreedily(m, std::move(patterns)); + (void)applyPatternsGreedily(m, std::move(patterns)); } LLVMTypeConverter converter(ctx, options); diff --git a/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp b/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp index 6dd89ecf4d5c2..e1de125ccaede 100644 --- a/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp +++ b/mlir/lib/Conversion/MeshToMPI/MeshToMPI.cpp @@ -427,8 +427,7 @@ struct ConvertMeshToMPIPass ConvertProcessLinearIndexOp, ConvertProcessMultiIndexOp>( ctx); - (void)mlir::applyPatternsAndFoldGreedily(getOperation(), - std::move(patterns)); + (void)mlir::applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp index 7df1407da6f97..d92027a5e3d46 100644 --- a/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp +++ b/mlir/lib/Conversion/ShapeToStandard/ConvertShapeConstraints.cpp @@ -62,7 +62,7 @@ class ConvertShapeConstraints RewritePatternSet patterns(context); populateConvertShapeConstraintsConversionPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(func, std::move(patterns)))) + if (failed(applyPatternsGreedily(func, std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Conversion/VectorToArmSME/VectorToArmSMEPass.cpp b/mlir/lib/Conversion/VectorToArmSME/VectorToArmSMEPass.cpp index cc00bf4ca190a..7419276651ae2 100644 --- a/mlir/lib/Conversion/VectorToArmSME/VectorToArmSMEPass.cpp +++ b/mlir/lib/Conversion/VectorToArmSME/VectorToArmSMEPass.cpp @@ -33,7 +33,7 @@ void ConvertVectorToArmSMEPass::runOnOperation() { RewritePatternSet patterns(&getContext()); populateVectorToArmSMEPatterns(patterns, getContext()); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } std::unique_ptr mlir::createConvertVectorToArmSMEPass() { diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp index 034f3e2d16e94..5b4414d67fdac 100644 --- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp +++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp @@ -1326,8 +1326,7 @@ struct ConvertVectorToGPUPass void runOnOperation() override { RewritePatternSet patterns(&getContext()); populatePrepareVectorToMMAPatterns(patterns, useNvGpu.getValue()); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); IRRewriter rewriter(&getContext()); diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp index 2d94c2f2e85a0..2c4c5ada9815d 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVMPass.cpp @@ -82,7 +82,7 @@ void ConvertVectorToLLVMPass::runOnOperation() { populateVectorInsertExtractStridedSliceTransforms(patterns); populateVectorStepLoweringPatterns(patterns); populateVectorRankReducingFMAPattern(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } // Convert to the LLVM IR dialect. diff --git a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp index 3a4dc806efe97..01bc65c841e94 100644 --- a/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp +++ b/mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp @@ -1730,12 +1730,12 @@ struct ConvertVectorToSCFPass RewritePatternSet lowerTransferPatterns(&getContext()); mlir::vector::populateVectorTransferPermutationMapLoweringPatterns( lowerTransferPatterns); - (void)applyPatternsAndFoldGreedily(getOperation(), - std::move(lowerTransferPatterns)); + (void)applyPatternsGreedily(getOperation(), + std::move(lowerTransferPatterns)); RewritePatternSet patterns(&getContext()); populateVectorToSCFConversionPatterns(patterns, options); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp index 1232d8795d4dc..8041bdf7da19b 100644 --- a/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp +++ b/mlir/lib/Conversion/VectorToXeGPU/VectorToXeGPU.cpp @@ -318,8 +318,7 @@ struct ConvertVectorToXeGPUPass void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorToXeGPUConversionPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp b/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp index eb52297940722..9f7df7823d997 100644 --- a/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp +++ b/mlir/lib/Dialect/Affine/TransformOps/AffineTransformOps.cpp @@ -132,7 +132,7 @@ SimplifyBoundedAffineOpsOp::apply(transform::TransformRewriter &rewriter, static_cast(rewriter.getListener()); config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps; // Apply the simplification pattern to a fixpoint. - if (failed(applyOpPatternsAndFold(targets, frozenPatterns, config))) { + if (failed(applyOpPatternsGreedily(targets, frozenPatterns, config))) { auto diag = emitDefiniteFailure() << "affine.min/max simplification did not converge"; return diag; diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp index 331b0f1b2c2b1..9ffe54f61ebbd 100644 --- a/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/AffineDataCopyGeneration.cpp @@ -239,5 +239,5 @@ void AffineDataCopyGeneration::runOnOperation() { FrozenRewritePatternSet frozenPatterns(std::move(patterns)); GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps; - (void)applyOpPatternsAndFold(copyOps, frozenPatterns, config); + (void)applyOpPatternsGreedily(copyOps, frozenPatterns, config); } diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp index d7b218225bc9a..7e335ea929c4f 100644 --- a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOps.cpp @@ -198,8 +198,7 @@ class ExpandAffineIndexOpsPass MLIRContext *context = &getContext(); RewritePatternSet patterns(context); populateAffineExpandIndexOpsPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp index bfcc1ddf91653..16ba16d5c798f 100644 --- a/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/AffineExpandIndexOpsAsAffine.cpp @@ -79,8 +79,7 @@ class ExpandAffineIndexOpsAsAffinePass MLIRContext *context = &getContext(); RewritePatternSet patterns(context); populateAffineExpandIndexOpsAsAffinePatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp index 49618074ec224..31711ade3153b 100644 --- a/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp +++ b/mlir/lib/Dialect/Affine/Transforms/SimplifyAffineStructures.cpp @@ -111,5 +111,5 @@ void SimplifyAffineStructures::runOnOperation() { }); GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps; - (void)applyOpPatternsAndFold(opsToSimplify, frozenPatterns, config); + (void)applyOpPatternsGreedily(opsToSimplify, frozenPatterns, config); } diff --git a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp index c5cc8bfeb0a64..0f2c889d4f390 100644 --- a/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp +++ b/mlir/lib/Dialect/Affine/Utils/LoopUtils.cpp @@ -318,8 +318,8 @@ LogicalResult mlir::affine::affineForOpBodySkew(AffineForOp forOp, GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingOps; bool erased; - (void)applyOpPatternsAndFold(res.getOperation(), std::move(patterns), - config, /*changed=*/nullptr, &erased); + (void)applyOpPatternsGreedily(res.getOperation(), std::move(patterns), + config, /*changed=*/nullptr, &erased); if (!erased && !prologue) prologue = res; if (!erased) diff --git a/mlir/lib/Dialect/Affine/Utils/Utils.cpp b/mlir/lib/Dialect/Affine/Utils/Utils.cpp index 07d399adae0cd..4d3ead20fb5cd 100644 --- a/mlir/lib/Dialect/Affine/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Affine/Utils/Utils.cpp @@ -425,8 +425,8 @@ LogicalResult mlir::affine::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) { GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingOps; bool erased; - (void)applyOpPatternsAndFold(ifOp.getOperation(), frozenPatterns, config, - /*changed=*/nullptr, &erased); + (void)applyOpPatternsGreedily(ifOp.getOperation(), frozenPatterns, config, + /*changed=*/nullptr, &erased); if (erased) { if (folded) *folded = true; @@ -454,7 +454,7 @@ LogicalResult mlir::affine::hoistAffineIfOp(AffineIfOp ifOp, bool *folded) { // Canonicalize to remove dead else blocks (happens whenever an 'if' moves up // a sequence of affine.fors that are all perfectly nested). - (void)applyPatternsAndFoldGreedily( + (void)applyPatternsGreedily( hoistedIfOp->getParentWithTrait(), frozenPatterns); diff --git a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp index b54a53f5ef70e..5982f5f55549e 100644 --- a/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/IntRangeOptimizations.cpp @@ -489,7 +489,7 @@ struct IntRangeOptimizationsPass final GreedyRewriteConfig config; config.listener = &listener; - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns), config))) + if (failed(applyPatternsGreedily(op, std::move(patterns), config))) signalPassFailure(); } }; @@ -518,7 +518,7 @@ struct IntRangeNarrowingPass final config.useTopDownTraversal = false; config.listener = &listener; - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns), config))) + if (failed(applyPatternsGreedily(op, std::move(patterns), config))) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp b/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp index ee1e374b25b04..23f2c2bf65e47 100644 --- a/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp +++ b/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp @@ -523,8 +523,7 @@ struct OuterProductFusionPass RewritePatternSet patterns(&getContext()); populateOuterProductFusionPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeVectorStorage.cpp b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeVectorStorage.cpp index 8b4bacd722712..d2ac850a5f70b 100644 --- a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeVectorStorage.cpp +++ b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeVectorStorage.cpp @@ -317,8 +317,7 @@ struct LegalizeVectorStorage void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateLegalizeVectorStoragePatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(getOperation(), - std::move(patterns)))) { + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) { signalPassFailure(); } ConversionTarget target(getContext()); diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp index 273101ce5f3e7..1320523aa989d 100644 --- a/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp +++ b/mlir/lib/Dialect/Async/Transforms/AsyncParallelFor.cpp @@ -931,7 +931,7 @@ void AsyncParallelForPass::runOnOperation() { [&](ImplicitLocOpBuilder builder, scf::ParallelOp op) { return builder.create(minTaskSize); }); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) signalPassFailure(); } diff --git a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp index 5227b22653eef..de3ae82f87086 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/BufferDeallocationSimplification.cpp @@ -470,8 +470,8 @@ struct BufferDeallocationSimplificationPass config.enableRegionSimplification = GreedySimplifyRegionLevel::Normal; populateDeallocOpCanonicalizationPatterns(patterns, &getContext()); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns), - config))) + if (failed( + applyPatternsGreedily(getOperation(), std::move(patterns), config))) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorToAllocTensor.cpp b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorToAllocTensor.cpp index 7670220dce776..d20c6966d4eb9 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorToAllocTensor.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/EmptyTensorToAllocTensor.cpp @@ -60,7 +60,7 @@ void EmptyTensorToAllocTensor::runOnOperation() { Operation *op = getOperation(); RewritePatternSet patterns(op->getContext()); populateEmptyTensorToAllocTensorPattern(patterns); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) signalPassFailure(); } diff --git a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp index 82bd031430d36..3385514375804 100644 --- a/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp +++ b/mlir/lib/Dialect/EmitC/Transforms/FormExpressions.cpp @@ -47,7 +47,7 @@ struct FormExpressionsPass RewritePatternSet patterns(context); populateExpressionPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(rootOp, std::move(patterns)))) + if (failed(applyPatternsGreedily(rootOp, std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp b/mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp index 004d73a77e535..a504101fb3f2f 100644 --- a/mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/DecomposeMemRefs.cpp @@ -227,8 +227,7 @@ struct GpuDecomposeMemrefsPass populateGpuDecomposeMemrefsPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/GPU/Transforms/EliminateBarriers.cpp b/mlir/lib/Dialect/GPU/Transforms/EliminateBarriers.cpp index 0ffd8131b8934..2178555cb62f7 100644 --- a/mlir/lib/Dialect/GPU/Transforms/EliminateBarriers.cpp +++ b/mlir/lib/Dialect/GPU/Transforms/EliminateBarriers.cpp @@ -630,7 +630,7 @@ class GpuEliminateBarriersPass auto funcOp = getOperation(); RewritePatternSet patterns(&getContext()); mlir::populateGpuEliminateBarriersPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) { + if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) { return signalPassFailure(); } } diff --git a/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp b/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp index 8c33148d1d2d7..c1ec1df48e5b9 100644 --- a/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp +++ b/mlir/lib/Dialect/LLVMIR/Transforms/OptimizeForNVVM.cpp @@ -96,7 +96,7 @@ void NVVMOptimizeForTarget::runOnOperation() { MLIRContext *ctx = getOperation()->getContext(); RewritePatternSet patterns(ctx); patterns.add(ctx); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp index 18fd24da395b7..221ca27b80fdd 100644 --- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp +++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp @@ -3511,7 +3511,7 @@ transform::VectorizeChildrenAndApplyPatternsOp::applyToOne( TrackingListener listener(state, *this); GreedyRewriteConfig config; config.listener = &listener; - if (failed(applyPatternsAndFoldGreedily(target, std::move(patterns), config))) + if (failed(applyPatternsGreedily(target, std::move(patterns), config))) return emitDefaultDefiniteFailure(target); results.push_back(target); diff --git a/mlir/lib/Dialect/Linalg/Transforms/BlockPackMatmul.cpp b/mlir/lib/Dialect/Linalg/Transforms/BlockPackMatmul.cpp index 91d4efa3372b7..57344f986480d 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/BlockPackMatmul.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/BlockPackMatmul.cpp @@ -301,7 +301,7 @@ struct LinalgBlockPackMatmul }; linalg::populateBlockPackMatmulPatterns(patterns, controlFn); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp index af38485291182..0e651f4cee4c3 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Detensorize.cpp @@ -563,8 +563,7 @@ struct LinalgDetensorize RewritePatternSet canonPatterns(context); tensor::FromElementsOp::getCanonicalizationPatterns(canonPatterns, context); - if (failed(applyPatternsAndFoldGreedily(getOperation(), - std::move(canonPatterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(canonPatterns)))) signalPassFailure(); // Get rid of the dummy entry block we created in the beginning to work diff --git a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp index bb50347596910..9b97865990bfd 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @@ -831,7 +831,7 @@ struct LinalgFoldUnitExtentDimsPass } linalg::populateFoldUnitExtentDimsPatterns(patterns, options); populateMoveInitOperandsToInputPattern(patterns); - (void)applyPatternsAndFoldGreedily(op, std::move(patterns)); + (void)applyPatternsGreedily(op, std::move(patterns)); } }; diff --git a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp index efc7934bc7d8a..3a57f368d4425 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @@ -2206,7 +2206,7 @@ struct LinalgElementwiseOpFusionPass // Use TopDownTraversal for compile time reasons GreedyRewriteConfig grc; grc.useTopDownTraversal = true; - (void)applyPatternsAndFoldGreedily(op, std::move(patterns), grc); + (void)applyPatternsGreedily(op, std::move(patterns), grc); } }; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp index 7ab3fef5dd039..78cee47c497ed 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Generalization.cpp @@ -89,7 +89,7 @@ struct LinalgGeneralizeNamedOpsPass void LinalgGeneralizeNamedOpsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); populateLinalgNamedOpsGeneralizationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } void mlir::linalg::populateLinalgNamedOpsGeneralizationPatterns( diff --git a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp index 2a1445fb92fdc..1f3336d2bfbb9 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/InlineScalarOperands.cpp @@ -113,7 +113,7 @@ struct LinalgInlineScalarOperandsPass MLIRContext &ctx = getContext(); RewritePatternSet patterns(&ctx); populateInlineConstantOperandsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(op, std::move(patterns)); + (void)applyPatternsGreedily(op, std::move(patterns)); } }; } // namespace diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp index 20a99491b6644..984f3f5a34ab1 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -321,7 +321,7 @@ static void lowerLinalgToLoopsImpl(Operation *enclosingOp) { affine::AffineApplyOp::getCanonicalizationPatterns(patterns, context); patterns.add(context); // Just apply the patterns greedily. - (void)applyPatternsAndFoldGreedily(enclosingOp, std::move(patterns)); + (void)applyPatternsGreedily(enclosingOp, std::move(patterns)); } struct LowerToAffineLoops diff --git a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp index 84bde1bc0b846..bb1e974391878 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/NamedOpConversions.cpp @@ -152,7 +152,7 @@ struct LinalgNamedOpConversionPass Operation *op = getOperation(); RewritePatternSet patterns(op->getContext()); populateLinalgNamedOpConversionPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp index 748e2a1377930..512fb7555a6b7 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Specialize.cpp @@ -349,7 +349,7 @@ void LinalgSpecializeGenericOpsPass::runOnOperation() { populateLinalgGenericOpsSpecializationPatterns(patterns); populateDecomposeProjectedPermutationPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) signalPassFailure(); } diff --git a/mlir/lib/Dialect/Math/Transforms/UpliftToFMA.cpp b/mlir/lib/Dialect/Math/Transforms/UpliftToFMA.cpp index 6b0d0f5e7466f..de950bac819c7 100644 --- a/mlir/lib/Dialect/Math/Transforms/UpliftToFMA.cpp +++ b/mlir/lib/Dialect/Math/Transforms/UpliftToFMA.cpp @@ -66,8 +66,7 @@ struct MathUpliftToFMA final void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateUpliftToFMAPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp b/mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp index 92592d2345d75..aa008f8407b5d 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp @@ -1223,7 +1223,7 @@ struct ExpandStridedMetadataPass final void ExpandStridedMetadataPass::runOnOperation() { RewritePatternSet patterns(&getContext()); memref::populateExpandStridedMetadataPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } std::unique_ptr memref::createExpandStridedMetadataPass() { diff --git a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp index 96daf4c5972a4..8e927a60087fc 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp @@ -857,7 +857,7 @@ struct FoldMemRefAliasOpsPass final void FoldMemRefAliasOpsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); memref::populateFoldMemRefAliasOpPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } std::unique_ptr memref::createFoldMemRefAliasOpsPass() { diff --git a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp index 792e722918306..dfcbaeb15ae5f 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/ResolveShapedTypeResultDims.cpp @@ -195,7 +195,7 @@ void memref::populateResolveShapedTypeResultDimsPatterns( void ResolveRankedShapeTypeResultDimsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); memref::populateResolveRankedShapedTypeResultDimsPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } @@ -203,7 +203,7 @@ void ResolveShapedTypeResultDimsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); memref::populateResolveRankedShapedTypeResultDimsPatterns(patterns); memref::populateResolveShapedTypeResultDimsPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp index 9f8189ae15e6d..3e93dc80b18ec 100644 --- a/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/ForToWhile.cpp @@ -112,7 +112,7 @@ struct ForToWhileLoop : public impl::SCFForToWhileLoopBase { MLIRContext *ctx = parentOp->getContext(); RewritePatternSet patterns(ctx); patterns.add(ctx); - (void)applyPatternsAndFoldGreedily(parentOp, std::move(patterns)); + (void)applyPatternsGreedily(parentOp, std::move(patterns)); } }; } // namespace diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp index c6d024c462e83..4ebd90dbcc1d5 100644 --- a/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/LoopCanonicalization.cpp @@ -167,7 +167,7 @@ struct SCFForLoopCanonicalization MLIRContext *ctx = parentOp->getContext(); RewritePatternSet patterns(ctx); scf::populateSCFForLoopCanonicalizationPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(parentOp, std::move(patterns)))) + if (failed(applyPatternsGreedily(parentOp, std::move(patterns)))) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp index 5104ad4b3a303..b71ec985fa6a1 100644 --- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp @@ -331,7 +331,7 @@ struct ForLoopPeeling : public impl::SCFForLoopPeelingBase { MLIRContext *ctx = parentOp->getContext(); RewritePatternSet patterns(ctx); patterns.add(ctx, peelFront, skipPartial); - (void)applyPatternsAndFoldGreedily(parentOp, std::move(patterns)); + (void)applyPatternsGreedily(parentOp, std::move(patterns)); // Drop the markers. parentOp->walk([](Operation *op) { diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp index ef5d4370e7810..90db42d479a19 100644 --- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp @@ -1430,7 +1430,7 @@ SliceTrackingListener::insertAndApplyPatterns(ArrayRef ops) { GreedyRewriteConfig config; config.listener = this; config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps; - return applyOpPatternsAndFold(ops, patterns.value(), config); + return applyOpPatternsGreedily(ops, patterns.value(), config); } void SliceTrackingListener::notifyOperationInserted( diff --git a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp index 374c205897c8a..cc59c2116ed37 100644 --- a/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/CanonicalizeGLPass.cpp @@ -29,8 +29,7 @@ class CanonicalizeGLPass final void runOnOperation() override { RewritePatternSet patterns(&getContext()); spirv::populateSPIRVGLCanonicalizationPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp index 877ac87fb0fe5..29f7e8afe0773 100644 --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp @@ -1354,7 +1354,7 @@ LogicalResult mlir::spirv::unrollVectorsInSignatures(Operation *op) { // looking for newly created func ops. GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingOps; - return applyPatternsAndFoldGreedily(op, std::move(patterns), config); + return applyPatternsGreedily(op, std::move(patterns), config); } LogicalResult mlir::spirv::unrollVectorsInFuncBodies(Operation *op) { @@ -1366,7 +1366,7 @@ LogicalResult mlir::spirv::unrollVectorsInFuncBodies(Operation *op) { auto options = vector::UnrollVectorOptions().setNativeShapeFn( [](auto op) { return mlir::spirv::getNativeVectorShape(op); }); populateVectorUnrollPatterns(patterns, options); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return failure(); } @@ -1378,7 +1378,7 @@ LogicalResult mlir::spirv::unrollVectorsInFuncBodies(Operation *op) { vector::VectorTransposeLowering::EltWise); vector::populateVectorTransposeLoweringPatterns(patterns, options); vector::populateVectorShapeCastLoweringPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return failure(); } @@ -1403,7 +1403,7 @@ LogicalResult mlir::spirv::unrollVectorsInFuncBodies(Operation *op) { vector::BroadcastOp::getCanonicalizationPatterns(patterns, context); vector::ShapeCastOp::getCanonicalizationPatterns(patterns, context); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) return failure(); } return success(); diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp index d75c8552c9ad0..af1cf2a1373e3 100644 --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp @@ -236,8 +236,7 @@ struct WebGPUPreparePass final populateSPIRVExpandExtendedMultiplicationPatterns(patterns); populateSPIRVExpandNonFiniteArithmeticPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp index 655555f883544..e56742d52e131 100644 --- a/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp +++ b/mlir/lib/Dialect/Shape/Transforms/OutlineShapeComputation.cpp @@ -207,7 +207,7 @@ void OutlineShapeComputationPass::runOnOperation() { MLIRContext *context = funcOp.getContext(); RewritePatternSet prevPatterns(context); prevPatterns.insert(context); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(prevPatterns)))) + if (failed(applyPatternsGreedily(funcOp, std::move(prevPatterns)))) return signalPassFailure(); // initialize class member `onlyUsedByWithShapes` @@ -254,7 +254,7 @@ void OutlineShapeComputationPass::runOnOperation() { } // Apply patterns, note this also performs DCE. - if (failed(applyPatternsAndFoldGreedily(funcOp, {}))) + if (failed(applyPatternsGreedily(funcOp, {}))) return signalPassFailure(); }); } diff --git a/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp b/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp index e1cccd8fd5d65..d2b245f832e57 100644 --- a/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp +++ b/mlir/lib/Dialect/Shape/Transforms/RemoveShapeConstraints.cpp @@ -55,7 +55,7 @@ class RemoveShapeConstraintsPass RewritePatternSet patterns(&ctx); populateRemoveShapeConstraintsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp index 8004bdb904b8a..1cac949b68c79 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorPasses.cpp @@ -57,7 +57,7 @@ struct SparseAssembler : public impl::SparseAssemblerBase { auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populateSparseAssembler(patterns, directOut); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -73,7 +73,7 @@ struct SparseReinterpretMap auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populateSparseReinterpretMap(patterns, scope); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -87,7 +87,7 @@ struct PreSparsificationRewritePass auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populatePreSparsificationRewriting(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -110,7 +110,7 @@ struct SparsificationPass RewritePatternSet patterns(ctx); populateSparsificationPatterns(patterns, options); scf::ForOp::getCanonicalizationPatterns(patterns, ctx); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -122,7 +122,7 @@ struct StageSparseOperationsPass auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populateStageSparseOperationsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -141,7 +141,7 @@ struct LowerSparseOpsToForeachPass RewritePatternSet patterns(ctx); populateLowerSparseOpsToForeachPatterns(patterns, enableRuntimeLibrary, enableConvert); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -154,7 +154,7 @@ struct LowerForeachToSCFPass auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populateLowerForeachToSCFPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -329,7 +329,7 @@ struct SparseBufferRewritePass auto *ctx = &getContext(); RewritePatternSet patterns(ctx); populateSparseBufferRewriting(patterns, enableBufferInitialization); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -351,7 +351,7 @@ struct SparseVectorizationPass populateSparseVectorizationPatterns( patterns, vectorLength, enableVLAVectorization, enableSIMDIndex32); vector::populateVectorToVectorCanonicalizationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -371,7 +371,7 @@ struct SparseGPUCodegenPass populateSparseGPULibgenPatterns(patterns, enableRuntimeLibrary); else populateSparseGPUCodegenPatterns(patterns, numThreads); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp b/mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp index 0f5fa61879b71..998b0fb6eb4b7 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/FoldTensorSubsetOps.cpp @@ -277,7 +277,7 @@ struct FoldTensorSubsetOpsPass final void FoldTensorSubsetOpsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); tensor::populateFoldTensorSubsetOpPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } std::unique_ptr tensor::createFoldTensorSubsetOpsPass() { diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp index e1400f0c907b2..9299db7e51a01 100644 --- a/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp +++ b/mlir/lib/Dialect/Tosa/Transforms/TosaLayerwiseConstantFoldPass.cpp @@ -60,7 +60,7 @@ struct TosaLayerwiseConstantFoldPass aggressiveReduceConstant); populateTosaOpsCanonicalizationPatterns(ctx, patterns); - if (applyPatternsAndFoldGreedily(func, std::move(patterns)).failed()) + if (applyPatternsGreedily(func, std::move(patterns)).failed()) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp index 9c6ee4c62eee5..2a990eed3f681 100644 --- a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp +++ b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp @@ -246,7 +246,7 @@ struct TosaMakeBroadcastable patterns.add>(ctx); patterns.add>(ctx); patterns.add>(ctx); - (void)applyPatternsAndFoldGreedily(func, std::move(patterns)); + (void)applyPatternsGreedily(func, std::move(patterns)); } }; } // namespace diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp index cef903a39e45b..603185e48aa94 100644 --- a/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp +++ b/mlir/lib/Dialect/Tosa/Transforms/TosaOptionalDecompositions.cpp @@ -42,7 +42,7 @@ struct TosaOptionalDecompositions mlir::tosa::populateTosaDecomposeTransposeConv(ctx, patterns); mlir::tosa::populateTosaDecomposeDepthwise(ctx, patterns); - if (applyPatternsAndFoldGreedily(func, std::move(patterns)).failed()) + if (applyPatternsGreedily(func, std::move(patterns)).failed()) signalPassFailure(); } }; diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp index 1f0f183e29f9a..106a794735090 100644 --- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp @@ -417,7 +417,7 @@ DiagnosedSilenceableFailure transform::ApplyPatternsOp::applyToOne( if (target->hasTrait()) { // Op is isolated from above. Apply patterns and also perform region // simplification. - result = applyPatternsAndFoldGreedily(target, frozenPatterns, config); + result = applyPatternsGreedily(target, frozenPatterns, config); } else { // Manually gather list of ops because the other // GreedyPatternRewriteDriver overloads only accepts ops that are isolated @@ -429,7 +429,7 @@ DiagnosedSilenceableFailure transform::ApplyPatternsOp::applyToOne( if (target != nestedOp) ops.push_back(nestedOp); }); - result = applyOpPatternsAndFold(ops, frozenPatterns, config); + result = applyOpPatternsGreedily(ops, frozenPatterns, config); } // A failure typically indicates that the pattern application did not diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorMask.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorMask.cpp index bfc05c71f5340..1f6cac2aa6f96 100644 --- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorMask.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorMask.cpp @@ -286,7 +286,7 @@ struct LowerVectorMaskPass populateVectorMaskLoweringPatternsForSideEffectingOps(loweringPatterns); MaskOp::getCanonicalizationPatterns(loweringPatterns, context); - if (failed(applyPatternsAndFoldGreedily(op, std::move(loweringPatterns)))) + if (failed(applyPatternsGreedily(op, std::move(loweringPatterns)))) signalPassFailure(); } diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp index 72bf329daaa76..0cafc9cd35517 100644 --- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp @@ -486,7 +486,7 @@ struct LowerVectorMultiReductionPass populateVectorMultiReductionLoweringPatterns(loweringPatterns, this->loweringStrategy); - if (failed(applyPatternsAndFoldGreedily(op, std::move(loweringPatterns)))) + if (failed(applyPatternsGreedily(op, std::move(loweringPatterns)))) signalPassFailure(); } diff --git a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUFoldAliasOps.cpp b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUFoldAliasOps.cpp index 9307e8eb784b5..e3082c55427fe 100644 --- a/mlir/lib/Dialect/XeGPU/Transforms/XeGPUFoldAliasOps.cpp +++ b/mlir/lib/Dialect/XeGPU/Transforms/XeGPUFoldAliasOps.cpp @@ -78,5 +78,5 @@ struct XeGPUFoldAliasOpsPass final void XeGPUFoldAliasOpsPass::runOnOperation() { RewritePatternSet patterns(&getContext()); xegpu::populateXeGPUFoldAliasOpsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } diff --git a/mlir/lib/Reducer/ReductionTreePass.cpp b/mlir/lib/Reducer/ReductionTreePass.cpp index b00045a3a41b7..2d2744bfc2732 100644 --- a/mlir/lib/Reducer/ReductionTreePass.cpp +++ b/mlir/lib/Reducer/ReductionTreePass.cpp @@ -65,7 +65,7 @@ static void applyPatterns(Region ®ion, // because we don't have expectation this reduction will be success or not. GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingOps; - (void)applyOpPatternsAndFold(op, patterns, config); + (void)applyOpPatternsGreedily(op, patterns, config); } if (eraseOpNotInRange) diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp index d50019bd6aee5..5f46960507036 100644 --- a/mlir/lib/Transforms/Canonicalizer.cpp +++ b/mlir/lib/Transforms/Canonicalizer.cpp @@ -60,7 +60,7 @@ struct Canonicalizer : public impl::CanonicalizerBase { } void runOnOperation() override { LogicalResult converged = - applyPatternsAndFoldGreedily(getOperation(), *patterns, config); + applyPatternsGreedily(getOperation(), *patterns, config); // Canonicalization is best-effort. Non-convergence is not a pass failure. if (testConvergence && failed(converged)) signalPassFailure(); diff --git a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp index e0d0acd122e26..99f3569b767b1 100644 --- a/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp +++ b/mlir/lib/Transforms/Utils/GreedyPatternRewriteDriver.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// // -// This file implements mlir::applyPatternsAndFoldGreedily. +// This file implements mlir::applyPatternsGreedily. // //===----------------------------------------------------------------------===// @@ -488,7 +488,7 @@ bool GreedyPatternRewriteDriver::processWorklist() { // infinite folding loop, as every constant op would be folded to an // Attribute and then immediately be rematerialized as a constant op, which // is then put on the worklist. - if (!op->hasTrait()) { + if (config.fold && !op->hasTrait()) { SmallVector foldResults; if (succeeded(op->fold(foldResults))) { LLVM_DEBUG(logResultWithLine("success", "operation was folded")); @@ -852,13 +852,13 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && { if (!config.useTopDownTraversal) { // Add operations to the worklist in postorder. region.walk([&](Operation *op) { - if (!insertKnownConstant(op)) + if (!config.cseConstants || !insertKnownConstant(op)) addToWorklist(op); }); } else { // Add all nested operations to the worklist in preorder. region.walk([&](Operation *op) { - if (!insertKnownConstant(op)) { + if (!config.cseConstants || !insertKnownConstant(op)) { addToWorklist(op); return WalkResult::advance(); } @@ -894,9 +894,9 @@ LogicalResult RegionPatternRewriteDriver::simplify(bool *changed) && { } LogicalResult -mlir::applyPatternsAndFoldGreedily(Region ®ion, - const FrozenRewritePatternSet &patterns, - GreedyRewriteConfig config, bool *changed) { +mlir::applyPatternsGreedily(Region ®ion, + const FrozenRewritePatternSet &patterns, + GreedyRewriteConfig config, bool *changed) { // The top-level operation must be known to be isolated from above to // prevent performing canonicalizations on operations defined at or above // the region containing 'op'. @@ -1012,7 +1012,7 @@ static Region *findCommonAncestor(ArrayRef ops) { return region; } -LogicalResult mlir::applyOpPatternsAndFold( +LogicalResult mlir::applyOpPatternsGreedily( ArrayRef ops, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config, bool *changed, bool *allErased) { if (ops.empty()) { diff --git a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp index c208716891ef1..6474c59595eb4 100644 --- a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp +++ b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp @@ -296,7 +296,7 @@ OneToNConversionPattern::matchAndRewrite(Operation *op, namespace mlir { // This function applies the provided patterns using -// `applyPatternsAndFoldGreedily` and then replaces all newly inserted +// `applyPatternsGreedily` and then replaces all newly inserted // `UnrealizedConversionCastOps` that haven't folded away. ("Backward" casts // from target to source types inserted by a `OneToNConversionPattern` normally // fold away with the "forward" casts from source to target types inserted by @@ -317,7 +317,7 @@ applyPartialOneToNConversion(Operation *op, TypeConverter &typeConverter, #endif // NDEBUG // Apply provided conversion patterns. - if (failed(applyPatternsAndFoldGreedily(op, patterns))) { + if (failed(applyPatternsGreedily(op, patterns))) { emitError(op->getLoc()) << "failed to apply conversion patterns"; return failure(); } diff --git a/mlir/test/Transforms/test-operation-folder.mlir b/mlir/test/Transforms/test-operation-folder.mlir index 3c0cd15dc6c51..86ed6c25a227a 100644 --- a/mlir/test/Transforms/test-operation-folder.mlir +++ b/mlir/test/Transforms/test-operation-folder.mlir @@ -1,5 +1,7 @@ // RUN: mlir-opt -test-greedy-patterns='top-down=false' %s | FileCheck %s // RUN: mlir-opt -test-greedy-patterns='top-down=true' %s | FileCheck %s +// RUN: mlir-opt -test-greedy-patterns='cse-constants=false' %s | FileCheck %s --check-prefix=NOCSE +// RUN: mlir-opt -test-greedy-patterns='fold=false' %s | FileCheck %s --check-prefix=NOFOLD func.func @foo() -> i32 { %c42 = arith.constant 42 : i32 @@ -25,7 +27,8 @@ func.func @test_fold_before_previously_folded_op() -> (i32, i32) { } func.func @test_dont_reorder_constants() -> (i32, i32, i32) { - // Test that we don't reorder existing constants during folding if it isn't necessary. + // Test that we don't reorder existing constants during folding if it isn't + // necessary. // CHECK: %[[CST:.+]] = arith.constant 1 // CHECK-NEXT: %[[CST:.+]] = arith.constant 2 // CHECK-NEXT: %[[CST:.+]] = arith.constant 3 @@ -34,3 +37,46 @@ func.func @test_dont_reorder_constants() -> (i32, i32, i32) { %2 = arith.constant 3 : i32 return %0, %1, %2 : i32, i32, i32 } + +// CHECK-LABEL: test_fold_nofold_nocse +// NOCSE-LABEL: test_fold_nofold_nocse +// NOFOLD-LABEL: test_fold_nofold_nocse +func.func @test_fold_nofold_nocse() -> (i32, i32, i32, i32, i32, i32) { + // Test either not folding or deduping constants. + + // Testing folding. There should be only 4 constants here. + // CHECK-NOT: arith.constant + // CHECK-DAG: %[[CST:.+]] = arith.constant 0 + // CHECK-DAG: %[[CST:.+]] = arith.constant 1 + // CHECK-DAG: %[[CST:.+]] = arith.constant 2 + // CHECK-DAG: %[[CST:.+]] = arith.constant 3 + // CHECK-NOT: arith.constant + // CHECK-NEXT: return + + // Testing not-CSE'ing. In this case we have the 3 original constants and 3 + // produced by folding. + // NOCSE-DAG: arith.constant 0 : i32 + // NOCSE-DAG: arith.constant 1 : i32 + // NOCSE-DAG: arith.constant 2 : i32 + // NOCSE-DAG: arith.constant 1 : i32 + // NOCSE-DAG: arith.constant 2 : i32 + // NOCSE-DAG: arith.constant 3 : i32 + // NOCSE-NEXT: return + + // Testing not folding. In this case we just have the original constants. + // NOFOLD-DAG: %[[CST:.+]] = arith.constant 0 + // NOFOLD-DAG: %[[CST:.+]] = arith.constant 1 + // NOFOLD-DAG: %[[CST:.+]] = arith.constant 2 + // NOFOLD: arith.addi + // NOFOLD: arith.addi + // NOFOLD: arith.addi + + %c0 = arith.constant 0 : i32 + %c1 = arith.constant 1 : i32 + %c2 = arith.constant 2 : i32 + %0 = arith.addi %c0, %c1 : i32 + %1 = arith.addi %0, %c1 : i32 + %2 = arith.addi %c2, %c1 : i32 + return %0, %1, %2, %c0, %c1, %c2 : i32, i32, i32, i32, i32, i32 +} + diff --git a/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp b/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp index e17fe12b9088b..1e45ab57ebcc7 100644 --- a/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp +++ b/mlir/test/lib/Conversion/MathToVCIX/TestMathToVCIXConversion.cpp @@ -248,7 +248,7 @@ struct TestMathToVCIX RewritePatternSet patterns(ctx); patterns.add( ctx); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/test/lib/Conversion/VectorToSPIRV/TestVectorReductionToSPIRVDotProd.cpp b/mlir/test/lib/Conversion/VectorToSPIRV/TestVectorReductionToSPIRVDotProd.cpp index 1864d2f7f5036..d49b4e391a68f 100644 --- a/mlir/test/lib/Conversion/VectorToSPIRV/TestVectorReductionToSPIRVDotProd.cpp +++ b/mlir/test/lib/Conversion/VectorToSPIRV/TestVectorReductionToSPIRVDotProd.cpp @@ -41,7 +41,7 @@ struct TestVectorReductionToSPIRVDotProd void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorReductionToSPIRVDotProductPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp index b418a457473a8..404f34ebee17a 100644 --- a/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp +++ b/mlir/test/lib/Dialect/Affine/TestAffineDataCopy.cpp @@ -136,7 +136,7 @@ void TestAffineDataCopy::runOnOperation() { } GreedyRewriteConfig config; config.strictMode = GreedyRewriteStrictness::ExistingAndNewOps; - (void)applyOpPatternsAndFold(copyOps, std::move(patterns), config); + (void)applyOpPatternsGreedily(copyOps, std::move(patterns), config); } namespace mlir { diff --git a/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp b/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp index f6bfd9f858284..03c80b601a347 100644 --- a/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp +++ b/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp @@ -47,7 +47,7 @@ void TestLowerToArmNeon::runOnOperation() { MLIRContext *context = &getContext(); RewritePatternSet patterns(context); populateLowerContractionToSMMLAPatternPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } diff --git a/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp b/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp index 74d057c0b7b6c..a49d304baf5c6 100644 --- a/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp +++ b/mlir/test/lib/Dialect/GPU/TestGpuRewrite.cpp @@ -38,7 +38,7 @@ struct TestGpuRewritePass void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateGpuRewritePatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -85,7 +85,7 @@ struct TestGpuSubgroupReduceLoweringPass patterns, /*subgroupSize=*/32, /*shuffleBitwidth=*/32); } - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; } // namespace diff --git a/mlir/test/lib/Dialect/Linalg/TestDataLayoutPropagation.cpp b/mlir/test/lib/Dialect/Linalg/TestDataLayoutPropagation.cpp index 4cf2460150d14..d0700f9a4f1a4 100644 --- a/mlir/test/lib/Dialect/Linalg/TestDataLayoutPropagation.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestDataLayoutPropagation.cpp @@ -34,8 +34,7 @@ struct TestDataLayoutPropagationPass RewritePatternSet patterns(context); linalg::populateDataLayoutPropagationPatterns( patterns, [](OpOperand *opOperand) { return true; }); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgDecomposeOps.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgDecomposeOps.cpp index 311244aeffb90..0143a27bfe843 100644 --- a/mlir/test/lib/Dialect/Linalg/TestLinalgDecomposeOps.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgDecomposeOps.cpp @@ -43,8 +43,8 @@ struct TestLinalgDecomposeOps RewritePatternSet decompositionPatterns(context); linalg::populateDecomposeLinalgOpsPattern(decompositionPatterns, removeDeadArgsAndResults); - if (failed(applyPatternsAndFoldGreedily( - getOperation(), std::move(decompositionPatterns)))) { + if (failed(applyPatternsGreedily(getOperation(), + std::move(decompositionPatterns)))) { return signalPassFailure(); } } diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgElementwiseFusion.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgElementwiseFusion.cpp index 7f68f4aec3a10..e4883e47f2063 100644 --- a/mlir/test/lib/Dialect/Linalg/TestLinalgElementwiseFusion.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgElementwiseFusion.cpp @@ -155,8 +155,8 @@ struct TestLinalgElementwiseFusion RewritePatternSet fusionPatterns(context); auto controlFn = [](OpOperand *operand) { return true; }; linalg::populateElementwiseOpsFusionPatterns(fusionPatterns, controlFn); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(fusionPatterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), + std::move(fusionPatterns)))) return signalPassFailure(); return; } @@ -166,8 +166,8 @@ struct TestLinalgElementwiseFusion linalg::populateElementwiseOpsFusionPatterns(fusionPatterns, setFusedOpOperandLimit<4>); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(fusionPatterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), + std::move(fusionPatterns)))) return signalPassFailure(); return; } @@ -176,8 +176,8 @@ struct TestLinalgElementwiseFusion RewritePatternSet fusionPatterns(context); linalg::populateFoldReshapeOpsByExpansionPatterns( fusionPatterns, [](OpOperand * /*fusedOperand*/) { return true; }); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(fusionPatterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), + std::move(fusionPatterns)))) return signalPassFailure(); return; } @@ -212,8 +212,8 @@ struct TestLinalgElementwiseFusion linalg::populateFoldReshapeOpsByExpansionPatterns(fusionPatterns, controlReshapeFusionFn); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(fusionPatterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), + std::move(fusionPatterns)))) return signalPassFailure(); return; } @@ -222,8 +222,7 @@ struct TestLinalgElementwiseFusion RewritePatternSet patterns(context); linalg::populateFoldReshapeOpsByCollapsingPatterns( patterns, [](OpOperand * /*fusedOperand */) { return true; }); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(patterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns)))) return signalPassFailure(); return; } @@ -239,8 +238,7 @@ struct TestLinalgElementwiseFusion return true; }; linalg::populateFoldReshapeOpsByCollapsingPatterns(patterns, controlFn); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(patterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns)))) return signalPassFailure(); return; } @@ -248,8 +246,7 @@ struct TestLinalgElementwiseFusion if (fuseMultiUseProducer) { RewritePatternSet patterns(context); patterns.insert(context); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(patterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns)))) return signalPassFailure(); return; } @@ -265,8 +262,7 @@ struct TestLinalgElementwiseFusion }; RewritePatternSet patterns(context); linalg::populateCollapseDimensions(patterns, collapseFn); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(patterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns)))) return signalPassFailure(); return; } diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp index 2d8ee2f9bb6e3..81e7eedabd5d1 100644 --- a/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgFusionTransforms.cpp @@ -84,7 +84,7 @@ struct TestLinalgGreedyFusion pm.addPass(createCanonicalizerPass()); pm.addPass(createCSEPass()); do { - (void)applyPatternsAndFoldGreedily(getOperation(), frozenPatterns); + (void)applyPatternsGreedily(getOperation(), frozenPatterns); if (failed(runPipeline(pm, getOperation()))) this->signalPassFailure(); } while (succeeded(fuseLinalgOpsGreedily(getOperation()))); diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp index 8b455d7d68c30..750ba6b5d9872 100644 --- a/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgRankReduceContractionOps.cpp @@ -49,8 +49,7 @@ struct TestLinalgRankReduceContractionOps RewritePatternSet patterns(context); linalg::populateContractionOpRankReducingPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(funcOp.getBody(), - std::move(patterns)))) + if (failed(applyPatternsGreedily(funcOp.getBody(), std::move(patterns)))) return signalPassFailure(); return; } diff --git a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp index 25aec75c3c14a..fa2a27dcfa991 100644 --- a/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestLinalgTransforms.cpp @@ -147,14 +147,14 @@ static void applyPatterns(func::FuncOp funcOp) { //===--------------------------------------------------------------------===// patterns.add(ctx); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyVectorTransferForwardingPatterns(func::FuncOp funcOp) { RewritePatternSet forwardPattern(funcOp.getContext()); forwardPattern.add(funcOp.getContext()); forwardPattern.add(funcOp.getContext()); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(forwardPattern)); + (void)applyPatternsGreedily(funcOp, std::move(forwardPattern)); } static void applyLinalgToVectorPatterns(func::FuncOp funcOp) { @@ -163,68 +163,68 @@ static void applyLinalgToVectorPatterns(func::FuncOp funcOp) { patterns.add(ctx); populatePadOpVectorizationPatterns(patterns); populateConvolutionVectorizationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyDecomposePadPatterns(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); patterns.add(funcOp.getContext()); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyDecomposeTensorPackPatterns(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); patterns.add(funcOp.getContext()); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyDecomposeTensorUnPackPatterns(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); patterns.add(funcOp.getContext()); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyExtractSliceOfPadTensorSwapPattern(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); patterns.add(funcOp.getContext()); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyBubbleUpExtractSliceOpPattern(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateBubbleUpExtractSliceOpPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applySwapExtractSliceWithFillPattern(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateSwapExtractSliceWithFillPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyEraseUnusedOperandsAndResultsPatterns(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateEraseUnusedOperandsAndResultsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyEraseUnnecessaryInputs(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateEraseUnnecessaryInputsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyWinogradConv2D(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateWinogradConv2DPatterns(patterns, /*m=*/4, /*r=*/3); populateWinogradConv2DPatterns(patterns, /*m=*/2, /*r=*/5); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } static void applyDecomposeWinogradOps(func::FuncOp funcOp) { RewritePatternSet patterns(funcOp.getContext()); populateDecomposeWinogradOpsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(funcOp, std::move(patterns)); + (void)applyPatternsGreedily(funcOp, std::move(patterns)); } /// Apply transformations specified as patterns. diff --git a/mlir/test/lib/Dialect/Linalg/TestPadFusion.cpp b/mlir/test/lib/Dialect/Linalg/TestPadFusion.cpp index 073e0d8d4e143..b927767038a9e 100644 --- a/mlir/test/lib/Dialect/Linalg/TestPadFusion.cpp +++ b/mlir/test/lib/Dialect/Linalg/TestPadFusion.cpp @@ -36,8 +36,7 @@ struct TestPadFusionPass MLIRContext *context = &getContext(); RewritePatternSet patterns(context); linalg::populateFuseTensorPadWithProducerLinalgOpPatterns(patterns); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } }; diff --git a/mlir/test/lib/Dialect/Math/TestAlgebraicSimplification.cpp b/mlir/test/lib/Dialect/Math/TestAlgebraicSimplification.cpp index 084a592215241..42491d4c716c9 100644 --- a/mlir/test/lib/Dialect/Math/TestAlgebraicSimplification.cpp +++ b/mlir/test/lib/Dialect/Math/TestAlgebraicSimplification.cpp @@ -40,7 +40,7 @@ struct TestMathAlgebraicSimplificationPass void TestMathAlgebraicSimplificationPass::runOnOperation() { RewritePatternSet patterns(&getContext()); populateMathAlgebraicSimplificationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } namespace mlir { diff --git a/mlir/test/lib/Dialect/Math/TestExpandMath.cpp b/mlir/test/lib/Dialect/Math/TestExpandMath.cpp index 69af2a08b97bd..0139eabba373f 100644 --- a/mlir/test/lib/Dialect/Math/TestExpandMath.cpp +++ b/mlir/test/lib/Dialect/Math/TestExpandMath.cpp @@ -53,7 +53,7 @@ void TestExpandMathPass::runOnOperation() { populateExpandRoundFPattern(patterns); populateExpandRoundEvenPattern(patterns); populateExpandRsqrtPattern(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } namespace mlir { diff --git a/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp b/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp index 8a01ac509c30e..9fdd200e2b2c9 100644 --- a/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp +++ b/mlir/test/lib/Dialect/Math/TestPolynomialApproximation.cpp @@ -59,7 +59,7 @@ void TestMathPolynomialApproximationPass::runOnOperation() { MathPolynomialApproximationOptions approxOptions; approxOptions.enableAvx2 = enableAvx2; populateMathPolynomialApproximationPatterns(patterns, approxOptions); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } namespace mlir { diff --git a/mlir/test/lib/Dialect/MemRef/TestComposeSubView.cpp b/mlir/test/lib/Dialect/MemRef/TestComposeSubView.cpp index 02a9dbbe263f8..08d22ab59f94b 100644 --- a/mlir/test/lib/Dialect/MemRef/TestComposeSubView.cpp +++ b/mlir/test/lib/Dialect/MemRef/TestComposeSubView.cpp @@ -38,7 +38,7 @@ void TestComposeSubViewPass::getDependentDialects( void TestComposeSubViewPass::runOnOperation() { RewritePatternSet patterns(&getContext()); memref::populateComposeSubViewPatterns(patterns, &getContext()); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } } // namespace diff --git a/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp b/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp index 1f836be1ae7ac..dbae93b380f2b 100644 --- a/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp +++ b/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp @@ -26,9 +26,9 @@ struct TestAllSliceOpLoweringPass SymbolTableCollection symbolTableCollection; mesh::populateAllSliceOpLoweringPatterns(patterns, symbolTableCollection); LogicalResult status = - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + applyPatternsGreedily(getOperation(), std::move(patterns)); (void)status; - assert(succeeded(status) && "applyPatternsAndFoldGreedily failed."); + assert(succeeded(status) && "applyPatternsGreedily failed."); } void getDependentDialects(DialectRegistry ®istry) const override { mesh::registerAllSliceOpLoweringDialects(registry); @@ -51,9 +51,9 @@ struct TestMultiIndexOpLoweringPass mesh::populateProcessMultiIndexOpLoweringPatterns(patterns, symbolTableCollection); LogicalResult status = - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + applyPatternsGreedily(getOperation(), std::move(patterns)); (void)status; - assert(succeeded(status) && "applyPatternsAndFoldGreedily failed."); + assert(succeeded(status) && "applyPatternsGreedily failed."); } void getDependentDialects(DialectRegistry ®istry) const override { mesh::registerProcessMultiIndexOpLoweringDialects(registry); diff --git a/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp b/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp index 98992c4cc11f9..102e64de4bd1f 100644 --- a/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp +++ b/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp @@ -97,8 +97,8 @@ struct TestMeshReshardingPass void runOnOperation() override { RewritePatternSet patterns(&getContext()); patterns.insert(&getContext()); - if (failed(applyPatternsAndFoldGreedily(getOperation().getOperation(), - std::move(patterns)))) { + if (failed(applyPatternsGreedily(getOperation().getOperation(), + std::move(patterns)))) { return signalPassFailure(); } } diff --git a/mlir/test/lib/Dialect/Mesh/TestSimplifications.cpp b/mlir/test/lib/Dialect/Mesh/TestSimplifications.cpp index 512b16af64c94..01e196d29f7a5 100644 --- a/mlir/test/lib/Dialect/Mesh/TestSimplifications.cpp +++ b/mlir/test/lib/Dialect/Mesh/TestSimplifications.cpp @@ -34,7 +34,7 @@ void TestMeshSimplificationsPass::runOnOperation() { SymbolTableCollection symbolTableCollection; mesh::populateSimplificationPatterns(patterns, symbolTableCollection); [[maybe_unused]] LogicalResult status = - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + applyPatternsGreedily(getOperation(), std::move(patterns)); assert(succeeded(status) && "Rewrite patters application did not converge."); } diff --git a/mlir/test/lib/Dialect/NVGPU/TestNVGPUTransforms.cpp b/mlir/test/lib/Dialect/NVGPU/TestNVGPUTransforms.cpp index 8ca29257b8120..0099dc8caf427 100644 --- a/mlir/test/lib/Dialect/NVGPU/TestNVGPUTransforms.cpp +++ b/mlir/test/lib/Dialect/NVGPU/TestNVGPUTransforms.cpp @@ -60,7 +60,7 @@ struct TestMmaSyncF32ToTF32Patterns RewritePatternSet patterns(&getContext()); populateMmaSyncF32ToTF32Patterns(patterns, tf32Precision); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp index a3be1f94fa28a..b4f3fa30f8ab5 100644 --- a/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp +++ b/mlir/test/lib/Dialect/SCF/TestSCFUtils.cpp @@ -226,7 +226,7 @@ struct TestSCFPipeliningPass options.peelEpilogue = false; } scf::populateSCFLoopPipeliningPatterns(patterns, options); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); getOperation().walk([](Operation *op) { // Clean up the markers. op->removeAttr(kTestPipeliningStageMarker); diff --git a/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp b/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp index 7e51d67702b05..856cde19edd52 100644 --- a/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp +++ b/mlir/test/lib/Dialect/SCF/TestSCFWrapInZeroTripCheck.cpp @@ -59,7 +59,7 @@ struct TestWrapWhileLoopInZeroTripCheckPass } else { RewritePatternSet patterns(context); scf::populateSCFRotateWhileLoopPatterns(patterns); - (void)applyPatternsAndFoldGreedily(func, std::move(patterns)); + (void)applyPatternsGreedily(func, std::move(patterns)); } } diff --git a/mlir/test/lib/Dialect/SCF/TestUpliftWhileToFor.cpp b/mlir/test/lib/Dialect/SCF/TestUpliftWhileToFor.cpp index 468bc0ca78489..cf123fe280242 100644 --- a/mlir/test/lib/Dialect/SCF/TestUpliftWhileToFor.cpp +++ b/mlir/test/lib/Dialect/SCF/TestUpliftWhileToFor.cpp @@ -34,7 +34,7 @@ struct TestSCFUpliftWhileToFor MLIRContext *ctx = op->getContext(); RewritePatternSet patterns(ctx); scf::populateUpliftWhileToForPatterns(patterns); - if (failed(applyPatternsAndFoldGreedily(op, std::move(patterns)))) + if (failed(applyPatternsGreedily(op, std::move(patterns)))) signalPassFailure(); } }; diff --git a/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp b/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp index 34de600132f5d..173bfd8955f2b 100644 --- a/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp +++ b/mlir/test/lib/Dialect/Tensor/TestTensorTransforms.cpp @@ -104,19 +104,19 @@ struct TestTensorTransforms static void applyReassociativeReshapeFoldingPatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateReassociativeReshapeFoldingPatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applyBubbleUpExpandShapePatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateBubbleUpExpandShapePatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applyFoldIntoPackAndUnpackPatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateFoldIntoPackAndUnpackPatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applyFoldConstantExtractSlicePatterns(Operation *rootOp) { @@ -132,26 +132,26 @@ static void applyFoldConstantExtractSlicePatterns(Operation *rootOp) { }; tensor::populateFoldConstantExtractSlicePatterns(patterns, controlFn); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applyFoldConsecutiveInsertExtractSlicePatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateMergeConsecutiveInsertExtractSlicePatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applyDropRedundantInsertSliceRankExpansionPatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateDropRedundantInsertSliceRankExpansionPatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } static void applySimplifyPackUnpackPatterns(Operation *rootOp) { RewritePatternSet patterns(rootOp->getContext()); tensor::populateSimplifyPackAndUnpackPatterns(patterns); - (void)applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + (void)applyPatternsGreedily(rootOp, std::move(patterns)); } namespace { @@ -293,7 +293,7 @@ applyRewriteExtractFromCollapseShapePatterns(Operation *rootOp, else patterns.add( rootOp->getContext()); - return applyPatternsAndFoldGreedily(rootOp, std::move(patterns)); + return applyPatternsGreedily(rootOp, std::move(patterns)); } namespace { diff --git a/mlir/test/lib/Dialect/Test/TestPatterns.cpp b/mlir/test/lib/Dialect/Test/TestPatterns.cpp index 8a0bc597c56be..ce2820b80a945 100644 --- a/mlir/test/lib/Dialect/Test/TestPatterns.cpp +++ b/mlir/test/lib/Dialect/Test/TestPatterns.cpp @@ -388,8 +388,9 @@ struct TestGreedyPatternDriver GreedyRewriteConfig config; config.useTopDownTraversal = this->useTopDownTraversal; config.maxIterations = this->maxIterations; - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns), - config); + config.fold = this->fold; + config.cseConstants = this->cseConstants; + (void)applyPatternsGreedily(getOperation(), std::move(patterns), config); } Option useTopDownTraversal{ @@ -400,6 +401,11 @@ struct TestGreedyPatternDriver *this, "max-iterations", llvm::cl::desc("Max. iterations in the GreedyRewriteConfig"), llvm::cl::init(GreedyRewriteConfig().maxIterations)}; + Option fold{*this, "fold", llvm::cl::desc("Whether to fold"), + llvm::cl::init(GreedyRewriteConfig().fold)}; + Option cseConstants{*this, "cse-constants", + llvm::cl::desc("Whether to CSE constants"), + llvm::cl::init(GreedyRewriteConfig().cseConstants)}; }; struct DumpNotifications : public RewriterBase::Listener { @@ -511,8 +517,8 @@ struct TestStrictPatternDriver // operation will trigger the assertion while processing. bool changed = false; bool allErased = false; - (void)applyOpPatternsAndFold(ArrayRef(ops), std::move(patterns), config, - &changed, &allErased); + (void)applyOpPatternsGreedily(ArrayRef(ops), std::move(patterns), config, + &changed, &allErased); Builder b(ctx); getOperation()->setAttr("pattern_driver_changed", b.getBoolAttr(changed)); getOperation()->setAttr("pattern_driver_all_erased", @@ -2101,7 +2107,7 @@ struct TestSelectiveReplacementPatternDriver MLIRContext *context = &getContext(); mlir::RewritePatternSet patterns(context); patterns.add(context); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; } // namespace diff --git a/mlir/test/lib/Dialect/Test/TestTraits.cpp b/mlir/test/lib/Dialect/Test/TestTraits.cpp index 031e1062dac76..d8763f562cbef 100644 --- a/mlir/test/lib/Dialect/Test/TestTraits.cpp +++ b/mlir/test/lib/Dialect/Test/TestTraits.cpp @@ -38,8 +38,8 @@ struct TestTraitFolder StringRef getArgument() const final { return "test-trait-folder"; } StringRef getDescription() const final { return "Run trait folding"; } void runOnOperation() override { - (void)applyPatternsAndFoldGreedily(getOperation(), - RewritePatternSet(&getContext())); + (void)applyPatternsGreedily(getOperation(), + RewritePatternSet(&getContext())); } }; } // namespace diff --git a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp index e5a3e2b6fccaa..ac904c3e01c93 100644 --- a/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp +++ b/mlir/test/lib/Dialect/Tosa/TosaTestPasses.cpp @@ -197,7 +197,7 @@ void TosaTestQuantUtilAPI::runOnOperation() { patterns.add(ctx); patterns.add(ctx); - (void)applyPatternsAndFoldGreedily(func, std::move(patterns)); + (void)applyPatternsGreedily(func, std::move(patterns)); } } // namespace diff --git a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp index f67a24755ac09..74838bc0ca2fb 100644 --- a/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp +++ b/mlir/test/lib/Dialect/Vector/TestVectorTransforms.cpp @@ -73,7 +73,7 @@ struct TestVectorToVectorLowering populateVectorToVectorCanonicalizationPatterns(patterns); populateBubbleVectorBitCastOpPatterns(patterns); populateCastAwayVectorLeadingOneDimPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } private: @@ -137,7 +137,7 @@ struct TestVectorContractionPrepareForMMTLowering MLIRContext *ctx = &getContext(); RewritePatternSet patterns(ctx); vector::populateVectorContractCanonicalizeMatmulToMMT(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -223,7 +223,7 @@ struct TestVectorUnrollingPatterns })); } populateVectorToVectorCanonicalizationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } ListOption unrollOrder{*this, "unroll-order", @@ -283,7 +283,7 @@ struct TestVectorTransferUnrollingPatterns } populateVectorUnrollPatterns(patterns, opts); populateVectorToVectorCanonicalizationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } Option reverseUnrollOrder{ @@ -326,7 +326,7 @@ struct TestScalarVectorTransferLoweringPatterns RewritePatternSet patterns(ctx); vector::populateScalarVectorTransferLoweringPatterns( patterns, /*benefit=*/1, allowMultipleUses.getValue()); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -370,7 +370,7 @@ struct TestVectorTransferCollapseInnerMostContiguousDims void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorTransferCollapseInnerMostContiguousDimsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -395,7 +395,7 @@ struct TestVectorSinkPatterns void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateSinkVectorOpsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -415,7 +415,7 @@ struct TestVectorReduceToContractPatternsPatterns void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorReductionToContractPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -434,7 +434,7 @@ struct TestVectorChainedReductionFoldingPatterns void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateChainedVectorReductionFoldingPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -455,7 +455,7 @@ struct TestVectorBreakDownReductionPatterns RewritePatternSet patterns(&getContext()); populateBreakDownVectorReductionPatterns(patterns, /*maxNumElementsToExtract=*/2); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -496,7 +496,7 @@ struct TestFlattenVectorTransferPatterns void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateFlattenVectorTransferPatterns(patterns, targetVectorBitwidth); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -512,7 +512,7 @@ struct TestVectorScanLowering void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorScanLoweringPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -662,18 +662,18 @@ struct TestVectorDistribution /*readBenefit=*/0); vector::populateDistributeReduction(patterns, warpReduction, 1); populateDistributeTransferWriteOpPatterns(patterns, distributionFn, 2); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } else if (distributeTransferWriteOps) { RewritePatternSet patterns(ctx); populateDistributeTransferWriteOpPatterns(patterns, distributionFn, maxTransferWriteElements); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } else if (propagateDistribution) { RewritePatternSet patterns(ctx); vector::populatePropagateWarpVectorDistributionPatterns( patterns, distributionFn, shuffleFn); vector::populateDistributeReduction(patterns, warpReduction); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } WarpExecuteOnLane0LoweringOptions options; options.warpAllocationFn = allocateGlobalSharedMemory; @@ -684,7 +684,7 @@ struct TestVectorDistribution // Test on one pattern in isolation. if (warpOpToSCF) { populateWarpExecuteOnLane0OpToScfForPattern(patterns, options); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); return; } } @@ -706,7 +706,7 @@ struct TestVectorExtractStridedSliceLowering void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorExtractStridedSliceToExtractInsertChainPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -726,7 +726,7 @@ struct TestVectorBreakDownBitCast populateBreakDownVectorBitCastOpPatterns(patterns, [](BitCastOp op) { return op.getSourceVectorType().getShape().back() > 4; }); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -782,7 +782,7 @@ struct TestVectorGatherLowering void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorGatherLoweringPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -809,7 +809,7 @@ struct TestFoldArithExtensionIntoVectorContractPatterns void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateFoldArithExtensionPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; @@ -834,7 +834,7 @@ struct TestVectorEmulateMaskedLoadStore final void runOnOperation() override { RewritePatternSet patterns(&getContext()); populateVectorMaskedLoadStoreEmulationPatterns(patterns); - (void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)); + (void)applyPatternsGreedily(getOperation(), std::move(patterns)); } }; diff --git a/mlir/test/lib/Rewrite/TestPDLByteCode.cpp b/mlir/test/lib/Rewrite/TestPDLByteCode.cpp index 77aa30f847dcd..7b96bf5e28d32 100644 --- a/mlir/test/lib/Rewrite/TestPDLByteCode.cpp +++ b/mlir/test/lib/Rewrite/TestPDLByteCode.cpp @@ -161,8 +161,8 @@ struct TestPDLByteCodePass patternList.add(std::move(pdlPattern)); // Invoke the pattern driver with the provided patterns. - (void)applyPatternsAndFoldGreedily(irModule.getBodyRegion(), - std::move(patternList)); + (void)applyPatternsGreedily(irModule.getBodyRegion(), + std::move(patternList)); } }; } // namespace diff --git a/mlir/test/lib/Tools/PDLL/TestPDLL.cpp b/mlir/test/lib/Tools/PDLL/TestPDLL.cpp index db45d0eadf818..f6b2b2b1c683f 100644 --- a/mlir/test/lib/Tools/PDLL/TestPDLL.cpp +++ b/mlir/test/lib/Tools/PDLL/TestPDLL.cpp @@ -39,7 +39,7 @@ struct TestPDLLPass : public PassWrapper> { void runOnOperation() final { // Invoke the pattern driver with the provided patterns. - (void)applyPatternsAndFoldGreedily(getOperation(), patterns); + (void)applyPatternsGreedily(getOperation(), patterns); } FrozenRewritePatternSet patterns; diff --git a/mlir/test/lib/Transforms/TestCommutativityUtils.cpp b/mlir/test/lib/Transforms/TestCommutativityUtils.cpp index 2ec0334ae0d05..5ea35759bb729 100644 --- a/mlir/test/lib/Transforms/TestCommutativityUtils.cpp +++ b/mlir/test/lib/Transforms/TestCommutativityUtils.cpp @@ -36,7 +36,7 @@ struct CommutativityUtils RewritePatternSet patterns(context); populateCommutativityUtilsPatterns(patterns); - (void)applyPatternsAndFoldGreedily(func, std::move(patterns)); + (void)applyPatternsGreedily(func, std::move(patterns)); } }; } // namespace diff --git a/mlir/test/lib/Transforms/TestMakeIsolatedFromAbove.cpp b/mlir/test/lib/Transforms/TestMakeIsolatedFromAbove.cpp index 82fa6cdb68d23..4e0213c0e4cfd 100644 --- a/mlir/test/lib/Transforms/TestMakeIsolatedFromAbove.cpp +++ b/mlir/test/lib/Transforms/TestMakeIsolatedFromAbove.cpp @@ -123,7 +123,7 @@ void TestMakeIsolatedFromAbovePass::runOnOperation() { if (simple) { RewritePatternSet patterns(context); patterns.insert(context); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) { + if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) { return signalPassFailure(); } return; @@ -132,7 +132,7 @@ void TestMakeIsolatedFromAbovePass::runOnOperation() { if (cloneOpsWithNoOperands) { RewritePatternSet patterns(context); patterns.insert(context); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) { + if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) { return signalPassFailure(); } return; @@ -141,7 +141,7 @@ void TestMakeIsolatedFromAbovePass::runOnOperation() { if (cloneOpsWithOperands) { RewritePatternSet patterns(context); patterns.insert(context); - if (failed(applyPatternsAndFoldGreedily(funcOp, std::move(patterns)))) { + if (failed(applyPatternsGreedily(funcOp, std::move(patterns)))) { return signalPassFailure(); } return; From 2ec6174bef4bc9ef3d5cedbffd7169017c9669c3 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Fri, 20 Dec 2024 11:27:04 -0500 Subject: [PATCH 002/466] Revert "[llvm]Add a simple Telemetry framework" (#120769) Reverts llvm/llvm-project#102323 Reason: broke CI --- llvm/docs/Telemetry.rst | 257 --------------------- llvm/docs/UserGuides.rst | 4 - llvm/docs/llvm_telemetry_design.png | Bin 94604 -> 0 bytes llvm/include/llvm/Telemetry/Telemetry.h | 162 ------------- llvm/lib/CMakeLists.txt | 1 - llvm/lib/Telemetry/CMakeLists.txt | 6 - llvm/lib/Telemetry/Telemetry.cpp | 26 --- llvm/unittests/CMakeLists.txt | 1 - llvm/unittests/Telemetry/CMakeLists.txt | 9 - llvm/unittests/Telemetry/TelemetryTest.cpp | 242 ------------------- 10 files changed, 708 deletions(-) delete mode 100644 llvm/docs/Telemetry.rst delete mode 100644 llvm/docs/llvm_telemetry_design.png delete mode 100644 llvm/include/llvm/Telemetry/Telemetry.h delete mode 100644 llvm/lib/Telemetry/CMakeLists.txt delete mode 100644 llvm/lib/Telemetry/Telemetry.cpp delete mode 100644 llvm/unittests/Telemetry/CMakeLists.txt delete mode 100644 llvm/unittests/Telemetry/TelemetryTest.cpp diff --git a/llvm/docs/Telemetry.rst b/llvm/docs/Telemetry.rst deleted file mode 100644 index e9d0d2cf95220..0000000000000 --- a/llvm/docs/Telemetry.rst +++ /dev/null @@ -1,257 +0,0 @@ -=========================== -Telemetry framework in LLVM -=========================== - -.. contents:: - :local: - -.. toctree:: - :hidden: - -Objective -========= - -Provides a common framework in LLVM for collecting various usage and performance -metrics. -It is located at ``llvm/Telemetry/Telemetry.h``. - -Characteristics ---------------- -* Configurable and extensible by: - - * Tools: any tool that wants to use Telemetry can extend and customize it. - * Vendors: Toolchain vendors can also provide custom implementation of the - library, which could either override or extend the given tool's upstream - implementation, to best fit their organization's usage and privacy models. - * End users of such tool can also configure Telemetry (as allowed by their - vendor). - -Important notes ---------------- - -* There is no concrete implementation of a Telemetry library in upstream LLVM. - We only provide the abstract API here. Any tool that wants telemetry will - implement one. - - The rationale for this is that all the tools in LLVM are very different in - what they care about (what/where/when to instrument data). Hence, it might not - be practical to have a single implementation. - However, in the future, if we see enough common pattern, we can extract them - into a shared place. This is TBD - contributions are welcome. - -* No implementation of Telemetry in upstream LLVM shall store any of the - collected data due to privacy and security reasons: - - * Different organizations have different privacy models: - - * Which data is sensitive, which is not? - * Whether it is acceptable for instrumented data to be stored anywhere? - (to a local file, what not?) - - * Data ownership and data collection consents are hard to accommodate from - LLVM developers' point of view: - - * E.g., data collected by Telemetry is not necessarily owned by the user - of an LLVM tool with Telemetry enabled, hence the user's consent to data - collection is not meaningful. On the other hand, LLVM developers have no - reasonable ways to request consent from the "real" owners. - - -High-level design -================= - -Key components --------------- - -The framework consists of four important classes: - -* ``llvm::telemetry::Manager``: The class responsible for collecting and - transmitting telemetry data. This is the main point of interaction between the - framework and any tool that wants to enable telemetry. -* ``llvm::telemetry::TelemetryInfo``: Data courier -* ``llvm::telemetry::Destination``: Data sink to which the Telemetry framework - sends data. - Its implementation is transparent to the framework. - It is up to the vendor to decide which pieces of data to forward and where - to forward them to for their final storage. -* ``llvm::telemetry::Config``: Configurations for the ``Manager``. - -.. image:: llvm_telemetry_design.png - -How to implement and interact with the API ------------------------------------------- - -To use Telemetry in your tool, you need to provide a concrete implementation of the ``Manager`` class and ``Destination``. - -1) Define a custom ``Serializer``, ``Manager``, ``Destination`` and optionally a subclass of ``TelemetryInfo`` - -.. code-block:: c++ - - class JsonSerializer : public Serializer { - public: - json::Object *getOutputObject() { return Out.get(); } - - Error init() override { - if (Started) - return createStringError("Serializer already in use"); - started = true; - Out = std::make_unique(); - return Error::success(); - } - - // Serialize the given value. - void write(StringRef KeyName, bool Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, int Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, unsigned int Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, unsigned long Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, long Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, long long Value ) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, unsigned long long Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, StringRef Value) override { - writeHelper(KeyName, Value); - } - - void beginObject(StringRef KeyName) override { - Children.push_back(json::Object()); - ChildrenNames.push_back(KeyName.str()); - } - - void endObject() override { - assert(!Children.empty() && !ChildrenNames.empty()); - json::Value Val = json::Value(std::move(Children.back())); - std::string Name = ChildrenNames.back(); - - Children.pop_back(); - ChildrenNames.pop_back(); - writeHelper(Name, std::move(Val)); - } - - Error finalize() override { - if (!Started) - return createStringError("Serializer not currently in use"); - Started = false; - return Error::success(); - } - - private: - template void writeHelper(StringRef Name, T Value) { - assert(Started && "serializer not started"); - if (Children.empty()) - Out->try_emplace(Name, Value); - else - Children.back().try_emplace(Name, Value); - } - bool Started = false; - std::unique_ptr Out; - std::vector Children; - std::vector ChildrenNames; - }; - - class MyManager : public telemery::Manager { - public: - static std::unique_ptr createInstatnce(telemetry::Config *Config) { - // If Telemetry is not enabled, then just return null; - if (!Config->EnableTelemetry) - return nullptr; - return std::make_unique(); - } - MyManager() = default; - - Error preDispatch(TelemetryInfo *Entry) override { - Entry->SessionId = SessionId; - return Error::success(); - } - - // You can also define additional instrumentation points. - void logStartup(TelemetryInfo *Entry) { - // Add some additional data to entry. - Entry->Msg = "Some message"; - dispatch(Entry); - } - - void logAdditionalPoint(TelemetryInfo *Entry) { - // .... code here - } - - private: - const std::string SessionId; - }; - - class MyDestination : public telemetry::Destination { - public: - Error receiveEntry(const TelemetryInfo *Entry) override { - if (Error Err = Serializer.init()) - return Err; - - Entry->serialize(Serializer); - if (Error Err = Serializer.finalize()) - return Err; - - json::Object Copied = *Serializer.getOutputObject(); - // Send the `Copied` object to wherever. - return Error::success(); - } - - private: - JsonSerializer Serializer; - }; - - // This defines a custom TelemetryInfo that has an additional Msg field. - struct MyTelemetryInfo : public telemetry::TelemetryInfo { - std::string Msg; - - Error serialize(Serializer &Serializer) const override { - TelemetryInfo::serialize(serializer); - Serializer.writeString("MyMsg", Msg); - } - - // Note: implement getKind() and classof() to support dyn_cast operations. - }; - - -2) Use the library in your tool. - -Logging the tool init-process: - -.. code-block:: c++ - - // In tool's initialization code. - auto StartTime = std::chrono::time_point::now(); - telemetry::Config MyConfig = makeConfig(); // Build up the appropriate Config struct here. - auto Manager = MyManager::createInstance(&MyConfig); - - - // Any other tool's init code can go here. - // ... - - // Finally, take a snapshot of the time now so we know how long it took the - // init process to finish. - auto EndTime = std::chrono::time_point::now(); - MyTelemetryInfo Entry; - - Entry.Start = StartTime; - Entry.End = EndTime; - Manager->logStartup(&Entry); - -Similar code can be used for logging the tool's exit. diff --git a/llvm/docs/UserGuides.rst b/llvm/docs/UserGuides.rst index 6eee564713d6d..0b204d512876a 100644 --- a/llvm/docs/UserGuides.rst +++ b/llvm/docs/UserGuides.rst @@ -72,7 +72,6 @@ intermediate LLVM representation. SupportLibrary TableGen/index TableGenFundamentals - Telemetry Vectorizers WritingAnLLVMPass WritingAnLLVMNewPMPass @@ -294,6 +293,3 @@ Additional Topics :doc:`Sandbox IR ` This document describes the design and usage of Sandbox IR, a transactional layer over LLVM IR. - -:doc:`Telemetry` - This document describes the Telemetry framework in LLVM. diff --git a/llvm/docs/llvm_telemetry_design.png b/llvm/docs/llvm_telemetry_design.png deleted file mode 100644 index 48fbc003da18e668b0a4bd2478a26bd47242f243..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 94604 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ξ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
1F2WqA6lM zsqfA8Tpj(n%A{4UrmW}<%L6qe*}iXZ5YU7|J+pvyuI!Yo<`yLJ>7OIhVnG6`jjtz* zezoAoD4OhEuunz`gr6LeNT?Vdk#tfpyJQyR z;rIK7$^P8%hl;xw-M+-k$e!b79)6Og!;D-jFK`^~z(Mz4#lBqj{k2MOH&JMHJ80`A zN8(6giQhWmoULnEzVDzm;mJ83X7SpQz&z`plhINM<>0Xm2CZ`?7PYBQLo0A|3BhAt zi&wt;FR+`pO!#@XuM3eqtuX3dB0A{YtlFHd_{ZlEHs@+$AA_dH@Q;fVuT_eR{c*^6 zF_lEc^l4&Qz(T$w0rHw~7CZ5)+R~V9v=J*-0^CGOxwAe81dkXfPJudcU(0p3O9!=t zeLBKUa%)dfF3TI}(W)1o-D8`dn}nfqzKGwkdBiZnh*`hjF6K_QWe(EW7vx;sO45^p z%@JKEf3t%1APyr|3*v{`P+bHXYLyUM1}yN2uT;l^=?b3OJ3M!!HSLbSAA}`rx`gODat5?js>Fk4;cX&~ASs zeXD=Mr#Cwe=D;SBP)OM!^nLVj|CQDoav4pUJ9|6JmlzUlkLqnQAIjxT`r-fwN39xH zHituEO-4b)uC1Yqnry_XBqj)x)l=<3$y11Dmz%qGXjy8!{?7@pZ9R5ftkOX5fe7j);3f~MLXYCpAs|h^0S9Iea zd1I0|ppfg?o4u2#A@5!g$YuDrt64!9M&!4A`~?O$q75`rhp)0&o~tz06dckiO0H%q z%M`s}RBgWNFmYGUp#lEdoxfJ%*S%iLgcQj8+t}WCIL^mKO{E69s?d>;{i@5@`|&Vs zoRyf4$F%af?}W6Jkd}~NP^!s|%*P%lG~7Ec;cF%KwkWu)h@KnaZ%!^lbr@BjsKT&x z7)7W>y7s|8szFqgBVOcLFSEc_-`&#PC@xh{3o(Ji+g$;*%&`2?f=oqWsV`5uj~Bds zn$h^0{!4WY6A+?9l;vd~R|%0Y^r?&)N8!>ob}pqtNbifWPC5ebYm*L{%M92DY4cM? zlPnDbFk@}N{vn0acZ0f?0#h2cpo+Ia(5*`%>FFU7A^VTgj^tHFt%fHSnRP2-9#o{I z!HBkd^5*=OZ--Vp**T_P%+krXUr`%l0rtJ#mNdnSo_KuBUYII`M2WJ z6^&k@6rHddo~#QBYc|Fea_PZE?7uBwP>a|Rw zVbmI&s+M?qe4PS0 z_o?v-c!UasAnL8*HcsL=K7J|7S?#EJHeXE))T)En4T@PpL2TDMg8`uit3&^J+~N@< zH+Gd?tVVY_zIK_4DbZ0C#1A8YjChu=JDmN7+*r<37$r&}r^k2cH-An4m%qk-Ow(Yb z{*>V0`8}QMt#CWRZ9$|z05YtV)&wd_lu&;~gt5o3 z$|*lU#L^%ya!H9b+h?8N+eOkm%a7{^Hp7R-pLfjFrFp+!n4C5~yth0s z^=b1VfHGz+^#St^ys2}8VQAHl?|#Ei)?-oD#6tgZ*rSZ=O9vjmx$tv;yYSvM1>Vy0 z%tMQP_gV5W)EJ3!vmHxKkTO13f#azM2sY&p25$6B>Q?N?RZM{wuapx%-XU3JG4w}> zla4$Yxe`L$Mh29i0B)(T9gEi+I9s6rin)QsrBeM*AhG_G(%RTPytQ6l!#ngXSDAGR_ zDu#ObRL+O!UedU{*0lCYmk=E_Dg@8yhwLce&(8l`ynbG#Hi$fG!Q}AjuN@UBx+<+w z9cbhbllV-U<-3$@o(|Fy7BBuWER)E25i^K0S;N#CM3je*fHkTbQ(}i2j6dD0u5gH2?|Vg!J=KB z)0StyZ%u0&jIG1F#7K0ph9MEz*6@sXoV0DZ)TqQfLYORPpx3UycR?T2=TVgEnEvVc zl99LNrtCx~ssDeSUY2pus|E7O^FiMWbZ%%_KWta2&m^tv z`qX$d1Q>SjHyBi8km2@{Q8abLNQC!&RF!RbnULZ3ZuLM) zhoqCMAQ#EKpL^qV&{fP2Za$K{xkT}EW*!1jV71)6Ia5)qn+c1r2Dhb;9;xu7Gbvew z+hLTN{L;LXKZm?MC4MsC-p7HIKt{O#KQAaJ?F9g$xXMK`plZzh*myG%D(~q$D}FT7 z7ES-zyxv10GQ-fOXlgojm+d!Tc~+q0b2>b;QO9wxXQ(ksKlYIdq#mRtT;x2L|44xH zL4J1EX-M#+5k+>86=251FKs6J7U=Md0_uh)jk??*#Y573j`XNm7I77KV-wN6#Q0#X z`(rr@u2VZ3*3Qz`NWzS=H%EVq64L*Q65h$n@e4iDpkQ3gofpxj`C6oVWiTD_RIU^q zLV?~o!qtggQb2X5LCv+@q)?eU-xT(^)^lcNXMA-=?z3J?Aac@WCy8wHkGVgF`cAOV z>=#>B8d5jQ=J=D5gz*y-)(4I$|5Qf-luK40cy@cGWjiqKdoqu91!oTk$$kwsO$Q8r zHGXdgKn5TDR=U5FBwoiGLvrmue?aS#_1cA2uZPsz(S2L=0JEgZiE-KH;ZLT(0~$IC zd+AfDLS`|8P*;IBwpzRn3ec9}0M8Q6;RTE1-JtH6DWB+u7x5}GVNQlxa^{MTO5pFk2Fbk~?4{ApSM zI{G)*`ZE}p@!Y^6A8?=BnjdGecRDs!CRp;Fa_`FMi1m!W<bMzyI0sl38ag|;bqNuCq@3PuwnYyU5-YaiUjNre-2$)&pZFRHKb72R7?4 zVtgSX+W$iA31O%FAh>Aj`4-YJ_jbgPLlpp& z&cyaP=}-Kbw@ttNy8`fH;|tive9^fF>>r(K>}z%TRQ&MhHLaA5p1ODiz83Y=Hxt_v z5q#>SO3GQKkK}x^tN@*QiZJ5dZRwk5KAS^C!`q;_>Aq3AN)z%w-j3s{7%P{v2S$At zi~|mb(c8u<#+|@N_gWBp7UB;Lm|emof&0F?uJ_q%a*mMdH8$FX+-Z-uP@sL0i(g7V z*nV-XDbAA*Io~ozSe%{(!=@PE?jK5&0by~aUNk~`S#iP6Xm^ieXm@c|oA7BkLvw9U zXgKOyl;cHDZJyA2AZ+LAJbZO+YAiCceH9aRFOx05Ti zqtbPY6kQ5!P@p_n}2S?c#h_4$jp#HvAB zKYpoV^LNSUnGTpqhca8Xrh09(Kh#PlH3N+UvC8R-wm^E_K@H7>Zlelr{hWkXC6`6G-Xhm}b4^Q!$f{Hm6=*}iQV8U=^Yrf1PqaFq%$1A-|1_YQAVBrY}N6?n9+<_?O#Y6zt(UPv=wP_$w)Qof8UK z35<_%;%w)eu*<2r7B(Y<(UW}2PDyKcZ9!kqF+p9$W$rt@k{gHx1jI+w(Nm7w?QND0 zU}|{f^3XY`n~5J*wGBS|s3aT&Gv&szDe8Y28(<6ASnl46$7P^TwXvh9Gv{6#n#2O; zuTXbJ6_;{O^VsX%jzIZ$^WzbGX&1PisAbp&8wJ^hGp+2WkH&x=mCRY#>XlR}0qK9= z%WsvwDB%Zy^;R#Vp2wK$3r= z@+SyYNq>AxVLz>0w>Zt7?9E?Dw3hT&-q@UzL`nAw@=|ARD=5pMgnK^>XNs~sQEzK^ zF~qs^ZKYY4_|f0&0K>37KD;Hi?$8;Y#oybnvmDi5I7ht^}lNYlJ1&MZgne)&B;}{K5LUwl9;uWfZ znOj77N}sqnPTTJKh1~C4^p)FE`=@ytLhxYJmLh#cSeG~b+0Z$aw=Up0B&A6=Yn8*r z08aC0SitjJ8CiRzDd*ShSHT|0^oXjY8C82VY4@rtTu1EzQl1sgcg`>US9{(b9^ zj9WG%`LWj+UwukbRdEVN9S4EiUbgizLsGX{eh1JN+2*%Th(sulecTXja{e&uNtq*AAfP6Ctik6KDwZ66en7Zmo8npu8`*^6Wx?_fQU8Yv!j z1MuX{j$&qSr43gEfS!zlKkYX1AGU3mXEsbi9LMVji6GKt%Oi6EcY^-(fC7&z`@R%Ua zx?*S=ouXW#$nza|xgWUAzC7j4If8-bG8=*(NNRMo%bC)=)>N8|y_6=)Pd4lEYxh8L z>9LkpIG|0$e)hzOP#!VEU)#iLq9Ayq#_}E_HWzz4ik)h(U%)^F>d?DMjRDWQrxJJhdRowIT-}*^Qp5dw4TV-1^h>a0YvyT?ioaJ^2i4pj@wAjLj~gGh$?|&8 z6dAIB2=pZtB7LI3*$oE5(O%JlwEW(M63cfw*QrCtg+V5y?{7%^B6BLXS3b)`ooalj zbmDdc6m+EKTzOa^&kApBlf|iZGUpA#=|Q_=*P_T((B~N~@vgkPdEeSs*&JISdcA1| zeg8zM57c-9po!SCWAMMT0vTIdmU4iaV~axp=5;N zAhP$vvX!!=aDu~t#l`LV{3%e$j9rn$i2Zu)*EW}G;*2n=;EZ6gCd5|Cx{dNGt^bv; zQ2)KMFICXP2x&vy(aFG?_5u4gUVh4HS(%ymQVQ59I|dhz#qBW!`u|b))^SxX-TUxO z3rL8B(x?d1qSB3siqhREh;(;tr4&U_T3S@PyGx}cl^k%~bezWx)51#XUpYyzb zzJDD*$L-uRYu36}T{BZMKF=>6GDXr6v& z|9hOVo`O(2pC{y-;%gV(~-q)LWX+#iLQbvmhE z+0p_=v@qxw+UFViQ}WxkmEeMfv=lYJP)Dd$UeUHS0aWd3cUB#AoALD!-!D=pxQgSI zI$7@pY;F9K_x=}y8eK?X_hitSQo5DHCI)b#tZ0rA?A>FNZ;@8S1z{fXbeAwkH?8Xb zj~_OO0P4rATCQ3D%h;KS2rvzZmjXT8_a*Irl7<0YL|5Zw4IqSNS^enkt7`*cHLLz} za;L0N3n9*+-{xG$6gbq{FTT-Qiua#~MEB!6=sUAK+TLEbF##vU4Rd`qOmjUwHt4V! zRlcEHUFO5TSl58!@yl7#s+e-+q4o18Ii%sl%H-~&dCsZp)IZb3Myw+fVp=l0S z863CFM`vvw(`|{>n~oF0rzAeU`>AWcXy_31EDBu)o;#>qO^~fBaGd%-eievLedi7A zKlEC3H79r;QRIq@?h#{#rlS?_Lb25^b~s>(jH8vDIFP|AzLM5-dHkS*otxx8?+0VN zCQjK@yWY{8-kjk&Ts<*f&7FQuZtnl<*MFw)-)%u6`*=> zlcX*vAK6x`3C=TVp%Zg+a3A(=gWY_{yhP4|Yi=b_* z5Z!zGL69Ie7Ivouj}7s9X;l2l0)(Jux)8C$r@dKv{akczzSYR~Tz$b%!UZkBwrTl| zoWjWe5;PgXF`>MJN8+myXiAa(??0#n2WMo3vlV>65g$mWWKuMj7Lb=VQhp4C z9B`V>1}Dugse=hAvYsF~{uErnPHU6+0DkIr!6AvYX{XKp06X3k%ozt92wFTzTaj?q z1ZPV70EuXM5aBtzja1MVB&FKsz=e{G_j4ToBo<>pp-42f1x*Ni$TBh=fng_2A_2}} zeEe;ZG0W{X-b7?{#Y;VffVRB=s6G(n|Lr7U2=;Xw&7(@GNO)`|Om7X^f(`6=;8#KK zejmvcAXGM}MfADUk^V3NKwttl^8ZZ|Q!x8|o-17)>^V@`@da*8b%2qETBED(wKEo)3=PK8%00WR9i`vE!}N3{m`J zp%fNlK}71Q`dBosi)xbG5~Z{fZ2v*Y(ge`A7evEtHhn`pOdtY4DE-G!vo>2%KKX?m z43@!fuNTT#@Oc129-#4c{U)`|V)wRr=i3MJeY1OOC6kTtYP38IJ$~OzWK6MZFj}Vr z^l$Y2pva*$k(Kao5-G3nzBX5qUhnAx62ncjiv5GysF}TGQ?j^~m<1SJ+MqySiSC1= zCnllQ{W}-U4vtYaRUDGF^Ta9}Ttu-7s#xo-7?zb~rR)%7N%R}B@OH@gttg#h>S9X} zVOR4)A7ncppalZI`xg%qGEulA&U_q>?brrcGPpy4;>i2kAgsdFbD5Jh)VrCJwbtm3 z{2K)_$@1|N63*>p9Py&{KyWx7)I_O%8(_d2EE^qxppX24SpdDN`c00vQ*{$F(W+dW ztPxy{<{5#A7tNr9k}mvC`byQ+&vpR3N}Z_b%3-Ee;lU-@=7A@euNUilD~Eg**W zrQNwE46fHG0k{TuuHRWShJkjqzWI%rXBpcrf zN<4R75LIonp}Ab`I{EeNc#2|xL;80BOEN|)GPn|@7fs5`_L!&nfltkse$xuYDkMAK z54Iqh0)f_Ou-xYBzyGEPkhjpzX1ZQb|2+8n(DdJs@V!b&NAJ#;C~=)}4CyRjyd}0f z%Rg)_^mj~sufmtpR}N~MS>VPFG%tAwqz7X^aDX>Hr~Vi99k}Jz5_(u+qT4q>UZWD3 z=dVTff@N+LWb1(k7=GUji5fuP1V~UhpYN}K9`^Nh@DHik{3f+2>+X4REs(?ObW>(q zq3gJ_5HF!91jHM2at~kv9)Ofua$LW<0+>>R;Hb;Q4=@|N{TrcEHyxpfrq%*9{-H>W zvA-!&x_Zsgb2Q&w@9O>|w1*H*vhv7Osr5FD(sLoIy$!G%##`ty+giW#XcU(yYx=d` zO4b(MaPjn79%w-fq6^Dl_3(2#d~?0`w>>EaIt zplep3=*;^8Zz7zzRJ)g2ZDlDv3Seu2+{Yqza4PCiR=l|=UcC9ioLc@`wfpe98?n_E z`VuF1&F-pI-vvOTjwlv#^@-(yQx5NiM2vkVw+|Vcujkh{ys@NSh}SFZdQ(ha)qT0x6D4c)37dJ@*cs2P*hH*!2-LdVofZRHMkRdr2%4Q^hv!{os+{*b&I}_AF>bH3ddxK?7Pzr0`ayE?`t>P+5nvT{(Y&AE@ah^iiBZS@8Lz4la7#) zCL2(!(W?4GwVvXZn;vp^4w_+A40~r&520LKI|0y?^rO|Z*P=HM&DGB-eob@IdxQp8 z01B|4$nFKW6mHDqkXhqXWcm98K^D#76k-DJfMMf>J;^a|f2~cVu0?mv2fFU9+d5mR z%s>3gUDK&Beyy-b&Q(B0-_0p~4K85(bw&#_)aqlqwlNVkf5DD8H-hUy==ptpyIZdH zO79bVLL?U_$HD}kvAXv7;5^~gPp*jEOh%T4@9PthsF+Z_rVerwAyBF3- zA9Z>p#?JIc$uP9%Kf>e758G#807<(&w4wIr3`<_QW2k3pHKNb(xEuzrsIAl8`B_VV zSte7o?pl1iw4gVqU&OfO$Ga=4xq1;JxVnPZX>nD(_!b4t)mdc_e)sHJ$ag*V zAX5%`SVIFD9?;q;n*xs7bvQNcVCIC!n?Gt?gYN)SbfsW8z?F)<`JN0B7QOJp_Zo;d zc39c&@#edAOIJX6;YYBl6=%4|4Tbx+D2zV}DxNk?AQB2(8q|po^RFJ~#gbzhL7tqG{&8V(&rQ}8S-e`m2 z!6zJkEj0Ezk?78@VnLtnJSeZBsG!zYIp2gBhCf$Q$~v>{*r11PT=DUBHzy zXev3xI|}M1`D|`#=cgh*I6CO3e<$X1XsqsA^xN$#X_MR?DOGUWfebCMMPDqdnF2Yz zzvKIe$g)18zskbinBim+Z7kG&?9$UB>qf=WOk5!dAF6!OYo*JwK(x1+%U&e}<#9G7 zd_H}Q11so1jGJB!5MJBOX?g9nt+)6q?FwB)(+E1wkM&myT=^=dhLAr`jhp1U|Ftaf zB4f9IBkcSUA!Gudip3qki85Hy3%htgt_%Mo-Dm8M?@LY8L)4vuPrc_6YT`fgI1kHy z-}&-D5R*6Fosyx)%_ra(Q-XR#WLZeKrm1D@hG0QR&emULAKp>PKzehMtb{4OIPzQb zWw8^G;&rb_Bb`bzDJ}ggOUKd*Pqnl&37ChGxqt8 zk>jgMd}2tZ+w{vJty2FfMM598z+M0yQTrkIV&5x+=-US<^iv??idK&`Ba5S=Pe5ufJM8%DF_Ipm zWtI{Y`MeWfVmFx+e(zsT82gcWj`1*X$Ug2t>xELo4g)ccO9H-!2$KL zLQo%L>|U&L;=UX7uEP2$mc+M`*)27F-VH&FX0ak>iAB5dXqs)YTlVM~ar~H(kj?0e zH}BGN&>K)>h4hSw`Xxj65&k*c>X6sE=o=CU(Hb1zp@Vq$o;73nvH(PGr6XoA%X~KR zENn$u2Q!==5nL__e|U)sO#ADvX|w+SdfJw;EMqm}U)s-`^>@-5T{Ea|(?9B0&Xot3 zywSVby$kkojUKIBQrAJIB1_i0Wi1cKsXUyN`2G~SQAGB!TlsyDqgQn(mq+fiO4s=B zwdEq5H+Eo-?|`C&9DEr`LR@`A2slfR0JB-*W4GI~emJ>|(%7(7So{} z>0u|y-k*Lj?A9Oe3l3?Gx3lB55&{E3Z*IU-xYZwpZ*cylbWP@tl4}2b+azOYn@UF4 z)g`_htNsy}^!6do5YeMPFTTyOxU88dr%=2$ z?^HY{tw1yfe-UZ1RzsKzHzlbS5nTAzf1GjcX~kgx;@hlA}Zw&Mu?mP16?&Zw#dvwx${?o+$#>rsSxQXVR zBxdRhJQMRZUTh0YuCwpu2<}5-`Lj&ITi+A!g%jx{xrjlayRqX+ET-ZSJ$Sp+Bq$S%~`FMIYsp9}|ry|a|Y;^zAj()X? zL3=4We18%@gbsqwiR2`N&|7rOEnabgds)As>z{vYF<4UWv@p~c@QT5h`>2THgM6)# zm*vXK*UoKmSDovOvR9)MWGVMiigu6XVBe=}uJSK0Llhbm~>Q zU{gm;K_Egzsj5NDfPxd?mhxFx)R?={x(x_UdR+|YJ^La~skmLoaP8cDUO!(XpQ0^E zrr09DOyUk*@g`mY+oy)ESyj3(&DM${6cY2^?qnRNRuA8}y|+W_7__Qq!fnx&rLU-Q=Tn~b zUg?d|+WdI_O-teYal4W&E@7Nbr}o6iOUsM!$KAL2&n{d5wn=|vAeOw28BKN?FEA<{mnD3)5eQVv7cIyNt)9@p1{g4K^zMB_GI( zZac>1CG37H!nsQjFuWZX?&&!*>k&4*jaWb~L>qxC7MDqIpMObF5O3f^ts;#_4>U&4 zi!{|}?8;kryM*pm&yBJBju-FU(G2)10X$QJnD`nx{upce<0d?aw;dgdfs>F0-~h^F ze)$USy(yv9r(rAWVM4f~JQ@8h@X<5HIyQK!`r*y=64SzDcSmiJ=sPi5aw=<9IXZ)c2cR1{gA`p_h|ReV24^N5acvgN0p` zoePDHoDssETViiw1_uY@3tYrZ=W4DTXXDa_^3}AysxADY(Ayg=ls`V)#fBBX)p*Ua8_R7r?$S`T->Rxx~Ro*W%px^z6|zCrl5%7~V8-!0NQ;d2{B$^hQOnOgpMJ?2JnVvOEJSA7u$ z3#hqtXLFp;rL*V$f#P8hFHg}?I|ieH%wrm{r{xoxn4xY}$7xoMw&GRvg~^Jnxtybt z7>t>o#aoP=nw7y~GluZPkn|>Yo380j$9EOMZ;6>A zcjg*K@8rw**?Bk%dVNSOuO-LNt)E)i5#UI}S?Jd6i=@qBx#hXf^%oTap)NaAb$am8 zLHo-#?0qN?@wm<5C=z8}PE^*PwiYfbQh9n#nGhNrnwDE!b@NT@t}``e)F=v{UDA70 z?bSyO)zo^H%@w1>M5@}7b}J@5Dd-L25w>k_uarVf;jFApI=<37<}!TF{-#^bd#`lM4q8tPhPs|US$2)*-pog6(QGCc`4Xb9G^&SHnFfNTo=`>5b4brkEZw9 z6ciktP `uh30PjCPB?D6j6T>D9LehXzW^_XcsJwqqW)cRCKtMjpn; zloByn)1shF` zMGI{mqJ& zoCL#H&6`{5*2%@k!t`fy`pz;nt0oK#eaH!vrK-ZK1Wk<=Ynq83TCtJZ|y zUiZPN7UdEg@W>(TwfX+0RXsxrNq8C0L&+`eW_p2Yq4mY{D^5PMPSn>Qhy=&hgwA=@ z#MJC{lpA*HS8)Ip;uOiIww2fy8{(1jw(+!B?T-@g4mQ|mvLpy02umIt3L~7!8{*7t z33DSJvrL_>MJ}CRi;p^Xc7g`@@*_^4pIeJdi_w51Dq9yxA)$`fhwPcrb}@`QP#(N2 zilb5gF|)@)v2$E9E{yi{=J?WTrDtVc@iijvDlC#herRU+84`YHx#{u8X;aKiyQk6; z%RJutMjg$zgLcoH&T+FF6gO|>;ld7Cb|ZZS%=J}!Wytq8xizURi8a!wJ&9I$Z;^Y})tC31Nj6pJamIJS!S-kkfk898iUeD_;{@3mQ;Bktq&M)4sY zWnu>>sBEg)(yh(j@gBXq>7+%`djAz(6yYg?&~7HkG4A4lhWgcMUdbf@xq3|pA_g~_ zN~g8|P$J8&=qVhtj$^S%I@7O1M`zTmRJCgK*XG6Lqq>J^pv^*T;2Qj+g&8OH{REq* zCqm}UhK-uS?=v(Xn<8)&U5F!d4E354a*}|HP^I?)4QIY zURO+SUiuutA=7K#A5}j_SdG_Z(b)7o`buKgN+(~lA-w6~@zR`)bJb`@@SCFbA^=tA zr|0*byq2}>zFXjbx7_IUk)GS`uAa*t^t$5Vnidz}fjxJ;nO)yVb^2b+mtG9U*cz`a zf#;=;=N{_SL^ahg9v@oPvN*!A79EU_TiG7zUcM~~8AmKdMl}i=7ZR&rNqmVHw99)m z>Vhoy8fmP&(d^+Q#Vr_LjWMyCxt#7aKey>)sWsmcAG%Gufhl?r^nu^NBCYwd_f_p( z?XQi3d(*>S2A&6QNdAyQ`KC_38G4`WE#s;YR85KK(FN$bxW3C050pm&7dMZk9Z}eX zp95I+9bnbO5z@UgvB+|o_-%!4@#$UtrDICb-gMy`=3@bD>gi0rq6XsP1f3L;pYMKB z>DAsb&g(DM@S)z@J?HMz>iM=9#eRNeRmfh6-$$W-ID3fo4xvIOF0Em0@O;#F5B9Nl z{i(YjF~aoUwiy(8cFVu5cpQ9s*PZyBl!DWmWJr&<1 zRr|&S)cJZ{ncXdRGr&RadSkW*^h)oBDuViU;vXjU#Dkq&19n%#P0;~|LA)&_k?0&X zrIZeLc5gNA$PZ)<+`83Sx4coy3i(U9=`0cx7}jRj(x-Ov!QYv^s0ppt&wV1jxY)t1 zJRKPV9vdh&&YOobNEl5Drr*}Rlc8Mr>hx}cPdWq9xn26;BUi3=-3obJ58)$$+*tAV zuS#`_mEKS$s1pg)IlR>7)6AJ}-Dz!MCl*I7>A5ZQieu%eMv!f{7k4`4KG_y5@G+sd z#&x!=G{;xCc{OAIqMC6Nv*)bA;L?YgJdGwDYf;=z--q}TbCXryuC2Ql;bO3ow;tSe zQG~H?x7+x12XTsj-~Mc2lGlGwY_$D#>v_-n-m|LZ?pEhlaImqJU**{bajHM1&)CR2 zy(`4B`{77hwma>P!{aY+xJ~j9jgt-)NM8rnN;Mj0vq`gF7?wy|U5JNr!qdoCcg~5I z<_$U!Jw9BNsW4-D_-e&K>obV3)`D|U)AFKs)t`lR9upGahht2neU^6WemY-=24>r_ zh4XKQ+rTX4lS9IDM-p8SZ_EGGLJJbXvW0pW%Kell~Ja|0|3<&!h_H zlNw~EXYwKyM5N>OSEO@^&&#BUz2!6j3L$Okv=x|j!YU?W)DLec?25e1Jc^rcK8jES zu`)E_ZOehtEMg;Uv#nZ1Z&iTSKog*WWhtu%N68U7K9Q3n!qcfriTq>9yWHFF9$6)X zGwIhyYZ4F;CwHw3UioP&#%o|XxJP_9Jx#sSsxj4oq#dO z>`(lGY{dm4A>)M9IDU6w{SZDa2p~cMK!mR|!{Z9yGHiA);dyi~Mo7XH53H-xkq=in z>h&itkkgV$F(oIfvX(ry&qI(qEgbRg(4n}hg^dE32ZnbEy-FGC6H+Hu)vdzc`=_d5 z5kt3Q|Ils>*g-v7&R@O9PVG+aJPyN2Qe@?3AC+Wcw>{UCOdIGx``u2nDVZ+Ng?7p= zx+$4H(1Uh!gNOJ~05we-+9=`88R$z(ma&D``QNcDOD{^>k+IJZqZ1!UGep_{tiIyg6O!>gnv#w(xARZA$-) zY#@mt+QHg_AP~<&BP8f($`tN)F`6bN(stkbYFCu|4$ zKKD0$9P{bn6D(u+Q;MMkq!0Xs8p5P(jQn_X1~^vEa-HHG$W+ayykU(L5FJIzEZwk8 zJH7jnbN{K>aMg>FBX?bw38*abfBVRwB5U|?xDTIP9wIN4ahq(c{Sp2yAHIkGR)f`K z+In!_&1lvtCP#AWQy=`ESqg;u(oFp~4MSV<&-e;ajVjQ3T0JDClbpIP55_N5+Pg2n zGSULZFTt1dC-IjY1bQul+1oovO5)SIG%z@-p;aJ7MV@}iL~`1}6btQT*ZICuf9h8{KjH@*D>CtEOq zFyeP4&|^!x-g8wt7YWABrrJG~>i^y{(hx2@d2RCHWH$PbXOgo*g@+G;4Pn%+{1i2Q z$f?4kE({o*YoZb&^B8lXYya#?6QWnWNd~$~Ta+>U@OL1Qx4R#%qdy}dYsD!01 zb6h{mMu04EGx$rS7*MCb7d@nl@z)-u-N901J*&o)9MpB!l?lu%_KGJHiZ!nJ(ID)Y z%=uKNpIJ+{DED3?(d)S3|q{aae zWUFzz!fT%R`SC}VmZiuzzUoC4x!leo zOzgEg{j;C9C_Hg|m{gxlnUJ=1FZ5+sc0QZ+katx@=_z;?y)Cs-nWedz-_pIGwzakX z?<-PZ4pevZpZDwZOKBitdcO7$EH9)ZQCy+YdG+0yi?8&Heal^i9vwFi;yudGL(4Vyc+g;61)_<%4uYt_ScfB}INt4A>CK4VSl^+=z#xa?E zIqv=Om^6P!J8lDN~%)I)g-UmX9K z0I?tjE*L0%e0+3x-LMX7O%xYLB9Sd!+@efOOxp`7A^JMy_OlA6oe6re;o(JEU(IC; zY+A^wyrd!xLmSKOrCx^0K4Wa_eNrA4NO6WBY&JtO)3c@9uB%C7#m+FwfR(d{DuH4j z|DoS!W4BJ<2D3?CEva6ehW44`G0GeQ55Lz^SOr!5fnl_)``LPxd|3vy-XHviMBTU3 z1RNK-(wOBU_cE5h-T(J>y}i&zVM5D;b2;$-4gX1F{MI#(J(sPy`$J`R7kkr`d@-@G zoFoly5m0hOUw7M_(MeTEtZ|2rRkIu8j|n(da>ZSgV{Mw8aGc~U(EZS_ws0%b*7m_> z*_{U00^NH4NRDwO?nyHyCO3Eb5{W(eJ!t{CNX3vwQIA?#Vk`vyHUFp<`-lg#I;GYT z-p7ZC1F`Kc>DsxD_yc!K%axc&P90)}d-qP=VT zo80(RE%wX|3I`Xp8orPFoo(qJq}lzThDxX<)bT?$bZyOdcBbi7?xrUtC0$ycZ+(5S zX)r@AlW(BFKs9Yhyh>H6I09vpVZ&97`KSdHY>*k8m z6{#_Cx}ueE(4>()T6*{H-FLudmHi1Qn#actsFnoTG;(yW`y8Q$!GDo*Uyt%^<2XvE z>`ygIvIIJ#Y>q}~iFt`}dr5nQI2D>S$m|80HO^|=EIRR_rV%p}cBOf00C16wB;u&u z315;iWibuq!2%OumdlqPY4m5)oD?~SGyztLAHOGh7~Q0x2V~EnHv$* zR$9(=w(nG?f4p(IQ|};STY81#BAMv!z{5=~Z}aFVEtA&pJNw|tMTL=ahk1_z-C~z; zj!C*ecXd>GwvnOsIEF&gv|!f5KC|9Do@-8$drvs%{MW7OJcl`(w;q=f)5=Y z9>P^K)w5Su1`Bjyw3Y~E-~{NY0)IFPK4OXU>c-_eQNra5jFx2b z_@;j1VaM$nCFK{swyJ{kd~2>fjLtiaDdAdK>I4QBuC6#xb*>FQT1@(jXSZ!FRjOz` zO{NG69I<(Co?|=>@6R0{OG`@=E=gqJ;8@XZe|uy3*+xRwnP(?-6k3<}9JU#IT0Uzd zJtpO5OTz=fFn-1w=F?EPkxV49I6c|N*RxvAeVP4xCF;%wSXbBfQrx!Y$jQmy6K=#& zP*Ft{S@h?0-??+gGd4S>L7YpUlK27A{2nnRh?1*vfsZvQh#_Yd^YZe-=a2KN+_u&@ zz@3Z;Ar!3Q)!+2Zr2v#t{fA)~kS$i}%?V%^W*^W$JKUQN zq3v005Z0K;gv60EVei2NMiHGcw>I`Ch-LN$ecmEG0+p zxn8g7L|18c(#=9}I1Ds0^(y(wjEStqT|4Rbh_v?Z3*4;^@pnfAr=3M6vkI z*|tjry|Tc_B0%2UYJp2s8}BR++QAMJSqNI1Xa5YDc#<~!FO3ob|< z_zmD7SB9EVeuXEj_n~KhTj*!vXZtx(yV`x{-TJz%p6xu_&Qfp6McG$rHWnpQI}OY8 z6Q7=+?VRgOJkD7)Jw-rJ(N|_S9SJ-(kz#-TZ=eUQi!H6zs+SR+gX)TZq@O-4N&qaf z&mNI-y~fWynqC^MEKSBRJlx+IWrD&Z!owYH>R=dmUcY|*wv&{C!bw0(tcJ|(79OK6 zx>P^-BVPe02`bmEYLt){oF*9>t?D2s#~+jpLQ%rcc`KeRxJ>4}xfYXwOG0nCz*&cn zkMD@uv)i${uLYDZqLc#<56?nO`rf^-b723X6#H{&qJA?0E-+)Z5!}@3lTY0Dxcamwe26LB*{M#A5>gT#}e+3{|>ti|Z(O>8SJ-n6#xm{`T%|=fwQHOQm|Y zc1UM}sPI2m;bAw?^q+w0$LN6$o)P+!4gOB0HA23*M>Il?tnuPL`d)G>ls+UEZ@o+c zwr(yatEo944z8rgxO{m-=^wJ!KLtqZFVUM>x2!~imvs7yy)P8H{3V!XdnQal`SIg4 zuI9GW#AIzz+zPdayRpN%hfQsRALOWrQP&fhZN{p^KYjijq1>Mx`}>~$hjGK8&=-vr zz}YEFNWi$d98^_R!>i)^^b!u6oR<4I%?I+5tL(q+7Lv26K9=4r{iSgkIz}6}SHTSbm#Uv%%7FZ@FTN{*S;7 z32)!4tE-bh($)()%yj`f=#{aPv0HG_DT_cE5M%18)9_i|&gP%-kO?9;8%|eYQCNcf ze%Cv0Y#0Q6Y50*ZrUhdu29S?7L7~32XIbRC_BN)|Zv|76laaj((BUltzK=SXhX2(o z@M>Hx@eJwuOiLI#20g#9vD`EKARC23v9hv0v!DBV2be4HA6$YYzCl=Z!p8W}`Qu>| zl5=sqCIl25nu=RUfZtr??CM#UWAd;_S)%Toh=L*4|1hUiC^WIU)UY0tP37ZDz0$4C z2=9%JjRJnd8tpFk8;k}w1ng&SXQ-qS&$figI)}c#C`E(+sq1WcJyMRMtBBSbYpy+)T$=hW>ooO4yD zf9Azd6&0og1U>v&5a{`W!73e8zyrA9ed`9OS8Y|=2*y5PkPwO;J|KS6o;1bn0$NZ%_2IkqoYz= z@K6Q-AnTa6?xvM1DHFDmA{B&!zcFDy) z8SMP31$cf!T5n!U30R(7dLtd{iK+oKQB4X?uAM^%44{!zOTnFG>o3+=`X>Kz#$gpWH^+~eT|VuZq9c5yX3qPcCps3bha{&f2vF7O<8l+`;7c44V+Rp z+lgf9K=fW#bfU&Q;4NcMTvi4odo$GJII%?-&Ytbw@b-g&*|eqo`)oi;AvjR&;X*)2 z*zG6lsk4|Q>AL`c(40OZeQBipnhD5lsUDOorz?LjwkhX}e`@RAf-ymF6qctoz=^t| zODe$Wc)!8SFx#LuA&81Q2btx$yal3!=Z!kVW`fu=@=86#>U($V%F4=i!5Z6gay%}+ zu*G3?W%`+h{|5`{se6J&a_iQurH1QYjK~mT9*6r*H^S`G1a5NZlw{>J5?s7)_T7(| zLCjP5%9X_nTGj`nEGwiX_%tnK*xsNtgyKRm$5G{gko(C;0&KyN*z0Cw6s(F8TL8De z-VsNw`_2)x!)p#+fxIe<5X0Bkx3lTX7qL+gktsSI(x^SK^Ym-|ca>5#HlC5(8MH5< z_gJ~QKcDEMEcNj#xp?X;;Y`JOD{SKPm5z({i|dn(ZJ%{&S*p0dQmW%;`hRF(X;7WS zGJ3h5pQpK}Ex@>L5<+`wlj7+L(kX$Y_@^1zmRGGIT_whM? z4}v4l3J`@N#+;j&+lLAr{PbG8IpThm12o71fQGWqQ4+!;4^l=PXFBIO^*6P zV|=W__X3b5Q2LdHPrKJHU%K?ZLVxdIti*~&ElX3W-|V)n?Rq-cZtSbIq)x)NPS0gF zsDv{9T@%I5W5Y%q;J};o#I>wV4F>`jm{ED5{jsE^q(2Qeu&Gu_1Z2N&_VC0p`(kE$4#KUl|mQc25)ayF{*dYibKIwp1qa)Iu} z?$q8Em8Dplnq&eBw)d2n2^~SC;EqT$5~nh(-vj=CfNg8j1Z2D1mrYJXlNoEHeu{+T zI5PoVfU!OIx%B;}kMEn~HXrdMZ-%}pJ7c$3bjMK}+k-7+m&DlaU2I!zK*4S{K9%t9 zF!1!Onscx_Cjee%tgxRA5^}q{5dlMuI>77G{a~rUf{t9Jq@?op%k|WZk*^Gt1BL(1 zKYE@fh60J{?w&bwrULmWqPe*lo~f3pewQOKWPk9QiZMP8GDEWFXt%=$pKr9y-uEhQx%2`>H5R?@(HGaJ-8_V1<;9`XcZ z0@N(hBzqc9RbU3B0ozB$fx45~paI>Q#J|Lo zn^$?DkwQ}v3QlcReg%z*VMAcwPMu%mf}`iGfe##K)2ndw+egNO0nePftV&uD_JQB1 z=0_eJtR7dj!wBoOaeh$(=0VWBHodTGXtveR_5!s(J&?Y!=BCB66?$>Rr`jIDhK|RY!W375`>V@OfCw!+(#~1xg zQ=eb-O7PwBWZ^!44kA|lUsQzvf{#|p0=N5GV=;Zp(LYD8^82{YF{iYIhxC`w(9qiH zsi`Fp%(ojH((5W2m#-Gbb*V*PL~-cOigCG!h{U5#m3SmaUcP_+G)`G`We!I?#y`=Fi;MmtaP#Is?G+8r7 z)K1k|0(&N>qB8A2*grThc=7!CqB;O}+9j6$oBqr(Hu>mQ5_ z(3okB-n_~P=@y$)P_U`q=I7QpMMxMXN$JA-t`ES}h8 znWYXrFaH+s-I|yVrq+jG4(r0ippE~d>1h5P3cor#Jq3m4>MnPuhE&Jf3uGy!+;Utw zC$7!CGu3f*9|2bYorLezd=z&E3r&yJJioMpw612!B~1VIhp-oqlf&|E2}pC5ZFZLI zRnE-Q4c%M!HSWrp6jMzGfgK%{jye)Rny=)cZpeSc?Jwc6dO zGU0R7d3eGOLa^0{3z8R(N z$#DE4B;+{xUJP$#rbezei1EHqfi{F!>HS!~@H1;wGdukTsfj*Eg59MXLMnh83Th6^ z$6v2?&M21>{;#@bX9o#*?%4*teA(09L{Ww}(iliG?8Ho~Q0R5wjD9}{H774dd!?p#ceQlUiyV&ah7}y20SIGVt1dra3tle%O5w;(W*L01f14g$%S_UtUT4iU&jZRbq}ex}#HwwdoLXdC<|Ta4VAnYPQ&uuF`s8 zK!cW=Ufeql6el?n>r*=pyutqu)8*2j^yw>F8OXob3*`Ytn%p+%Y@%M;edB*JfJFNg zrA9)?me{)qV}#^af06g2CodIbztBW7eIUK3wl|3`cvk|{9We^9rtg??^WJP>aa|JI^D?RjI}R)edruvsRic>Dpl8npl)&b0PFc|_mNHHcHaTml{1aQqj)KV($f$cV)RrqjJ8pPsSuYusD7F#fJ~~nL=~MDIL5csO zvlO>}6;**b{P;Rwp58Gq1nlq2^vHWk1dv4v&1|UVhy|Z&)*#OQ#+H{rA%LlrKZ;Xlx9=$qVZbP8 zqn+7Mr}IbnEjFA>u2fWL=HAO3jyn54DjZ;JBcC`0`Z+aVCkHB4I?Q*7qC@=5Tql1p z#nujXUApKE)E+@q)?9{;ckfhZBh$kN4=xm2k7|qIby4h@f9BLFxugf0_(iUCTA zfI{D=Pjk|89sGfdYL>q?QvC6L>@DCgXCkUtm=6e_x$3DFi4SZ$Lr4t{Uda zvhHJp??c#_YfyXSsH;1Y3lg1xk)wlF_S`P8*c-`jg(LX!VD~JkI#xdYZ+6Bq4e^+P zYRK@j$9!5+5^JYs{CJE&+C-R=l5(tOFiqg??OkL)d$+%MraZr=nirlBxU{!jD4SEzI9*M>6JtG;U&;wv!&SbLjdO@V>3fSccu5{86vO21W1icjyDUr<|{8 zjg+tHcCrG(Gm8ek_>YJ&OcFXrMde}vB52=dX*gO!M|+ZcchB_{nROomcLl^b4Ei|e z($n=PZ!058L5cI~vx@59E9yUS%T|NI>YSO?p6Noof9|4w;@iEzAeDR1F)Jn?@vg>R z-EPGjb!@z5(LSEo3{SI;eOqC-8(q09P0(^CZd0#TWEW@jdIB*z><>if{NRfrOYuw` zkzmiieEFiUSM*p3?*bdA2+KXP0K(NzW#fk^)LMG3oj<)nz4ORn~Jh~{K2V>e?^jL3h7I>#M78{ph#~(E$;1k_ChPODuoa}Cjb>aP7x85 zi-Cbb6dnvjSt+6(yJb78wYuQ=+K5h$RDh|OVrsR`rvkYpTT0MMtp>e?1Lw7oa;4ER z+W!#eyS^E~BUExVCLXo*h!KOTYLs)N{~u%T8PH^xgbm+_iYUc`AYDa8M2aB2svsx| zBE73f@4Y1fMMP-<1tQWc)X-FVOH`ytRge}+=skoU0wH`S?z6k@KKs7k%U_Z^=giER zxn|~?b4%_EX-jib<+-`?DR;bP-yZ+~kTq@eX)-@X(jIhpOF-r-@4s{sWGykSLsjaaRpym^??)OWE-meA0P^jl zrXV+>gmGB<--Pu(2M#olutUQ0Uk+TG>D7qg=@0Jva9@m-M|No+UwUlpk1F*@_SO`GHp_eeNJ9Z_J6?D4r3d7X0c?lv=S@0GNA|qj<$VEY0d8 zj#j&-^({faB#T?dHDmA7o?TlTe|sIs_?_BwPG+vl=W9S21v+Kigz+WdJ`l0HmN*PN zCQ)OV1YVJ=v4=LJw6}f<*ohJ(LsE=#r1x3YYSv~Sf&Hlu3e*% z9YH}VsMfAK!%{{qbP4aGhaA)BXAdX>KVJx4=khgbcNP)A7o@IOZ;3n3Ohk;F0WL0EeY` ze~6r?O}2VacJuuKx5Ar@>#{uKd9(hTXzbMYlTqMSNb#Lt4cLHJ5Sc+aRy zmDI~R4N=~BiKrsq3DsX)GFF#NO1$qMWIpt^Qb90_X*zFr<#@Y5Z-`}-QWFz@N?z;i&QnvTq?ll>m@Vs||pI--b)U&{$$~Cdf zYEFZeM#K3nhk&JzJy>D*MeH5Yf}IQYdG)`Ynkg7C9$uM7?5>u3cdZ_GqPs%35+O}B z1H!wY$imXyD?%PRTIB;H+#r`rL9llkhuXXq)54Kpnn$umzx#y*(|E93ZPnGMFas|A zAGNHc&6c9_jr?Rw&<*B97ft8w2^fY|7y1}?Uq3FS^W{9}ujSwJu^J%X#@WvX^p|B@ zNkJ)?wok1+#D<>a;;m*6w_8CbGVQ5<$fEVB1O~Qn0Me`86Pt(F*_x!^vxkLjEdS(3 zZO@SVy{7x4pf@*3sB2GDqPqv8g>(&dYd-Vagz_9|eo?(W?DfB)*hw#Cm6DLeUFCE` zKFc@U4A3wqRJPc8=IqFrnZJuiMdSF?;?^B)CvFH4#}hRf*_Ic?J1)GjxnY3D;6pT&IOkXJY# z{}w{sQ|4ag6XGY+6vZL$Pyfc$Co=D*t_W2zITmsD26?l#ZPG@_YKL2;)6GQO9*q-= z9qVp-_6-sRos_%4#E?{x!`7|$@g5=y(m$i-rO?$=rQF)^!XO>UuWmb>%hLbFuRW?x z&l=ux<0F!}oK)?&ADdBwYe`17pRf(h2SZ(2u}+9u>1Y zso3t-(DcNvEDp$*yT@{sFDm_h6JDcKN)DIC>JhgQkSMx(3Sc%OfQ5LG$|2IilVPM(SKJ$jp?=nJ_j-dV_A}hQ3rl_b$ z!+c*8T0i%+!cmX11x5(?pzZn=F|7HElxoxVWB*RppX+Yc=Fh2Ye6Ss~wlH&SC{n`c zlL95TXIe;liM0b}sTb>dc4VSzzm1XVMtU(#wNk5ja_cALij*gB! z=0Tox2|0K4eQh5o40qFw{0P{YybM^OCbn=DOYoYmN8KKaQ7SL1is(Wrml1ho-@ojf zDeuy~j?!tM8=;lavpE3`Aq1p%yfh|#j!JrA(tO7+w|uaQQjNk2o3?`%Aa zrsBR}Lmw-8$ZLGZ(B&n#)W9|SeUvE37F03&DgX~Gq3cl2w+eU(dId2{CHdz@OwmrsI_GvLamfo5_x?t294k3!mS+1v%$$_k3@qIN_;WlQgcmlBHa zA#tSx(3fM&W%*Azeg|TYoQ84?Zm}!sn%DrJXEzkPp1kyqY1G+@gFP#ua?_%D7T}IJ=)&t$oT+P|NA?6P#^neiVz6b!s8MW)z5d7+OmB`217d;T{)F zK^(%T))nJCH?=I(^-*1=<3(NNIP?66FI`(L_qBqPuXU`$B{D;!!3_&pVbyk7txiMF zCs%4W(aL=I92bi~xBh`DQpxM(ws4`AA%_u3p*qQf&~{9akWIg3>Kk5^DHuZ^$zDNU znfH_lUOe*pgKfNP0Mr^$ZX;E*bY`%nVEtg#uchNbZf%QN*QPM&*#mWs-RWMFioZr- zkxQ=o&_Q7av-$FOzAru9HDIBX#ilfiJT#h zrH=^~)=GijY zq--!y-=@fkf4%VqedMxBi+@Bb_gn6cqelm3hEeNW4zoTlqOGJPZ2Yg&y%FeucrLFS z3>l~z-cEB=rHvwsaD?*2%to`(}sh^3ww6 zgg`F{dv}kLMhi%PFI`$51O2Oki0`4@#NL+wibe~}5Ctxy|IKE3daT)b z;a`Wj4gf06fx57LU(3HH1-&b@ti36yla>J*@2Qy0u|u3uAd!y%JwUP0FCbt0DS%YG z3M$fXL4RLQU!QH?{{78)OU}71wk5A#oxlNd!`ZWEzpHlq1g;1+n~4&2>-#Wz<5Ivg zLg1BARhGqY+RXL?HiVdP5WT8lrDa(BD9i_+Rh)OZh;V5kpv{S#Xg)7H0L3mRAYj5v ziK}@w?#3nh`L>GVz4^+Yo&kh&yFfvvH)>q?s0)63z-ivby=i<*81*a4%LZVRnN>GM z4XaesD`sMdD@DPBMyoZVe7m#AE~!;WoO{@?dufkiS5{=p!)#3o4AWR8gQ{iD>k4sN zLS!yFLHAs1@MsrsJ;Qf`d;HHyP~&<9x_B=^*IrmhO8Vv}B`5Bsq*m77@LILXFbwFq3xeK__=V^_(L_8-bK$if%Yn3nI z_12|@3m~sbQwp-|2i-!wC(s?*RY8A^QqoS8=Na%qw%}M>9(;q-Hty@$Lzz*L!e;uC z+RPB`x`nn)I(|$(C;#@ns42P7JgRXHCw}R9)$3lb8C%}$r=f*RkeQ!j7H3Bwa`A1_ zR3(Do-37g3bjt=k(X_~P)*R(VR&yjt_&>u`C@o9@2aW|$t)T<(K4AsrTb|HniMSP* zx3Z8uJ9t#WuQKKK@^Qa^(y2kR^Y9+%Evd@~ZR9gCk%8A^0_^7V^mVk39;j;FFe`I@ z3(i}LZQJX!^mV7MJ-q|UtGS@&rC)4&oAW3-T}heL?+Fr%Z?}%?HQdHK&K~c)$=v@7x>I{|ac8nlYP{0x@W3+gsd$_d z@2-0!*Xw0)DT+3yOyI0|o2=3PkiqZI3I1i&3A@(=?}e4kwPlz?l9qgdV*$<2;iCTp zHq3t=HG$Ko3oqOM7^wrjtu;`b_j~{ECE{!gaVNiPrA~y9dqS_dDCgkVRgokjMuc~0xOd9!^;pP<8!ykX_+359!*dI;h~vJz zdv9Y0`GXFcOKSZ@|Nq+O{*ac9_Ok;q;+uw+7zy!$ zH_d>eU}(b4AFnz}%8A+o@36NG!4)#}%md4g&}PE~qADQcI3&6YM>H=1Owv=^ohQcCmMzB$6^|11e=|&Kto}?jbv(IwK+yKT0X5a9Mz8_48EGr(SDq0P@KW>J zMeAtmn@liTq=29$(6nM+&+uz~y#Bw;CW#T!xCj%rQB>J31nHzuu$LQVZmqQmS}NeA zzx&inzUdP#E_5S~sqzm%teffYOjqk}%)(E7H2mpLn*3$V1_V+7m-gruGN&xsU*L$ zyFtGEk`j>fP-Q^#Qnv>CtmSkw6dNQz>}{KA`?|4uheWy7<2R^PWdn&H8`cI<07|Lb zPWTTTTK)y(UPz98A%n%@q=T)G(&UkAphnhg875{?mC-IS^hpw$u#EP5_Fdt?zOZ|z zG?xr|6Hp2NCfCs*whhP)erFlHhnQI6mB!Fr5(4z9ER+7mZ!7jx^@;;qiz@QuQ7lja zkmZGGiCaD=2N(Oh`H{VU1#-}q|8Hc%LPI8&Y>+37m+#B-u3bO?skCuohdiA=x6mm9 z0s<(e{QUk>Fkp20;2@_a@7tQg>chNy=Kj^kprwNbw)CGnHaZ0Pt@ztY+S1@^GN}o= zbR!(WqH*P?RzDb~zMiwJGd~V_Y6t`zRCAchyh&ic57g;m@INg~;kSjEK>mR7hraXn zaSd80RVQ#|x`Q@R{le%7&TM0UNVaxrmGC(gp#?U~(X4|aPs}H3%jy5!UioWTs)p}x z7_^nVl!@uOZEd3u*>5X;1+cHT_G#q>=%TK23_Im==vXsbcPn!FQ)Z9Xr4Y_#>Ae5x zc9m#ux8@==F}+#phEMxs*HM_P6S!IV2(YW)0(yK-@vUN>15kjcHoF^RZ&=q?!K(tN z7y|4LrFf%~4i1pw@LuPL2R`GnV zGtezChYJ`NO~PBh$Pa1rkt+wU2DN;Few4{FO|X7T4ZY0qE(}^JJbCB;sr}5Wf}p%n zwUu%mlx@&5$^f-Ubg@=($^ocScCVuFMUJCk7p`U; zKEIhW|MUNm9&zO7mt6_L)#G^I z$uia6A7ak4C+%3-!MZ1j4`)xFDIdu$)MEYP@`(QniA>${1mqdbBlm*F;!QTXPGhlU z>#PcFNr-ZQ43lS%mrvWEUwa;~TCI;;L0Mg3o&2?EJBp`1qH9IBDH3;1dB?js@c z)%q>!bSF`zsCz7Q*^Gp+tB;GSl$CP+k&42%2Aps)mmnzWGxp_gYS~}mvZi9Fjo?OW zScW69H~B&&-Zg2_e+F|NdZ4!^bn>LC40i2FSlCZ6kTJVK7?`{0Gx-$^xe*nVMPY(b zhc6s@G`F?(=Jza%=$WANF7m~9du8b$cPVPB{%?BEUw)*Xuo$~=s)}|yiZb;=0Mz{K zv=|68U}7p&=Je^S;8$o~ZXjIDe5Bg5ON@gdw$@^6K|1>a#d7{Jy!FH$it^Afo0nGyz6VrRp0R=B7|_fF|2T zBhUBGHrInUOoWG^!ivJO!_1!mKH%jC5y#)E2ieYY34+PbhQA4k_ZY`}Cr}O<9WQ#p z@Fwc~3g9Y+mV@*wHa$JvHEnjZ{TgPM8dT+n+@98~W;y_onRky%GwK|aW28G7;t-#A zH|d-kPqtGE1XXbDYX2G6SI2z)Djg?%XpkR9F<61(kEkcHLS)CwEE)NmZYWe7-AM+2 zKrcz?Sl63Q;$vX~snNxBfmfE5fZIkSy>>V36Kg#@cktA|R8iRdQs*c4%k6*chMn(- zt;rTB-)#^p>4(Su;xT0x9*CZFvbBkz+FUvwpFH>yJ`ewQ*PaU6iP&DCF&9qEICZ zCT3ESLC@Jjfc`V!2p9mFmpWbsK~uj?(Y5uLPOf$fuBw3%g8Z|@sODGSqnHwQr^*hs@N?hJL(VBY!NFXm zx*ZLpDfAQ@ZucL*jAlU|H(Otxo=q_7nayH=Le`W9Kb@;p@p@WFyZ?nO!)D_h7qCZF zyK|Ghx9uy>{fH$3n6fM4=7ff;d?ImWE?P8-963u+Ts)Rt#8j=f$m=>P(B?E$bC&0D z&%yMUlP1AhVRR2GCuOjQFVOC#_=m@;URPkbQ_V{79wa)uO!9}u5 zj6OkmFDZU^+)tLyc3vfMb$>=~-Ep@+>>|4^=OTwS-5=89VYRc$xxW1-dr=C!yQH2# zNYNcFacw02ypi*D@=fo+R*Ea}}xi(8!#C^;6vNS)hS9ibV);Fn_^J{d+06u*`I z5VUABRmM7*fat*{D|cyHCS_}*j=-x+`kmLKycQi#UDdtR@?q`W-d38}AMrcyYFP zBE>6_=ggrCS0o;*9r0%-=B4)-W#btwsk3zgd9!%{E2^K~JmJ?z& z0=ywWMSJ@!G$9{C6d9WQP{$I40Hx{HF|&Zlgh-HNc9*HVYUQd~Zs3j#-c7y{RKO$& zJq&GyYO2@1bw+EUL|&M@u+Vn7bB9-0TW&kz!Ou+g_1+Kz1G^VS%6^vkT|Xt;@P>=n zn%iPcVocei(=p-jqRsV4jvibtI_9_>#?pIMJwj;O(pX`C??>VFV7>#I4CifOP!kg2 zKBV%vfL9A8mYO$%-QcGi@ywh@@#%gog8URAN=GnN&$)KJr(SWjRd0ZLPy3blTiKa6 zp%F%w0cY_OYoLdHSd)p`E;NK)OU@KVVKTiFze0C>epR;~Y~ct>Uw(1%a>(R zJLu_Vq57yp5F>T7l<8}M0(h;4uW)?3<(Wr@x)$4R1)Xp$F_o>E_f}^29_@4dVlt<> zH^d!K1USGjs=Ld!p4X61uSgnfquF`Q7@kl!eNA z*TzL-r);$RYxBT*KelaNnM~h>0&BCmUB$z(EO%O8L9yh-RQC% zRVw{Z@$RtcR`I*7<;X^mMfC-XRE#_>9l7X}u}Af44VZ4kT*?y*j{0)ua?NVH0(bEN zy{uEv#Lj47Fe@s}6kHil9XV$dM;>Lp`qPq;db;$=6`zX%q?bjD&7fzK1PSC6zvO_Z=uq`qOQsfE8~=`G+M!-(B7S82CcnteHehM);yI5))OoAj z3q4lBI}h6Brt_5=?s*PoDY5t1_HktR*7?51Qr4JQg|SbEK;y zUn7Th*xIa8-F-hUjU77PySx4ZM;C=gvkXnDlsJ2=q-v~-WM@+x?G&j!bzHqnw@}E+ z(O6RjgKo}Kja`StmV3rVUh3rXdd>HtXscGs@caG9pE~)Nz>kxK+`TLh!1=w`i+d0~ z#$iVoE>EH6gtzms*4PstbaeR=%#OLtD)UAD`Pdf3hL+QDCs%4E?n*S;QOy6V8;clbE46ehkvuu<#jlv#qg~y| zT)yq;F`M2#XEwaE$scgr+#uCf4nb{|&+CmTD6P(*9lIm5ypExd=ZrV9w$nw1%f7v< zX9;&UQ~023K#&#-Tv$s~2^2pT#UIx+;NaFYJGd5}O!ZaAujs@Kd;}7eN*JFi7pc_r z=%NoUv!lMMq&-|&G1f5+ zyemtu00OT1apw_!)@-U#UAt<$2^c9sSx!04j~WnR-GTk!%TzG*+vWacQPtliMX{A0 z@*jHl>UaN~qjFGcWVfn9w-SRrrgS2T5y7y6RLAV0?WlA%6$OWE%%rueY{n%makp%= zwOLH$wAE5HSgVDRf^W~_?-To%?GH_<%j^^`*PS#!u~UT-E9Bjqi*DB>$HiO|9m;mA zJOWt;yBDO+wI;@n7@aM!O2tfKwNqm&Zs$LwJK6h4 zrMQP9@@%46&Ezk6gKq7hVSXJ4^5{P8>W5hd!`eP2)%{4Bi`uo@uP~FLqQlh{bCs)3 z1bv^i@5{uaEh2`nz|`(YZhrqP-~9aAKhIZnzr}{qn^$%~MIwGf85Pt7Ehh#I;Ck1a zr`v@$l&0bz&v;H6Lbq!Kqn;#<3BFFMB?NEHg$@6uK4L#7$#m)3K^TUyyB)<~ef8Uo!#yd@9v2&n zTWai*9$?2~a(P$Lf2!9=X=6|;QVP3~@L(}uTGVjsTTldXXT^+N5Un(q87!aYaly^p za+}-geAb}9Ca@OmbOy^3zn0QVI@NYJJ=*C7yK%X5pFLBWmoGFHcy%ZkeVn@P#G%)& zg7uBci-HCO#Ex(C!JR+$G*}6-n>>hXP=BdX)zDnOA8%IPxBP*4T*K1q z-h0h2^Ol$jU-2xob;tZ};0=Mb$QBB2mQRpq4$f?<$Mk!|9m?9b)U8CF8p5-&F~Rm6 zpuw|p?NN;>Ji(qk&CBN-GkMZQKYjaJZ^{onNY zHD9XlsiwTyqy###w-lC`fBby<5Zj>|f=KDvBdIifR!B(dZcM-U08t zu^K1hoLQRZ#_@Url9~yer2)gA=NOG18c9X&loEHRt^9O8u6YXo!sX2Md3Sdp-d4;~ zRY)Shnr!MVbZSh2DA0eNR09K_{GgW54i2}#mdEuLNNlGuX8U_D6N7%W{ssvN_grs4 zv`a|R>&Oy&fn}g;{}hFRLF2nfkxG4!N#5WEGYsLr*t0@hq-Eede}q&|{~I@Q)ppv2 zcFfiWEecz{{KHEE1pGw@jwl%G^D100)7D|oH;7L2|594tfFCS#OHyGohpiHUH!!HS zph2Uz=&*uPCc)h&OHv9qc8j@&+nQISs0{Aa`imH)r=v==WnmhslC{Uan|-q`@&jEc3&!94}Y-wW5VVqXkBh!Qh7fn&&OkmR@!q2E6e-)ekC%|7q)cX`C2?)#!x&kBn6?r-s^-eZWP)LDfnt2}|8OM+0DFvv z$qbq~Z>|??CkDeitm^}MhYi5uc+NsFsve#Zciko13iU;Zw_ zr^}7KT#51kzoHzTZaldDEsv&1Yu&=*o0tTZo^sgs`(Ow2YqV$~&-KqhPEBS#h(@Ek z=6$OdOw17jp#V+rdgiMPzC|kupe}8;a`Y0+Fu=ArP{Ui{H2o(1<)e|}2+C&gGO8JN z?~Z{1Zv<9xC4OwJ#dXnanDp!=7q%z4T+e`@PQDb!EWPWCm*|zRol0w@=~_X=M`b-Y zjq#Z#c*fT!SiJXcap{*U1_q_6jj2Hf9+UthV9D;Sv(bmfrorb+7x@_YESy*0r*DW@ zZ6q@sMAjSlTyHYIwv%oLfP=uTSF+1Ry+hj%UEIM+)Dh&BXL@1_0LH~1GED>qu{9JJ zJ`|zEn$}qk`z{h}U+IcQ&uQKm()sKA@${cpjfR&SaUm2dl8 z(y!5$>@#6u7upsfWM?s44*MBRI_{@Ly-8D0$<2Q~=GLprvqIF)SF9{Ro!rzZq!?Rx zDhz>_z%!aTZ`T3Y8Kf>FX2#Pmhyv?{w{Q%*yMd!WcW2^++t@b~YWzPolX7|XOK}mV zR$4X(?dTUs1MeDX2oJmj-N>BP7VSsTF``7+LQ#EZ3#R&#Yom_?_@w-+UpwF~tU&P& z0C+V{$hZzNH>L#i2d~iNTCIV|5D+Iw4i%BN z2&(}9IG&y2LkcE}hT3_~Yz4~Rb`If@#BZgcSWi5|`2r#wubUZt(1F{WI34L07WFt+m43STu@ zg#b?o;)7B8>y4y`KmGP3jxehUf_|yY;C&L@^37j>a|7p{M^s9p$+m8NeHHWeeB+7k z!Z_trl9vH524Q7iK1&LVxh}KQv{DO61-r3@oC*y^&$){53g?%s2#|pd$eV{UU~x9MYy*Y&+lju(8xFkD zcS(A?Q^+F7MzA^Jr98nJGhJ>g^Gn@-9+voCD;y#Wswh`8n-yf~9 zNi?w}-BbqpVFBfqBHyG9hwk>1sr9yN`D$8+F0ovH_jG5M z^9Jyf8}7=+IcV*oFQHZh2|^b-^(S1b`u287%sHd29~UT4ldVWM_SxEH;w!JhO3PM; zLk8WmQh$@`86V|!gx0#)>DsnU#$!}Z5IFOhPXIq_y)Z^j*pr+z8yxQj2>-#&es(aLm%w?#3LmG6H)wp?tz zy)l<)hK3)Bdr~QQD`k^p#s|YlhX6%H{(_z`kHT4IcjB zzt=1|pv0m$WiYqZbJI#Kqy1bJ>EuAJe}{*mk?{_%P{&58QMj@>z*>8sjlR zDgorU1{mqNmR;_sw5h;O~%qor}oKNH$bzUts8~7=kbKe0^{`(fS z=15?vn43!YyF-!BZiNZ__JY%)5g@kweUp{5<=9;&ADEVb*lCHq!wS>pURZw+WxDsX z8+7M#{Eba09y)LkTYV( zQ-+ZY>q~l~IYVw|6v^-A9g$M8z0{58xSatqfq%i2GWOw^J9m`U zUvNiAVXJhPhglIBeG3Elq9J901+{cT-qsexDx^YPKDZvFB?aUiy-?jC&#f58DuG6a za$esY@k{34Df!s;WpIXjpl4C$DAgXh;{^6cL#YHR0XCFhd_1p^T94cMIo8IiXcTW9 z{Bg%MsMj^w5-Gp)q9Lec($6n{NSdvZpOo%KmEj}ZqpYNNySbgw1W7w>!Y@lPsceld4Q+EmfKnX_JDm|Te4 z8m$;SNE89{_xffkY>d8k>DDZdV;}VU6&dFjk4}|JOI}qjhk@6V?tDebz&Jt$4QBCE-0%cj<{{9HaH8;?{?YG+AoKf~tn5YUcEi7Mx9>odd&YJN+R*m_K7wu} zXt>~$%=WwTTW&`@qTLe9?SsT2?#mZj_PV;v00z=sbrJs&%8!|yE zn?DVl%18YWn=di$qF9%V!H0Q7X}db`4*|q!BFGW9G(mH%^`55abrTCRWcrK>gsqy2s6>B*~|&Ke7YnF*LR^ zz~}7HD+(!2j?Ht|UkGC*!3Q2_u~iei?6s0>S>(!$-QTK5&~WJHH@hDDl&Q-AsgI4P zQ(@MI-x;TOs*D3Gk8_cxFXu30F+Lu>$BN3Ft(#3y9K?X#a4ypOp%+?W1D;A(sVck4 z9QK0^+l}KpTWO74y~Y!}8fm_|mjag0a+9X@rEU9awrlzA1DGb@W0kPw7H;XpfqfzP z&0%E386O%HfQzxr-{5ag-(bOmhz6ZJD6anzvyw%>GSZD7dL-R_d1$e377TL@|5u(@x?{< zl$KXJ-M6tOK~Z1!sDg>X6%B4{S(g)a71H-{Sr&k7!c5CY$8NiseDD}>F7B{|`L>C1 z7!6YIw7^k;(<{-jtBoouZ;A+J?B+R_FkWpKTGBJV{d_&DE8EJ~t7WH>X)m7tNzgLf z*lFjssjZl&3Z})s$e+K$^3*&h7F#wc9X;p* zVm2*^Zosa8)n0Sx_Pv{q0z++|Iz;%@)UHQ-I*)PQw%7n6dYB zKepo5m8u8hZmwn&?_B||x5pT$Y^p~1bxkWX(ZlV&LdF$Kvh|$a2KDd5bNc|ZT}dLB=}MT#$WqHH`Z?d#FPa<{)3f9QavJy0UyW0Rd#H~G3l1p zgog2N?+!9n8bv8$mCTNDjB z76me;A@HCh&8*nk*b>>i)2UzOqo>yrqRSVA&(ks~xC-A&gG_CvZprd)#cgG)vKw(7 z^AoG%rOTX$6SF$(Dq_6T4ZEAQ7tBKUh3s{tJPKP*RKa~)k5U;7_n-)36>FA`aFHgJo}c2u3o5qvC@dJZN|ELx>l4k<9wtn<<@dKDFIM>rJb7rYy!OqD zdp^JdrgK=laI0U8O{>N_Y3v<0(FrEFDxgi?{eD02o6&S9M_I57sOs^Kjd`aQCOX_v*USOgm9kfv@zS)}BNq_z{im-Irf#&JHocr5FP+T9PC#eCLZdnNb1$~PMV zmqw38kxmw3m!1Z36NUE~Y^9w4OvA?*rwwK>5EavLu~w{D#-u|`ywN9GF9Ze12}z`c zUX3f9hm0mlbqDp9q9+z&;ugEmrv1<1!hkSYO1X5Zx#DwR!&Td`Owy@)uWL33xUFrf z(muZ4UJ5@9R=4>G343R=@ZE(2TCup+*WmTNsOYx8x+eRsaXgrb*A2CKT)u{wrfkJD zkksV&ugaUCsNx1SD#4#`gm!FdWNa!G*DY>ePGoHEY#e1Zh+3cJ&%~wfX(b7gI_w^- zZXHnWB32d`Ru%kAJSkboeIA+s?^WFKY*SCu*@Bk<%@=aluXpp7h=iYkS7i)j|U3H&894f4s6#c zyW7=^-DR3r${Jk=h_jw=pjghJy>~xq-kOw?2o({{2D%dHcZDR?bBG z_5&ooyZ+D?{~^ufi3d0#o^u>7eXdlP|L|a9`mhX7zvVw+4It6U(TnaLp1e!H*L|=- zD1SD}y*2nvDB)XwpT|=RCa6oLqNLaY(mYUKMM3g4WeQe^>~{-*G(#Hr3vfI4LtEtC zZ#tV#1&Q*C#q|$4yLGv_^nOAB@aLAVvKnE=-2y9LX81r^IigvCqRtV4IcASdk(4sX z^t`QsQS-0rZ_A<(EcE+A2neO5ek2Ur01nZanThSPp<8z_MVqHi3|CXiMsd%T3tpS? zbtvh;`P9_pzg63&`jnxPcwe%rqS3kcpRgjbC)w^@Eh53~6L5hUA@>ya>d(7W8I13e z*U7Q{j|Ur=9#P63?NN=mvFEdQ*^T&qpFzR)ciQxyjn~?CwgMbUk-bMLICi{42{>oH zqgwpQPO8g&WUtBiY#^i8Y^1X}E&So`F9y!^QtuMz*w9>0;KYD-L^0T$#j;zS#aN&WL-rTt*!Z(ampU~$Mjd!n>dMk~y;hD{; zA$l-}W6_eU51^*p8nUk*@UU3Lv55xxJykHCm|n|CTuwmVa>U6p z%FK-@wkL1y4b20kCPJ~;8CEt3;aX56U3SgmL|t|n-G~E+lxs5hm&uVQPOZZynv7F2 z>F%W*|FRHY1HWu(CB|MriPhNZyT%ChvydizrU#G>dKvoQn&03Do*dX;*~4S~ z9XIc08Z8BA${@e!E=$6RLJt$A<}1#qDO0cO)J{CTKA;Faq*&Wp3@b~ue?12_{$zIb zIo&-(QUuLcU#*cLm%X1|_h2{(F)nxd=-Tpo;zYBp8dZKBj>vM^e-H{#StZ<-f@;>O z4J*KSX$y)`m%(o_bR;&y?e+p86|0dmDK`Tz1sQY?ihpImb{&Q8p7DTZ!;~bnkV(E2 zm9#yBuIvoigPvy9ADqCMkF3xuDXDfn8D>-iXw!5ju`?|jV;8adW$L=Vb;NYni>!iB z6rFj>B&wN7v9Mn4XX{GI{t(TO8wWJM)H^tma~lMBp}XHYr)DHY3zSg)2gOGn5d&-g z%Ep)h8Rm7cxfc?Ojg8)*oWF};RxNzr?6Qnxu49DA)-3b1Uu(F65gyCrS%G4mN9c$u4!J$Ka+?H+i*{EH{eJK7Q83bT1uQP_}i9d@lpd#SAi1 z1rfS?6a$6x(Py;}R)t%Q_Woev0j3@^Z-lNJDBwZISL=Moe4p(#@P|6CX=Iec|v{ z7F;?p{f%HAn>zi1{kd!>prv9u#2_SP=D@!5l2-=8K6cG(k{k>Q7QneIg~X|2Zi+kc zDtkY+k~DBJKad{r17okGQ$VPE-ep;7X{EeapY+sY5L}TXOO=$oRLdXiegB+wAdcX^ zN0sVdx6&TOZ(gkuJUEJaHZFhl`=&iOUj`;1}&O&EO#!nO3 z)XeQuuZBE+I?t}_Z{agt2Y0E=Iy_+0!;pQ-Beli`U;9A7cud}xT;>5R?d#$YaYuC= zGw=Mt#N&sD-EkG1^=?D1zWIb=t*aGP__Lx0?nmM_kL+YrgHWM!?f)^R6@^Gh*|xxKpnc z1%0XbRmihTvHY*!D5<==LQ|-wX8nnJo1-VXXw`!UZAGwxpVG_(V5aq%1J}6-39pqJGl*^I*jR z!Ii8HU8#B+@?gUIRJw@d@qmIs_F&kP;ytcG6PY;Qa2g1^a5oqQCxv}Nw(+W|*`7=m z`!sVjxS8RsfdQ?e(&Ef)Tev*VLv|rd^l}N^dbO{?YxFYz!F=D|$Z>fO8en|S8`gbL z82-UyD7(fYUOZ;{XptYPxkwV>(&Dmp@Op%zt-=IWUm;+*T;^bfH}6}%x2M$^Ntq$z zRqC^|mXs|qB)l`Mw{#HY`y`yadcS9s16y;yMP55{l1=Y2k&K)s>Fj;2zi!y2 zsmWO=>_^t%*+L20^L&N>OuE^}ZK?F^vb4l9_)Xt~WL`%+1I7MGu>A=6WbpY@`SQz; zow!M74`&QvG*W&U+rp_8xvdx959OkUjjN+Q;#E#uvRyWQqW9!(>%ABk-#&PH!;Tn+ zOoGq*TRicc^jnsaS8miBGy-OeG?IljHJZH zmXWu=IN6n{AO|*wh4CtT>V2^}ibs7xZQ%5}Uq4ow_4H}USIeNuQ)7pMBi8RKi|3-B z>Uu9FrwuE-y5=IIKb~JZ>mf@@W!Kp9z*K#g;gS^TI_-O1t~1?g(SEKAJv3oIP<}#7 zUMVd@n<%STOG-8bpOj5_J>pqyu>p!m0x3t*3HI|{I9^b$DWcwGA0gcdFV~+0Km6>t zU6M@?s%VFBtd#DiLD0a+7q^b@`)1_Y&_hzGRagE|(Vi1YGHJ^FHe{~Sm+h1B|F!qs zUrhyFyP+4UN)_oUi1g4~sG@)n1XQFd7(klz8bS%6(nXpe7^NAhA{|0e2})BshNd(j z^iCkjJ?i_dyO!_$2ku&5eqiy#oIT~7*|X<)o;`CPfm$yndA;c}(1*z$w~#*w9? zxa;=m^=|~fkd8lWkqq^=2&%XI0rcsy)l#-!Keu-idE$Fy5xUjwU+`G;!k%J)(q5qP zo|K4uy6U!Q!QpQD(aZm5(FMbs#9oWx2`Q`kN8RF%$y;YGYMkuEq=cvnHdxjk{1*;; zzObSgQ{3M&Fr39)NEc#ylH7jhZdRMH|3z+D zumF&=2Ob_89&t+px_c*N=MNt+n?2<4nNGoKjrm{pqNv+dog;-``<8* zZ0V14AX{jSzj<)*U!>CehW;@OFh=)R7BeO8=sPFM&j5WEm;#8$f&n@Wt2NVq+r*C^ z#twfT?vWa)0cvo0?E5h6M=G$R&5E)LYyYoz_ET6auTO@A(S9*`LowlzKf`6SJeB1I z3u(-j;1Q@4J$3)zA+p$cX6$t+79h9hV_YjKGI&4SXRy$kcY z%!iMxk(GNSYfh8k)kQ{J?8`Ssa|1>v>{~YDW=QISY*w}E|MmF^$pDH3viIl&4DmR$ zp-2sQ%2%lXo~&x$uscdea?p}RuZ%1I%WDPRIOx~H=GpFe?_{EH14Q#U3{ZE5_On52 zkN>SgF)K8vzi}}lpHN?P7BDYYclYAU5~{a>S^s`|#W$92Y}`1gv+NKN(fqP#d*-Vk zt@)b3zhj?tW9E0kI?FboSpTh~fZ4wT+5QGl0{uJoX-%1gOtt!=6;AdvT8BJ<4eg0P zhZyZS0s)eU|C(K_(s=8YJ1e-%2eJm0 zjmsN%8?-GuyIap`fEYnIuQ4ly{R9LXZ<*0(HNwBVPMF2YXn@k>$+eZ+D-)S3H}&;t z?_&VkXzKmXW5~&PIjg1vpQBZP|GzZJLH_XD;qu|i;c6+X@<)%D9$Ooy*N^MCX{#SVer*Pq6MP6%@b5f0NTxgIw_@BUcs!0S z3Izu2?pDWd_q8)}y)JaMLd?FL8G}}9`gatX9ag^WDG?XvhD(OuNLjso^eBfzb!CxK-;6?VB>0$~m4axy@d|6mQD zKZ9slCb_uB)Bq|L;J5OyXu5E{kW|RhcgljDeObfrnSdPLqXyDO{#K$@z&iZ57$A57 zP}Y6Qy^8@ZH6#x9w483St`tG?c-Zs-imtNp;4yhVrtWXq6=+dKA*QguaJu&tl$|{% zr1xgi#>dC$q<1^^bi_-7?SC5y=#xyt_;(coF6`Z}=?6@jcRvA6p=-uVdD|VPrOPyt zM#5!p{Vm&96j7L5m|s}Yd+ItnJ1=}Q!6f%L|KE6kaLzcc#Ng8qOEJxVtC!dl2@u^A z4REf>2aL*noGfbN0jRPbz6c_Y^|z9&w!{9f)iARay%qfxgOx5AQCvjCDf@zv*>4?y zv5m*hhxk7s;%wz#qf;__LIJ{i!U6Yc>;bFN_ZkOx><^l(9ZvdLnu%M4$}l0qWN*VNGu6hwkzL8>?a)9N8qW*xd`jO=2ynk3CU_Hp(#z3*5t>JuCmrZ zmu0ZPtJqf0gpaiXOLiCdC@cPNvy&s0`Hi7 zbeYfd2={g)blf`X?*p&L0a?o-xpbyBt(%OWBc3#~$jBK zf|dY%*q#yT(|;cRkQJKHlt4&OOAIZu2A&3v67ql6Xf!6F*|hs+tWOO$v~m1ZqJHE3 zn9hNn&#@k&r|tdU#s;k1Ff+ep?qKd>?yZQIUXfXm1?tS{dRK(Y%D+Vzl&oo4UoOf7 zjy-pnfyJx;*7uoB?r$d4$|(Km?1+7)+T+m2O^*qW)t-c+t^b$;s!zO=DKS;%Z?x=f zOb+_JO!#lr%LFXl!F&4e4D3U;^M_=b7nT8rVcMPH&j38QWjv)v)Z^FJ)VI@z>%SN- z%PP$+Ehv4hudm-FdB%9gs>yy?tB5;`gxVFH6Eg{Rt7vpUknb5|=IT<)_H%Nz>PK&R zkw*8MryGEYH3k3r47{$6U%?e%X5)@YNNyl088P{L`Iq_Ib3pIE*L^{mOe(0pg0e?> zO}K5utfP`q`KSsM2Gx(6My6hjoi*574gyxJZCG6DObpE`R(A+-bgh8u!d#_{3mo#M@ zRH^G2M(}qowV|j^WGz!_J^XSgS39AxS*JT^j0Zm7Vu_kCLfAFAyjzE(LMuzeI0W2C zcA2UYu%WoD4m?R45mzu1*lf&RpIY4=JgX4Q4~@)+U_pA2M? z9F}#Dn86JD-^g(iRWCG~*XD}IOd}qjd?q~gIzSJ1-#uKm+0GcE2Vg!2mIBTK&4RJ` z8r+r3uP=a*%|@&Pw}49n9zD8xpm%kz0!kx(2|z1%kmxE0dCQt=+Gt(R*ukS6zSAmu z$x7Zm-aNF_%o-2@h!`tK47fT}&Di5BEzI>>+)zU?m!;%Q!eaRSbl_N6zbxr9Xh-q5 zII520e)qgPv!B8SmX3>0;;8KfQ<{Ub33zw9%B-;$A6%Mkm!prEuLGDQ!^ey9XovS< zG5}m0!+uOP;Pap|W#G}ly(&_7*Z}?~@j(#53rNTk*c^{pqgs0j+14ml>~5~!EepR- ziF2=STl!iV96p`$W3wCzzv(`&te`4kSwFN?k^y9O@3nwU;IJV+y<_6tDp2Y{B<2H= z7N<2Q0?(8S5IVHwH4bhS)!gw@=x{5h{#Ft%aq?UMXw#1&6rm-s-`iCe^w~vjoOI@( zx<0-Ga;i(TD?+RO%^E8*e~s`NK*XFhiBU_PLG9XKgF>!TC6%<_#?FD2uJ?K+cyOU- zTc^e)05>Bd!Vi03U?6t8W;Y7TdEu}UYL_mhl@$oQ8EkFe-Z!$8rowwJz75uqTFhWz z8$&sGpZ-d}G|_A@F4{Z2u+MS61T@2szL!4a#gO?^$(yx&>^Ol!D0ZB9P2E%qC*(%g zQrv1p=DJfbM{s-n^pq~=l~sNM&Xebk83hUIYvZ2*)u9MAaD~epY9uq4$6oruQUcvR z8%(TT^VZYUzI(I{?ZZ4-s{riACRED6+eo%e_Jc5?eQ|iX|LZ|AH~N_LDugd~CFe8Y z@Z64d7QjF6+~v#TdX6!h3_61G!5WI{h3jk8X|g+?W3CA%c^;ko!d=>ZZKF4GV9!GI zoPbOZ%}APvYYJI@^7HtxR2AmR%*6l-vFm;J!!OZufVrF|B7$*~rSE>{yQN&RAt8{U zK`Vlx!_O-}3$NQvK_POHV5Ij^na2K>x*kG(I;AoL0Gl_S852(9CY0My3_5f3U&#V& z_FqYK)jE^|M~Tj=w2{q7(m*!+5yp@wt5Yk`+I32Byx`u$DQVDoOJ~6o!=1WcwJ64H z5u|1!#d2K%!yfUGJ6G|s6!8&BbzD%eOM?3DaV*IqaQVY(Pz;TyDlkD-MLmLgJT#-g z8*oC1CNJ7YGOJ8_CI>~zhtL-BIYL084{RHJq zn~}DY^H<_HF)3wauK4gNq3^tx0j3h0v){TUbnw~ z*sN@MaQ`CZT^@?g52!XC;ggrYz86l!)p0;MzUeWje+LpyrQm9okoGF0QeC=yTn4d^ zK&jn%$sR9JgwNFCM86VeK2?H5OQBdd*bM|e@!~Ph-_QApitA98ozYW_kz@v4Y7!s6 zjRBl#PnZ!%FUlzGC@et2vsV@UMjyd_tsSI_6GyZ$4*`6VJcJJhEiwh;?G`lJi>}>I(>m z8T%|<3;`YXKsA*%gi!+Edl+sswy|;ohJo5)p9G4!|{Zj|yCM zVJEN?)2r?sLu+wzmd6V*#J;n*MGUoSFKwuIY3IdJ&%F0@5gO71IkM|>Mc8-}hJzPC z>ETD_r38`Vr8B6|0tO~p(fwGBlb?R5wizz8ps)}VPTCSR@#&g6q0blvY57T93aN6~ z3@sJ|&DRJQ&IL?ypouA|K0?Kcfb)@;X8$rY5Q1qL^)C=Z-ZlAI>pALyZQC`}wcn2i zrav*-bIX3q{;OC{fKjvms_F$x;tLVd*<*)>3Wc3X%`h??rvYeZi!bc zrVrC07#Uo?>Xg`%o~}gI;nH=`H*YfSpjD66b$@9J?Q^O!+cp&M5*YmkIV@xFkJ_kg zkm(wTuF4PCE$9x)#UJW%B3fQb6$s+Tfz0IU*a7lmsAul|E-6C4Ri9D_NJYzX#(FYE z?m7JF)_gWhy=$JHn0N3q0ToJgpdZot2z_o}uT>9_zX#*0^Nt;>3w8c0m=e->m{?bix1@T9}>H1X1NL{7a9D(=h?;16r z6lNXQb9qc*GEF>Db^^pzgIjhqoQ;kMN~DK zh<9$g9N)40`0(fhN&s}4i=DK145>m?4O}@S*M64YRHLVbe6_vkaqrmY%I*0ES+$4; z*p({XQVi92JiTE~xiZi0#JGd61GAN5W~ZP+_QDsf{LVzp^)ttcPLQ77Ns}Knj}Sbw zJ4n#GhKRE>A<-B}L=^~L|sk1{4dz`l7`2@HRrD1J98jED> z3fRzVpkwXvxa?qZex8Pwv%|<={>GM_gn4&W~ ze7g8It|6fDWEwriu;f6j@|d{_`>w2$+X0lbJ%obBCy-M36!`3-M{5ZB{V9+tTv04e zQf~Dzg;34ljcmCNf@f|IHJhY`#`XU5FMrhWtg?e{n0&%MV!8nGz~<^I;$mjy;Yl2^ z93iScHyICN-1QXk7sQC+PU9a<+CJy>YW)C23M~3eAcm3~{j4KlI@#)~I|OK-W8yp* z^_alrh2_-gQx2iZ&KsJiG&7>aS@<&7rLevit-h$S|V zeOe{c2p%C}Eg%j$pVucW*-f=`jsV%PGGhA0KzY&Sbhr;+hoG!+x}#S7%b36+KG2ov zv*?^oYA20bb&rwkbI(10yAk;3yTt;y@!G}{JTz8fOHO2&lu8%577QSpnZ|;_|(w^7pz0EL=#7EqYz?ZuP!I^*BA#m1Y{7JjWL{KavHWAE$izkMN(FN{ z7z@ORb0+=I_;dq8kG0vns#(8rTimPC%obC|VK~t6Dt>CV56mDxo{b1@^b(uPfT=rZ zeEnz}d!~;408A;?Ro3x4D3}Rk7>O_x|F9OmznV+^B&|M{H1Vi=r=@AP=Ncc0zEcb9 z!hw^suO_M}F>`kAoq)sN6&YL}iw!-F+F#q#Yn3W#XVITjw%CE#v%3nOMa$(LY;;1& zR3_^5Ai;rKNgm8B>nk0m+JezIPKG~Iv{!h z%gEm?lD9vDIkQhJ3Q>p0FJ;h1BK2#2CeImec=T~P8R3mUcOya z{`1DKx_mxWZ2Hc%l;s4GHj|o07fH>)A%LXL+x}?60<-*h@AwebOm8qMfg+?aL`!{# zikr`tNb;gBwxpSf+_Gfz9VJ-Uxva+Eow`7Z*^TstZa|t)DRzMsG*_m^_{EA=Hvi|f zU%C`o>2y~C4+zU*C&&%mH!7tpONmFnbXTU@+;UcZ3e+laus<`I8GQB}7<7xbeV1c2 zj|U|G_HwLt;zQ>Q9cLIzA%zeH7Z^W&kwWOx;T_cT7iVJLxiNrJyrr?$F_*%NC+qC} zat^Xd&(aYQ?49ngcjgbzoD5!MKA{Jh8E1-)#i0OYPd+#b)Uock*^uRezt^_7+x@$N zP2FW0FoT875cWwEGtkwqx|@n@NIeZm7sn$Cp$#}AF(wC4Z3gSTJ9ii2$hZ38A)++8 ztD~Drdmp09J#9gti<;-wtu?f~d8) z>-g(G?^`dX2!?M|6|{+3jv3#FGl4|IGsC&W;z*GPghkJ-zhRuf*mcbd z4C46X-S3I_(n{Q>S5&b}76A+~DBQkSWpwusqV$VNuHSHK=~BYg-&tU zo?V#|@rc+?l*$H+cAN7XYiFD>CL%0fUtd z%!dNp`OE#t0~##~yH=gDMB#X@5;J3K8X|6qpr@F=yk8QoA$;y<>v^_#*4PzahD+3M zk+B;6^P{<48t(Bc0qn0LF29FJg+4Hm0ww+sfyY2ts%GS_EE1z+Qv(IvrNKM?FG#t3 zCX7Tx=P+_ZL(7=JG|7z~iuAk5U?q4T(NCovt&tg0a3feCamoh*6I^Iq zoM{es0FG@^Q;@BQs3R}Zwk%Q4w8)(3NXHTru!7?BT)*F9nsk&1fvk)7(9orgW-Ikv=CS+Z1;3$Ngh9X;9?wZigHGZdhx?uK;*KKsFGY`rpxr` z$VrE>01xiN0UBt9xti`{QDId)!UiwGVjUp@aj zY!|Vkt=ScSLVt=rHk-NKgn}|%MO2a%r0gYak z`ab&F1}}GS{~~ib!bYn!8J`s>w2E0C99!1(Ir^)Cs9_aQXP=b|HGTB0!OR@ay?IZV z6hYKaj2KDodI5|9OuYh3BVk{{diFl3@Shp72#E&}9$q$$O${@K5tnvJ@$YN|eGET( z44YV75I;IrA2C?L59lh}m-;<-83b~*_Kk)Xo(8%Bu2%oh#JmYnN|^b9BIGS|dw9pf zZ0rSpFnWdv&hW2L2(6CW8qT~-+0puTD@0&9u?Gb#Yq(vr3Yo6sPwsQ@V&(!n=LQO) zfrTchX8~_U_!a8=AyrvBG0-Up^M2IJm>l2UkD{`U&Aq3Kq{ziMP2jM2EwhJLL7n66 zO)*ac^Ir8eDTKSz2~*#d^-OEeNsZe~9w-P{HZh&uanvLd0mx7$cqX5I50vVYI2K@1 zYR`>ZA{rHNSEgVK9d;rHli``zmnk{|AX65rD#I${nWHPErnvk3b4)2Z-E>>6LW%cq z?_KiFn-E-UnBiGV*Gl&iVCuR$>xSbp0l}5ySpoy+E$84);o&Y0coJ_EHvYlMEWDUJ zD0aKer-t82vw-FxrGN${zx zT&cSzsID~ZGI@>{opY1jOHAdpj1XC@^mX@Awbs3X%;j~D| zR_lV_7f2YvJnvfi;QEfu1xwV0k`q9@)E>Ub8a1X|6QIr09>I1O0c^+GfK5wEn9(ot zBz<{Kh=L*)gB86tTlNR0H&g(2+_ff;6W0p-!mUTHojMHXVjbBra&d`3g@mcWm}tQo z3^VJjBXehD-{lQNQWDft3~Z)d1YA&1Vp=3r>zzgEbd8lRC#h=6A$}hs+ku}?VOb_= zmvSG_?ehyP_4M5rvV_?dY6`0s;MH{ll1#sMX`fYM8F3oQTyW*PJY|Q|>(uxn+19=>2 z)igEks;w$*0>%GhUFZsM{iNxId5*F0i!;Ns97d+>i>eQw3*%-(kw`?Ik&K8FpL9lt z*7W)?;?GA8u)Y)zTdR}wj`0$vr))Q#x}z4x==m6HkSk|hkdJI#67g4knYGz@aVGR5 ziqM&i8KFOJ_J9BU-x1LKyi(-8aM?wqCezD06uRtH)bq^CR!!9n{QP#Mf30&4xyDPO z%A<6;Ib;XmcM2ql<{00^&A7oNBgCC1v*o}d>X?C(s-T5edVL(B;T zQZe{NN*ubN&lPi{$qIAhFHzT&ZeuLie~Tqe(J1B1EtYgJzz~t8hy~EtbjiwerLzVn zMY~V`)OrPMwp?j+>-y*#8~VVj(RnHnxwLDtytKpD1#*yvU$ES804UU&J>?guGCuTD zJ4TFZX8=l`ywM29V@APQ7RF=;j4y4~)zYrrI5434kbZg;qda&Lq9v?HEi!q8&Q# z6_p@Y;94&my{-(MqL}>{{>fjvJ;=KhW>PH8j-H639wJNG<#d5_YK?>XZuJXASQBtx zXRro;#-Pxc_d3O_Es9Y&`!g4>JH>48D?5-1I0T5ACKZ48PCb65)%Jo7>zpydfp8!z zuQT#~5U54EXes{3-hIk;_3aFX0)V9oz8#^LvNa0r(<*fMgH}Jfnzh+DXlyJf(|Xa8 z;`e^vS|0iEAQrtQ_`K(oqW2QP8k<3qvIM&wLdL42eNfM7g6@{C^9kbdeK@+G#zkWB zXz@0PCGNz7M+I~q^tf^%YEVxvz{m!PuUpHNr1~U{Bih%Ih<$tB1EWhGH$v@71=1s< zE!+V((X)hNam?u8)QDSPQ06p0p|bI6_QzvicxhdTS!qQUHh|4(&fYyvn9%cA6q<`xajG9nF#yt z%C-*xLPOH$=lqfi_$%Y<&KX=Js{$5 z3gkwTh(A&XY3|&ygeQhqNLjL5-Rn($NgzaD^pR#6fgi9~ef!+xnd|voP6|i{ zq{oXlUGidO8S#sd+vTpK7R&pY6(^J%zY>8wMV-OkDP0jeA|0IYaSZU&_G2NarYq;h zB+jj#jYRs$Jkv5KIPZ|R40V6v7qmQfehrc@w+inTP%=}8_YQ^>`VT-~)E)RP8>7_9 zf9u4xqXVcjv=4*K{rFK7DIxbtVJmWPrHIvR(`J;$`K-bWmE4>MtMW)0(5S*`NAKxOVj$|JXW{G+;S|N@MOFKQMsn+>ossSoeb#QFL ziwU#Lr$Mg2u=Yz-L$K}|j{*65%*$`oM9A7$_0#mdt^;GJoJ2urW=h*~es(ATVt*Yl9+V|Y*HDE48FD+=vGnYE)I?yH(A z4*X!fG!RFE!m(f5WQgZ?H;i}F-wzDRsPL=hkM`q@$+tTjdIJX?&HsAGE+M~oiP@&s z-GI-8Bt5G`0Qs)566fGH9@SxL2fW2+GYVKSZ^t#Qw{h5#NU`y=Kt3T4GAK<0WGie* zqZ%6&IwcWJVeceK$YK9P3{FY|>yE_jxozrveaf}2da`{vj2$``G) z-s4vsxwKc6?^(#UT9v=aLa$5jm(7sTAAJwTKJa++G(BgdgPP4HR#1*-x9?d6iXWHp ztY)L^r>lroPXmx=!jpS%^Dzmeta%ocFTv0M64K~{G`Gb|u+dO*QR;;2d01}eLup(* zn$szSJlN4M6S2C{;AugE)7gH?C}Gd!p3xm%c2E&9=V4r(50`i^FWNCag6A$`j%Wrk zi?EDk%RUBj10AR?%HD&RxY)?|Bu1tX&!7JAe!PCL+EHPrA4=o9WoR8-zTxU-9uMp` zz3WZ(>+!m^{G_j`aW%-$@WthEZ3kzKIZYU?+(&p8M8B{~=3V~4i?!|WBT)l23xCpJ ziJoGv(o@>V_BnQeAsLbI{={;ho8V)n168s2{pS{L4TUf#Dzj5+=W~O(gvpaR0o`l6 zA%7zfUJ*A(xjRB0FWcuhs`A8i-9cB=ns2;2_hZ+%PN$0NGgbS9u42sv$X;qye2y5$ zs~EXwpof)<@;Z(z;G%}4p<@-!lpH0uQvKAfUcu-Lm4u|F9=MXLbiHW*ojJ=N9F(fj ze_&C{OG|Mpm?O7B?eQS99Wu4{B;-XD$B)*>Kc)d3T+7lZ zK0Nlr$j2N!#S+8oNMe0^)FGsY-&n%;L9am^24fNKj2yt2sawn7_NQ3e_xb|MmIbYmlSjIRPFe*laTECyO|OS zAI2GLj|A(w|2RVZY}CiHMAjwcUi}CTT4^p-W;uX)a=+@yg~nfFH~DC7*zjObniV9< z(Tg<0KAYx1TRTl2VBVYa#hnIiPv0ml0e6e|#Mvx+CeGWT?BV)%r zR(G$b3#r%wk^4moD9yJZJx{Fya)bnF>48i(?<9;-8=&uCx2!$&I+(>nhBk85NzzYh z;G{Z7=d-8W!wbMRaT1z+8qJ&ZMx*k@_c9lyvqTw(fxTt=we7tbhLKDCM+BnYi(m=a z4nKA@2HV>lj`(s7a3W-vE9Z}?jtK!M#^oD7B^$(aiST&^N3S_nrgoDDrYHd*zj#3_ zD3-7<@L+m>0`@!O&125*oR_Wy=B z&LHs?@#!2N9d^TSsx>Y&>s;uik@Zjq4mbc6n4hIme`3mb9oGKI9mdQBx^cBDHGXJ@ zK9s&aoB4xNqCRlI`KtI&T(wW>cVDB+vd3}vDcPb=MJwiu;#>lS$Zd_gUtq^kj$FdH z&t@;E7*7D+!0$YMb_-go?#0F+UB@~?+?j}1)nfoLyru_#XLqUgK?}1zWM^3dIH<%Z zu+BrqlGpFN=PSV(?&(`GG?Q(1ARY&c5`cTpO421OO5xaDer(Bn9boX=8GHJiHgdNy zPXXi%Ey6b@y&hi})TZ6q2{@2pUk2uewnn+%{k~$fwVGm=_xR;U}(kE^}o%Elj zBNREM+bTQcrW_Y}Qh@LGLEAT5yMrlVJ6jst7V=S0A==11kt-e7g)z4s5}xqrmuHp% zz!{_ecebj9lHBUPnfrKOU}^|_vrYcw`DGo|Bo%kxBV|Y;M=|jFuQsK-lNaxb87M(g z<$1Q=&+!x%YVZ}yfX+Xfdp5sIuuBX6aJ<6J^AuP>`S&d5PiQ;hP zwD2jw%&fl$jBBxs7mZB@j4aN*L0vj>GBXCkl-iFFg+hf1 z58+0mwYjm~w=?t61KHRmJ%?+;4Hr&|5g#pThKw)jyJihagTf64!KN+wA?dgj z#*ux%+Z-)v0oi?P@5<-4`TnlP&W_^q^w#3P8odNQ%|czu{h!e2?X`%9TTFA25Mc)! z_paUS@;N*o9TzR+IvaWM%THEWSt$0ZiNT~LH`SRliePJYb1vekkJ`N^iTcb;N?>`e zGcHN7eZ6}h8eItfdzH8;aJS?D6%G6?a2IWbg%xxrVy3C)xfe}jtwNya?U&W~EA^W% zXW*W>=>zH1MzeO%}1>F&_~&K*wk2%*(# zpKt4Q3=}MtI24B7FD}T9w+KH z5GR*aB7%AYTFOAOwbT2&wek)wR>l!~yP;MYaPrY<3zT_BkW|iPNi}6q*{e#wn$Z!v zsM`g#lq?Aqgyi4iBUI}K#BRPwD9|FFG#eY6AkOVH)kJUNDcdcr3H#Yt=p5#FF&n>O9ogJp zR8jN7n3&g0*7n*{=a@|MZ``&0AWb0XrU--}XhiFx5bz$t-8?9y24-Cnx)vg9;8Cw;)C4a`M z*0QJ7=Z@DUq-VsCea9{F@fKp^o%%~m_=~N%^WVAKv|zWtlESWn#=*T!)iSG>9bI40 z_#ybf=f>YE^3{x*Uw|I(89UKddJYT?$;X;Y4J}o^{K*62l2)Sibg)91b)DoP5>>U5 z_O`P@Rqbzx+qoZ3x+;j%f!vf4zP;6NUu^McTON%^ls>4Q-KTS+RUq^FO|U{7e6`G~ ztK4sOZ+qC5*QsH#T?TkJ94-*<-s>se;!eVNPeT?P-=nX;oqk|@_I2h|%vV3EcC*9~ zf&F^U?b`nSAN%fjTMEYxE2-7Bw+_kH47YPP(Z0t=ZjCJx6tf8rZ9v&wHAIW3|*aTV{2Vp7Cjz` z-(7oQ<+fHZ#7qz{mA0DLt*_&6_Ie&R(`Y3l$m56L)Y!*#<_o6q3TXiMBzca~JivRq zN?4XfyWV4Ar>XS&C# zTK;}Dz9vGULfYn&BW_enMiTC48*crXu6}_rj4>xDRzRvAF@%R(a$3s{H66gM7H(tv z<$if1ZmHS`)nrPsp=14myg=D^98NtOC44W4T_d&tM+~C#vV3Y!*Z2j|w75Tjhbj8#IF5bdyrW!eXO&u!Dhmv8>{yZ$t|n#f z23trA%l_)foZ?yqsA{FNzn}vAdw>l&-dQDWqvm9kXymNUaT3bWS-Bhfia;QQqr7zrqg+!n(+0Nnvi7J(|zuO*(XzkO0C@d|D7eQ&Z&w^d?d{RVEcAQ>EG z9D1Ui;?r>X7d240VRT3icjj$eb7k}g33_*PgkP`A#E5{M@qD%2ky>rZDaBcs6~~zU z -#include -#include -#include -#include -#include - -namespace llvm { -namespace telemetry { - -class Serializer { -public: - virtual Error init() = 0; - virtual void write(StringRef KeyName, bool Value) = 0; - virtual void write(StringRef KeyName, StringRef Value) = 0; - - template - std::enable_if_t> write(StringRef KeyName, T Value) { - if constexpr (std::is_signed_v) - writeSigned(KeyName, Value); - else - writeUnsigned(KeyName, Value); - } - - template - void write(StringRef KeyName, const T &Map) { - static_assert(std::is_convertible_v, - "KeyType must be convertible to string"); - beginObject(KeyName); - for (const auto &KeyVal : Map) - write(KeyVal.first, KeyVal.second); - endObject(); - } - - virtual void beginObject(StringRef KeyName) = 0; - virtual void endObject() = 0; - - virtual Error finalize() = 0; - -private: - virtual void writeUnsigned(StringRef KeyName, unsigned long long) = 0; - virtual void writeSigned(StringRef KeyName, long long) = 0; -}; - -/// Configuration for the Manager class. -/// This stores configurations from both users and vendors and is passed -/// to the Manager upon construction. (Any changes to the config after -/// the Manager's construction will not have any effect on it). -/// -/// This struct can be extended as needed to add additional configuration -/// points specific to a vendor's implementation. -struct Config { - // If true, telemetry will be enabled. - const bool EnableTelemetry; - Config(bool E) : EnableTelemetry(E) {} - - virtual std::optional makeSessionId() { return std::nullopt; } -}; - -/// For isa, dyn_cast, etc operations on TelemetryInfo. -typedef unsigned KindType; -/// This struct is used by TelemetryInfo to support isa<>, dyn_cast<> -/// operations. -/// It is defined as a struct (rather than an enum) because it is -/// expected to be extended by subclasses which may have -/// additional TelemetryInfo types defined to describe different events. -struct EntryKind { - static const KindType Base = 0; -}; - -/// TelemetryInfo is the data courier, used to move instrumented data -/// from the tool being monitored to the Telemetry framework. -/// -/// This base class contains only the basic set of telemetry data. -/// Downstream implementations can define more subclasses with -/// additional fields to describe different events and concepts. -/// -/// For example, The LLDB debugger can define a DebugCommandInfo subclass -/// which has additional fields about the debug-command being instrumented, -/// such as `CommandArguments` or `CommandName`. -struct TelemetryInfo { - // This represents a unique-id, conventionally corresponding to - // a tool's session - i.e., every time the tool starts until it exits. - // - // Note: a tool could have multiple sessions running at once, in which - // case, these shall be multiple sets of TelemetryInfo with multiple unique - // IDs. - // - // Different usages can assign different types of IDs to this field. - std::string SessionId; - - TelemetryInfo() = default; - virtual ~TelemetryInfo() = default; - - virtual void serialize(Serializer &serializer) const; - - // For isa, dyn_cast, etc, operations. - virtual KindType getKind() const { return EntryKind::Base; } - static bool classof(const TelemetryInfo *T) { - return T->getKind() == EntryKind::Base; - } -}; - -/// This class presents a data sink to which the Telemetry framework -/// sends data. -/// -/// Its implementation is transparent to the framework. -/// It is up to the vendor to decide which pieces of data to forward -/// and where to forward them. -class Destination { -public: - virtual ~Destination() = default; - virtual Error receiveEntry(const TelemetryInfo *Entry) = 0; - virtual StringLiteral name() const = 0; -}; - -/// This class is the main interaction point between any LLVM tool -/// and this framework. -/// It is responsible for collecting telemetry data from the tool being -/// monitored and transmitting the data elsewhere. -class Manager { -public: - // Optional callback for subclasses to perform additional tasks before - // dispatching to Destinations. - virtual Error preDispatch(TelemetryInfo *Entry) = 0; - - // Dispatch Telemetry data to the Destination(s). - // The argument is non-const because the Manager may add or remove - // data from the entry. - virtual Error dispatch(TelemetryInfo *Entry); - - // Register a Destination. - void addDestination(std::unique_ptr Destination); - -private: - std::vector> Destinations; -}; - -} // namespace telemetry -} // namespace llvm - -#endif // LLVM_TELEMETRY_TELEMETRY_H diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt index f6465612d30c0..503c77cb13bd0 100644 --- a/llvm/lib/CMakeLists.txt +++ b/llvm/lib/CMakeLists.txt @@ -41,7 +41,6 @@ add_subdirectory(ProfileData) add_subdirectory(Passes) add_subdirectory(TargetParser) add_subdirectory(TextAPI) -add_subdirectory(Telemetry) add_subdirectory(ToolDrivers) add_subdirectory(XRay) if (LLVM_INCLUDE_TESTS) diff --git a/llvm/lib/Telemetry/CMakeLists.txt b/llvm/lib/Telemetry/CMakeLists.txt deleted file mode 100644 index 8208bdadb05e9..0000000000000 --- a/llvm/lib/Telemetry/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_llvm_component_library(LLVMTelemetry - Telemetry.cpp - - ADDITIONAL_HEADER_DIRS - "${LLVM_MAIN_INCLUDE_DIR}/llvm/Telemetry" -) diff --git a/llvm/lib/Telemetry/Telemetry.cpp b/llvm/lib/Telemetry/Telemetry.cpp deleted file mode 100644 index de8e77d52623c..0000000000000 --- a/llvm/lib/Telemetry/Telemetry.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "llvm/Telemetry/Telemetry.h" - -namespace llvm { -namespace telemetry { - -void TelemetryInfo::serialize(Serializer &serializer) const { - serializer.write("SessionId", SessionId); -} - -Error Manager::dispatch(TelemetryInfo *Entry) { - if (Error Err = preDispatch(Entry)) - return std::move(Err); - - Error AllErrs = Error::success(); - for (auto &Dest : Destinations) { - AllErrs = joinErrors(std::move(AllErrs), Dest->receiveEntry(Entry)); - } - return AllErrs; -} - -void Manager::addDestination(std::unique_ptr Dest) { - Destinations.push_back(std::move(Dest)); -} - -} // namespace telemetry -} // namespace llvm diff --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt index 81abce51b8939..8892f3e75729a 100644 --- a/llvm/unittests/CMakeLists.txt +++ b/llvm/unittests/CMakeLists.txt @@ -63,7 +63,6 @@ add_subdirectory(Support) add_subdirectory(TableGen) add_subdirectory(Target) add_subdirectory(TargetParser) -add_subdirectory(Telemetry) add_subdirectory(Testing) add_subdirectory(TextAPI) add_subdirectory(Transforms) diff --git a/llvm/unittests/Telemetry/CMakeLists.txt b/llvm/unittests/Telemetry/CMakeLists.txt deleted file mode 100644 index a40ae4b2f5560..0000000000000 --- a/llvm/unittests/Telemetry/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(LLVM_LINK_COMPONENTS - Telemetry - Core - Support - ) - -add_llvm_unittest(TelemetryTests - TelemetryTest.cpp - ) diff --git a/llvm/unittests/Telemetry/TelemetryTest.cpp b/llvm/unittests/Telemetry/TelemetryTest.cpp deleted file mode 100644 index 05523f1bcfaa2..0000000000000 --- a/llvm/unittests/Telemetry/TelemetryTest.cpp +++ /dev/null @@ -1,242 +0,0 @@ -//===- llvm/unittest/Telemetry/TelemetryTest.cpp - Telemetry unittests ---===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/Telemetry/Telemetry.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/Casting.h" -#include "llvm/Support/Error.h" -#include "gtest/gtest.h" -#include -#include - -namespace llvm { -namespace telemetry { -// Testing parameters. -// -// These are set by each test to force certain outcomes. -struct TestContext { - // Controlling whether there is vendor plugin. In "real" implementation, the - // plugin-registration framework will handle the overrides but for tests, we - // just use a bool flag to decide which function to call. - bool HasVendorPlugin = false; - - // This field contains data emitted by the framework for later - // verification by the tests. - std::string Buffer = ""; - - // The expected Uuid generated by the fake tool. - std::string ExpectedUuid = ""; -}; - -class StringSerializer : public Serializer { -public: - const std::string &getString() { return Buffer; } - - Error init() override { - if (Started) - return createStringError("Serializer already in use"); - Started = true; - Buffer.clear(); - return Error::success(); - } - - void write(StringRef KeyName, bool Value) override { - writeHelper(KeyName, Value); - } - - void write(StringRef KeyName, StringRef Value) override { - writeHelper(KeyName, Value); - } - - void beginObject(StringRef KeyName) override { - Children.push_back(std::string("\n")); - ChildrenNames.push_back(KeyName.str()); - } - - void endObject() override { - assert(!Children.empty() && !ChildrenNames.empty()); - std::string ChildBuff = Children.back(); - std::string Name = ChildrenNames.back(); - Children.pop_back(); - ChildrenNames.pop_back(); - writeHelper(Name, ChildBuff); - } - - Error finalize() override { - assert(Children.empty() && ChildrenNames.empty()); - if (!Started) - return createStringError("Serializer not currently in use"); - Started = false; - return Error::success(); - } - -private: - template void writeHelper(StringRef Name, T Value) { - assert(Started && "serializer not started"); - if (Children.empty()) - Buffer.append((Name + ":" + Twine(Value) + "\n").str()); - else - Children.back().append((Name + ":" + Twine(Value) + "\n").str()); - } - - void writeUnsigned(StringRef KeyName, unsigned long long Value) override { - writeHelper(KeyName, Value); - } - - void writeSigned(StringRef KeyName, long long Value) override { - writeHelper(KeyName, Value); - } - - bool Started = false; - std::string Buffer; - std::vector Children; - std::vector ChildrenNames; -}; - -namespace vendor { -struct VendorConfig : public Config { - VendorConfig(bool Enable) : Config(Enable) {} - std::optional makeSessionId() override { - static int seed = 0; - return std::to_string(seed++); - } -}; - -std::shared_ptr getTelemetryConfig(const TestContext &Ctxt) { - return std::make_shared(/*EnableTelemetry=*/true); -} - -class TestStorageDestination : public Destination { -public: - TestStorageDestination(TestContext *Ctxt) : CurrentContext(Ctxt) {} - - Error receiveEntry(const TelemetryInfo *Entry) override { - if (Error Err = serializer.init()) - return Err; - - Entry->serialize(serializer); - if (Error Err = serializer.finalize()) - return Err; - - CurrentContext->Buffer.append(serializer.getString()); - return Error::success(); - } - - StringLiteral name() const override { return "TestDestination"; } - -private: - TestContext *CurrentContext; - StringSerializer serializer; -}; - -struct StartupInfo : public TelemetryInfo { - std::string ToolName; - std::map MetaData; - - void serialize(Serializer &serializer) const override { - TelemetryInfo::serialize(serializer); - serializer.write("ToolName", ToolName); - serializer.write("MetaData", MetaData); - } -}; - -struct ExitInfo : public TelemetryInfo { - int ExitCode; - std::string ExitDesc; - void serialize(Serializer &serializer) const override { - TelemetryInfo::serialize(serializer); - serializer.write("ExitCode", ExitCode); - serializer.write("ExitDesc", ExitDesc); - } -}; - -class TestManager : public Manager { -public: - static std::unique_ptr - createInstance(Config *Config, TestContext *CurrentContext) { - if (!Config->EnableTelemetry) - return nullptr; - CurrentContext->ExpectedUuid = *(Config->makeSessionId()); - std::unique_ptr Ret = std::make_unique( - CurrentContext, CurrentContext->ExpectedUuid); - - // Add a destination. - Ret->addDestination( - std::make_unique(CurrentContext)); - - return Ret; - } - - TestManager(TestContext *Ctxt, std::string Id) - : CurrentContext(Ctxt), SessionId(Id) {} - - Error preDispatch(TelemetryInfo *Entry) override { - Entry->SessionId = SessionId; - return Error::success(); - } - - std::string getSessionId() { return SessionId; } - -private: - TestContext *CurrentContext; - const std::string SessionId; -}; -} // namespace vendor - -std::shared_ptr getTelemetryConfig(const TestContext &Ctxt) { - if (Ctxt.HasVendorPlugin) - return vendor::getTelemetryConfig(Ctxt); - - return std::make_shared(false); -} - -TEST(TelemetryTest, TelemetryDisabled) { - TestContext Context; - Context.HasVendorPlugin = false; - - std::shared_ptr Config = getTelemetryConfig(Context); - auto Manager = vendor::TestManager::createInstance(Config.get(), &Context); - EXPECT_EQ(nullptr, Manager); -} - -TEST(TelemetryTest, TelemetryEnabled) { - const std::string ToolName = "TelemetryTestTool"; - - // Preset some params. - TestContext Context; - Context.HasVendorPlugin = true; - Context.Buffer.clear(); - - std::shared_ptr Config = getTelemetryConfig(Context); - auto Manager = vendor::TestManager::createInstance(Config.get(), &Context); - - EXPECT_STREQ(Manager->getSessionId().c_str(), Context.ExpectedUuid.c_str()); - - vendor::StartupInfo S; - S.ToolName = ToolName; - S.MetaData["a"] = "A"; - S.MetaData["b"] = "B"; - - Error startupEmitStatus = Manager->dispatch(&S); - EXPECT_FALSE(startupEmitStatus); - std::string ExpectedBuffer = - "SessionId:0\nToolName:TelemetryTestTool\nMetaData:\na:A\nb:B\n\n"; - EXPECT_EQ(ExpectedBuffer, Context.Buffer); - Context.Buffer.clear(); - - vendor::ExitInfo E; - E.ExitCode = 0; - E.ExitDesc = "success"; - Error exitEmitStatus = Manager->dispatch(&E); - EXPECT_FALSE(exitEmitStatus); - ExpectedBuffer = "SessionId:0\nExitCode:0\nExitDesc:success\n"; - EXPECT_EQ(ExpectedBuffer, Context.Buffer); -} - -} // namespace telemetry -} // namespace llvm From 7739380643718bc912bc05b969e4be525a85c0d2 Mon Sep 17 00:00:00 2001 From: Yifei Xu Date: Fri, 20 Dec 2024 10:36:39 -0600 Subject: [PATCH 003/466] Fix integration tests after #120580 (math-polynomial-approx-avx2) --- .../mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir | 1 + 1 file changed, 1 insertion(+) diff --git a/mlir/test/mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir b/mlir/test/mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir index bf236dc7659f0..c51802d100b80 100644 --- a/mlir/test/mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir +++ b/mlir/test/mlir-cpu-runner/X86Vector/math-polynomial-approx-avx2.mlir @@ -2,6 +2,7 @@ // RUN: -convert-vector-to-scf \ // RUN: -convert-scf-to-cf \ // RUN: -convert-arith-to-llvm \ +// RUN: -convert-cf-to-llvm \ // RUN: -convert-vector-to-llvm="enable-x86vector" \ // RUN: -convert-math-to-llvm \ // RUN: -convert-func-to-llvm \ From 6780ab371ff8ce5e2b08b5fddd75a8296d3debdd Mon Sep 17 00:00:00 2001 From: Santanu Das Date: Fri, 20 Dec 2024 22:50:37 +0530 Subject: [PATCH 004/466] [Hexagon] Add support for addrspacecast lowering (#119195) This patch adds support for addrspacecast lowering. At the moment, there are no separate address spaces for Hexagon target, hence this instruction is treated as a noop. --- llvm/lib/Target/Hexagon/HexagonTargetMachine.h | 4 ++++ llvm/test/CodeGen/Hexagon/addrspacecast-crash.ll | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 llvm/test/CodeGen/Hexagon/addrspacecast-crash.ll diff --git a/llvm/lib/Target/Hexagon/HexagonTargetMachine.h b/llvm/lib/Target/Hexagon/HexagonTargetMachine.h index 6438d0d5a6ba8..65f5b6e7e8eb7 100644 --- a/llvm/lib/Target/Hexagon/HexagonTargetMachine.h +++ b/llvm/lib/Target/Hexagon/HexagonTargetMachine.h @@ -46,6 +46,10 @@ class HexagonTargetMachine : public CodeGenTargetMachineImpl { MachineFunctionInfo * createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, const TargetSubtargetInfo *STI) const override; + + bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override { + return true; + } }; } // end namespace llvm diff --git a/llvm/test/CodeGen/Hexagon/addrspacecast-crash.ll b/llvm/test/CodeGen/Hexagon/addrspacecast-crash.ll new file mode 100644 index 0000000000000..ce197bdeea1f3 --- /dev/null +++ b/llvm/test/CodeGen/Hexagon/addrspacecast-crash.ll @@ -0,0 +1,12 @@ +; Tests if addrspacecast is handled in Hexagon backend + +; REQUIRES: asserts + +; RUN: llc -march=hexagon %s -o /dev/null + +define double @f(ptr %G, ptr %x) { +BB: + %Castaddrspacecast = addrspacecast ptr %x to ptr addrspace(1) + store ptr addrspace(1) %Castaddrspacecast, ptr %G, align 8 + ret double 0.000000e+00 +} From 952c8d305459d3f1218d1ce12c7f20b6a10ba046 Mon Sep 17 00:00:00 2001 From: Jonathan Thackray Date: Fri, 20 Dec 2024 17:27:08 +0000 Subject: [PATCH 005/466] [AArch64] Enable FEAT_SVE2p1 by default for Armv9.4-A and later (#120753) The ArmARM says: ``` "In an Armv9.4 implementation, if FEAT_SVE2 is implemented, FEAT_SVE2p1 is implemented." ``` Since FEAT_SVE2 is already enabled for Armv9.0-A and later, then FEAT_SVE2p1 should also be enabled by default. --- clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c | 1 + clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c | 1 + llvm/lib/Target/AArch64/AArch64Features.td | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c b/clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c index 0032c926c22d9..1cfda6c996b9e 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-armv9.4-a.c @@ -58,6 +58,7 @@ // CHECK-NEXT: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit // CHECK-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions // CHECK-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions +// CHECK-NEXT: FEAT_SVE2p1 Enable Scalable Vector Extension 2.1 instructions // CHECK-NEXT: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions // CHECK-NEXT: FEAT_TRBE Enable Trace Buffer Extension // CHECK-NEXT: FEAT_TRF Enable Armv8.4-A Trace extension diff --git a/clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c b/clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c index be24bd0bbddb6..76c8b34a56b75 100644 --- a/clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c +++ b/clang/test/Driver/print-enabled-extensions/aarch64-armv9.5-a.c @@ -61,6 +61,7 @@ // CHECK-NEXT: FEAT_SSBS, FEAT_SSBS2 Enable Speculative Store Bypass Safe bit // CHECK-NEXT: FEAT_SVE Enable Scalable Vector Extension (SVE) instructions // CHECK-NEXT: FEAT_SVE2 Enable Scalable Vector Extension 2 (SVE2) instructions +// CHECK-NEXT: FEAT_SVE2p1 Enable Scalable Vector Extension 2.1 instructions // CHECK-NEXT: FEAT_TLBIOS, FEAT_TLBIRANGE Enable Armv8.4-A TLB Range and Maintenance instructions // CHECK-NEXT: FEAT_TRBE Enable Trace Buffer Extension // CHECK-NEXT: FEAT_TRF Enable Armv8.4-A Trace extension diff --git a/llvm/lib/Target/AArch64/AArch64Features.td b/llvm/lib/Target/AArch64/AArch64Features.td index 3a6bef81f4a0d..41eb9a73bd013 100644 --- a/llvm/lib/Target/AArch64/AArch64Features.td +++ b/llvm/lib/Target/AArch64/AArch64Features.td @@ -874,7 +874,7 @@ def HasV9_3aOps : Architecture64<9, 3, "a", "v9.3a", def HasV9_4aOps : Architecture64<9, 4, "a", "v9.4a", [HasV8_9aOps, HasV9_3aOps], !listconcat(HasV9_3aOps.DefaultExts, [FeatureSPECRES2, FeatureCSSC, - FeatureRASv2])>; + FeatureRASv2, FeatureSVE2p1])>; def HasV9_5aOps : Architecture64<9, 5, "a", "v9.5a", [HasV9_4aOps, FeatureCPA], !listconcat(HasV9_4aOps.DefaultExts, [FeatureCPA, FeatureLUT, FeatureFAMINMAX])>; From adfef2a753d9a543ec818a445b2c6d05899cdf3d Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Fri, 20 Dec 2024 17:28:53 +0000 Subject: [PATCH 006/466] [compiler-rt][rtsan] ppoll interception. (#120366) --- .../lib/rtsan/rtsan_interceptors_posix.cpp | 12 ++++++++++++ .../rtsan/tests/rtsan_test_interceptors_posix.cpp | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp index f000deb3039a8..24e0857b96650 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp @@ -807,6 +807,17 @@ INTERCEPTOR(int, epoll_pwait, int epfd, struct epoll_event *events, #define RTSAN_MAYBE_INTERCEPT_EPOLL_PWAIT #endif // SANITIZER_INTERCEPT_EPOLL +#if SANITIZER_INTERCEPT_PPOLL +INTERCEPTOR(int, ppoll, struct pollfd *fds, nfds_t n, const struct timespec *ts, + const sigset_t *set) { + __rtsan_notify_intercepted_call("ppoll"); + return REAL(ppoll)(fds, n, ts, set); +} +#define RTSAN_MAYBE_INTERCEPT_PPOLL INTERCEPT_FUNCTION(ppoll) +#else +#define RTSAN_MAYBE_INTERCEPT_PPOLL +#endif + #if SANITIZER_INTERCEPT_KQUEUE INTERCEPTOR(int, kqueue, void) { __rtsan_notify_intercepted_call("kqueue"); @@ -1000,6 +1011,7 @@ void __rtsan::InitializeInterceptors() { RTSAN_MAYBE_INTERCEPT_EPOLL_CTL; RTSAN_MAYBE_INTERCEPT_EPOLL_WAIT; RTSAN_MAYBE_INTERCEPT_EPOLL_PWAIT; + RTSAN_MAYBE_INTERCEPT_PPOLL; RTSAN_MAYBE_INTERCEPT_KQUEUE; RTSAN_MAYBE_INTERCEPT_KEVENT; RTSAN_MAYBE_INTERCEPT_KEVENT64; diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp index b3fb32ee8dcd4..5859ec7b5fb61 100644 --- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp @@ -1056,6 +1056,21 @@ TEST_F(EpollTest, EpollPWaitDiesWhenRealtime) { } #endif // SANITIZER_INTERCEPT_EPOLL +#if SANITIZER_INTERCEPT_PPOLL +TEST(TestRtsanInterceptors, PpollDiesWhenRealtime) { + struct pollfd fds[1]; + fds[0].fd = 0; + fds[0].events = POLLIN; + + timespec ts = {0}; + + auto Func = [&fds, &ts]() { ppoll(fds, 1, &ts, nullptr); }; + + ExpectRealtimeDeath(Func, "ppoll"); + ExpectNonRealtimeSurvival(Func); +} +#endif + #if SANITIZER_INTERCEPT_KQUEUE TEST(TestRtsanInterceptors, KqueueDiesWhenRealtime) { auto Func = []() { kqueue(); }; From f39ecb7b2846af1c113ec50bc4e1f204d18e7d90 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Fri, 20 Dec 2024 17:29:30 +0000 Subject: [PATCH 007/466] [compiler][rtsan] stream based on memory buffer interception. (#120672) --- .../lib/rtsan/rtsan_interceptors_posix.cpp | 19 ++++++++++++++ .../tests/rtsan_test_interceptors_posix.cpp | 25 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp index 24e0857b96650..4e51f464b5730 100644 --- a/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/rtsan_interceptors_posix.cpp @@ -297,6 +297,23 @@ INTERCEPTOR(FILE *, fdopen, int fd, const char *mode) { return REAL(fdopen)(fd, mode); } +#if SANITIZER_INTERCEPT_OPEN_MEMSTREAM +INTERCEPTOR(FILE *, open_memstream, char **buf, size_t *size) { + __rtsan_notify_intercepted_call("open_memstream"); + return REAL(open_memstream)(buf, size); +} + +INTERCEPTOR(FILE *, fmemopen, void *buf, size_t size, const char *mode) { + __rtsan_notify_intercepted_call("fmemopen"); + return REAL(fmemopen)(buf, size, mode); +} +#define RTSAN_MAYBE_INTERCEPT_OPEN_MEMSTREAM INTERCEPT_FUNCTION(open_memstream) +#define RTSAN_MAYBE_INTERCEPT_FMEMOPEN INTERCEPT_FUNCTION(fmemopen) +#else +#define RTSAN_MAYBE_INTERCEPT_OPEN_MEMSTREAM +#define RTSAN_MAYBE_INTERCEPT_FMEMOPEN +#endif + INTERCEPTOR(int, puts, const char *s) { __rtsan_notify_intercepted_call("puts"); return REAL(puts)(s); @@ -955,6 +972,8 @@ void __rtsan::InitializeInterceptors() { INTERCEPT_FUNCTION(fputs); INTERCEPT_FUNCTION(fdopen); INTERCEPT_FUNCTION(freopen); + RTSAN_MAYBE_INTERCEPT_OPEN_MEMSTREAM; + RTSAN_MAYBE_INTERCEPT_FMEMOPEN; INTERCEPT_FUNCTION(lseek); RTSAN_MAYBE_INTERCEPT_LSEEK64; INTERCEPT_FUNCTION(dup); diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp index 5859ec7b5fb61..eb502e99bb1b5 100644 --- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp @@ -353,6 +353,31 @@ TEST_F(RtsanFileTest, FopenDiesWhenRealtime) { ExpectNonRealtimeSurvival(Func); } +#if SANITIZER_INTERCEPT_OPEN_MEMSTREAM +TEST_F(RtsanFileTest, OpenMemstreamDiesWhenRealtime) { + char *buffer; + size_t size; + auto Func = [&buffer, &size]() { + FILE *f = open_memstream(&buffer, &size); + EXPECT_THAT(f, Ne(nullptr)); + }; + + ExpectRealtimeDeath(Func, "open_memstream"); + ExpectNonRealtimeSurvival(Func); +} + +TEST_F(RtsanFileTest, FmemOpenDiesWhenRealtime) { + char buffer[1024]; + auto Func = [&buffer]() { + FILE *f = fmemopen(&buffer, sizeof(buffer), "w"); + EXPECT_THAT(f, Ne(nullptr)); + }; + + ExpectRealtimeDeath(Func, "fmemopen"); + ExpectNonRealtimeSurvival(Func); +} +#endif + class RtsanOpenedFileTest : public RtsanFileTest { protected: void SetUp() override { From 0550c3292b2277399c2ab700cfcbc43e8477826f Mon Sep 17 00:00:00 2001 From: Alan Date: Fri, 20 Dec 2024 12:37:41 -0500 Subject: [PATCH 008/466] [OCaml] Add bindings for x86_amx, token, and metadata types (#120638) --- llvm/bindings/ocaml/llvm/llvm.ml | 3 +++ llvm/bindings/ocaml/llvm/llvm.mli | 12 ++++++++++++ llvm/bindings/ocaml/llvm/llvm_ocaml.c | 15 +++++++++++++++ llvm/test/Bindings/OCaml/core.ml | 12 ++++++++++++ 4 files changed, 42 insertions(+) diff --git a/llvm/bindings/ocaml/llvm/llvm.ml b/llvm/bindings/ocaml/llvm/llvm.ml index 74ba31389b378..35bc16a60bcfc 100644 --- a/llvm/bindings/ocaml/llvm/llvm.ml +++ b/llvm/bindings/ocaml/llvm/llvm.ml @@ -525,6 +525,9 @@ external vector_size : lltype -> int = "llvm_vector_size" (*--... Operations on other types ..........................................--*) external void_type : llcontext -> lltype = "llvm_void_type" external label_type : llcontext -> lltype = "llvm_label_type" +external x86_amx_type : llcontext -> lltype = "llvm_x86_amx_type" +external token_type : llcontext -> lltype = "llvm_token_type" +external metadata_type : llcontext -> lltype = "llvm_metadata_type" external type_by_name : llmodule -> string -> lltype option = "llvm_type_by_name" external classify_value : llvalue -> ValueKind.t = "llvm_classify_value" diff --git a/llvm/bindings/ocaml/llvm/llvm.mli b/llvm/bindings/ocaml/llvm/llvm.mli index 17cad1f43888b..da52ae6033b90 100644 --- a/llvm/bindings/ocaml/llvm/llvm.mli +++ b/llvm/bindings/ocaml/llvm/llvm.mli @@ -766,6 +766,18 @@ val void_type : llcontext -> lltype [llvm::Type::LabelTy]. *) val label_type : llcontext -> lltype +(** [x86_amx_type c] creates an X86 AMX type in the context [c]. See + [llvm::Type::getX86_AMXTy]. *) +val x86_amx_type : llcontext -> lltype + +(** [token_type c] creates a token type in the context [c]. See + [llvm::Type::getTokenTy]. *) +val token_type : llcontext -> lltype + +(** [metadata_type c] creates a metadata type in the context [c]. See + [llvm::Type::getMetadataTy]. *) +val metadata_type : llcontext -> lltype + (** [type_by_name m name] returns the specified type from the current module if it exists. See the method [llvm::Module::getTypeByName] *) diff --git a/llvm/bindings/ocaml/llvm/llvm_ocaml.c b/llvm/bindings/ocaml/llvm/llvm_ocaml.c index 5906f427e6907..019e731172a98 100644 --- a/llvm/bindings/ocaml/llvm/llvm_ocaml.c +++ b/llvm/bindings/ocaml/llvm/llvm_ocaml.c @@ -686,6 +686,21 @@ value llvm_label_type(value Context) { return to_val(LLVMLabelTypeInContext(Context_val(Context))); } +/* llcontext -> lltype */ +value llvm_x86_amx_type(value Context) { + return to_val(LLVMX86AMXTypeInContext(Context_val(Context))); +} + +/* llcontext -> lltype */ +value llvm_token_type(value Context) { + return to_val(LLVMTokenTypeInContext(Context_val(Context))); +} + +/* llcontext -> lltype */ +value llvm_metadata_type(value Context) { + return to_val(LLVMMetadataTypeInContext(Context_val(Context))); +} + /* llmodule -> string -> lltype option */ value llvm_type_by_name(value M, value Name) { return ptr_to_option(LLVMGetTypeByName(Module_val(M), String_val(Name))); diff --git a/llvm/test/Bindings/OCaml/core.ml b/llvm/test/Bindings/OCaml/core.ml index 923a3541e239c..9d42107aff2ab 100644 --- a/llvm/test/Bindings/OCaml/core.ml +++ b/llvm/test/Bindings/OCaml/core.ml @@ -48,11 +48,22 @@ let test_contained_types () = insist ([| i32_type; i8_type |] = struct_element_types ar) (*===-- Pointer types ----------------------------------------------------===*) + let test_pointer_types () = + insist (TypeKind.Pointer = classify_type (pointer_type context)); insist (0 = address_space (pointer_type context)); insist (0 = address_space (qualified_pointer_type context 0)); insist (1 = address_space (qualified_pointer_type context 1)) +(*===-- Other types ------------------------------------------------------===*) + +let test_other_types () = + insist (TypeKind.Void = classify_type void_type); + insist (TypeKind.Label = classify_type (label_type context)); + insist (TypeKind.X86_amx = classify_type (x86_amx_type context)); + insist (TypeKind.Token = classify_type (token_type context)); + insist (TypeKind.Metadata = classify_type (metadata_type context)) + (*===-- Conversion --------------------------------------------------------===*) let test_conversion () = @@ -1461,6 +1472,7 @@ let _ = suite "modules" test_modules; suite "contained types" test_contained_types; suite "pointer types" test_pointer_types; + suite "other types" test_other_types; suite "conversion" test_conversion; suite "target" test_target; suite "constants" test_constants; From 14180185026b8ed793cc7dfd037620e5150ccc35 Mon Sep 17 00:00:00 2001 From: Qiongsi Wu <274595+qiongsiwu@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:47:26 -0800 Subject: [PATCH 009/466] [clang][ObjectiveC] Fix Parsing the `::` Optional Scope Specifier (#119908) The parser hangs when processing types/variables prefixed by `::` as an optional scope specifier. For example, ``` - (instancetype)init:(::A *) foo; ``` The parser should not hang, and it should emit an error. This PR implements the error check. rdar://140885078 --- clang/docs/ReleaseNotes.rst | 3 +++ clang/lib/Parse/Parser.cpp | 9 ++++++++- clang/test/Parser/objc-coloncolon.m | 19 +++++++++++++++++++ clang/test/Parser/objcxx-coloncolon.mm | 9 +++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 clang/test/Parser/objc-coloncolon.m create mode 100644 clang/test/Parser/objcxx-coloncolon.mm diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index a85ef60b7b58b..38c35aea3cf22 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -708,6 +708,9 @@ Improvements to Clang's diagnostics - Fix -Wdangling false positives on conditional operators (#120206). +- Fixed a bug where Clang hung on an unsupported optional scope specifier ``::`` when parsing + Objective-C. Clang now emits a diagnostic message instead of hanging. + Improvements to Clang's time-trace ---------------------------------- diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index 36e56a92c3092..8ba6a5dce8a99 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -2222,8 +2222,15 @@ bool Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec( } } - if (SS.isEmpty()) + if (SS.isEmpty()) { + if (getLangOpts().ObjC && !getLangOpts().CPlusPlus && + Tok.is(tok::coloncolon)) { + // ObjectiveC does not allow :: as as a scope token. + Diag(ConsumeToken(), diag::err_expected_type); + return true; + } return false; + } // A C++ scope specifier that isn't followed by a typename. AnnotateScopeToken(SS, IsNewScope); diff --git a/clang/test/Parser/objc-coloncolon.m b/clang/test/Parser/objc-coloncolon.m new file mode 100644 index 0000000000000..04a24fd81ec08 --- /dev/null +++ b/clang/test/Parser/objc-coloncolon.m @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -x objective-c -fsyntax-only -Wno-objc-root-class -verify %s + +int GV = 42; + +@interface A ++ (int) getGV; +- (instancetype)init:(::A *) foo; // expected-error {{expected a type}} +@end + +@implementation A +- (void)performSelector:(SEL)selector {} +- (void)double:(int)firstArg :(int)secondArg colon:(int)thirdArg {} +- (void)test { + // The `::` below should not trigger an error. + [self performSelector:@selector(double::colon:)]; +} ++ (int) getGV { return ::GV; } // expected-error {{expected a type}} +- (instancetype)init:(::A *) foo { return self; } // expected-error {{expected a type}} +@end diff --git a/clang/test/Parser/objcxx-coloncolon.mm b/clang/test/Parser/objcxx-coloncolon.mm new file mode 100644 index 0000000000000..864a7df8400c1 --- /dev/null +++ b/clang/test/Parser/objcxx-coloncolon.mm @@ -0,0 +1,9 @@ +// Test to make sure the parser does not get stuck on the optional +// scope specifier on the type B. +// RUN: %clang_cc1 -fsyntax-only %s + +class B; + +@interface A +- (void) init:(::B *) foo; +@end From e3157d3f0dc69102013d966345c441f565b2459a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 20 Dec 2024 17:09:06 +0000 Subject: [PATCH 010/466] [VectorCombine] foldBitcastShuffle - add debug message for match + cost-comparison Helps with debugging to show to that the fold found the match, and shows the old + new costs to indicate whether the fold was/wasn't profitable. --- llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 4538c6ae0e8fc..785deb918bf8a 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -794,17 +794,21 @@ bool VectorCombine::foldBitcastShuffle(Instruction &I) { IsUnary ? TargetTransformInfo::SK_PermuteSingleSrc : TargetTransformInfo::SK_PermuteTwoSrc; - InstructionCost DestCost = + InstructionCost NewCost = TTI.getShuffleCost(SK, NewShuffleTy, NewMask, CostKind) + (NumOps * TTI.getCastInstrCost(Instruction::BitCast, NewShuffleTy, SrcTy, TargetTransformInfo::CastContextHint::None, CostKind)); - InstructionCost SrcCost = + InstructionCost OldCost = TTI.getShuffleCost(SK, SrcTy, Mask, CostKind) + TTI.getCastInstrCost(Instruction::BitCast, DestTy, OldShuffleTy, TargetTransformInfo::CastContextHint::None, CostKind); - if (DestCost > SrcCost || !DestCost.isValid()) + + LLVM_DEBUG(dbgs() << "Found a bitcasted shuffle: " << I << "\n OldCost: " + << OldCost << " vs NewCost: " << NewCost << "\n"); + + if (NewCost > OldCost || !NewCost.isValid()) return false; // bitcast (shuf V0, V1, MaskC) --> shuf (bitcast V0), (bitcast V1), MaskC' From 82b5bda42c00179fcf101e3ab2c591bda94ada9a Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 20 Dec 2024 17:32:06 +0000 Subject: [PATCH 011/466] [VectorCombine] Add "VC: Erasing" debug message to help the log show when dead WorkList instructions are erased. --- llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 785deb918bf8a..1e39f9d7be1dc 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -138,6 +138,7 @@ class VectorCombine { } void eraseInstruction(Instruction &I) { + LLVM_DEBUG(dbgs() << "VC: Erasing: " << I << '\n'); for (Value *Op : I.operands()) Worklist.pushValue(Op); Worklist.remove(&I); From 5bb650345d83669434713146aaa431c1f7ad43d6 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Fri, 20 Dec 2024 10:07:44 -0800 Subject: [PATCH 012/466] Remove -bounds-checking-unique-traps (replace with -fno-sanitize-merge=local-bounds) (#120682) #120613 removed -ubsan-unique-traps and replaced it with -fno-sanitize-merge (introduced in #120511), which allows fine-grained control of which UBSan checks to prevent merging. This analogous patch removes -bound-checking-unique-traps, and allows it to be controlled via -fno-sanitize-merge=local-bounds. Most of this patch is simply plumbing through the compiler flags into the bounds checking pass. Note: this patch subtly changes -fsanitize-merge (the default) to also include -fsanitize-merge=local-bounds. This is different from the previous behavior, where -fsanitize-merge (or the old -ubsan-unique-traps) did not affect local-bounds (requiring the separate -bounds-checking-unique-traps). However, we argue that the new behavior is more intuitive. Removing -bounds-checking-unique-traps and merging its functionality into -fsanitize-merge breaks backwards compatibility; we hope that this is acceptable since '-mllvm -bounds-checking-unique-traps' was an experimental flag. --- clang/docs/ReleaseNotes.rst | 11 +- clang/docs/UndefinedBehaviorSanitizer.rst | 4 +- clang/lib/CodeGen/BackendUtil.cpp | 6 +- clang/test/CodeGen/bounds-checking.c | 14 +- .../Instrumentation/BoundsChecking.h | 15 +- llvm/lib/Passes/PassBuilder.cpp | 20 +-- llvm/lib/Passes/PassRegistry.def | 4 +- .../Instrumentation/BoundsChecking.cpp | 39 +++-- .../BoundsChecking/many-trap.ll | 4 +- .../BoundsChecking/runtimes.ll | 146 ++++++++++++------ .../BoundsChecking/simple-32.ll | 2 +- .../Instrumentation/BoundsChecking/simple.ll | 2 +- .../BoundsChecking/ubsan-unique-traps.ll | 4 +- 13 files changed, 169 insertions(+), 102 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 38c35aea3cf22..d9d016b30f93d 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -445,10 +445,6 @@ New Compiler Flags - The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison starting from C++26, this warning is enabled as an error by default. -- '-fsanitize-merge' (default) and '-fno-sanitize-merge' have been added for - fine-grained control of which UBSan checks are allowed to be merged by the - backend (for example, -fno-sanitize-merge=bool,enum). - Deprecated Compiler Flags ------------------------- @@ -488,8 +484,6 @@ Removed Compiler Flags derivatives) is now removed, since it's no longer possible to suppress the diagnostic (see above). Users can expect an `unknown warning` diagnostic if it's still in use. -- The experimental flag '-ubsan-unique-traps' has been removed. It is - superseded by '-fno-sanitize-merge'. Attribute Changes in Clang -------------------------- @@ -1213,6 +1207,11 @@ Sanitizers - Implemented ``-f[no-]sanitize-trap=local-bounds``, and ``-f[no-]sanitize-recover=local-bounds``. +- ``-fsanitize-merge`` (default) and ``-fno-sanitize-merge`` have been added for + fine-grained, unified control of which UBSan checks can potentially be merged + by the compiler (for example, + ``-fno-sanitize-merge=bool,enum,array-bounds,local-bounds``). + Python Binding Changes ---------------------- - Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``. diff --git a/clang/docs/UndefinedBehaviorSanitizer.rst b/clang/docs/UndefinedBehaviorSanitizer.rst index 671db7f9f3671..b9ee4484fb9ae 100644 --- a/clang/docs/UndefinedBehaviorSanitizer.rst +++ b/clang/docs/UndefinedBehaviorSanitizer.rst @@ -276,8 +276,8 @@ Stack traces and report symbolization If you want UBSan to print symbolized stack trace for each error report, you will need to: -#. Compile with ``-g`` and ``-fno-omit-frame-pointer`` to get proper debug - information in your binary. +#. Compile with ``-g``, ``-fno-sanitize-merge`` and ``-fno-omit-frame-pointer`` + to get proper debug information in your binary. #. Run your program with environment variable ``UBSAN_OPTIONS=print_stacktrace=1``. #. Make sure ``llvm-symbolizer`` binary is in ``PATH``. diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index e6c9d77d29f6f..04358cd6d7c23 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -1030,6 +1030,9 @@ void EmitAssemblyHelper::RunOptimizationPipeline( PB.registerScalarOptimizerLateEPCallback( [this](FunctionPassManager &FPM, OptimizationLevel Level) { BoundsCheckingPass::ReportingMode Mode; + bool Merge = CodeGenOpts.SanitizeMergeHandlers.has( + SanitizerKind::LocalBounds); + if (CodeGenOpts.SanitizeTrap.has(SanitizerKind::LocalBounds)) { Mode = BoundsCheckingPass::ReportingMode::Trap; } else if (CodeGenOpts.SanitizeMinimalRuntime) { @@ -1041,7 +1044,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline( ? BoundsCheckingPass::ReportingMode::FullRuntime : BoundsCheckingPass::ReportingMode::FullRuntimeAbort; } - FPM.addPass(BoundsCheckingPass(Mode)); + BoundsCheckingPass::BoundsCheckingOptions Options(Mode, Merge); + FPM.addPass(BoundsCheckingPass(Options)); }); // Don't add sanitizers if we are here from ThinLTO PostLink. That already diff --git a/clang/test/CodeGen/bounds-checking.c b/clang/test/CodeGen/bounds-checking.c index f9319ca61670c..5e6b317a99969 100644 --- a/clang/test/CodeGen/bounds-checking.c +++ b/clang/test/CodeGen/bounds-checking.c @@ -1,12 +1,14 @@ -// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s -// RUN: %clang_cc1 -fsanitize=array-bounds -O -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s +// N.B. The clang driver defaults to -fsanitize-merge but clang_cc1 effectively +// defaults to -fno-sanitize-merge. // RUN: %clang_cc1 -fsanitize=array-bounds -O -fsanitize-trap=array-bounds -emit-llvm -triple x86_64-apple-darwin10 -DNO_DYNAMIC %s -o - | FileCheck %s +// RUN: %clang_cc1 -fsanitize=array-bounds -O -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s // -// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -mllvm -bounds-checking-unique-traps -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL -// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTLOCAL +// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// +// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL +// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -fno-sanitize-merge -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTLOCAL +// RUN: %clang_cc1 -fsanitize=local-bounds -fsanitize-trap=local-bounds -fsanitize-merge=local-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTLOCAL // -// N.B. The clang driver defaults to -fsanitize-merge but clang_cc1 effectively -// defaults to -fno-sanitize-merge. // RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTARRAY // RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -fno-sanitize-merge -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | FileCheck %s --check-prefixes=NOOPTARRAY // RUN: %clang_cc1 -fsanitize=array-bounds -fsanitize-trap=array-bounds -fsanitize-merge=array-bounds -O3 -emit-llvm -triple x86_64-apple-darwin10 %s -o - | not FileCheck %s --check-prefixes=NOOPTARRAY diff --git a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h index 1876e5b72e8c9..ee71aa64f85ee 100644 --- a/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h +++ b/llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h @@ -17,6 +17,7 @@ class Function; /// A pass to instrument code and perform run-time bounds checking on loads, /// stores, and other memory intrinsics. class BoundsCheckingPass : public PassInfoMixin { + public: enum class ReportingMode { Trap, @@ -26,15 +27,21 @@ class BoundsCheckingPass : public PassInfoMixin { FullRuntimeAbort, }; -private: - ReportingMode Mode = ReportingMode::Trap; + struct BoundsCheckingOptions { + BoundsCheckingOptions(ReportingMode Mode, bool Merge); -public: - BoundsCheckingPass(ReportingMode Mode) : Mode(Mode) {} + ReportingMode Mode; + bool Merge; + }; + + BoundsCheckingPass(BoundsCheckingOptions Options) : Options(Options) {} PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM); static bool isRequired() { return true; } void printPipeline(raw_ostream &OS, function_ref MapClassName2PassName); + +private: + BoundsCheckingOptions Options; }; } // end namespace llvm diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp index d70ac48f25118..a936f5381137c 100644 --- a/llvm/lib/Passes/PassBuilder.cpp +++ b/llvm/lib/Passes/PassBuilder.cpp @@ -1281,23 +1281,25 @@ parseRegAllocFastPassOptions(PassBuilder &PB, StringRef Params) { return Opts; } -Expected +Expected parseBoundsCheckingOptions(StringRef Params) { - BoundsCheckingPass::ReportingMode Mode = - BoundsCheckingPass::ReportingMode::Trap; + BoundsCheckingPass::BoundsCheckingOptions Options( + BoundsCheckingPass::ReportingMode::Trap, false); while (!Params.empty()) { StringRef ParamName; std::tie(ParamName, Params) = Params.split(';'); if (ParamName == "trap") { - Mode = BoundsCheckingPass::ReportingMode::Trap; + Options.Mode = BoundsCheckingPass::ReportingMode::Trap; } else if (ParamName == "rt") { - Mode = BoundsCheckingPass::ReportingMode::FullRuntime; + Options.Mode = BoundsCheckingPass::ReportingMode::FullRuntime; } else if (ParamName == "rt-abort") { - Mode = BoundsCheckingPass::ReportingMode::FullRuntimeAbort; + Options.Mode = BoundsCheckingPass::ReportingMode::FullRuntimeAbort; } else if (ParamName == "min-rt") { - Mode = BoundsCheckingPass::ReportingMode::MinRuntime; + Options.Mode = BoundsCheckingPass::ReportingMode::MinRuntime; } else if (ParamName == "min-rt-abort") { - Mode = BoundsCheckingPass::ReportingMode::MinRuntimeAbort; + Options.Mode = BoundsCheckingPass::ReportingMode::MinRuntimeAbort; + } else if (ParamName == "merge") { + Options.Merge = true; } else { return make_error( formatv("invalid BoundsChecking pass parameter '{0}' ", ParamName) @@ -1305,7 +1307,7 @@ parseBoundsCheckingOptions(StringRef Params) { inconvertibleErrorCode()); } } - return Mode; + return Options; } } // namespace diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def index ba3adcb0e317c..9f0b09278edcc 100644 --- a/llvm/lib/Passes/PassRegistry.def +++ b/llvm/lib/Passes/PassRegistry.def @@ -624,8 +624,8 @@ FUNCTION_PASS_WITH_PARAMS( parseWinEHPrepareOptions, "demote-catchswitch-only") FUNCTION_PASS_WITH_PARAMS( "bounds-checking", "BoundsCheckingPass", - [](BoundsCheckingPass::ReportingMode Mode) { - return BoundsCheckingPass(Mode); + [](BoundsCheckingPass::BoundsCheckingOptions Options) { + return BoundsCheckingPass(Options); }, parseBoundsCheckingOptions, "trap") #undef FUNCTION_PASS_WITH_PARAMS diff --git a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp index f639d0628d605..41e5038581246 100644 --- a/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp +++ b/llvm/lib/Transforms/Instrumentation/BoundsChecking.cpp @@ -37,15 +37,16 @@ using namespace llvm; static cl::opt SingleTrapBB("bounds-checking-single-trap", cl::desc("Use one trap block per function")); -static cl::opt DebugTrapBB("bounds-checking-unique-traps", - cl::desc("Always use one trap per check")); - STATISTIC(ChecksAdded, "Bounds checks added"); STATISTIC(ChecksSkipped, "Bounds checks skipped"); STATISTIC(ChecksUnable, "Bounds checks unable to add"); using BuilderTy = IRBuilder; +BoundsCheckingPass::BoundsCheckingOptions::BoundsCheckingOptions( + ReportingMode Mode, bool Merge) + : Mode(Mode), Merge(Merge) {} + /// Gets the conditions under which memory accessing instructions will overflow. /// /// \p Ptr is the pointer that will be read/written, and \p InstVal is either @@ -105,7 +106,7 @@ static Value *getBoundsCheckCond(Value *Ptr, Value *InstVal, return Or; } -static CallInst *InsertTrap(BuilderTy &IRB) { +static CallInst *InsertTrap(BuilderTy &IRB, bool DebugTrapBB) { if (!DebugTrapBB) return IRB.CreateIntrinsic(Intrinsic::trap, {}, {}); // FIXME: Ideally we would use the SanitizerHandler::OutOfBounds constant. @@ -169,9 +170,10 @@ struct ReportingOpts { bool MayReturn = false; bool UseTrap = false; bool MinRuntime = false; + bool MayMerge = true; StringRef Name; - ReportingOpts(BoundsCheckingPass::ReportingMode Mode) { + ReportingOpts(BoundsCheckingPass::ReportingMode Mode, bool Merge) { switch (Mode) { case BoundsCheckingPass::ReportingMode::Trap: UseTrap = true; @@ -193,6 +195,8 @@ struct ReportingOpts { Name = "__ubsan_handle_local_out_of_bounds_abort"; break; } + + MayMerge = Merge; } }; @@ -253,13 +257,12 @@ static bool addBoundsChecking(Function &F, TargetLibraryInfo &TLI, BasicBlock *TrapBB = BasicBlock::Create(Fn->getContext(), "trap", Fn); IRB.SetInsertPoint(TrapBB); + bool DebugTrapBB = !Opts.MayMerge; CallInst *TrapCall = Opts.UseTrap - ? InsertTrap(IRB) + ? InsertTrap(IRB, DebugTrapBB) : InsertCall(IRB, Opts.MayReturn, Opts.Name); - if (DebugTrapBB) { - // FIXME: Pass option form clang. + if (DebugTrapBB) TrapCall->addFnAttr(llvm::Attribute::NoMerge); - } TrapCall->setDoesNotThrow(); TrapCall->setDebugLoc(DebugLoc); @@ -289,7 +292,8 @@ PreservedAnalyses BoundsCheckingPass::run(Function &F, FunctionAnalysisManager & auto &TLI = AM.getResult(F); auto &SE = AM.getResult(F); - if (!addBoundsChecking(F, TLI, SE, ReportingOpts(Mode))) + if (!addBoundsChecking(F, TLI, SE, + ReportingOpts(Options.Mode, Options.Merge))) return PreservedAnalyses::all(); return PreservedAnalyses::none(); @@ -299,21 +303,24 @@ void BoundsCheckingPass::printPipeline( raw_ostream &OS, function_ref MapClassName2PassName) { static_cast *>(this)->printPipeline( OS, MapClassName2PassName); - switch (Mode) { + switch (Options.Mode) { case ReportingMode::Trap: - OS << ""; + OS << ""; + OS << ""; + OS << ""; + OS << ""; + OS << ""; } diff --git a/llvm/test/Instrumentation/BoundsChecking/many-trap.ll b/llvm/test/Instrumentation/BoundsChecking/many-trap.ll index e9cde95cd09e5..4e157520dbafe 100644 --- a/llvm/test/Instrumentation/BoundsChecking/many-trap.ll +++ b/llvm/test/Instrumentation/BoundsChecking/many-trap.ll @@ -1,5 +1,5 @@ -; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s -; RUN: opt < %s -passes=bounds-checking -bounds-checking-single-trap -S | FileCheck -check-prefix=SINGLE %s +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s +; RUN: opt < %s -passes='bounds-checking' -bounds-checking-single-trap -S | FileCheck -check-prefix=SINGLE %s target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" ; CHECK: @f1 diff --git a/llvm/test/Instrumentation/BoundsChecking/runtimes.ll b/llvm/test/Instrumentation/BoundsChecking/runtimes.ll index 357f92aca85c0..7b95a4092af77 100644 --- a/llvm/test/Instrumentation/BoundsChecking/runtimes.ll +++ b/llvm/test/Instrumentation/BoundsChecking/runtimes.ll @@ -1,10 +1,13 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 -; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s --check-prefixes=TR -; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=TR -; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=RT -; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=RTABORT -; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=MINRT -; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=MINRTABORT +; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s --check-prefixes=TR-NOMERGE +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=TR-NOMERGE +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=RT-NOMERGE +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=RTABORT-NOMERGE +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=MINRT-NOMERGE +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=MINRTABORT-NOMERGE +; +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=TR +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s --check-prefixes=RT target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @@ -41,55 +44,96 @@ define void @f1(i64 %x) nounwind { ; RT-NEXT: call void @__ubsan_handle_local_out_of_bounds() #[[ATTR0]] ; RT-NEXT: br label %[[BB7]] ; -; RTABORT-LABEL: define void @f1( -; RTABORT-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; RTABORT-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] -; RTABORT-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 -; RTABORT-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 -; RTABORT-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 -; RTABORT-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] -; RTABORT-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] -; RTABORT-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] -; RTABORT: [[BB7]]: -; RTABORT-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 -; RTABORT-NEXT: ret void -; RTABORT: [[TRAP]]: -; RTABORT-NEXT: call void @__ubsan_handle_local_out_of_bounds_abort() #[[ATTR1:[0-9]+]] -; RTABORT-NEXT: unreachable +; TR-NOMERGE-LABEL: define void @f1( +; TR-NOMERGE-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; TR-NOMERGE-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] +; TR-NOMERGE-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 +; TR-NOMERGE-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 +; TR-NOMERGE-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 +; TR-NOMERGE-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] +; TR-NOMERGE-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] +; TR-NOMERGE-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] +; TR-NOMERGE: [[BB7]]: +; TR-NOMERGE-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 +; TR-NOMERGE-NEXT: ret void +; TR-NOMERGE: [[TRAP]]: +; TR-NOMERGE-NEXT: call void @llvm.ubsantrap(i8 3) #[[ATTR2:[0-9]+]] +; TR-NOMERGE-NEXT: unreachable +; +; RT-NOMERGE-LABEL: define void @f1( +; RT-NOMERGE-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; RT-NOMERGE-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] +; RT-NOMERGE-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 +; RT-NOMERGE-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 +; RT-NOMERGE-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 +; RT-NOMERGE-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] +; RT-NOMERGE-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] +; RT-NOMERGE-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] +; RT-NOMERGE: [[BB7]]: +; RT-NOMERGE-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 +; RT-NOMERGE-NEXT: ret void +; RT-NOMERGE: [[TRAP]]: +; RT-NOMERGE-NEXT: call void @__ubsan_handle_local_out_of_bounds() #[[ATTR1:[0-9]+]] +; RT-NOMERGE-NEXT: br label %[[BB7]] +; +; RTABORT-NOMERGE-LABEL: define void @f1( +; RTABORT-NOMERGE-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; RTABORT-NOMERGE-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] +; RTABORT-NOMERGE-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 +; RTABORT-NOMERGE-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 +; RTABORT-NOMERGE-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 +; RTABORT-NOMERGE-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] +; RTABORT-NOMERGE-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] +; RTABORT-NOMERGE-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] +; RTABORT-NOMERGE: [[BB7]]: +; RTABORT-NOMERGE-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 +; RTABORT-NOMERGE-NEXT: ret void +; RTABORT-NOMERGE: [[TRAP]]: +; RTABORT-NOMERGE-NEXT: call void @__ubsan_handle_local_out_of_bounds_abort() #[[ATTR2:[0-9]+]] +; RTABORT-NOMERGE-NEXT: unreachable ; -; MINRT-LABEL: define void @f1( -; MINRT-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; MINRT-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] -; MINRT-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 -; MINRT-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 -; MINRT-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 -; MINRT-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] -; MINRT-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] -; MINRT-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] -; MINRT: [[BB7]]: -; MINRT-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 -; MINRT-NEXT: ret void -; MINRT: [[TRAP]]: -; MINRT-NEXT: call void @__ubsan_handle_local_out_of_bounds_minimal() #[[ATTR0]] -; MINRT-NEXT: br label %[[BB7]] +; MINRT-NOMERGE-LABEL: define void @f1( +; MINRT-NOMERGE-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; MINRT-NOMERGE-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] +; MINRT-NOMERGE-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 +; MINRT-NOMERGE-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 +; MINRT-NOMERGE-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 +; MINRT-NOMERGE-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] +; MINRT-NOMERGE-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] +; MINRT-NOMERGE-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] +; MINRT-NOMERGE: [[BB7]]: +; MINRT-NOMERGE-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 +; MINRT-NOMERGE-NEXT: ret void +; MINRT-NOMERGE: [[TRAP]]: +; MINRT-NOMERGE-NEXT: call void @__ubsan_handle_local_out_of_bounds_minimal() #[[ATTR1:[0-9]+]] +; MINRT-NOMERGE-NEXT: br label %[[BB7]] ; -; MINRTABORT-LABEL: define void @f1( -; MINRTABORT-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { -; MINRTABORT-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] -; MINRTABORT-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 -; MINRTABORT-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 -; MINRTABORT-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 -; MINRTABORT-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] -; MINRTABORT-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] -; MINRTABORT-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] -; MINRTABORT: [[BB7]]: -; MINRTABORT-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 -; MINRTABORT-NEXT: ret void -; MINRTABORT: [[TRAP]]: -; MINRTABORT-NEXT: call void @__ubsan_handle_local_out_of_bounds_minimal_abort() #[[ATTR1:[0-9]+]] -; MINRTABORT-NEXT: unreachable +; MINRTABORT-NOMERGE-LABEL: define void @f1( +; MINRTABORT-NOMERGE-SAME: i64 [[X:%.*]]) #[[ATTR0:[0-9]+]] { +; MINRTABORT-NOMERGE-NEXT: [[TMP1:%.*]] = mul i64 16, [[X]] +; MINRTABORT-NOMERGE-NEXT: [[TMP2:%.*]] = alloca i128, i64 [[X]], align 8 +; MINRTABORT-NOMERGE-NEXT: [[TMP3:%.*]] = sub i64 [[TMP1]], 0 +; MINRTABORT-NOMERGE-NEXT: [[TMP4:%.*]] = icmp ult i64 [[TMP3]], 16 +; MINRTABORT-NOMERGE-NEXT: [[TMP5:%.*]] = or i1 false, [[TMP4]] +; MINRTABORT-NOMERGE-NEXT: [[TMP6:%.*]] = or i1 false, [[TMP5]] +; MINRTABORT-NOMERGE-NEXT: br i1 [[TMP6]], label %[[TRAP:.*]], label %[[BB7:.*]] +; MINRTABORT-NOMERGE: [[BB7]]: +; MINRTABORT-NOMERGE-NEXT: [[TMP8:%.*]] = load i128, ptr [[TMP2]], align 4 +; MINRTABORT-NOMERGE-NEXT: ret void +; MINRTABORT-NOMERGE: [[TRAP]]: +; MINRTABORT-NOMERGE-NEXT: call void @__ubsan_handle_local_out_of_bounds_minimal_abort() #[[ATTR2:[0-9]+]] +; MINRTABORT-NOMERGE-NEXT: unreachable ; %1 = alloca i128, i64 %x %3 = load i128, ptr %1, align 4 ret void } + +; TR-NOMERGE: attributes #[[ATTR2]] = { nomerge noreturn nounwind } +; RT-NOMERGE: attributes #[[ATTR1]] = { nomerge nounwind } +; RTABORT-NOMERGE: attributes #[[ATTR2]] = { nomerge noreturn nounwind } +; MINRT-NOMERGE: attributes #[[ATTR1]] = { nomerge nounwind } +; MINRTABORT-NOMERGE: attributes #[[ATTR2]] = { nomerge noreturn nounwind } +; +; TR: attributes #[[ATTR2]] = { noreturn nounwind } +; RT: attributes #[[ATTR0]] = { nounwind } diff --git a/llvm/test/Instrumentation/BoundsChecking/simple-32.ll b/llvm/test/Instrumentation/BoundsChecking/simple-32.ll index b707adaca434c..6f8d373d4c596 100644 --- a/llvm/test/Instrumentation/BoundsChecking/simple-32.ll +++ b/llvm/test/Instrumentation/BoundsChecking/simple-32.ll @@ -1,4 +1,4 @@ -; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" diff --git a/llvm/test/Instrumentation/BoundsChecking/simple.ll b/llvm/test/Instrumentation/BoundsChecking/simple.ll index 914cafdc57f9d..ce2540cf49ccc 100644 --- a/llvm/test/Instrumentation/BoundsChecking/simple.ll +++ b/llvm/test/Instrumentation/BoundsChecking/simple.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s +; RUN: opt < %s -passes='bounds-checking' -S | FileCheck %s target datalayout = "e-p:64:64:64-p1:16:16:16-p2:64:64:64:48-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" @.str = private constant [8 x i8] c"abcdefg\00" diff --git a/llvm/test/Instrumentation/BoundsChecking/ubsan-unique-traps.ll b/llvm/test/Instrumentation/BoundsChecking/ubsan-unique-traps.ll index a3f34007e9b09..5fdb9c78357e7 100644 --- a/llvm/test/Instrumentation/BoundsChecking/ubsan-unique-traps.ll +++ b/llvm/test/Instrumentation/BoundsChecking/ubsan-unique-traps.ll @@ -1,5 +1,7 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -passes=bounds-checking -bounds-checking-unique-traps -S | FileCheck %s +; RUN: opt < %s -passes=bounds-checking -S | FileCheck %s +; RUN: opt < %s -passes='bounds-checking' -S | not FileCheck %s + target datalayout = "e-p:64:64:64-p1:16:16:16-p2:64:64:64:48-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" declare noalias ptr @malloc(i64) nounwind allocsize(0) From 5e22597aa01d719b7fed79c45cdf240ed196bd68 Mon Sep 17 00:00:00 2001 From: Guy David <49722543+guy-david@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:08:24 +0200 Subject: [PATCH 013/466] [AArch64] Verify consecutive vector registers in tbl, tbx (#120262) Table lookup instructions expect the vectors that define the table itself to be consecutive (wraparound allowed). Relevant documentation: https://developer.arm.com/documentation/100069/0606/SIMD-Vector-Instructions/TBL--vector- --- .../lib/Target/AArch64/AArch64InstrFormats.td | 32 +++++++++---------- .../lib/Target/AArch64/AArch64RegisterInfo.td | 13 +++++++- .../AArch64/AsmParser/AArch64AsmParser.cpp | 10 ++++-- llvm/test/MC/AArch64/neon-diagnostics.s | 24 ++++++++++++++ 4 files changed, 59 insertions(+), 20 deletions(-) diff --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td index 56ff7b0d3a280..47c4c6c39565f 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td +++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td @@ -8528,28 +8528,28 @@ multiclass SIMDTableLookup { def : SIMDTableLookupAlias(NAME#"v8i8One"), - V64, VecListOne128>; + V64, VecListOneConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Two"), - V64, VecListTwo128>; + V64, VecListTwoConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Three"), - V64, VecListThree128>; + V64, VecListThreeConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Four"), - V64, VecListFour128>; + V64, VecListFourConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8One"), - V128, VecListOne128>; + V128, VecListOneConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Two"), - V128, VecListTwo128>; + V128, VecListTwoConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Three"), - V128, VecListThree128>; + V128, VecListThreeConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Four"), - V128, VecListFour128>; + V128, VecListFourConsecutive128>; } multiclass SIMDTableLookupTied { @@ -8572,28 +8572,28 @@ multiclass SIMDTableLookupTied { def : SIMDTableLookupAlias(NAME#"v8i8One"), - V64, VecListOne128>; + V64, VecListOneConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Two"), - V64, VecListTwo128>; + V64, VecListTwoConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Three"), - V64, VecListThree128>; + V64, VecListThreeConsecutive128>; def : SIMDTableLookupAlias(NAME#"v8i8Four"), - V64, VecListFour128>; + V64, VecListFourConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8One"), - V128, VecListOne128>; + V128, VecListOneConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Two"), - V128, VecListTwo128>; + V128, VecListTwoConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Three"), - V128, VecListThree128>; + V128, VecListThreeConsecutive128>; def : SIMDTableLookupAlias(NAME#"v16i8Four"), - V128, VecListFour128>; + V128, VecListFourConsecutive128>; } //---------------------------------------------------------------------------- diff --git a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td index 4fec120391f01..dd4f2549929f8 100644 --- a/llvm/lib/Target/AArch64/AArch64RegisterInfo.td +++ b/llvm/lib/Target/AArch64/AArch64RegisterInfo.td @@ -646,7 +646,7 @@ class TypedVecListRegOperand # eltsize # "'>">; multiclass VectorList { - // With implicit types (probably on instruction instead). E.g. { v0, v1 } + // With implicit types (probably on instruction instead). E.g. { v0, v1 } or {v0, v2, v4}. def _64AsmOperand : AsmOperandClass { let Name = NAME # "64"; let PredicateMethod = "isImplicitlyTypedVectorList"; @@ -667,6 +667,17 @@ multiclass VectorList { let ParserMatchClass = !cast(NAME # "_128AsmOperand"); } + // With implicit types (probably on instruction instead), consecutive registers. E.g. { v0, v1, v2 } + def _Consecutive128AsmOperand : AsmOperandClass { + let Name = NAME # "Consecutive128"; + let PredicateMethod = "isImplicitlyTypedVectorList"; + let RenderMethod = "addVectorListOperands"; + } + + def "Consecutive128" : RegisterOperand { + let ParserMatchClass = !cast(NAME # "_Consecutive128AsmOperand"); + } + // 64-bit register lists with explicit type. // { v0.8b, v1.8b } diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index d1173e5e12b22..f44afd804c2bd 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -1447,11 +1447,12 @@ class AArch64Operand : public MCParsedAsmOperand { /// Is this a vector list with the type implicit (presumably attached to the /// instruction itself)? - template + template bool isImplicitlyTypedVectorList() const { return Kind == k_VectorList && VectorList.Count == NumRegs && VectorList.NumElements == 0 && - VectorList.RegisterKind == VectorKind; + VectorList.RegisterKind == VectorKind && + (!IsConsecutive || (VectorList.Stride == 1)); } template + template void addVectorListOperands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); + assert((!IsConsecutive || (getVectorListStride() == 1)) && + "Expected consecutive registers"); static const unsigned FirstRegs[][5] = { /* DReg */ { AArch64::Q0, AArch64::D0, AArch64::D0_D1, diff --git a/llvm/test/MC/AArch64/neon-diagnostics.s b/llvm/test/MC/AArch64/neon-diagnostics.s index 6863a89bbe189..2610f4acf383b 100644 --- a/llvm/test/MC/AArch64/neon-diagnostics.s +++ b/llvm/test/MC/AArch64/neon-diagnostics.s @@ -6914,6 +6914,9 @@ tbl v0.8b, {v1.8b, v2.8b, v3.8b}, v2.8b tbl v0.8b, {v1.8b, v2.8b, v3.8b, v4.8b}, v2.8b tbl v0.8b, {v1.16b, v2.16b, v3.16b, v4.16b, v5.16b}, v2.8b + tbl v0.8b, {v2.16b, v4.16b, v6.16b, v8.16b}, v10.8b + tbl.8b v0, {v2, v4, v6, v8}, v10 + tbl.16b v0, {v2, v4, v6, v8}, v10 // CHECK-ERROR: error: invalid operand for instruction // CHECK-ERROR: tbl v0.8b, {v1.8b}, v2.8b @@ -6930,12 +6933,24 @@ // CHECK-ERROR: error: invalid number of vectors // CHECK-ERROR: tbl v0.8b, {v1.16b, v2.16b, v3.16b, v4.16b, v5.16b}, v2.8b // CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbl v0.8b, {v2.16b, v4.16b, v6.16b, v8.16b}, v10.8b +// CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbl.8b v0, {v2, v4, v6, v8}, v10 +// CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbl.16b v0, {v2, v4, v6, v8}, v10 +// CHECK-ERROR: ^ tbx v0.8b, {v1.8b}, v2.8b tbx v0.8b, {v1.8b, v2.8b}, v2.8b tbx v0.8b, {v1.8b, v2.8b, v3.8b}, v2.8b tbx v0.8b, {v1.8b, v2.8b, v3.8b, v4.8b}, v2.8b tbx v0.8b, {v1.16b, v2.16b, v3.16b, v4.16b, v5.16b}, v2.8b + tbx v0.8b, {v2.16b, v4.16b, v6.16b, v8.16b}, v10.8b + tbx.8b v0, {v2, v4, v6, v8}, v10 + tbx.16b v0, {v2, v4, v6, v8}, v10 // CHECK-ERROR: error: invalid operand for instruction // CHECK-ERROR: tbx v0.8b, {v1.8b}, v2.8b @@ -6952,6 +6967,15 @@ // CHECK-ERROR: error: invalid number of vectors // CHECK-ERROR: tbx v0.8b, {v1.16b, v2.16b, v3.16b, v4.16b, v5.16b}, v2.8b // CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbx v0.8b, {v2.16b, v4.16b, v6.16b, v8.16b}, v10.8b +// CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbx.8b v0, {v2, v4, v6, v8}, v10 +// CHECK-ERROR: ^ +// CHECK-ERROR: error: invalid operand for instruction +// CHECK-ERROR: tbx.16b v0, {v2, v4, v6, v8}, v10 +// CHECK-ERROR: ^ //---------------------------------------------------------------------- // Scalar Floating-point Convert To Lower Precision Narrow, Rounding To From 3bf91ad2a9c75dd045961e45fdd830fd7b7a5455 Mon Sep 17 00:00:00 2001 From: Shubham Sandeep Rastogi Date: Fri, 20 Dec 2024 10:08:54 -0800 Subject: [PATCH 014/466] Add a pass to collect dropped var stats for MIR (#120780) This patch uses the DroppedVariableStats class to add dropped variable statistics for MIR passes. Reland 1c082c9cd12efaa67a32c5da89a328c458ed51c5 --- .../llvm/CodeGen/DroppedVariableStatsMIR.h | 70 ++ .../llvm/CodeGen/MachineFunctionPass.h | 2 + llvm/lib/CodeGen/CMakeLists.txt | 1 + llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp | 77 ++ llvm/lib/CodeGen/MachineFunctionPass.cpp | 15 +- llvm/unittests/CodeGen/CMakeLists.txt | 1 + .../CodeGen/DroppedVariableStatsMIRTest.cpp | 1080 +++++++++++++++++ 7 files changed, 1245 insertions(+), 1 deletion(-) create mode 100644 llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h create mode 100644 llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp create mode 100644 llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp diff --git a/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h b/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h new file mode 100644 index 0000000000000..462bbb8b404bc --- /dev/null +++ b/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h @@ -0,0 +1,70 @@ +///===- DroppedVariableStatsMIR.h - Opt Diagnostics -*- 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 +/// +///===---------------------------------------------------------------------===// +/// \file +/// Dropped Variable Statistics for Debug Information. Reports any number +/// of DBG_VALUEs that get dropped due to an optimization pass. +/// +///===---------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSMIR_H +#define LLVM_CODEGEN_DROPPEDVARIABLESTATSMIR_H + +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/Passes/DroppedVariableStats.h" + +namespace llvm { + +/// A class to collect and print dropped debug information due to MIR +/// optimization passes. After every MIR pass is run, it will print how many +/// #DBG_VALUEs were dropped due to that pass. +class DroppedVariableStatsMIR : public DroppedVariableStats { +public: + DroppedVariableStatsMIR() : llvm::DroppedVariableStats(false) {} + + void runBeforePass(StringRef PassID, MachineFunction *MF) { + if (PassID == "Debug Variable Analysis") + return; + setup(); + return runOnMachineFunction(MF, true); + } + + void runAfterPass(StringRef PassID, MachineFunction *MF) { + if (PassID == "Debug Variable Analysis") + return; + runOnMachineFunction(MF, false); + calculateDroppedVarStatsOnMachineFunction(MF, PassID, MF->getName().str()); + cleanup(); + } + +private: + const MachineFunction *MFunc; + /// Populate DebugVariablesBefore, DebugVariablesAfter, InlinedAts before or + /// after a pass has run to facilitate dropped variable calculation for an + /// llvm::MachineFunction. + void runOnMachineFunction(const MachineFunction *MF, bool Before); + /// Iterate over all Instructions in a MachineFunction and report any dropped + /// debug information. + void calculateDroppedVarStatsOnMachineFunction(const MachineFunction *MF, + StringRef PassID, + StringRef FuncOrModName); + /// Override base class method to run on an llvm::MachineFunction + /// specifically. + virtual void + visitEveryInstruction(unsigned &DroppedCount, + DenseMap &InlinedAtsMap, + VarID Var) override; + /// Override base class method to run on DBG_VALUEs specifically. + virtual void visitEveryDebugRecord( + DenseSet &VarIDSet, + DenseMap> &InlinedAtsMap, + StringRef FuncName, bool Before) override; +}; + +} // namespace llvm + +#endif diff --git a/llvm/include/llvm/CodeGen/MachineFunctionPass.h b/llvm/include/llvm/CodeGen/MachineFunctionPass.h index caaf22c2139e3..8d7e4192003d2 100644 --- a/llvm/include/llvm/CodeGen/MachineFunctionPass.h +++ b/llvm/include/llvm/CodeGen/MachineFunctionPass.h @@ -18,6 +18,7 @@ #ifndef LLVM_CODEGEN_MACHINEFUNCTIONPASS_H #define LLVM_CODEGEN_MACHINEFUNCTIONPASS_H +#include "llvm/CodeGen/DroppedVariableStatsMIR.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Pass.h" @@ -67,6 +68,7 @@ class MachineFunctionPass : public FunctionPass { MachineFunctionProperties RequiredProperties; MachineFunctionProperties SetProperties; MachineFunctionProperties ClearedProperties; + DroppedVariableStatsMIR DroppedVarStatsMF; /// createPrinterPass - Get a machine function printer pass. Pass *createPrinterPass(raw_ostream &O, diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index 145fd2fac8b56..b8cefcc1acd22 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -50,6 +50,7 @@ add_llvm_component_library(LLVMCodeGen DeadMachineInstructionElim.cpp DetectDeadLanes.cpp DFAPacketizer.cpp + DroppedVariableStatsMIR.cpp DwarfEHPrepare.cpp EarlyIfConversion.cpp EdgeBundles.cpp diff --git a/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp b/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp new file mode 100644 index 0000000000000..4379db8b16679 --- /dev/null +++ b/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp @@ -0,0 +1,77 @@ +///===- DroppedVariableStatsMIR.cpp ---------------------------------------===// +/// +/// Part of the LLVM Project, under the Apache License v2.0 with LLVM +/// Exceptions. See https://llvm.org/LICENSE.txt for license information. +/// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +/// +///===---------------------------------------------------------------------===// +/// \file +/// Dropped Variable Statistics for Debug Information. Reports any number +/// of DBG_VALUEs that get dropped due to an optimization pass. +/// +///===---------------------------------------------------------------------===// + +#include "llvm/CodeGen/DroppedVariableStatsMIR.h" + +using namespace llvm; + +void DroppedVariableStatsMIR::runOnMachineFunction(const MachineFunction *MF, + bool Before) { + auto &DebugVariables = DebugVariablesStack.back()[&MF->getFunction()]; + auto FuncName = MF->getName(); + MFunc = MF; + run(DebugVariables, FuncName, Before); +} + +void DroppedVariableStatsMIR::calculateDroppedVarStatsOnMachineFunction( + const MachineFunction *MF, StringRef PassID, StringRef FuncOrModName) { + MFunc = MF; + StringRef FuncName = MF->getName(); + const Function *Func = &MF->getFunction(); + DebugVariables &DbgVariables = DebugVariablesStack.back()[Func]; + calculateDroppedStatsAndPrint(DbgVariables, FuncName, PassID, FuncOrModName, + "MachineFunction", Func); +} + +void DroppedVariableStatsMIR::visitEveryInstruction( + unsigned &DroppedCount, DenseMap &InlinedAtsMap, + VarID Var) { + unsigned PrevDroppedCount = DroppedCount; + const DIScope *DbgValScope = std::get<0>(Var); + for (const auto &MBB : *MFunc) { + for (const auto &MI : MBB) { + if (!MI.isDebugInstr()) { + auto *DbgLoc = MI.getDebugLoc().get(); + if (!DbgLoc) + continue; + + auto *Scope = DbgLoc->getScope(); + if (updateDroppedCount(DbgLoc, Scope, DbgValScope, InlinedAtsMap, Var, + DroppedCount)) + break; + } + } + if (PrevDroppedCount != DroppedCount) { + PrevDroppedCount = DroppedCount; + break; + } + } +} + +void DroppedVariableStatsMIR::visitEveryDebugRecord( + DenseSet &VarIDSet, + DenseMap> &InlinedAtsMap, + StringRef FuncName, bool Before) { + for (const auto &MBB : *MFunc) { + for (const auto &MI : MBB) { + if (MI.isDebugValueLike()) { + auto *DbgVar = MI.getDebugVariable(); + if (!DbgVar) + continue; + auto DbgLoc = MI.getDebugLoc(); + populateVarIDSetAndInlinedMap(DbgVar, DbgLoc, VarIDSet, InlinedAtsMap, + FuncName, Before); + } + } + } +} \ No newline at end of file diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp index 62ac3e32d24d9..e803811643f87 100644 --- a/llvm/lib/CodeGen/MachineFunctionPass.cpp +++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp @@ -32,6 +32,11 @@ using namespace llvm; using namespace ore; +static cl::opt DroppedVarStatsMIR( + "dropped-variable-stats-mir", cl::Hidden, + cl::desc("Dump dropped debug variables stats for MIR passes"), + cl::init(false)); + Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O, const std::string &Banner) const { return createMachineFunctionPrinterPass(O, Banner); @@ -91,7 +96,15 @@ bool MachineFunctionPass::runOnFunction(Function &F) { MFProps.reset(ClearedProperties); - bool RV = runOnMachineFunction(MF); + bool RV; + if (DroppedVarStatsMIR) { + auto PassName = getPassName(); + DroppedVarStatsMF.runBeforePass(PassName, &MF); + RV = runOnMachineFunction(MF); + DroppedVarStatsMF.runAfterPass(PassName, &MF); + } else { + RV = runOnMachineFunction(MF); + } if (ShouldEmitSizeRemarks) { // We wanted size remarks. Check if there was a change to the number of diff --git a/llvm/unittests/CodeGen/CMakeLists.txt b/llvm/unittests/CodeGen/CMakeLists.txt index 963cdcc0275e1..4f580e7539f4d 100644 --- a/llvm/unittests/CodeGen/CMakeLists.txt +++ b/llvm/unittests/CodeGen/CMakeLists.txt @@ -27,6 +27,7 @@ add_llvm_unittest(CodeGenTests CCStateTest.cpp DIEHashTest.cpp DIETest.cpp + DroppedVariableStatsMIRTest.cpp DwarfStringPoolEntryRefTest.cpp InstrRefLDVTest.cpp LowLevelTypeTest.cpp diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp new file mode 100644 index 0000000000000..b3d6da575f3ba --- /dev/null +++ b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp @@ -0,0 +1,1080 @@ +//===- unittests/CodeGen/DroppedVariableStatsMIRTest.cpp ------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/DroppedVariableStatsMIR.h" +#include "llvm/AsmParser/Parser.h" +#include "llvm/CodeGen/MIRParser/MIRParser.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/IR/Function.h" +#include "llvm/IR/LegacyPassManager.h" +#include "llvm/IR/Module.h" +#include "llvm/MC/TargetRegistry.h" +#include "llvm/Pass.h" +#include "llvm/Support/TargetSelect.h" +#include "llvm/Target/TargetMachine.h" +#include "gtest/gtest.h" +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace llvm; + +namespace { + +std::unique_ptr +createTargetMachine(std::string TT, StringRef CPU, StringRef FS) { + std::string Error; + const Target *T = TargetRegistry::lookupTarget(TT, Error); + if (!T) + return nullptr; + TargetOptions Options; + return std::unique_ptr( + static_cast(T->createTargetMachine( + TT, CPU, FS, Options, std::nullopt, std::nullopt))); +} + +std::unique_ptr parseMIR(const TargetMachine &TM, StringRef MIRCode, + MachineModuleInfo &MMI, LLVMContext *Context) { + SMDiagnostic Diagnostic; + std::unique_ptr M; + std::unique_ptr MBuffer = MemoryBuffer::getMemBuffer(MIRCode); + auto MIR = createMIRParser(std::move(MBuffer), *Context); + if (!MIR) + return nullptr; + + std::unique_ptr Mod = MIR->parseIRModule(); + if (!Mod) + return nullptr; + + Mod->setDataLayout(TM.createDataLayout()); + + if (MIR->parseMachineFunctions(*Mod, MMI)) { + M.reset(); + return nullptr; + } + return Mod; +} +// This test ensures that if a DBG_VALUE and an instruction that exists in the +// same scope as that DBG_VALUE are both deleted as a result of an optimization +// pass, debug information is considered not dropped. +TEST(DroppedVariableStatsMIR, BothDeleted) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4) + !12 = !DILocation(line: 2, column: 11, scope: !4) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + for (auto &MI : MBB) { + auto *DbgLoc = MI.getDebugLoc().get(); + if (DbgLoc) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), false); +} + +// This test ensures that if a DBG_VALUE is dropped after an optimization pass, +// but an instruction that shares the same scope as the DBG_VALUE still exists, +// debug information is conisdered dropped. +TEST(DroppedVariableStatsMIR, DbgValLost) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4) + !12 = !DILocation(line: 2, column: 11, scope: !4) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), true); +} + +// This test ensures that if a #dbg_value is dropped after an optimization pass, +// but an instruction that has an unrelated scope as the #dbg_value still +// exists, debug information is conisdered not dropped. +TEST(DroppedVariableStatsMIR, UnrelatedScopes) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4) + !12 = !DILocation(line: 2, column: 11, scope: !13) + !13 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), false); +} + +// This test ensures that if a #dbg_value is dropped after an optimization pass, +// but an instruction that has a scope which is a child of the #dbg_value scope +// still exists, debug information is conisdered dropped. +TEST(DroppedVariableStatsMIR, ChildScopes) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4) + !12 = !DILocation(line: 2, column: 11, scope: !13) + !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), true); +} + +// This test ensures that if a DBG_VALUE is dropped after an optimization pass, +// but an instruction that has a scope which is a child of the DBG_VALUE scope +// still exists, and the DBG_VALUE is inlined at another location, debug +// information is conisdered not dropped. +TEST(DroppedVariableStatsMIR, InlinedAt) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) + !12 = !DILocation(line: 2, column: 11, scope: !13) + !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) + !14 = !DILocation(line: 3, column: 2, scope: !4) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), false); +} + +// This test ensures that if a DBG_VALUE is dropped after an optimization pass, +// but an instruction that has a scope which is a child of the DBG_VALUE scope +// still exists, and the DBG_VALUE and the instruction are inlined at another +// location, debug information is conisdered dropped. +TEST(DroppedVariableStatsMIR, InlinedAtShared) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) + !12 = !DILocation(line: 2, column: 11, scope: !13, inlinedAt: !14) + !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) + !14 = !DILocation(line: 3, column: 2, scope: !4) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), true); +} + +// This test ensures that if a DBG_VALUE is dropped after an optimization pass, +// but an instruction that has a scope which is a child of the DBG_VALUE scope +// still exists, and the instruction is inlined at a location that is the +// DBG_VALUE's inlined at location, debug information is conisdered dropped. +TEST(DroppedVariableStatsMIR, InlinedAtChild) { + InitializeAllTargetInfos(); + InitializeAllTargets(); + InitializeAllTargetMCs(); + PassInstrumentationCallbacks PIC; + PassInstrumentation PI(&PIC); + + LLVMContext C; + + const char *MIR = + R"( +--- | + ; ModuleID = '/tmp/test.ll' + source_filename = "/tmp/test.ll" + target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" + + define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { + entry: + #dbg_value(i32 %x, !10, !DIExpression(), !11) + %add = add nsw i32 %x, 1, !dbg !12 + ret i32 0 + } + + !llvm.dbg.cu = !{!0} + !llvm.module.flags = !{!2} + !llvm.ident = !{!3} + + !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") + !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") + !2 = !{i32 2, !"Debug Info Version", i32 3} + !3 = !{!"clang"} + !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) + !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") + !6 = !DISubroutineType(types: !7) + !7 = !{!8, !8} + !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) + !9 = !{!10} + !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) + !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) + !12 = !DILocation(line: 2, column: 11, scope: !13, inlinedAt: !15) + !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) + !14 = !DILocation(line: 3, column: 2, scope: !4) + !15 = !DILocation(line: 4, column: 5, scope: !13, inlinedAt: !14) + +... +--- +name: _Z3fooi +alignment: 4 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +failedISel: false +tracksRegLiveness: true +hasWinCFI: false +noPhis: false +isSSA: true +noVRegs: false +hasFakeUses: false +callsEHReturn: false +callsUnwindInit: false +hasEHCatchret: false +hasEHScopes: false +hasEHFunclets: false +isOutlined: false +debugInstrRef: false +failsVerification: false +tracksDebugUserValues: false +registers: + - { id: 0, class: _, preferred-register: '', flags: [ ] } + - { id: 1, class: _, preferred-register: '', flags: [ ] } + - { id: 2, class: _, preferred-register: '', flags: [ ] } + - { id: 3, class: _, preferred-register: '', flags: [ ] } +liveins: + - { reg: '$w0', virtual-reg: '' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 1 + adjustsStack: false + hasCalls: false + stackProtector: '' + functionContext: '' + maxCallFrameSize: 4294967295 + cvBytesOfCalleeSavedRegisters: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false + hasTailCall: false + isCalleeSavedInfoValid: false + localFrameSize: 0 + savePoint: '' + restorePoint: '' +fixedStack: [] +stack: [] +entry_values: [] +callSites: [] +debugValueSubstitutions: [] +constants: [] +machineFunctionInfo: {} +body: | + bb.1.entry: + liveins: $w0 + + %0:_(s32) = COPY $w0 + %1:_(s32) = G_CONSTANT i32 1 + %3:_(s32) = G_CONSTANT i32 0 + DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 + %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 + $w0 = COPY %3(s32) + RET_ReallyLR implicit $w0 + )"; + auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); + if (!TM) + return; + MachineModuleInfo MMI(TM.get()); + std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); + ASSERT_TRUE(M); + + DroppedVariableStatsMIR Stats; + auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); + Stats.runBeforePass("Test", MF); + + // This loop simulates an IR pass that drops debug information. + for (auto &MBB : *MF) { + for (auto &MI : MBB) { + if (MI.isDebugValueLike()) { + MI.eraseFromParent(); + break; + } + } + break; + } + + Stats.runAfterPass("Test", MF); + ASSERT_EQ(Stats.getPassDroppedVariables(), true); +} + +} // end anonymous namespace \ No newline at end of file From 5162fde6ee6565d39511e451c04865e7b53bcdcc Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 20 Dec 2024 10:18:08 -0800 Subject: [PATCH 015/466] [webkit.UncountedLambdaCapturesChecker] Fix a nullptr deference. (#120702) Added a nullptr check. --- .../WebKit/UncountedLambdaCapturesChecker.cpp | 2 ++ ...counted-lambda-captures-find-lambda-crash.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-find-lambda-crash.cpp diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp index da9698e327562..a57499d52acd0 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLambdaCapturesChecker.cpp @@ -155,6 +155,8 @@ class UncountedLambdaCapturesChecker if (!Init) return nullptr; TempExpr = dyn_cast(Init->IgnoreParenCasts()); + if (!TempExpr) + return nullptr; return dyn_cast_or_null(TempExpr->getSubExpr()); } diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-find-lambda-crash.cpp b/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-find-lambda-crash.cpp new file mode 100644 index 0000000000000..4d9edb75b7ff3 --- /dev/null +++ b/clang/test/Analysis/Checkers/WebKit/uncounted-lambda-captures-find-lambda-crash.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.UncountedLambdaCapturesChecker -verify %s +// expected-no-diagnostics + +struct Foo { + int x; + int y; + Foo(int x, int y) : x(x) , y(y) { } + ~Foo() { } +}; + +Foo bar(const Foo&); +void foo() { + int x = 7; + int y = 5; + bar(Foo(x, y)); +} From 9901906035c2be776674b25a3357b37a7dbbac68 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 20 Dec 2024 10:25:49 -0800 Subject: [PATCH 016/466] [mlir] Fix a warning This patch fixes: mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp:535:13: error: 'applyPatternsAndFoldGreedily' is deprecated: Use applyPatternsGreedily() instead [-Werror,-Wdeprecated-declarations] --- mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp index 2ebf38c53e393..83208e0c42da2 100644 --- a/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp +++ b/mlir/lib/Conversion/GPUCommon/GPUToLLVMConversion.cpp @@ -531,8 +531,7 @@ void GpuToLLVMConversionPass::runOnOperation() { // Vector transfer ops with rank > 1 should be lowered with VectorToSCF. vector::populateVectorTransferLoweringPatterns(patterns, /*maxTransferRank=*/1); - if (failed( - applyPatternsAndFoldGreedily(getOperation(), std::move(patterns)))) + if (failed(applyPatternsGreedily(getOperation(), std::move(patterns)))) return signalPassFailure(); } From 0575815b70b486240ace728a33f756cea8fe58fa Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 20 Dec 2024 10:28:58 -0800 Subject: [PATCH 017/466] [TableGen] Avoid repeated hash lookups (NFC) (#120681) --- llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp index 1a393beaa14f9..1a61d32b4869a 100644 --- a/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp +++ b/llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp @@ -3508,9 +3508,8 @@ void CodeGenDAGPatterns::FindPatternInputsAndOutputs( Val->getDef()->isSubClassOf("PointerLikeRegClass")) { if (Dest->getName().empty()) I.error("set destination must have a name!"); - if (InstResults.count(Dest->getName())) + if (!InstResults.insert_or_assign(Dest->getName(), Dest).second) I.error("cannot set '" + Dest->getName() + "' multiple times"); - InstResults[Dest->getName()] = Dest; } else if (Val->getDef()->isSubClassOf("Register")) { InstImpResults.push_back(Val->getDef()); } else { From 89cb528f076dc6246ca2883054be5f6237473c83 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Fri, 20 Dec 2024 18:30:13 +0000 Subject: [PATCH 018/466] [gn build] Port 3bf91ad2a9c7 --- llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn | 1 + llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn | 1 + 2 files changed, 2 insertions(+) diff --git a/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn index ab72ac4ae9f4b..99abbc8ae57b8 100644 --- a/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn @@ -50,6 +50,7 @@ static_library("CodeGen") { "DFAPacketizer.cpp", "DeadMachineInstructionElim.cpp", "DetectDeadLanes.cpp", + "DroppedVariableStatsMIR.cpp", "DwarfEHPrepare.cpp", "EHContGuardCatchret.cpp", "EarlyIfConversion.cpp", diff --git a/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn index a3f89a5648cb5..2fbc127199609 100644 --- a/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn @@ -26,6 +26,7 @@ unittest("CodeGenTests") { "CCStateTest.cpp", "DIEHashTest.cpp", "DIETest.cpp", + "DroppedVariableStatsMIRTest.cpp", "DwarfStringPoolEntryRefTest.cpp", "InstrRefLDVTest.cpp", "LexicalScopesTest.cpp", From 3e13acfbf4c93067d5ee5dc1f6e0c6e0fef9297f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 20 Dec 2024 10:37:48 -0800 Subject: [PATCH 019/466] [flang][cuda] Make default.nonTbpDefinedIoTable compiler generated (#120686) `default.nonTbpDefinedIoTable` is a special global defined for IO that doesn't follow the mangling scheme and is then not handle correctly in the `CompilerGeneratedNames` pass. Update how it is generated with doGenerated so it can be handle without special handling. Also do not generate comdat in gpu module as the current code is not handling nested module correctly. --- flang/lib/Lower/IO.cpp | 8 +++++--- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 4 +++- .../CUDA/cuda-compiler-generated-names.mlir | 18 ++++++++++++++++++ flang/test/Lower/io-derived-type.f90 | 6 +++--- flang/test/Lower/namelist.f90 | 4 ++-- 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/flang/lib/Lower/IO.cpp b/flang/lib/Lower/IO.cpp index 0d4f95fdcc4d8..75453721d91a2 100644 --- a/flang/lib/Lower/IO.cpp +++ b/flang/lib/Lower/IO.cpp @@ -32,6 +32,7 @@ #include "flang/Optimizer/Builder/Todo.h" #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/Support/FIRContext.h" +#include "flang/Optimizer/Support/InternalNames.h" #include "flang/Parser/parse-tree.h" #include "flang/Runtime/io-api-consts.h" #include "flang/Semantics/runtime-type-info.h" @@ -298,9 +299,10 @@ getNonTbpDefinedIoTableAddr(Fortran::lower::AbstractConverter &converter, mlir::Location loc = converter.getCurrentLocation(); mlir::Type refTy = fir::ReferenceType::get(mlir::NoneType::get(context)); std::string suffix = ".nonTbpDefinedIoTable"; - std::string tableMangleName = definedIoProcMap.empty() - ? "default" + suffix - : converter.mangleName(suffix); + std::string tableMangleName = + definedIoProcMap.empty() + ? fir::NameUniquer::doGenerated("default" + suffix) + : converter.mangleName(suffix); if (auto table = builder.getNamedGlobal(tableMangleName)) return builder.createConvert( loc, refTy, diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index 2f4cd84dda7de..d09f47a20b33d 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -2990,10 +2990,12 @@ struct GlobalOpConversion : public fir::FIROpConversion { g.setAlignment(*global.getAlignment()); auto module = global->getParentOfType(); + auto gpuMod = global->getParentOfType(); // Add comdat if necessary if (fir::getTargetTriple(module).supportsCOMDAT() && (linkage == mlir::LLVM::Linkage::Linkonce || - linkage == mlir::LLVM::Linkage::LinkonceODR)) { + linkage == mlir::LLVM::Linkage::LinkonceODR) && + !gpuMod) { addComdat(g, rewriter, module); } diff --git a/flang/test/Fir/CUDA/cuda-compiler-generated-names.mlir b/flang/test/Fir/CUDA/cuda-compiler-generated-names.mlir index 4507e444d1b51..8c5503d7baf8c 100644 --- a/flang/test/Fir/CUDA/cuda-compiler-generated-names.mlir +++ b/flang/test/Fir/CUDA/cuda-compiler-generated-names.mlir @@ -8,6 +8,22 @@ module @mod1 attributes {gpu.container} { %0 = fir.embox %arg0() : (!fir.ref>) -> !fir.box> return } + + fir.global @_QQdefault.nonTbpDefinedIoTable constant : tuple, !fir.ref, i32, i1>>>, i1> { + %true = arith.constant true + %c0_i64 = arith.constant 0 : i64 + %0 = fir.undefined tuple, !fir.ref, i32, i1>>>, i1> + %1 = fir.insert_value %0, %c0_i64, [0 : index] : (tuple, !fir.ref, i32, i1>>>, i1>, i64) -> tuple, !fir.ref, i32, i1>>>, i1> + %2 = fir.zero_bits !fir.ref, !fir.ref, i32, i1>>> + %3 = fir.insert_value %1, %2, [1 : index] : (tuple, !fir.ref, i32, i1>>>, i1>, !fir.ref, !fir.ref, i32, i1>>>) -> tuple, !fir.ref, i32, i1>>>, i1> + %4 = fir.insert_value %3, %true, [2 : index] : (tuple, !fir.ref, i32, i1>>>, i1>, i1) -> tuple, !fir.ref, i32, i1>>>, i1> + fir.has_value %4 : tuple, !fir.ref, i32, i1>>>, i1> + } + + func.func @special() { + %0 = fir.address_of(@_QQdefault.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> + return + } } } @@ -15,3 +31,5 @@ module @mod1 attributes {gpu.container} { // CHECK: llvm.mlir.global linkonce constant @_QMtest_dinitEXdtXtseq // CHECK: llvm.mlir.addressof @_QMtest_dinitEXdtXtseq : !llvm.ptr +// CHECK: llvm.mlir.global external constant @_QQdefaultXnonTbpDefinedIoTable() +// CHECK: llvm.mlir.addressof @_QQdefaultXnonTbpDefinedIoTable diff --git a/flang/test/Lower/io-derived-type.f90 b/flang/test/Lower/io-derived-type.f90 index 08b1207f55ad1..8ac995739afd7 100644 --- a/flang/test/Lower/io-derived-type.f90 +++ b/flang/test/Lower/io-derived-type.f90 @@ -51,7 +51,7 @@ subroutine test1 ! CHECK: fir.store %c2{{.*}} to %[[V_36]] : !fir.ref ! CHECK: %[[V_37:[0-9]+]] = fir.embox %{{.*}} : (!fir.ref>) -> !fir.box> ! CHECK: %[[V_38:[0-9]+]] = fir.convert %[[V_37]] : (!fir.box>) -> !fir.box - ! CHECK: %[[V_39:[0-9]+]] = fir.address_of(@default.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> + ! CHECK: %[[V_39:[0-9]+]] = fir.address_of(@_QQdefault.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> ! CHECK: %[[V_40:[0-9]+]] = fir.convert %[[V_39]] : (!fir.ref, !fir.ref, i32, i1>>>, i1>>) -> !fir.ref ! CHECK: %[[V_41:[0-9]+]] = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %[[V_38]], %[[V_40]]) fastmath : (!fir.ref, !fir.box, !fir.ref) -> i1 print *, 'test1 block, should not call wft: ', t(2) @@ -65,7 +65,7 @@ subroutine test2 ! CHECK: fir.store %c3{{.*}} to %[[V_14]] : !fir.ref ! CHECK: %[[V_15:[0-9]+]] = fir.embox %{{.*}} : (!fir.ref>) -> !fir.box> ! CHECK: %[[V_16:[0-9]+]] = fir.convert %[[V_15]] : (!fir.box>) -> !fir.box - ! CHECK: %[[V_17:[0-9]+]] = fir.address_of(@default.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> + ! CHECK: %[[V_17:[0-9]+]] = fir.address_of(@_QQdefault.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> ! CHECK: %[[V_18:[0-9]+]] = fir.convert %[[V_17]] : (!fir.ref, !fir.ref, i32, i1>>>, i1>>) -> !fir.ref ! CHECK: %[[V_19:[0-9]+]] = fir.call @_FortranAioOutputDerivedType(%{{.*}}, %[[V_16]], %[[V_18]]) fastmath : (!fir.ref, !fir.box, !fir.ref) -> i1 @@ -131,6 +131,6 @@ program p ! CHECK: fir.global linkonce @_QQMmFtest1.nonTbpDefinedIoTable.list constant : !fir.array<1xtuple, !fir.ref, i32, i1>> ! CHECK: fir.global linkonce @_QQMmFtest1.nonTbpDefinedIoTable constant : tuple, !fir.ref, i32, i1>>>, i1> -! CHECK: fir.global linkonce @default.nonTbpDefinedIoTable constant : tuple, !fir.ref, i32, i1>>>, i1> +! CHECK: fir.global linkonce @_QQdefault.nonTbpDefinedIoTable constant : tuple, !fir.ref, i32, i1>>>, i1> ! CHECK: fir.global linkonce @_QQF.nonTbpDefinedIoTable.list constant : !fir.array<1xtuple, !fir.ref, i32, i1>> ! CHECK: fir.global linkonce @_QQF.nonTbpDefinedIoTable constant : tuple, !fir.ref, i32, i1>>>, i1> diff --git a/flang/test/Lower/namelist.f90 b/flang/test/Lower/namelist.f90 index a96bbbfad0cd6..ea97a0957c35b 100644 --- a/flang/test/Lower/namelist.f90 +++ b/flang/test/Lower/namelist.f90 @@ -42,7 +42,7 @@ program p ! CHECK: %[[V_42:[0-9]+]] = fir.insert_value %[[V_39]], %[[V_41]], [0 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: %[[V_43:[0-9]+]] = fir.insert_value %[[V_42]], %c2{{.*}}, [1 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, i64) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: %[[V_44:[0-9]+]] = fir.insert_value %[[V_43]], %[[V_24]], [2 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref, !fir.ref>>>>) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> - ! CHECK: %[[V_45:[0-9]+]] = fir.address_of(@default.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> + ! CHECK: %[[V_45:[0-9]+]] = fir.address_of(@_QQdefault.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> ! CHECK: %[[V_46:[0-9]+]] = fir.convert %[[V_45]] : (!fir.ref, !fir.ref, i32, i1>>>, i1>>) -> !fir.ref ! CHECK: %[[V_47:[0-9]+]] = fir.insert_value %[[V_44]], %[[V_46]], [3 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: fir.store %[[V_47]] to %[[V_38]] : !fir.ref, i64, !fir.ref, !fir.ref>>>>, !fir.ref>> @@ -100,7 +100,7 @@ subroutine sss ! CHECK: %[[V_20:[0-9]+]] = fir.insert_value %[[V_17]], %[[V_19]], [0 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: %[[V_21:[0-9]+]] = fir.insert_value %[[V_20]], %c1{{.*}}, [1 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, i64) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: %[[V_22:[0-9]+]] = fir.insert_value %[[V_21]], %[[V_8]], [2 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref, !fir.ref>>>>) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> - ! CHECK: %[[V_23:[0-9]+]] = fir.address_of(@default.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> + ! CHECK: %[[V_23:[0-9]+]] = fir.address_of(@_QQdefault.nonTbpDefinedIoTable) : !fir.ref, !fir.ref, i32, i1>>>, i1>> ! CHECK: %[[V_24:[0-9]+]] = fir.convert %[[V_23]] : (!fir.ref, !fir.ref, i32, i1>>>, i1>>) -> !fir.ref ! CHECK: %[[V_25:[0-9]+]] = fir.insert_value %[[V_22]], %[[V_24]], [3 : index] : (tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref>, !fir.ref) -> tuple, i64, !fir.ref, !fir.ref>>>>, !fir.ref> ! CHECK: fir.store %[[V_25]] to %[[V_16]] : !fir.ref, i64, !fir.ref, !fir.ref>>>>, !fir.ref>> From fecf1397e32a89a928ebeeab07bfc7e38a318827 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 20 Dec 2024 10:41:54 -0800 Subject: [PATCH 020/466] [Tensor] Migrate away from PointerUnion::{is,get} (NFC) (#120679) Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa, cast and the llvm::dyn_cast I'm not touching PointerUnion::dyn_cast for now because it's a bit complicated; we could blindly migrate it to dyn_cast_if_present, but we should probably use dyn_cast when the operand is known to be non-null. --- mlir/lib/Dialect/Tensor/IR/TensorOps.cpp | 4 ++-- .../Tensor/Transforms/BufferizableOpInterfaceImpl.cpp | 4 ++-- .../Tensor/Transforms/IndependenceTransforms.cpp | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp index 21f78cf96c70e..f79c774ceb3e9 100644 --- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp +++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp @@ -142,8 +142,8 @@ static llvm::SmallBitVector getDroppedDims(ArrayRef reducedShape, size_t idx = mixedSizes.size() - size.index() - 1; // Rank-reduced dims must have a static unit dimension. bool isStaticUnitSize = - size.value().is() && - llvm::cast(size.value().get()).getInt() == 1; + isa(size.value()) && + llvm::cast(cast(size.value())).getInt() == 1; if (shapePos < 0) { // There are no more dims in the reduced shape. All remaining sizes must diff --git a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp index 9797b73f534a9..1abcacd6d6db3 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/BufferizableOpInterfaceImpl.cpp @@ -761,8 +761,8 @@ struct PadOpInterface RankedTensorType srcType = padOp.getSourceType(); auto toValue = [&](OpFoldResult ofr) { - if (ofr.is()) - return ofr.get(); + if (auto value = dyn_cast(ofr)) + return value; return rewriter .create(loc, *getConstantIntValue(ofr)) .getResult(); diff --git a/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp b/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp index a89ce20048dff..4655fa3cf0d23 100644 --- a/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp +++ b/mlir/lib/Dialect/Tensor/Transforms/IndependenceTransforms.cpp @@ -21,9 +21,9 @@ using namespace mlir::tensor; static FailureOr makeIndependent(OpBuilder &b, Location loc, OpFoldResult ofr, ValueRange independencies) { - if (ofr.is()) + if (isa(ofr)) return ofr; - Value value = ofr.get(); + Value value = cast(ofr); AffineMap boundMap; ValueDimList mapOperands; if (failed(ValueBoundsConstraintSet::computeIndependentBound( @@ -80,14 +80,14 @@ FailureOr tensor::buildIndependentOp(OpBuilder &b, tensor::PadOp padOp, for (int64_t i = 0, e = padOp.getResultType().getRank(); i < e; ++i) { // offset = ub(low_padding) - low_padding OpFoldResult prevLow = padOp.getMixedLowPad()[i]; - if (prevLow.is()) { + if (isa(prevLow)) { offsets.push_back(b.getIndexAttr(0)); } else { offsets.push_back( b.create( loc, b.getAffineDimExpr(0) - b.getAffineDimExpr(1), - std::initializer_list{newMixedLow[i].get(), - prevLow.get()}) + std::initializer_list{cast(newMixedLow[i]), + cast(prevLow)}) .getResult()); } // size = reified result size From 21a6dbd400ffd68abe36161576d81d0646f1122d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 20 Dec 2024 19:56:02 +0100 Subject: [PATCH 021/466] [LLD][COFF] Report undefined EC symbols on ARM64X (#120311) --- lld/COFF/Driver.cpp | 6 ++++-- lld/test/COFF/arm64x-symtab.s | 13 +++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index bef55abb7f856..a4d6b94812d93 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -2727,8 +2727,10 @@ void LinkerDriver::linkerMain(ArrayRef argsArr) { createECExportThunks(); // Resolve remaining undefined symbols and warn about imported locals. - while (ctx.symtab.resolveRemainingUndefines()) - run(); + ctx.forEachSymtab([&](SymbolTable &symtab) { + while (symtab.resolveRemainingUndefines()) + run(); + }); if (errorCount()) return; diff --git a/lld/test/COFF/arm64x-symtab.s b/lld/test/COFF/arm64x-symtab.s index e7beb0287d7ff..2b269dde61f61 100644 --- a/lld/test/COFF/arm64x-symtab.s +++ b/lld/test/COFF/arm64x-symtab.s @@ -6,6 +6,7 @@ // RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym.s -o sym-x86_64.obj // RUN: llvm-mc -filetype=obj -triple=aarch64-windows symref.s -o symref-aarch64.obj // RUN: llvm-mc -filetype=obj -triple=arm64ec-windows symref.s -o symref-arm64ec.obj +// RUN: llvm-mc -filetype=obj -triple=x86_64-windows symref.s -o symref-x86_64.obj // RUN: llvm-lib -machine:arm64x -out:sym.lib sym-aarch64.obj sym-arm64ec.obj // Check that native object files can't reference EC symbols. @@ -15,6 +16,18 @@ // UNDEF: lld-link: error: undefined symbol: sym // UNDEF-NEXT: >>> referenced by symref-aarch64.obj:(.data) +// Check that EC object files can't reference native symbols. + +// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-arm64ec.obj sym-aarch64.obj \ +// RUN: 2>&1 | FileCheck --check-prefix=UNDEFEC %s +// UNDEFEC: lld-link: error: undefined symbol: sym +// UNDEFEC-NEXT: >>> referenced by symref-arm64ec.obj:(.data) + +// RUN: not lld-link -machine:arm64x -dll -noentry -out:out.dll symref-x86_64.obj sym-aarch64.obj \ +// RUN: 2>&1 | FileCheck --check-prefix=UNDEFX86 %s +// UNDEFX86: lld-link: error: undefined symbol: sym +// UNDEFX86-NEXT: >>> referenced by symref-x86_64.obj:(.data) + // RUN: not lld-link -machine:arm64x -dll -noentry -out:err2.dll symref-aarch64.obj sym-x86_64.obj \ // RUN: 2>&1 | FileCheck --check-prefix=UNDEF %s From 399c3a78a2577c6fc68bba7f301901a0e66e87ed Mon Sep 17 00:00:00 2001 From: Ziqing Luo Date: Fri, 20 Dec 2024 11:12:16 -0800 Subject: [PATCH 022/466] [clang][NFC] Fix the static assertion in 4797437 (#120643) In the previous commit 4797437463e63ee289a1ff1904cfb7b2fe6cb4c2, I used `llvm::isInt(StmtClass::LAST##Class)` to test if `StmtClass` is strictly bounded by the an unsigned integer of 'NumStmtBits'. That is incorrect as `llvm::isInt` tests for signed integers. This commit fixes it. (rdar://141555357) --- clang/include/clang/AST/Stmt.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index 07cb63956aed0..f188bd47f5c0a 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -114,10 +114,9 @@ class alignas(void *) Stmt { #define STMT(CLASS, PARENT) #define STMT_RANGE(BASE, FIRST, LAST) #define LAST_STMT_RANGE(BASE, FIRST, LAST) \ - static_assert( \ - llvm::isInt(StmtClass::LAST##Class), \ - "The number of 'StmtClass'es is strictly bounded under two to " \ - "the power of 'NumStmtBits'"); + static_assert(llvm::isUInt(StmtClass::LAST##Class), \ + "The number of 'StmtClass'es is strictly bound " \ + "by a bitfield of width NumStmtBits"); #define ABSTRACT_STMT(STMT) #include "clang/AST/StmtNodes.inc" From 1b12ad124ec9eb83ca7d1511b12e1dc3e1c5e06a Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 20 Dec 2024 11:25:48 -0800 Subject: [PATCH 023/466] [IR] Correct Value::use_iterator::value_type. (#120609) operator* for this iterator returns Use& so I think the value_type should be Use not Use*. Noticed while comparing with SDNode::use_iterator. --- llvm/include/llvm/IR/Value.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index d444a768a6543..011aedece94ab 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -131,7 +131,7 @@ class Value { public: using iterator_category = std::forward_iterator_tag; - using value_type = UseT *; + using value_type = UseT; using difference_type = std::ptrdiff_t; using pointer = value_type *; using reference = value_type &; From d2b8acc10464e1f0f6e043f1a92cefc2f3b9d30f Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 20 Dec 2024 11:26:19 -0800 Subject: [PATCH 024/466] [RISCV] Swap the order of SEWGreaterThanOrEqualAndLessThan64 and SEWGreaterThanOrEqual. (#120649) SEWGreaterThanOrEqualAndLessThan64 is a stricter constraint so it should have a higher value than SEWGreaterThanOrEqual. Found by our random test generator. --- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp | 14 +++---- .../RISCV/rvv/vsetvli-insert-zve64f.mir | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index 49c2bc90c085a..75985832594d4 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -218,14 +218,14 @@ struct DemandedFields { bool VLZeroness = false; // What properties of SEW we need to preserve. enum : uint8_t { - SEWEqual = 3, // The exact value of SEW needs to be preserved. - SEWGreaterThanOrEqual = 2, // SEW can be changed as long as it's greater - // than or equal to the original value. + SEWEqual = 3, // The exact value of SEW needs to be preserved. SEWGreaterThanOrEqualAndLessThan64 = - 1, // SEW can be changed as long as it's greater - // than or equal to the original value, but must be less - // than 64. - SEWNone = 0 // We don't need to preserve SEW at all. + 2, // SEW can be changed as long as it's greater + // than or equal to the original value, but must be less + // than 64. + SEWGreaterThanOrEqual = 1, // SEW can be changed as long as it's greater + // than or equal to the original value. + SEWNone = 0 // We don't need to preserve SEW at all. } SEW = SEWNone; enum : uint8_t { LMULEqual = 2, // The exact value of LMUL needs to be preserved. diff --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir new file mode 100644 index 0000000000000..f65bba1b7b9c7 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-zve64f.mir @@ -0,0 +1,40 @@ +# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5 +# RUN: llc %s -mtriple=riscv64 -mattr=+zve64f -run-pass=riscv-insert-vsetvli -o - | FileCheck %s + +--- +name: spam +tracksRegLiveness: true +noPhis: true +isSSA: false +body: | + bb.0.entry: + liveins: $x10, $x11, $x12, $f10_f + + ; CHECK-LABEL: name: spam + ; CHECK: liveins: $x10, $x11, $x12, $f10_f + ; CHECK-NEXT: {{ $}} + ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr = COPY $x12 + ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr = COPY $x11 + ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr = COPY $x10 + ; CHECK-NEXT: [[COPY3:%[0-9]+]]:fpr32 = COPY $f10_f + ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 8, 208 /* e32, m1, ta, ma */, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: renamable $v10 = PseudoVFMV_S_FPR32 undef renamable $v10, [[COPY3]], 8, 5 /* e32 */, implicit $vl, implicit $vtype + ; CHECK-NEXT: renamable $v11 = PseudoVMV_S_X undef renamable $v11, [[COPY2]], 8, 5 /* e32 */, implicit $vl, implicit $vtype + ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 1, 216 /* e64, m1, ta, ma */, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: renamable $v8 = PseudoVLE64_V_M1 undef renamable $v8, [[COPY1]], 1, 6 /* e64 */, 2 /* tu, ma */, implicit $vl, implicit $vtype :: (load unknown-size, align 8) + ; CHECK-NEXT: dead $x0 = PseudoVSETIVLI 8, 208 /* e32, m1, ta, ma */, implicit-def $vl, implicit-def $vtype + ; CHECK-NEXT: renamable $v9 = PseudoVLE32_V_M1 undef renamable $v9, [[COPY]], 8, 5 /* e32 */, 2 /* tu, ma */, implicit $vl, implicit $vtype :: (load unknown-size, align 4) + ; CHECK-NEXT: INLINEASM &"# use $0 $1 $2 $3", 1 /* sideeffect attdialect */, 3145737 /* reguse:VR */, killed renamable $v10, 3145737 /* reguse:VR */, killed renamable $v11, 3145737 /* reguse:VR */, killed renamable $v8, 3145737 /* reguse:VR */, killed renamable $v9 + ; CHECK-NEXT: PseudoRET + %3:gpr = COPY $x12 + %2:gpr = COPY $x11 + %1:gpr = COPY $x10 + %0:fpr32 = COPY $f10_f + renamable $v10 = PseudoVFMV_S_FPR32 undef renamable $v10, %0, 8, 5 /* e32 */ + renamable $v11 = PseudoVMV_S_X undef renamable $v11, %1, 8, 5 /* e32 */ + renamable $v8 = PseudoVLE64_V_M1 undef renamable $v8, %2, 1, 6 /* e64 */, 2 /* tu, ma */ :: (load unknown-size, align 8) + renamable $v9 = PseudoVLE32_V_M1 undef renamable $v9, %3, 8, 5 /* e32 */, 2 /* tu, ma */ :: (load unknown-size, align 4) + INLINEASM &"# use $0 $1 $2 $3", 1 /* sideeffect attdialect */, 3145737 /* reguse:VR */, killed renamable $v10, 3145737 /* reguse:VR */, killed renamable $v11, 3145737 /* reguse:VR */, killed renamable $v8, 3145737 /* reguse:VR */, killed renamable $v9 + PseudoRET + +... From c7451ffcb94a1fe53b703e9fc3204bf6cda610a9 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Fri, 20 Dec 2024 11:27:54 -0800 Subject: [PATCH 025/466] [MemProf] Supporting hinting mostly-cold allocations after cloning (#120633) Optionally unconditionally hint allocations as cold or not cold during the cloning step if the percentage of bytes allocated is at least that of the given threshold. This is similar to PR120301 which supports this during matching, but enables the same behavior during cloning, to reduce the false positives that can be addressed by cloning at the cost of carrying the additional size metadata/summary. --- .../IPO/MemProfContextDisambiguation.cpp | 80 ++++++++++++++++--- .../Instrumentation/MemProfiler.cpp | 9 ++- .../ThinLTO/X86/memprof-missing-callsite.ll | 35 +++++++- llvm/test/Transforms/PGOProfile/memprof.ll | 4 + 4 files changed, 116 insertions(+), 12 deletions(-) diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp index cd4b9f557fb49..1bf7ff468d782 100644 --- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp +++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp @@ -140,6 +140,7 @@ cl::opt MemProfRequireDefinitionForPromotion( } // namespace llvm extern cl::opt MemProfReportHintedSizes; +extern cl::opt MinClonedColdBytePercent; namespace { /// CRTP base for graphs built from either IR or ThinLTO summary index. @@ -617,6 +618,11 @@ class CallsiteContextGraph { static_cast(this)->updateAllocationCall(Call, AllocType); } + /// Get the AllocationType assigned to the given allocation instruction clone. + AllocationType getAllocationCallType(const CallInfo &Call) const { + return static_cast(this)->getAllocationCallType(Call); + } + /// Update non-allocation call to invoke (possibly cloned) function /// CalleeFunc. void updateCall(CallInfo &CallerCall, FuncInfo CalleeFunc) { @@ -711,7 +717,8 @@ class CallsiteContextGraph { /// Map from each contextID to the profiled full contexts and their total /// sizes (there may be more than one due to context trimming), - /// optionally populated when requested (via MemProfReportHintedSizes). + /// optionally populated when requested (via MemProfReportHintedSizes or + /// MinClonedColdBytePercent). DenseMap> ContextIdToContextSizeInfos; /// Identifies the context node created for a stack id when adding the MIB @@ -773,6 +780,7 @@ class ModuleCallsiteContextGraph uint64_t getLastStackId(Instruction *Call); std::vector getStackIdsWithContextNodesForCall(Instruction *Call); void updateAllocationCall(CallInfo &Call, AllocationType AllocType); + AllocationType getAllocationCallType(const CallInfo &Call) const; void updateCall(CallInfo &CallerCall, FuncInfo CalleeFunc); CallsiteContextGraph::FuncInfo @@ -852,6 +860,7 @@ class IndexCallsiteContextGraph uint64_t getLastStackId(IndexCall &Call); std::vector getStackIdsWithContextNodesForCall(IndexCall &Call); void updateAllocationCall(CallInfo &Call, AllocationType AllocType); + AllocationType getAllocationCallType(const CallInfo &Call) const; void updateCall(CallInfo &CallerCall, FuncInfo CalleeFunc); CallsiteContextGraph::FuncInfo @@ -1201,8 +1210,7 @@ void CallsiteContextGraph::addStackNodesForMIB( ContextIdToAllocationType[++LastContextId] = AllocType; - if (MemProfReportHintedSizes) { - assert(!ContextSizeInfo.empty()); + if (!ContextSizeInfo.empty()) { auto &Entry = ContextIdToContextSizeInfos[LastContextId]; Entry.insert(Entry.begin(), ContextSizeInfo.begin(), ContextSizeInfo.end()); } @@ -2043,14 +2051,15 @@ IndexCallsiteContextGraph::IndexCallsiteContextGraph( CallStack::const_iterator> EmptyContext; unsigned I = 0; - assert(!MemProfReportHintedSizes || - AN.ContextSizeInfos.size() == AN.MIBs.size()); + assert( + (!MemProfReportHintedSizes && MinClonedColdBytePercent >= 100) || + AN.ContextSizeInfos.size() == AN.MIBs.size()); // Now add all of the MIBs and their stack nodes. for (auto &MIB : AN.MIBs) { CallStack::const_iterator> StackContext(&MIB); std::vector ContextSizeInfo; - if (MemProfReportHintedSizes) { + if (!AN.ContextSizeInfos.empty()) { for (auto [FullStackId, TotalSize] : AN.ContextSizeInfos[I]) ContextSizeInfo.push_back({FullStackId, TotalSize}); } @@ -2825,6 +2834,7 @@ void CallsiteContextGraph::printTotalSizes( if (!Node->IsAllocation) continue; DenseSet ContextIds = Node->getContextIds(); + auto AllocTypeFromCall = getAllocationCallType(Node->Call); std::vector SortedIds(ContextIds.begin(), ContextIds.end()); std::sort(SortedIds.begin(), SortedIds.end()); for (auto Id : SortedIds) { @@ -2837,7 +2847,11 @@ void CallsiteContextGraph::printTotalSizes( << getAllocTypeString((uint8_t)TypeI->second) << " full allocation context " << Info.FullStackId << " with total size " << Info.TotalSize << " is " - << getAllocTypeString(Node->AllocTypes) << " after cloning\n"; + << getAllocTypeString(Node->AllocTypes) << " after cloning"; + if (allocTypeToUse(Node->AllocTypes) != AllocTypeFromCall) + OS << " marked " << getAllocTypeString((uint8_t)AllocTypeFromCall) + << " due to cold byte percent"; + OS << "\n"; } } } @@ -3487,6 +3501,23 @@ void IndexCallsiteContextGraph::updateAllocationCall(CallInfo &Call, AI->Versions[Call.cloneNo()] = (uint8_t)AllocType; } +AllocationType +ModuleCallsiteContextGraph::getAllocationCallType(const CallInfo &Call) const { + const auto *CB = cast(Call.call()); + if (!CB->getAttributes().hasFnAttr("memprof")) + return AllocationType::None; + return CB->getAttributes().getFnAttr("memprof").getValueAsString() == "cold" + ? AllocationType::Cold + : AllocationType::NotCold; +} + +AllocationType +IndexCallsiteContextGraph::getAllocationCallType(const CallInfo &Call) const { + const auto *AI = Call.call().dyn_cast(); + assert(AI->Versions.size() > Call.cloneNo()); + return (AllocationType)AI->Versions[Call.cloneNo()]; +} + void ModuleCallsiteContextGraph::updateCall(CallInfo &CallerCall, FuncInfo CalleeFunc) { if (CalleeFunc.cloneNo() > 0) @@ -4017,6 +4048,9 @@ bool CallsiteContextGraph::assignFunctions() { } } + uint8_t BothTypes = + (uint8_t)AllocationType::Cold | (uint8_t)AllocationType::NotCold; + auto UpdateCalls = [&](ContextNode *Node, DenseSet &Visited, auto &&UpdateCalls) { @@ -4036,7 +4070,31 @@ bool CallsiteContextGraph::assignFunctions() { return; if (Node->IsAllocation) { - updateAllocationCall(Node->Call, allocTypeToUse(Node->AllocTypes)); + auto AT = allocTypeToUse(Node->AllocTypes); + // If the allocation type is ambiguous, and more aggressive hinting + // has been enabled via the MinClonedColdBytePercent flag, see if this + // allocation should be hinted cold anyway because its fraction cold bytes + // allocated is at least the given threshold. + if (Node->AllocTypes == BothTypes && MinClonedColdBytePercent < 100 && + !ContextIdToContextSizeInfos.empty()) { + uint64_t TotalCold = 0; + uint64_t Total = 0; + for (auto Id : Node->getContextIds()) { + auto TypeI = ContextIdToAllocationType.find(Id); + assert(TypeI != ContextIdToAllocationType.end()); + auto CSI = ContextIdToContextSizeInfos.find(Id); + if (CSI != ContextIdToContextSizeInfos.end()) { + for (auto &Info : CSI->second) { + Total += Info.TotalSize; + if (TypeI->second == AllocationType::Cold) + TotalCold += Info.TotalSize; + } + } + } + if (TotalCold * 100 >= Total * MinClonedColdBytePercent) + AT = AllocationType::Cold; + } + updateAllocationCall(Node->Call, AT); assert(Node->MatchingCalls.empty()); return; } @@ -4419,7 +4477,11 @@ bool MemProfContextDisambiguation::applyImport(Module &M) { // will still be none type or should have gotten the default NotCold. // Skip that after calling clone helper since that does some sanity // checks that confirm we haven't decided yet that we need cloning. - if (AllocNode.Versions.size() == 1) { + // We might have a single version that is cold due to the + // MinClonedColdBytePercent heuristic, make sure we don't skip in that + // case. + if (AllocNode.Versions.size() == 1 && + (AllocationType)AllocNode.Versions[0] != AllocationType::Cold) { assert((AllocationType)AllocNode.Versions[0] == AllocationType::NotCold || (AllocationType)AllocNode.Versions[0] == diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp index fea45d53b2eb4..661a05bfe0ad6 100644 --- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp @@ -176,6 +176,10 @@ static cl::opt cl::desc("Salvage stale MemProf profile"), cl::init(false), cl::Hidden); +cl::opt MinClonedColdBytePercent( + "memprof-cloning-cold-threshold", cl::init(100), cl::Hidden, + cl::desc("Min percent of cold bytes to hint alloc cold during cloning")); + extern cl::opt MemProfReportHintedSizes; static cl::opt MinMatchedColdBytePercent( @@ -755,7 +759,7 @@ static AllocationType addCallStack(CallStackTrie &AllocTrie, AllocInfo->Info.getAllocCount(), AllocInfo->Info.getTotalLifetime()); std::vector ContextSizeInfo; - if (MemProfReportHintedSizes) { + if (MemProfReportHintedSizes || MinClonedColdBytePercent < 100) { auto TotalSize = AllocInfo->Info.getTotalSize(); assert(TotalSize); assert(FullStackId != 0); @@ -1126,7 +1130,8 @@ readMemprof(Module &M, Function &F, IndexedInstrProfReader *MemProfReader, InlinedCallStack)) { NumOfMemProfMatchedAllocContexts++; uint64_t FullStackId = 0; - if (ClPrintMemProfMatchInfo || MemProfReportHintedSizes) + if (ClPrintMemProfMatchInfo || MemProfReportHintedSizes || + MinClonedColdBytePercent < 100) FullStackId = computeFullStackId(AllocInfo->CallStack); auto AllocType = addCallStack(AllocTrie, AllocInfo, FullStackId); TotalSize += AllocInfo->Info.getTotalSize(); diff --git a/llvm/test/ThinLTO/X86/memprof-missing-callsite.ll b/llvm/test/ThinLTO/X86/memprof-missing-callsite.ll index e7fbb3c0bad2c..5ce786c63ac1a 100644 --- a/llvm/test/ThinLTO/X86/memprof-missing-callsite.ll +++ b/llvm/test/ThinLTO/X86/memprof-missing-callsite.ll @@ -1,6 +1,7 @@ ;; Test callsite context graph generation for simple call graph with ;; two memprof contexts and no inlining, where one callsite required for -;; cloning is missing (e.g. unmatched). +;; cloning is missing (e.g. unmatched). Use this to test aggressive hinting +;; threshold. ;; ;; Original code looks like: ;; @@ -30,6 +31,30 @@ ; RUN: --check-prefix=SIZESUNHINTED ; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --implicit-check-not "\"memprof\"=\"cold\"" +;; Check that we do hint with a sufficient -memprof-cloning-cold-threshold. +; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o +; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ +; RUN: -supports-hot-cold-new \ +; RUN: -r=%t.o,main,plx \ +; RUN: -r=%t.o,_Znam, \ +; RUN: -memprof-report-hinted-sizes -memprof-cloning-cold-threshold=80 \ +; RUN: -pass-remarks=memprof-context-disambiguation -save-temps \ +; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=REMARKSHINTED \ +; RUN: --check-prefix=SIZESHINTED +; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IRHINTED + +;; Check again that we hint with a sufficient -memprof-cloning-cold-threshold, +;; even if we don't specify -memprof-report-hinted-sizes. +; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o +; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ +; RUN: -supports-hot-cold-new \ +; RUN: -r=%t.o,main,plx \ +; RUN: -r=%t.o,_Znam, \ +; RUN: -memprof-cloning-cold-threshold=80 \ +; RUN: -pass-remarks=memprof-context-disambiguation -save-temps \ +; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=REMARKSHINTED +; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IRHINTED + source_filename = "memprof-missing-callsite.ll" target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" @@ -68,3 +93,11 @@ attributes #0 = { noinline optnone } ; SIZESUNHINTED: NotCold full allocation context 123 with total size 100 is NotColdCold after cloning ; SIZESUNHINTED: Cold full allocation context 456 with total size 200 is NotColdCold after cloning ; SIZESUNHINTED: Cold full allocation context 789 with total size 300 is NotColdCold after cloning + +; SIZESHINTED: NotCold full allocation context 123 with total size 100 is NotColdCold after cloning marked Cold due to cold byte percent +; SIZESHINTED: Cold full allocation context 456 with total size 200 is NotColdCold after cloning marked Cold due to cold byte percent +; SIZESHINTED: Cold full allocation context 789 with total size 300 is NotColdCold after cloning marked Cold due to cold byte percent + +; REMARKSHINTED: call in clone _Z3foov marked with memprof allocation attribute cold + +; IRHINTED: "memprof"="cold" diff --git a/llvm/test/Transforms/PGOProfile/memprof.ll b/llvm/test/Transforms/PGOProfile/memprof.ll index 7e47c8ded4e4a..c0e44cccbf16f 100644 --- a/llvm/test/Transforms/PGOProfile/memprof.ll +++ b/llvm/test/Transforms/PGOProfile/memprof.ll @@ -69,6 +69,10 @@ ;; Check that we hint additional allocations with a threshold < 100% ; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -memprof-report-hinted-sizes -memprof-matching-cold-threshold=60 2>&1 | FileCheck %s --check-prefixes=TOTALSIZESSINGLE,TOTALSIZESTHRESH60 +;; Make sure that the -memprof-cloning-cold-threshold flag is enough to cause +;; the size metadata to be generated for the LTO link. +; RUN: opt < %s -passes='memprof-use' -pgo-warn-missing-function -S -memprof-cloning-cold-threshold=80 2>&1 | FileCheck %s --check-prefixes=TOTALSIZES + ;; Make sure we emit a random hotness seed if requested. ; RUN: llvm-profdata merge -memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND ; RAND: random hotness seed = From 6ab8401f53deddbd79f930ba2bec2f824c9567e3 Mon Sep 17 00:00:00 2001 From: Luke Quinn Date: Fri, 20 Dec 2024 14:32:27 -0500 Subject: [PATCH 026/466] [RISCV][GISel] Port AddiPair optimization (#120463) Check if (add r, imm) can be optimized to (ADDI (ADDI r, imm0), imm1), in which imm = imm0 + imml and both imm0 and imm1 are simm12. We make imm0 as large as possible and imm1 as small as possible so that we might be able to use c.addi for the small immediate. --- .../RISCV/GISel/RISCVInstructionSelector.cpp | 24 ++ llvm/lib/Target/RISCV/RISCVInstrInfo.td | 14 +- llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll | 247 ++++++++++++++++++ 3 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll diff --git a/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp b/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp index 985264c591e10..5aa66b3780b86 100644 --- a/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp +++ b/llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp @@ -137,6 +137,11 @@ class RISCVInstructionSelector : public InstructionSelector { void renderXLenSubTrailingOnes(MachineInstrBuilder &MIB, const MachineInstr &MI, int OpIdx) const; + void renderAddiPairImmLarge(MachineInstrBuilder &MIB, const MachineInstr &MI, + int OpIdx) const; + void renderAddiPairImmSmall(MachineInstrBuilder &MIB, const MachineInstr &MI, + int OpIdx) const; + const RISCVSubtarget &STI; const RISCVInstrInfo &TII; const RISCVRegisterInfo &TRI; @@ -871,6 +876,25 @@ void RISCVInstructionSelector::renderXLenSubTrailingOnes( MIB.addImm(Subtarget->getXLen() - llvm::countr_one(C)); } +void RISCVInstructionSelector::renderAddiPairImmSmall(MachineInstrBuilder &MIB, + const MachineInstr &MI, + int OpIdx) const { + assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 && + "Expected G_CONSTANT"); + int64_t Imm = MI.getOperand(1).getCImm()->getSExtValue(); + int64_t Adj = Imm < 0 ? -2048 : 2047; + MIB.addImm(Imm - Adj); +} + +void RISCVInstructionSelector::renderAddiPairImmLarge(MachineInstrBuilder &MIB, + const MachineInstr &MI, + int OpIdx) const { + assert(MI.getOpcode() == TargetOpcode::G_CONSTANT && OpIdx == -1 && + "Expected G_CONSTANT"); + int64_t Imm = MI.getOperand(1).getCImm()->getSExtValue() < 0 ? -2048 : 2047; + MIB.addImm(Imm); +} + const TargetRegisterClass *RISCVInstructionSelector::getRegClassForTypeOnBank( LLT Ty, const RegisterBank &RB) const { if (RB.getID() == RISCV::GPRBRegBankID) { diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index 24bf7da4dadc0..ac9805ded9d30 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -454,7 +454,14 @@ def AddiPair : PatLeaf<(imm), [{ // The immediate operand must be in range [-4096,-2049] or [2048,4094]. int64_t Imm = N->getSExtValue(); return (-4096 <= Imm && Imm <= -2049) || (2048 <= Imm && Imm <= 4094); -}]>; +}]> { + let GISelPredicateCode = [{ + if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg())) + return false; + int64_t Imm = MI.getOperand(1).getCImm()->getSExtValue(); + return (-4096 <= Imm && Imm <= -2049) || (2048 <= Imm && Imm <= 4094); + }]; +} // Return imm - (imm < 0 ? -2048 : 2047). def AddiPairImmSmall : SDNodeXFormgetSignedTargetConstant(Imm - Adj, SDLoc(N), N->getValueType(0)); }]>; +def GIAddiPairImmSmall : GICustomOperandRenderer<"renderAddiPairImmSmall">, + GISDNodeXFormEquiv; // Return -2048 if immediate is negative or 2047 if positive. These are the // largest simm12 values. @@ -470,6 +479,8 @@ def AddiPairImmLarge : SDNodeXFormgetSExtValue() < 0 ? -2048 : 2047; return CurDAG->getSignedTargetConstant(Imm, SDLoc(N), N->getValueType(0)); }]>; +def GIAddiPairImmLarge : GICustomOperandRenderer<"renderAddiPairImmLarge">, + GISDNodeXFormEquiv; def TrailingZeros : SDNodeXFormgetTargetConstant(llvm::countr_zero(N->getZExtValue()), @@ -537,7 +548,6 @@ def LeadingOnesWMask : PatLeaf<(imm), [{ return !isInt<32>(Imm) && isUInt<32>(Imm) && isShiftedMask_64(Imm) && Imm != UINT64_C(0xffffffff); }]; - } //===----------------------------------------------------------------------===// diff --git a/llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll b/llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll new file mode 100644 index 0000000000000..ff56ab193c480 --- /dev/null +++ b/llvm/test/CodeGen/RISCV/GlobalISel/add-imm.ll @@ -0,0 +1,247 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -mtriple=riscv32 -global-isel < %s \ +; RUN: | FileCheck %s -check-prefix=RV32I +; RUN: llc -mtriple=riscv64 -global-isel < %s \ +; RUN: | FileCheck %s -check-prefix=RV64I + +; These test how the immediate in an addition is materialized. + +define i32 @add_positive_low_bound_reject(i32 %a) nounwind { +; RV32I-LABEL: add_positive_low_bound_reject: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_positive_low_bound_reject: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: ret + %1 = add i32 %a, 2047 + ret i32 %1 +} + +define i32 @add_positive_low_bound_accept(i32 %a) nounwind { +; RV32I-LABEL: add_positive_low_bound_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: addi a0, a0, 1 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_positive_low_bound_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addi a0, a0, 1 +; RV64I-NEXT: ret + %1 = add i32 %a, 2048 + ret i32 %1 +} + +define i32 @add_positive_high_bound_accept(i32 %a) nounwind { +; RV32I-LABEL: add_positive_high_bound_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_positive_high_bound_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: ret + %1 = add i32 %a, 4094 + ret i32 %1 +} + +define i32 @add_positive_high_bound_reject(i32 %a) nounwind { +; RV32I-LABEL: add_positive_high_bound_reject: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a1, 1 +; RV32I-NEXT: addi a1, a1, -1 +; RV32I-NEXT: add a0, a0, a1 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_positive_high_bound_reject: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a1, 1 +; RV64I-NEXT: addiw a1, a1, -1 +; RV64I-NEXT: add a0, a0, a1 +; RV64I-NEXT: ret + %1 = add i32 %a, 4095 + ret i32 %1 +} + +define i32 @add_negative_high_bound_reject(i32 %a) nounwind { +; RV32I-LABEL: add_negative_high_bound_reject: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, -2048 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_negative_high_bound_reject: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, -2048 +; RV64I-NEXT: ret + %1 = add i32 %a, -2048 + ret i32 %1 +} + +define i32 @add_negative_high_bound_accept(i32 %a) nounwind { +; RV32I-LABEL: add_negative_high_bound_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, -2048 +; RV32I-NEXT: addi a0, a0, -1 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_negative_high_bound_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, -2048 +; RV64I-NEXT: addi a0, a0, -1 +; RV64I-NEXT: ret + %1 = add i32 %a, -2049 + ret i32 %1 +} + +define i32 @add_negative_low_bound_accept(i32 %a) nounwind { +; RV32I-LABEL: add_negative_low_bound_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, -2048 +; RV32I-NEXT: addi a0, a0, -2048 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_negative_low_bound_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, -2048 +; RV64I-NEXT: addi a0, a0, -2048 +; RV64I-NEXT: ret + %1 = add i32 %a, -4096 + ret i32 %1 +} + +define i32 @add_negative_low_bound_reject(i32 %a) nounwind { +; RV32I-LABEL: add_negative_low_bound_reject: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a1, 1048575 +; RV32I-NEXT: addi a1, a1, -1 +; RV32I-NEXT: add a0, a0, a1 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add_negative_low_bound_reject: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a1, 1048575 +; RV64I-NEXT: addiw a1, a1, -1 +; RV64I-NEXT: add a0, a0, a1 +; RV64I-NEXT: ret + %1 = add i32 %a, -4097 + ret i32 %1 +} + +define i32 @add32_accept(i32 %a) nounwind { +; RV32I-LABEL: add32_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: addi a0, a0, 952 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add32_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addi a0, a0, 952 +; RV64I-NEXT: ret + %1 = add i32 %a, 2999 + ret i32 %1 +} + +define signext i32 @add32_sext_accept(i32 signext %a) nounwind { +; RV32I-LABEL: add32_sext_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: addi a0, a0, 952 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add32_sext_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addiw a0, a0, 952 +; RV64I-NEXT: ret + %1 = add i32 %a, 2999 + ret i32 %1 +} + +@gv0 = global i32 0, align 4 +define signext i32 @add32_sext_reject_on_rv64(i32 signext %a) nounwind { +; RV32I-LABEL: add32_sext_reject_on_rv64: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a1, %hi(gv0) +; RV32I-NEXT: addi a0, a0, 2047 +; RV32I-NEXT: addi a0, a0, 953 +; RV32I-NEXT: sw a0, %lo(gv0)(a1) +; RV32I-NEXT: ret +; +; RV64I-LABEL: add32_sext_reject_on_rv64: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a1, %hi(gv0) +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addiw a0, a0, 953 +; RV64I-NEXT: sw a0, %lo(gv0)(a1) +; RV64I-NEXT: ret + %b = add nsw i32 %a, 3000 + store i32 %b, ptr @gv0, align 4 + ret i32 %b +} + +define i64 @add64_accept(i64 %a) nounwind { +; RV32I-LABEL: add64_accept: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a2, 1 +; RV32I-NEXT: addi a2, a2, -1097 +; RV32I-NEXT: add a0, a0, a2 +; RV32I-NEXT: sltu a2, a0, a2 +; RV32I-NEXT: add a1, a1, a2 +; RV32I-NEXT: ret +; +; RV64I-LABEL: add64_accept: +; RV64I: # %bb.0: +; RV64I-NEXT: addi a0, a0, 2047 +; RV64I-NEXT: addi a0, a0, 952 +; RV64I-NEXT: ret + %1 = add i64 %a, 2999 + ret i64 %1 +} + +@ga = global i32 0, align 4 +@gb = global i32 0, align 4 +define void @add32_reject() nounwind { +; RV32I-LABEL: add32_reject: +; RV32I: # %bb.0: +; RV32I-NEXT: lui a0, %hi(ga) +; RV32I-NEXT: lui a1, %hi(gb) +; RV32I-NEXT: lw a2, %lo(ga)(a0) +; RV32I-NEXT: lw a3, %lo(gb)(a1) +; RV32I-NEXT: lui a4, 1 +; RV32I-NEXT: addi a4, a4, -1096 +; RV32I-NEXT: add a2, a2, a4 +; RV32I-NEXT: add a3, a3, a4 +; RV32I-NEXT: sw a2, %lo(ga)(a0) +; RV32I-NEXT: sw a3, %lo(gb)(a1) +; RV32I-NEXT: ret +; +; RV64I-LABEL: add32_reject: +; RV64I: # %bb.0: +; RV64I-NEXT: lui a0, %hi(ga) +; RV64I-NEXT: lui a1, %hi(gb) +; RV64I-NEXT: lw a2, %lo(ga)(a0) +; RV64I-NEXT: lw a3, %lo(gb)(a1) +; RV64I-NEXT: lui a4, 1 +; RV64I-NEXT: addi a4, a4, -1096 +; RV64I-NEXT: add a2, a2, a4 +; RV64I-NEXT: add a3, a3, a4 +; RV64I-NEXT: sw a2, %lo(ga)(a0) +; RV64I-NEXT: sw a3, %lo(gb)(a1) +; RV64I-NEXT: ret + %1 = load i32, ptr @ga, align 4 + %2 = load i32, ptr @gb, align 4 + %3 = add i32 %1, 3000 + %4 = add i32 %2, 3000 + store i32 %3, ptr @ga, align 4 + store i32 %4, ptr @gb, align 4 + ret void +} From 0c629206b0b3e1ddd64104a56c7a573a55e8944a Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Fri, 20 Dec 2024 19:47:55 +0000 Subject: [PATCH 027/466] undef reviewer: tweak the regex so it doesn't warn about #undef --- llvm/utils/git/code-format-helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index 19264bca6ce8f..36fc5ee4c3d52 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -380,7 +380,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str # diff --git a/file b/file for file in re.split("^diff --git ", stdout, 0, re.MULTILINE): # search for additions of undef - if re.search("^[+].*" + regex, file, re.MULTILINE): + if re.search(r"^[+](?!\s*#\s*).*(\bundef\b|UndefValue::get)", file, re.MULTILINE): files.append(re.match("a/([^ ]+)", file.splitlines()[0])[1]) if not files: From 8b37c1c71bf66274251db35b742f8f4013be2f52 Mon Sep 17 00:00:00 2001 From: Ikhlas Ajbar Date: Fri, 20 Dec 2024 14:01:58 -0600 Subject: [PATCH 028/466] [Hexagon] Add V75 support to compiler and assembler (#120773) This patch introduces support for the Hexagon V75 architecture. It includes instruction formats, definitions, encodings, scheduling classes, and builtins/intrinsics. --- clang/include/clang/Basic/BuiltinsHexagon.def | 10 +- clang/include/clang/Driver/Options.td | 2 + clang/lib/Basic/Targets/Hexagon.cpp | 15 +- clang/test/Driver/hexagon-toolchain-elf.c | 7 + .../Misc/target-invalid-cpu-note/hexagon.c | 1 + clang/test/Preprocessor/hexagon-predefines.c | 16 + llvm/include/llvm/BinaryFormat/ELF.h | 1 + llvm/lib/Object/ELFObjectFile.cpp | 2 + llvm/lib/ObjectYAML/ELFYAML.cpp | 2 + llvm/lib/Target/Hexagon/Hexagon.td | 14 + llvm/lib/Target/Hexagon/HexagonDepArch.h | 4 +- llvm/lib/Target/Hexagon/HexagonDepArch.td | 2 + llvm/lib/Target/Hexagon/HexagonDepIICHVX.td | 592 ++++++++++++ .../lib/Target/Hexagon/HexagonDepIICScalar.td | 888 ++++++++++++++++++ llvm/lib/Target/Hexagon/HexagonSchedule.td | 1 + llvm/lib/Target/Hexagon/HexagonScheduleV75.td | 39 + llvm/lib/Target/Hexagon/HexagonSubtarget.h | 6 + .../MCTargetDesc/HexagonMCELFStreamer.cpp | 3 + .../MCTargetDesc/HexagonMCTargetDesc.cpp | 68 +- llvm/test/MC/Hexagon/arch-support.s | 9 + llvm/test/MC/Hexagon/v75_arch.s | 10 + 21 files changed, 1656 insertions(+), 36 deletions(-) create mode 100644 llvm/lib/Target/Hexagon/HexagonScheduleV75.td create mode 100644 llvm/test/MC/Hexagon/v75_arch.s diff --git a/clang/include/clang/Basic/BuiltinsHexagon.def b/clang/include/clang/Basic/BuiltinsHexagon.def index 0dc0f4567dd41..ca3f99176110e 100644 --- a/clang/include/clang/Basic/BuiltinsHexagon.def +++ b/clang/include/clang/Basic/BuiltinsHexagon.def @@ -17,8 +17,10 @@ # define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS) #endif +#pragma push_macro("V75") +#define V75 "v75" #pragma push_macro("V73") -#define V73 "v73" +#define V73 "v73|" V75 #pragma push_macro("V71") #define V71 "v71|" V73 #pragma push_macro("V69") @@ -40,8 +42,10 @@ #pragma push_macro("V5") #define V5 "v5|" V55 +#pragma push_macro("HVXV75") +#define HVXV75 "hvxv75" #pragma push_macro("HVXV73") -#define HVXV73 "hvxv73" +#define HVXV73 "hvxv73|" HVXV75 #pragma push_macro("HVXV71") #define HVXV71 "hvxv71|" HVXV73 #pragma push_macro("HVXV69") @@ -143,6 +147,7 @@ TARGET_BUILTIN(__builtin_HEXAGON_V6_vrmpyub_rtt_acc_128B,"V64iV64iV32iLLi","", " #pragma pop_macro("HVXV69") #pragma pop_macro("HVXV71") #pragma pop_macro("HVXV73") +#pragma pop_macro("HVXV75") #pragma pop_macro("V5") #pragma pop_macro("V55") @@ -155,6 +160,7 @@ TARGET_BUILTIN(__builtin_HEXAGON_V6_vrmpyub_rtt_acc_128B,"V64iV64iV32iLLi","", " #pragma pop_macro("V69") #pragma pop_macro("V71") #pragma pop_macro("V73") +#pragma pop_macro("V75") #undef BUILTIN #undef TARGET_BUILTIN diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 638f8c52053ec..9edf308cc685e 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -6224,6 +6224,8 @@ def mv71t : Flag<["-"], "mv71t">, Group, Alias, AliasArgs<["hexagonv71t"]>; def mv73 : Flag<["-"], "mv73">, Group, Alias, AliasArgs<["hexagonv73"]>; +def mv75 : Flag<["-"], "mv75">, Group, + Alias, AliasArgs<["hexagonv75"]>; def mhexagon_hvx : Flag<["-"], "mhvx">, Group, HelpText<"Enable Hexagon Vector eXtensions">; def mhexagon_hvx_EQ : Joined<["-"], "mhvx=">, diff --git a/clang/lib/Basic/Targets/Hexagon.cpp b/clang/lib/Basic/Targets/Hexagon.cpp index 0282ac812c306..931327bd8657b 100644 --- a/clang/lib/Basic/Targets/Hexagon.cpp +++ b/clang/lib/Basic/Targets/Hexagon.cpp @@ -78,6 +78,9 @@ void HexagonTargetInfo::getTargetDefines(const LangOptions &Opts, } else if (CPU == "hexagonv73") { Builder.defineMacro("__HEXAGON_V73__"); Builder.defineMacro("__HEXAGON_ARCH__", "73"); + } else if (CPU == "hexagonv75") { + Builder.defineMacro("__HEXAGON_V75__"); + Builder.defineMacro("__HEXAGON_ARCH__", "75"); } if (hasFeature("hvx-length64b")) { @@ -229,13 +232,13 @@ struct CPUSuffix { }; static constexpr CPUSuffix Suffixes[] = { - {{"hexagonv5"}, {"5"}}, {{"hexagonv55"}, {"55"}}, - {{"hexagonv60"}, {"60"}}, {{"hexagonv62"}, {"62"}}, - {{"hexagonv65"}, {"65"}}, {{"hexagonv66"}, {"66"}}, + {{"hexagonv5"}, {"5"}}, {{"hexagonv55"}, {"55"}}, + {{"hexagonv60"}, {"60"}}, {{"hexagonv62"}, {"62"}}, + {{"hexagonv65"}, {"65"}}, {{"hexagonv66"}, {"66"}}, {{"hexagonv67"}, {"67"}}, {{"hexagonv67t"}, {"67t"}}, - {{"hexagonv68"}, {"68"}}, {{"hexagonv69"}, {"69"}}, - {{"hexagonv71"}, {"71"}}, {{"hexagonv71t"}, {"71t"}}, - {{"hexagonv73"}, {"73"}}, + {{"hexagonv68"}, {"68"}}, {{"hexagonv69"}, {"69"}}, + {{"hexagonv71"}, {"71"}}, {{"hexagonv71t"}, {"71t"}}, + {{"hexagonv73"}, {"73"}}, {{"hexagonv75"}, {"75"}}, }; std::optional HexagonTargetInfo::getHexagonCPURev(StringRef Name) { diff --git a/clang/test/Driver/hexagon-toolchain-elf.c b/clang/test/Driver/hexagon-toolchain-elf.c index 716d82bcf316b..37d24d4b2b99d 100644 --- a/clang/test/Driver/hexagon-toolchain-elf.c +++ b/clang/test/Driver/hexagon-toolchain-elf.c @@ -152,6 +152,13 @@ // CHECK230: "-cc1" {{.*}} "-target-cpu" "hexagonv73" // CHECK230: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v73/crt0 +// RUN: not %clang -### --target=hexagon-unknown-elf \ +// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \ +// RUN: -mcpu=hexagonv75 -fuse-ld=hexagon-link \ +// RUN: %s 2>&1 | FileCheck -check-prefix=CHECK240 %s +// CHECK240: "-cc1" {{.*}} "-target-cpu" "hexagonv75" +// CHECK240: hexagon-link{{.*}}/Inputs/hexagon_tree/Tools/bin/../target/hexagon/lib/v75/crt0 + // ----------------------------------------------------------------------------- // Test Linker related args // ----------------------------------------------------------------------------- diff --git a/clang/test/Misc/target-invalid-cpu-note/hexagon.c b/clang/test/Misc/target-invalid-cpu-note/hexagon.c index a7b73f33cccae..7c3f0999a53cc 100644 --- a/clang/test/Misc/target-invalid-cpu-note/hexagon.c +++ b/clang/test/Misc/target-invalid-cpu-note/hexagon.c @@ -18,4 +18,5 @@ // CHECK-SAME: {{^}}, hexagonv71 // CHECK-SAME: {{^}}, hexagonv71t // CHECK-SAME: {{^}}, hexagonv73 +// CHECK-SAME: {{^}}, hexagonv75 // CHECK-SAME: {{$}} diff --git a/clang/test/Preprocessor/hexagon-predefines.c b/clang/test/Preprocessor/hexagon-predefines.c index 188f465520056..ad92c40e744c7 100644 --- a/clang/test/Preprocessor/hexagon-predefines.c +++ b/clang/test/Preprocessor/hexagon-predefines.c @@ -137,6 +137,22 @@ // CHECK-V73HVX-128B: #define __HVX__ 1 // CHECK-V73HVX-128B: #define __hexagon__ 1 +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv75 %s\ +// RUN: | FileCheck %s -check-prefix CHECK-V75 +// CHECK-V75: #define __HEXAGON_ARCH__ 75 +// CHECK-V75: #define __HEXAGON_PHYSICAL_SLOTS__ 4 +// CHECK-V75: #define __HEXAGON_V75__ 1 +// CHECK-V75: #define __hexagon__ 1 + +// RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv75 \ +// RUN: -target-feature +hvxv75 -target-feature +hvx-length128b %s | FileCheck \ +// RUN: %s -check-prefix CHECK-V75HVX-128B +// CHECK-V75HVX-128B: #define __HEXAGON_ARCH__ 75 +// CHECK-V75HVX-128B: #define __HEXAGON_V75__ 1 +// CHECK-V75HVX-128B: #define __HVX_ARCH__ 75 +// CHECK-V75HVX-128B: #define __HVX_LENGTH__ 128 +// CHECK-V75HVX-128B: #define __HVX__ 1 +// CHECK-V75HVX-128B: #define __hexagon__ 1 // RUN: %clang_cc1 -E -dM -triple hexagon-unknown-elf -target-cpu hexagonv67 \ // RUN: -target-feature +hvxv67 -target-feature +hvx-length128b %s | FileCheck \ diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index 024b136816ff7..7858e59b2cc92 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -629,6 +629,7 @@ enum { EF_HEXAGON_MACH_V71 = 0x00000071, // Hexagon V71 EF_HEXAGON_MACH_V71T = 0x00008071, // Hexagon V71T EF_HEXAGON_MACH_V73 = 0x00000073, // Hexagon V73 + EF_HEXAGON_MACH_V75 = 0x00000075, // Hexagon V75 EF_HEXAGON_MACH = 0x000003ff, // Hexagon V.. // Highest ISA version flags diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 76415aed1387c..1ddfadaf1e271 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -309,6 +309,8 @@ static std::optional hexagonAttrToFeatureString(unsigned Attr) { return "v71"; case 73: return "v73"; + case 75: + return "v75"; default: return {}; } diff --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp index f28e6766f734c..7e94d01a97153 100644 --- a/llvm/lib/ObjectYAML/ELFYAML.cpp +++ b/llvm/lib/ObjectYAML/ELFYAML.cpp @@ -496,6 +496,7 @@ void ScalarBitSetTraits::bitset(IO &IO, BCaseMask(EF_HEXAGON_MACH_V71, EF_HEXAGON_MACH); BCaseMask(EF_HEXAGON_MACH_V71T, EF_HEXAGON_MACH); BCaseMask(EF_HEXAGON_MACH_V73, EF_HEXAGON_MACH); + BCaseMask(EF_HEXAGON_MACH_V75, EF_HEXAGON_MACH); BCaseMask(EF_HEXAGON_ISA_V2, EF_HEXAGON_ISA); BCaseMask(EF_HEXAGON_ISA_V3, EF_HEXAGON_ISA); BCaseMask(EF_HEXAGON_ISA_V4, EF_HEXAGON_ISA); @@ -510,6 +511,7 @@ void ScalarBitSetTraits::bitset(IO &IO, BCaseMask(EF_HEXAGON_ISA_V69, EF_HEXAGON_ISA); BCaseMask(EF_HEXAGON_ISA_V71, EF_HEXAGON_ISA); BCaseMask(EF_HEXAGON_ISA_V73, EF_HEXAGON_ISA); + BCaseMask(EF_HEXAGON_ISA_V75, EF_HEXAGON_ISA); break; case ELF::EM_AVR: BCaseMask(EF_AVR_ARCH_AVR1, EF_AVR_ARCH_MASK); diff --git a/llvm/lib/Target/Hexagon/Hexagon.td b/llvm/lib/Target/Hexagon/Hexagon.td index d31597158cc1c..79c958cb0b6f7 100644 --- a/llvm/lib/Target/Hexagon/Hexagon.td +++ b/llvm/lib/Target/Hexagon/Hexagon.td @@ -67,6 +67,12 @@ def ExtensionHVXV73: SubtargetFeature<"hvxv73", "HexagonHVXVersion", [ExtensionHVXV60, ExtensionHVXV62, ExtensionHVXV65, ExtensionHVXV66, ExtensionHVXV67, ExtensionHVXV68, ExtensionHVXV69, ExtensionHVXV71]>; +def ExtensionHVXV75: SubtargetFeature<"hvxv75", "HexagonHVXVersion", + "Hexagon::ArchEnum::V75", "Hexagon HVX instructions", + [ExtensionHVXV60, ExtensionHVXV62, ExtensionHVXV65, ExtensionHVXV66, + ExtensionHVXV67, ExtensionHVXV68, ExtensionHVXV69, ExtensionHVXV71, + ExtensionHVXV73]>; + def ExtensionHVX64B: SubtargetFeature<"hvx-length64b", "UseHVX64BOps", "true", "Hexagon HVX 64B instructions", [ExtensionHVX]>; def ExtensionHVX128B: SubtargetFeature<"hvx-length128b", "UseHVX128BOps", @@ -137,6 +143,8 @@ def UseHVXV71 : Predicate<"HST->useHVXV71Ops()">, AssemblerPredicate<(all_of ExtensionHVXV71)>; def UseHVXV73 : Predicate<"HST->useHVXV73Ops()">, AssemblerPredicate<(all_of ExtensionHVXV73)>; +def UseHVXV75 : Predicate<"HST->useHVXV75Ops()">, + AssemblerPredicate<(all_of ExtensionHVXV75)>; def UseAudio : Predicate<"HST->useAudioOps()">, AssemblerPredicate<(all_of ExtensionAudio)>; def UseZReg : Predicate<"HST->useZRegOps()">, @@ -462,6 +470,12 @@ def : Proc<"hexagonv73", HexagonModelV73, ArchV68, ArchV69, ArchV71, ArchV73, FeatureCompound, FeatureDuplex, FeatureMemNoShuf, FeatureMemops, FeatureNVJ, FeatureNVS, FeaturePackets, FeatureSmallData]>; +def : Proc<"hexagonv75", HexagonModelV75, + [ArchV5, ArchV55, ArchV60, ArchV62, ArchV65, ArchV66, ArchV67, + ArchV68, ArchV69, ArchV71, ArchV73, ArchV75, FeatureCompound, + FeatureDuplex, FeatureMemNoShuf, FeatureMemops, FeatureNVJ, + FeatureNVS, FeaturePackets, FeatureSmallData]>; + // Need to update the correct features for tiny core. // Disable NewValueJumps since the packetizer is unable to handle a packet with // a new value jump and another SLOT0 instruction. diff --git a/llvm/lib/Target/Hexagon/HexagonDepArch.h b/llvm/lib/Target/Hexagon/HexagonDepArch.h index 8eb6ee1ca497f..7c20bd1172130 100644 --- a/llvm/lib/Target/Hexagon/HexagonDepArch.h +++ b/llvm/lib/Target/Hexagon/HexagonDepArch.h @@ -27,7 +27,8 @@ enum class ArchEnum { V68, V69, V71, - V73 + V73, + V75 }; inline std::optional getCpu(StringRef CPU) { @@ -46,6 +47,7 @@ inline std::optional getCpu(StringRef CPU) { .Case("hexagonv71", Hexagon::ArchEnum::V71) .Case("hexagonv71t", Hexagon::ArchEnum::V71) .Case("hexagonv73", Hexagon::ArchEnum::V73) + .Case("hexagonv75", Hexagon::ArchEnum::V75) .Default(std::nullopt); } } // namespace Hexagon diff --git a/llvm/lib/Target/Hexagon/HexagonDepArch.td b/llvm/lib/Target/Hexagon/HexagonDepArch.td index 08640c7d9a200..6b62ffbec6e75 100644 --- a/llvm/lib/Target/Hexagon/HexagonDepArch.td +++ b/llvm/lib/Target/Hexagon/HexagonDepArch.td @@ -30,3 +30,5 @@ def ArchV71: SubtargetFeature<"v71", "HexagonArchVersion", "Hexagon::ArchEnum::V def HasV71 : Predicate<"HST->hasV71Ops()">, AssemblerPredicate<(all_of ArchV71)>; def ArchV73: SubtargetFeature<"v73", "HexagonArchVersion", "Hexagon::ArchEnum::V73", "Enable Hexagon V73 architecture">; def HasV73 : Predicate<"HST->hasV73Ops()">, AssemblerPredicate<(all_of ArchV73)>; +def ArchV75: SubtargetFeature<"v75", "HexagonArchVersion", "Hexagon::ArchEnum::V75", "Enable Hexagon V75 architecture">; +def HasV75 : Predicate<"HST->hasV75Ops()">, AssemblerPredicate<(all_of ArchV75)>; diff --git a/llvm/lib/Target/Hexagon/HexagonDepIICHVX.td b/llvm/lib/Target/Hexagon/HexagonDepIICHVX.td index 897f8b73bb7aa..d1d331175ba8b 100644 --- a/llvm/lib/Target/Hexagon/HexagonDepIICHVX.td +++ b/llvm/lib/Target/Hexagon/HexagonDepIICHVX.td @@ -6038,3 +6038,595 @@ class DepHVXItinV73 { [Hex_FWD, Hex_FWD, HVX_FWD]> ]; } + +class DepHVXItinV75 { + list DepHVXItinV75_list = [ + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE], 0>, + InstrStage<1, [CVI_MPY01]>], [9, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_SHIFT]>], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 7, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 7], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_XLANE]>], [2, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL]>], [], + []>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1], 0>, + InstrStage<1, [CVI_SHIFT, CVI_XLANE]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_SHIFT]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [3, 7, 1, 2, 7], + [Hex_FWD, HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 2, 2], + [HVX_FWD, HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 3, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE], 0>, + InstrStage<1, [CVI_MPY01]>], [3, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 7, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL_NOMEM]>], [9, 3, 5, 2], + [HVX_FWD, Hex_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 7, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL_NOMEM]>], [9, 3, 7, 5, 2], + [HVX_FWD, Hex_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 7, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_SHIFT]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD]>], [9, 2, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 2, 7], + [HVX_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ZW]>], [3, 2, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_XLANE]>], [9, 3, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [1, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [3, 1, 2, 7], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [7, 1, 2, 7], + [HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 3, 2, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLANE]>], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_SHIFT]>], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD]>], [9, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [4, 7, 1], + [Hex_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [3, 2, 1, 2, 7], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLANE]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [7, 1, 2, 7, 7], + [HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLANE]>], [9, 2], + [HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL_NOMEM]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD]>], [9, 3, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [3, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLANE]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [1, 2, 7], + [Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [9, 7, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [2, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [9], + [HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [1, 2, 7, 7], + [Hex_FWD, Hex_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_SHIFT]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL]>], [3, 2], + [HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [7, 1, 2, 7], + [HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 9, 7, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [7, 1, 2, 7, 7], + [HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL_NOMEM]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLANE]>], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE], 0>, + InstrStage<1, [CVI_MPY01]>], [9, 3, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE], 0>, + InstrStage<1, [CVI_MPY01]>], [1, 2, 5], + [Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 7, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [1, 2, 7, 7], + [Hex_FWD, Hex_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [2, 1, 2, 7], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ZW]>], [3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [1, 2, 7], + [Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [7, 1, 2, 7], + [HVX_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_XLANE]>], [9, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [1, 2, 5], + [Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 2, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [9, 2, 7, 7], + [HVX_FWD, Hex_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL]>], [2], + [Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [9, 7], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD]>], [9, 3, 2, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 7, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_LD], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 1, 2], + [HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 2], + [HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [1, 2, 7], + [Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_XLANE]>], [3, 2, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1], 0>, + InstrStage<1, [CVI_SHIFT, CVI_XLANE]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01, CVI_XLSHF]>], [9, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ZW]>], [2, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_XLSHF]>], [9, 7, 5, 5], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_XLANE]>], [3, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData ], [9, 5], + [HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1, CVI_SHIFT, CVI_XLANE]>], [9, 9, 7, 7], + [HVX_FWD, HVX_FWD, HVX_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ALL]>], [3], + [HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 7, 5, 2, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ZW]>], [1, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_ST]>], [3, 2, 1, 2, 5], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, HVX_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY0, CVI_MPY1]>], [9, 5, 5, 2], + [HVX_FWD, HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [CVI_MPY01]>], [9, 5, 2], + [HVX_FWD, HVX_FWD, Hex_FWD]>, + + InstrItinData , + InstrStage<1, [SLOT1], 0>, + InstrStage<1, [CVI_ST], 0>, + InstrStage<1, [CVI_XLANE]>], [1, 2, 5], + [Hex_FWD, Hex_FWD, HVX_FWD]> + ]; +} diff --git a/llvm/lib/Target/Hexagon/HexagonDepIICScalar.td b/llvm/lib/Target/Hexagon/HexagonDepIICScalar.td index 257ca203426e0..a422e59830970 100644 --- a/llvm/lib/Target/Hexagon/HexagonDepIICScalar.td +++ b/llvm/lib/Target/Hexagon/HexagonDepIICScalar.td @@ -11964,3 +11964,891 @@ class DepScalarItinV73 { [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]> ]; } + +class DepScalarItinV75 { + list DepScalarItinV75_list = [ + InstrItinData ], [2, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 3], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [2, 1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 3, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3], + [Hex_FWD]>, + + InstrItinData ], [3, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 4, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 3, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [4, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 4, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3], + [Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 2, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3], + [Hex_FWD]>, + + InstrItinData ], [4, 2, 2, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 4, 3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4], + [Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 3], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [4, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [1, 3], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3], + [Hex_FWD]>, + + InstrItinData ], [1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [5, 5, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [2, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [1, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 3, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 2, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 2, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 1, 2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [1, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [3, 1, 2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [], + []>, + + InstrItinData ], [2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [], + []>, + + InstrItinData ], [3, 2, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 1, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [1], + [Hex_FWD]>, + + InstrItinData ], [2, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [3, 2, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4, 1], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 1, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [4, 3, 1, 2, 3], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [3, 2, 2], + [Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [5, 5, 1, 1], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]>, + + InstrItinData ], [2], + [Hex_FWD]>, + + InstrItinData ], [2, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2], + [Hex_FWD, Hex_FWD]>, + + InstrItinData ], [4, 2, 1, 2], + [Hex_FWD, Hex_FWD, Hex_FWD, Hex_FWD]> + ]; +} diff --git a/llvm/lib/Target/Hexagon/HexagonSchedule.td b/llvm/lib/Target/Hexagon/HexagonSchedule.td index 01969caf15549..c14fa4c4736e4 100644 --- a/llvm/lib/Target/Hexagon/HexagonSchedule.td +++ b/llvm/lib/Target/Hexagon/HexagonSchedule.td @@ -73,3 +73,4 @@ include "HexagonScheduleV69.td" include "HexagonScheduleV71.td" include "HexagonScheduleV71T.td" include "HexagonScheduleV73.td" +include "HexagonScheduleV75.td" diff --git a/llvm/lib/Target/Hexagon/HexagonScheduleV75.td b/llvm/lib/Target/Hexagon/HexagonScheduleV75.td new file mode 100644 index 0000000000000..bce344f225a92 --- /dev/null +++ b/llvm/lib/Target/Hexagon/HexagonScheduleV75.td @@ -0,0 +1,39 @@ +//=-HexagonScheduleV75.td - HexagonV75 Scheduling Definitions *- tablegen -*-=// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// +// ScalarItin, SilverV65Itin and HVXItin contain some old itineraries +// still used by a handful of instructions. Hopefully, we will be able +// to get rid of them soon. +def HexagonV75ItinList : DepScalarItinV75, ScalarItin, + DepHVXItinV75, HVXItin, PseudoItin { + list ItinList = + !listconcat(DepScalarItinV75_list, ScalarItin_list, + DepHVXItinV75_list, HVXItin_list, PseudoItin_list); +} + +def HexagonItinerariesV75 : + ProcessorItineraries<[SLOT0, SLOT1, SLOT2, SLOT3, SLOT_ENDLOOP, + CVI_ST, CVI_XLANE, CVI_SHIFT, CVI_MPY0, CVI_MPY1, + CVI_LD, CVI_XLSHF, CVI_MPY01, CVI_ALL, + CVI_ALL_NOMEM, CVI_ZW], + [Hex_FWD, HVX_FWD], + HexagonV75ItinList.ItinList>; + +def HexagonModelV75 : SchedMachineModel { + // Max issue per cycle == bundle width. + let IssueWidth = 4; + let Itineraries = HexagonItinerariesV75; + let LoadLatency = 1; + let CompleteModel = 0; +} + +//===----------------------------------------------------------------------===// +// Hexagon V75 Resource Definitions - +//===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/Hexagon/HexagonSubtarget.h b/llvm/lib/Target/Hexagon/HexagonSubtarget.h index da3f8f56ccc4a..58a14268f5de1 100644 --- a/llvm/lib/Target/Hexagon/HexagonSubtarget.h +++ b/llvm/lib/Target/Hexagon/HexagonSubtarget.h @@ -210,6 +210,12 @@ class HexagonSubtarget : public HexagonGenSubtargetInfo { bool hasV73OpsOnly() const { return getHexagonArchVersion() == Hexagon::ArchEnum::V73; } + bool hasV75Ops() const { + return getHexagonArchVersion() >= Hexagon::ArchEnum::V75; + } + bool hasV75OpsOnly() const { + return getHexagonArchVersion() == Hexagon::ArchEnum::V75; + } bool useAudioOps() const { return UseAudioOps; } bool useCompound() const { return UseCompound; } diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp index ddc6898d53dbf..32d9f1f822af9 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp @@ -182,6 +182,9 @@ static unsigned featureToArchVersion(unsigned Feature) { case Hexagon::ArchV73: case Hexagon::ExtensionHVXV73: return 73; + case Hexagon::ArchV75: + case Hexagon::ExtensionHVXV75: + return 75; } llvm_unreachable("Expected valid arch feature"); return 0; diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp index aa86b2df85629..dfa1f5471ad24 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp @@ -91,6 +91,8 @@ cl::opt MV71T("mv71t", cl::Hidden, cl::desc("Build for Hexagon V71T"), cl::init(false)); cl::opt MV73("mv73", cl::Hidden, cl::desc("Build for Hexagon V73"), cl::init(false)); +cl::opt MV75("mv75", cl::Hidden, cl::desc("Build for Hexagon V75"), + cl::init(false)); } // namespace cl::opt EnableHVX( @@ -104,6 +106,7 @@ cl::opt EnableHVX( clEnumValN(Hexagon::ArchEnum::V69, "v69", "Build for HVX v69"), clEnumValN(Hexagon::ArchEnum::V71, "v71", "Build for HVX v71"), clEnumValN(Hexagon::ArchEnum::V73, "v73", "Build for HVX v73"), + clEnumValN(Hexagon::ArchEnum::V75, "v75", "Build for HVX v75"), // Sentinel for no value specified. clEnumValN(Hexagon::ArchEnum::Generic, "", "")), // Sentinel for flag not present. @@ -148,6 +151,8 @@ static StringRef HexagonGetArchVariant() { return "hexagonv71t"; if (MV73) return "hexagonv73"; + if (MV75) + return "hexagonv75"; return ""; } @@ -443,19 +448,23 @@ std::string selectHexagonFS(StringRef CPU, StringRef FS) { case Hexagon::ArchEnum::V73: Result.push_back("+hvxv73"); break; - case Hexagon::ArchEnum::Generic:{ + case Hexagon::ArchEnum::V75: + Result.push_back("+hvxv75"); + break; + case Hexagon::ArchEnum::Generic: { Result.push_back(StringSwitch(CPU) - .Case("hexagonv60", "+hvxv60") - .Case("hexagonv62", "+hvxv62") - .Case("hexagonv65", "+hvxv65") - .Case("hexagonv66", "+hvxv66") - .Case("hexagonv67", "+hvxv67") - .Case("hexagonv67t", "+hvxv67") - .Case("hexagonv68", "+hvxv68") - .Case("hexagonv69", "+hvxv69") - .Case("hexagonv71", "+hvxv71") - .Case("hexagonv71t", "+hvxv71") - .Case("hexagonv73", "+hvxv73")); + .Case("hexagonv60", "+hvxv60") + .Case("hexagonv62", "+hvxv62") + .Case("hexagonv65", "+hvxv65") + .Case("hexagonv66", "+hvxv66") + .Case("hexagonv67", "+hvxv67") + .Case("hexagonv67t", "+hvxv67") + .Case("hexagonv68", "+hvxv68") + .Case("hexagonv69", "+hvxv69") + .Case("hexagonv71", "+hvxv71") + .Case("hexagonv71t", "+hvxv71") + .Case("hexagonv73", "+hvxv73") + .Case("hexagonv75", "+hvxv75")); break; } case Hexagon::ArchEnum::NoArch: @@ -503,8 +512,8 @@ FeatureBitset Hexagon_MC::completeHVXFeatures(const FeatureBitset &S) { // turns on hvxvNN, corresponding to the existing ArchVNN. FeatureBitset FB = S; unsigned CpuArch = ArchV5; - for (unsigned F : {ArchV73, ArchV71, ArchV69, ArchV68, ArchV67, ArchV66, - ArchV65, ArchV62, ArchV60, ArchV55, ArchV5}) { + for (unsigned F : {ArchV75, ArchV73, ArchV71, ArchV69, ArchV68, ArchV67, + ArchV66, ArchV65, ArchV62, ArchV60, ArchV55, ArchV5}) { if (!FB.test(F)) continue; CpuArch = F; @@ -518,9 +527,10 @@ FeatureBitset Hexagon_MC::completeHVXFeatures(const FeatureBitset &S) { break; } bool HasHvxVer = false; - for (unsigned F : {ExtensionHVXV60, ExtensionHVXV62, ExtensionHVXV65, - ExtensionHVXV66, ExtensionHVXV67, ExtensionHVXV68, - ExtensionHVXV69, ExtensionHVXV71, ExtensionHVXV73}) { + for (unsigned F : + {ExtensionHVXV60, ExtensionHVXV62, ExtensionHVXV65, ExtensionHVXV66, + ExtensionHVXV67, ExtensionHVXV68, ExtensionHVXV69, ExtensionHVXV71, + ExtensionHVXV73, ExtensionHVXV75}) { if (!FB.test(F)) continue; HasHvxVer = true; @@ -533,6 +543,9 @@ FeatureBitset Hexagon_MC::completeHVXFeatures(const FeatureBitset &S) { // HasHvxVer is false, and UseHvx is true. switch (CpuArch) { + case ArchV75: + FB.set(ExtensionHVXV75); + [[fallthrough]]; case ArchV73: FB.set(ExtensionHVXV73); [[fallthrough]]; @@ -627,11 +640,11 @@ void Hexagon_MC::addArchSubtarget(MCSubtargetInfo const *STI, StringRef FS) { std::optional Hexagon_MC::getHVXVersion(const FeatureBitset &Features) { - for (auto Arch : {Hexagon::ExtensionHVXV73, Hexagon::ExtensionHVXV71, - Hexagon::ExtensionHVXV69, Hexagon::ExtensionHVXV68, - Hexagon::ExtensionHVXV67, Hexagon::ExtensionHVXV66, - Hexagon::ExtensionHVXV65, Hexagon::ExtensionHVXV62, - Hexagon::ExtensionHVXV60}) + for (auto Arch : {Hexagon::ExtensionHVXV75, Hexagon::ExtensionHVXV73, + Hexagon::ExtensionHVXV71, Hexagon::ExtensionHVXV69, + Hexagon::ExtensionHVXV68, Hexagon::ExtensionHVXV67, + Hexagon::ExtensionHVXV66, Hexagon::ExtensionHVXV65, + Hexagon::ExtensionHVXV62, Hexagon::ExtensionHVXV60}) if (Features.test(Arch)) return Arch; return {}; @@ -639,12 +652,12 @@ Hexagon_MC::getHVXVersion(const FeatureBitset &Features) { unsigned Hexagon_MC::getArchVersion(const FeatureBitset &Features) { for (auto Arch : - {Hexagon::ArchV73, Hexagon::ArchV71, Hexagon::ArchV69, Hexagon::ArchV68, - Hexagon::ArchV67, Hexagon::ArchV66, Hexagon::ArchV65, Hexagon::ArchV62, - Hexagon::ArchV60, Hexagon::ArchV55, Hexagon::ArchV5}) + {Hexagon::ArchV75, Hexagon::ArchV73, Hexagon::ArchV71, Hexagon::ArchV69, + Hexagon::ArchV68, Hexagon::ArchV67, Hexagon::ArchV66, Hexagon::ArchV65, + Hexagon::ArchV62, Hexagon::ArchV60, Hexagon::ArchV55, Hexagon::ArchV5}) if (Features.test(Arch)) return Arch; - llvm_unreachable("Expected arch v5-v73"); + llvm_unreachable("Expected arch v5-v75"); return 0; } @@ -663,7 +676,8 @@ unsigned Hexagon_MC::GetELFFlags(const MCSubtargetInfo &STI) { .Case("hexagonv69", llvm::ELF::EF_HEXAGON_MACH_V69) .Case("hexagonv71", llvm::ELF::EF_HEXAGON_MACH_V71) .Case("hexagonv71t", llvm::ELF::EF_HEXAGON_MACH_V71T) - .Case("hexagonv73", llvm::ELF::EF_HEXAGON_MACH_V73); + .Case("hexagonv73", llvm::ELF::EF_HEXAGON_MACH_V73) + .Case("hexagonv75", llvm::ELF::EF_HEXAGON_MACH_V75); } llvm::ArrayRef Hexagon_MC::GetVectRegRev() { diff --git a/llvm/test/MC/Hexagon/arch-support.s b/llvm/test/MC/Hexagon/arch-support.s index 01a15bce5c411..634370ca2c38c 100644 --- a/llvm/test/MC/Hexagon/arch-support.s +++ b/llvm/test/MC/Hexagon/arch-support.s @@ -6,6 +6,9 @@ # RUN: llvm-mc -triple=hexagon -mv67 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V67 %s # RUN: llvm-mc -triple=hexagon -mv68 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V68 %s # RUN: llvm-mc -triple=hexagon -mv69 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V69 %s +# RUN: llvm-mc -triple=hexagon -mv71 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V71 %s +# RUN: llvm-mc -triple=hexagon -mv73 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V73 %s +# RUN: llvm-mc -triple=hexagon -mv75 -filetype=obj %s | llvm-readelf -h - | FileCheck --check-prefix=CHECK-V75 %s # RUN: llvm-mc -triple=hexagon -mv5 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s # RUN: llvm-mc -triple=hexagon -mv55 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s @@ -15,6 +18,9 @@ # RUN: llvm-mc -triple=hexagon -mv67 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s # RUN: llvm-mc -triple=hexagon -mv68 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s # RUN: llvm-mc -triple=hexagon -mv69 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s +# RUN: llvm-mc -triple=hexagon -mv71 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s +# RUN: llvm-mc -triple=hexagon -mv73 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s +# RUN: llvm-mc -triple=hexagon -mv75 -filetype=obj %s | llvm-objdump --disassemble - | FileCheck --check-prefix=CHECK-OBJDUMP %s .text r1 = r1 @@ -26,5 +32,8 @@ r1 = r1 # CHECK-V67: Flags:{{.*}}0x67 # CHECK-V68: Flags:{{.*}}0x68 # CHECK-V69: Flags:{{.*}}0x69 +# CHECK-V71: Flags:{{.*}}0x71 +# CHECK-V73: Flags:{{.*}}0x73 +# CHECK-V75: Flags:{{.*}}0x75 # CHECK-OBJDUMP: { r1 = r1 } diff --git a/llvm/test/MC/Hexagon/v75_arch.s b/llvm/test/MC/Hexagon/v75_arch.s new file mode 100644 index 0000000000000..fde61e9b1ab49 --- /dev/null +++ b/llvm/test/MC/Hexagon/v75_arch.s @@ -0,0 +1,10 @@ +# RUN: llvm-mc -arch=hexagon -mcpu=hexagonv75 -filetype=obj %s | llvm-objdump -d - | FileCheck %s +# RUN: llvm-mc -arch=hexagon -mcpu=hexagonv75 -mhvx -filetype=obj %s | llvm-objdump -d - | FileCheck %s + +r1=memw(r0) +{ r0=r0 + memw(r0)=r0.new } + +# CHECK: { r1 = memw(r0+#0x0) } +# CHECK: { r0 = r0 +# CHECK: memw(r0+#0x0) = r0.new } From 8ae8a905855ca1b07a72059d8225ab1f9cae65dc Mon Sep 17 00:00:00 2001 From: David Olsen Date: Fri, 20 Dec 2024 12:22:25 -0800 Subject: [PATCH 029/466] [CIR] floating-point, pointer, and function types (#120484) Upstream ClangIR support for `void` type, floating-point types, pointer types, and function types. Floating-point support is missing the IBM double-double format, because that hasn't been implemented in the incubator project yet. Pointer types do not yet support address spaces. Function type support includes only the return type and the parameter types. The many other properties and attributes of function types will be upstreamed later. --- clang/include/clang/CIR/CMakeLists.txt | 1 + .../CIR/Dialect/Builder/CIRBaseBuilder.h | 8 + clang/include/clang/CIR/Dialect/IR/CIRTypes.h | 7 + .../include/clang/CIR/Dialect/IR/CIRTypes.td | 221 ++++++++++++++ .../clang/CIR/Interfaces/CIRFPTypeInterface.h | 22 ++ .../CIR/Interfaces/CIRFPTypeInterface.td | 56 ++++ .../clang/CIR/Interfaces/CMakeLists.txt | 14 + clang/lib/CIR/CMakeLists.txt | 1 + clang/lib/CIR/CodeGen/CIRGenBuilder.h | 12 + clang/lib/CIR/CodeGen/CIRGenModule.cpp | 7 + clang/lib/CIR/CodeGen/CIRGenTypeCache.h | 11 + clang/lib/CIR/CodeGen/CIRGenTypes.cpp | 132 +++++++++ clang/lib/CIR/CodeGen/CIRGenTypes.h | 9 + clang/lib/CIR/CodeGen/CMakeLists.txt | 1 + clang/lib/CIR/Dialect/IR/CIRTypes.cpp | 280 ++++++++++++++++++ clang/lib/CIR/Dialect/IR/CMakeLists.txt | 1 + .../lib/CIR/Interfaces/CIRFPTypeInterface.cpp | 18 ++ clang/lib/CIR/Interfaces/CMakeLists.txt | 14 + clang/test/CIR/global-var-simple.cpp | 39 +++ 19 files changed, 854 insertions(+) create mode 100644 clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.h create mode 100644 clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.td create mode 100644 clang/include/clang/CIR/Interfaces/CMakeLists.txt create mode 100644 clang/lib/CIR/Interfaces/CIRFPTypeInterface.cpp create mode 100644 clang/lib/CIR/Interfaces/CMakeLists.txt diff --git a/clang/include/clang/CIR/CMakeLists.txt b/clang/include/clang/CIR/CMakeLists.txt index f8d6f407a03d0..e20c896171c92 100644 --- a/clang/include/clang/CIR/CMakeLists.txt +++ b/clang/include/clang/CIR/CMakeLists.txt @@ -4,3 +4,4 @@ include_directories(${MLIR_INCLUDE_DIR}) include_directories(${MLIR_TABLEGEN_OUTPUT_DIR}) add_subdirectory(Dialect) +add_subdirectory(Interfaces) diff --git a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h index 75ae74e926fbc..0e414921324b7 100644 --- a/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h +++ b/clang/include/clang/CIR/Dialect/Builder/CIRBaseBuilder.h @@ -18,6 +18,14 @@ class CIRBaseBuilderTy : public mlir::OpBuilder { public: CIRBaseBuilderTy(mlir::MLIRContext &mlirContext) : mlir::OpBuilder(&mlirContext) {} + + cir::PointerType getPointerTo(mlir::Type ty) { + return cir::PointerType::get(getContext(), ty); + } + + cir::PointerType getVoidPtrTy() { + return getPointerTo(cir::VoidType::get(getContext())); + } }; } // namespace cir diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypes.h b/clang/include/clang/CIR/Dialect/IR/CIRTypes.h index 2bc7d77b2bc8a..5d1eb17e146d0 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRTypes.h +++ b/clang/include/clang/CIR/Dialect/IR/CIRTypes.h @@ -16,6 +16,13 @@ #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/Types.h" #include "mlir/Interfaces/DataLayoutInterfaces.h" +#include "clang/CIR/Interfaces/CIRFPTypeInterface.h" + +namespace cir { + +bool isAnyFloatingPointType(mlir::Type t); + +} // namespace cir //===----------------------------------------------------------------------===// // CIR Dialect Tablegen'd Types diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td index ce0b6ba1d68c5..ef00b26c1fd98 100644 --- a/clang/include/clang/CIR/Dialect/IR/CIRTypes.td +++ b/clang/include/clang/CIR/Dialect/IR/CIRTypes.td @@ -14,6 +14,7 @@ #define MLIR_CIR_DIALECT_CIR_TYPES include "clang/CIR/Dialect/IR/CIRDialect.td" +include "clang/CIR/Interfaces/CIRFPTypeInterface.td" include "mlir/Interfaces/DataLayoutInterfaces.td" include "mlir/IR/AttrTypeBase.td" @@ -129,4 +130,224 @@ def PrimitiveInt : AnyTypeOf<[UInt8, UInt16, UInt32, UInt64, SInt8, SInt16, SInt32, SInt64], "primitive int", "::cir::IntType">; +//===----------------------------------------------------------------------===// +// FloatType +//===----------------------------------------------------------------------===// + +class CIR_FloatType + : CIR_Type, + DeclareTypeInterfaceMethods, + ]> {} + +def CIR_Single : CIR_FloatType<"Single", "float"> { + let summary = "CIR single-precision 32-bit float type"; + let description = [{ + A 32-bit floating-point type whose format is IEEE-754 `binary32`. It + represents the types `float`, `_Float32`, and `std::float32_t` in C and C++. + }]; +} + +def CIR_Double : CIR_FloatType<"Double", "double"> { + let summary = "CIR double-precision 64-bit float type"; + let description = [{ + A 64-bit floating-point type whose format is IEEE-754 `binary64`. It + represents the types `double', '_Float64`, `std::float64_t`, and `_Float32x` + in C and C++. This is the underlying type for `long double` on some + platforms, including Windows. + }]; +} + +def CIR_FP16 : CIR_FloatType<"FP16", "f16"> { + let summary = "CIR half-precision 16-bit float type"; + let description = [{ + A 16-bit floating-point type whose format is IEEE-754 `binary16`. It + represents the types '_Float16` and `std::float16_t` in C and C++. + }]; +} + +def CIR_BFloat16 : CIR_FloatType<"BF16", "bf16"> { + let summary = "CIR bfloat16 16-bit float type"; + let description = [{ + A 16-bit floating-point type in the bfloat16 format, which is the same as + IEEE `binary32` except that the lower 16 bits of the mantissa are missing. + It represents the type `std::bfloat16_t` in C++, also spelled `__bf16` in + some implementations. + }]; +} + +def CIR_FP80 : CIR_FloatType<"FP80", "f80"> { + let summary = "CIR x87 80-bit float type"; + let description = [{ + An 80-bit floating-point type in the x87 extended precision format. The + size and alignment of the type are both 128 bits, even though only 80 of + those bits are used. This is the underlying type for `long double` on Linux + x86 platforms, and it is available as an extension in some implementations. + }]; +} + +def CIR_FP128 : CIR_FloatType<"FP128", "f128"> { + let summary = "CIR quad-precision 128-bit float type"; + let description = [{ + A 128-bit floating-point type whose format is IEEE-754 `binary128`. It + represents the types `_Float128` and `std::float128_t` in C and C++, and the + extension `__float128` in some implementations. This is the underlying type + for `long double` on some platforms including Linux Arm. + }]; +} + +def CIR_LongDouble : CIR_FloatType<"LongDouble", "long_double"> { + let summary = "CIR float type for `long double`"; + let description = [{ + A floating-point type that represents the `long double` type in C and C++. + + The underlying floating-point format of a `long double` value depends on the + target platform and the implementation. The `underlying` parameter specifies + the CIR floating-point type that corresponds to this format. Underlying + types of IEEE 64-bit, IEEE 128-bit, x87 80-bit, and IBM's double-double + format are all in use. + }]; + + let parameters = (ins "mlir::Type":$underlying); + + let assemblyFormat = [{ + `<` $underlying `>` + }]; + + let genVerifyDecl = 1; +} + +// Constraints + +def CIR_AnyFloat: AnyTypeOf<[CIR_Single, CIR_Double, CIR_FP80, CIR_FP128, CIR_LongDouble, + CIR_FP16, CIR_BFloat16]>; +def CIR_AnyIntOrFloat: AnyTypeOf<[CIR_AnyFloat, CIR_IntType]>; + +//===----------------------------------------------------------------------===// +// PointerType +//===----------------------------------------------------------------------===// + +def CIR_PointerType : CIR_Type<"Pointer", "ptr", + [DeclareTypeInterfaceMethods]> { + + let summary = "CIR pointer type"; + let description = [{ + The `cir.ptr` type represents C and C++ pointer types and C++ reference + types, other than pointers-to-members. The `pointee` type is the type + pointed to. + + TODO(CIR): The address space attribute is not yet implemented. + }]; + + let parameters = (ins "mlir::Type":$pointee); + + let builders = [ + TypeBuilderWithInferredContext<(ins "mlir::Type":$pointee), [{ + return $_get(pointee.getContext(), pointee); + }]>, + TypeBuilder<(ins "mlir::Type":$pointee), [{ + return $_get($_ctxt, pointee); + }]> + ]; + + let assemblyFormat = [{ + `<` $pointee `>` + }]; + + let genVerifyDecl = 1; + + let skipDefaultBuilders = 1; + + let extraClassDeclaration = [{ + bool isVoidPtr() const { + return mlir::isa(getPointee()); + } + }]; +} + +//===----------------------------------------------------------------------===// +// FuncType +//===----------------------------------------------------------------------===// + +def CIR_FuncType : CIR_Type<"Func", "func"> { + let summary = "CIR function type"; + let description = [{ + The `!cir.func` is a function type. It consists of a single return type, a + list of parameter types and can optionally be variadic. + + Example: + + ```mlir + !cir.func + !cir.func + !cir.func + ``` + }]; + + let parameters = (ins ArrayRefParameter<"mlir::Type">:$inputs, + "mlir::Type":$returnType, "bool":$varArg); + let assemblyFormat = [{ + `<` $returnType ` ` `(` custom($inputs, $varArg) `>` + }]; + + let builders = [ + TypeBuilderWithInferredContext<(ins + "llvm::ArrayRef":$inputs, "mlir::Type":$returnType, + CArg<"bool", "false">:$isVarArg), [{ + return $_get(returnType.getContext(), inputs, returnType, isVarArg); + }]> + ]; + + let extraClassDeclaration = [{ + /// Returns whether the function is variadic. + bool isVarArg() const { return getVarArg(); } + + /// Returns the `i`th input operand type. Asserts if out of bounds. + mlir::Type getInput(unsigned i) const { return getInputs()[i]; } + + /// Returns the number of arguments to the function. + unsigned getNumInputs() const { return getInputs().size(); } + + /// Returns the result type of the function as an ArrayRef, enabling better + /// integration with generic MLIR utilities. + llvm::ArrayRef getReturnTypes() const; + + /// Returns whether the function is returns void. + bool isVoid() const; + + /// Returns a clone of this function type with the given argument + /// and result types. + FuncType clone(mlir::TypeRange inputs, mlir::TypeRange results) const; + }]; +} + +//===----------------------------------------------------------------------===// +// Void type +//===----------------------------------------------------------------------===// + +def CIR_VoidType : CIR_Type<"Void", "void"> { + let summary = "CIR void type"; + let description = [{ + The `!cir.void` type represents the C and C++ `void` type. + }]; + let extraClassDeclaration = [{ + std::string getAlias() const { return "void"; }; + }]; +} + +// Constraints + +// Pointer to void +def VoidPtr : Type< + And<[ + CPred<"::mlir::isa<::cir::PointerType>($_self)">, + CPred<"::mlir::isa<::cir::VoidType>(" + "::mlir::cast<::cir::PointerType>($_self).getPointee())">, + ]>, "void*">, + BuildableType< + "cir::PointerType::get($_builder.getContext()," + "cir::VoidType::get($_builder.getContext()))"> { +} + #endif // MLIR_CIR_DIALECT_CIR_TYPES diff --git a/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.h b/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.h new file mode 100644 index 0000000000000..40b85ef6cfb62 --- /dev/null +++ b/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.h @@ -0,0 +1,22 @@ +//===---------------------------------------------------------------------===// +// +// 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 +// +//===---------------------------------------------------------------------===// +// +// Defines the interface to generically handle CIR floating-point types. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H +#define LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H + +#include "mlir/IR/Types.h" +#include "llvm/ADT/APFloat.h" + +/// Include the tablegen'd interface declarations. +#include "clang/CIR/Interfaces/CIRFPTypeInterface.h.inc" + +#endif // LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_H diff --git a/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.td b/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.td new file mode 100644 index 0000000000000..973851b61444f --- /dev/null +++ b/clang/include/clang/CIR/Interfaces/CIRFPTypeInterface.td @@ -0,0 +1,56 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the interface to generically handle CIR floating-point types. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD +#define LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD + +include "mlir/IR/OpBase.td" + +def CIRFPTypeInterface : TypeInterface<"CIRFPTypeInterface"> { + let description = [{ + Contains helper functions to query properties about a floating-point type. + }]; + let cppNamespace = "::cir"; + + let methods = [ + InterfaceMethod<[{ + Returns the bit width of this floating-point type. + }], + /*retTy=*/"unsigned", + /*methodName=*/"getWidth", + /*args=*/(ins), + /*methodBody=*/"", + /*defaultImplementation=*/[{ + return llvm::APFloat::semanticsSizeInBits($_type.getFloatSemantics()); + }] + >, + InterfaceMethod<[{ + Return the mantissa width. + }], + /*retTy=*/"unsigned", + /*methodName=*/"getFPMantissaWidth", + /*args=*/(ins), + /*methodBody=*/"", + /*defaultImplementation=*/[{ + return llvm::APFloat::semanticsPrecision($_type.getFloatSemantics()); + }] + >, + InterfaceMethod<[{ + Return the float semantics of this floating-point type. + }], + /*retTy=*/"const llvm::fltSemantics &", + /*methodName=*/"getFloatSemantics" + >, + ]; +} + +#endif // LLVM_CLANG_INCLUDE_CLANG_CIR_INTERFACES_CIRFPTYPEINTERFACE_TD diff --git a/clang/include/clang/CIR/Interfaces/CMakeLists.txt b/clang/include/clang/CIR/Interfaces/CMakeLists.txt new file mode 100644 index 0000000000000..1c90b6b5a23cb --- /dev/null +++ b/clang/include/clang/CIR/Interfaces/CMakeLists.txt @@ -0,0 +1,14 @@ +# This replicates part of the add_mlir_interface cmake function from MLIR that +# cannot be used here. This happens because it expects to be run inside MLIR +# directory which is not the case for CIR (and also FIR, both have similar +# workarounds). + +function(add_clang_mlir_type_interface interface) + set(LLVM_TARGET_DEFINITIONS ${interface}.td) + mlir_tablegen(${interface}.h.inc -gen-type-interface-decls) + mlir_tablegen(${interface}.cpp.inc -gen-type-interface-defs) + add_public_tablegen_target(MLIR${interface}IncGen) + add_dependencies(mlir-generic-headers MLIR${interface}IncGen) +endfunction() + +add_clang_mlir_type_interface(CIRFPTypeInterface) diff --git a/clang/lib/CIR/CMakeLists.txt b/clang/lib/CIR/CMakeLists.txt index 11cca734808df..f3ef8525e15c2 100644 --- a/clang/lib/CIR/CMakeLists.txt +++ b/clang/lib/CIR/CMakeLists.txt @@ -4,3 +4,4 @@ include_directories(${CMAKE_BINARY_DIR}/tools/mlir/include) add_subdirectory(Dialect) add_subdirectory(CodeGen) add_subdirectory(FrontendAction) +add_subdirectory(Interfaces) diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h index 92115778518d4..01d56963883cc 100644 --- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h +++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h @@ -21,6 +21,18 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy { public: CIRGenBuilderTy(mlir::MLIRContext &mlirContext, const CIRGenTypeCache &tc) : CIRBaseBuilderTy(mlirContext), typeCache(tc) {} + + cir::LongDoubleType getLongDoubleTy(const llvm::fltSemantics &format) const { + if (&format == &llvm::APFloat::IEEEdouble()) + return cir::LongDoubleType::get(getContext(), typeCache.DoubleTy); + if (&format == &llvm::APFloat::x87DoubleExtended()) + return cir::LongDoubleType::get(getContext(), typeCache.FP80Ty); + if (&format == &llvm::APFloat::IEEEquad()) + return cir::LongDoubleType::get(getContext(), typeCache.FP128Ty); + if (&format == &llvm::APFloat::PPCDoubleDouble()) + llvm_unreachable("NYI: PPC double-double format for long double"); + llvm_unreachable("Unsupported format for long double"); + } }; } // namespace clang::CIRGen diff --git a/clang/lib/CIR/CodeGen/CIRGenModule.cpp b/clang/lib/CIR/CodeGen/CIRGenModule.cpp index 0db24c3b41d18..416d532028d09 100644 --- a/clang/lib/CIR/CodeGen/CIRGenModule.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenModule.cpp @@ -35,6 +35,7 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, diags(diags), target(astContext.getTargetInfo()), genTypes(*this) { // Initialize cached types + VoidTy = cir::VoidType::get(&getMLIRContext()); SInt8Ty = cir::IntType::get(&getMLIRContext(), 8, /*isSigned=*/true); SInt16Ty = cir::IntType::get(&getMLIRContext(), 16, /*isSigned=*/true); SInt32Ty = cir::IntType::get(&getMLIRContext(), 32, /*isSigned=*/true); @@ -45,6 +46,12 @@ CIRGenModule::CIRGenModule(mlir::MLIRContext &mlirContext, UInt32Ty = cir::IntType::get(&getMLIRContext(), 32, /*isSigned=*/false); UInt64Ty = cir::IntType::get(&getMLIRContext(), 64, /*isSigned=*/false); UInt128Ty = cir::IntType::get(&getMLIRContext(), 128, /*isSigned=*/false); + FP16Ty = cir::FP16Type::get(&getMLIRContext()); + BFloat16Ty = cir::BF16Type::get(&getMLIRContext()); + FloatTy = cir::SingleType::get(&getMLIRContext()); + DoubleTy = cir::DoubleType::get(&getMLIRContext()); + FP80Ty = cir::FP80Type::get(&getMLIRContext()); + FP128Ty = cir::FP128Type::get(&getMLIRContext()); } mlir::Location CIRGenModule::getLoc(SourceLocation cLoc) { diff --git a/clang/lib/CIR/CodeGen/CIRGenTypeCache.h b/clang/lib/CIR/CodeGen/CIRGenTypeCache.h index a357663c33e0f..99c0123c64b28 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypeCache.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypeCache.h @@ -23,6 +23,9 @@ namespace clang::CIRGen { struct CIRGenTypeCache { CIRGenTypeCache() = default; + // ClangIR void type + cir::VoidType VoidTy; + // ClangIR signed integral types of common sizes cir::IntType SInt8Ty; cir::IntType SInt16Ty; @@ -36,6 +39,14 @@ struct CIRGenTypeCache { cir::IntType UInt32Ty; cir::IntType UInt64Ty; cir::IntType UInt128Ty; + + // ClangIR floating-point types with fixed formats + cir::FP16Type FP16Ty; + cir::BF16Type BFloat16Ty; + cir::SingleType FloatTy; + cir::DoubleType DoubleTy; + cir::FP80Type FP80Ty; + cir::FP128Type FP128Ty; }; } // namespace clang::CIRGen diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp index 181af1898baff..8519854556b1c 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp @@ -4,6 +4,9 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/Type.h" +#include "clang/Basic/TargetInfo.h" + +#include using namespace clang; using namespace clang::CIRGen; @@ -18,6 +21,70 @@ mlir::MLIRContext &CIRGenTypes::getMLIRContext() const { return *builder.getContext(); } +/// Return true if the specified type in a function parameter or result position +/// can be converted to a CIR type at this point. This boils down to being +/// whether it is complete, as well as whether we've temporarily deferred +/// expanding the type because we're in a recursive context. +bool CIRGenTypes::isFuncParamTypeConvertible(clang::QualType type) { + // Some ABIs cannot have their member pointers represented in LLVM IR unless + // certain circumstances have been reached. + assert(!type->getAs() && "NYI"); + + // If this isn't a tag type, we can convert it. + const TagType *tagType = type->getAs(); + if (!tagType) + return true; + + // Function types involving incomplete class types are problematic in MLIR. + return !tagType->isIncompleteType(); +} + +/// Code to verify a given function type is complete, i.e. the return type and +/// all of the parameter types are complete. Also check to see if we are in a +/// RS_StructPointer context, and if so whether any struct types have been +/// pended. If so, we don't want to ask the ABI lowering code to handle a type +/// that cannot be converted to a CIR type. +bool CIRGenTypes::isFuncTypeConvertible(const FunctionType *ft) { + if (!isFuncParamTypeConvertible(ft->getReturnType())) + return false; + + if (const auto *fpt = dyn_cast(ft)) + for (unsigned i = 0, e = fpt->getNumParams(); i != e; i++) + if (!isFuncParamTypeConvertible(fpt->getParamType(i))) + return false; + + return true; +} + +mlir::Type CIRGenTypes::ConvertFunctionTypeInternal(QualType qft) { + assert(qft.isCanonical()); + const FunctionType *ft = cast(qft.getTypePtr()); + // First, check whether we can build the full fucntion type. If the function + // type depends on an incomplete type (e.g. a struct or enum), we cannot lower + // the function type. + if (!isFuncTypeConvertible(ft)) { + cgm.errorNYI(SourceLocation(), "function type involving an incomplete type", + qft); + return cir::FuncType::get(SmallVector{}, cgm.VoidTy); + } + + // TODO(CIR): This is a stub of what the final code will be. See the + // implementation of this function and the implementation of class + // CIRGenFunction in the ClangIR incubator project. + + if (const auto *fpt = dyn_cast(ft)) { + SmallVector mlirParamTypes; + for (unsigned i = 0; i < fpt->getNumParams(); ++i) { + mlirParamTypes.push_back(convertType(fpt->getParamType(i))); + } + return cir::FuncType::get( + mlirParamTypes, convertType(fpt->getReturnType().getUnqualifiedType()), + fpt->isVariadic()); + } + cgm.errorNYI(SourceLocation(), "non-prototype function type", qft); + return cir::FuncType::get(SmallVector{}, cgm.VoidTy); +} + mlir::Type CIRGenTypes::convertType(QualType type) { type = astContext.getCanonicalType(type); const Type *ty = type.getTypePtr(); @@ -34,6 +101,12 @@ mlir::Type CIRGenTypes::convertType(QualType type) { switch (ty->getTypeClass()) { case Type::Builtin: { switch (cast(ty)->getKind()) { + + // void + case BuiltinType::Void: + resultType = cgm.VoidTy; + break; + // Signed integral types. case BuiltinType::Char_S: case BuiltinType::Int: @@ -63,6 +136,47 @@ mlir::Type CIRGenTypes::convertType(QualType type) { cir::IntType::get(&getMLIRContext(), astContext.getTypeSize(ty), /*isSigned=*/false); break; + + // Floating-point types + case BuiltinType::Float16: + resultType = cgm.FP16Ty; + break; + case BuiltinType::Half: + if (astContext.getLangOpts().NativeHalfType || + !astContext.getTargetInfo().useFP16ConversionIntrinsics()) { + resultType = cgm.FP16Ty; + } else { + cgm.errorNYI(SourceLocation(), "processing of built-in type", type); + resultType = cgm.SInt32Ty; + } + break; + case BuiltinType::BFloat16: + resultType = cgm.BFloat16Ty; + break; + case BuiltinType::Float: + assert(&astContext.getFloatTypeSemantics(type) == + &llvm::APFloat::IEEEsingle() && + "ClangIR NYI: 'float' in a format other than IEEE 32-bit"); + resultType = cgm.FloatTy; + break; + case BuiltinType::Double: + assert(&astContext.getFloatTypeSemantics(type) == + &llvm::APFloat::IEEEdouble() && + "ClangIR NYI: 'double' in a format other than IEEE 64-bit"); + resultType = cgm.DoubleTy; + break; + case BuiltinType::LongDouble: + resultType = + builder.getLongDoubleTy(astContext.getFloatTypeSemantics(type)); + break; + case BuiltinType::Float128: + resultType = cgm.FP128Ty; + break; + case BuiltinType::Ibm128: + cgm.errorNYI(SourceLocation(), "processing of built-in type", type); + resultType = cgm.SInt32Ty; + break; + default: cgm.errorNYI(SourceLocation(), "processing of built-in type", type); resultType = cgm.SInt32Ty; @@ -70,6 +184,23 @@ mlir::Type CIRGenTypes::convertType(QualType type) { } break; } + + case Type::Pointer: { + const PointerType *ptrTy = cast(ty); + QualType elemTy = ptrTy->getPointeeType(); + assert(!elemTy->isConstantMatrixType() && "not implemented"); + + mlir::Type pointeeType = convertType(elemTy); + + resultType = builder.getPointerTo(pointeeType); + break; + } + + case Type::FunctionNoProto: + case Type::FunctionProto: + resultType = ConvertFunctionTypeInternal(type); + break; + case Type::BitInt: { const auto *bitIntTy = cast(type); if (bitIntTy->getNumBits() > cir::IntType::maxBitwidth()) { @@ -81,6 +212,7 @@ mlir::Type CIRGenTypes::convertType(QualType type) { } break; } + default: cgm.errorNYI(SourceLocation(), "processing of type", type); resultType = cgm.SInt32Ty; diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.h b/clang/lib/CIR/CodeGen/CIRGenTypes.h index 563d7759831fa..71427e1200027 100644 --- a/clang/lib/CIR/CodeGen/CIRGenTypes.h +++ b/clang/lib/CIR/CodeGen/CIRGenTypes.h @@ -19,6 +19,7 @@ namespace clang { class ASTContext; +class FunctionType; class QualType; class Type; } // namespace clang @@ -39,10 +40,18 @@ class CIRGenTypes { clang::ASTContext &astContext; CIRGenBuilderTy &builder; + /// Heper for ConvertType. + mlir::Type ConvertFunctionTypeInternal(clang::QualType ft); + public: CIRGenTypes(CIRGenModule &cgm); ~CIRGenTypes(); + /// Utility to check whether a function type can be converted to a CIR type + /// (i.e. doesn't depend on an incomplete tag type). + bool isFuncTypeConvertible(const clang::FunctionType *ft); + bool isFuncParamTypeConvertible(clang::QualType type); + /// This map of clang::Type to mlir::Type (which includes CIR type) is a /// cache of types that have already been processed. using TypeCacheTy = llvm::DenseMap; diff --git a/clang/lib/CIR/CodeGen/CMakeLists.txt b/clang/lib/CIR/CodeGen/CMakeLists.txt index 9ada31c11de95..782b814d75daa 100644 --- a/clang/lib/CIR/CodeGen/CMakeLists.txt +++ b/clang/lib/CIR/CodeGen/CMakeLists.txt @@ -21,4 +21,5 @@ add_clang_library(clangCIR clangLex ${dialect_libs} MLIRCIR + MLIRCIRInterfaces ) diff --git a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp index de38337057d3d..48be11ba4e243 100644 --- a/clang/lib/CIR/Dialect/IR/CIRTypes.cpp +++ b/clang/lib/CIR/Dialect/IR/CIRTypes.cpp @@ -16,6 +16,16 @@ #include "clang/CIR/Dialect/IR/CIRDialect.h" #include "llvm/ADT/TypeSwitch.h" +//===----------------------------------------------------------------------===// +// CIR Custom Parser/Printer Signatures +//===----------------------------------------------------------------------===// + +static mlir::ParseResult +parseFuncTypeArgs(mlir::AsmParser &p, llvm::SmallVector ¶ms, + bool &isVarArg); +static void printFuncTypeArgs(mlir::AsmPrinter &p, + mlir::ArrayRef params, bool isVarArg); + //===----------------------------------------------------------------------===// // Get autogenerated stuff //===----------------------------------------------------------------------===// @@ -133,6 +143,276 @@ IntType::verify(llvm::function_ref emitError, return mlir::success(); } +//===----------------------------------------------------------------------===// +// Floating-point type definitions +//===----------------------------------------------------------------------===// + +const llvm::fltSemantics &SingleType::getFloatSemantics() const { + return llvm::APFloat::IEEEsingle(); +} + +llvm::TypeSize +SingleType::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return llvm::TypeSize::getFixed(getWidth()); +} + +uint64_t +SingleType::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +uint64_t +SingleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +const llvm::fltSemantics &DoubleType::getFloatSemantics() const { + return llvm::APFloat::IEEEdouble(); +} + +llvm::TypeSize +DoubleType::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return llvm::TypeSize::getFixed(getWidth()); +} + +uint64_t +DoubleType::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +uint64_t +DoubleType::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +const llvm::fltSemantics &FP16Type::getFloatSemantics() const { + return llvm::APFloat::IEEEhalf(); +} + +llvm::TypeSize +FP16Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return llvm::TypeSize::getFixed(getWidth()); +} + +uint64_t FP16Type::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +uint64_t +FP16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +const llvm::fltSemantics &BF16Type::getFloatSemantics() const { + return llvm::APFloat::BFloat(); +} + +llvm::TypeSize +BF16Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return llvm::TypeSize::getFixed(getWidth()); +} + +uint64_t BF16Type::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +uint64_t +BF16Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return (uint64_t)(getWidth() / 8); +} + +const llvm::fltSemantics &FP80Type::getFloatSemantics() const { + return llvm::APFloat::x87DoubleExtended(); +} + +llvm::TypeSize +FP80Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + // Though only 80 bits are used for the value, the type is 128 bits in size. + return llvm::TypeSize::getFixed(128); +} + +uint64_t FP80Type::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return 16; +} + +uint64_t +FP80Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return 16; +} + +const llvm::fltSemantics &FP128Type::getFloatSemantics() const { + return llvm::APFloat::IEEEquad(); +} + +llvm::TypeSize +FP128Type::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return llvm::TypeSize::getFixed(getWidth()); +} + +uint64_t FP128Type::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return 16; +} + +uint64_t +FP128Type::getPreferredAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + return 16; +} + +const llvm::fltSemantics &LongDoubleType::getFloatSemantics() const { + return mlir::cast(getUnderlying()) + .getFloatSemantics(); +} + +llvm::TypeSize +LongDoubleType::getTypeSizeInBits(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return mlir::cast(getUnderlying()) + .getTypeSizeInBits(dataLayout, params); +} + +uint64_t +LongDoubleType::getABIAlignment(const mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return mlir::cast(getUnderlying()) + .getABIAlignment(dataLayout, params); +} + +uint64_t LongDoubleType::getPreferredAlignment( + const ::mlir::DataLayout &dataLayout, + mlir::DataLayoutEntryListRef params) const { + return mlir::cast(getUnderlying()) + .getPreferredAlignment(dataLayout, params); +} + +LogicalResult +LongDoubleType::verify(function_ref emitError, + mlir::Type underlying) { + if (!mlir::isa(underlying)) { + emitError() << "invalid underlying type for long double"; + return failure(); + } + + return success(); +} + +//===----------------------------------------------------------------------===// +// Floating-point type helpers +//===----------------------------------------------------------------------===// + +bool cir::isAnyFloatingPointType(mlir::Type t) { + return isa(t); +} + +//===----------------------------------------------------------------------===// +// FuncType Definitions +//===----------------------------------------------------------------------===// + +FuncType FuncType::clone(TypeRange inputs, TypeRange results) const { + assert(results.size() == 1 && "expected exactly one result type"); + return get(llvm::to_vector(inputs), results[0], isVarArg()); +} + +mlir::ParseResult parseFuncTypeArgs(mlir::AsmParser &p, + llvm::SmallVector ¶ms, + bool &isVarArg) { + isVarArg = false; + // `(` `)` + if (succeeded(p.parseOptionalRParen())) + return mlir::success(); + + // `(` `...` `)` + if (succeeded(p.parseOptionalEllipsis())) { + isVarArg = true; + return p.parseRParen(); + } + + // type (`,` type)* (`,` `...`)? + mlir::Type type; + if (p.parseType(type)) + return mlir::failure(); + params.push_back(type); + while (succeeded(p.parseOptionalComma())) { + if (succeeded(p.parseOptionalEllipsis())) { + isVarArg = true; + return p.parseRParen(); + } + if (p.parseType(type)) + return mlir::failure(); + params.push_back(type); + } + + return p.parseRParen(); +} + +void printFuncTypeArgs(mlir::AsmPrinter &p, mlir::ArrayRef params, + bool isVarArg) { + llvm::interleaveComma(params, p, + [&p](mlir::Type type) { p.printType(type); }); + if (isVarArg) { + if (!params.empty()) + p << ", "; + p << "..."; + } + p << ')'; +} + +llvm::ArrayRef FuncType::getReturnTypes() const { + return static_cast(getImpl())->returnType; +} + +bool FuncType::isVoid() const { return mlir::isa(getReturnType()); } + +//===----------------------------------------------------------------------===// +// PointerType Definitions +//===----------------------------------------------------------------------===// + +llvm::TypeSize +PointerType::getTypeSizeInBits(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + // FIXME: improve this in face of address spaces + return llvm::TypeSize::getFixed(64); +} + +uint64_t +PointerType::getABIAlignment(const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + // FIXME: improve this in face of address spaces + return 8; +} + +uint64_t PointerType::getPreferredAlignment( + const ::mlir::DataLayout &dataLayout, + ::mlir::DataLayoutEntryListRef params) const { + // FIXME: improve this in face of address spaces + return 8; +} + +mlir::LogicalResult +PointerType::verify(llvm::function_ref emitError, + mlir::Type pointee) { + // TODO(CIR): Verification of the address space goes here. + return mlir::success(); +} + //===----------------------------------------------------------------------===// // CIR Dialect //===----------------------------------------------------------------------===// diff --git a/clang/lib/CIR/Dialect/IR/CMakeLists.txt b/clang/lib/CIR/Dialect/IR/CMakeLists.txt index 7ddc4ce501907..df60f69df6fc0 100644 --- a/clang/lib/CIR/Dialect/IR/CMakeLists.txt +++ b/clang/lib/CIR/Dialect/IR/CMakeLists.txt @@ -11,5 +11,6 @@ add_clang_library(MLIRCIR MLIRDLTIDialect MLIRDataLayoutInterfaces MLIRFuncDialect + MLIRCIRInterfaces clangAST ) diff --git a/clang/lib/CIR/Interfaces/CIRFPTypeInterface.cpp b/clang/lib/CIR/Interfaces/CIRFPTypeInterface.cpp new file mode 100644 index 0000000000000..41817e90b5232 --- /dev/null +++ b/clang/lib/CIR/Interfaces/CIRFPTypeInterface.cpp @@ -0,0 +1,18 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// Defines the interface to generically handle CIR floating-point types. +// +//===----------------------------------------------------------------------===// + +#include "clang/CIR/Interfaces/CIRFPTypeInterface.h" + +using namespace cir; + +/// Include the generated interfaces. +#include "clang/CIR/Interfaces/CIRFPTypeInterface.cpp.inc" diff --git a/clang/lib/CIR/Interfaces/CMakeLists.txt b/clang/lib/CIR/Interfaces/CMakeLists.txt new file mode 100644 index 0000000000000..fcd8b6963d06c --- /dev/null +++ b/clang/lib/CIR/Interfaces/CMakeLists.txt @@ -0,0 +1,14 @@ +add_clang_library(MLIRCIRInterfaces + CIRFPTypeInterface.cpp + + ADDITIONAL_HEADER_DIRS + ${MLIR_MAIN_INCLUDE_DIR}/mlir/Interfaces + + DEPENDS + MLIRCIRFPTypeInterfaceIncGen + + LINK_LIBS + ${dialect_libs} + MLIRIR + MLIRSupport + ) diff --git a/clang/test/CIR/global-var-simple.cpp b/clang/test/CIR/global-var-simple.cpp index 5230ff53f87d7..bbd452655a01b 100644 --- a/clang/test/CIR/global-var-simple.cpp +++ b/clang/test/CIR/global-var-simple.cpp @@ -57,3 +57,42 @@ _BitInt(20) sb20; unsigned _BitInt(48) ub48; // CHECK: cir.global @ub48 : !cir.int + +_Float16 f16; +// CHECK: cir.global @f16 : !cir.f16 + +__bf16 bf16; +// CHECK: cir.global @bf16 : !cir.bf16 + +float f; +// CHECK: cir.global @f : !cir.float + +double d; +// CHECK: cir.global @d : !cir.double + +long double ld; +// CHECK: cir.global @ld : !cir.long_double + +__float128 f128; +// CHECK: cir.global @f128 : !cir.f128 + +void *vp; +// CHECK: cir.global @vp : !cir.ptr + +int *ip; +// CHECK: cir.global @ip : !cir.ptr> + +double *dp; +// CHECK: cir.global @dp : !cir.ptr + +char **cpp; +// CHECK: cir.global @cpp : !cir.ptr>> + +void (*fp)(); +// CHECK: cir.global @fp : !cir.ptr> + +int (*fpii)(int); +// CHECK: cir.global @fpii : !cir.ptr (!cir.int)>> + +void (*fpvar)(int, ...); +// CHECK: cir.global @fpvar : !cir.ptr, ...)>> From 3f89279609526270894f26317f7c3ccf04e0f16f Mon Sep 17 00:00:00 2001 From: Srinivasa R Date: Sat, 21 Dec 2024 01:55:06 +0530 Subject: [PATCH 030/466] [NVPTX] Add intrinsics for wgmma.fence PTX instructions (#120523) This PR adds NVVM intrinsics and NVPTX codegen for: - [wgmma.fence.sync.aligned](https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-fence) - [wgmma.commit_group.sync.aligned](https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-commit-group) - [wgmma.wait_group.sync.aligned](https://docs.nvidia.com/cuda/parallel-thread-execution/#asynchronous-warpgroup-level-matrix-instructions-wgmma-wait-group) --- llvm/docs/NVPTXUsage.rst | 90 ++++++++++++++++++++ llvm/include/llvm/IR/IntrinsicsNVVM.td | 15 ++++ llvm/lib/Target/NVPTX/NVPTXIntrinsics.td | 14 +++ llvm/test/CodeGen/NVPTX/wgmma-sm90a-fence.ll | 47 ++++++++++ 4 files changed, 166 insertions(+) create mode 100644 llvm/test/CodeGen/NVPTX/wgmma-sm90a-fence.ll diff --git a/llvm/docs/NVPTXUsage.rst b/llvm/docs/NVPTXUsage.rst index b19632535b3e1..313e84f3722a9 100644 --- a/llvm/docs/NVPTXUsage.rst +++ b/llvm/docs/NVPTXUsage.rst @@ -733,6 +733,96 @@ these intrinsics is a boolean flag, with the same functionality as described in For more information, refer PTX ISA ``_. +Warp Group Intrinsics +--------------------- + +'``llvm.nvvm.wgmma.fence.sync.aligned``' +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +.. code-block:: llvm + + declare void @llvm.nvvm.wgmma.fence.sync.aligned() + +Overview: +""""""""" + +The '``@llvm.nvvm.wgmma.fence.sync.aligned``' intrinsic generates the +``wgmma.fence.sync.aligned`` PTX instruction, which establishes an ordering +between prior accesses to any warpgroup registers and subsequent accesses to +the same registers by a ``wgmma.mma_async`` instruction. + +The ``wgmma.fence`` instruction must be issued by all warps of the warpgroup in +the following locations: + +* Before the first ``wgmma.mma_async`` operation in a warpgroup. +* Between a register access by a thread in the warpgroup and any + ``wgmma.mma_async`` instruction that accesses the same registers, except when + these are accumulator register accesses across multiple ``wgmma.mma_async`` + instructions of the same shape in which case an ordering guarantee is + provided by default. + +For more information, refer PTX ISA +``_. + +'``llvm.nvvm.wgmma.commit_group.sync.aligned``' +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +.. code-block:: llvm + + declare void @llvm.nvvm.wgmma.commit_group.sync.aligned() + +Overview: +""""""""" + +The '``@llvm.nvvm.wgmma.commit_group.sync.aligned``' intrinsic generates the +``wgmma.commit_group.sync.aligned`` PTX instruction, which creates a new +wgmma-group per warpgroup and batches all prior ``wgmma.mma_async`` +instructions initiated by the executing warp but not committed to any +wgmma-group into the new wgmma-group. If there are no uncommitted ``wgmma +mma_async`` instructions then, ``wgmma.commit_group`` results in an empty +wgmma-group. + +An executing thread can wait for the completion of all ``wgmma.mma_async`` +operations in a wgmma-group by using ``wgmma.wait_group``. + +For more information, refer PTX ISA +``_. + +'``llvm.nvvm.wgmma.wait_group.sync.aligned``' +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Syntax: +""""""" + +.. code-block:: llvm + + declare void @llvm.nvvm.wgmma.wait_group.sync.aligned(i64 immarg N) + +Overview: +""""""""" + +The '``@llvm.nvvm.wgmma.wait_group.sync.aligned``' intrinsic generates the +``wgmma.commit_group.sync.aligned N`` PTX instruction, which will cause the +executing thread to wait until only ``N`` or fewer of the most recent +wgmma-groups are pending and all the prior wgmma-groups committed by the +executing threads are complete. For example, when ``N`` is 0, the executing +thread waits on all the prior wgmma-groups to complete. Operand ``N`` is an +integer constant. + +Accessing the accumulator register or the input register containing the +fragments of matrix A of a ``wgmma.mma_async`` instruction without first +performing a ``wgmma.wait_group`` instruction that waits on a wgmma-group +including that ``wgmma.mma_async`` instruction is undefined behavior. + +For more information, refer PTX ISA +``_. + Other Intrinsics ---------------- diff --git a/llvm/include/llvm/IR/IntrinsicsNVVM.td b/llvm/include/llvm/IR/IntrinsicsNVVM.td index 9834dbb70d4c1..fd07d131ce15b 100644 --- a/llvm/include/llvm/IR/IntrinsicsNVVM.td +++ b/llvm/include/llvm/IR/IntrinsicsNVVM.td @@ -4805,6 +4805,21 @@ def int_nvvm_redux_sync_or : ClangBuiltin<"__nvvm_redux_sync_or">, Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrConvergent, IntrInaccessibleMemOnly, IntrNoCallback]>; +// +// WGMMA fence instructions +// +// wgmma.fence.sync.aligned; +def int_nvvm_wgmma_fence_sync_aligned + : Intrinsic<[], [], [IntrConvergent]>; + +// wgmma.commit_group.sync.aligned; +def int_nvvm_wgmma_commit_group_sync_aligned + : Intrinsic<[], [], [IntrConvergent], "llvm.nvvm.wgmma.commit_group.sync.aligned">; + +// wgmma.wait_group.sync.aligned N; +def int_nvvm_wgmma_wait_group_sync_aligned + : Intrinsic<[], [llvm_i64_ty], [IntrConvergent, ImmArg>], "llvm.nvvm.wgmma.wait_group.sync.aligned">; + // // WMMA instructions // diff --git a/llvm/lib/Target/NVPTX/NVPTXIntrinsics.td b/llvm/lib/Target/NVPTX/NVPTXIntrinsics.td index 6d4a56f191825..0773c1bbc5781 100644 --- a/llvm/lib/Target/NVPTX/NVPTXIntrinsics.td +++ b/llvm/lib/Target/NVPTX/NVPTXIntrinsics.td @@ -7484,4 +7484,18 @@ defm INT_SET_MAXNREG_DEC : SET_MAXNREG<"dec", int_nvvm_setmaxnreg_dec_sync_align } // isConvergent +// +// WGMMA fence instructions +// +let isConvergent = true in { +def INT_NVVM_WGMMA_FENCE_SYNC_ALIGNED : NVPTXInst<(outs), (ins), "wgmma.fence.sync.aligned;", + [(int_nvvm_wgmma_fence_sync_aligned)]>, Requires<[hasSM90a, hasPTX<80>]>; + +def INT_NVVM_WGMMA_COMMIT_GROUP_SYNC_ALIGNED : NVPTXInst<(outs), (ins), "wgmma.commit_group.sync.aligned;", + [(int_nvvm_wgmma_commit_group_sync_aligned)]>, Requires<[hasSM90a, hasPTX<80>]>; + +def INT_NVVM_WGMMA_WAIT_GROUP_SYNC_ALIGNED : NVPTXInst<(outs), (ins i64imm:$n), "wgmma.wait_group.sync.aligned \t$n;", + [(int_nvvm_wgmma_wait_group_sync_aligned timm:$n)]>, Requires<[hasSM90a, hasPTX<80>]>; +} // isConvergent = true + def INT_EXIT : NVPTXInst<(outs), (ins), "exit;", [(int_nvvm_exit)]>; diff --git a/llvm/test/CodeGen/NVPTX/wgmma-sm90a-fence.ll b/llvm/test/CodeGen/NVPTX/wgmma-sm90a-fence.ll new file mode 100644 index 0000000000000..59fe57b9b2c89 --- /dev/null +++ b/llvm/test/CodeGen/NVPTX/wgmma-sm90a-fence.ll @@ -0,0 +1,47 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5 +; RUN: llc < %s -march=nvptx64 -mcpu=sm_90a -mattr=+ptx80 | FileCheck %s +; RUN: %if ptxas-12.0 %{ llc < %s -march=nvptx64 -mcpu=sm_90a -mattr=+ptx80 | %ptxas-verify -arch=sm_90a %} + +target triple = "nvptx64-nvidia-cuda" + +declare void @llvm.nvvm.wgmma.fence.sync.aligned() + +define void @test_wgmma_fence_sync_aligned() { +; CHECK-LABEL: test_wgmma_fence_sync_aligned( +; CHECK: { +; CHECK-EMPTY: +; CHECK-EMPTY: +; CHECK-NEXT: // %bb.0: +; CHECK-NEXT: wgmma.fence.sync.aligned; +; CHECK-NEXT: ret; + call void @llvm.nvvm.wgmma.fence.sync.aligned() + ret void +} + +declare void @llvm.nvvm.wgmma.commit_group.sync.aligned() + +define void @test_wgmma_commit_group_sync_aligned() { +; CHECK-LABEL: test_wgmma_commit_group_sync_aligned( +; CHECK: { +; CHECK-EMPTY: +; CHECK-EMPTY: +; CHECK-NEXT: // %bb.0: +; CHECK-NEXT: wgmma.commit_group.sync.aligned; +; CHECK-NEXT: ret; + call void @llvm.nvvm.wgmma.commit_group.sync.aligned() + ret void +} + +declare void @llvm.nvvm.wgmma.wait_group.sync.aligned(i64) + +define void @test_wgmma_wait_group_sync_aligned() { +; CHECK-LABEL: test_wgmma_wait_group_sync_aligned( +; CHECK: { +; CHECK-EMPTY: +; CHECK-EMPTY: +; CHECK-NEXT: // %bb.0: +; CHECK-NEXT: wgmma.wait_group.sync.aligned 10; +; CHECK-NEXT: ret; + call void @llvm.nvvm.wgmma.wait_group.sync.aligned(i64 10) + ret void +} From e934a39e01b9eedd8091cc1505be3a4ad5cad12b Mon Sep 17 00:00:00 2001 From: Petr Penzin Date: Fri, 20 Dec 2024 12:30:17 -0800 Subject: [PATCH 031/466] [RISC-V] Base scheduling model for tt-ascalon-d8 (#120160) First part of tt-ascalon-d8 scheduling model, only containing scalar ops. Scheduling for vector instructions will be added in a follow-up patch. --------- Co-authored-by: Anton Blanchard Co-authored-by: Pengcheng Wang --- llvm/lib/Target/RISCV/RISCV.td | 1 + llvm/lib/Target/RISCV/RISCVProcessors.td | 2 +- .../lib/Target/RISCV/RISCVSchedTTAscalonD8.td | 330 ++++++++++++++++++ .../tools/llvm-mca/RISCV/tt-ascalon-d8/fp.s | 79 +++++ .../tools/llvm-mca/RISCV/tt-ascalon-d8/fx.s | 79 +++++ 5 files changed, 490 insertions(+), 1 deletion(-) create mode 100644 llvm/lib/Target/RISCV/RISCVSchedTTAscalonD8.td create mode 100644 llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fp.s create mode 100644 llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fx.s diff --git a/llvm/lib/Target/RISCV/RISCV.td b/llvm/lib/Target/RISCV/RISCV.td index 1df6f9ae1944c..963124140cd03 100644 --- a/llvm/lib/Target/RISCV/RISCV.td +++ b/llvm/lib/Target/RISCV/RISCV.td @@ -54,6 +54,7 @@ include "RISCVSchedSiFiveP600.td" include "RISCVSchedSyntacoreSCR1.td" include "RISCVSchedSyntacoreSCR345.td" include "RISCVSchedSyntacoreSCR7.td" +include "RISCVSchedTTAscalonD8.td" include "RISCVSchedXiangShanNanHu.td" //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVProcessors.td b/llvm/lib/Target/RISCV/RISCVProcessors.td index 053a3b11f39bc..61c7c21367036 100644 --- a/llvm/lib/Target/RISCV/RISCVProcessors.td +++ b/llvm/lib/Target/RISCV/RISCVProcessors.td @@ -453,7 +453,7 @@ def SYNTACORE_SCR7 : RISCVProcessorModel<"syntacore-scr7", [TuneNoDefaultUnroll, TunePostRAScheduler]>; def TENSTORRENT_ASCALON_D8 : RISCVProcessorModel<"tt-ascalon-d8", - NoSchedModel, + TTAscalonD8Model, !listconcat(RVA23S64Features, [FeatureStdExtSmaia, FeatureStdExtSsaia, diff --git a/llvm/lib/Target/RISCV/RISCVSchedTTAscalonD8.td b/llvm/lib/Target/RISCV/RISCVSchedTTAscalonD8.td new file mode 100644 index 0000000000000..2afe02552974e --- /dev/null +++ b/llvm/lib/Target/RISCV/RISCVSchedTTAscalonD8.td @@ -0,0 +1,330 @@ +//=- RISCVSchedTTAscalonD8.td - TT Ascalon D8 Sched Defs -----*- tablegen -*-=// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// + +def TTAscalonD8Model : SchedMachineModel { + let IssueWidth = 8; // 8-way decode and dispatch + let MicroOpBufferSize = 256; // 256 micro-op re-order buffer + let LoadLatency = 4; // Optimistic load latency + let MispredictPenalty = 14; // Fetch + Decode/Rename/Dispatch + Branch + + let CompleteModel = 0; + + // TODO: supported, but haven't added scheduling info yet. + let UnsupportedFeatures = [HasStdExtZbkb, HasStdExtZbkc, HasStdExtZbkx, + HasStdExtZcmt, HasStdExtZknd, HasStdExtZkne, + HasStdExtZknh, HasStdExtZksed, HasStdExtZksh, + HasStdExtZkr, HasVInstructions, HasVInstructionsI64]; +} + +let SchedModel = TTAscalonD8Model in { + +//===----------------------------------------------------------------------===// +// Define each kind of processor resource and number available. + +let BufferSize = 16 in { + def AscalonLS : ProcResource<3>; + def AscalonFXA : ProcResource<1>; // ALU, FP/VEC -> INT, MUL, DIV, CSR + def AscalonFXB : ProcResource<1>; // ALU, INT -> FP/VEC + def AscalonFXC : ProcResource<2>; // ALU, BR + def AscalonFXD : ProcResource<2>; // ALU + def AscalonFP : ProcResource<2>; + // TODO: two vector units with vector scheduling model. +} + +def AscalonFX : ProcResGroup<[AscalonFXA, AscalonFXB, AscalonFXC, AscalonFXD]>; + +//===----------------------------------------------------------------------===// + +// Branching +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// Integer arithmetic and logic +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// Integer multiplication +let Latency = 3 in { +def : WriteRes; +def : WriteRes; +} + +// Integer division +// Worst case latency is used. + +let Latency = 7, ReleaseAtCycles = [7] in { + def : WriteRes; + def : WriteRes; + def : WriteRes; + def : WriteRes; +} + +// Bitmanip +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +def : WriteRes; +def : WriteRes; + +def : WriteRes; + +def : WriteRes; + +def : WriteRes; + +def : WriteRes; +def : WriteRes; + +// Single-bit instructions +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// Memory +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +let Latency = 4 in { +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +} + +// Atomic memory +def : WriteRes; +def : WriteRes; + +let Latency = 4 in { +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +} + +// Half precision. +let Latency = 3 in { +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +} + +let Latency = 7, ReleaseAtCycles = [7] in { +def : WriteRes; +def : WriteRes; +} + +// Single precision. +let Latency = 3 in { +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +} + +let Latency = 7, ReleaseAtCycles = [7] in { +def : WriteRes; +def : WriteRes; +} + +// Double precision +let Latency = 3 in { +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +} + +let Latency = 12, ReleaseAtCycles = [12] in { +def : WriteRes; +def : WriteRes; +} + +// Conversions +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; +def : WriteRes; + +// Others +def : WriteRes; +def : WriteRes; + +def : InstRW<[WriteIALU], (instrs COPY)>; + +//===----------------------------------------------------------------------===// +// Bypass and advance +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; + +// Bitmanip +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +def : ReadAdvance; +// Single-bit instructions +def : ReadAdvance; +def : ReadAdvance; + +//===----------------------------------------------------------------------===// +// Unsupported extensions +defm : UnsupportedSchedV; +defm : UnsupportedSchedXsfvcp; +defm : UnsupportedSchedZabha; +defm : UnsupportedSchedZbc; +defm : UnsupportedSchedZbkb; +defm : UnsupportedSchedZbkx; +defm : UnsupportedSchedZfa; +defm : UnsupportedSchedZvk; +defm : UnsupportedSchedSFB; +} diff --git a/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fp.s b/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fp.s new file mode 100644 index 0000000000000..9fd16e1ffc1d6 --- /dev/null +++ b/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fp.s @@ -0,0 +1,79 @@ +# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py +# RUN: llvm-mca -mtriple=riscv64-unknown-unknown -mcpu=tt-ascalon-d8 --iterations=1 < %s | FileCheck %s + +fmin.s ft0, fa0, fa1 +fmax.s ft1, fa0, fa1 +fmin.d ft2, ft4, ft5 +fmax.d ft3, ft4, ft5 +fmadd.s fs0, fs0, fs8, fs9 +fmsub.s fs1, fs1, fs8, fs9 +fmul.s fs3, fs3, fs4 +fdiv.s fs2, fs3, fs4 +fmul.d ft4, ft4, ft5 +fdiv.d fs4, fa3, ft5 +fsqrt.s ft1, fa2 +fsqrt.d ft2, fa3 + +# CHECK: Iterations: 1 +# CHECK-NEXT: Instructions: 12 +# CHECK-NEXT: Total Cycles: 31 +# CHECK-NEXT: Total uOps: 12 + +# CHECK: Dispatch Width: 8 +# CHECK-NEXT: uOps Per Cycle: 0.39 +# CHECK-NEXT: IPC: 0.39 +# CHECK-NEXT: Block RThroughput: 23.0 + +# CHECK: Instruction Info: +# CHECK-NEXT: [1]: #uOps +# CHECK-NEXT: [2]: Latency +# CHECK-NEXT: [3]: RThroughput +# CHECK-NEXT: [4]: MayLoad +# CHECK-NEXT: [5]: MayStore +# CHECK-NEXT: [6]: HasSideEffects (U) + +# CHECK: [1] [2] [3] [4] [5] [6] Instructions: +# CHECK-NEXT: 1 3 0.50 fmin.s ft0, fa0, fa1 +# CHECK-NEXT: 1 3 0.50 fmax.s ft1, fa0, fa1 +# CHECK-NEXT: 1 3 0.50 fmin.d ft2, ft4, ft5 +# CHECK-NEXT: 1 3 0.50 fmax.d ft3, ft4, ft5 +# CHECK-NEXT: 1 3 0.50 fmadd.s fs0, fs0, fs8, fs9 +# CHECK-NEXT: 1 3 0.50 fmsub.s fs1, fs1, fs8, fs9 +# CHECK-NEXT: 1 3 0.50 fmul.s fs3, fs3, fs4 +# CHECK-NEXT: 1 7 3.50 fdiv.s fs2, fs3, fs4 +# CHECK-NEXT: 1 3 0.50 fmul.d ft4, ft4, ft5 +# CHECK-NEXT: 1 12 6.00 fdiv.d fs4, fa3, ft5 +# CHECK-NEXT: 1 7 3.50 fsqrt.s ft1, fa2 +# CHECK-NEXT: 1 12 6.00 fsqrt.d ft2, fa3 + +# CHECK: Resources: +# CHECK-NEXT: [0.0] - AscalonFP +# CHECK-NEXT: [0.1] - AscalonFP +# CHECK-NEXT: [1] - AscalonFXA +# CHECK-NEXT: [2] - AscalonFXB +# CHECK-NEXT: [3.0] - AscalonFXC +# CHECK-NEXT: [3.1] - AscalonFXC +# CHECK-NEXT: [4.0] - AscalonFXD +# CHECK-NEXT: [4.1] - AscalonFXD +# CHECK-NEXT: [5.0] - AscalonLS +# CHECK-NEXT: [5.1] - AscalonLS +# CHECK-NEXT: [5.2] - AscalonLS + +# CHECK: Resource pressure per iteration: +# CHECK-NEXT: [0.0] [0.1] [1] [2] [3.0] [3.1] [4.0] [4.1] [5.0] [5.1] [5.2] +# CHECK-NEXT: 18.00 28.00 - - - - - - - - - + +# CHECK: Resource pressure by instruction: +# CHECK-NEXT: [0.0] [0.1] [1] [2] [3.0] [3.1] [4.0] [4.1] [5.0] [5.1] [5.2] Instructions: +# CHECK-NEXT: - 1.00 - - - - - - - - - fmin.s ft0, fa0, fa1 +# CHECK-NEXT: 1.00 - - - - - - - - - - fmax.s ft1, fa0, fa1 +# CHECK-NEXT: - 1.00 - - - - - - - - - fmin.d ft2, ft4, ft5 +# CHECK-NEXT: 1.00 - - - - - - - - - - fmax.d ft3, ft4, ft5 +# CHECK-NEXT: - 1.00 - - - - - - - - - fmadd.s fs0, fs0, fs8, fs9 +# CHECK-NEXT: 1.00 - - - - - - - - - - fmsub.s fs1, fs1, fs8, fs9 +# CHECK-NEXT: - 1.00 - - - - - - - - - fmul.s fs3, fs3, fs4 +# CHECK-NEXT: 7.00 - - - - - - - - - - fdiv.s fs2, fs3, fs4 +# CHECK-NEXT: 1.00 - - - - - - - - - - fmul.d ft4, ft4, ft5 +# CHECK-NEXT: - 12.00 - - - - - - - - - fdiv.d fs4, fa3, ft5 +# CHECK-NEXT: 7.00 - - - - - - - - - - fsqrt.s ft1, fa2 +# CHECK-NEXT: - 12.00 - - - - - - - - - fsqrt.d ft2, fa3 diff --git a/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fx.s b/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fx.s new file mode 100644 index 0000000000000..46cb4c6b8ae24 --- /dev/null +++ b/llvm/test/tools/llvm-mca/RISCV/tt-ascalon-d8/fx.s @@ -0,0 +1,79 @@ +# NOTE: Assertions have been autogenerated by utils/update_mca_test_checks.py +# RUN: llvm-mca -mtriple=riscv64-unknown-unknown -mcpu=tt-ascalon-d8 --iterations=1 < %s | FileCheck %s + +mul t0, a0, t0 +sub s2, a2, a3 +div t1, t2, t3 +add t1, a4, x3 +div a1, a2, a3 +add t1, a0, t0 +mul s0, a5, s0 +add t2, t2, t2 +sub s1, s0, s1 +fcvt.s.w f1, t3 +add s2, s2, s2 +fcvt.w.s t5, f3 + +# CHECK: Iterations: 1 +# CHECK-NEXT: Instructions: 12 +# CHECK-NEXT: Total Cycles: 22 +# CHECK-NEXT: Total uOps: 12 + +# CHECK: Dispatch Width: 8 +# CHECK-NEXT: uOps Per Cycle: 0.55 +# CHECK-NEXT: IPC: 0.55 +# CHECK-NEXT: Block RThroughput: 17.0 + +# CHECK: Instruction Info: +# CHECK-NEXT: [1]: #uOps +# CHECK-NEXT: [2]: Latency +# CHECK-NEXT: [3]: RThroughput +# CHECK-NEXT: [4]: MayLoad +# CHECK-NEXT: [5]: MayStore +# CHECK-NEXT: [6]: HasSideEffects (U) + +# CHECK: [1] [2] [3] [4] [5] [6] Instructions: +# CHECK-NEXT: 1 3 1.00 mul t0, a0, t0 +# CHECK-NEXT: 1 1 0.17 sub s2, a2, a3 +# CHECK-NEXT: 1 7 7.00 div t1, t2, t3 +# CHECK-NEXT: 1 1 0.17 add t1, a4, gp +# CHECK-NEXT: 1 7 7.00 div a1, a2, a3 +# CHECK-NEXT: 1 1 0.17 add t1, a0, t0 +# CHECK-NEXT: 1 3 1.00 mul s0, s0, a5 +# CHECK-NEXT: 1 1 0.17 add t2, t2, t2 +# CHECK-NEXT: 1 1 0.17 sub s1, s0, s1 +# CHECK-NEXT: 1 1 1.00 fcvt.s.w ft1, t3 +# CHECK-NEXT: 1 1 0.17 add s2, s2, s2 +# CHECK-NEXT: 1 1 1.00 fcvt.w.s t5, ft3 + +# CHECK: Resources: +# CHECK-NEXT: [0.0] - AscalonFP +# CHECK-NEXT: [0.1] - AscalonFP +# CHECK-NEXT: [1] - AscalonFXA +# CHECK-NEXT: [2] - AscalonFXB +# CHECK-NEXT: [3.0] - AscalonFXC +# CHECK-NEXT: [3.1] - AscalonFXC +# CHECK-NEXT: [4.0] - AscalonFXD +# CHECK-NEXT: [4.1] - AscalonFXD +# CHECK-NEXT: [5.0] - AscalonLS +# CHECK-NEXT: [5.1] - AscalonLS +# CHECK-NEXT: [5.2] - AscalonLS + +# CHECK: Resource pressure per iteration: +# CHECK-NEXT: [0.0] [0.1] [1] [2] [3.0] [3.1] [4.0] [4.1] [5.0] [5.1] [5.2] +# CHECK-NEXT: - - 17.00 1.00 2.00 2.00 1.00 1.00 - - - + +# CHECK: Resource pressure by instruction: +# CHECK-NEXT: [0.0] [0.1] [1] [2] [3.0] [3.1] [4.0] [4.1] [5.0] [5.1] [5.2] Instructions: +# CHECK-NEXT: - - 1.00 - - - - - - - - mul t0, a0, t0 +# CHECK-NEXT: - - - - - - - 1.00 - - - sub s2, a2, a3 +# CHECK-NEXT: - - 7.00 - - - - - - - - div t1, t2, t3 +# CHECK-NEXT: - - - - - - 1.00 - - - - add t1, a4, gp +# CHECK-NEXT: - - 7.00 - - - - - - - - div a1, a2, a3 +# CHECK-NEXT: - - - - - 1.00 - - - - - add t1, a0, t0 +# CHECK-NEXT: - - 1.00 - - - - - - - - mul s0, s0, a5 +# CHECK-NEXT: - - - - - 1.00 - - - - - add t2, t2, t2 +# CHECK-NEXT: - - - - 1.00 - - - - - - sub s1, s0, s1 +# CHECK-NEXT: - - - 1.00 - - - - - - - fcvt.s.w ft1, t3 +# CHECK-NEXT: - - - - 1.00 - - - - - - add s2, s2, s2 +# CHECK-NEXT: - - 1.00 - - - - - - - - fcvt.w.s t5, ft3 From bc8fa9c4439c7fd51d95845006f7d650c037c5ec Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sat, 21 Dec 2024 09:33:39 +1300 Subject: [PATCH 032/466] Revert "SimplifyLibCalls: Use default globals address space when building new global strings. (#118729)" (#119616) This reverts commit cfa582e8aaa791b52110791f5e6504121aaf62bf. --- .../llvm/Transforms/Utils/BuildLibCalls.h | 32 ++--- .../Scalar/DeadStoreElimination.cpp | 5 +- llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 116 ++++++++---------- .../lib/Transforms/Utils/SimplifyLibCalls.cpp | 80 ++++++------ .../InstCombine/printf-addrspace.ll | 35 ------ 5 files changed, 104 insertions(+), 164 deletions(-) delete mode 100644 llvm/test/Transforms/InstCombine/printf-addrspace.ll diff --git a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h index 0508f92dfd2ff..a8fb38e726004 100644 --- a/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h +++ b/llvm/include/llvm/Transforms/Utils/BuildLibCalls.h @@ -246,32 +246,32 @@ namespace llvm { const DataLayout &DL, const TargetLibraryInfo *TLI); /// Emit a call to the malloc function. - Value *emitMalloc(Type *RetTy, Value *Num, IRBuilderBase &B, - const DataLayout &DL, const TargetLibraryInfo *TLI); + Value *emitMalloc(Value *Num, IRBuilderBase &B, const DataLayout &DL, + const TargetLibraryInfo *TLI); /// Emit a call to the calloc function. - Value *emitCalloc(Type *RetTy, Value *Num, Value *Size, IRBuilderBase &B, - const TargetLibraryInfo &TLI); + Value *emitCalloc(Value *Num, Value *Size, IRBuilderBase &B, + const TargetLibraryInfo &TLI, unsigned AddrSpace); /// Emit a call to the hot/cold operator new function. - Value *emitHotColdNew(Type *RetTy, Value *Num, IRBuilderBase &B, + Value *emitHotColdNew(Value *Num, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold); - Value *emitHotColdNewNoThrow(Type *RetTy, Value *Num, Value *NoThrow, - IRBuilderBase &B, const TargetLibraryInfo *TLI, - LibFunc NewFunc, uint8_t HotCold); - Value *emitHotColdNewAligned(Type *RetTy, Value *Num, Value *Align, - IRBuilderBase &B, const TargetLibraryInfo *TLI, - LibFunc NewFunc, uint8_t HotCold); - Value *emitHotColdNewAlignedNoThrow(Type *RetTy, Value *Num, Value *Align, - Value *NoThrow, IRBuilderBase &B, + Value *emitHotColdNewNoThrow(Value *Num, Value *NoThrow, IRBuilderBase &B, + const TargetLibraryInfo *TLI, LibFunc NewFunc, + uint8_t HotCold); + Value *emitHotColdNewAligned(Value *Num, Value *Align, IRBuilderBase &B, + const TargetLibraryInfo *TLI, LibFunc NewFunc, + uint8_t HotCold); + Value *emitHotColdNewAlignedNoThrow(Value *Num, Value *Align, Value *NoThrow, + IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold); - Value *emitHotColdSizeReturningNew(Type *RetTy, Value *Num, IRBuilderBase &B, + Value *emitHotColdSizeReturningNew(Value *Num, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold); - Value *emitHotColdSizeReturningNewAligned(Type *RetTy, Value *Num, - Value *Align, IRBuilderBase &B, + Value *emitHotColdSizeReturningNewAligned(Value *Num, Value *Align, + IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold); } diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index 4799640089fa9..cae5b9c41a37f 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -2014,8 +2014,9 @@ struct DSEState { return false; IRBuilder<> IRB(Malloc); Type *SizeTTy = Malloc->getArgOperand(0)->getType(); - auto *Calloc = emitCalloc(Malloc->getType(), ConstantInt::get(SizeTTy, 1), - Malloc->getArgOperand(0), IRB, TLI); + auto *Calloc = + emitCalloc(ConstantInt::get(SizeTTy, 1), Malloc->getArgOperand(0), IRB, + TLI, Malloc->getType()->getPointerAddressSpace()); if (!Calloc) return false; diff --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp index 287538179af8f..fe1b91267c907 100644 --- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp @@ -1545,20 +1545,20 @@ static Value *emitLibCall(LibFunc TheLibFunc, Type *ReturnType, Value *llvm::emitStrLen(Value *Ptr, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Ptr->getType(); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strlen, SizeTTy, CharPtrTy, Ptr, B, TLI); } Value *llvm::emitStrDup(Value *Ptr, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Ptr->getType(); + Type *CharPtrTy = B.getPtrTy(); return emitLibCall(LibFunc_strdup, CharPtrTy, CharPtrTy, Ptr, B, TLI); } Value *llvm::emitStrChr(Value *Ptr, char C, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Ptr->getType(); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); return emitLibCall(LibFunc_strchr, CharPtrTy, {CharPtrTy, IntTy}, {Ptr, ConstantInt::get(IntTy, C)}, B, TLI); @@ -1566,8 +1566,7 @@ Value *llvm::emitStrChr(Value *Ptr, char C, IRBuilderBase &B, Value *llvm::emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Ptr1->getType(); - assert(CharPtrTy == Ptr2->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall( @@ -1579,23 +1578,20 @@ Value *llvm::emitStrNCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, Value *llvm::emitStrCpy(Value *Dst, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { Type *CharPtrTy = Dst->getType(); - assert(CharPtrTy == Src->getType()); return emitLibCall(LibFunc_strcpy, CharPtrTy, {CharPtrTy, CharPtrTy}, {Dst, Src}, B, TLI); } Value *llvm::emitStpCpy(Value *Dst, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dst->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); return emitLibCall(LibFunc_stpcpy, CharPtrTy, {CharPtrTy, CharPtrTy}, {Dst, Src}, B, TLI); } Value *llvm::emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dst->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strncpy, CharPtrTy, {CharPtrTy, CharPtrTy, SizeTTy}, {Dst, Src, Len}, B, TLI); @@ -1603,8 +1599,7 @@ Value *llvm::emitStrNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, Value *llvm::emitStpNCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dst->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_stpncpy, CharPtrTy, {CharPtrTy, CharPtrTy, SizeTTy}, {Dst, Src, Len}, B, TLI); @@ -1620,8 +1615,7 @@ Value *llvm::emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, AttributeList AS; AS = AttributeList::get(M->getContext(), AttributeList::FunctionIndex, Attribute::NoUnwind); - Type *VoidPtrTy = Dst->getType(); - assert(VoidPtrTy == Src->getType()); + Type *VoidPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); FunctionCallee MemCpy = getOrInsertLibFunc(M, *TLI, LibFunc_memcpy_chk, AttributeList::get(M->getContext(), AS), VoidPtrTy, @@ -1635,8 +1629,7 @@ Value *llvm::emitMemCpyChk(Value *Dst, Value *Src, Value *Len, Value *ObjSize, Value *llvm::emitMemPCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Dst->getType(); - assert(VoidPtrTy == Src->getType()); + Type *VoidPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_mempcpy, VoidPtrTy, {VoidPtrTy, VoidPtrTy, SizeTTy}, @@ -1645,7 +1638,7 @@ Value *llvm::emitMemPCpy(Value *Dst, Value *Src, Value *Len, IRBuilderBase &B, Value *llvm::emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Ptr->getType(); + Type *VoidPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_memchr, VoidPtrTy, @@ -1655,7 +1648,7 @@ Value *llvm::emitMemChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, Value *llvm::emitMemRChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Ptr->getType(); + Type *VoidPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_memrchr, VoidPtrTy, @@ -1665,8 +1658,7 @@ Value *llvm::emitMemRChr(Value *Ptr, Value *Val, Value *Len, IRBuilderBase &B, Value *llvm::emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Ptr1->getType(); - assert(VoidPtrTy == Ptr2->getType()); + Type *VoidPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_memcmp, IntTy, @@ -1676,8 +1668,7 @@ Value *llvm::emitMemCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, Value *llvm::emitBCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, const DataLayout &DL, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Ptr1->getType(); - assert(VoidPtrTy == Ptr2->getType()); + Type *VoidPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_bcmp, IntTy, @@ -1687,8 +1678,7 @@ Value *llvm::emitBCmp(Value *Ptr1, Value *Ptr2, Value *Len, IRBuilderBase &B, Value *llvm::emitMemCCpy(Value *Ptr1, Value *Ptr2, Value *Val, Value *Len, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *VoidPtrTy = Ptr1->getType(); - assert(VoidPtrTy == Ptr2->getType()); + Type *VoidPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_memccpy, VoidPtrTy, @@ -1699,8 +1689,7 @@ Value *llvm::emitMemCCpy(Value *Ptr1, Value *Ptr2, Value *Val, Value *Len, Value *llvm::emitSNPrintf(Value *Dest, Value *Size, Value *Fmt, ArrayRef VariadicArgs, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Fmt->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); SmallVector Args{Dest, Size, Fmt}; @@ -1713,7 +1702,7 @@ Value *llvm::emitSNPrintf(Value *Dest, Value *Size, Value *Fmt, Value *llvm::emitSPrintf(Value *Dest, Value *Fmt, ArrayRef VariadicArgs, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); SmallVector Args{Dest, Fmt}; llvm::append_range(Args, VariadicArgs); @@ -1724,8 +1713,7 @@ Value *llvm::emitSPrintf(Value *Dest, Value *Fmt, Value *llvm::emitStrCat(Value *Dest, Value *Src, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); return emitLibCall(LibFunc_strcat, CharPtrTy, {CharPtrTy, CharPtrTy}, {Dest, Src}, B, TLI); @@ -1733,8 +1721,7 @@ Value *llvm::emitStrCat(Value *Dest, Value *Src, IRBuilderBase &B, Value *llvm::emitStrLCpy(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strlcpy, SizeTTy, {CharPtrTy, CharPtrTy, SizeTTy}, @@ -1743,8 +1730,7 @@ Value *llvm::emitStrLCpy(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, Value *llvm::emitStrLCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strlcat, SizeTTy, {CharPtrTy, CharPtrTy, SizeTTy}, @@ -1753,8 +1739,7 @@ Value *llvm::emitStrLCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, Value *llvm::emitStrNCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Src->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall(LibFunc_strncat, CharPtrTy, {CharPtrTy, CharPtrTy, SizeTTy}, @@ -1763,8 +1748,7 @@ Value *llvm::emitStrNCat(Value *Dest, Value *Src, Value *Size, IRBuilderBase &B, Value *llvm::emitVSNPrintf(Value *Dest, Value *Size, Value *Fmt, Value *VAList, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Fmt->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); Type *SizeTTy = getSizeTTy(B, TLI); return emitLibCall( @@ -1775,8 +1759,7 @@ Value *llvm::emitVSNPrintf(Value *Dest, Value *Size, Value *Fmt, Value *VAList, Value *llvm::emitVSPrintf(Value *Dest, Value *Fmt, Value *VAList, IRBuilderBase &B, const TargetLibraryInfo *TLI) { - Type *CharPtrTy = Dest->getType(); - assert(CharPtrTy == Fmt->getType()); + Type *CharPtrTy = B.getPtrTy(); Type *IntTy = getIntTy(B, TLI); return emitLibCall(LibFunc_vsprintf, IntTy, {CharPtrTy, CharPtrTy, VAList->getType()}, @@ -1930,7 +1913,7 @@ Value *llvm::emitPutS(Value *Str, IRBuilderBase &B, Type *IntTy = getIntTy(B, TLI); StringRef PutsName = TLI->getName(LibFunc_puts); FunctionCallee PutS = - getOrInsertLibFunc(M, *TLI, LibFunc_puts, IntTy, Str->getType()); + getOrInsertLibFunc(M, *TLI, LibFunc_puts, IntTy, B.getPtrTy()); inferNonMandatoryLibFuncAttrs(M, PutsName, *TLI); CallInst *CI = B.CreateCall(PutS, Str, PutsName); if (const Function *F = @@ -1968,7 +1951,7 @@ Value *llvm::emitFPutS(Value *Str, Value *File, IRBuilderBase &B, Type *IntTy = getIntTy(B, TLI); StringRef FPutsName = TLI->getName(LibFunc_fputs); FunctionCallee F = getOrInsertLibFunc(M, *TLI, LibFunc_fputs, IntTy, - Str->getType(), File->getType()); + B.getPtrTy(), File->getType()); if (File->getType()->isPointerTy()) inferNonMandatoryLibFuncAttrs(M, FPutsName, *TLI); CallInst *CI = B.CreateCall(F, {Str, File}, FPutsName); @@ -1988,7 +1971,7 @@ Value *llvm::emitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilderBase &B, Type *SizeTTy = getSizeTTy(B, TLI); StringRef FWriteName = TLI->getName(LibFunc_fwrite); FunctionCallee F = - getOrInsertLibFunc(M, *TLI, LibFunc_fwrite, SizeTTy, Ptr->getType(), + getOrInsertLibFunc(M, *TLI, LibFunc_fwrite, SizeTTy, B.getPtrTy(), SizeTTy, SizeTTy, File->getType()); if (File->getType()->isPointerTy()) @@ -2003,8 +1986,8 @@ Value *llvm::emitFWrite(Value *Ptr, Value *Size, Value *File, IRBuilderBase &B, return CI; } -Value *llvm::emitMalloc(Type *RetTy, Value *Num, IRBuilderBase &B, - const DataLayout &DL, const TargetLibraryInfo *TLI) { +Value *llvm::emitMalloc(Value *Num, IRBuilderBase &B, const DataLayout &DL, + const TargetLibraryInfo *TLI) { Module *M = B.GetInsertBlock()->getModule(); if (!isLibFuncEmittable(M, TLI, LibFunc_malloc)) return nullptr; @@ -2012,7 +1995,7 @@ Value *llvm::emitMalloc(Type *RetTy, Value *Num, IRBuilderBase &B, StringRef MallocName = TLI->getName(LibFunc_malloc); Type *SizeTTy = getSizeTTy(B, TLI); FunctionCallee Malloc = - getOrInsertLibFunc(M, *TLI, LibFunc_malloc, RetTy, SizeTTy); + getOrInsertLibFunc(M, *TLI, LibFunc_malloc, B.getPtrTy(), SizeTTy); inferNonMandatoryLibFuncAttrs(M, MallocName, *TLI); CallInst *CI = B.CreateCall(Malloc, Num, MallocName); @@ -2023,16 +2006,16 @@ Value *llvm::emitMalloc(Type *RetTy, Value *Num, IRBuilderBase &B, return CI; } -Value *llvm::emitCalloc(Type *RetTy, Value *Num, Value *Size, IRBuilderBase &B, - const TargetLibraryInfo &TLI) { +Value *llvm::emitCalloc(Value *Num, Value *Size, IRBuilderBase &B, + const TargetLibraryInfo &TLI, unsigned AddrSpace) { Module *M = B.GetInsertBlock()->getModule(); if (!isLibFuncEmittable(M, &TLI, LibFunc_calloc)) return nullptr; StringRef CallocName = TLI.getName(LibFunc_calloc); Type *SizeTTy = getSizeTTy(B, &TLI); - FunctionCallee Calloc = - getOrInsertLibFunc(M, TLI, LibFunc_calloc, RetTy, SizeTTy, SizeTTy); + FunctionCallee Calloc = getOrInsertLibFunc( + M, TLI, LibFunc_calloc, B.getPtrTy(AddrSpace), SizeTTy, SizeTTy); inferNonMandatoryLibFuncAttrs(M, CallocName, TLI); CallInst *CI = B.CreateCall(Calloc, {Num, Size}, CallocName); @@ -2043,8 +2026,7 @@ Value *llvm::emitCalloc(Type *RetTy, Value *Num, Value *Size, IRBuilderBase &B, return CI; } -Value *llvm::emitHotColdSizeReturningNew(Type *RetPtrTy, Value *Num, - IRBuilderBase &B, +Value *llvm::emitHotColdSizeReturningNew(Value *Num, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc SizeFeedbackNewFunc, uint8_t HotCold) { @@ -2056,7 +2038,7 @@ Value *llvm::emitHotColdSizeReturningNew(Type *RetPtrTy, Value *Num, // __sized_ptr_t struct return type { void*, size_t } StructType *SizedPtrT = - StructType::get(M->getContext(), {RetPtrTy, Num->getType()}); + StructType::get(M->getContext(), {B.getPtrTy(), Num->getType()}); FunctionCallee Func = M->getOrInsertFunction(Name, SizedPtrT, Num->getType(), B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); @@ -2068,8 +2050,8 @@ Value *llvm::emitHotColdSizeReturningNew(Type *RetPtrTy, Value *Num, return CI; } -Value *llvm::emitHotColdSizeReturningNewAligned(Type *RetPtrTy, Value *Num, - Value *Align, IRBuilderBase &B, +Value *llvm::emitHotColdSizeReturningNewAligned(Value *Num, Value *Align, + IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc SizeFeedbackNewFunc, uint8_t HotCold) { @@ -2081,7 +2063,7 @@ Value *llvm::emitHotColdSizeReturningNewAligned(Type *RetPtrTy, Value *Num, // __sized_ptr_t struct return type { void*, size_t } StructType *SizedPtrT = - StructType::get(M->getContext(), {RetPtrTy, Num->getType()}); + StructType::get(M->getContext(), {B.getPtrTy(), Num->getType()}); FunctionCallee Func = M->getOrInsertFunction(Name, SizedPtrT, Num->getType(), Align->getType(), B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); @@ -2094,7 +2076,7 @@ Value *llvm::emitHotColdSizeReturningNewAligned(Type *RetPtrTy, Value *Num, return CI; } -Value *llvm::emitHotColdNew(Type *RetTy, Value *Num, IRBuilderBase &B, +Value *llvm::emitHotColdNew(Value *Num, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold) { Module *M = B.GetInsertBlock()->getModule(); @@ -2103,7 +2085,7 @@ Value *llvm::emitHotColdNew(Type *RetTy, Value *Num, IRBuilderBase &B, StringRef Name = TLI->getName(NewFunc); FunctionCallee Func = - M->getOrInsertFunction(Name, RetTy, Num->getType(), B.getInt8Ty()); + M->getOrInsertFunction(Name, B.getPtrTy(), Num->getType(), B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); CallInst *CI = B.CreateCall(Func, {Num, B.getInt8(HotCold)}, Name); @@ -2114,8 +2096,7 @@ Value *llvm::emitHotColdNew(Type *RetTy, Value *Num, IRBuilderBase &B, return CI; } -Value *llvm::emitHotColdNewNoThrow(Type *RetTy, Value *Num, Value *NoThrow, - IRBuilderBase &B, +Value *llvm::emitHotColdNewNoThrow(Value *Num, Value *NoThrow, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold) { Module *M = B.GetInsertBlock()->getModule(); @@ -2124,7 +2105,7 @@ Value *llvm::emitHotColdNewNoThrow(Type *RetTy, Value *Num, Value *NoThrow, StringRef Name = TLI->getName(NewFunc); FunctionCallee Func = M->getOrInsertFunction( - Name, RetTy, Num->getType(), NoThrow->getType(), B.getInt8Ty()); + Name, B.getPtrTy(), Num->getType(), NoThrow->getType(), B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); CallInst *CI = B.CreateCall(Func, {Num, NoThrow, B.getInt8(HotCold)}, Name); @@ -2135,8 +2116,7 @@ Value *llvm::emitHotColdNewNoThrow(Type *RetTy, Value *Num, Value *NoThrow, return CI; } -Value *llvm::emitHotColdNewAligned(Type *RetTy, Value *Num, Value *Align, - IRBuilderBase &B, +Value *llvm::emitHotColdNewAligned(Value *Num, Value *Align, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold) { Module *M = B.GetInsertBlock()->getModule(); @@ -2144,8 +2124,8 @@ Value *llvm::emitHotColdNewAligned(Type *RetTy, Value *Num, Value *Align, return nullptr; StringRef Name = TLI->getName(NewFunc); - FunctionCallee Func = M->getOrInsertFunction(Name, RetTy, Num->getType(), - Align->getType(), B.getInt8Ty()); + FunctionCallee Func = M->getOrInsertFunction( + Name, B.getPtrTy(), Num->getType(), Align->getType(), B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); CallInst *CI = B.CreateCall(Func, {Num, Align, B.getInt8(HotCold)}, Name); @@ -2156,7 +2136,7 @@ Value *llvm::emitHotColdNewAligned(Type *RetTy, Value *Num, Value *Align, return CI; } -Value *llvm::emitHotColdNewAlignedNoThrow(Type *RetTy, Value *Num, Value *Align, +Value *llvm::emitHotColdNewAlignedNoThrow(Value *Num, Value *Align, Value *NoThrow, IRBuilderBase &B, const TargetLibraryInfo *TLI, LibFunc NewFunc, uint8_t HotCold) { @@ -2165,9 +2145,9 @@ Value *llvm::emitHotColdNewAlignedNoThrow(Type *RetTy, Value *Num, Value *Align, return nullptr; StringRef Name = TLI->getName(NewFunc); - FunctionCallee Func = - M->getOrInsertFunction(Name, RetTy, Num->getType(), Align->getType(), - NoThrow->getType(), B.getInt8Ty()); + FunctionCallee Func = M->getOrInsertFunction( + Name, B.getPtrTy(), Num->getType(), Align->getType(), NoThrow->getType(), + B.getInt8Ty()); inferNonMandatoryLibFuncAttrs(M, Name, *TLI); CallInst *CI = B.CreateCall(Func, {Num, Align, NoThrow, B.getInt8(HotCold)}, Name); diff --git a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp index 7c45822572d4e..737818b7825cf 100644 --- a/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp @@ -901,9 +901,8 @@ Value *LibCallSimplifier::optimizeStringNCpy(CallInst *CI, bool RetEnd, // Create a bigger, nul-padded array with the same length, SrcLen, // as the original string. SrcStr.resize(N, '\0'); - Src = B.CreateGlobalString( - SrcStr, "str", /*AddressSpace=*/DL.getDefaultGlobalsAddressSpace(), - /*M=*/nullptr, /*AddNull=*/false); + Src = B.CreateGlobalString(SrcStr, "str", /*AddressSpace=*/0, + /*M=*/nullptr, /*AddNull=*/false); } // st{p,r}ncpy(D, S, N) -> memcpy(align 1 D, align 1 S, N) when both @@ -1707,8 +1706,7 @@ Value *LibCallSimplifier::optimizeMemSet(CallInst *CI, IRBuilderBase &B) { Value *LibCallSimplifier::optimizeRealloc(CallInst *CI, IRBuilderBase &B) { if (isa(CI->getArgOperand(0))) - return copyFlags(*CI, emitMalloc(CI->getArgOperand(0)->getType(), - CI->getArgOperand(1), B, DL, TLI)); + return copyFlags(*CI, emitMalloc(CI->getArgOperand(1), B, DL, TLI)); return nullptr; } @@ -1743,124 +1741,122 @@ Value *LibCallSimplifier::optimizeNew(CallInst *CI, IRBuilderBase &B, switch (Func) { case LibFunc_Znwm12__hot_cold_t: if (OptimizeExistingHotColdNew) - return emitHotColdNew(CI->getType(), CI->getArgOperand(0), B, TLI, + return emitHotColdNew(CI->getArgOperand(0), B, TLI, LibFunc_Znwm12__hot_cold_t, HotCold); break; case LibFunc_Znwm: if (HotCold != NotColdNewHintValue) - return emitHotColdNew(CI->getType(), CI->getArgOperand(0), B, TLI, + return emitHotColdNew(CI->getArgOperand(0), B, TLI, LibFunc_Znwm12__hot_cold_t, HotCold); break; case LibFunc_Znam12__hot_cold_t: if (OptimizeExistingHotColdNew) - return emitHotColdNew(CI->getType(), CI->getArgOperand(0), B, TLI, + return emitHotColdNew(CI->getArgOperand(0), B, TLI, LibFunc_Znam12__hot_cold_t, HotCold); break; case LibFunc_Znam: if (HotCold != NotColdNewHintValue) - return emitHotColdNew(CI->getType(), CI->getArgOperand(0), B, TLI, + return emitHotColdNew(CI->getArgOperand(0), B, TLI, LibFunc_Znam12__hot_cold_t, HotCold); break; case LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t, HotCold); break; case LibFunc_ZnwmRKSt9nothrow_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnwmRKSt9nothrow_t12__hot_cold_t, HotCold); break; case LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t, HotCold); break; case LibFunc_ZnamRKSt9nothrow_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnamRKSt9nothrow_t12__hot_cold_t, HotCold); break; case LibFunc_ZnwmSt11align_val_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewAligned( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnwmSt11align_val_t12__hot_cold_t, HotCold); break; case LibFunc_ZnwmSt11align_val_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewAligned( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnwmSt11align_val_t12__hot_cold_t, HotCold); break; case LibFunc_ZnamSt11align_val_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewAligned( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnamSt11align_val_t12__hot_cold_t, HotCold); break; case LibFunc_ZnamSt11align_val_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewAligned( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_ZnamSt11align_val_t12__hot_cold_t, HotCold); break; case LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewAlignedNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), - CI->getArgOperand(2), B, TLI, - LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold); + CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B, + TLI, LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, + HotCold); break; case LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewAlignedNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), - CI->getArgOperand(2), B, TLI, - LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold); + CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B, + TLI, LibFunc_ZnwmSt11align_val_tRKSt9nothrow_t12__hot_cold_t, + HotCold); break; case LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t: if (OptimizeExistingHotColdNew) return emitHotColdNewAlignedNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), - CI->getArgOperand(2), B, TLI, - LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold); + CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B, + TLI, LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, + HotCold); break; case LibFunc_ZnamSt11align_val_tRKSt9nothrow_t: if (HotCold != NotColdNewHintValue) return emitHotColdNewAlignedNoThrow( - CI->getType(), CI->getArgOperand(0), CI->getArgOperand(1), - CI->getArgOperand(2), B, TLI, - LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, HotCold); + CI->getArgOperand(0), CI->getArgOperand(1), CI->getArgOperand(2), B, + TLI, LibFunc_ZnamSt11align_val_tRKSt9nothrow_t12__hot_cold_t, + HotCold); break; case LibFunc_size_returning_new: if (HotCold != NotColdNewHintValue) - return emitHotColdSizeReturningNew( - CI->getType()->getStructElementType(0), CI->getArgOperand(0), B, TLI, - LibFunc_size_returning_new_hot_cold, HotCold); + return emitHotColdSizeReturningNew(CI->getArgOperand(0), B, TLI, + LibFunc_size_returning_new_hot_cold, + HotCold); break; case LibFunc_size_returning_new_hot_cold: if (OptimizeExistingHotColdNew) - return emitHotColdSizeReturningNew( - CI->getType()->getStructElementType(0), CI->getArgOperand(0), B, TLI, - LibFunc_size_returning_new_hot_cold, HotCold); + return emitHotColdSizeReturningNew(CI->getArgOperand(0), B, TLI, + LibFunc_size_returning_new_hot_cold, + HotCold); break; case LibFunc_size_returning_new_aligned: if (HotCold != NotColdNewHintValue) return emitHotColdSizeReturningNewAligned( - CI->getType()->getStructElementType(0), CI->getArgOperand(0), - CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_size_returning_new_aligned_hot_cold, HotCold); break; case LibFunc_size_returning_new_aligned_hot_cold: if (OptimizeExistingHotColdNew) return emitHotColdSizeReturningNewAligned( - CI->getType()->getStructElementType(0), CI->getArgOperand(0), - CI->getArgOperand(1), B, TLI, + CI->getArgOperand(0), CI->getArgOperand(1), B, TLI, LibFunc_size_returning_new_aligned_hot_cold, HotCold); break; default: @@ -3332,8 +3328,7 @@ Value *LibCallSimplifier::optimizePrintFString(CallInst *CI, IRBuilderBase &B) { // printf("%s", str"\n") --> puts(str) if (OperandStr.back() == '\n') { OperandStr = OperandStr.drop_back(); - Value *GV = B.CreateGlobalString(OperandStr, "str", - DL.getDefaultGlobalsAddressSpace()); + Value *GV = B.CreateGlobalString(OperandStr, "str"); return copyFlags(*CI, emitPutS(GV, B, TLI)); } return nullptr; @@ -3345,8 +3340,7 @@ Value *LibCallSimplifier::optimizePrintFString(CallInst *CI, IRBuilderBase &B) { // Create a string literal with no \n on it. We expect the constant merge // pass to be run after this pass, to merge duplicate strings. FormatStr = FormatStr.drop_back(); - Value *GV = B.CreateGlobalString(FormatStr, "str", - DL.getDefaultGlobalsAddressSpace()); + Value *GV = B.CreateGlobalString(FormatStr, "str"); return copyFlags(*CI, emitPutS(GV, B, TLI)); } diff --git a/llvm/test/Transforms/InstCombine/printf-addrspace.ll b/llvm/test/Transforms/InstCombine/printf-addrspace.ll deleted file mode 100644 index 3cb28ce3460bf..0000000000000 --- a/llvm/test/Transforms/InstCombine/printf-addrspace.ll +++ /dev/null @@ -1,35 +0,0 @@ -; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; Test that the printf library call simplifier works correctly. -; -; RUN: opt < %s -passes=instcombine -S | FileCheck %s - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-G200" - -@hello_world = addrspace(200) constant [13 x i8] c"hello world\0A\00" -@percent_s = addrspace(200) constant [4 x i8] c"%s\0A\00" - -declare i32 @printf(ptr addrspace(200) , ...) -declare i32 @puts(ptr addrspace(200)) - -; Check printf("foo\n") -> puts("foo"). - -define void @test_simplify1() { -; CHECK-LABEL: @test_simplify1( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(ptr addrspace(200) @str) -; CHECK-NEXT: ret void -; - call i32 (ptr addrspace(200) , ...) @printf(ptr addrspace(200) @hello_world) - ret void -} - - -; Check printf("%s\n", str) -> puts(str). - -define void @test_simplify2() { -; CHECK-LABEL: @test_simplify2( -; CHECK-NEXT: [[PUTS:%.*]] = call i32 @puts(ptr addrspace(200) @hello_world) -; CHECK-NEXT: ret void -; - call i32 (ptr addrspace(200) , ...) @printf(ptr addrspace(200) @percent_s, ptr addrspace(200) @hello_world) - ret void -} From ef42e9c59aae112031d6ccbbc560d559730507c8 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Fri, 20 Dec 2024 15:33:52 -0500 Subject: [PATCH 033/466] [libc++] Remove allocation.bench.cpp (#120767) That benchmark isn't really useful, since it doesn't benchmark anything from libc++ (besides `operator new`). The implementation of the benchmark also has serious problems like the fact that it allocates an unknown amount of memory without deallocating it. --- libcxx/test/benchmarks/allocation.bench.cpp | 125 -------------------- 1 file changed, 125 deletions(-) delete mode 100644 libcxx/test/benchmarks/allocation.bench.cpp diff --git a/libcxx/test/benchmarks/allocation.bench.cpp b/libcxx/test/benchmarks/allocation.bench.cpp deleted file mode 100644 index bdccaa2c133bd..0000000000000 --- a/libcxx/test/benchmarks/allocation.bench.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++03, c++11 - -// These compiler versions and platforms don't enable sized deallocation by default. -// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(target=x86_64-w64-windows-gnu): -fsized-deallocation -// ADDITIONAL_COMPILE_FLAGS(target=i686-w64-windows-gnu): -fsized-deallocation - -#include "benchmark/benchmark.h" - -#include -#include -#include -#include - -#include "test_macros.h" - -struct PointerList { - PointerList* Next = nullptr; -}; - -struct MallocWrapper { - __attribute__((always_inline)) static void* Allocate(size_t N) { return std::malloc(N); } - __attribute__((always_inline)) static void Deallocate(void* P, size_t) { std::free(P); } -}; - -struct NewWrapper { - __attribute__((always_inline)) static void* Allocate(size_t N) { return ::operator new(N); } - __attribute__((always_inline)) static void Deallocate(void* P, size_t) { ::operator delete(P); } -}; - -#ifdef TEST_COMPILER_CLANG -struct BuiltinNewWrapper { - __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); } - __attribute__((always_inline)) static void Deallocate(void* P, size_t) { __builtin_operator_delete(P); } -}; - -struct BuiltinSizedNewWrapper { - __attribute__((always_inline)) static void* Allocate(size_t N) { return __builtin_operator_new(N); } - __attribute__((always_inline)) static void Deallocate(void* P, size_t N) { __builtin_operator_delete(P, N); } -}; -#endif - -template -static void BM_AllocateAndDeallocate(benchmark::State& st) { - const size_t alloc_size = st.range(0); - while (st.KeepRunning()) { - void* p = AllocWrapper::Allocate(alloc_size); - benchmark::DoNotOptimize(p); - AllocWrapper::Deallocate(p, alloc_size); - } -} - -template -static void BM_AllocateOnly(benchmark::State& st) { - const size_t alloc_size = st.range(0); - PointerList* Start = nullptr; - - while (st.KeepRunning()) { - PointerList* p = (PointerList*)AllocWrapper::Allocate(alloc_size); - benchmark::DoNotOptimize(p); - p->Next = Start; - Start = p; - } - - PointerList* Next = Start; - while (Next) { - PointerList* Tmp = Next; - Next = Tmp->Next; - AllocWrapper::Deallocate(Tmp, alloc_size); - } -} - -template -static void BM_DeallocateOnly(benchmark::State& st) { - const size_t alloc_size = st.range(0); - const auto NumAllocs = st.max_iterations; - - std::vector Pointers(NumAllocs); - for (auto& p : Pointers) { - p = AllocWrapper::Allocate(alloc_size); - } - - void** Data = Pointers.data(); - [[maybe_unused]] void** const End = Pointers.data() + Pointers.size(); - while (st.KeepRunning()) { - AllocWrapper::Deallocate(*Data, alloc_size); - Data += 1; - } - assert(Data == End); -} - -static int RegisterAllocBenchmarks() { - using FnType = void (*)(benchmark::State&); - struct { - const char* name; - FnType func; - } TestCases[] = { - {"BM_Malloc", &BM_AllocateAndDeallocate}, - {"BM_New", &BM_AllocateAndDeallocate}, -#ifdef TEST_COMPILER_CLANG - {"BM_BuiltinNewDelete", BM_AllocateAndDeallocate}, - {"BM_BuiltinSizedNewDelete", BM_AllocateAndDeallocate}, - {"BM_BuiltinNewAllocateOnly", BM_AllocateOnly}, - {"BM_BuiltinNewSizedDeallocateOnly", BM_DeallocateOnly}, -#endif - }; - for (auto TC : TestCases) { - benchmark::RegisterBenchmark(TC.name, TC.func)->Range(16, 4096 * 2); - } - return 0; -} -int Sink = RegisterAllocBenchmarks(); - -BENCHMARK_MAIN(); From 131acb07d814fabcc969dcaa63f4f352cd529267 Mon Sep 17 00:00:00 2001 From: Ziqing Luo Date: Fri, 20 Dec 2024 12:29:33 -0800 Subject: [PATCH 034/466] [clang][NFC] Move static assert on StmtClass bounds from header to source A follow-up change to PR #120341 & #120643. Address @nikic's concern: https://github.com/llvm/llvm-project/pull/120341#discussion_r1893822845 --- clang/include/clang/AST/Stmt.h | 11 +---------- clang/lib/AST/Stmt.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index f188bd47f5c0a..405c6166adb15 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -109,16 +109,7 @@ class alignas(void *) Stmt { //===--- Statement bitfields classes ---===// - enum { NumStmtBits = 9 }; - -#define STMT(CLASS, PARENT) -#define STMT_RANGE(BASE, FIRST, LAST) -#define LAST_STMT_RANGE(BASE, FIRST, LAST) \ - static_assert(llvm::isUInt(StmtClass::LAST##Class), \ - "The number of 'StmtClass'es is strictly bound " \ - "by a bitfield of width NumStmtBits"); -#define ABSTRACT_STMT(STMT) -#include "clang/AST/StmtNodes.inc" + #define NumStmtBits 9 class StmtBitfields { friend class ASTStmtReader; diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 1e527ed0b2a2e..d6a351a78c7ba 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -47,6 +47,15 @@ using namespace clang; +#define STMT(CLASS, PARENT) +#define STMT_RANGE(BASE, FIRST, LAST) +#define LAST_STMT_RANGE(BASE, FIRST, LAST) \ + static_assert(llvm::isUInt(Stmt::StmtClass::LAST##Class), \ + "The number of 'StmtClass'es is strictly bound " \ + "by a bitfield of width NumStmtBits"); +#define ABSTRACT_STMT(STMT) +#include "clang/AST/StmtNodes.inc" + static struct StmtClassNameTable { const char *Name; unsigned Counter; From df8efbdbbfcde53b0f9f4f8ceb16b50eecd6e6d3 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 20 Dec 2024 20:49:37 +0000 Subject: [PATCH 035/466] [SCEV] Remove existing predicates implied by newly added ones. (#118185) When adding a new predicate to a union predicate, some of the existing predicates may be implied by the new predicate. Remove any existing predicates that are already implied by the new predicate. Depends on https://github.com/llvm/llvm-project/pull/118184 to show the main benefit. PR: https://github.com/llvm/llvm-project/pull/118185 --- llvm/lib/Analysis/ScalarEvolution.cpp | 15 ++++++-- .../nssw-predicate-implied.ll | 3 +- .../wrapping-pointer-versioning.ll | 2 +- .../AArch64/induction-costs-sve.ll | 2 -- .../LoopVectorize/AArch64/induction-costs.ll | 1 - .../LoopVectorize/X86/cost-model.ll | 3 +- .../Transforms/LoopVectorize/X86/pr72969.ll | 1 - ...o-fold-tail-by-masking-iv-external-uses.ll | 8 +---- .../scev-exit-phi-invalidation.ll | 19 ++++------- .../LoopVectorize/scev-predicate-reasoning.ll | 34 ++++++++----------- .../wrapping-pointer-versioning.ll | 4 +-- 11 files changed, 39 insertions(+), 53 deletions(-) diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 1e4bb1d606cd3..8ab56025546e6 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -15081,8 +15081,19 @@ void SCEVUnionPredicate::add(const SCEVPredicate *N, ScalarEvolution &SE) { } // Only add predicate if it is not already implied by this union predicate. - if (!implies(N, SE)) - Preds.push_back(N); + if (implies(N, SE)) + return; + + // Build a new vector containing the current predicates, except the ones that + // are implied by the new predicate N. + SmallVector PrunedPreds; + for (auto *P : Preds) { + if (N->implies(P, SE)) + continue; + PrunedPreds.push_back(P); + } + Preds = std::move(PrunedPreds); + Preds.push_back(N); } PredicatedScalarEvolution::PredicatedScalarEvolution(ScalarEvolution &SE, diff --git a/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll b/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll index 4f595b44ae5fd..c502c7c1176c0 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/nssw-predicate-implied.ll @@ -113,7 +113,7 @@ exit: ret void } -; FIXME: {0,+,3} implies {0,+,2}. +; {0,+,3} [nssw] implies {0,+,2} [nssw]. define void @wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order(i32 noundef %N, ptr %dst, ptr %src) { ; CHECK-LABEL: 'wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order' ; CHECK-NEXT: loop: @@ -135,7 +135,6 @@ define void @wrap_check_iv.3_implies_iv.2_predicates_added_in_different_order(i3 ; CHECK-EMPTY: ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop. ; CHECK-NEXT: SCEV assumptions: -; CHECK-NEXT: {0,+,2}<%loop> Added Flags: ; CHECK-NEXT: {0,+,3}<%loop> Added Flags: ; CHECK-EMPTY: ; CHECK-NEXT: Expressions re-written: diff --git a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll index 9da3d8f3d2802..52ef2d7fb7621 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll @@ -22,7 +22,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ; LAA-LABEL: f1 ; LAA: Memory dependences are safe{{$}} ; LAA: SCEV assumptions: -; LAA-NEXT: {0,+,2}<%for.body> Added Flags: +; LAA-NOT: {0,+,2}<%for.body> Added Flags: ; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: ; The expression for %mul_ext as analyzed by SCEV is diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll index 8d449f447d598..d42e6af1cec0c 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs-sve.ll @@ -760,7 +760,6 @@ define void @exit_cond_zext_iv(ptr %dst, i64 %N) { ; DEFAULT: vector.scevcheck: ; DEFAULT-NEXT: [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1) ; DEFAULT-NEXT: [[TMP0:%.*]] = add i64 [[UMAX]], -1 -; DEFAULT-NEXT: [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295 ; DEFAULT-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32 ; DEFAULT-NEXT: [[TMP3:%.*]] = add i32 1, [[TMP2]] ; DEFAULT-NEXT: [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1 @@ -810,7 +809,6 @@ define void @exit_cond_zext_iv(ptr %dst, i64 %N) { ; PRED: vector.scevcheck: ; PRED-NEXT: [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1) ; PRED-NEXT: [[TMP0:%.*]] = add i64 [[UMAX]], -1 -; PRED-NEXT: [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295 ; PRED-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32 ; PRED-NEXT: [[TMP3:%.*]] = add i32 1, [[TMP2]] ; PRED-NEXT: [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1 diff --git a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll index 3f55701f4f2a4..bf27f9e6be65e 100644 --- a/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll +++ b/llvm/test/Transforms/LoopVectorize/AArch64/induction-costs.ll @@ -390,7 +390,6 @@ define void @zext_iv_increment(ptr %dst, i64 %N) { ; CHECK: vector.scevcheck: ; CHECK-NEXT: [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[N]], i64 1) ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[UMAX]], -1 -; CHECK-NEXT: [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP0]] to i32 ; CHECK-NEXT: [[TMP3:%.*]] = add i32 1, [[TMP2]] ; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i32 [[TMP3]], 1 diff --git a/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll b/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll index bfff5c94d727f..6a12be7da192e 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/cost-model.ll @@ -335,14 +335,13 @@ define void @multi_exit(ptr %dst, ptr %src.1, ptr %src.2, i64 %A, i64 %B) #0 { ; CHECK-NEXT: [[TMP1:%.*]] = freeze i64 [[TMP0]] ; CHECK-NEXT: [[UMIN7:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP1]], i64 [[A:%.*]]) ; CHECK-NEXT: [[TMP2:%.*]] = add nuw i64 [[UMIN7]], 1 -; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ule i64 [[TMP2]], 30 +; CHECK-NEXT: [[MIN_ITERS_CHECK:%.*]] = icmp ule i64 [[TMP2]], 28 ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_SCEVCHECK:%.*]] ; CHECK: vector.scevcheck: ; CHECK-NEXT: [[UMAX:%.*]] = call i64 @llvm.umax.i64(i64 [[B]], i64 1) ; CHECK-NEXT: [[TMP3:%.*]] = add i64 [[UMAX]], -1 ; CHECK-NEXT: [[TMP4:%.*]] = freeze i64 [[TMP3]] ; CHECK-NEXT: [[UMIN:%.*]] = call i64 @llvm.umin.i64(i64 [[TMP4]], i64 [[A]]) -; CHECK-NEXT: [[TMP5:%.*]] = icmp ugt i64 [[UMIN]], 4294967295 ; CHECK-NEXT: [[TMP6:%.*]] = trunc i64 [[UMIN]] to i32 ; CHECK-NEXT: [[TMP7:%.*]] = add i32 1, [[TMP6]] ; CHECK-NEXT: [[TMP8:%.*]] = icmp ult i32 [[TMP7]], 1 diff --git a/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll b/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll index 5a0aec967ccd9..41868d62a35a5 100644 --- a/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll +++ b/llvm/test/Transforms/LoopVectorize/X86/pr72969.ll @@ -42,7 +42,6 @@ define void @test(ptr %p) { ; VEC-NEXT: [[TMP6:%.*]] = add i64 [[UMAX]], -9 ; VEC-NEXT: [[TMP7:%.*]] = sub i64 [[TMP6]], [[P1]] ; VEC-NEXT: [[TMP8:%.*]] = lshr i64 [[TMP7]], 3 -; VEC-NEXT: [[TMP9:%.*]] = icmp ugt i64 [[TMP8]], 65535 ; VEC-NEXT: [[TMP10:%.*]] = trunc i64 [[TMP8]] to i16 ; VEC-NEXT: [[TMP11:%.*]] = add i16 2, [[TMP10]] ; VEC-NEXT: [[TMP12:%.*]] = icmp ult i16 [[TMP11]], 2 diff --git a/llvm/test/Transforms/LoopVectorize/no-fold-tail-by-masking-iv-external-uses.ll b/llvm/test/Transforms/LoopVectorize/no-fold-tail-by-masking-iv-external-uses.ll index e0f57d5233304..66996316b47b7 100644 --- a/llvm/test/Transforms/LoopVectorize/no-fold-tail-by-masking-iv-external-uses.ll +++ b/llvm/test/Transforms/LoopVectorize/no-fold-tail-by-masking-iv-external-uses.ll @@ -19,17 +19,11 @@ define i32 @test(ptr %arr, i64 %n) { ; CHECK-NEXT: br i1 [[MIN_ITERS_CHECK]], label [[SCALAR_PH:%.*]], label [[VECTOR_SCEVCHECK:%.*]] ; CHECK: vector.scevcheck: ; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[N]], -2 -; CHECK-NEXT: [[TMP2:%.*]] = trunc i64 [[TMP1]] to i8 -; CHECK-NEXT: [[TMP3:%.*]] = add i8 1, [[TMP2]] -; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i8 [[TMP3]], 1 -; CHECK-NEXT: [[TMP5:%.*]] = icmp ugt i64 [[TMP1]], 255 -; CHECK-NEXT: [[TMP6:%.*]] = or i1 [[TMP4]], [[TMP5]] ; CHECK-NEXT: [[TMP7:%.*]] = trunc i64 [[TMP1]] to i8 ; CHECK-NEXT: [[TMP8:%.*]] = add i8 2, [[TMP7]] ; CHECK-NEXT: [[TMP9:%.*]] = icmp ult i8 [[TMP8]], 2 ; CHECK-NEXT: [[TMP10:%.*]] = icmp ugt i64 [[TMP1]], 255 -; CHECK-NEXT: [[TMP11:%.*]] = or i1 [[TMP9]], [[TMP10]] -; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP6]], [[TMP11]] +; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP9]], [[TMP10]] ; CHECK-NEXT: br i1 [[TMP12]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; CHECK: vector.ph: ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[TMP0]], 4 diff --git a/llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll b/llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll index d0f9ae28ae946..63bf01fe604e8 100644 --- a/llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll +++ b/llvm/test/Transforms/LoopVectorize/scev-exit-phi-invalidation.ll @@ -42,16 +42,11 @@ define void @test_pr63368(i1 %c, ptr %A) { ; CHECK-NEXT: [[SMAX:%.*]] = call i32 @llvm.smax.i32(i32 [[L_LCSSA_LCSSA]], i32 -1) ; CHECK-NEXT: [[TMP3:%.*]] = add i32 [[SMAX]], 1 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i8 -; CHECK-NEXT: [[TMP5:%.*]] = icmp slt i8 [[TMP4]], 0 -; CHECK-NEXT: [[TMP6:%.*]] = icmp ugt i32 [[TMP3]], 255 -; CHECK-NEXT: [[TMP7:%.*]] = or i1 [[TMP5]], [[TMP6]] -; CHECK-NEXT: [[TMP8:%.*]] = trunc i32 [[TMP3]] to i8 -; CHECK-NEXT: [[TMP9:%.*]] = add i8 1, [[TMP8]] -; CHECK-NEXT: [[TMP10:%.*]] = icmp slt i8 [[TMP9]], 1 -; CHECK-NEXT: [[TMP11:%.*]] = icmp ugt i32 [[TMP3]], 255 -; CHECK-NEXT: [[TMP12:%.*]] = or i1 [[TMP10]], [[TMP11]] -; CHECK-NEXT: [[TMP13:%.*]] = or i1 [[TMP7]], [[TMP12]] -; CHECK-NEXT: br i1 [[TMP13]], label [[SCALAR_PH3]], label [[VECTOR_PH4:%.*]] +; CHECK-NEXT: [[TMP5:%.*]] = add i8 1, [[TMP4]] +; CHECK-NEXT: [[TMP6:%.*]] = icmp slt i8 [[TMP5]], 1 +; CHECK-NEXT: [[TMP7:%.*]] = icmp ugt i32 [[TMP3]], 255 +; CHECK-NEXT: [[TMP8:%.*]] = or i1 [[TMP6]], [[TMP7]] +; CHECK-NEXT: br i1 [[TMP8]], label [[SCALAR_PH3]], label [[VECTOR_PH4:%.*]] ; CHECK: vector.ph4: ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i32 [[TMP2]], 4 ; CHECK-NEXT: [[N_VEC:%.*]] = sub i32 [[TMP2]], [[N_MOD_VF]] @@ -69,8 +64,8 @@ define void @test_pr63368(i1 %c, ptr %A) { ; CHECK-NEXT: [[TMP18:%.*]] = icmp eq i32 [[INDEX_NEXT9]], [[N_VEC]] ; CHECK-NEXT: br i1 [[TMP18]], label [[MIDDLE_BLOCK2:%.*]], label [[VECTOR_BODY5]], !llvm.loop [[LOOP4:![0-9]+]] ; CHECK: middle.block2: -; CHECK-NEXT: [[CMP_N6:%.*]] = icmp eq i32 [[TMP2]], [[N_VEC]] -; CHECK-NEXT: br i1 [[CMP_N6]], label [[EXIT_2:%.*]], label [[SCALAR_PH3]] +; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i32 [[TMP2]], [[N_VEC]] +; CHECK-NEXT: br i1 [[CMP_N]], label [[EXIT_2:%.*]], label [[SCALAR_PH3]] ; CHECK: scalar.ph3: ; CHECK-NEXT: [[BC_RESUME_VAL8:%.*]] = phi i8 [ [[IND_END]], [[MIDDLE_BLOCK2]] ], [ 0, [[VECTOR_SCEVCHECK]] ], [ 0, [[EXIT_1]] ] ; CHECK-NEXT: br label [[LOOP_2:%.*]] diff --git a/llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll b/llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll index e53de22f74b2c..2f2d715790229 100644 --- a/llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll +++ b/llvm/test/Transforms/LoopVectorize/scev-predicate-reasoning.ll @@ -174,20 +174,14 @@ define void @implied_wrap_predicate(ptr %A, ptr %B, ptr %C) { ; CHECK-NEXT: [[TMP7:%.*]] = sub i64 [[TMP6]], [[A1]] ; CHECK-NEXT: [[TMP8:%.*]] = lshr i64 [[TMP7]], 3 ; CHECK-NEXT: [[TMP9:%.*]] = trunc i64 [[TMP8]] to i16 -; CHECK-NEXT: [[TMP10:%.*]] = add i16 1, [[TMP9]] -; CHECK-NEXT: [[TMP11:%.*]] = icmp ult i16 [[TMP10]], 1 +; CHECK-NEXT: [[TMP10:%.*]] = add i16 2, [[TMP9]] +; CHECK-NEXT: [[TMP11:%.*]] = icmp ult i16 [[TMP10]], 2 ; CHECK-NEXT: [[TMP12:%.*]] = icmp ugt i64 [[TMP8]], 65535 ; CHECK-NEXT: [[TMP13:%.*]] = or i1 [[TMP11]], [[TMP12]] -; CHECK-NEXT: [[TMP14:%.*]] = trunc i64 [[TMP8]] to i16 -; CHECK-NEXT: [[TMP15:%.*]] = add i16 2, [[TMP14]] -; CHECK-NEXT: [[TMP16:%.*]] = icmp ult i16 [[TMP15]], 2 -; CHECK-NEXT: [[TMP17:%.*]] = icmp ugt i64 [[TMP8]], 65535 -; CHECK-NEXT: [[TMP18:%.*]] = or i1 [[TMP16]], [[TMP17]] -; CHECK-NEXT: [[TMP19:%.*]] = or i1 [[TMP13]], [[TMP18]] -; CHECK-NEXT: br i1 [[TMP19]], label [[SCALAR_PH]], label [[VECTOR_MEMCHECK:%.*]] +; CHECK-NEXT: br i1 [[TMP13]], label [[SCALAR_PH]], label [[VECTOR_MEMCHECK:%.*]] ; CHECK: vector.memcheck: -; CHECK-NEXT: [[TMP20:%.*]] = sub i64 [[C2]], [[A3]] -; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP20]], 32 +; CHECK-NEXT: [[TMP14:%.*]] = sub i64 [[C2]], [[A3]] +; CHECK-NEXT: [[DIFF_CHECK:%.*]] = icmp ult i64 [[TMP14]], 32 ; CHECK-NEXT: br i1 [[DIFF_CHECK]], label [[SCALAR_PH]], label [[VECTOR_PH:%.*]] ; CHECK: vector.ph: ; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[TMP4]], 4 @@ -199,16 +193,16 @@ define void @implied_wrap_predicate(ptr %A, ptr %B, ptr %C) { ; CHECK: vector.body: ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ] ; CHECK-NEXT: [[OFFSET_IDX:%.*]] = add i64 1, [[INDEX]] -; CHECK-NEXT: [[TMP21:%.*]] = add i64 [[OFFSET_IDX]], 0 -; CHECK-NEXT: [[TMP22:%.*]] = getelementptr i64, ptr [[A]], i64 [[TMP21]] -; CHECK-NEXT: [[TMP23:%.*]] = getelementptr i64, ptr [[TMP22]], i32 0 -; CHECK-NEXT: store <4 x i64> zeroinitializer, ptr [[TMP23]], align 4 -; CHECK-NEXT: [[TMP24:%.*]] = getelementptr i64, ptr [[C]], i64 [[TMP21]] -; CHECK-NEXT: [[TMP25:%.*]] = getelementptr i64, ptr [[TMP24]], i32 0 -; CHECK-NEXT: store <4 x i64> zeroinitializer, ptr [[TMP25]], align 4 +; CHECK-NEXT: [[TMP15:%.*]] = add i64 [[OFFSET_IDX]], 0 +; CHECK-NEXT: [[TMP16:%.*]] = getelementptr i64, ptr [[A]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP17:%.*]] = getelementptr i64, ptr [[TMP16]], i32 0 +; CHECK-NEXT: store <4 x i64> zeroinitializer, ptr [[TMP17]], align 4 +; CHECK-NEXT: [[TMP18:%.*]] = getelementptr i64, ptr [[C]], i64 [[TMP15]] +; CHECK-NEXT: [[TMP19:%.*]] = getelementptr i64, ptr [[TMP18]], i32 0 +; CHECK-NEXT: store <4 x i64> zeroinitializer, ptr [[TMP19]], align 4 ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4 -; CHECK-NEXT: [[TMP26:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] -; CHECK-NEXT: br i1 [[TMP26]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]] +; CHECK-NEXT: [[TMP20:%.*]] = icmp eq i64 [[INDEX_NEXT]], [[N_VEC]] +; CHECK-NEXT: br i1 [[TMP20]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop [[LOOP6:![0-9]+]] ; CHECK: middle.block: ; CHECK-NEXT: [[CMP_N:%.*]] = icmp eq i64 [[TMP4]], [[N_VEC]] ; CHECK-NEXT: br i1 [[CMP_N]], label [[EXIT:%.*]], label [[SCALAR_PH]] diff --git a/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll b/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll index 892c518b6c873..4c8b43eab947f 100644 --- a/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll +++ b/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll @@ -29,15 +29,13 @@ define void @f1(ptr noalias %a, ; LV-LABEL: @f1( ; LV-NEXT: for.body.lver.check: ; LV-NEXT: [[TMP0:%.*]] = add i64 [[N:%.*]], -1 -; LV-NEXT: [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295 ; LV-NEXT: [[MUL1:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 4, i64 [[TMP0]]) ; LV-NEXT: [[MUL_RESULT:%.*]] = extractvalue { i64, i1 } [[MUL1]], 0 ; LV-NEXT: [[MUL_OVERFLOW:%.*]] = extractvalue { i64, i1 } [[MUL1]], 1 ; LV-NEXT: [[TMP2:%.*]] = sub i64 0, [[MUL_RESULT]] ; LV-NEXT: [[TMP3:%.*]] = getelementptr i8, ptr [[A:%.*]], i64 [[MUL_RESULT]] ; LV-NEXT: [[TMP4:%.*]] = icmp ult ptr [[TMP3]], [[A]] -; LV-NEXT: [[TMP5:%.*]] = or i1 [[TMP4]], [[MUL_OVERFLOW]] -; LV-NEXT: [[TMP6:%.*]] = or i1 [[TMP1]], [[TMP5]] +; LV-NEXT: [[TMP6:%.*]] = or i1 [[TMP4]], [[MUL_OVERFLOW]] ; LV-NEXT: br i1 [[TMP6]], label [[FOR_BODY_PH_LVER_ORIG:%.*]], label [[FOR_BODY_PH:%.*]] ; LV: for.body.ph.lver.orig: ; LV-NEXT: br label [[FOR_BODY_LVER_ORIG:%.*]] From 7a4b3b4927bd92e8494dca9dffaf5aeeca4658ba Mon Sep 17 00:00:00 2001 From: Helena Kotas Date: Fri, 20 Dec 2024 12:52:38 -0800 Subject: [PATCH 036/466] [HLSL] Add Load(int) method on structured buffers (#120663) Adds `T Load(int)` method on `StructuredBuffer`, `RWStructuredBuffer` and `RasterizerOrderedStructuredBuffer`. Uses the existing `addLoadMethods` in HLSLExternalSemalSource so most of this change is just tests. Fixes #112977 --- clang/lib/Sema/HLSLExternalSemaSource.cpp | 3 +++ .../test/AST/HLSL/StructuredBuffers-AST.hlsl | 21 ++++++++++++++++--- .../StructuredBuffers-methods-lib.hlsl | 15 +++++++++++++ .../StructuredBuffers-methods-ps.hlsl | 13 ++++++++++-- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp index 4faeda856c469..d34d3ef2996ac 100644 --- a/clang/lib/Sema/HLSLExternalSemaSource.cpp +++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp @@ -1027,6 +1027,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { setupBufferType(Decl, *SemaPtr, ResourceClass::SRV, ResourceKind::RawBuffer, /*IsROV=*/false, /*RawBuffer=*/true) .addArraySubscriptOperators() + .addLoadMethods() .completeDefinition(); }); @@ -1037,6 +1038,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer, /*IsROV=*/false, /*RawBuffer=*/true) .addArraySubscriptOperators() + .addLoadMethods() .addIncrementCounterMethod() .addDecrementCounterMethod() .completeDefinition(); @@ -1072,6 +1074,7 @@ void HLSLExternalSemaSource::defineHLSLTypesWithForwardDeclarations() { setupBufferType(Decl, *SemaPtr, ResourceClass::UAV, ResourceKind::RawBuffer, /*IsROV=*/true, /*RawBuffer=*/true) .addArraySubscriptOperators() + .addLoadMethods() .addIncrementCounterMethod() .addDecrementCounterMethod() .completeDefinition(); diff --git a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl index fd4aa58f5891b..db3f2d405e686 100644 --- a/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl +++ b/clang/test/AST/HLSL/StructuredBuffers-AST.hlsl @@ -4,7 +4,7 @@ // // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \ // RUN: -DRESOURCE=StructuredBuffer %s | FileCheck -DRESOURCE=StructuredBuffer \ -// RUN: -check-prefixes=CHECK,CHECK-SRV,CHECK-SUBSCRIPT %s +// RUN: -check-prefixes=CHECK,CHECK-SRV,CHECK-SUBSCRIPT,CHECK-LOAD %s // // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \ // RUN: -DRESOURCE=RWStructuredBuffer %s | FileCheck -DRESOURCE=RWStructuredBuffer \ @@ -12,7 +12,7 @@ // // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \ // RUN: -DRESOURCE=RWStructuredBuffer %s | FileCheck -DRESOURCE=RWStructuredBuffer \ -// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-SUBSCRIPT,CHECK-COUNTER %s +// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-SUBSCRIPT,CHECK-COUNTER,CHECK-LOAD %s // // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump -DEMPTY \ // RUN: -DRESOURCE=AppendStructuredBuffer %s | FileCheck -DRESOURCE=AppendStructuredBuffer \ @@ -36,7 +36,7 @@ // // RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -x hlsl -ast-dump \ // RUN: -DRESOURCE=RasterizerOrderedStructuredBuffer %s | FileCheck -DRESOURCE=RasterizerOrderedStructuredBuffer \ -// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-ROV,CHECK-SUBSCRIPT %s +// RUN: -check-prefixes=CHECK,CHECK-UAV,CHECK-ROV,CHECK-SUBSCRIPT,CHECK-LOAD %s // This test tests two different AST generations for each structured buffer. // The "EMPTY" test mode verifies the AST generated by forward declaration @@ -125,6 +125,21 @@ RESOURCE Buffer; // CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <> operator[] 'const element_type &(unsigned int) const' // CHECK-NOSUBSCRIPT-NOT: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <> operator[] 'element_type &(unsigned int)' +// CHECK-LOAD: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <> Load 'element_type (unsigned int)' +// CHECK-LOAD-NEXT: ParmVarDecl 0x{{[0-9A-Fa-f]+}} <> Index 'unsigned int' +// CHECK-LOAD-NEXT: CompoundStmt 0x{{[0-9A-Fa-f]+}} <> +// CHECK-LOAD-NEXT: ReturnStmt 0x{{[0-9A-Fa-f]+}} <> +// CHECK-LOAD-NEXT: UnaryOperator 0x{{[0-9A-Fa-f]+}} <> 'element_type' prefix '*' cannot overflow +// CHECK-LOAD-NEXT: CallExpr 0x{{[0-9A-Fa-f]+}} <> 'element_type *' +// CHECK-LOAD-NEXT: DeclRefExpr 0x{{[0-9A-Fa-f]+}} <> '' Function 0x{{[0-9A-Fa-f]+}} '__builtin_hlsl_resource_getpointer' 'void (...) noexcept' +// CHECK-LOAD-NEXT: MemberExpr 0x{{[0-9A-Fa-f]+}} <> '__hlsl_resource_t +// CHECK-LOAD-SAME{LITERAL}: [[hlsl::resource_class( +// CHECK-LOAD-SAME{LITERAL}: [[hlsl::contained_type(element_type)]] +// CHECK-LOAD-SAME: ' lvalue .__handle 0x{{[0-9A-Fa-f]+}} +// CHECK-LOAD-NEXT: CXXThisExpr 0x{{[0-9A-Fa-f]+}} <> '[[RESOURCE]]' lvalue implicit this +// CHECK-LOAD-NEXT: DeclRefExpr 0x{{[0-9A-Fa-f]+}} <> 'unsigned int' ParmVar 0x{{[0-9A-Fa-f]+}} 'Index' 'unsigned int' +// CHECK-LOAD-NEXT: AlwaysInlineAttr 0x{{[0-9A-Fa-f]+}} <> Implicit always_inline + // CHECK-COUNTER: CXXMethodDecl 0x{{[0-9A-Fa-f]+}} <> IncrementCounter 'unsigned int ()' // CHECK-COUNTER-NEXT: CompoundStmt 0x{{[0-9A-Fa-f]+}} <> // CHECK-COUNTER-NEXT: ReturnStmt 0x{{[0-9A-Fa-f]+}} <> diff --git a/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-lib.hlsl b/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-lib.hlsl index 5fc2d2ead564d..383f591f676d9 100644 --- a/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-lib.hlsl +++ b/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-lib.hlsl @@ -3,12 +3,16 @@ // NOTE: SPIRV codegen for resource methods is not yet implemented +StructuredBuffer SB1 : register(t0); RWStructuredBuffer RWSB1 : register(u0); RWStructuredBuffer RWSB2 : register(u1); AppendStructuredBuffer ASB : register(u2); ConsumeStructuredBuffer CSB : register(u3); +// CHECK: %"class.hlsl::StructuredBuffer" = type { target("dx.RawBuffer", float, 0, 0) } // CHECK: %"class.hlsl::RWStructuredBuffer" = type { target("dx.RawBuffer", float, 1, 0) } +// CHECK: %"class.hlsl::AppendStructuredBuffer" = type { target("dx.RawBuffer", float, 1, 0) } +// CHECK: %"class.hlsl::ConsumeStructuredBuffer" = type { target("dx.RawBuffer", float, 1, 0) } export int TestIncrementCounter() { return RWSB1.IncrementCounter(); @@ -45,5 +49,16 @@ export float TestConsume() { // CHECK-DXIL: %[[VALUE:.*]] = load float, ptr %[[RESPTR]], align 4 // CHECK-DXIL: ret float %[[VALUE]] +export float TestLoad() { + return RWSB1.Load(1) + SB1.Load(2); +} + +// CHECK: define noundef float @_Z8TestLoadv() +// CHECK: %[[PTR1:.*]] = call ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0) %{{[0-9]+}}, i32 %{{[0-9]+}}) +// CHECK: %[[VALUE1:.*]] = load float, ptr %[[PTR1]] +// CHECK: %[[PTR2:.*]] = call ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_0_0t(target("dx.RawBuffer", float, 0, 0) %{{[0-9]+}}, i32 %{{[0-9]+}}) +// CHECK: %[[VALUE2:.*]] = load float, ptr %[[PTR2]] + // CHECK: declare i32 @llvm.dx.resource.updatecounter.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i8) // CHECK: declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i32) +// CHECK: declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_0_0t(target("dx.RawBuffer", float, 0, 0), i32) diff --git a/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-ps.hlsl b/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-ps.hlsl index f7c091084d3ed..3d9f4f68ec7d2 100644 --- a/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-ps.hlsl +++ b/clang/test/CodeGenHLSL/builtins/StructuredBuffers-methods-ps.hlsl @@ -24,5 +24,14 @@ export void TestDecrementCounter() { ROSB2.DecrementCounter(); } -// CHECK: declare i32 @llvm.dx.resource.updatecounter.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i8) -// CHECK: declare i32 @llvm.dx.resource.updatecounter.tdx.RawBuffer_f32_1_1t(target("dx.RawBuffer", float, 1, 1), i8) +export float TestLoad() { + return ROSB1.Load(10); +} + +// CHECK: define noundef float @_Z8TestLoadv() +// CHECK: %[[PTR1:.*]] = call ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_1_1t(target("dx.RawBuffer", float, 1, 1) %{{[0-9]+}}, i32 %{{[0-9]+}}) +// CHECK: %[[VALUE1:.*]] = load float, ptr %[[PTR1]] + +// CHECK: declare i32 @llvm.dx.resource.updatecounter.tdx.RawBuffer_f32_1_0t(target("dx.RawBuffer", float, 1, 0), i8) #3 +// CHECK: declare i32 @llvm.dx.resource.updatecounter.tdx.RawBuffer_f32_1_1t(target("dx.RawBuffer", float, 1, 1), i8) #3 +// CHECK: declare ptr @llvm.dx.resource.getpointer.p0.tdx.RawBuffer_f32_1_1t(target("dx.RawBuffer", float, 1, 1), i32) #4 From d8e10d13d7e31cb1695eb65f02696e682ec97097 Mon Sep 17 00:00:00 2001 From: Thurston Dang Date: Fri, 20 Dec 2024 20:52:13 +0000 Subject: [PATCH 037/466] [rtsan] Fix-forward TEST(TestRtsanInterceptors, PpollDiesWhenRealtime) Buildbot breakage: home/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp:1090:19: error: missing field 'tv_nsec' initializer [-Werror,-Wmissing-field-initializers] 1090 | timespec ts = {0}; introduced by https://github.com/llvm/llvm-project/pull/120366/files --- compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp index eb502e99bb1b5..b052dd859dcdf 100644 --- a/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp +++ b/compiler-rt/lib/rtsan/tests/rtsan_test_interceptors_posix.cpp @@ -1087,7 +1087,7 @@ TEST(TestRtsanInterceptors, PpollDiesWhenRealtime) { fds[0].fd = 0; fds[0].events = POLLIN; - timespec ts = {0}; + timespec ts = {0, 0}; auto Func = [&fds, &ts]() { ppoll(fds, 1, &ts, nullptr); }; From d9cc37fea7b02954079ca59e8f7f28cffacc7e9e Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Fri, 20 Dec 2024 13:02:54 -0800 Subject: [PATCH 038/466] [lldb] Expose structured errors in SBError (#120784) Building on top of previous work that exposed expression diagnostics via SBCommandReturnObject, this patch generalizes the support to expose any SBError as machine-readable structured data. One use-case of this is to allow IDEs to better visualize expression diagnostics. rdar://139997604 --- lldb/include/lldb/API/SBError.h | 5 ++ lldb/include/lldb/API/SBStructuredData.h | 1 + .../lldb/Utility/DiagnosticsRendering.h | 14 +++- lldb/include/lldb/Utility/Status.h | 6 ++ lldb/source/API/SBError.cpp | 14 ++++ .../Interpreter/CommandReturnObject.cpp | 52 +------------ lldb/source/Utility/DiagnosticsRendering.cpp | 40 ++++++++++ lldb/source/Utility/Status.cpp | 24 ++++++ .../diagnostics/TestExprDiagnostics.py | 75 ++++++++++++------- .../API/commands/frame/var/TestFrameVar.py | 15 +++- 10 files changed, 161 insertions(+), 85 deletions(-) diff --git a/lldb/include/lldb/API/SBError.h b/lldb/include/lldb/API/SBError.h index 9f55f92131c06..58b45ebd793af 100644 --- a/lldb/include/lldb/API/SBError.h +++ b/lldb/include/lldb/API/SBError.h @@ -44,8 +44,13 @@ class LLDB_API SBError { bool Success() const; + /// Get the error code. uint32_t GetError() const; + /// Get the error in machine-readable form. Particularly useful for + /// compiler diagnostics. + SBStructuredData GetErrorData() const; + lldb::ErrorType GetType() const; void SetError(uint32_t err, lldb::ErrorType type); diff --git a/lldb/include/lldb/API/SBStructuredData.h b/lldb/include/lldb/API/SBStructuredData.h index c0d214a7374c6..f96e169f236ed 100644 --- a/lldb/include/lldb/API/SBStructuredData.h +++ b/lldb/include/lldb/API/SBStructuredData.h @@ -115,6 +115,7 @@ class SBStructuredData { friend class SBLaunchInfo; friend class SBDebugger; friend class SBFrame; + friend class SBError; friend class SBTarget; friend class SBProcess; friend class SBThread; diff --git a/lldb/include/lldb/Utility/DiagnosticsRendering.h b/lldb/include/lldb/Utility/DiagnosticsRendering.h index 33aded602e3a7..dd33d671c24a5 100644 --- a/lldb/include/lldb/Utility/DiagnosticsRendering.h +++ b/lldb/include/lldb/Utility/DiagnosticsRendering.h @@ -57,6 +57,13 @@ struct DiagnosticDetail { std::string rendered; }; +StructuredData::ObjectSP Serialize(llvm::ArrayRef details); + +void RenderDiagnosticDetails(Stream &stream, + std::optional offset_in_command, + bool show_inline, + llvm::ArrayRef details); + class DiagnosticError : public llvm::ErrorInfo { public: @@ -64,12 +71,11 @@ class DiagnosticError DiagnosticError(std::error_code ec) : ErrorInfo(ec) {} lldb::ErrorType GetErrorType() const override; virtual llvm::ArrayRef GetDetails() const = 0; + StructuredData::ObjectSP GetAsStructuredData() const override { + return Serialize(GetDetails()); + } static char ID; }; -void RenderDiagnosticDetails(Stream &stream, - std::optional offset_in_command, - bool show_inline, - llvm::ArrayRef details); } // namespace lldb_private #endif diff --git a/lldb/include/lldb/Utility/Status.h b/lldb/include/lldb/Utility/Status.h index b8993dff3bb18..212282cca1f3e 100644 --- a/lldb/include/lldb/Utility/Status.h +++ b/lldb/include/lldb/Utility/Status.h @@ -10,6 +10,7 @@ #define LLDB_UTILITY_STATUS_H #include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/lldb-defines.h" #include "lldb/lldb-enumerations.h" #include "llvm/ADT/StringRef.h" @@ -38,6 +39,7 @@ class CloneableError CloneableError() : ErrorInfo() {} virtual std::unique_ptr Clone() const = 0; virtual lldb::ErrorType GetErrorType() const = 0; + virtual StructuredData::ObjectSP GetAsStructuredData() const = 0; static char ID; }; @@ -49,6 +51,7 @@ class CloneableECError std::error_code convertToErrorCode() const override { return EC; } void log(llvm::raw_ostream &OS) const override { OS << EC.message(); } lldb::ErrorType GetErrorType() const override; + virtual StructuredData::ObjectSP GetAsStructuredData() const override; static char ID; protected: @@ -183,6 +186,9 @@ class Status { /// NULL otherwise. const char *AsCString(const char *default_error_str = "unknown error") const; + /// Get the error in machine-readable form. + StructuredData::ObjectSP GetAsStructuredData() const; + /// Clear the object state. /// /// Reverts the state of this object to contain a generic success value and diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp index 31964931649db..aab4ddd3181dd 100644 --- a/lldb/source/API/SBError.cpp +++ b/lldb/source/API/SBError.cpp @@ -9,6 +9,8 @@ #include "lldb/API/SBError.h" #include "Utils.h" #include "lldb/API/SBStream.h" +#include "lldb/API/SBStructuredData.h" +#include "lldb/Core/StructuredDataImpl.h" #include "lldb/Utility/Instrumentation.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/VASPrintf.h" @@ -97,6 +99,18 @@ uint32_t SBError::GetError() const { return err; } +SBStructuredData SBError::GetErrorData() const { + LLDB_INSTRUMENT_VA(this); + + SBStructuredData sb_data; + if (!m_opaque_up) + return sb_data; + + StructuredData::ObjectSP data(m_opaque_up->GetAsStructuredData()); + sb_data.m_impl_up->SetObjectSP(data); + return sb_data; +} + ErrorType SBError::GetType() const { LLDB_INSTRUMENT_VA(this); diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp index 2776efbb5ee36..b99b2bc7b36ce 100644 --- a/lldb/source/Interpreter/CommandReturnObject.cpp +++ b/lldb/source/Interpreter/CommandReturnObject.cpp @@ -169,57 +169,7 @@ std::string CommandReturnObject::GetErrorString(bool with_diagnostics) { } StructuredData::ObjectSP CommandReturnObject::GetErrorData() { - auto make_array = []() { return std::make_unique(); }; - auto make_bool = [](bool b) { - return std::make_unique(b); - }; - auto make_dict = []() { - return std::make_unique(); - }; - auto make_int = [](unsigned i) { - return std::make_unique(i); - }; - auto make_string = [](llvm::StringRef s) { - return std::make_unique(s); - }; - auto dict_up = make_dict(); - dict_up->AddItem("version", make_int(1)); - auto array_up = make_array(); - for (const DiagnosticDetail &diag : m_diagnostics) { - auto detail_up = make_dict(); - if (auto &sloc = diag.source_location) { - auto sloc_up = make_dict(); - sloc_up->AddItem("file", make_string(sloc->file.GetPath())); - sloc_up->AddItem("line", make_int(sloc->line)); - sloc_up->AddItem("length", make_int(sloc->length)); - sloc_up->AddItem("hidden", make_bool(sloc->hidden)); - sloc_up->AddItem("in_user_input", make_bool(sloc->in_user_input)); - detail_up->AddItem("source_location", std::move(sloc_up)); - } - llvm::StringRef severity = "unknown"; - switch (diag.severity) { - case lldb::eSeverityError: - severity = "error"; - break; - case lldb::eSeverityWarning: - severity = "warning"; - break; - case lldb::eSeverityInfo: - severity = "note"; - break; - } - detail_up->AddItem("severity", make_string(severity)); - detail_up->AddItem("message", make_string(diag.message)); - detail_up->AddItem("rendered", make_string(diag.rendered)); - array_up->AddItem(std::move(detail_up)); - } - dict_up->AddItem("details", std::move(array_up)); - if (auto stream_sp = m_err_stream.GetStreamAtIndex(eStreamStringIndex)) { - auto text = std::static_pointer_cast(stream_sp)->GetString(); - if (!text.empty()) - dict_up->AddItem("text", make_string(text)); - } - return dict_up; + return Serialize(m_diagnostics); } // Similar to AppendError, but do not prepend 'Status: ' to message, and don't diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp b/lldb/source/Utility/DiagnosticsRendering.cpp index f5aa27baadfef..368e2199b749f 100644 --- a/lldb/source/Utility/DiagnosticsRendering.cpp +++ b/lldb/source/Utility/DiagnosticsRendering.cpp @@ -20,6 +20,46 @@ lldb::ErrorType DiagnosticError::GetErrorType() const { return lldb::eErrorTypeExpression; } +StructuredData::ObjectSP Serialize(llvm::ArrayRef details) { + auto make_array = []() { return std::make_unique(); }; + auto make_dict = []() { + return std::make_unique(); + }; + auto dict_up = make_dict(); + dict_up->AddIntegerItem("version", 1u); + auto array_up = make_array(); + for (const DiagnosticDetail &diag : details) { + auto detail_up = make_dict(); + if (auto &sloc = diag.source_location) { + auto sloc_up = make_dict(); + sloc_up->AddStringItem("file", sloc->file.GetPath()); + sloc_up->AddIntegerItem("line", sloc->line); + sloc_up->AddIntegerItem("length", sloc->length); + sloc_up->AddBooleanItem("hidden", sloc->hidden); + sloc_up->AddBooleanItem("in_user_input", sloc->in_user_input); + detail_up->AddItem("source_location", std::move(sloc_up)); + } + llvm::StringRef severity = "unknown"; + switch (diag.severity) { + case lldb::eSeverityError: + severity = "error"; + break; + case lldb::eSeverityWarning: + severity = "warning"; + break; + case lldb::eSeverityInfo: + severity = "note"; + break; + } + detail_up->AddStringItem("severity", severity); + detail_up->AddStringItem("message", diag.message); + detail_up->AddStringItem("rendered", diag.rendered); + array_up->AddItem(std::move(detail_up)); + } + dict_up->AddItem("details", std::move(array_up)); + return dict_up; +} + static llvm::raw_ostream &PrintSeverity(Stream &stream, lldb::Severity severity) { llvm::HighlightColor color; diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp index 5757935fb8622..49dd469d20bd5 100644 --- a/lldb/source/Utility/Status.cpp +++ b/lldb/source/Utility/Status.cpp @@ -252,6 +252,30 @@ lldb::ErrorType Win32Error::GetErrorType() const { return lldb::eErrorTypeWin32; } +StructuredData::ObjectSP Status::GetAsStructuredData() const { + auto dict_up = std::make_unique(); + auto array_up = std::make_unique(); + llvm::visitErrors(m_error, [&](const llvm::ErrorInfoBase &error) { + if (error.isA()) + array_up->AddItem( + static_cast(error).GetAsStructuredData()); + else + array_up->AddStringItem(error.message()); + }); + dict_up->AddIntegerItem("version", 1u); + dict_up->AddIntegerItem("type", (unsigned)GetType()); + dict_up->AddItem("errors", std::move(array_up)); + return dict_up; +} + +StructuredData::ObjectSP CloneableECError::GetAsStructuredData() const { + auto dict_up = std::make_unique(); + dict_up->AddIntegerItem("version", 1u); + dict_up->AddIntegerItem("error_code", EC.value()); + dict_up->AddStringItem("message", message()); + return dict_up; +} + ErrorType Status::GetType() const { ErrorType result = eErrorTypeInvalid; llvm::visitErrors(m_error, [&](const llvm::ErrorInfoBase &error) { diff --git a/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py b/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py index 0806776aa6eb0..59e759352ce06 100644 --- a/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py +++ b/lldb/test/API/commands/expression/diagnostics/TestExprDiagnostics.py @@ -207,37 +207,56 @@ def test_command_expr_sbdata(self): (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "// Break here", self.main_source_spec ) + + def check_error(diags): + # Version. + version = diags.GetValueForKey("version") + self.assertEqual(version.GetIntegerValue(), 1) + + details = diags.GetValueForKey("details") + + # Detail 1/2: undeclared 'a' + diag = details.GetItemAtIndex(0) + + severity = diag.GetValueForKey("severity") + message = diag.GetValueForKey("message") + rendered = diag.GetValueForKey("rendered") + sloc = diag.GetValueForKey("source_location") + filename = sloc.GetValueForKey("file") + hidden = sloc.GetValueForKey("hidden") + in_user_input = sloc.GetValueForKey("in_user_input") + + self.assertEqual(str(severity), "error") + self.assertIn("undeclared identifier 'a'", str(message)) + # The rendered string should contain the source file. + self.assertIn("user expression", str(rendered)) + self.assertIn("user expression", str(filename)) + self.assertFalse(hidden.GetBooleanValue()) + self.assertTrue(in_user_input.GetBooleanValue()) + + # Detail 1/2: undeclared 'b' + diag = details.GetItemAtIndex(1) + message = diag.GetValueForKey("message") + self.assertIn("undeclared identifier 'b'", str(message)) + + # Test diagnostics in CommandReturnObject interp = self.dbg.GetCommandInterpreter() cro = lldb.SBCommandReturnObject() interp.HandleCommand("expression -- a+b", cro) diags = cro.GetErrorData() - # Version. - version = diags.GetValueForKey("version") - self.assertEqual(version.GetIntegerValue(), 1) + check_error(diags) - details = diags.GetValueForKey("details") - - # Detail 1/2: undeclared 'a' - diag = details.GetItemAtIndex(0) - - severity = diag.GetValueForKey("severity") - message = diag.GetValueForKey("message") - rendered = diag.GetValueForKey("rendered") - sloc = diag.GetValueForKey("source_location") - filename = sloc.GetValueForKey("file") - hidden = sloc.GetValueForKey("hidden") - in_user_input = sloc.GetValueForKey("in_user_input") - - self.assertEqual(str(severity), "error") - self.assertIn("undeclared identifier 'a'", str(message)) - # The rendered string should contain the source file. - self.assertIn("user expression", str(rendered)) - self.assertIn("user expression", str(filename)) - self.assertFalse(hidden.GetBooleanValue()) - self.assertTrue(in_user_input.GetBooleanValue()) - - # Detail 1/2: undeclared 'b' - diag = details.GetItemAtIndex(1) - message = diag.GetValueForKey("message") - self.assertIn("undeclared identifier 'b'", str(message)) + # Test diagnostics in SBError + frame = thread.GetSelectedFrame() + value = frame.EvaluateExpression("a+b") + error = value.GetError() + self.assertTrue(error.Fail()) + self.assertEquals(error.GetType(), lldb.eErrorTypeExpression) + data = error.GetErrorData() + version = data.GetValueForKey("version") + self.assertEqual(version.GetIntegerValue(), 1) + err_ty = data.GetValueForKey("type") + self.assertEqual(err_ty.GetIntegerValue(), lldb.eErrorTypeExpression) + diags = data.GetValueForKey("errors").GetItemAtIndex(0) + check_error(diags) diff --git a/lldb/test/API/commands/frame/var/TestFrameVar.py b/lldb/test/API/commands/frame/var/TestFrameVar.py index 92e47eb45f5ca..7211cade5c7c8 100644 --- a/lldb/test/API/commands/frame/var/TestFrameVar.py +++ b/lldb/test/API/commands/frame/var/TestFrameVar.py @@ -113,12 +113,23 @@ def check_frame_variable_errors(self, thread, error_strings): frame = thread.GetFrameAtIndex(0) var_list = frame.GetVariables(True, True, False, True) self.assertEqual(var_list.GetSize(), 0) - api_error = var_list.GetError().GetCString() + api_error = var_list.GetError() + api_error_str = api_error.GetCString() for s in error_strings: self.assertIn(s, command_error) for s in error_strings: - self.assertIn(s, api_error) + self.assertIn(s, api_error_str) + + # Check the structured error data. + data = api_error.GetErrorData() + version = data.GetValueForKey("version") + self.assertEqual(version.GetIntegerValue(), 1) + err_ty = data.GetValueForKey("type") + self.assertEqual(err_ty.GetIntegerValue(), lldb.eErrorTypeGeneric) + message = str(data.GetValueForKey("errors").GetItemAtIndex(0)) + for s in error_strings: + self.assertIn(s, message) @skipIfRemote @skipUnlessDarwin From 8fce5d96a75d8c6b018e54fd4005bda01c377b56 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 20 Dec 2024 21:13:08 +0000 Subject: [PATCH 039/466] [SCEV] Update changed test after df8efbdbb. Test needed updating due to changes on main since branch was tested. --- .../Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll index 52ef2d7fb7621..1ebe91a044b78 100644 --- a/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll +++ b/llvm/test/Analysis/LoopAccessAnalysis/wrapping-pointer-versioning.ll @@ -22,7 +22,7 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" ; LAA-LABEL: f1 ; LAA: Memory dependences are safe{{$}} ; LAA: SCEV assumptions: -; LAA-NOT: {0,+,2}<%for.body> Added Flags: +; LAA: {0,+,2}<%for.body> Added Flags: ; LAA-NEXT: {%a,+,4}<%for.body> Added Flags: ; The expression for %mul_ext as analyzed by SCEV is From f82bb3d496d6b8b932ce34497ba7970b519915f6 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Fri, 20 Dec 2024 21:31:04 +0000 Subject: [PATCH 040/466] [SCEV] Update changed test after df8efbdbb (take 2). Test needed updating due to changes on main since branch was tested. --- .../Transforms/LoopVersioning/wrapping-pointer-versioning.ll | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll b/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll index 4c8b43eab947f..6e5eeaf9f1218 100644 --- a/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll +++ b/llvm/test/Transforms/LoopVersioning/wrapping-pointer-versioning.ll @@ -29,6 +29,7 @@ define void @f1(ptr noalias %a, ; LV-LABEL: @f1( ; LV-NEXT: for.body.lver.check: ; LV-NEXT: [[TMP0:%.*]] = add i64 [[N:%.*]], -1 +; LV-NEXT: [[TMP1:%.*]] = icmp ugt i64 [[TMP0]], 4294967295 ; LV-NEXT: [[MUL1:%.*]] = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 4, i64 [[TMP0]]) ; LV-NEXT: [[MUL_RESULT:%.*]] = extractvalue { i64, i1 } [[MUL1]], 0 ; LV-NEXT: [[MUL_OVERFLOW:%.*]] = extractvalue { i64, i1 } [[MUL1]], 1 @@ -36,7 +37,8 @@ define void @f1(ptr noalias %a, ; LV-NEXT: [[TMP3:%.*]] = getelementptr i8, ptr [[A:%.*]], i64 [[MUL_RESULT]] ; LV-NEXT: [[TMP4:%.*]] = icmp ult ptr [[TMP3]], [[A]] ; LV-NEXT: [[TMP6:%.*]] = or i1 [[TMP4]], [[MUL_OVERFLOW]] -; LV-NEXT: br i1 [[TMP6]], label [[FOR_BODY_PH_LVER_ORIG:%.*]], label [[FOR_BODY_PH:%.*]] +; LV-NEXT: [[TMP7:%.*]] = or i1 [[TMP1]], [[TMP6]] +; LV-NEXT: br i1 [[TMP7]], label [[FOR_BODY_PH_LVER_ORIG:%.*]], label [[FOR_BODY_PH:%.*]] ; LV: for.body.ph.lver.orig: ; LV-NEXT: br label [[FOR_BODY_LVER_ORIG:%.*]] ; LV: for.body.lver.orig: From 81831ef3e7804b9637aff119c1adde661d10fb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 20 Dec 2024 13:32:31 -0800 Subject: [PATCH 041/466] [flang][cuda] Correctly allocate descriptor in managed memory when reboxing (#120795) Reboxing might create a new in memory descriptor. If this one was allocate with managed memory, allocate the new one in managed memory as well. --- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 11 ++-- flang/test/Fir/CUDA/cuda-code-gen.mlir | 70 +++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index d09f47a20b33d..9d911d6bfd406 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -1725,13 +1725,17 @@ struct EmboxOpConversion : public EmboxCommonConversion { }; static bool isDeviceAllocation(mlir::Value val) { + if (auto loadOp = mlir::dyn_cast_or_null(val.getDefiningOp())) + return isDeviceAllocation(loadOp.getMemref()); if (auto convertOp = mlir::dyn_cast_or_null(val.getDefiningOp())) val = convertOp.getValue(); if (auto callOp = mlir::dyn_cast_or_null(val.getDefiningOp())) if (callOp.getCallee() && - callOp.getCallee().value().getRootReference().getValue().starts_with( - RTNAME_STRING(CUFMemAlloc))) + (callOp.getCallee().value().getRootReference().getValue().starts_with( + RTNAME_STRING(CUFMemAlloc)) || + callOp.getCallee().value().getRootReference().getValue().starts_with( + RTNAME_STRING(CUFAllocDesciptor)))) return true; return false; } @@ -2045,7 +2049,8 @@ struct XReboxOpConversion : public EmboxCommonConversion { } dest = insertBaseAddress(rewriter, loc, dest, base); mlir::Value result = - placeInMemoryIfNotGlobalInit(rewriter, rebox.getLoc(), destBoxTy, dest); + placeInMemoryIfNotGlobalInit(rewriter, rebox.getLoc(), destBoxTy, dest, + isDeviceAllocation(rebox.getBox())); rewriter.replaceOp(rebox, result); return mlir::success(); } diff --git a/flang/test/Fir/CUDA/cuda-code-gen.mlir b/flang/test/Fir/CUDA/cuda-code-gen.mlir index a34c2770c5f6c..47c5667a14c95 100644 --- a/flang/test/Fir/CUDA/cuda-code-gen.mlir +++ b/flang/test/Fir/CUDA/cuda-code-gen.mlir @@ -56,3 +56,73 @@ module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64> // CHECK-LABEL: llvm.func @_QQmain() // CHECK: llvm.call @_FortranACUFMemAlloc // CHECK: llvm.call @_FortranACUFAllocDesciptor + +// ----- + +module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64>, i128 = dense<128> : vector<2xi64>, i64 = dense<64> : vector<2xi64>, !llvm.ptr<272> = dense<64> : vector<4xi64>, !llvm.ptr<271> = dense<32> : vector<4xi64>, !llvm.ptr<270> = dense<32> : vector<4xi64>, f128 = dense<128> : vector<2xi64>, f64 = dense<64> : vector<2xi64>, f16 = dense<16> : vector<2xi64>, i32 = dense<32> : vector<2xi64>, i16 = dense<16> : vector<2xi64>, i8 = dense<8> : vector<2xi64>, i1 = dense<8> : vector<2xi64>, !llvm.ptr = dense<64> : vector<4xi64>, "dlti.endianness" = "little", "dlti.stack_alignment" = 128 : i64>} { + func.func @_QQmain() attributes {fir.bindc_name = "p1"} { + %c1_i32 = arith.constant 1 : i32 + %c0_i32 = arith.constant 0 : i32 + %c16_i32 = arith.constant 16 : i32 + %c1 = arith.constant 1 : index + %c0 = arith.constant 0 : index + %0 = fir.alloca i32 {bindc_name = "iblk", uniq_name = "_QFEiblk"} + %1 = fir.alloca i32 {bindc_name = "ithr", uniq_name = "_QFEithr"} + %2 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref> + %c14_i32 = arith.constant 14 : i32 + %c72 = arith.constant 72 : index + %3 = fir.convert %c72 : (index) -> i64 + %4 = fir.convert %2 : (!fir.ref>) -> !fir.ref + %5 = fir.call @_FortranACUFAllocDesciptor(%3, %4, %c14_i32) : (i64, !fir.ref, i32) -> !fir.ref> + %6 = fir.convert %5 : (!fir.ref>) -> !fir.ref>>> + %7 = fir.zero_bits !fir.heap> + %8 = fircg.ext_embox %7(%c0, %c0) {allocator_idx = 2 : i32} : (!fir.heap>, index, index) -> !fir.box>> + fir.store %8 to %6 : !fir.ref>>> + %9 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref> + %c20_i32 = arith.constant 20 : i32 + %c48 = arith.constant 48 : index + %10 = fir.convert %c48 : (index) -> i64 + %11 = fir.convert %9 : (!fir.ref>) -> !fir.ref + %12 = fir.call @_FortranACUFAllocDesciptor(%10, %11, %c20_i32) : (i64, !fir.ref, i32) -> !fir.ref> + %13 = fir.convert %12 : (!fir.ref>) -> !fir.ref>>> + %14 = fir.zero_bits !fir.heap> + %15 = fircg.ext_embox %14(%c0) {allocator_idx = 2 : i32} : (!fir.heap>, index) -> !fir.box>> + fir.store %15 to %13 : !fir.ref>>> + %16 = fir.convert %6 : (!fir.ref>>>) -> !fir.ref> + %17 = fir.convert %c1 : (index) -> i64 + %18 = fir.convert %c16_i32 : (i32) -> i64 + %19 = fir.call @_FortranAAllocatableSetBounds(%16, %c0_i32, %17, %18) fastmath : (!fir.ref>, i32, i64, i64) -> none + %20 = fir.call @_FortranAAllocatableSetBounds(%16, %c1_i32, %17, %18) fastmath : (!fir.ref>, i32, i64, i64) -> none + %21 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref> + %c31_i32 = arith.constant 31 : i32 + %false = arith.constant false + %22 = fir.absent !fir.box + %c-1_i64 = arith.constant -1 : i64 + %23 = fir.convert %6 : (!fir.ref>>>) -> !fir.ref> + %24 = fir.convert %21 : (!fir.ref>) -> !fir.ref + %25 = fir.call @_FortranACUFAllocatableAllocate(%23, %c-1_i64, %false, %22, %24, %c31_i32) : (!fir.ref>, i64, i1, !fir.box, !fir.ref, i32) -> i32 + %26 = fir.convert %13 : (!fir.ref>>>) -> !fir.ref> + %27 = fir.call @_FortranAAllocatableSetBounds(%26, %c0_i32, %17, %18) fastmath : (!fir.ref>, i32, i64, i64) -> none + %28 = fir.address_of(@_QQclX64756D6D792E6D6C697200) : !fir.ref> + %c34_i32 = arith.constant 34 : i32 + %false_0 = arith.constant false + %29 = fir.absent !fir.box + %c-1_i64_1 = arith.constant -1 : i64 + %30 = fir.convert %13 : (!fir.ref>>>) -> !fir.ref> + %31 = fir.convert %28 : (!fir.ref>) -> !fir.ref + %32 = fir.call @_FortranACUFAllocatableAllocate(%30, %c-1_i64_1, %false_0, %29, %31, %c34_i32) : (!fir.ref>, i64, i1, !fir.box, !fir.ref, i32) -> i32 + %33 = fir.load %6 : !fir.ref>>> + %34 = fircg.ext_rebox %33 : (!fir.box>>) -> !fir.box> + return + } + func.func private @_FortranAAllocatableSetBounds(!fir.ref>, i32, i64, i64) -> none attributes {fir.runtime} + fir.global linkonce @_QQclX64756D6D792E6D6C697200 constant : !fir.char<1,11> { + %0 = fir.string_lit "dummy.mlir\00"(11) : !fir.char<1,11> + fir.has_value %0 : !fir.char<1,11> + } + func.func private @_FortranACUFAllocDesciptor(i64, !fir.ref, i32) -> !fir.ref> attributes {fir.runtime} + func.func private @_FortranACUFAllocatableAllocate(!fir.ref>, i64, i1, !fir.box, !fir.ref, i32) -> i32 attributes {fir.runtime} +} + +// CHECK-LABEL: llvm.func @_QQmain() +// CHECK-COUNT-4: llvm.call @_FortranACUFAllocDesciptor From e650ac1654c011bd0bdabd72f2c7b8ceefa9f709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 20 Dec 2024 13:57:47 -0800 Subject: [PATCH 042/466] [flang][cuda][NFC] Fix typo in CUFAllocDescriptor (#120797) Missing `r` in the function name. --- flang/include/flang/Runtime/CUDA/descriptor.h | 2 +- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 12 ++++++------ .../lib/Optimizer/Transforms/CUFOpConversion.cpp | 2 +- flang/runtime/CUDA/descriptor.cpp | 2 +- flang/test/Fir/CUDA/cuda-allocate.fir | 2 +- flang/test/Fir/CUDA/cuda-code-gen.mlir | 16 ++++++++-------- flang/unittests/Runtime/CUDA/AllocatorCUF.cpp | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/flang/include/flang/Runtime/CUDA/descriptor.h b/flang/include/flang/Runtime/CUDA/descriptor.h index 4c6c2c4694fd4..415efc9ba2ff7 100644 --- a/flang/include/flang/Runtime/CUDA/descriptor.h +++ b/flang/include/flang/Runtime/CUDA/descriptor.h @@ -18,7 +18,7 @@ namespace Fortran::runtime::cuda { extern "C" { /// Allocate a descriptor in managed. -Descriptor *RTDECL(CUFAllocDesciptor)( +Descriptor *RTDECL(CUFAllocDescriptor)( std::size_t, const char *sourceFile = nullptr, int sourceLine = 0); /// Deallocate a descriptor allocated in managed or unified memory. diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index 9d911d6bfd406..1714b9e191db7 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -1210,12 +1210,12 @@ genCUFAllocDescriptor(mlir::Location loc, llvmPointerType, {llvmIntPtrType, llvmPointerType, llvmInt32Type}); auto llvmFunc = mod.lookupSymbol( - RTNAME_STRING(CUFAllocDesciptor)); + RTNAME_STRING(CUFAllocDescriptor)); auto funcFunc = - mod.lookupSymbol(RTNAME_STRING(CUFAllocDesciptor)); + mod.lookupSymbol(RTNAME_STRING(CUFAllocDescriptor)); if (!llvmFunc && !funcFunc) mlir::OpBuilder::atBlockEnd(mod.getBody()) - .create(loc, RTNAME_STRING(CUFAllocDesciptor), + .create(loc, RTNAME_STRING(CUFAllocDescriptor), fctTy); mlir::Type structTy = typeConverter.convertBoxTypeAsStruct(boxTy); @@ -1224,7 +1224,7 @@ genCUFAllocDescriptor(mlir::Location loc, genConstantIndex(loc, llvmIntPtrType, rewriter, boxSize); llvm::SmallVector args = {sizeInBytes, sourceFile, sourceLine}; return rewriter - .create(loc, fctTy, RTNAME_STRING(CUFAllocDesciptor), + .create(loc, fctTy, RTNAME_STRING(CUFAllocDescriptor), args) .getResult(); } @@ -1735,7 +1735,7 @@ static bool isDeviceAllocation(mlir::Value val) { (callOp.getCallee().value().getRootReference().getValue().starts_with( RTNAME_STRING(CUFMemAlloc)) || callOp.getCallee().value().getRootReference().getValue().starts_with( - RTNAME_STRING(CUFAllocDesciptor)))) + RTNAME_STRING(CUFAllocDescriptor)))) return true; return false; } @@ -3127,7 +3127,7 @@ struct LoadOpConversion : public fir::FIROpConversion { inputBoxStorage.getDefiningOp())) { if (callOp.getCallee() && (*callOp.getCallee()) - .starts_with(RTNAME_STRING(CUFAllocDesciptor))) { + .starts_with(RTNAME_STRING(CUFAllocDescriptor))) { // CUDA Fortran local descriptor are allocated in managed memory. So // new storage must be allocated the same way. auto mod = load->getParentOfType(); diff --git a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp index 1df82e6accfed..de1634f1cd228 100644 --- a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp @@ -342,7 +342,7 @@ struct CUFAllocOpConversion : public mlir::OpRewritePattern { // Convert descriptor allocations to function call. auto boxTy = mlir::dyn_cast_or_null(op.getInType()); mlir::func::FuncOp func = - fir::runtime::getRuntimeFunc(loc, builder); + fir::runtime::getRuntimeFunc(loc, builder); auto fTy = func.getFunctionType(); mlir::Value sourceLine = fir::factory::locationToLineNo(builder, loc, fTy.getInput(2)); diff --git a/flang/runtime/CUDA/descriptor.cpp b/flang/runtime/CUDA/descriptor.cpp index 58bc0dbed6bab..ae01c11fdc015 100644 --- a/flang/runtime/CUDA/descriptor.cpp +++ b/flang/runtime/CUDA/descriptor.cpp @@ -18,7 +18,7 @@ namespace Fortran::runtime::cuda { extern "C" { RT_EXT_API_GROUP_BEGIN -Descriptor *RTDEF(CUFAllocDesciptor)( +Descriptor *RTDEF(CUFAllocDescriptor)( std::size_t sizeInBytes, const char *sourceFile, int sourceLine) { return reinterpret_cast(CUFAllocManaged(sizeInBytes)); } diff --git a/flang/test/Fir/CUDA/cuda-allocate.fir b/flang/test/Fir/CUDA/cuda-allocate.fir index 9b87c7546d1e9..8f2b1d278870a 100644 --- a/flang/test/Fir/CUDA/cuda-allocate.fir +++ b/flang/test/Fir/CUDA/cuda-allocate.fir @@ -15,7 +15,7 @@ func.func @_QPsub1() { } // CHECK-LABEL: func.func @_QPsub1() -// CHECK: %[[DESC_RT_CALL:.*]] = fir.call @_FortranACUFAllocDesciptor(%{{.*}}, %{{.*}}, %{{.*}}) : (i64, !fir.ref, i32) -> !fir.ref> +// CHECK: %[[DESC_RT_CALL:.*]] = fir.call @_FortranACUFAllocDescriptor(%{{.*}}, %{{.*}}, %{{.*}}) : (i64, !fir.ref, i32) -> !fir.ref> // CHECK: %[[DESC:.*]] = fir.convert %[[DESC_RT_CALL]] : (!fir.ref>) -> !fir.ref>>> // CHECK: %[[DECL_DESC:.*]]:2 = hlfir.declare %[[DESC]] {data_attr = #cuf.cuda, fortran_attrs = #fir.var_attrs, uniq_name = "_QFsub1Ea"} : (!fir.ref>>>) -> (!fir.ref>>>, !fir.ref>>>) // CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref>>>) -> !fir.ref> diff --git a/flang/test/Fir/CUDA/cuda-code-gen.mlir b/flang/test/Fir/CUDA/cuda-code-gen.mlir index 47c5667a14c95..5367314415dc2 100644 --- a/flang/test/Fir/CUDA/cuda-code-gen.mlir +++ b/flang/test/Fir/CUDA/cuda-code-gen.mlir @@ -8,7 +8,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry : %c48 = arith.constant 48 : index %1 = fir.convert %c48 : (index) -> i64 %2 = fir.convert %0 : (!fir.ref>) -> !fir.ref - %3 = fir.call @_FortranACUFAllocDesciptor(%1, %2, %c4_i32) : (i64, !fir.ref, i32) -> !fir.ref> + %3 = fir.call @_FortranACUFAllocDescriptor(%1, %2, %c4_i32) : (i64, !fir.ref, i32) -> !fir.ref> %4 = fir.convert %3 : (!fir.ref>) -> !fir.ref>>> %5 = fir.zero_bits !fir.heap> %6 = fircg.ext_embox %5(%c0) {allocator_idx = 2 : i32} : (!fir.heap>, index) -> !fir.box>> @@ -18,13 +18,13 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry : } // CHECK-LABEL: llvm.func @_QQmain() - // CHECK-COUNT-2: llvm.call @_FortranACUFAllocDesciptor + // CHECK-COUNT-2: llvm.call @_FortranACUFAllocDescriptor fir.global linkonce @_QQclX3C737464696E3E00 constant : !fir.char<1,8> { %0 = fir.string_lit "\00"(8) : !fir.char<1,8> fir.has_value %0 : !fir.char<1,8> } - func.func private @_FortranACUFAllocDesciptor(i64, !fir.ref, i32) -> !fir.ref> attributes {fir.runtime} + func.func private @_FortranACUFAllocDescriptor(i64, !fir.ref, i32) -> !fir.ref> attributes {fir.runtime} } // ----- @@ -55,7 +55,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64> // CHECK-LABEL: llvm.func @_QQmain() // CHECK: llvm.call @_FortranACUFMemAlloc -// CHECK: llvm.call @_FortranACUFAllocDesciptor +// CHECK: llvm.call @_FortranACUFAllocDescriptor // ----- @@ -73,7 +73,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64> %c72 = arith.constant 72 : index %3 = fir.convert %c72 : (index) -> i64 %4 = fir.convert %2 : (!fir.ref>) -> !fir.ref - %5 = fir.call @_FortranACUFAllocDesciptor(%3, %4, %c14_i32) : (i64, !fir.ref, i32) -> !fir.ref> + %5 = fir.call @_FortranACUFAllocDescriptor(%3, %4, %c14_i32) : (i64, !fir.ref, i32) -> !fir.ref> %6 = fir.convert %5 : (!fir.ref>) -> !fir.ref>>> %7 = fir.zero_bits !fir.heap> %8 = fircg.ext_embox %7(%c0, %c0) {allocator_idx = 2 : i32} : (!fir.heap>, index, index) -> !fir.box>> @@ -83,7 +83,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64> %c48 = arith.constant 48 : index %10 = fir.convert %c48 : (index) -> i64 %11 = fir.convert %9 : (!fir.ref>) -> !fir.ref - %12 = fir.call @_FortranACUFAllocDesciptor(%10, %11, %c20_i32) : (i64, !fir.ref, i32) -> !fir.ref> + %12 = fir.call @_FortranACUFAllocDescriptor(%10, %11, %c20_i32) : (i64, !fir.ref, i32) -> !fir.ref> %13 = fir.convert %12 : (!fir.ref>) -> !fir.ref>>> %14 = fir.zero_bits !fir.heap> %15 = fircg.ext_embox %14(%c0) {allocator_idx = 2 : i32} : (!fir.heap>, index) -> !fir.box>> @@ -120,9 +120,9 @@ module attributes {dlti.dl_spec = #dlti.dl_spec : vector<2xi64> %0 = fir.string_lit "dummy.mlir\00"(11) : !fir.char<1,11> fir.has_value %0 : !fir.char<1,11> } - func.func private @_FortranACUFAllocDesciptor(i64, !fir.ref, i32) -> !fir.ref> attributes {fir.runtime} + func.func private @_FortranACUFAllocDescriptor(i64, !fir.ref, i32) -> !fir.ref> attributes {fir.runtime} func.func private @_FortranACUFAllocatableAllocate(!fir.ref>, i64, i1, !fir.box, !fir.ref, i32) -> i32 attributes {fir.runtime} } // CHECK-LABEL: llvm.func @_QQmain() -// CHECK-COUNT-4: llvm.call @_FortranACUFAllocDesciptor +// CHECK-COUNT-4: llvm.call @_FortranACUFAllocDescriptor diff --git a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp index b51ff0ac006cc..cad73799ac7c4 100644 --- a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp +++ b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp @@ -66,7 +66,7 @@ TEST(AllocatableCUFTest, DescriptorAllocationTest) { // REAL(4), DEVICE, ALLOCATABLE :: a(:) auto a{createAllocatable(TypeCategory::Real, 4)}; Descriptor *desc = nullptr; - desc = RTNAME(CUFAllocDesciptor)(a->SizeInBytes()); + desc = RTNAME(CUFAllocDescriptor)(a->SizeInBytes()); EXPECT_TRUE(desc != nullptr); RTNAME(CUFFreeDesciptor)(desc); } From 994457f81ffd95531eff07e08a0fea42397b80d2 Mon Sep 17 00:00:00 2001 From: Chris White Date: Fri, 20 Dec 2024 22:12:25 +0000 Subject: [PATCH 043/466] [Clang-CL][DXC] Expose -fdiagnostic-color= to clang-cl and clang-dxc (#120644) Exposing `-fdiagnostic-color=` to clang-cl and clang-dxc. `-fcolor-diagnostics` and `-fno-color-diagnostics` are already allowed in both of these and `-fdiagnostics-color=` allows one additional value, `auto`. I've added the tests for clang-cl to `cl-options.c` as per the comments in the issue linked below. I couldn't finding a suitable existing file to add the clang-dxc tests to so I've created a new one. Resolves #119184 --- clang/docs/ReleaseNotes.rst | 3 +++ clang/include/clang/Driver/Options.td | 2 +- clang/test/Driver/cl-options.c | 1 + clang/test/Driver/dxc_options.hlsl | 8 ++++++++ clang/test/Driver/unknown-arg-drivermodes.test | 4 ---- 5 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 clang/test/Driver/dxc_options.hlsl diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d9d016b30f93d..3560efaebd2a0 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -445,6 +445,9 @@ New Compiler Flags - The ``-Warray-compare-cxx26`` warning has been added to warn about array comparison starting from C++26, this warning is enabled as an error by default. +- clang-cl and clang-dxc now support ``-fdiagnostics-color=[auto|never|always]`` + in addition to ``-f[no-]color-diagnostics``. + Deprecated Compiler Flags ------------------------- diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 9edf308cc685e..9e81c39f6869b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1990,7 +1990,7 @@ def : Flag<["-"], "fno-diagnostics-color">, Group, Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Alias; def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group, - Visibility<[ClangOption, FlangOption]>, + Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, Values<"auto,always,never">, HelpText<"When to use colors in diagnostics">; def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group, diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 477e8489e7428..c975727839c0b 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -680,6 +680,7 @@ // RUN: -fcoverage-mapping \ // RUN: -fno-coverage-mapping \ // RUN: -fdiagnostics-color \ +// RUN: -fdiagnostics-color=auto \ // RUN: -fno-diagnostics-color \ // RUN: -fdebug-compilation-dir . \ // RUN: -fdebug-compilation-dir=. \ diff --git a/clang/test/Driver/dxc_options.hlsl b/clang/test/Driver/dxc_options.hlsl new file mode 100644 index 0000000000000..09fdba1c3dd5f --- /dev/null +++ b/clang/test/Driver/dxc_options.hlsl @@ -0,0 +1,8 @@ +// RUN: %clang_dxc \ +// RUN: -fcolor-diagnostics \ +// RUN: -fno-color-diagnostics \ +// RUN: -fdiagnostics-color \ +// RUN: -fno-diagnostics-color \ +// RUN: -fdiagnostics-color=auto \ +// RUN: -Tlib_6_7 -Vd -fdriver-only -- %s 2>&1 |count 0 + diff --git a/clang/test/Driver/unknown-arg-drivermodes.test b/clang/test/Driver/unknown-arg-drivermodes.test index a7ea73af345e0..0125d79b47afa 100644 --- a/clang/test/Driver/unknown-arg-drivermodes.test +++ b/clang/test/Driver/unknown-arg-drivermodes.test @@ -1,6 +1,5 @@ // RUN: %clang_cl \ // RUN: --config \ -// RUN: -fdiagnostics-color=auto \ // RUN: -fno-record-command-line \ // RUN: -frecord-command-line \ // RUN: -nodefaultlibs \ @@ -15,7 +14,6 @@ // RUN: not %clang_dxc \ // RUN: --config \ -// RUN: -fdiagnostics-color=auto \ // RUN: -fno-record-command-line \ // RUN: -frecord-command-line \ // RUN: -nodefaultlibs \ @@ -30,7 +28,6 @@ // RUN: | FileCheck %s --check-prefix=DXC --implicit-check-not="error:" // CL: warning: unknown argument ignored in clang-cl: '--config' -// CL: warning: unknown argument ignored in clang-cl: '-fdiagnostics-color=auto' // CL: warning: unknown argument ignored in clang-cl: '-fno-record-command-line' // CL: warning: unknown argument ignored in clang-cl: '-frecord-command-line' // CL: warning: unknown argument ignored in clang-cl: '-nodefaultlibs' @@ -42,7 +39,6 @@ // CL: warning: unknown argument ignored in clang-cl: '-Xoffload-linker' // DXC: error: unknown argument: '--config' -// DXC: error: unknown argument: '-fdiagnostics-color=auto' // DXC: error: unknown argument: '-fno-record-command-line' // DXC: error: unknown argument: '-frecord-command-line' // DXC: error: unknown argument: '-nodefaultlibs' From 78ab77199118414aad8632d990bf73aca3d16ff8 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 20 Dec 2024 14:00:54 -0800 Subject: [PATCH 044/466] [RISCV][NFC]Add more test for shuffles with exact vlen, NFC --- .../rvv/fixed-vectors-shuffle-exact-vlen.ll | 156 ++++++++++++++++-- 1 file changed, 146 insertions(+), 10 deletions(-) diff --git a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-exact-vlen.ll b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-exact-vlen.ll index cadee8acf27d6..f0ee780137300 100644 --- a/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-exact-vlen.ll +++ b/llvm/test/CodeGen/RISCV/rvv/fixed-vectors-shuffle-exact-vlen.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s -; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32 +; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64 define <4 x i64> @m2_splat_0(<4 x i64> %v1) vscale_range(2,2) { ; CHECK-LABEL: m2_splat_0: @@ -69,16 +69,18 @@ define <4 x i64> @m2_pair_swap_vl4(<4 x i64> %v1) vscale_range(2,2) { define <8 x i32> @m2_pair_swap_vl8(<8 x i32> %v1) vscale_range(2,2) { ; RV32-LABEL: m2_pair_swap_vl8: ; RV32: # %bb.0: +; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma +; RV32-NEXT: vmv.v.i v10, 0 ; RV32-NEXT: li a0, 32 -; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma +; RV32-NEXT: li a1, 63 +; RV32-NEXT: vwsubu.vx v12, v10, a0 +; RV32-NEXT: vsetvli zero, zero, e64, m2, ta, ma ; RV32-NEXT: vmv.v.x v10, a0 -; RV32-NEXT: li a0, 63 -; RV32-NEXT: vand.vx v12, v10, a0 -; RV32-NEXT: vsll.vv v12, v8, v12 -; RV32-NEXT: vrsub.vi v10, v10, 0 -; RV32-NEXT: vand.vx v10, v10, a0 -; RV32-NEXT: vsrl.vv v8, v8, v10 -; RV32-NEXT: vor.vv v8, v12, v8 +; RV32-NEXT: vand.vx v12, v12, a1 +; RV32-NEXT: vand.vx v10, v10, a1 +; RV32-NEXT: vsrl.vv v12, v8, v12 +; RV32-NEXT: vsll.vv v8, v8, v10 +; RV32-NEXT: vor.vv v8, v8, v12 ; RV32-NEXT: ret ; ; RV64-LABEL: m2_pair_swap_vl8: @@ -176,3 +178,137 @@ define <4 x i64> @m2_splat_into_slide_two_source(<4 x i64> %v1, <4 x i64> %v2) v %res = shufflevector <4 x i64> %v1, <4 x i64> %v2, <4 x i32> ret <4 x i64> %res } + +define void @shuffle1(ptr %explicit_0, ptr %explicit_1) vscale_range(2,2) { +; CHECK-LABEL: shuffle1: +; CHECK: # %bb.0: +; CHECK-NEXT: addi a0, a0, 252 +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma +; CHECK-NEXT: vid.v v8 +; CHECK-NEXT: vsetivli zero, 3, e32, m1, ta, ma +; CHECK-NEXT: vle32.v v9, (a0) +; CHECK-NEXT: li a0, 175 +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma +; CHECK-NEXT: vsrl.vi v8, v8, 1 +; CHECK-NEXT: vmv.s.x v0, a0 +; CHECK-NEXT: vadd.vi v8, v8, 1 +; CHECK-NEXT: vrgather.vv v11, v9, v8 +; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma +; CHECK-NEXT: vmerge.vim v8, v10, 0, v0 +; CHECK-NEXT: addi a0, a1, 672 +; CHECK-NEXT: vs2r.v v8, (a0) +; CHECK-NEXT: ret + %1 = getelementptr i32, ptr %explicit_0, i64 63 + %2 = load <3 x i32>, ptr %1, align 1 + %3 = shufflevector <3 x i32> %2, <3 x i32> undef, <2 x i32> + %4 = shufflevector <2 x i32> %3, <2 x i32> undef, <8 x i32> + %5 = shufflevector <8 x i32> , <8 x i32> %4, <8 x i32> + %6 = getelementptr inbounds <8 x i32>, ptr %explicit_1, i64 21 + store <8 x i32> %5, ptr %6, align 32 + ret void +} + +define <16 x float> @shuffle2(<4 x float> %a) vscale_range(2,2) { +; CHECK-LABEL: shuffle2: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma +; CHECK-NEXT: vid.v v9 +; CHECK-NEXT: li a0, -97 +; CHECK-NEXT: vadd.vv v9, v9, v9 +; CHECK-NEXT: vrsub.vi v9, v9, 4 +; CHECK-NEXT: vmv.s.x v0, a0 +; CHECK-NEXT: vrgather.vv v13, v8, v9 +; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma +; CHECK-NEXT: vmerge.vim v8, v12, 0, v0 +; CHECK-NEXT: ret + %b = extractelement <4 x float> %a, i32 2 + %c = insertelement <16 x float> , float %b, i32 5 + %b1 = extractelement <4 x float> %a, i32 0 + %c1 = insertelement <16 x float> %c, float %b1, i32 6 + ret <16 x float>%c1 +} + +define i64 @extract_any_extend_vector_inreg_v16i64(<16 x i64> %a0, i32 %a1) vscale_range(2,2) { +; RV32-LABEL: extract_any_extend_vector_inreg_v16i64: +; RV32: # %bb.0: +; RV32-NEXT: li a1, 16 +; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, mu +; RV32-NEXT: vmv.v.i v16, 0 +; RV32-NEXT: vmv.s.x v0, a1 +; RV32-NEXT: li a1, 32 +; RV32-NEXT: vrgather.vi v16, v8, 15, v0.t +; RV32-NEXT: vsetvli zero, zero, e64, m8, ta, ma +; RV32-NEXT: vslidedown.vx v8, v16, a0 +; RV32-NEXT: vmv.x.s a0, v8 +; RV32-NEXT: vsetivli zero, 1, e64, m8, ta, ma +; RV32-NEXT: vsrl.vx v8, v8, a1 +; RV32-NEXT: vmv.x.s a1, v8 +; RV32-NEXT: ret +; +; RV64-LABEL: extract_any_extend_vector_inreg_v16i64: +; RV64: # %bb.0: +; RV64-NEXT: addi sp, sp, -256 +; RV64-NEXT: .cfi_def_cfa_offset 256 +; RV64-NEXT: sd ra, 248(sp) # 8-byte Folded Spill +; RV64-NEXT: sd s0, 240(sp) # 8-byte Folded Spill +; RV64-NEXT: sd s2, 232(sp) # 8-byte Folded Spill +; RV64-NEXT: .cfi_offset ra, -8 +; RV64-NEXT: .cfi_offset s0, -16 +; RV64-NEXT: .cfi_offset s2, -24 +; RV64-NEXT: addi s0, sp, 256 +; RV64-NEXT: .cfi_def_cfa s0, 0 +; RV64-NEXT: andi sp, sp, -128 +; RV64-NEXT: li a1, -17 +; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma +; RV64-NEXT: vmv.s.x v0, a1 +; RV64-NEXT: vrgather.vi v16, v8, 15 +; RV64-NEXT: vmerge.vim v8, v16, 0, v0 +; RV64-NEXT: mv s2, sp +; RV64-NEXT: vs8r.v v8, (s2) +; RV64-NEXT: andi a0, a0, 15 +; RV64-NEXT: li a1, 8 +; RV64-NEXT: call __muldi3 +; RV64-NEXT: add a0, s2, a0 +; RV64-NEXT: ld a0, 0(a0) +; RV64-NEXT: addi sp, s0, -256 +; RV64-NEXT: .cfi_def_cfa sp, 256 +; RV64-NEXT: ld ra, 248(sp) # 8-byte Folded Reload +; RV64-NEXT: ld s0, 240(sp) # 8-byte Folded Reload +; RV64-NEXT: ld s2, 232(sp) # 8-byte Folded Reload +; RV64-NEXT: .cfi_restore ra +; RV64-NEXT: .cfi_restore s0 +; RV64-NEXT: .cfi_restore s2 +; RV64-NEXT: addi sp, sp, 256 +; RV64-NEXT: .cfi_def_cfa_offset 0 +; RV64-NEXT: ret + %1 = extractelement <16 x i64> %a0, i32 15 + %2 = insertelement <16 x i64> zeroinitializer, i64 %1, i32 4 + %3 = extractelement <16 x i64> %2, i32 %a1 + ret i64 %3 +} + +define <4 x double> @shuffles_add(<4 x double> %0, <4 x double> %1) vscale_range(2,2) { +; CHECK-LABEL: shuffles_add: +; CHECK: # %bb.0: +; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma +; CHECK-NEXT: vrgather.vi v12, v8, 2 +; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma +; CHECK-NEXT: vid.v v14 +; CHECK-NEXT: vmv.v.i v0, 12 +; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma +; CHECK-NEXT: vrgather.vi v16, v8, 3 +; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma +; CHECK-NEXT: vadd.vv v8, v14, v14 +; CHECK-NEXT: vadd.vi v9, v8, -4 +; CHECK-NEXT: vadd.vi v8, v8, -3 +; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu +; CHECK-NEXT: vrgatherei16.vv v12, v10, v9, v0.t +; CHECK-NEXT: vrgatherei16.vv v16, v10, v8, v0.t +; CHECK-NEXT: vfadd.vv v8, v12, v16 +; CHECK-NEXT: ret + %3 = shufflevector <4 x double> %0, <4 x double> %1, <4 x i32> + %4 = shufflevector <4 x double> %0, <4 x double> %1, <4 x i32> + %5 = fadd <4 x double> %3, %4 + ret <4 x double> %5 +} + From 415cfaf339dc4383acd44248584bcc6376213c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Valentin=20Clement=20=28=E3=83=90=E3=83=AC=E3=83=B3?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=B3=20=E3=82=AF=E3=83=AC=E3=83=A1?= =?UTF-8?q?=E3=83=B3=29?= Date: Fri, 20 Dec 2024 14:43:12 -0800 Subject: [PATCH 045/466] [flang][cuda][NFC] Fix type in CUFFreeDescriptor (#120799) --- flang/include/flang/Runtime/CUDA/descriptor.h | 2 +- flang/lib/Optimizer/Transforms/CUFOpConversion.cpp | 2 +- flang/runtime/CUDA/descriptor.cpp | 2 +- flang/test/Fir/CUDA/cuda-allocate.fir | 2 +- flang/unittests/Runtime/CUDA/AllocatorCUF.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flang/include/flang/Runtime/CUDA/descriptor.h b/flang/include/flang/Runtime/CUDA/descriptor.h index 415efc9ba2ff7..55878aaac57fb 100644 --- a/flang/include/flang/Runtime/CUDA/descriptor.h +++ b/flang/include/flang/Runtime/CUDA/descriptor.h @@ -22,7 +22,7 @@ Descriptor *RTDECL(CUFAllocDescriptor)( std::size_t, const char *sourceFile = nullptr, int sourceLine = 0); /// Deallocate a descriptor allocated in managed or unified memory. -void RTDECL(CUFFreeDesciptor)( +void RTDECL(CUFFreeDescriptor)( Descriptor *, const char *sourceFile = nullptr, int sourceLine = 0); /// Retrieve the device pointer from the host one. diff --git a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp index de1634f1cd228..de5c51556eecf 100644 --- a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp @@ -451,7 +451,7 @@ struct CUFFreeOpConversion : public mlir::OpRewritePattern { // Convert cuf.free on descriptors. mlir::func::FuncOp func = - fir::runtime::getRuntimeFunc(loc, builder); + fir::runtime::getRuntimeFunc(loc, builder); auto fTy = func.getFunctionType(); mlir::Value sourceLine = fir::factory::locationToLineNo(builder, loc, fTy.getInput(2)); diff --git a/flang/runtime/CUDA/descriptor.cpp b/flang/runtime/CUDA/descriptor.cpp index ae01c11fdc015..391c47e84241d 100644 --- a/flang/runtime/CUDA/descriptor.cpp +++ b/flang/runtime/CUDA/descriptor.cpp @@ -23,7 +23,7 @@ Descriptor *RTDEF(CUFAllocDescriptor)( return reinterpret_cast(CUFAllocManaged(sizeInBytes)); } -void RTDEF(CUFFreeDesciptor)( +void RTDEF(CUFFreeDescriptor)( Descriptor *desc, const char *sourceFile, int sourceLine) { CUFFreeManaged(reinterpret_cast(desc)); } diff --git a/flang/test/Fir/CUDA/cuda-allocate.fir b/flang/test/Fir/CUDA/cuda-allocate.fir index 8f2b1d278870a..2f805d4a2b6bb 100644 --- a/flang/test/Fir/CUDA/cuda-allocate.fir +++ b/flang/test/Fir/CUDA/cuda-allocate.fir @@ -24,7 +24,7 @@ func.func @_QPsub1() { // CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref>>>) -> !fir.ref> // CHECK: %{{.*}} = fir.call @_FortranAAllocatableDeallocate(%[[BOX_NONE]], %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}) : (!fir.ref>, i1, !fir.box, !fir.ref, i32) -> i32 // CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref>>>) -> !fir.ref> -// CHECK: fir.call @_FortranACUFFreeDesciptor(%[[BOX_NONE]], %{{.*}}, %{{.*}}) : (!fir.ref>, !fir.ref, i32) -> none +// CHECK: fir.call @_FortranACUFFreeDescriptor(%[[BOX_NONE]], %{{.*}}, %{{.*}}) : (!fir.ref>, !fir.ref, i32) -> none fir.global @_QMmod1Ea {data_attr = #cuf.cuda} : !fir.box>> { %0 = fir.zero_bits !fir.heap> diff --git a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp index cad73799ac7c4..7cb25787e7797 100644 --- a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp +++ b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp @@ -68,5 +68,5 @@ TEST(AllocatableCUFTest, DescriptorAllocationTest) { Descriptor *desc = nullptr; desc = RTNAME(CUFAllocDescriptor)(a->SizeInBytes()); EXPECT_TRUE(desc != nullptr); - RTNAME(CUFFreeDesciptor)(desc); + RTNAME(CUFFreeDescriptor)(desc); } From c1e7e4500c6e3b921f5e0cda8ba8d8d66e086db6 Mon Sep 17 00:00:00 2001 From: Malek Ben Slimane Date: Wed, 11 Sep 2024 22:07:45 +0200 Subject: [PATCH 046/466] Thread Safety Analysis: Support passing scoped locks between functions with appropriate annotations (#110523) This is helpful when multiple functions operate on the same capabilities, but we still want to use scoped lockable types for readability and exception safety. - Introduce support for thread safety annotations on function parameters marked with the 'scoped_lockable' attribute. - Add semantic checks for annotated function parameters, ensuring correct usage. - Enhance the analysis to recognize and handle parameters annotated for thread safety, extending the scope of analysis to track these across function boundries. - Verify that the underlying mutexes of function arguments match the expectations set by the annotations. Limitation: This does not work when the attribute arguments are class members, because attributes on function parameters are parsed differently from attributes on functions. --- clang/docs/ReleaseNotes.rst | 25 ++ clang/docs/ThreadSafetyAnalysis.rst | 50 ++- .../clang/Analysis/Analyses/ThreadSafety.h | 36 ++ clang/include/clang/Basic/Attr.td | 8 +- .../clang/Basic/DiagnosticSemaKinds.td | 15 + clang/lib/Analysis/ThreadSafety.cpp | 175 +++++++- clang/lib/Sema/AnalysisBasedWarnings.cpp | 40 ++ clang/lib/Sema/SemaDeclAttr.cpp | 41 ++ .../SemaCXX/warn-thread-safety-analysis.cpp | 372 ++++++++++++++++++ .../SemaCXX/warn-thread-safety-parsing.cpp | 42 +- 10 files changed, 774 insertions(+), 30 deletions(-) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 3560efaebd2a0..6b9e1109f3906 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -708,6 +708,31 @@ Improvements to Clang's diagnostics - Fixed a bug where Clang hung on an unsupported optional scope specifier ``::`` when parsing Objective-C. Clang now emits a diagnostic message instead of hanging. +- The :doc:`ThreadSafetyAnalysis` now supports passing scoped capabilities into functions: + an attribute on the scoped capability parameter indicates both the expected associated capabilities and, + like in the case of attributes on the function declaration itself, their state before and after the call. + + .. code-block:: c++ + + #include "mutex.h" + + Mutex mu1, mu2; + int a GUARDED_BY(mu1); + + void require(MutexLocker& scope REQUIRES(mu1)) { + scope.Unlock(); + a = 0; // Warning! Requires mu1. + scope.Lock(); + } + + void testParameter() { + MutexLocker scope(&mu1), scope2(&mu2); + require(scope2); // Warning! Mutex managed by 'scope2' is 'mu2' instead of 'mu1' + require(scope); // OK. + scope.Unlock(); + require(scope); // Warning! Requires mu1. + } + Improvements to Clang's time-trace ---------------------------------- diff --git a/clang/docs/ThreadSafetyAnalysis.rst b/clang/docs/ThreadSafetyAnalysis.rst index f6517afc3bfc2..9c1c32e46989b 100644 --- a/clang/docs/ThreadSafetyAnalysis.rst +++ b/clang/docs/ThreadSafetyAnalysis.rst @@ -187,10 +187,13 @@ REQUIRES(...), REQUIRES_SHARED(...) *Previously*: ``EXCLUSIVE_LOCKS_REQUIRED``, ``SHARED_LOCKS_REQUIRED`` -``REQUIRES`` is an attribute on functions or methods, which +``REQUIRES`` is an attribute on functions, methods or function parameters of +reference to :ref:`scoped_capability`-annotated type, which declares that the calling thread must have exclusive access to the given capabilities. More than one capability may be specified. The capabilities must be held on entry to the function, *and must still be held on exit*. +Additionally, if the attribute is on a function parameter, it declares that +the scoped capability manages the specified capabilities in the given order. ``REQUIRES_SHARED`` is similar, but requires only shared access. @@ -211,6 +214,20 @@ must be held on entry to the function, *and must still be held on exit*. mu1.Unlock(); } + void require(MutexLocker& scope REQUIRES(mu1)) { + scope.Unlock(); + a = 0; // Warning! Requires mu1. + scope.Lock(); + } + + void testParameter() { + MutexLocker scope(&mu1), scope2(&mu2); + require(scope2); // Warning! Mutex managed by 'scope2' is 'mu2' instead of 'mu1' + require(scope); // OK. + scope.Unlock(); + require(scope); // Warning! Requires mu1. + } + ACQUIRE(...), ACQUIRE_SHARED(...), RELEASE(...), RELEASE_SHARED(...), RELEASE_GENERIC(...) ------------------------------------------------------------------------------------------ @@ -218,10 +235,13 @@ ACQUIRE(...), ACQUIRE_SHARED(...), RELEASE(...), RELEASE_SHARED(...), RELEASE_GE *Previously*: ``EXCLUSIVE_LOCK_FUNCTION``, ``SHARED_LOCK_FUNCTION``, ``UNLOCK_FUNCTION`` -``ACQUIRE`` and ``ACQUIRE_SHARED`` are attributes on functions or methods -declaring that the function acquires a capability, but does not release it. +``ACQUIRE`` and ``ACQUIRE_SHARED`` are attributes on functions, methods +or function parameters of reference to :ref:`scoped_capability`-annotated type, +which declare that the function acquires a capability, but does not release it. The given capability must not be held on entry, and will be held on exit (exclusively for ``ACQUIRE``, shared for ``ACQUIRE_SHARED``). +Additionally, if the attribute is on a function parameter, it declares that +the scoped capability manages the specified capabilities in the given order. ``RELEASE``, ``RELEASE_SHARED``, and ``RELEASE_GENERIC`` declare that the function releases the given capability. The capability must be held on entry @@ -249,6 +269,14 @@ shared for ``RELEASE_GENERIC``), and will no longer be held on exit. myObject.doSomething(); // Warning, mu is not locked. } + void release(MutexLocker& scope RELEASE(mu)) { + } // Warning! Need to unlock mu. + + void testParameter() { + MutexLocker scope(&mu); + release(scope); + } + If no argument is passed to ``ACQUIRE`` or ``RELEASE``, then the argument is assumed to be ``this``, and the analysis will not check the body of the function. This pattern is intended for use by classes which hide locking @@ -283,10 +311,13 @@ EXCLUDES(...) *Previously*: ``LOCKS_EXCLUDED`` -``EXCLUDES`` is an attribute on functions or methods, which declares that +``EXCLUDES`` is an attribute on functions, methods or function parameters +of reference to :ref:`scoped_capability`-annotated type, which declares that the caller must *not* hold the given capabilities. This annotation is used to prevent deadlock. Many mutex implementations are not re-entrant, so deadlock can occur if the function acquires the mutex a second time. +Additionally, if the attribute is on a function parameter, it declares that +the scoped capability manages the specified capabilities in the given order. .. code-block:: c++ @@ -305,6 +336,16 @@ deadlock can occur if the function acquires the mutex a second time. mu.Unlock(); } + void exclude(MutexLocker& scope LOCKS_EXCLUDED(mu)) { + scope.Unlock(); // Warning! mu is not locked. + scope.Lock(); + } // Warning! mu still held at the end of function. + + void testParameter() { + MutexLocker scope(&mu); + exclude(scope); // Warning, mu is held. + } + Unlike ``REQUIRES``, ``EXCLUDES`` is optional. The analysis will not issue a warning if the attribute is missing, which can lead to false negatives in some cases. This issue is discussed further in :ref:`negative`. @@ -393,6 +434,7 @@ class can be used as a capability. The string argument specifies the kind of capability in error messages, e.g. ``"mutex"``. See the ``Container`` example given above, or the ``Mutex`` class in :ref:`mutexheader`. +.. _scoped_capability: SCOPED_CAPABILITY ----------------- diff --git a/clang/include/clang/Analysis/Analyses/ThreadSafety.h b/clang/include/clang/Analysis/Analyses/ThreadSafety.h index 0866b09bab299..0fcf5bed1285a 100644 --- a/clang/include/clang/Analysis/Analyses/ThreadSafety.h +++ b/clang/include/clang/Analysis/Analyses/ThreadSafety.h @@ -223,6 +223,42 @@ class ThreadSafetyHandler { virtual void handleFunExcludesLock(StringRef Kind, Name FunName, Name LockName, SourceLocation Loc) {} + /// Warn when an actual underlying mutex of a scoped lockable does not match + /// the expected. + /// \param Loc -- The location of the call expression. + /// \param DLoc -- The location of the function declaration. + /// \param ScopeName -- The name of the scope passed to the function. + /// \param Kind -- The kind of the expected mutex. + /// \param Expected -- The name of the expected mutex. + /// \param Actual -- The name of the actual mutex. + virtual void handleUnmatchedUnderlyingMutexes(SourceLocation Loc, + SourceLocation DLoc, + Name ScopeName, StringRef Kind, + Name Expected, Name Actual) {} + + /// Warn when we get fewer underlying mutexes than expected. + /// \param Loc -- The location of the call expression. + /// \param DLoc -- The location of the function declaration. + /// \param ScopeName -- The name of the scope passed to the function. + /// \param Kind -- The kind of the expected mutex. + /// \param Expected -- The name of the expected mutex. + virtual void handleExpectMoreUnderlyingMutexes(SourceLocation Loc, + SourceLocation DLoc, + Name ScopeName, StringRef Kind, + Name Expected) {} + + /// Warn when we get more underlying mutexes than expected. + /// \param Loc -- The location of the call expression. + /// \param DLoc -- The location of the function declaration. + /// \param ScopeName -- The name of the scope passed to the function. + /// \param Kind -- The kind of the actual mutex. + /// \param Actual -- The name of the actual mutex. + virtual void handleExpectFewerUnderlyingMutexes(SourceLocation Loc, + SourceLocation DLoc, + Name ScopeName, + StringRef Kind, Name Actual) { + } + /// Warn that L1 cannot be acquired before L2. virtual void handleLockAcquiredBefore(StringRef Kind, Name L1Name, Name L2Name, SourceLocation Loc) {} diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 90d2a2056fe1b..52ad72eb608c3 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -3763,7 +3763,7 @@ def AcquireCapability : InheritableAttr { Clang<"acquire_shared_capability", 0>, GNU<"exclusive_lock_function">, GNU<"shared_lock_function">]; - let Subjects = SubjectList<[Function]>; + let Subjects = SubjectList<[Function, ParmVar]>; let LateParsed = LateAttrParseStandard; let TemplateDependent = 1; let ParseArgumentsAsUnevaluated = 1; @@ -3795,7 +3795,7 @@ def ReleaseCapability : InheritableAttr { Clang<"release_shared_capability", 0>, Clang<"release_generic_capability", 0>, Clang<"unlock_function", 0>]; - let Subjects = SubjectList<[Function]>; + let Subjects = SubjectList<[Function, ParmVar]>; let LateParsed = LateAttrParseStandard; let TemplateDependent = 1; let ParseArgumentsAsUnevaluated = 1; @@ -3819,7 +3819,7 @@ def RequiresCapability : InheritableAttr { let TemplateDependent = 1; let ParseArgumentsAsUnevaluated = 1; let InheritEvenIfAlreadyPresent = 1; - let Subjects = SubjectList<[Function]>; + let Subjects = SubjectList<[Function, ParmVar]>; let Accessors = [Accessor<"isShared", [Clang<"requires_shared_capability", 0>, Clang<"shared_locks_required", 0>]>]; let Documentation = [Undocumented]; @@ -3941,7 +3941,7 @@ def LocksExcluded : InheritableAttr { let TemplateDependent = 1; let ParseArgumentsAsUnevaluated = 1; let InheritEvenIfAlreadyPresent = 1; - let Subjects = SubjectList<[Function]>; + let Subjects = SubjectList<[Function, ParmVar]>; let Documentation = [Undocumented]; } diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 491bc83c1e129..330ae045616ab 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3999,6 +3999,10 @@ def warn_thread_attribute_decl_not_lockable : Warning< def warn_thread_attribute_decl_not_pointer : Warning< "%0 only applies to pointer types; type here is %1">, InGroup, DefaultIgnore; +def warn_thread_attribute_not_on_scoped_lockable_param : Warning< + "%0 attribute applies to function parameters only if their type is a " + "reference to a 'scoped_lockable'-annotated type">, + InGroup, DefaultIgnore; def err_attribute_argument_out_of_bounds_extra_info : Error< "%0 attribute parameter %1 is out of bounds: " "%plural{0:no parameters to index into|" @@ -4054,6 +4058,17 @@ def warn_acquired_before : Warning< def warn_acquired_before_after_cycle : Warning< "cycle in acquired_before/after dependencies, starting with '%0'">, InGroup, DefaultIgnore; +def warn_unmatched_underlying_mutexes : Warning< + "%0 managed by '%1' is '%3' instead of '%2'">, + InGroup, DefaultIgnore; +def warn_expect_more_underlying_mutexes : Warning< + "%0 '%2' not managed by '%1'">, + InGroup, DefaultIgnore; +def warn_expect_fewer_underlying_mutexes : Warning< + "did not expect %0 '%2' to be managed by '%1'">, + InGroup, DefaultIgnore; +def note_managed_mismatch_here_for_param : Note< + "see attribute on parameter here">; // Thread safety warnings negative capabilities diff --git a/clang/lib/Analysis/ThreadSafety.cpp b/clang/lib/Analysis/ThreadSafety.cpp index 5577f45aa5217..bfaf1a0e7c7ff 100644 --- a/clang/lib/Analysis/ThreadSafety.cpp +++ b/clang/lib/Analysis/ThreadSafety.cpp @@ -103,6 +103,8 @@ class FactSet; /// FIXME: this analysis does not currently support re-entrant locking. class FactEntry : public CapabilityExpr { public: + enum FactEntryKind { Lockable, ScopedLockable }; + /// Where a fact comes from. enum SourceKind { Acquired, ///< The fact has been directly acquired. @@ -112,6 +114,8 @@ class FactEntry : public CapabilityExpr { }; private: + const FactEntryKind Kind : 8; + /// Exclusive or shared. LockKind LKind : 8; @@ -122,13 +126,14 @@ class FactEntry : public CapabilityExpr { SourceLocation AcquireLoc; public: - FactEntry(const CapabilityExpr &CE, LockKind LK, SourceLocation Loc, - SourceKind Src) - : CapabilityExpr(CE), LKind(LK), Source(Src), AcquireLoc(Loc) {} + FactEntry(FactEntryKind FK, const CapabilityExpr &CE, LockKind LK, + SourceLocation Loc, SourceKind Src) + : CapabilityExpr(CE), Kind(FK), LKind(LK), Source(Src), AcquireLoc(Loc) {} virtual ~FactEntry() = default; LockKind kind() const { return LKind; } SourceLocation loc() const { return AcquireLoc; } + FactEntryKind getFactEntryKind() const { return Kind; } bool asserted() const { return Source == Asserted; } bool declared() const { return Source == Declared; } @@ -857,7 +862,7 @@ class LockableFactEntry : public FactEntry { public: LockableFactEntry(const CapabilityExpr &CE, LockKind LK, SourceLocation Loc, SourceKind Src = Acquired) - : FactEntry(CE, LK, Loc, Src) {} + : FactEntry(Lockable, CE, LK, Loc, Src) {} void handleRemovalFromIntersection(const FactSet &FSet, FactManager &FactMan, @@ -885,6 +890,10 @@ class LockableFactEntry : public FactEntry { !Cp, LK_Exclusive, UnlockLoc)); } } + + static bool classof(const FactEntry *A) { + return A->getFactEntryKind() == Lockable; + } }; class ScopedLockableFactEntry : public FactEntry { @@ -903,8 +912,16 @@ class ScopedLockableFactEntry : public FactEntry { SmallVector UnderlyingMutexes; public: - ScopedLockableFactEntry(const CapabilityExpr &CE, SourceLocation Loc) - : FactEntry(CE, LK_Exclusive, Loc, Acquired) {} + ScopedLockableFactEntry(const CapabilityExpr &CE, SourceLocation Loc, + SourceKind Src) + : FactEntry(ScopedLockable, CE, LK_Exclusive, Loc, Src) {} + + CapExprSet getUnderlyingMutexes() const { + CapExprSet UnderlyingMutexesSet; + for (const UnderlyingCapability &UnderlyingMutex : UnderlyingMutexes) + UnderlyingMutexesSet.push_back(UnderlyingMutex.Cap); + return UnderlyingMutexesSet; + } void addLock(const CapabilityExpr &M) { UnderlyingMutexes.push_back(UnderlyingCapability{M, UCK_Acquired}); @@ -971,6 +988,10 @@ class ScopedLockableFactEntry : public FactEntry { FSet.removeLock(FactMan, Cp); } + static bool classof(const FactEntry *A) { + return A->getFactEntryKind() == ScopedLockable; + } + private: void lock(FactSet &FSet, FactManager &FactMan, const CapabilityExpr &Cp, LockKind kind, SourceLocation loc, @@ -1806,7 +1827,7 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D, if (Exp) { assert(!Self); const auto *TagT = Exp->getType()->getAs(); - if (TagT && Exp->isPRValue()) { + if (D->hasAttrs() && TagT && Exp->isPRValue()) { std::pair Placeholder = Analyzer->SxBuilder.createThisPlaceholder(Exp); [[maybe_unused]] auto inserted = @@ -1915,6 +1936,101 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D, } } + std::optional Args; + if (Exp) { + if (const auto *CE = dyn_cast(Exp)) + Args = CE->arguments(); + else if (const auto *CE = dyn_cast(Exp)) + Args = CE->arguments(); + else + llvm_unreachable("Unknown call kind"); + } + const auto *CalledFunction = dyn_cast(D); + if (CalledFunction && Args.has_value()) { + for (auto [Param, Arg] : zip(CalledFunction->parameters(), *Args)) { + CapExprSet DeclaredLocks; + for (const Attr *At : Param->attrs()) { + switch (At->getKind()) { + case attr::AcquireCapability: { + const auto *A = cast(At); + Analyzer->getMutexIDs(A->isShared() ? SharedLocksToAdd + : ExclusiveLocksToAdd, + A, Exp, D, Self); + Analyzer->getMutexIDs(DeclaredLocks, A, Exp, D, Self); + break; + } + + case attr::ReleaseCapability: { + const auto *A = cast(At); + if (A->isGeneric()) + Analyzer->getMutexIDs(GenericLocksToRemove, A, Exp, D, Self); + else if (A->isShared()) + Analyzer->getMutexIDs(SharedLocksToRemove, A, Exp, D, Self); + else + Analyzer->getMutexIDs(ExclusiveLocksToRemove, A, Exp, D, Self); + Analyzer->getMutexIDs(DeclaredLocks, A, Exp, D, Self); + break; + } + + case attr::RequiresCapability: { + const auto *A = cast(At); + for (auto *Arg : A->args()) + Analyzer->warnIfMutexNotHeld(FSet, D, Exp, + A->isShared() ? AK_Read : AK_Written, + Arg, POK_FunctionCall, Self, Loc); + Analyzer->getMutexIDs(DeclaredLocks, A, Exp, D, Self); + break; + } + + case attr::LocksExcluded: { + const auto *A = cast(At); + for (auto *Arg : A->args()) + Analyzer->warnIfMutexHeld(FSet, D, Exp, Arg, Self, Loc); + Analyzer->getMutexIDs(DeclaredLocks, A, Exp, D, Self); + break; + } + + default: + break; + } + } + if (DeclaredLocks.empty()) + continue; + CapabilityExpr Cp(Analyzer->SxBuilder.translate(Arg, nullptr), + StringRef("mutex"), false); + if (const auto *CBTE = dyn_cast(Arg->IgnoreCasts()); + Cp.isInvalid() && CBTE) { + if (auto Object = Analyzer->ConstructedObjects.find(CBTE->getSubExpr()); + Object != Analyzer->ConstructedObjects.end()) + Cp = CapabilityExpr(Object->second, StringRef("mutex"), false); + } + const FactEntry *Fact = FSet.findLock(Analyzer->FactMan, Cp); + if (!Fact) { + Analyzer->Handler.handleMutexNotHeld(Cp.getKind(), D, POK_FunctionCall, + Cp.toString(), LK_Exclusive, + Exp->getExprLoc()); + continue; + } + const auto *Scope = cast(Fact); + for (const auto &[a, b] : + zip_longest(DeclaredLocks, Scope->getUnderlyingMutexes())) { + if (!a.has_value()) { + Analyzer->Handler.handleExpectFewerUnderlyingMutexes( + Exp->getExprLoc(), D->getLocation(), Scope->toString(), + b.value().getKind(), b.value().toString()); + } else if (!b.has_value()) { + Analyzer->Handler.handleExpectMoreUnderlyingMutexes( + Exp->getExprLoc(), D->getLocation(), Scope->toString(), + a.value().getKind(), a.value().toString()); + } else if (!a.value().equals(b.value())) { + Analyzer->Handler.handleUnmatchedUnderlyingMutexes( + Exp->getExprLoc(), D->getLocation(), Scope->toString(), + a.value().getKind(), a.value().toString(), b.value().toString()); + break; + } + } + } + } // Remove locks first to allow lock upgrading/downgrading. // FIXME -- should only fully remove if the attribute refers to 'this'. bool Dtor = isa(D); @@ -1937,7 +2053,8 @@ void BuildLockset::handleCall(const Expr *Exp, const NamedDecl *D, if (!Scp.shouldIgnore()) { // Add the managing object as a dummy mutex, mapped to the underlying mutex. - auto ScopedEntry = std::make_unique(Scp, Loc); + auto ScopedEntry = std::make_unique( + Scp, Loc, FactEntry::Acquired); for (const auto &M : ExclusiveLocksToAdd) ScopedEntry->addLock(M); for (const auto &M : SharedLocksToAdd) @@ -2084,7 +2201,7 @@ void BuildLockset::VisitCallExpr(const CallExpr *Exp) { } auto *D = dyn_cast_or_null(Exp->getCalleeDecl()); - if(!D || !D->hasAttrs()) + if (!D) return; handleCall(Exp, D); } @@ -2324,7 +2441,7 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { // Add locks from exclusive_locks_required and shared_locks_required // to initial lockset. Also turn off checking for lock and unlock functions. // FIXME: is there a more intelligent way to check lock/unlock functions? - if (!SortedGraph->empty() && D->hasAttrs()) { + if (!SortedGraph->empty()) { assert(*SortedGraph->begin() == &CFGraph->getEntry()); FactSet &InitialLockset = Initial.EntrySet; @@ -2362,6 +2479,44 @@ void ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) { return; } } + ArrayRef Params; + if (CurrentFunction) + Params = CurrentFunction->getCanonicalDecl()->parameters(); + else if (auto CurrentMethod = dyn_cast(D)) + Params = CurrentMethod->getCanonicalDecl()->parameters(); + else + llvm_unreachable("Unknown function kind"); + for (const ParmVarDecl *Param : Params) { + CapExprSet UnderlyingLocks; + for (const auto *Attr : Param->attrs()) { + Loc = Attr->getLocation(); + if (const auto *A = dyn_cast(Attr)) { + getMutexIDs(A->isShared() ? SharedLocksToAdd : ExclusiveLocksToAdd, A, + nullptr, Param); + getMutexIDs(LocksReleased, A, nullptr, Param); + getMutexIDs(UnderlyingLocks, A, nullptr, Param); + } else if (const auto *A = dyn_cast(Attr)) { + getMutexIDs(A->isShared() ? SharedLocksToAdd : ExclusiveLocksToAdd, A, + nullptr, Param); + getMutexIDs(UnderlyingLocks, A, nullptr, Param); + } else if (const auto *A = dyn_cast(Attr)) { + getMutexIDs(A->isShared() ? SharedLocksAcquired + : ExclusiveLocksAcquired, + A, nullptr, Param); + getMutexIDs(UnderlyingLocks, A, nullptr, Param); + } else if (const auto *A = dyn_cast(Attr)) { + getMutexIDs(UnderlyingLocks, A, nullptr, Param); + } + } + if (UnderlyingLocks.empty()) + continue; + CapabilityExpr Cp(SxBuilder.createVariable(Param), StringRef(), false); + auto ScopedEntry = std::make_unique( + Cp, Param->getLocation(), FactEntry::Declared); + for (const CapabilityExpr &M : UnderlyingLocks) + ScopedEntry->addLock(M); + addLock(InitialLockset, std::move(ScopedEntry), true); + } // FIXME -- Loc can be wrong here. for (const auto &Mu : ExclusiveLocksToAdd) { diff --git a/clang/lib/Sema/AnalysisBasedWarnings.cpp b/clang/lib/Sema/AnalysisBasedWarnings.cpp index 37d966a5a0463..589869d018657 100644 --- a/clang/lib/Sema/AnalysisBasedWarnings.cpp +++ b/clang/lib/Sema/AnalysisBasedWarnings.cpp @@ -1843,6 +1843,14 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { : getNotes(); } + OptionalNotes makeManagedMismatchNoteForParam(SourceLocation DeclLoc) { + return DeclLoc.isValid() + ? getNotes(PartialDiagnosticAt( + DeclLoc, + S.PDiag(diag::note_managed_mismatch_here_for_param))) + : getNotes(); + } + public: ThreadSafetyReporter(Sema &S, SourceLocation FL, SourceLocation FEL) : S(S), FunLocation(FL), FunEndLocation(FEL), @@ -1863,6 +1871,38 @@ class ThreadSafetyReporter : public clang::threadSafety::ThreadSafetyHandler { } } + void handleUnmatchedUnderlyingMutexes(SourceLocation Loc, SourceLocation DLoc, + Name scopeName, StringRef Kind, + Name expected, Name actual) override { + PartialDiagnosticAt Warning(Loc, + S.PDiag(diag::warn_unmatched_underlying_mutexes) + << Kind << scopeName << expected << actual); + Warnings.emplace_back(std::move(Warning), + makeManagedMismatchNoteForParam(DLoc)); + } + + void handleExpectMoreUnderlyingMutexes(SourceLocation Loc, + SourceLocation DLoc, Name scopeName, + StringRef Kind, + Name expected) override { + PartialDiagnosticAt Warning( + Loc, S.PDiag(diag::warn_expect_more_underlying_mutexes) + << Kind << scopeName << expected); + Warnings.emplace_back(std::move(Warning), + makeManagedMismatchNoteForParam(DLoc)); + } + + void handleExpectFewerUnderlyingMutexes(SourceLocation Loc, + SourceLocation DLoc, Name scopeName, + StringRef Kind, + Name actual) override { + PartialDiagnosticAt Warning( + Loc, S.PDiag(diag::warn_expect_fewer_underlying_mutexes) + << Kind << scopeName << actual); + Warnings.emplace_back(std::move(Warning), + makeManagedMismatchNoteForParam(DLoc)); + } + void handleInvalidLockExp(SourceLocation Loc) override { PartialDiagnosticAt Warning(Loc, S.PDiag(diag::warn_cannot_resolve_lock) << Loc); diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 5d7ee09738377..bb4d33560b93b 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -271,6 +271,19 @@ static bool checkRecordTypeForCapability(Sema &S, QualType Ty) { return checkRecordDeclForAttr(RT->getDecl()); } +static bool checkRecordTypeForScopedCapability(Sema &S, QualType Ty) { + const RecordType *RT = getRecordType(Ty); + + if (!RT) + return false; + + // Don't check for the capability if the class hasn't been defined yet. + if (RT->isIncompleteType()) + return true; + + return checkRecordDeclForAttr(RT->getDecl()); +} + static bool checkTypedefTypeForCapability(QualType Ty) { const auto *TD = Ty->getAs(); if (!TD) @@ -416,6 +429,19 @@ static void checkAttrArgsAreCapabilityObjs(Sema &S, Decl *D, } } +static bool checkFunParamsAreScopedLockable(Sema &S, + const ParmVarDecl *ParamDecl, + const ParsedAttr &AL) { + QualType ParamType = ParamDecl->getType(); + if (const auto *RefType = ParamType->getAs(); + RefType && + checkRecordTypeForScopedCapability(S, RefType->getPointeeType())) + return true; + S.Diag(AL.getLoc(), diag::warn_thread_attribute_not_on_scoped_lockable_param) + << AL; + return false; +} + //===----------------------------------------------------------------------===// // Attribute Implementations //===----------------------------------------------------------------------===// @@ -643,6 +669,10 @@ static void handleLockReturnedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { } static void handleLocksExcludedAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (const auto *ParmDecl = dyn_cast(D); + ParmDecl && !checkFunParamsAreScopedLockable(S, ParmDecl, AL)) + return; + if (!AL.checkAtLeastNumArgs(S, 1)) return; @@ -5908,6 +5938,10 @@ static void handleAssertCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { static void handleAcquireCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (const auto *ParmDecl = dyn_cast(D); + ParmDecl && !checkFunParamsAreScopedLockable(S, ParmDecl, AL)) + return; + SmallVector Args; if (!checkLockFunAttrCommon(S, D, AL, Args)) return; @@ -5928,6 +5962,9 @@ static void handleTryAcquireCapabilityAttr(Sema &S, Decl *D, static void handleReleaseCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (const auto *ParmDecl = dyn_cast(D); + ParmDecl && !checkFunParamsAreScopedLockable(S, ParmDecl, AL)) + return; // Check that all arguments are lockable objects. SmallVector Args; checkAttrArgsAreCapabilityObjs(S, D, AL, Args, 0, true); @@ -5938,6 +5975,10 @@ static void handleReleaseCapabilityAttr(Sema &S, Decl *D, static void handleRequiresCapabilityAttr(Sema &S, Decl *D, const ParsedAttr &AL) { + if (const auto *ParmDecl = dyn_cast(D); + ParmDecl && !checkFunParamsAreScopedLockable(S, ParmDecl, AL)) + return; + if (!AL.checkAtLeastNumArgs(S, 1)) return; diff --git a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp index 3c52c8165d852..018d6d1bb258b 100644 --- a/clang/test/SemaCXX/warn-thread-safety-analysis.cpp +++ b/clang/test/SemaCXX/warn-thread-safety-analysis.cpp @@ -3196,6 +3196,378 @@ void lockUnlock() EXCLUSIVE_LOCKS_REQUIRED(mu) { } // end namespace ScopedUnlock +namespace PassingScope { + +class SCOPED_LOCKABLE RelockableScope { +public: + RelockableScope(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu); + void Release() UNLOCK_FUNCTION(); + void Acquire() EXCLUSIVE_LOCK_FUNCTION(); + ~RelockableScope() EXCLUSIVE_UNLOCK_FUNCTION(); +}; + +class SCOPED_LOCKABLE ReaderRelockableScope { +public: + ReaderRelockableScope(Mutex *mu) SHARED_LOCK_FUNCTION(mu); + void Release() UNLOCK_FUNCTION(); + void Acquire() SHARED_LOCK_FUNCTION(); + ~ReaderRelockableScope() UNLOCK_FUNCTION(); +}; + +Mutex mu; +Mutex mu1; +Mutex mu2; +int x GUARDED_BY(mu); +int y GUARDED_BY(mu) GUARDED_BY(mu2); +void print(int); + +// Analysis inside the function with annotated parameters + +void sharedRequired(ReleasableMutexLock& scope SHARED_LOCKS_REQUIRED(mu)) { + print(x); // OK. +} + +void sharedAcquire(ReaderRelockableScope& scope SHARED_LOCK_FUNCTION(mu)) { + scope.Acquire(); + print(x); +} + +void sharedRelease(RelockableScope& scope SHARED_UNLOCK_FUNCTION(mu)) { + print(x); + scope.Release(); + print(x); // expected-warning{{reading variable 'x' requires holding mutex 'mu'}} +} + +void requiredLock(ReleasableMutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu)) { + x = 1; // OK. +} + +void reacquireRequiredLock(RelockableScope& scope EXCLUSIVE_LOCKS_REQUIRED(mu)) { + scope.Release(); + scope.Acquire(); + x = 2; // OK. +} + +void releaseSingleMutex(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)) { + x = 1; // OK. + scope.Release(); + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void releaseMultipleMutexes(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu, mu2)) { + y = 1; // OK. + scope.Release(); + y = 2; // expected-warning{{writing variable 'y' requires holding mutex 'mu' exclusively}} + // expected-warning@-1{{writing variable 'y' requires holding mutex 'mu2' exclusively}} +} + +void acquireLock(RelockableScope& scope EXCLUSIVE_LOCK_FUNCTION(mu)) { + x = 1; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} + scope.Acquire(); + x = 2; // OK. +} + +void acquireMultipleLocks(RelockableScope& scope EXCLUSIVE_LOCK_FUNCTION(mu, mu2)) { + y = 1; // expected-warning{{writing variable 'y' requires holding mutex 'mu' exclusively}} + // expected-warning@-1{{writing variable 'y' requires holding mutex 'mu2' exclusively}} + scope.Acquire(); + y = 2; // OK. +} + +void excludedLock(ReleasableMutexLock& scope LOCKS_EXCLUDED(mu)) { + x = 1; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void acquireAndReleaseExcludedLocks(RelockableScope& scope LOCKS_EXCLUDED(mu)) { + scope.Acquire(); + scope.Release(); +} + +// expected-note@+1{{mutex acquired here}} +void unreleasedMutex(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)) { + x = 1; // OK. +} // expected-warning{{mutex 'mu' is still held at the end of function}} + +// expected-note@+1{{mutex acquired here}} +void acquireAlreadyHeldMutex(RelockableScope& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)) { + scope.Acquire(); // expected-warning{{acquiring mutex 'mu' that is already held}} + scope.Release(); +} + +void reacquireMutex(RelockableScope& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)) { + scope.Release(); + scope.Acquire(); // expected-note{{mutex acquired here}} + x = 2; // OK. +} // expected-warning{{mutex 'mu' is still held at the end of function}} + +// expected-note@+1{{mutex acquired here}} +void requireSingleMutex(ReleasableMutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu)) { + x = 1; // OK. + scope.Release(); + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + +// expected-note@+1 2{{mutex acquired here}} +void requireMultipleMutexes(ReleasableMutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu, mu2)) { + y = 1; // OK. + scope.Release(); + y = 2; // expected-warning{{writing variable 'y' requires holding mutex 'mu' exclusively}} + // expected-warning@-1{{writing variable 'y' requires holding mutex 'mu2' exclusively}} +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + // expected-warning@-1{{expecting mutex 'mu2' to be held at the end of function}} + +// expected-note@+1{{mutex acquired here}} +void acquireAlreadyHeldLock(RelockableScope& scope EXCLUSIVE_LOCKS_REQUIRED(mu)) { + scope.Acquire(); // expected-warning{{acquiring mutex 'mu' that is already held}} +} + +// expected-note@+1 {{mutex acquired here}} +void releaseWithoutHoldingLock(ReleasableMutexLock& scope EXCLUSIVE_LOCK_FUNCTION(mu)) { + scope.Release(); // expected-warning{{releasing mutex 'mu' that was not held}} +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + +// expected-note@+1 {{mutex acquired here}} +void endWithReleasedMutex(RelockableScope& scope EXCLUSIVE_LOCK_FUNCTION(mu)) { + scope.Acquire(); + scope.Release(); +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + +void acquireExcludedLock(RelockableScope& scope LOCKS_EXCLUDED(mu)) { + x = 1; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} + scope.Acquire(); // expected-note {{mutex acquired here}} + x = 2; // OK. +} // expected-warning{{mutex 'mu' is still held at the end of function}} + +void acquireMultipleExcludedLocks(RelockableScope& scope LOCKS_EXCLUDED(mu, mu2)) { + y = 1; // expected-warning{{writing variable 'y' requires holding mutex 'mu' exclusively}} + // expected-warning@-1{{writing variable 'y' requires holding mutex 'mu2' exclusively}} + scope.Acquire(); // expected-note 2{{mutex acquired here}} + y = 2; // OK. +} // expected-warning{{mutex 'mu' is still held at the end of function}} + // expected-warning@-1{{mutex 'mu2' is still held at the end of function}} + +void reacquireExcludedLocks(RelockableScope& scope LOCKS_EXCLUDED(mu)) { + scope.Release(); // expected-warning{{releasing mutex 'mu' that was not held}} + scope.Acquire(); // expected-note {{mutex acquired here}} + x = 2; // OK. +} // expected-warning{{mutex 'mu' is still held at the end of function}} + +// expected-note@+1{{mutex acquired here}} +void sharedRequired2(ReleasableMutexLock& scope SHARED_LOCKS_REQUIRED(mu)) { + print(x); // OK. + scope.Release(); + print(x); // expected-warning{{reading variable 'x' requires holding mutex 'mu'}} +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + +// expected-note@+1{{mutex acquired here}} +void sharedAcquire2(RelockableScope& scope SHARED_LOCK_FUNCTION(mu)) { + print(x); // expected-warning{{reading variable 'x' requires holding mutex 'mu'}} + scope.Release(); // expected-warning{{releasing mutex 'mu' that was not held}} +} // expected-warning{{expecting mutex 'mu' to be held at the end of function}} + +// expected-note@+1 2{{mutex acquired here}} +void sharedRelease2(RelockableScope& scope SHARED_UNLOCK_FUNCTION(mu)) { + scope.Acquire(); //expected-warning{{acquiring mutex 'mu' that is already held}} +} //expected-warning{{mutex 'mu' is still held at the end of function}} + +// Handling the call of the function with annotated parameters + +// expected-note@+1{{see attribute on parameter here}} +void release(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)); +// expected-note@+1{{see attribute on parameter here}} +void release_DoubleMutexLock(DoubleMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu)); +// expected-note@+1 2{{see attribute on parameter here}} +void release_two(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu, mu2)); +// expected-note@+1{{see attribute on parameter here}} +void release_double(DoubleMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu, mu2)); +void require(ReleasableMutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu)); +void acquire(RelockableScope& scope EXCLUSIVE_LOCK_FUNCTION(mu)); +void exclude(RelockableScope& scope LOCKS_EXCLUDED(mu)); + +void release_shared(ReaderRelockableScope& scope SHARED_UNLOCK_FUNCTION(mu)); +void require_shared(ReleasableMutexLock& scope SHARED_LOCKS_REQUIRED(mu)); +void acquire_shared(ReaderRelockableScope& scope SHARED_LOCK_FUNCTION(mu)); + +void unlockCall() { + ReleasableMutexLock scope(&mu); + x = 1; // OK. + release(scope); + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void unlockSharedCall() { + ReaderRelockableScope scope(&mu); + print(x); // OK. + release_shared(scope); + print(x); // expected-warning{{reading variable 'x' requires holding mutex 'mu'}} +} + +void requireCall() { + ReleasableMutexLock scope(&mu); + x = 1; // OK. + require(scope); + x = 2; // Ok. +} + +void requireSharedCall() { + ReleasableMutexLock scope(&mu); + print(x); // OK. + require_shared(scope); + print(x); // Ok. +} + +void acquireCall() { + RelockableScope scope(&mu); + scope.Release(); + acquire(scope); + x = 2; // Ok. +} + +void acquireSharedCall() { + ReaderRelockableScope scope(&mu); + scope.Release(); + acquire_shared(scope); + print(x); // Ok. +} + +void writeAfterExcludeCall() { + RelockableScope scope(&mu); + scope.Release(); + exclude(scope); + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void unlockCallAfterExplicitRelease() { + ReleasableMutexLock scope(&mu); + x = 1; // OK. + scope.Release(); // expected-note{{mutex released here}} + release(scope); // expected-warning{{releasing mutex 'mu' that was not held}} + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void unmatchedMutexes() { + ReleasableMutexLock scope(&mu2); + release(scope); // expected-warning{{mutex managed by 'scope' is 'mu2' instead of 'mu'}} + // expected-warning@-1{{releasing mutex 'mu' that was not held}} +} + +void wrongOrder() { + DoubleMutexLock scope(&mu2, &mu); + release_double(scope); // expected-warning{{mutex managed by 'scope' is 'mu2' instead of 'mu'}} +} + +void differentNumberOfMutexes() { + ReleasableMutexLock scope(&mu); + release_two(scope); // expected-warning{{mutex 'mu2' not managed by 'scope'}} + // expected-warning@-1{{releasing mutex 'mu2' that was not held}} +} + +void differentNumberOfMutexes2() { + ReleasableMutexLock scope(&mu2); + release_two(scope); // expected-warning{{mutex managed by 'scope' is 'mu2' instead of 'mu'}} + // expected-warning@-1{{releasing mutex 'mu' that was not held}} +} + +void differentNumberOfMutexes3() { + DoubleMutexLock scope(&mu, &mu2); + release_DoubleMutexLock(scope); // expected-warning{{did not expect mutex 'mu2' to be managed by 'scope'}} +} + +void releaseDefault(ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(mu), int = 0); + +void unlockFunctionDefault() { + ReleasableMutexLock scope(&mu); + x = 1; // OK. + releaseDefault(scope); + x = 2; // expected-warning{{writing variable 'x' requires holding mutex 'mu' exclusively}} +} + +void requireCallWithReleasedLock() { + ReleasableMutexLock scope(&mu); + scope.Release(); + require(scope); // expected-warning{{calling function 'require' requires holding mutex 'mu' exclusively}} +} + +void acquireCallWithAlreadyHeldLock() { + RelockableScope scope(&mu); // expected-note{{mutex acquired here}} + acquire(scope); // expected-warning{{acquiring mutex 'mu' that is already held}} + x = 1; +} + +void excludeCallWithAlreadyHeldLock() { + RelockableScope scope(&mu); + exclude(scope); // expected-warning{{cannot call function 'exclude' while mutex 'mu' is held}} + x = 2; // OK. +} + +void requireConst(const ReleasableMutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu)); +void requireConstCall() { + requireConst(ReleasableMutexLock(&mu)); +} + +void passScopeUndeclared(ReleasableMutexLock &scope) { + release(scope); // expected-warning{{calling function 'release' requires holding mutex 'scope' exclusively}} + // expected-warning@-1{{releasing mutex 'mu' that was not held}} +} + +class SCOPED_LOCKABLE ScopedWithoutLock { +public: + ScopedWithoutLock(); + + ~ScopedWithoutLock() EXCLUSIVE_UNLOCK_FUNCTION(); +}; + +void require(ScopedWithoutLock &scope EXCLUSIVE_LOCKS_REQUIRED(mu)); + +void constructWithoutLock() { + ScopedWithoutLock scope; + require(scope); // expected-warning{{calling function 'require' requires holding mutex 'mu' exclusively}} + // expected-warning@-1{{calling function 'require' requires holding mutex 'scope' exclusively}} +} // expected-warning {{releasing mutex 'scope' that was not held}} + +void requireConst(const ScopedWithoutLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu)); + +void requireCallWithReleasedLock2() { + requireConst(ScopedWithoutLock()); + // expected-warning@-1{{calling function 'requireConst' requires holding mutex '#undefined' exclusively}} + // expected-warning@-2{{calling function 'requireConst' requires holding mutex 'mu' exclusively}} +} + +void requireDecl(RelockableScope &scope EXCLUSIVE_LOCKS_REQUIRED(mu)); +void requireDecl(RelockableScope &scope) { + scope.Release(); + scope.Acquire(); +} + +struct foo +{ + Mutex mu; + // expected-note@+1{{see attribute on parameter here}} + void require(RelockableScope &scope EXCLUSIVE_LOCKS_REQUIRED(mu)); + void callRequire(){ + RelockableScope scope(&mu); + // TODO: False positive due to incorrect parsing of parameter attribute arguments. + require(scope); + // expected-warning@-1{{calling function 'require' requires holding mutex 'mu' exclusively}} + // expected-warning@-2{{mutex managed by 'scope' is 'mu' instead of 'mu'}} + } +}; + +struct ObjectWithMutex { + Mutex mu; + int x GUARDED_BY(mu); +}; +void releaseMember(ObjectWithMutex& object, ReleasableMutexLock& scope EXCLUSIVE_UNLOCK_FUNCTION(object.mu)) { + object.x = 1; + scope.Release(); +} +void releaseMemberCall() { + ObjectWithMutex obj; + ReleasableMutexLock lock(&obj.mu); + releaseMember(obj, lock); +} + +} // end namespace PassingScope namespace TrylockFunctionTest { diff --git a/clang/test/SemaCXX/warn-thread-safety-parsing.cpp b/clang/test/SemaCXX/warn-thread-safety-parsing.cpp index 0c5b0cc85897b..752803e4a0543 100644 --- a/clang/test/SemaCXX/warn-thread-safety-parsing.cpp +++ b/clang/test/SemaCXX/warn-thread-safety-parsing.cpp @@ -62,6 +62,12 @@ class MuDoubleWrapper { } }; +class SCOPED_LOCKABLE MutexLock { + public: + MutexLock(Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu); + ~MutexLock() UNLOCK_FUNCTION(); +}; + Mutex mu1; UnlockableMu umu; Mutex mu2; @@ -599,8 +605,11 @@ class EXCLUSIVE_LOCK_FUNCTION() ElfTestClass { // \ // expected-warning {{'exclusive_lock_function' attribute only applies to functions}} }; -void elf_fun_params(int lvar EXCLUSIVE_LOCK_FUNCTION()); // \ - // expected-warning {{'exclusive_lock_function' attribute only applies to functions}} +void elf_fun_params1(MutexLock& scope EXCLUSIVE_LOCK_FUNCTION(mu1)); +void elf_fun_params2(int lvar EXCLUSIVE_LOCK_FUNCTION(mu1)); // \ + // expected-warning{{'exclusive_lock_function' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} +void elf_fun_params3(MutexLock& scope EXCLUSIVE_LOCK_FUNCTION()); // \ + // expected-warning{{'exclusive_lock_function' attribute without capability arguments can only be applied to non-static methods of a class}} // Check argument parsing. @@ -660,8 +669,11 @@ int slf_testfn(int y) { int slf_test_var SHARED_LOCK_FUNCTION(); // \ // expected-warning {{'shared_lock_function' attribute only applies to functions}} -void slf_fun_params(int lvar SHARED_LOCK_FUNCTION()); // \ - // expected-warning {{'shared_lock_function' attribute only applies to functions}} +void slf_fun_params1(MutexLock& scope SHARED_LOCK_FUNCTION(mu1)); +void slf_fun_params2(int lvar SHARED_LOCK_FUNCTION(mu1)); // \ + // expected-warning {{'shared_lock_function' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} +void slf_fun_params3(MutexLock& scope SHARED_LOCK_FUNCTION()); // \ + // expected-warning {{'shared_lock_function' attribute without capability arguments can only be applied to non-static methods of a class}} class SlfFoo { private: @@ -903,8 +915,11 @@ class NO_THREAD_SAFETY_ANALYSIS UfTestClass { // \ // expected-warning {{'no_thread_safety_analysis' attribute only applies to functions}} }; -void uf_fun_params(int lvar UNLOCK_FUNCTION()); // \ - // expected-warning {{'unlock_function' attribute only applies to functions}} +void uf_fun_params1(MutexLock& scope UNLOCK_FUNCTION(mu1)); +void uf_fun_params2(int lvar UNLOCK_FUNCTION(mu1)); // \ + // expected-warning {{'unlock_function' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} +void uf_fun_params3(MutexLock& scope UNLOCK_FUNCTION()); // \ + // expected-warning {{'unlock_function' attribute without capability arguments can only be applied to non-static methods of a class}} // Check argument parsing. @@ -1035,8 +1050,9 @@ int le_testfn(int y) { int le_test_var LOCKS_EXCLUDED(mu1); // \ // expected-warning {{'locks_excluded' attribute only applies to functions}} -void le_fun_params(int lvar LOCKS_EXCLUDED(mu1)); // \ - // expected-warning {{'locks_excluded' attribute only applies to functions}} +void le_fun_params1(MutexLock& scope LOCKS_EXCLUDED(mu1)); +void le_fun_params2(int lvar LOCKS_EXCLUDED(mu1)); // \ + // expected-warning{{'locks_excluded' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} class LeFoo { private: @@ -1102,8 +1118,9 @@ int elr_testfn(int y) { int elr_test_var EXCLUSIVE_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'exclusive_locks_required' attribute only applies to functions}} -void elr_fun_params(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \ - // expected-warning {{'exclusive_locks_required' attribute only applies to functions}} +void elr_fun_params1(MutexLock& scope EXCLUSIVE_LOCKS_REQUIRED(mu1)); +void elr_fun_params2(int lvar EXCLUSIVE_LOCKS_REQUIRED(mu1)); // \ + // expected-warning {{'exclusive_locks_required' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} class ElrFoo { private: @@ -1170,8 +1187,9 @@ int slr_testfn(int y) { int slr_test_var SHARED_LOCKS_REQUIRED(mu1); // \ // expected-warning {{'shared_locks_required' attribute only applies to functions}} -void slr_fun_params(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \ - // expected-warning {{'shared_locks_required' attribute only applies to functions}} +void slr_fun_params1(MutexLock& scope SHARED_LOCKS_REQUIRED(mu1)); +void slr_fun_params2(int lvar SHARED_LOCKS_REQUIRED(mu1)); // \ + // expected-warning {{'shared_locks_required' attribute applies to function parameters only if their type is a reference to a 'scoped_lockable'-annotated type}} class SlrFoo { private: From e5de2a2df4f983e1db83deaaa1d21457c922404f Mon Sep 17 00:00:00 2001 From: Congcong Cai Date: Sat, 21 Dec 2024 07:07:19 +0800 Subject: [PATCH 047/466] [clang-tidy][NFC] extract options verify to separately function (#120768) --- clang-tools-extra/clang-tidy/ClangTidy.cpp | 8 ++--- clang-tools-extra/clang-tidy/ClangTidy.h | 6 ++-- .../clang-tidy/tool/ClangTidyMain.cpp | 36 +++++++++++-------- 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/clang-tools-extra/clang-tidy/ClangTidy.cpp b/clang-tools-extra/clang-tidy/ClangTidy.cpp index 9c8c93c5d16c7..959b11777e88d 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.cpp +++ b/clang-tools-extra/clang-tidy/ClangTidy.cpp @@ -646,9 +646,9 @@ void exportReplacements(const llvm::StringRef MainFilePath, YAML << TUD; } -NamesAndOptions +ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) { - NamesAndOptions Result; + ChecksAndOptions Result; ClangTidyOptions Opts; Opts.Checks = "*"; clang::tidy::ClangTidyContext Context( @@ -661,7 +661,7 @@ getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) { } for (const auto &Factory : Factories) - Result.Names.insert(Factory.getKey()); + Result.Checks.insert(Factory.getKey()); #if CLANG_TIDY_ENABLE_STATIC_ANALYZER SmallString<64> Buffer(AnalyzerCheckNamePrefix); @@ -670,7 +670,7 @@ getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers) { AllowEnablingAnalyzerAlphaCheckers)) { Buffer.truncate(DefSize); Buffer.append(AnalyzerCheck); - Result.Names.insert(Buffer); + Result.Checks.insert(Buffer); } for (std::string OptionName : { #define GET_CHECKER_OPTIONS diff --git a/clang-tools-extra/clang-tidy/ClangTidy.h b/clang-tools-extra/clang-tidy/ClangTidy.h index 51d9e226c7946..4ffd49f6ebf50 100644 --- a/clang-tools-extra/clang-tidy/ClangTidy.h +++ b/clang-tools-extra/clang-tidy/ClangTidy.h @@ -58,12 +58,12 @@ class ClangTidyASTConsumerFactory { std::vector getCheckNames(const ClangTidyOptions &Options, bool AllowEnablingAnalyzerAlphaCheckers); -struct NamesAndOptions { - llvm::StringSet<> Names; +struct ChecksAndOptions { + llvm::StringSet<> Checks; llvm::StringSet<> Options; }; -NamesAndOptions +ChecksAndOptions getAllChecksAndOptions(bool AllowEnablingAnalyzerAlphaCheckers = true); /// Returns the effective check-specific options. diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index d42dafa8ffc36..b8d843cba7133 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -526,6 +526,24 @@ static bool verifyFileExtensions( return AnyInvalid; } +static bool verifyOptions(const llvm::StringSet<> &ValidOptions, + const ClangTidyOptions::OptionMap &OptionMap, + StringRef Source) { + bool AnyInvalid = false; + for (auto Key : OptionMap.keys()) { + if (ValidOptions.contains(Key)) + continue; + AnyInvalid = true; + auto &Output = llvm::WithColor::warning(llvm::errs(), Source) + << "unknown check option '" << Key << '\''; + llvm::StringRef Closest = closest(Key, ValidOptions); + if (!Closest.empty()) + Output << "; did you mean '" << Closest << '\''; + Output << VerifyConfigWarningEnd; + } + return AnyInvalid; +} + static SmallString<256> makeAbsolute(llvm::StringRef Input) { if (Input.empty()) return {}; @@ -629,29 +647,17 @@ int clangTidyMain(int argc, const char **argv) { if (VerifyConfig) { std::vector RawOptions = OptionsProvider->getRawOptions(FileName); - NamesAndOptions Valid = + ChecksAndOptions Valid = getAllChecksAndOptions(AllowEnablingAnalyzerAlphaCheckers); bool AnyInvalid = false; for (const auto &[Opts, Source] : RawOptions) { if (Opts.Checks) - AnyInvalid |= verifyChecks(Valid.Names, *Opts.Checks, Source); - + AnyInvalid |= verifyChecks(Valid.Checks, *Opts.Checks, Source); if (Opts.HeaderFileExtensions && Opts.ImplementationFileExtensions) AnyInvalid |= verifyFileExtensions(*Opts.HeaderFileExtensions, *Opts.ImplementationFileExtensions, Source); - - for (auto Key : Opts.CheckOptions.keys()) { - if (Valid.Options.contains(Key)) - continue; - AnyInvalid = true; - auto &Output = llvm::WithColor::warning(llvm::errs(), Source) - << "unknown check option '" << Key << '\''; - llvm::StringRef Closest = closest(Key, Valid.Options); - if (!Closest.empty()) - Output << "; did you mean '" << Closest << '\''; - Output << VerifyConfigWarningEnd; - } + AnyInvalid |= verifyOptions(Valid.Options, Opts.CheckOptions, Source); } if (AnyInvalid) return 1; From adf0c817f3eb0afc2c9ccc64c806acc7d6c14cd8 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 20 Dec 2024 15:40:08 -0800 Subject: [PATCH 048/466] [memprof] Undrift MemProf profile even when some frames are missing (#120500) This patch makes the MemProf undrifting process a little more lenient. Consider an inlined call hierarchy: foo -> bar -> ::new If bar tail-calls ::new, the profile appears to indicate that foo directly calls ::new. This is a problem because the perceived call hierarchy in the profile looks different from what we can obtain from the inline stack in the IR. Recall that undrifting works by constructing and comparing a list of direct calls from the profile and that from the IR. This patch modifies the construction of the latter. Specifically, if foo calls bar in the IR, but bar is missing the profile, we pretend that foo directly calls some heap allocation function. We apply this transformation only in the inline stack leading to some heap allocation function. --- .../Transforms/Instrumentation/MemProfiler.h | 7 +- .../Instrumentation/MemProfiler.cpp | 37 ++++++-- .../memprof_undrift_missing_leaf.ll | 92 +++++++++++++++++++ 3 files changed, 125 insertions(+), 11 deletions(-) create mode 100644 llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll diff --git a/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h b/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h index 344c9215fb822..169f757e580d2 100644 --- a/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h +++ b/llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h @@ -66,8 +66,11 @@ namespace memprof { // Extract all calls from the IR. Arrange them in a map from caller GUIDs to a // list of call sites, each of the form {LineLocation, CalleeGUID}. -DenseMap> -extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI); +DenseMap> extractCallsFromIR( + Module &M, const TargetLibraryInfo &TLI, + function_ref IsPresentInProfile = [](uint64_t) { + return true; + }); struct LineLocationHash { uint64_t operator()(const LineLocation &Loc) const { diff --git a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp index 661a05bfe0ad6..f1580b025efca 100644 --- a/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemProfiler.cpp @@ -832,7 +832,8 @@ struct AllocMatchInfo { }; DenseMap> -memprof::extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI) { +memprof::extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI, + function_ref IsPresentInProfile) { DenseMap> Calls; auto GetOffset = [](const DILocation *DIL) { @@ -856,7 +857,12 @@ memprof::extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI) { continue; StringRef CalleeName = CalledFunction->getName(); + // True if we are calling a heap allocation function that supports + // hot/cold variants. bool IsAlloc = isAllocationWithHotColdVariant(CalledFunction, TLI); + // True for the first iteration below, indicating that we are looking at + // a leaf node. + bool IsLeaf = true; for (const DILocation *DIL = I.getDebugLoc(); DIL; DIL = DIL->getInlinedAt()) { StringRef CallerName = DIL->getSubprogramLinkageName(); @@ -865,16 +871,27 @@ memprof::extractCallsFromIR(Module &M, const TargetLibraryInfo &TLI) { uint64_t CallerGUID = IndexedMemProfRecord::getGUID(CallerName); uint64_t CalleeGUID = IndexedMemProfRecord::getGUID(CalleeName); // Pretend that we are calling a function with GUID == 0 if we are - // calling a heap allocation function. - if (IsAlloc) - CalleeGUID = 0; + // in the inline stack leading to a heap allocation function. + if (IsAlloc) { + if (IsLeaf) { + // For leaf nodes, set CalleeGUID to 0 without consulting + // IsPresentInProfile. + CalleeGUID = 0; + } else if (!IsPresentInProfile(CalleeGUID)) { + // In addition to the leaf case above, continue to set CalleeGUID + // to 0 as long as we don't see CalleeGUID in the profile. + CalleeGUID = 0; + } else { + // Once we encounter a callee that exists in the profile, stop + // setting CalleeGUID to 0. + IsAlloc = false; + } + } + LineLocation Loc = {GetOffset(DIL), DIL->getColumn()}; Calls[CallerGUID].emplace_back(Loc, CalleeGUID); CalleeName = CallerName; - // FIXME: Recognize other frames that are associated with heap - // allocation functions. It may be too early to reset IsAlloc to - // false here. - IsAlloc = false; + IsLeaf = false; } } } @@ -897,7 +914,9 @@ memprof::computeUndriftMap(Module &M, IndexedInstrProfReader *MemProfReader, DenseMap> CallsFromProfile = MemProfReader->getMemProfCallerCalleePairs(); DenseMap> CallsFromIR = - extractCallsFromIR(M, TLI); + extractCallsFromIR(M, TLI, [&](uint64_t GUID) { + return CallsFromProfile.contains(GUID); + }); // Compute an undrift map for each CallerGUID. for (const auto &[CallerGUID, IRAnchors] : CallsFromIR) { diff --git a/llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll b/llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll new file mode 100644 index 0000000000000..ec8ee3d7930cf --- /dev/null +++ b/llvm/test/Transforms/PGOProfile/memprof_undrift_missing_leaf.ll @@ -0,0 +1,92 @@ +;; Tests memprof undrifting when the leaf frame is missing in the profile. +;; This test case is taken from memprof_missing_leaf.ll with the profile +;; drifted. + +; RUN: split-file %s %t +; RUN: llvm-profdata merge %t/memprof_missing_leaf.yaml -o %t/memprof_missing_leaf.memprofdata +; RUN: opt < %t/memprof_missing_leaf.ll -passes='memprof-use' -memprof-salvage-stale-profile -S | FileCheck %s + +;--- memprof_missing_leaf.yaml +--- +HeapProfileRecords: + - GUID: main + AllocSites: + - Callstack: + - { Function: main, LineOffset: 2, Column: 21, IsInlineFrame: false } + MemInfoBlock: + AllocCount: 1 + TotalSize: 1 + CallSites: [] +... +;--- memprof_missing_leaf.ll +; CHECK: call {{.*}} @_Znam{{.*}} #[[ATTR:[0-9]+]] +; CHECK: attributes #[[ATTR]] = {{.*}} "memprof"="notcold" + +; ModuleID = '' +source_filename = "memprof_missing_leaf.cc" +target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +; Function Attrs: nobuiltin allocsize(0) +declare noundef nonnull ptr @_Znam(i64 noundef) #0 + +; Function Attrs: mustprogress norecurse uwtable +define dso_local noundef i32 @main() #1 !dbg !8 { +entry: + %s.addr.i = alloca i64, align 8 + %retval = alloca i32, align 4 + %a = alloca ptr, align 8 + store i32 0, ptr %retval, align 4 + store i64 1, ptr %s.addr.i, align 8, !tbaa !11 + %0 = load i64, ptr %s.addr.i, align 8, !dbg !15, !tbaa !11 + %call.i = call noalias noundef nonnull ptr @_Znam(i64 noundef %0) #3, !dbg !18 + store ptr %call.i, ptr %a, align 8, !dbg !19, !tbaa !20 + %1 = load ptr, ptr %a, align 8, !dbg !22, !tbaa !20 + %isnull = icmp eq ptr %1, null, !dbg !23 + br i1 %isnull, label %delete.end, label %delete.notnull, !dbg !23 + +delete.notnull: ; preds = %entry + call void @_ZdlPv(ptr noundef %1) #4, !dbg !23 + br label %delete.end, !dbg !23 + +delete.end: ; preds = %delete.notnull, %entry + ret i32 0, !dbg !24 +} + +; Function Attrs: nobuiltin nounwind +declare void @_ZdlPv(ptr noundef) #2 + +attributes #0 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #1 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #2 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } +attributes #3 = { builtin allocsize(0) } +attributes #4 = { builtin nounwind } + +!llvm.dbg.cu = !{!0} +!llvm.module.flags = !{!2, !3, !4, !5, !6, !7} + +!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 18.0.0 (git@github.com:llvm/llvm-project.git 71bf052ec90e77cb4aa66505d47cbc4b6016ac1d)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) +!1 = !DIFile(filename: "memprof_missing_leaf.cc", directory: ".", checksumkind: CSK_MD5, checksum: "f1445a8699406a6b826128704d257677") +!2 = !{i32 7, !"Dwarf Version", i32 5} +!3 = !{i32 2, !"Debug Info Version", i32 3} +!4 = !{i32 1, !"wchar_size", i32 4} +!5 = !{i32 8, !"PIC Level", i32 2} +!6 = !{i32 7, !"PIE Level", i32 2} +!7 = !{i32 7, !"uwtable", i32 2} +!8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 15, type: !9, scopeLine: 15, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) +!9 = !DISubroutineType(types: !10) +!10 = !{} +!11 = !{!12, !12, i64 0} +!12 = !{!"long", !13, i64 0} +!13 = !{!"omnipotent char", !14, i64 0} +!14 = !{!"Simple C++ TBAA"} +!15 = !DILocation(line: 11, column: 19, scope: !16, inlinedAt: !17) +!16 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barm", scope: !1, file: !1, line: 7, type: !9, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) +!17 = distinct !DILocation(line: 16, column: 21, scope: !8) +!18 = !DILocation(line: 11, column: 10, scope: !16, inlinedAt: !17) +!19 = !DILocation(line: 16, column: 9, scope: !8) +!20 = !{!21, !21, i64 0} +!21 = !{!"any pointer", !13, i64 0} +!22 = !DILocation(line: 17, column: 10, scope: !8) +!23 = !DILocation(line: 17, column: 3, scope: !8) +!24 = !DILocation(line: 18, column: 3, scope: !8) From 96839a47209c202b60c4164a2acc34bd755f6308 Mon Sep 17 00:00:00 2001 From: alx32 <103613512+alx32@users.noreply.github.com> Date: Fri, 20 Dec 2024 16:00:52 -0800 Subject: [PATCH 049/466] [llvm-gsymutil] Ensure stable ordering of merged functions (#120796) Previously, the test `llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml` [was disabled](https://github.com/llvm/llvm-project/pull/119957/files) due to failing on Linux. The issue is that the merged functions appear in a different order in the final produced `gSYM`. To ensure deterministic ordering of merged functions, we change the sorting of functions to use the `stable_sort` algorithm. Before merged functions, this was not an issue as the address is used as a comparator in the sorting algorithm so there was no chance of two functions testing as identical according to the comparator. Confirmed that test now passes locally with `-DLLVM_ENABLE_EXPENSIVE_CHECKS=ON`. --- llvm/lib/DebugInfo/GSYM/GsymCreator.cpp | 4 ++-- .../ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp index eb26c637a2ca3..14078f5aaf9a4 100644 --- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp +++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp @@ -200,8 +200,8 @@ void GsymCreator::prepareMergedFunctions(OutputAggregator &Out) { if (Funcs.size() < 2) return; - // Sort the function infos by address range first - llvm::sort(Funcs); + // Sort the function infos by address range first, preserving input order + llvm::stable_sort(Funcs); std::vector TopLevelFuncs; // Add the first function info to the top level functions diff --git a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml index 001145c01398c..4cecc79c72b4b 100644 --- a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml +++ b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/macho-gsym-merged-callsites-dsym.yaml @@ -1,7 +1,3 @@ -# FIXME: Currently disabled as it fails on some Linux hosts -# UNSUPPORTED: true - - ## Test that reconstructs a dSYM file from YAML and generates a gsym from it. The gsym has callsite info and merged functions. # RUN: split-file %s %t From 6ecedb05b0d320543968843159b1b29233b03fc7 Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Fri, 20 Dec 2024 16:06:20 -0800 Subject: [PATCH 050/466] [libc] Make a couple of math smoke tests more robust. (#120808) Make sure to clear out all FE_ALL_EXCEPT bits both before and after invoking function under test -- otherwise the very first check for the exception bits in the unit test may fail due to bits set prior to test invocation. --- libc/test/src/math/smoke/CanonicalizeTest.h | 1 + libc/test/src/math/smoke/FModTest.h | 1 + 2 files changed, 2 insertions(+) diff --git a/libc/test/src/math/smoke/CanonicalizeTest.h b/libc/test/src/math/smoke/CanonicalizeTest.h index ef75f568b8275..e500bc38f9852 100644 --- a/libc/test/src/math/smoke/CanonicalizeTest.h +++ b/libc/test/src/math/smoke/CanonicalizeTest.h @@ -19,6 +19,7 @@ #include "hdr/math_macros.h" #define TEST_SPECIAL(x, y, expected, expected_exception) \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_EQ(expected, f(&x, &y)); \ EXPECT_FP_EXCEPTION(expected_exception); \ LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT) diff --git a/libc/test/src/math/smoke/FModTest.h b/libc/test/src/math/smoke/FModTest.h index ad9688fc01e7c..8fbcc2a276542 100644 --- a/libc/test/src/math/smoke/FModTest.h +++ b/libc/test/src/math/smoke/FModTest.h @@ -18,6 +18,7 @@ #include "hdr/fenv_macros.h" #define TEST_SPECIAL(x, y, expected, dom_err, expected_exception) \ + LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT); \ EXPECT_FP_EQ(expected, f(x, y)); \ EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0); \ EXPECT_FP_EXCEPTION(expected_exception); \ From 44514316bd5ef656076b6baaf6bccb298d98f0ea Mon Sep 17 00:00:00 2001 From: Sergey Barannikov Date: Sat, 21 Dec 2024 03:16:17 +0300 Subject: [PATCH 051/466] [TableGen][GISel] Delete unused `Src` arguments (NFC) (#120445) The last uses were removed in #120332 and #120426. When emitting renderers, we shouldn't look at the source DAG at all. The required information is provided by the destination DAG and by the instructions referenced in that DAG. Sometimes, we do want to know if a result was referenced in the source DAG; this can be checked by calling `RuleMatcher::hasOperand`. Any other use of the source DAG when emitting renderers is likely an error. Pull Request: https://github.com/llvm/llvm-project/pull/120445 --- llvm/utils/TableGen/GlobalISelEmitter.cpp | 132 +++++++++++----------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index 715c29c4636ae..ca05c10ed81ae 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -393,12 +393,13 @@ class GlobalISelEmitter final : public GlobalISelMatchTableExecutorEmitter { bool OperandIsAPointer, bool OperandIsImmArg, unsigned OpIdx, unsigned &TempOpIdx); - Expected createAndImportInstructionRenderer( - RuleMatcher &M, InstructionMatcher &InsnMatcher, - const TreePatternNode &Src, const TreePatternNode &Dst); + Expected + createAndImportInstructionRenderer(RuleMatcher &M, + InstructionMatcher &InsnMatcher, + const TreePatternNode &Dst); Expected createAndImportSubInstructionRenderer( action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst, - const TreePatternNode &Src, unsigned TempReg); + unsigned TempReg); Expected createInstructionRenderer(action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst); @@ -406,15 +407,16 @@ class GlobalISelEmitter final : public GlobalISelMatchTableExecutorEmitter { Expected importExplicitDefRenderers(action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const TreePatternNode &Src, const TreePatternNode &Dst, unsigned Start = 0); - Expected importExplicitUseRenderers( - action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const llvm::TreePatternNode &Dst, const TreePatternNode &Src); - Expected importExplicitUseRenderer( - action_iterator InsertPt, RuleMatcher &Rule, BuildMIAction &DstMIBuilder, - const TreePatternNode &DstChild, const TreePatternNode &Src); + Expected + importExplicitUseRenderers(action_iterator InsertPt, RuleMatcher &M, + BuildMIAction &DstMIBuilder, + const TreePatternNode &Dst); + Expected + importExplicitUseRenderer(action_iterator InsertPt, RuleMatcher &Rule, + BuildMIAction &DstMIBuilder, + const TreePatternNode &Dst); Error importDefaultOperandRenderers(action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, const DAGDefaultOperand &DefaultOp) const; @@ -1196,23 +1198,22 @@ Error GlobalISelEmitter::importChildMatcher( Expected GlobalISelEmitter::importExplicitUseRenderer( action_iterator InsertPt, RuleMatcher &Rule, BuildMIAction &DstMIBuilder, - const TreePatternNode &DstChild, const TreePatternNode &Src) { + const TreePatternNode &Dst) { - const auto &SubOperand = Rule.getComplexSubOperand(DstChild.getName()); + const auto &SubOperand = Rule.getComplexSubOperand(Dst.getName()); if (SubOperand) { DstMIBuilder.addRenderer( - *std::get<0>(*SubOperand), DstChild.getName(), std::get<1>(*SubOperand), + *std::get<0>(*SubOperand), Dst.getName(), std::get<1>(*SubOperand), std::get<2>(*SubOperand)); return InsertPt; } - if (!DstChild.isLeaf()) { - if (DstChild.getOperator()->isSubClassOf("SDNodeXForm")) { - auto &Child = DstChild.getChild(0); - auto I = SDNodeXFormEquivs.find(DstChild.getOperator()); + if (!Dst.isLeaf()) { + if (Dst.getOperator()->isSubClassOf("SDNodeXForm")) { + auto &Child = Dst.getChild(0); + auto I = SDNodeXFormEquivs.find(Dst.getOperator()); if (I != SDNodeXFormEquivs.end()) { - const Record *XFormOpc = - DstChild.getOperator()->getValueAsDef("Opcode"); + const Record *XFormOpc = Dst.getOperator()->getValueAsDef("Opcode"); if (XFormOpc->getName() == "timm") { // If this is a TargetConstant, there won't be a corresponding // instruction to transform. Instead, this will refer directly to an @@ -1231,10 +1232,10 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( // We accept 'bb' here. It's an operator because BasicBlockSDNode isn't // inline, but in MI it's just another operand. - if (DstChild.getOperator()->isSubClassOf("SDNode")) { - auto &ChildSDNI = CGP.getSDNodeInfo(DstChild.getOperator()); + if (Dst.getOperator()->isSubClassOf("SDNode")) { + auto &ChildSDNI = CGP.getSDNodeInfo(Dst.getOperator()); if (ChildSDNI.getSDClassName() == "BasicBlockSDNode") { - DstMIBuilder.addRenderer(DstChild.getName()); + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } } @@ -1243,26 +1244,25 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( // rendered as operands. // FIXME: The target should be able to choose sign-extended when appropriate // (e.g. on Mips). - if (DstChild.getOperator()->getName() == "timm") { - DstMIBuilder.addRenderer(DstChild.getName()); + if (Dst.getOperator()->getName() == "timm") { + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } - if (DstChild.getOperator()->getName() == "tframeindex") { - DstMIBuilder.addRenderer(DstChild.getName()); + if (Dst.getOperator()->getName() == "tframeindex") { + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } - if (DstChild.getOperator()->getName() == "imm") { - DstMIBuilder.addRenderer(DstChild.getName()); + if (Dst.getOperator()->getName() == "imm") { + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } - if (DstChild.getOperator()->getName() == "fpimm") { - DstMIBuilder.addRenderer( - DstChild.getName()); + if (Dst.getOperator()->getName() == "fpimm") { + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } - if (DstChild.getOperator()->isSubClassOf("Instruction")) { - auto OpTy = getInstResultType(DstChild, Target); + if (Dst.getOperator()->isSubClassOf("Instruction")) { + auto OpTy = getInstResultType(Dst, Target); if (!OpTy) return OpTy.takeError(); @@ -1272,29 +1272,28 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( DstMIBuilder.addRenderer(TempRegID); auto InsertPtOrError = createAndImportSubInstructionRenderer( - ++InsertPt, Rule, DstChild, Src, TempRegID); + ++InsertPt, Rule, Dst, TempRegID); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); return InsertPtOrError.get(); } return failedImport("Dst pattern child isn't a leaf node or an MBB" + - llvm::to_string(DstChild)); + llvm::to_string(Dst)); } // It could be a specific immediate in which case we should just check for // that immediate. - if (const IntInit *ChildIntInit = - dyn_cast(DstChild.getLeafValue())) { + if (const IntInit *ChildIntInit = dyn_cast(Dst.getLeafValue())) { DstMIBuilder.addRenderer(ChildIntInit->getValue()); return InsertPt; } // Otherwise, we're looking for a bog-standard RegisterClass operand. - if (auto *ChildDefInit = dyn_cast(DstChild.getLeafValue())) { + if (auto *ChildDefInit = dyn_cast(Dst.getLeafValue())) { auto *ChildRec = ChildDefInit->getDef(); - ArrayRef ChildTypes = DstChild.getExtTypes(); + ArrayRef ChildTypes = Dst.getExtTypes(); if (ChildTypes.size() != 1) return failedImport("Dst pattern child has multiple results"); @@ -1315,11 +1314,11 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( if (ChildRec->isSubClassOf("RegisterOperand") && !ChildRec->isValueUnset("GIZeroRegister")) { DstMIBuilder.addRenderer( - DstChild.getName(), ChildRec->getValueAsDef("GIZeroRegister")); + Dst.getName(), ChildRec->getValueAsDef("GIZeroRegister")); return InsertPt; } - DstMIBuilder.addRenderer(DstChild.getName()); + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } @@ -1335,9 +1334,9 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( return failedImport( "SelectionDAG ComplexPattern not mapped to GlobalISel"); - const OperandMatcher &OM = Rule.getOperandMatcher(DstChild.getName()); + const OperandMatcher &OM = Rule.getOperandMatcher(Dst.getName()); DstMIBuilder.addRenderer( - *ComplexPattern->second, DstChild.getName(), + *ComplexPattern->second, Dst.getName(), OM.getAllocatedTemporariesBaseID()); return InsertPt; } @@ -1348,16 +1347,19 @@ Expected GlobalISelEmitter::importExplicitUseRenderer( // Handle the case where the MVT/register class is omitted in the dest pattern // but MVT exists in the source pattern. - if (isa(DstChild.getLeafValue()) && - Rule.hasOperand(DstChild.getName())) { - DstMIBuilder.addRenderer(DstChild.getName()); + if (isa(Dst.getLeafValue()) && Rule.hasOperand(Dst.getName())) { + DstMIBuilder.addRenderer(Dst.getName()); return InsertPt; } return failedImport("Dst pattern child is an unsupported kind"); } +/// Generates code that builds the resulting instruction(s) from the destination +/// DAG. Note that to do this we do not and should not need the source DAG. +/// We do need to know whether a generated instruction defines a result of the +/// source DAG; this information is available via RuleMatcher::hasOperand. Expected GlobalISelEmitter::createAndImportInstructionRenderer( - RuleMatcher &M, InstructionMatcher &InsnMatcher, const TreePatternNode &Src, + RuleMatcher &M, InstructionMatcher &InsnMatcher, const TreePatternNode &Dst) { auto InsertPtOrError = createInstructionRenderer(M.actions_end(), M, Dst); if (auto Error = InsertPtOrError.takeError()) @@ -1377,14 +1379,12 @@ Expected GlobalISelEmitter::createAndImportInstructionRenderer( CopyToPhysRegMIBuilder.addRenderer(PhysInput.first); } - if (auto Error = - importExplicitDefRenderers(InsertPt, M, DstMIBuilder, Src, Dst) - .takeError()) + if (auto Error = importExplicitDefRenderers(InsertPt, M, DstMIBuilder, Dst) + .takeError()) return std::move(Error); - if (auto Error = - importExplicitUseRenderers(InsertPt, M, DstMIBuilder, Dst, Src) - .takeError()) + if (auto Error = importExplicitUseRenderers(InsertPt, M, DstMIBuilder, Dst) + .takeError()) return std::move(Error); return DstMIBuilder; @@ -1392,8 +1392,8 @@ Expected GlobalISelEmitter::createAndImportInstructionRenderer( Expected GlobalISelEmitter::createAndImportSubInstructionRenderer( - const action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst, - const TreePatternNode &Src, unsigned TempRegID) { + action_iterator InsertPt, RuleMatcher &M, const TreePatternNode &Dst, + unsigned TempRegID) { auto InsertPtOrError = createInstructionRenderer(InsertPt, M, Dst); // TODO: Assert there's exactly one result. @@ -1408,13 +1408,13 @@ GlobalISelEmitter::createAndImportSubInstructionRenderer( DstMIBuilder.addRenderer(TempRegID, true); // Handle additional (ignored) results. - InsertPtOrError = importExplicitDefRenderers( - std::prev(*InsertPtOrError), M, DstMIBuilder, Src, Dst, /*Start=*/1); + InsertPtOrError = importExplicitDefRenderers(std::prev(*InsertPtOrError), M, + DstMIBuilder, Dst, /*Start=*/1); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); - InsertPtOrError = importExplicitUseRenderers(InsertPtOrError.get(), M, - DstMIBuilder, Dst, Src); + InsertPtOrError = + importExplicitUseRenderers(InsertPtOrError.get(), M, DstMIBuilder, Dst); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); @@ -1448,7 +1448,7 @@ Expected GlobalISelEmitter::createInstructionRenderer( Expected GlobalISelEmitter::importExplicitDefRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const TreePatternNode &Src, const TreePatternNode &Dst, unsigned Start) { + const TreePatternNode &Dst, unsigned Start) { const CodeGenInstruction *DstI = DstMIBuilder.getCGI(); // Some instructions have multiple defs, but are missing a type entry @@ -1497,7 +1497,7 @@ Expected GlobalISelEmitter::importExplicitDefRenderers( Expected GlobalISelEmitter::importExplicitUseRenderers( action_iterator InsertPt, RuleMatcher &M, BuildMIAction &DstMIBuilder, - const llvm::TreePatternNode &Dst, const llvm::TreePatternNode &Src) { + const TreePatternNode &Dst) { const CodeGenInstruction *DstI = DstMIBuilder.getCGI(); CodeGenInstruction *OrigDstI = &Target.getInstruction(Dst.getOperator()); @@ -1527,7 +1527,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( TempRegID); auto InsertPtOrError = createAndImportSubInstructionRenderer( - ++InsertPt, M, ValChild, Src, TempRegID); + ++InsertPt, M, ValChild, TempRegID); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); @@ -1585,7 +1585,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( CodeGenSubRegIndex *SubIdx = CGRegs.getSubRegIdx(SubRegInit->getDef()); auto InsertPtOrError = - importExplicitUseRenderer(InsertPt, M, DstMIBuilder, ValChild, Src); + importExplicitUseRenderer(InsertPt, M, DstMIBuilder, ValChild); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); InsertPt = InsertPtOrError.get(); @@ -1654,7 +1654,7 @@ Expected GlobalISelEmitter::importExplicitUseRenderers( } auto InsertPtOrError = importExplicitUseRenderer(InsertPt, M, DstMIBuilder, - Dst.getChild(Child), Src); + Dst.getChild(Child)); if (auto Error = InsertPtOrError.takeError()) return std::move(Error); InsertPt = InsertPtOrError.get(); @@ -2135,7 +2135,7 @@ Expected GlobalISelEmitter::runOnPattern(const PatternToMatch &P) { } auto DstMIBuilderOrError = - createAndImportInstructionRenderer(M, InsnMatcher, Src, Dst); + createAndImportInstructionRenderer(M, InsnMatcher, Dst); if (auto Error = DstMIBuilderOrError.takeError()) return std::move(Error); BuildMIAction &DstMIBuilder = DstMIBuilderOrError.get(); From 3bbd53ce97059718994cd17f3fd404654e9198cb Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 20 Dec 2024 19:34:05 -0600 Subject: [PATCH 052/466] [libc] Remove old RPC host call extension for GPU (#120800) Summary: This was originally a hacked together function that served to just implement some features for OpenMP. That has been moved into OpenMP itself now that we have exported RPC properly. This can now be deleted. --- libc/config/gpu/entrypoints.txt | 3 --- libc/config/gpu/headers.txt | 3 --- libc/hdrgen/yaml/gpu/rpc.yaml | 23 ----------------------- libc/include/CMakeLists.txt | 13 ------------- libc/include/gpu/rpc.h.def | 18 ------------------ libc/src/__support/RPC/CMakeLists.txt | 1 - 6 files changed, 61 deletions(-) delete mode 100644 libc/hdrgen/yaml/gpu/rpc.yaml delete mode 100644 libc/include/gpu/rpc.h.def diff --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt index 28317c656d4be..b008e0e6684fd 100644 --- a/libc/config/gpu/entrypoints.txt +++ b/libc/config/gpu/entrypoints.txt @@ -271,9 +271,6 @@ set(TARGET_LIBC_ENTRYPOINTS libc.src.locale.newlocale libc.src.locale.setlocale libc.src.locale.uselocale - - # gpu/rpc.h entrypoints - libc.src.gpu.rpc_host_call ) set(TARGET_LIBM_ENTRYPOINTS diff --git a/libc/config/gpu/headers.txt b/libc/config/gpu/headers.txt index adbd014fba6c1..fa8ad7c11ba8b 100644 --- a/libc/config/gpu/headers.txt +++ b/libc/config/gpu/headers.txt @@ -18,7 +18,4 @@ set(TARGET_PUBLIC_HEADERS libc.include.uchar libc.include.features libc.include.locale - - # Header for RPC extensions - libc.include.gpu_rpc ) diff --git a/libc/hdrgen/yaml/gpu/rpc.yaml b/libc/hdrgen/yaml/gpu/rpc.yaml deleted file mode 100644 index da4f6afb7856d..0000000000000 --- a/libc/hdrgen/yaml/gpu/rpc.yaml +++ /dev/null @@ -1,23 +0,0 @@ -header: gpu-rpc.h -macros: [] -types: [] -enums: [] -objects: [] -functions: - - name: rpc_fprintf - standards: - - GPUExtensions - return_type: int - arguments: - - type: ::FILE *__restrict - - type: const char *__restrict - - type: void * - - type: size_t - - name: rpc_host_call - standards: - - GPUExtensions - return_type: unsigned long long - arguments: - - type: void * - - type: void * - - type: size_t diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt index 18ce8e22d1a0a..3a05c01abba5a 100644 --- a/libc/include/CMakeLists.txt +++ b/libc/include/CMakeLists.txt @@ -750,19 +750,6 @@ add_header_macro( .llvm-libc-types.struct_lconv ) -if(LIBC_TARGET_OS_IS_GPU) - file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu) - - add_header_macro( - gpu_rpc - ../libc/hdrgen/yaml/gpu/rpc.yaml - gpu/rpc.h.def - gpu/rpc.h - DEPENDS - .llvm_libc_common_h - ) -endif() - if(NOT LLVM_LIBC_FULL_BUILD) # We don't install headers in non-fullbuild mode. return() diff --git a/libc/include/gpu/rpc.h.def b/libc/include/gpu/rpc.h.def deleted file mode 100644 index 060650345e1fb..0000000000000 --- a/libc/include/gpu/rpc.h.def +++ /dev/null @@ -1,18 +0,0 @@ -//===-- GPU header rpc.h --------------------------------------------------===// -// -// 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_LIBC_GPU_RPC_H -#define LLVM_LIBC_GPU_RPC_H - -#include "__llvm-libc-common.h" - -#include "../llvm-libc-types/rpc_opcodes_t.h" - -%%public_api() - -#endif // LLVM_LIBC_GPU_RPC_H diff --git a/libc/src/__support/RPC/CMakeLists.txt b/libc/src/__support/RPC/CMakeLists.txt index 0a7141fb60bf0..cac9c4e05e369 100644 --- a/libc/src/__support/RPC/CMakeLists.txt +++ b/libc/src/__support/RPC/CMakeLists.txt @@ -9,6 +9,5 @@ add_object_library( HDRS rpc_client.h DEPENDS - libc.include.gpu_rpc libc.src.__support.GPU.utils ) From a7cd660bd7351f95e538286b23d38224bc8a9bb4 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Sat, 21 Dec 2024 05:24:57 +0300 Subject: [PATCH 053/466] [TableGen][GISel] Learn to import patterns with optional defs (#120470) The number of skipped patterns reduces for ARM from 4278 to 4257. This is the only in-tree target that makes use of OptionalDefOperand. Pull Request: https://github.com/llvm/llvm-project/pull/120470 --- .../GlobalISelEmitter-optional-def.td | 56 +++++++++++++++++++ .../GlobalISel/GlobalISelMatchTable.cpp | 9 ++- .../Common/GlobalISel/GlobalISelMatchTable.h | 6 +- llvm/utils/TableGen/GlobalISelEmitter.cpp | 31 ++++++++-- 4 files changed, 91 insertions(+), 11 deletions(-) create mode 100644 llvm/test/TableGen/GlobalISelEmitter-optional-def.td diff --git a/llvm/test/TableGen/GlobalISelEmitter-optional-def.td b/llvm/test/TableGen/GlobalISelEmitter-optional-def.td new file mode 100644 index 0000000000000..def4a0447fe53 --- /dev/null +++ b/llvm/test/TableGen/GlobalISelEmitter-optional-def.td @@ -0,0 +1,56 @@ +// RUN: llvm-tblgen -gen-global-isel -warn-on-skipped-patterns \ +// RUN: -I %p/../../include -I %p/Common %s 2> %t | FileCheck %s +// RUN: FileCheck -DFILE=%s -check-prefix=ERR %s < %t + +include "llvm/Target/Target.td" +include "GlobalISelEmitterCommon.td" + +def cc_out : OptionalDefOperand; +def s_cc_out : OptionalDefOperand; + +// CHECK-LABEL: // (add:{ *:[i32] } i32:{ *:[i32] }:$rs1, i32:{ *:[i32] }:$rs2) => (tst2:{ *:[i32] } i32:{ *:[i32] }:$rs1, i32:{ *:[i32] }:$rs2) +// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(MyTarget::tst2), +// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // DstI[rd] +// CHECK-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::B0), /*AddRegisterRegFlags*/GIMT_Encode2(RegState::Define | RegState::Dead), +// CHECK-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::F0), /*AddRegisterRegFlags*/GIMT_Encode2(RegState::Define | RegState::Dead), +// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/1, // rs1 +// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/2, // rs2 +// CHECK-NEXT: GIR_RootConstrainSelectedInstOperands, +// CHECK-NEXT: // GIR_Coverage, 1, +// CHECK-NEXT: GIR_EraseRootFromParent_Done, + +// CHECK-LABEL: // (imm:{ *:[i32] }):$imm => (tst1:{ *:[i32] } (imm:{ *:[i32] }):$imm) +// CHECK-NEXT: GIR_BuildRootMI, /*Opcode*/GIMT_Encode2(MyTarget::tst1), +// CHECK-NEXT: GIR_RootToRootCopy, /*OpIdx*/0, // DstI[rd] +// CHECK-NEXT: GIR_AddRegister, /*InsnID*/0, GIMT_Encode2(MyTarget::NoRegister), /*AddRegisterRegFlags*/GIMT_Encode2(RegState::Define | RegState::Dead), +// CHECK-NEXT: GIR_CopyConstantAsSImm, /*NewInsnID*/0, /*OldInsnID*/0, // imm +// CHECK-NEXT: GIR_RootConstrainSelectedInstOperands, +// CHECK-NEXT: // GIR_Coverage, 0, +// CHECK-NEXT: GIR_EraseRootFromParent_Done, + +def tst1 : I<(outs GPR32:$rd, cc_out:$s), (ins i32imm:$imm), + [(set GPR32:$rd, imm:$imm)]>; + +def tst2 : I<(outs GPR32:$rd, s_cc_out:$s), (ins GPR32:$rs1, GPR32:$rs2), + [(set GPR32:$rd, (add i32:$rs1, i32:$rs2))]>; + +// TODO: There should be more tests, but any attempt to write something +// more complex results in tablegen crashing somewhere in +// TreePatternNode::UpdateNodeType. + + +def not_leaf : OptionalDefOperand; +def not_rec : OptionalDefOperand; +def not_reg : OptionalDefOperand; + +// ERR: [[#@LINE+1]]:5: warning: Skipped pattern: optional def is not a leaf +def tst_not_leaf : I<(outs GPR32:$rd, not_leaf:$s), (ins i32imm:$imm), + [(set GPR32:$rd, imm:$imm)]>; + +// ERR: [[#@LINE+1]]:5: warning: Skipped pattern: optional def is not a record +def tst_not_rec : I<(outs GPR32:$rd, not_rec:$s), (ins i32imm:$imm), + [(set GPR32:$rd, imm:$imm)]>; + +// ERR: [[#@LINE+1]]:5: warning: Skipped pattern: optional def is not a register +def tst_not_reg : I<(outs GPR32:$rd, not_reg:$s), (ins i32imm:$imm), + [(set GPR32:$rd, imm:$imm)]>; diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp index 15ec7e17130de..619e7a4790c88 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp @@ -1993,10 +1993,13 @@ void AddRegisterRenderer::emitRenderOpcodes(MatchTable &Table, // TODO: This is encoded as a 64-bit element, but only 16 or 32-bits are // really needed for a physical register reference. We can pack the // register and flags in a single field. - if (IsDef) - Table << MatchTable::NamedValue(2, "RegState::Define"); - else + if (IsDef) { + Table << MatchTable::NamedValue( + 2, IsDead ? "RegState::Define | RegState::Dead" : "RegState::Define"); + } else { + assert(!IsDead && "A use cannot be dead"); Table << MatchTable::IntValue(2, 0); + } Table << MatchTable::LineBreak; } diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h index 00fe073057c5c..48ce71be677c0 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h @@ -2091,13 +2091,15 @@ class AddRegisterRenderer : public OperandRenderer { unsigned InsnID; const Record *RegisterDef; bool IsDef; + bool IsDead; const CodeGenTarget &Target; public: AddRegisterRenderer(unsigned InsnID, const CodeGenTarget &Target, - const Record *RegisterDef, bool IsDef = false) + const Record *RegisterDef, bool IsDef = false, + bool IsDead = false) : OperandRenderer(OR_Register), InsnID(InsnID), RegisterDef(RegisterDef), - IsDef(IsDef), Target(Target) {} + IsDef(IsDef), IsDead(IsDead), Target(Target) {} static bool classof(const OperandRenderer *R) { return R->getKind() == OR_Register; diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp index ca05c10ed81ae..3f504b73465d2 100644 --- a/llvm/utils/TableGen/GlobalISelEmitter.cpp +++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp @@ -1451,14 +1451,10 @@ Expected GlobalISelEmitter::importExplicitDefRenderers( const TreePatternNode &Dst, unsigned Start) { const CodeGenInstruction *DstI = DstMIBuilder.getCGI(); - // Some instructions have multiple defs, but are missing a type entry - // (e.g. s_cc_out operands). - if (Dst.getExtTypes().size() < DstI->Operands.NumDefs) - return failedImport("unhandled discarded def"); - // Process explicit defs. The caller may have already handled the first def. for (unsigned I = Start, E = DstI->Operands.NumDefs; I != E; ++I) { - std::string OpName = getMangledRootDefName(DstI->Operands[I].Name); + const CGIOperandList::OperandInfo &OpInfo = DstI->Operands[I]; + std::string OpName = getMangledRootDefName(OpInfo.Name); // If the def is used in the source DAG, forward it. if (M.hasOperand(OpName)) { @@ -1469,6 +1465,29 @@ Expected GlobalISelEmitter::importExplicitDefRenderers( continue; } + // A discarded explicit def may be an optional physical register. + // If this is the case, add the default register and mark it as dead. + if (OpInfo.Rec->isSubClassOf("OptionalDefOperand")) { + for (const TreePatternNode &DefaultOp : + make_pointee_range(CGP.getDefaultOperand(OpInfo.Rec).DefaultOps)) { + // TODO: Do these checks in ParseDefaultOperands. + if (!DefaultOp.isLeaf()) + return failedImport("optional def is not a leaf"); + + const auto *RegDI = dyn_cast(DefaultOp.getLeafValue()); + if (!RegDI) + return failedImport("optional def is not a record"); + + const Record *Reg = RegDI->getDef(); + if (!Reg->isSubClassOf("Register") && Reg->getName() != "zero_reg") + return failedImport("optional def is not a register"); + + DstMIBuilder.addRenderer( + Target, Reg, /*IsDef=*/true, /*IsDead=*/true); + } + continue; + } + // The def is discarded, create a dead virtual register for it. const TypeSetByHwMode &ExtTy = Dst.getExtType(I); if (!ExtTy.isMachineValueType()) From 9ae92d70561bcc95a7f818920238e764253d9758 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Sat, 21 Dec 2024 05:29:51 +0300 Subject: [PATCH 054/466] [SelectionDAG] Virtualize isTargetStrictFPOpcode / isTargetMemoryOpcode (#119969) With this change, targets are no longer required to put memory / strict-fp opcodes after special `ISD::FIRST_TARGET_MEMORY_OPCODE`/`ISD::FIRST_TARGET_STRICTFP_OPCODE` markers. This will also allow autogenerating `isTargetMemoryOpcode`/`isTargetStrictFPOpcode (#119709). Pull Request: https://github.com/llvm/llvm-project/pull/119969 --- llvm/include/llvm/CodeGen/ISDOpcodes.h | 11 ------ llvm/include/llvm/CodeGen/SelectionDAG.h | 4 +- llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 29 ++------------- .../llvm/CodeGen/SelectionDAGTargetInfo.h | 13 +++++++ .../lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 12 +++--- .../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 7 +++- .../SelectionDAG/SelectionDAGTargetInfo.cpp | 6 +++ llvm/lib/Target/AArch64/AArch64ISelLowering.h | 8 +++- .../AArch64/AArch64SelectionDAGInfo.cpp | 10 +++++ .../Target/AArch64/AArch64SelectionDAGInfo.h | 4 ++ llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 1 - llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h | 6 ++- .../Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp | 6 +++ .../Target/AMDGPU/AMDGPUSelectionDAGInfo.h | 2 + llvm/lib/Target/ARM/ARMISelLowering.h | 6 ++- llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp | 5 +++ llvm/lib/Target/ARM/ARMSelectionDAGInfo.h | 2 + llvm/lib/Target/Mips/MipsISelLowering.h | 6 ++- llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp | 6 +++ llvm/lib/Target/Mips/MipsSelectionDAGInfo.h | 2 + llvm/lib/Target/NVPTX/NVPTXISelLowering.h | 4 +- .../Target/NVPTX/NVPTXSelectionDAGInfo.cpp | 6 +++ llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h | 2 + llvm/lib/Target/PowerPC/PPCISelLowering.h | 23 ++++++------ .../Target/PowerPC/PPCSelectionDAGInfo.cpp | 11 ++++++ llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h | 4 ++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp | 37 +++++++++---------- llvm/lib/Target/RISCV/RISCVISelLowering.h | 13 +++---- .../Target/RISCV/RISCVSelectionDAGInfo.cpp | 11 ++++++ llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h | 4 ++ llvm/lib/Target/SystemZ/SystemZISelLowering.h | 10 +++-- .../SystemZ/SystemZSelectionDAGInfo.cpp | 10 +++++ .../Target/SystemZ/SystemZSelectionDAGInfo.h | 4 ++ .../lib/Target/WebAssembly/WebAssemblyISD.def | 8 ++-- .../WebAssembly/WebAssemblyISelLowering.cpp | 3 -- .../WebAssembly/WebAssemblyISelLowering.h | 8 ---- .../WebAssemblySelectionDAGInfo.cpp | 12 ++++++ .../WebAssembly/WebAssemblySelectionDAGInfo.h | 3 ++ llvm/lib/Target/X86/X86ISelLowering.cpp | 8 +++- llvm/lib/Target/X86/X86ISelLowering.h | 15 +++----- llvm/lib/Target/X86/X86SelectionDAGInfo.cpp | 10 +++++ llvm/lib/Target/X86/X86SelectionDAGInfo.h | 4 ++ 42 files changed, 234 insertions(+), 122 deletions(-) diff --git a/llvm/include/llvm/CodeGen/ISDOpcodes.h b/llvm/include/llvm/CodeGen/ISDOpcodes.h index 0b6d155b6d161..69820aed2137b 100644 --- a/llvm/include/llvm/CodeGen/ISDOpcodes.h +++ b/llvm/include/llvm/CodeGen/ISDOpcodes.h @@ -1490,17 +1490,6 @@ enum NodeType { BUILTIN_OP_END }; -/// FIRST_TARGET_STRICTFP_OPCODE - Target-specific pre-isel operations -/// which cannot raise FP exceptions should be less than this value. -/// Those that do must not be less than this value. -static const int FIRST_TARGET_STRICTFP_OPCODE = BUILTIN_OP_END + 400; - -/// FIRST_TARGET_MEMORY_OPCODE - Target-specific pre-isel operations -/// which do not reference a specific memory location should be less than -/// this value. Those that do must not be less than this value, and can -/// be used with SelectionDAG::getMemIntrinsicNode. -static const int FIRST_TARGET_MEMORY_OPCODE = BUILTIN_OP_END + 500; - /// Whether this is bitwise logic opcode. inline bool isBitwiseLogicOp(unsigned Opcode) { return Opcode == ISD::AND || Opcode == ISD::OR || Opcode == ISD::XOR; diff --git a/llvm/include/llvm/CodeGen/SelectionDAG.h b/llvm/include/llvm/CodeGen/SelectionDAG.h index d63e1c559122b..ff7caec41855f 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAG.h +++ b/llvm/include/llvm/CodeGen/SelectionDAG.h @@ -1330,8 +1330,8 @@ class SelectionDAG { /// Creates a MemIntrinsicNode that may produce a /// result and takes a list of operands. Opcode may be INTRINSIC_VOID, - /// INTRINSIC_W_CHAIN, or a target-specific opcode with a value not - /// less than FIRST_TARGET_MEMORY_OPCODE. + /// INTRINSIC_W_CHAIN, or a target-specific memory-referencing opcode + // (see `SelectionDAGTargetInfo::isTargetMemoryOpcode`). SDValue getMemIntrinsicNode( unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef Ops, EVT MemVT, MachinePointerInfo PtrInfo, Align Alignment, diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index 5e2440c1b57e3..03899493847b3 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h @@ -210,7 +210,6 @@ class SDValue { inline const SDValue &getOperand(unsigned i) const; inline uint64_t getConstantOperandVal(unsigned i) const; inline const APInt &getConstantOperandAPInt(unsigned i) const; - inline bool isTargetMemoryOpcode() const; inline bool isTargetOpcode() const; inline bool isMachineOpcode() const; inline bool isUndef() const; @@ -691,22 +690,6 @@ END_TWO_BYTE_PACK() /// \ISD namespace). bool isTargetOpcode() const { return NodeType >= ISD::BUILTIN_OP_END; } - /// Test if this node has a target-specific opcode that may raise - /// FP exceptions (in the \ISD namespace and greater than - /// FIRST_TARGET_STRICTFP_OPCODE). Note that all target memory - /// opcode are currently automatically considered to possibly raise - /// FP exceptions as well. - bool isTargetStrictFPOpcode() const { - return NodeType >= ISD::FIRST_TARGET_STRICTFP_OPCODE; - } - - /// Test if this node has a target-specific - /// memory-referencing opcode (in the \ISD namespace and - /// greater than FIRST_TARGET_MEMORY_OPCODE). - bool isTargetMemoryOpcode() const { - return NodeType >= ISD::FIRST_TARGET_MEMORY_OPCODE; - } - /// Return true if the type of the node type undefined. bool isUndef() const { return NodeType == ISD::UNDEF; } @@ -1255,10 +1238,6 @@ inline bool SDValue::isTargetOpcode() const { return Node->isTargetOpcode(); } -inline bool SDValue::isTargetMemoryOpcode() const { - return Node->isTargetMemoryOpcode(); -} - inline bool SDValue::isMachineOpcode() const { return Node->isMachineOpcode(); } @@ -1615,10 +1594,10 @@ class AtomicSDNode : public MemSDNode { } }; -/// This SDNode is used for target intrinsics that touch -/// memory and need an associated MachineMemOperand. Its opcode may be -/// INTRINSIC_VOID, INTRINSIC_W_CHAIN, PREFETCH, or a target-specific opcode -/// with a value not less than FIRST_TARGET_MEMORY_OPCODE. +/// This SDNode is used for target intrinsics that touch memory and need +/// an associated MachineMemOperand. Its opcode may be INTRINSIC_VOID, +/// INTRINSIC_W_CHAIN, PREFETCH, or a target-specific memory-referencing +/// opcode (see `SelectionDAGTargetInfo::isTargetMemoryOpcode`). class MemIntrinsicSDNode : public MemSDNode { public: MemIntrinsicSDNode(unsigned Opc, unsigned Order, const DebugLoc &dl, diff --git a/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h b/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h index 720c9463867c3..ef5ae5dba58de 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h +++ b/llvm/include/llvm/CodeGen/SelectionDAGTargetInfo.h @@ -35,6 +35,19 @@ class SelectionDAGTargetInfo { SelectionDAGTargetInfo &operator=(const SelectionDAGTargetInfo &) = delete; virtual ~SelectionDAGTargetInfo(); + /// Returns true if a node with the given target-specific opcode has + /// a memory operand. Nodes with such opcodes can only be created with + /// `SelectionDAG::getMemIntrinsicNode`. + virtual bool isTargetMemoryOpcode(unsigned Opcode) const { return false; } + + /// Returns true if a node with the given target-specific opcode has + /// strict floating-point semantics. + virtual bool isTargetStrictFPOpcode(unsigned Opcode) const { return false; } + + /// Returns true if a node with the given target-specific opcode + /// may raise a floating-point exception. + virtual bool mayRaiseFPException(unsigned Opcode) const; + /// Emit target-specific code that performs a memcpy. /// This can be used by targets to provide code sequences for cases /// that don't fit the target's parameters for simple loads/stores and can be diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 20119537b631f..10e8ba93359fb 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -9040,12 +9040,12 @@ SDValue SelectionDAG::getMemIntrinsicNode(unsigned Opcode, const SDLoc &dl, SDVTList VTList, ArrayRef Ops, EVT MemVT, MachineMemOperand *MMO) { - assert((Opcode == ISD::INTRINSIC_VOID || - Opcode == ISD::INTRINSIC_W_CHAIN || - Opcode == ISD::PREFETCH || - (Opcode <= (unsigned)std::numeric_limits::max() && - (int)Opcode >= ISD::FIRST_TARGET_MEMORY_OPCODE)) && - "Opcode is not a memory-accessing opcode!"); + assert( + (Opcode == ISD::INTRINSIC_VOID || Opcode == ISD::INTRINSIC_W_CHAIN || + Opcode == ISD::PREFETCH || + (Opcode <= (unsigned)std::numeric_limits::max() && + Opcode >= ISD::BUILTIN_OP_END && TSI->isTargetMemoryOpcode(Opcode))) && + "Opcode is not a memory-accessing opcode!"); // Memoize the node unless it returns a glue result. MemIntrinsicSDNode *N; diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index c1dabe05452fb..d64a90bcaae7d 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -51,6 +51,7 @@ #include "llvm/CodeGen/SchedulerRegistry.h" #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/SelectionDAGNodes.h" +#include "llvm/CodeGen/SelectionDAGTargetInfo.h" #include "llvm/CodeGen/StackMaps.h" #include "llvm/CodeGen/StackProtector.h" #include "llvm/CodeGen/SwiftErrorValueTracking.h" @@ -4382,8 +4383,10 @@ bool SelectionDAGISel::mayRaiseFPException(SDNode *N) const { // For ISD opcodes, only StrictFP opcodes may raise an FP // exception. - if (N->isTargetOpcode()) - return N->isTargetStrictFPOpcode(); + if (N->isTargetOpcode()) { + const SelectionDAGTargetInfo &TSI = CurDAG->getSelectionDAGInfo(); + return TSI.mayRaiseFPException(N->getOpcode()); + } return N->isStrictFPOpcode(); } diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGTargetInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGTargetInfo.cpp index 3a2df6f60593a..0f3b36658f10a 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGTargetInfo.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGTargetInfo.cpp @@ -15,3 +15,9 @@ using namespace llvm; SelectionDAGTargetInfo::~SelectionDAGTargetInfo() = default; + +bool SelectionDAGTargetInfo::mayRaiseFPException(unsigned Opcode) const { + // FIXME: All target memory opcodes are currently automatically considered + // to possibly raise FP exceptions. See rev. 63336795. + return isTargetStrictFPOpcode(Opcode) || isTargetMemoryOpcode(Opcode); +} diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.h b/llvm/lib/Target/AArch64/AArch64ISelLowering.h index 4ab8e0103fa2c..36d62ca69ca08 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.h +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.h @@ -477,11 +477,14 @@ enum NodeType : unsigned { MSRR, // Strict (exception-raising) floating point comparison - STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE, + FIRST_STRICTFP_OPCODE, + STRICT_FCMP = FIRST_STRICTFP_OPCODE, STRICT_FCMPE, + LAST_STRICTFP_OPCODE = STRICT_FCMPE, // NEON Load/Store with post-increment base updates - LD2post = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + LD2post = FIRST_MEMORY_OPCODE, LD3post, LD4post, ST2post, @@ -516,6 +519,7 @@ enum NodeType : unsigned { STP, STILP, STNP, + LAST_MEMORY_OPCODE = STNP, // SME ZA loads and stores SME_ZA_LDR, diff --git a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp index c4d60a0cb4a11..17adda15d9fc8 100644 --- a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp @@ -23,6 +23,16 @@ static cl::opt "to lower to librt functions"), cl::init(true)); +bool AArch64SelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= AArch64ISD::FIRST_MEMORY_OPCODE && + Opcode <= AArch64ISD::LAST_MEMORY_OPCODE; +} + +bool AArch64SelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const { + return Opcode >= AArch64ISD::FIRST_STRICTFP_OPCODE && + Opcode <= AArch64ISD::LAST_STRICTFP_OPCODE; +} + SDValue AArch64SelectionDAGInfo::EmitMOPS(unsigned Opcode, SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue SrcOrValue, diff --git a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h index 9d1f2e9cba846..7efe49c720655 100644 --- a/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h +++ b/llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.h @@ -19,6 +19,10 @@ namespace llvm { class AArch64SelectionDAGInfo : public SelectionDAGTargetInfo { public: + bool isTargetMemoryOpcode(unsigned Opcode) const override; + + bool isTargetStrictFPOpcode(unsigned Opcode) const override; + SDValue EmitMOPS(unsigned Opcode, SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue SrcOrValue, SDValue Size, Align Alignment, bool isVolatile, diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index a716d185e392a..cca9fa72d0ca5 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -5555,7 +5555,6 @@ const char* AMDGPUTargetLowering::getTargetNodeName(unsigned Opcode) const { NODE_NAME_CASE(PC_ADD_REL_OFFSET) NODE_NAME_CASE(LDS) NODE_NAME_CASE(DUMMY_CHAIN) - case AMDGPUISD::FIRST_MEM_OPCODE_NUMBER: break; NODE_NAME_CASE(LOAD_D16_HI) NODE_NAME_CASE(LOAD_D16_LO) NODE_NAME_CASE(LOAD_D16_HI_I8) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h index 33991239a4120..c74dc7942f52c 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -546,8 +546,9 @@ enum NodeType : unsigned { LDS, DUMMY_CHAIN, - FIRST_MEM_OPCODE_NUMBER = ISD::FIRST_TARGET_MEMORY_OPCODE, - LOAD_D16_HI, + + FIRST_MEMORY_OPCODE, + LOAD_D16_HI = FIRST_MEMORY_OPCODE, LOAD_D16_LO, LOAD_D16_HI_I8, LOAD_D16_HI_U8, @@ -603,6 +604,7 @@ enum NodeType : unsigned { BUFFER_ATOMIC_FMIN, BUFFER_ATOMIC_FMAX, BUFFER_ATOMIC_COND_SUB_U32, + LAST_MEMORY_OPCODE = BUFFER_ATOMIC_COND_SUB_U32, }; } // End namespace AMDGPUISD diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp index 7bc651504e36d..2941a48c78d94 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.cpp @@ -7,7 +7,13 @@ //===----------------------------------------------------------------------===// #include "AMDGPUSelectionDAGInfo.h" +#include "AMDGPUISelLowering.h" using namespace llvm; AMDGPUSelectionDAGInfo::~AMDGPUSelectionDAGInfo() = default; + +bool AMDGPUSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= AMDGPUISD::FIRST_MEMORY_OPCODE && + Opcode <= AMDGPUISD::LAST_MEMORY_OPCODE; +} diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.h b/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.h index bb11a56da5259..3280be73b2fdf 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUSelectionDAGInfo.h @@ -16,6 +16,8 @@ namespace llvm { class AMDGPUSelectionDAGInfo : public SelectionDAGTargetInfo { public: ~AMDGPUSelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; }; } // namespace llvm diff --git a/llvm/lib/Target/ARM/ARMISelLowering.h b/llvm/lib/Target/ARM/ARMISelLowering.h index 49416e2c8b25e..3c1a414af8597 100644 --- a/llvm/lib/Target/ARM/ARMISelLowering.h +++ b/llvm/lib/Target/ARM/ARMISelLowering.h @@ -321,7 +321,8 @@ class VectorType; CSINC, // Conditional select increment. // Vector load N-element structure to all lanes: - VLD1DUP = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + VLD1DUP = FIRST_MEMORY_OPCODE, VLD2DUP, VLD3DUP, VLD4DUP, @@ -356,7 +357,8 @@ class VectorType; // Load/Store of dual registers LDRD, - STRD + STRD, + LAST_MEMORY_OPCODE = STRD, }; } // end namespace ARMISD diff --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp index e7ea10ff971a0..a39487c318f8e 100644 --- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp +++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp @@ -30,6 +30,11 @@ cl::opt EnableMemtransferTPLoop( "Allow (may be subject to certain conditions) " "conversion of memcpy to TP loop."))); +bool ARMSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= ARMISD::FIRST_MEMORY_OPCODE && + Opcode <= ARMISD::LAST_MEMORY_OPCODE; +} + // Emit, if possible, a specialized version of the given Libcall. Typically this // means selecting the appropriately aligned version, but we also convert memset // of 0 into memclr. diff --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.h b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.h index 275b1c0f8dc01..d68150e66567c 100644 --- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.h +++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.h @@ -37,6 +37,8 @@ namespace ARM_AM { class ARMSelectionDAGInfo : public SelectionDAGTargetInfo { public: + bool isTargetMemoryOpcode(unsigned Opcode) const override; + SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, diff --git a/llvm/lib/Target/Mips/MipsISelLowering.h b/llvm/lib/Target/Mips/MipsISelLowering.h index e245c056de649..655a347679ad7 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.h +++ b/llvm/lib/Target/Mips/MipsISelLowering.h @@ -247,14 +247,16 @@ class TargetRegisterClass; DOUBLE_SELECT_I64, // Load/Store Left/Right nodes. - LWL = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + LWL = FIRST_MEMORY_OPCODE, LWR, SWL, SWR, LDL, LDR, SDL, - SDR + SDR, + LAST_MEMORY_OPCODE = SDR, }; } // ene namespace MipsISD diff --git a/llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp b/llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp index c24107bf63943..6497ac5bb2df6 100644 --- a/llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp +++ b/llvm/lib/Target/Mips/MipsSelectionDAGInfo.cpp @@ -7,7 +7,13 @@ //===----------------------------------------------------------------------===// #include "MipsSelectionDAGInfo.h" +#include "MipsISelLowering.h" using namespace llvm; MipsSelectionDAGInfo::~MipsSelectionDAGInfo() = default; + +bool MipsSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= MipsISD::FIRST_MEMORY_OPCODE && + Opcode <= MipsISD::LAST_MEMORY_OPCODE; +} diff --git a/llvm/lib/Target/Mips/MipsSelectionDAGInfo.h b/llvm/lib/Target/Mips/MipsSelectionDAGInfo.h index bccd924a30e71..934cd2e056595 100644 --- a/llvm/lib/Target/Mips/MipsSelectionDAGInfo.h +++ b/llvm/lib/Target/Mips/MipsSelectionDAGInfo.h @@ -16,6 +16,8 @@ namespace llvm { class MipsSelectionDAGInfo : public SelectionDAGTargetInfo { public: ~MipsSelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; }; } // namespace llvm diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.h b/llvm/lib/Target/NVPTX/NVPTXISelLowering.h index 0244a0c5bec9d..4a98fe21b81dc 100644 --- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.h +++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.h @@ -70,7 +70,8 @@ enum NodeType : unsigned { BrxEnd, Dummy, - LoadV2 = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + LoadV2 = FIRST_MEMORY_OPCODE, LoadV4, LDUV2, // LDU.v2 LDUV4, // LDU.v4 @@ -87,6 +88,7 @@ enum NodeType : unsigned { StoreRetval, StoreRetvalV2, StoreRetvalV4, + LAST_MEMORY_OPCODE = StoreRetvalV4, }; } diff --git a/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.cpp index 9c26f310bbf65..d2035c6f8166f 100644 --- a/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.cpp @@ -7,7 +7,13 @@ //===----------------------------------------------------------------------===// #include "NVPTXSelectionDAGInfo.h" +#include "NVPTXISelLowering.h" using namespace llvm; NVPTXSelectionDAGInfo::~NVPTXSelectionDAGInfo() = default; + +bool NVPTXSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= NVPTXISD::FIRST_MEMORY_OPCODE && + Opcode <= NVPTXISD::LAST_MEMORY_OPCODE; +} diff --git a/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h b/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h index 6b04d78ca9687..9d69f48026c79 100644 --- a/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h +++ b/llvm/lib/Target/NVPTX/NVPTXSelectionDAGInfo.h @@ -16,6 +16,8 @@ namespace llvm { class NVPTXSelectionDAGInfo : public SelectionDAGTargetInfo { public: ~NVPTXSelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; }; } // namespace llvm diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h index 8f41fc107a691..5d692e3fcae92 100644 --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -36,14 +36,11 @@ namespace llvm { namespace PPCISD { - // When adding a NEW PPCISD node please add it to the correct position in - // the enum. The order of elements in this enum matters! - // Values that are added after this entry: - // STBRX = ISD::FIRST_TARGET_MEMORY_OPCODE - // are considered memory opcodes and are treated differently than entries - // that come before it. For example, ADD or MUL should be placed before - // the ISD::FIRST_TARGET_MEMORY_OPCODE while a LOAD or STORE should come - // after it. + // When adding a NEW PPCISD node please add it to the correct position in + // the enum. The order of elements in this enum matters! + // Values that are added between FIRST_MEMORY_OPCODE and LAST_MEMORY_OPCODE + // are considered memory opcodes and are treated differently than other + // entries. enum NodeType : unsigned { // Start the numbering where the builtin ops and target ops leave off. FIRST_NUMBER = ISD::BUILTIN_OP_END, @@ -487,7 +484,8 @@ namespace llvm { XXMFACC, // Constrained conversion from floating point to int - STRICT_FCTIDZ = ISD::FIRST_TARGET_STRICTFP_OPCODE, + FIRST_STRICTFP_OPCODE, + STRICT_FCTIDZ = FIRST_STRICTFP_OPCODE, STRICT_FCTIWZ, STRICT_FCTIDUZ, STRICT_FCTIWUZ, @@ -500,6 +498,7 @@ namespace llvm { /// Constrained floating point add in round-to-zero mode. STRICT_FADDRTZ, + LAST_STRICTFP_OPCODE = STRICT_FADDRTZ, /// SETBC - The ISA 3.1 (P10) SETBC instruction. SETBC, @@ -516,7 +515,8 @@ namespace llvm { /// byte-swapping store instruction. It byte-swaps the low "Type" bits of /// the GPRC input, then stores it through Ptr. Type can be either i16 or /// i32. - STBRX = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + STBRX = FIRST_MEMORY_OPCODE, /// GPRC, CHAIN = LBRX CHAIN, Ptr, Type - This is a /// byte-swapping load instruction. It loads "Type" bits, byte swaps it, @@ -607,7 +607,8 @@ namespace llvm { /// GPRC = TOC_ENTRY GA, TOC /// Loads the entry for GA from the TOC, where the TOC base is given by /// the last operand. - TOC_ENTRY + TOC_ENTRY, + LAST_MEMORY_OPCODE = TOC_ENTRY, }; } // end namespace PPCISD diff --git a/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp b/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp index 211aaff3cfa0e..95de9f39b86e8 100644 --- a/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp @@ -7,7 +7,18 @@ //===----------------------------------------------------------------------===// #include "PPCSelectionDAGInfo.h" +#include "PPCISelLowering.h" using namespace llvm; PPCSelectionDAGInfo::~PPCSelectionDAGInfo() = default; + +bool PPCSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= PPCISD::FIRST_MEMORY_OPCODE && + Opcode <= PPCISD::LAST_MEMORY_OPCODE; +} + +bool PPCSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const { + return Opcode >= PPCISD::FIRST_STRICTFP_OPCODE && + Opcode <= PPCISD::LAST_STRICTFP_OPCODE; +} diff --git a/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h b/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h index cc14e9b0a6904..08e2ddbf1c4ca 100644 --- a/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h +++ b/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.h @@ -16,6 +16,10 @@ namespace llvm { class PPCSelectionDAGInfo : public SelectionDAGTargetInfo { public: ~PPCSelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; + + bool isTargetStrictFPOpcode(unsigned Opcode) const override; }; } // namespace llvm diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp index ea8814aa2b4fc..04dd23d9cdaa2 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -17,6 +17,7 @@ #include "RISCVConstantPoolValue.h" #include "RISCVMachineFunctionInfo.h" #include "RISCVRegisterInfo.h" +#include "RISCVSelectionDAGInfo.h" #include "RISCVSubtarget.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" @@ -6394,14 +6395,12 @@ static unsigned getRISCVVLOp(SDValue Op) { /// Return true if a RISC-V target specified op has a passthru operand. static bool hasPassthruOp(unsigned Opcode) { assert(Opcode > RISCVISD::FIRST_NUMBER && - Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE && + Opcode <= RISCVISD::LAST_STRICTFP_OPCODE && "not a RISC-V target specific op"); - static_assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == - 127 && - RISCVISD::LAST_RISCV_STRICTFP_OPCODE - - ISD::FIRST_TARGET_STRICTFP_OPCODE == - 21 && - "adding target specific op should update this function"); + static_assert( + RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == 127 && + RISCVISD::LAST_STRICTFP_OPCODE - RISCVISD::FIRST_STRICTFP_OPCODE == 21 && + "adding target specific op should update this function"); if (Opcode >= RISCVISD::ADD_VL && Opcode <= RISCVISD::VFMAX_VL) return true; if (Opcode == RISCVISD::FCOPYSIGN_VL) @@ -6420,14 +6419,12 @@ static bool hasPassthruOp(unsigned Opcode) { /// Return true if a RISC-V target specified op has a mask operand. static bool hasMaskOp(unsigned Opcode) { assert(Opcode > RISCVISD::FIRST_NUMBER && - Opcode <= RISCVISD::LAST_RISCV_STRICTFP_OPCODE && + Opcode <= RISCVISD::LAST_STRICTFP_OPCODE && "not a RISC-V target specific op"); - static_assert(RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == - 127 && - RISCVISD::LAST_RISCV_STRICTFP_OPCODE - - ISD::FIRST_TARGET_STRICTFP_OPCODE == - 21 && - "adding target specific op should update this function"); + static_assert( + RISCVISD::LAST_VL_VECTOR_OP - RISCVISD::FIRST_VL_VECTOR_OP == 127 && + RISCVISD::LAST_STRICTFP_OPCODE - RISCVISD::FIRST_STRICTFP_OPCODE == 21 && + "adding target specific op should update this function"); if (Opcode >= RISCVISD::TRUNCATE_VECTOR_VL && Opcode <= RISCVISD::SETCC_VL) return true; if (Opcode >= RISCVISD::VRGATHER_VX_VL && Opcode <= RISCVISD::VFIRST_VL) @@ -15980,7 +15977,7 @@ static SDValue performFP_TO_INTCombine(SDNode *N, SDValue Src = N->getOperand(0); // Don't do this for strict-fp Src. - if (Src->isStrictFPOpcode() || Src->isTargetStrictFPOpcode()) + if (Src->isStrictFPOpcode()) return SDValue(); // Ensure the FP type is legal. @@ -16085,7 +16082,7 @@ static SDValue performFP_TO_INT_SATCombine(SDNode *N, SDValue Src = N->getOperand(0); // Don't do this for strict-fp Src. - if (Src->isStrictFPOpcode() || Src->isTargetStrictFPOpcode()) + if (Src->isStrictFPOpcode()) return SDValue(); // Ensure the FP type is also legal. @@ -16193,7 +16190,9 @@ static unsigned negateFMAOpcode(unsigned Opcode, bool NegMul, bool NegAcc) { static SDValue combineVFMADD_VLWithVFNEG_VL(SDNode *N, SelectionDAG &DAG) { // Fold FNEG_VL into FMA opcodes. // The first operand of strict-fp is chain. - unsigned Offset = N->isTargetStrictFPOpcode(); + bool IsStrict = + DAG.getSelectionDAGInfo().isTargetStrictFPOpcode(N->getOpcode()); + unsigned Offset = IsStrict ? 1 : 0; SDValue A = N->getOperand(0 + Offset); SDValue B = N->getOperand(1 + Offset); SDValue C = N->getOperand(2 + Offset); @@ -16220,7 +16219,7 @@ static SDValue combineVFMADD_VLWithVFNEG_VL(SDNode *N, SelectionDAG &DAG) { return SDValue(); unsigned NewOpcode = negateFMAOpcode(N->getOpcode(), NegA != NegB, NegC); - if (N->isTargetStrictFPOpcode()) + if (IsStrict) return DAG.getNode(NewOpcode, SDLoc(N), N->getVTList(), {N->getOperand(0), A, B, C, Mask, VL}); return DAG.getNode(NewOpcode, SDLoc(N), N->getValueType(0), A, B, C, Mask, @@ -16236,7 +16235,7 @@ static SDValue performVFMADD_VLCombine(SDNode *N, return V; // FIXME: Ignore strict opcodes for now. - if (N->isTargetStrictFPOpcode()) + if (DAG.getSelectionDAGInfo().isTargetStrictFPOpcode(N->getOpcode())) return SDValue(); return combineOp_VLToVWOp_VL(N, DCI, Subtarget); diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.h b/llvm/lib/Target/RISCV/RISCVISelLowering.h index 4c78fd784a3c8..ea077c7d2d23a 100644 --- a/llvm/lib/Target/RISCV/RISCVISelLowering.h +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.h @@ -467,7 +467,8 @@ enum NodeType : unsigned { // FP to 32 bit int conversions for RV64. These are used to keep track of the // result being sign extended to 64 bit. These saturate out of range inputs. - STRICT_FCVT_W_RV64 = ISD::FIRST_TARGET_STRICTFP_OPCODE, + FIRST_STRICTFP_OPCODE, + STRICT_FCVT_W_RV64 = FIRST_STRICTFP_OPCODE, STRICT_FCVT_WU_RV64, STRICT_FADD_VL, STRICT_FSUB_VL, @@ -489,17 +490,15 @@ enum NodeType : unsigned { STRICT_FSETCC_VL, STRICT_FSETCCS_VL, STRICT_VFROUND_NOEXCEPT_VL, - LAST_RISCV_STRICTFP_OPCODE = STRICT_VFROUND_NOEXCEPT_VL, + LAST_STRICTFP_OPCODE = STRICT_VFROUND_NOEXCEPT_VL, - // WARNING: Do not add anything in the end unless you want the node to - // have memop! In fact, starting from FIRST_TARGET_MEMORY_OPCODE all - // opcodes will be thought as target memory ops! - - TH_LWD = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + TH_LWD = FIRST_MEMORY_OPCODE, TH_LWUD, TH_LDD, TH_SWD, TH_SDD, + LAST_MEMORY_OPCODE = TH_SDD, }; // clang-format on } // namespace RISCVISD diff --git a/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp b/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp index 19d6138609a2b..ab1ade89a76d1 100644 --- a/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.cpp @@ -7,7 +7,18 @@ //===----------------------------------------------------------------------===// #include "RISCVSelectionDAGInfo.h" +#include "RISCVISelLowering.h" using namespace llvm; RISCVSelectionDAGInfo::~RISCVSelectionDAGInfo() = default; + +bool RISCVSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= RISCVISD::FIRST_MEMORY_OPCODE && + Opcode <= RISCVISD::LAST_MEMORY_OPCODE; +} + +bool RISCVSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const { + return Opcode >= RISCVISD::FIRST_STRICTFP_OPCODE && + Opcode <= RISCVISD::LAST_STRICTFP_OPCODE; +} diff --git a/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h b/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h index 7543d8b493ceb..6977d8507a960 100644 --- a/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h +++ b/llvm/lib/Target/RISCV/RISCVSelectionDAGInfo.h @@ -16,6 +16,10 @@ namespace llvm { class RISCVSelectionDAGInfo : public SelectionDAGTargetInfo { public: ~RISCVSelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; + + bool isTargetStrictFPOpcode(unsigned Opcode) const override; }; } // namespace llvm diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h index 0a899e861c73b..d663e4abfb4e3 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h +++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h @@ -307,7 +307,8 @@ enum NodeType : unsigned { // Strict variants of scalar floating-point comparisons. // Quiet and signaling versions. - STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE, + FIRST_STRICTFP_OPCODE, + STRICT_FCMP = FIRST_STRICTFP_OPCODE, STRICT_FCMPS, // Strict variants of vector floating-point comparisons. @@ -322,6 +323,7 @@ enum NodeType : unsigned { // Strict variants of VEXTEND and VROUND. STRICT_VEXTEND, STRICT_VROUND, + LAST_STRICTFP_OPCODE = STRICT_VROUND, // Wrappers around the inner loop of an 8- or 16-bit ATOMIC_SWAP or // ATOMIC_LOAD_. @@ -333,7 +335,8 @@ enum NodeType : unsigned { // operand into the high bits // Operand 3: the negative of operand 2, for rotating the other way // Operand 4: the width of the field in bits (8 or 16) - ATOMIC_SWAPW = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + ATOMIC_SWAPW = FIRST_MEMORY_OPCODE, ATOMIC_LOADW_ADD, ATOMIC_LOADW_SUB, ATOMIC_LOADW_AND, @@ -384,7 +387,8 @@ enum NodeType : unsigned { // Prefetch from the second operand using the 4-bit control code in // the first operand. The code is 1 for a load prefetch and 2 for // a store prefetch. - PREFETCH + PREFETCH, + LAST_MEMORY_OPCODE = PREFETCH, }; // Return true if OPCODE is some kind of PC-relative address. diff --git a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp index c182c9890509f..d76babec73dd4 100644 --- a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp @@ -17,6 +17,16 @@ using namespace llvm; #define DEBUG_TYPE "systemz-selectiondag-info" +bool SystemZSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= SystemZISD::FIRST_MEMORY_OPCODE && + Opcode <= SystemZISD::LAST_MEMORY_OPCODE; +} + +bool SystemZSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const { + return Opcode >= SystemZISD::FIRST_STRICTFP_OPCODE && + Opcode <= SystemZISD::LAST_STRICTFP_OPCODE; +} + static unsigned getMemMemLenAdj(unsigned Op) { return Op == SystemZISD::MEMSET_MVC ? 2 : 1; } diff --git a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.h b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.h index 6ac5bf8c6c1a3..c928f343e5710 100644 --- a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.h +++ b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.h @@ -21,6 +21,10 @@ class SystemZSelectionDAGInfo : public SelectionDAGTargetInfo { public: explicit SystemZSelectionDAGInfo() = default; + bool isTargetMemoryOpcode(unsigned Opcode) const override; + + bool isTargetStrictFPOpcode(unsigned Opcode) const override; + SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def index 3502c47016c6b..1cf0d13df1ff6 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISD.def +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISD.def @@ -48,10 +48,10 @@ HANDLE_NODETYPE(I64_MUL_WIDE_S) HANDLE_NODETYPE(I64_MUL_WIDE_U) // Memory intrinsics -HANDLE_MEM_NODETYPE(GLOBAL_GET) -HANDLE_MEM_NODETYPE(GLOBAL_SET) -HANDLE_MEM_NODETYPE(TABLE_GET) -HANDLE_MEM_NODETYPE(TABLE_SET) +HANDLE_NODETYPE(GLOBAL_GET) +HANDLE_NODETYPE(GLOBAL_SET) +HANDLE_NODETYPE(TABLE_GET) +HANDLE_NODETYPE(TABLE_SET) // Bulk memory instructions. These follow LLVM's expected semantics of // supporting out-of-bounds pointers if the length is zero, by inserting diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 7712570869ff6..084aed6eed46d 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -871,14 +871,11 @@ const char * WebAssemblyTargetLowering::getTargetNodeName(unsigned Opcode) const { switch (static_cast(Opcode)) { case WebAssemblyISD::FIRST_NUMBER: - case WebAssemblyISD::FIRST_MEM_OPCODE: break; #define HANDLE_NODETYPE(NODE) \ case WebAssemblyISD::NODE: \ return "WebAssemblyISD::" #NODE; -#define HANDLE_MEM_NODETYPE(NODE) HANDLE_NODETYPE(NODE) #include "WebAssemblyISD.def" -#undef HANDLE_MEM_NODETYPE #undef HANDLE_NODETYPE } return nullptr; diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h index 82b33b6d1933d..454432728ca87 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.h @@ -24,16 +24,8 @@ namespace WebAssemblyISD { enum NodeType : unsigned { FIRST_NUMBER = ISD::BUILTIN_OP_END, #define HANDLE_NODETYPE(NODE) NODE, -#define HANDLE_MEM_NODETYPE(NODE) #include "WebAssemblyISD.def" - FIRST_MEM_OPCODE = ISD::FIRST_TARGET_MEMORY_OPCODE, #undef HANDLE_NODETYPE -#undef HANDLE_MEM_NODETYPE -#define HANDLE_NODETYPE(NODE) -#define HANDLE_MEM_NODETYPE(NODE) NODE, -#include "WebAssemblyISD.def" -#undef HANDLE_NODETYPE -#undef HANDLE_MEM_NODETYPE }; } // end namespace WebAssemblyISD diff --git a/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp b/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp index 6f37dab409534..2673c81eae40b 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.cpp @@ -18,6 +18,18 @@ using namespace llvm; WebAssemblySelectionDAGInfo::~WebAssemblySelectionDAGInfo() = default; // anchor +bool WebAssemblySelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + switch (static_cast(Opcode)) { + default: + return false; + case WebAssemblyISD::GLOBAL_GET: + case WebAssemblyISD::GLOBAL_SET: + case WebAssemblyISD::TABLE_GET: + case WebAssemblyISD::TABLE_SET: + return true; + } +} + SDValue WebAssemblySelectionDAGInfo::EmitTargetCodeForMemcpy( SelectionDAG &DAG, const SDLoc &DL, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, bool IsVolatile, bool AlwaysInline, diff --git a/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.h b/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.h index fd517b238715b..69c9af0966308 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.h +++ b/llvm/lib/Target/WebAssembly/WebAssemblySelectionDAGInfo.h @@ -22,6 +22,9 @@ namespace llvm { class WebAssemblySelectionDAGInfo final : public SelectionDAGTargetInfo { public: ~WebAssemblySelectionDAGInfo() override; + + bool isTargetMemoryOpcode(unsigned Opcode) const override; + SDValue EmitTargetCodeForMemcpy(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2, SDValue Op3, Align Alignment, bool isVolatile, diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 2528ca553d3e9..b50e0c60fadb6 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -54481,7 +54481,8 @@ static SDValue combineX86INT_TO_FP(SDNode *N, SelectionDAG &DAG, static SDValue combineCVTP2I_CVTTP2I(SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI) { - bool IsStrict = N->isTargetStrictFPOpcode(); + const SelectionDAGTargetInfo &TSI = DAG.getSelectionDAGInfo(); + bool IsStrict = TSI.isTargetStrictFPOpcode(N->getOpcode()); EVT VT = N->getValueType(0); // Convert a full vector load into vzload when not all bits are needed. @@ -55102,7 +55103,10 @@ static SDValue combineFMA(SDNode *N, SelectionDAG &DAG, const X86Subtarget &Subtarget) { SDLoc dl(N); EVT VT = N->getValueType(0); - bool IsStrict = N->isStrictFPOpcode() || N->isTargetStrictFPOpcode(); + const SelectionDAGTargetInfo &TSI = DAG.getSelectionDAGInfo(); + bool IsStrict = N->isTargetOpcode() + ? TSI.isTargetStrictFPOpcode(N->getOpcode()) + : N->isStrictFPOpcode(); // Let legalize expand this if it isn't a legal type yet. const TargetLowering &TLI = DAG.getTargetLoweringInfo(); diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index d154ee9745b97..2b7a8eaf249d8 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -809,7 +809,8 @@ namespace llvm { CTEST, /// X86 strict FP compare instructions. - STRICT_FCMP = ISD::FIRST_TARGET_STRICTFP_OPCODE, + FIRST_STRICTFP_OPCODE, + STRICT_FCMP = FIRST_STRICTFP_OPCODE, STRICT_FCMPS, // Vector packed double/float comparison. @@ -853,12 +854,11 @@ namespace llvm { /// Floating point max and min. STRICT_FMAX, STRICT_FMIN, - - // WARNING: Only add nodes here if they are strict FP nodes. Non-memory and - // non-strict FP nodes should be above FIRST_TARGET_STRICTFP_OPCODE. + LAST_STRICTFP_OPCODE = STRICT_FMIN, // Compare and swap. - LCMPXCHG_DAG = ISD::FIRST_TARGET_MEMORY_OPCODE, + FIRST_MEMORY_OPCODE, + LCMPXCHG_DAG = FIRST_MEMORY_OPCODE, LCMPXCHG8_DAG, LCMPXCHG16_DAG, LCMPXCHG16_SAVE_RBX_DAG, @@ -979,10 +979,7 @@ namespace llvm { // Conditional load/store instructions CLOAD, CSTORE, - - // WARNING: Do not add anything in the end unless you want the node to - // have memop! In fact, starting from FIRST_TARGET_MEMORY_OPCODE all - // opcodes will be thought as target memory ops! + LAST_MEMORY_OPCODE = CSTORE, }; } // end namespace X86ISD diff --git a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp index 3f88bcf9ce5ec..aba62c36546f9 100644 --- a/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp +++ b/llvm/lib/Target/X86/X86SelectionDAGInfo.cpp @@ -27,6 +27,16 @@ static cl::opt UseFSRMForMemcpy("x86-use-fsrm-for-memcpy", cl::Hidden, cl::init(false), cl::desc("Use fast short rep mov in memcpy lowering")); +bool X86SelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const { + return Opcode >= X86ISD::FIRST_MEMORY_OPCODE && + Opcode <= X86ISD::LAST_MEMORY_OPCODE; +} + +bool X86SelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const { + return Opcode >= X86ISD::FIRST_STRICTFP_OPCODE && + Opcode <= X86ISD::LAST_STRICTFP_OPCODE; +} + /// Returns the best type to use with repmovs/repstos depending on alignment. static MVT getOptimalRepType(const X86Subtarget &Subtarget, Align Alignment) { uint64_t Align = Alignment.value(); diff --git a/llvm/lib/Target/X86/X86SelectionDAGInfo.h b/llvm/lib/Target/X86/X86SelectionDAGInfo.h index 19136ca4f6f58..e77e16bab830d 100644 --- a/llvm/lib/Target/X86/X86SelectionDAGInfo.h +++ b/llvm/lib/Target/X86/X86SelectionDAGInfo.h @@ -26,6 +26,10 @@ class X86SelectionDAGInfo : public SelectionDAGTargetInfo { public: explicit X86SelectionDAGInfo() = default; + bool isTargetMemoryOpcode(unsigned Opcode) const override; + + bool isTargetStrictFPOpcode(unsigned Opcode) const override; + SDValue EmitTargetCodeForMemset(SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src, SDValue Size, Align Alignment, From d328d410613963359c4044292cfca99388d01023 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sat, 21 Dec 2024 12:08:33 +0900 Subject: [PATCH 055/466] Revert "Add a pass to collect dropped var stats for MIR (#120780)" This reverts commit 3bf91ad2a9c75dd045961e45fdd830fd7b7a5455. (llvmorg-20-init-16123-g3bf91ad2a9c7) `llvm/CodeGen` should not depend on `llvm/Passes`. --- .../llvm/CodeGen/DroppedVariableStatsMIR.h | 70 -- .../llvm/CodeGen/MachineFunctionPass.h | 2 - llvm/lib/CodeGen/CMakeLists.txt | 1 - llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp | 77 -- llvm/lib/CodeGen/MachineFunctionPass.cpp | 15 +- llvm/unittests/CodeGen/CMakeLists.txt | 1 - .../CodeGen/DroppedVariableStatsMIRTest.cpp | 1080 ----------------- 7 files changed, 1 insertion(+), 1245 deletions(-) delete mode 100644 llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h delete mode 100644 llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp delete mode 100644 llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp diff --git a/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h b/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h deleted file mode 100644 index 462bbb8b404bc..0000000000000 --- a/llvm/include/llvm/CodeGen/DroppedVariableStatsMIR.h +++ /dev/null @@ -1,70 +0,0 @@ -///===- DroppedVariableStatsMIR.h - Opt Diagnostics -*- 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 -/// -///===---------------------------------------------------------------------===// -/// \file -/// Dropped Variable Statistics for Debug Information. Reports any number -/// of DBG_VALUEs that get dropped due to an optimization pass. -/// -///===---------------------------------------------------------------------===// - -#ifndef LLVM_CODEGEN_DROPPEDVARIABLESTATSMIR_H -#define LLVM_CODEGEN_DROPPEDVARIABLESTATSMIR_H - -#include "llvm/CodeGen/MachineFunction.h" -#include "llvm/Passes/DroppedVariableStats.h" - -namespace llvm { - -/// A class to collect and print dropped debug information due to MIR -/// optimization passes. After every MIR pass is run, it will print how many -/// #DBG_VALUEs were dropped due to that pass. -class DroppedVariableStatsMIR : public DroppedVariableStats { -public: - DroppedVariableStatsMIR() : llvm::DroppedVariableStats(false) {} - - void runBeforePass(StringRef PassID, MachineFunction *MF) { - if (PassID == "Debug Variable Analysis") - return; - setup(); - return runOnMachineFunction(MF, true); - } - - void runAfterPass(StringRef PassID, MachineFunction *MF) { - if (PassID == "Debug Variable Analysis") - return; - runOnMachineFunction(MF, false); - calculateDroppedVarStatsOnMachineFunction(MF, PassID, MF->getName().str()); - cleanup(); - } - -private: - const MachineFunction *MFunc; - /// Populate DebugVariablesBefore, DebugVariablesAfter, InlinedAts before or - /// after a pass has run to facilitate dropped variable calculation for an - /// llvm::MachineFunction. - void runOnMachineFunction(const MachineFunction *MF, bool Before); - /// Iterate over all Instructions in a MachineFunction and report any dropped - /// debug information. - void calculateDroppedVarStatsOnMachineFunction(const MachineFunction *MF, - StringRef PassID, - StringRef FuncOrModName); - /// Override base class method to run on an llvm::MachineFunction - /// specifically. - virtual void - visitEveryInstruction(unsigned &DroppedCount, - DenseMap &InlinedAtsMap, - VarID Var) override; - /// Override base class method to run on DBG_VALUEs specifically. - virtual void visitEveryDebugRecord( - DenseSet &VarIDSet, - DenseMap> &InlinedAtsMap, - StringRef FuncName, bool Before) override; -}; - -} // namespace llvm - -#endif diff --git a/llvm/include/llvm/CodeGen/MachineFunctionPass.h b/llvm/include/llvm/CodeGen/MachineFunctionPass.h index 8d7e4192003d2..caaf22c2139e3 100644 --- a/llvm/include/llvm/CodeGen/MachineFunctionPass.h +++ b/llvm/include/llvm/CodeGen/MachineFunctionPass.h @@ -18,7 +18,6 @@ #ifndef LLVM_CODEGEN_MACHINEFUNCTIONPASS_H #define LLVM_CODEGEN_MACHINEFUNCTIONPASS_H -#include "llvm/CodeGen/DroppedVariableStatsMIR.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Pass.h" @@ -68,7 +67,6 @@ class MachineFunctionPass : public FunctionPass { MachineFunctionProperties RequiredProperties; MachineFunctionProperties SetProperties; MachineFunctionProperties ClearedProperties; - DroppedVariableStatsMIR DroppedVarStatsMF; /// createPrinterPass - Get a machine function printer pass. Pass *createPrinterPass(raw_ostream &O, diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt index b8cefcc1acd22..145fd2fac8b56 100644 --- a/llvm/lib/CodeGen/CMakeLists.txt +++ b/llvm/lib/CodeGen/CMakeLists.txt @@ -50,7 +50,6 @@ add_llvm_component_library(LLVMCodeGen DeadMachineInstructionElim.cpp DetectDeadLanes.cpp DFAPacketizer.cpp - DroppedVariableStatsMIR.cpp DwarfEHPrepare.cpp EarlyIfConversion.cpp EdgeBundles.cpp diff --git a/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp b/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp deleted file mode 100644 index 4379db8b16679..0000000000000 --- a/llvm/lib/CodeGen/DroppedVariableStatsMIR.cpp +++ /dev/null @@ -1,77 +0,0 @@ -///===- DroppedVariableStatsMIR.cpp ---------------------------------------===// -/// -/// Part of the LLVM Project, under the Apache License v2.0 with LLVM -/// Exceptions. See https://llvm.org/LICENSE.txt for license information. -/// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -/// -///===---------------------------------------------------------------------===// -/// \file -/// Dropped Variable Statistics for Debug Information. Reports any number -/// of DBG_VALUEs that get dropped due to an optimization pass. -/// -///===---------------------------------------------------------------------===// - -#include "llvm/CodeGen/DroppedVariableStatsMIR.h" - -using namespace llvm; - -void DroppedVariableStatsMIR::runOnMachineFunction(const MachineFunction *MF, - bool Before) { - auto &DebugVariables = DebugVariablesStack.back()[&MF->getFunction()]; - auto FuncName = MF->getName(); - MFunc = MF; - run(DebugVariables, FuncName, Before); -} - -void DroppedVariableStatsMIR::calculateDroppedVarStatsOnMachineFunction( - const MachineFunction *MF, StringRef PassID, StringRef FuncOrModName) { - MFunc = MF; - StringRef FuncName = MF->getName(); - const Function *Func = &MF->getFunction(); - DebugVariables &DbgVariables = DebugVariablesStack.back()[Func]; - calculateDroppedStatsAndPrint(DbgVariables, FuncName, PassID, FuncOrModName, - "MachineFunction", Func); -} - -void DroppedVariableStatsMIR::visitEveryInstruction( - unsigned &DroppedCount, DenseMap &InlinedAtsMap, - VarID Var) { - unsigned PrevDroppedCount = DroppedCount; - const DIScope *DbgValScope = std::get<0>(Var); - for (const auto &MBB : *MFunc) { - for (const auto &MI : MBB) { - if (!MI.isDebugInstr()) { - auto *DbgLoc = MI.getDebugLoc().get(); - if (!DbgLoc) - continue; - - auto *Scope = DbgLoc->getScope(); - if (updateDroppedCount(DbgLoc, Scope, DbgValScope, InlinedAtsMap, Var, - DroppedCount)) - break; - } - } - if (PrevDroppedCount != DroppedCount) { - PrevDroppedCount = DroppedCount; - break; - } - } -} - -void DroppedVariableStatsMIR::visitEveryDebugRecord( - DenseSet &VarIDSet, - DenseMap> &InlinedAtsMap, - StringRef FuncName, bool Before) { - for (const auto &MBB : *MFunc) { - for (const auto &MI : MBB) { - if (MI.isDebugValueLike()) { - auto *DbgVar = MI.getDebugVariable(); - if (!DbgVar) - continue; - auto DbgLoc = MI.getDebugLoc(); - populateVarIDSetAndInlinedMap(DbgVar, DbgLoc, VarIDSet, InlinedAtsMap, - FuncName, Before); - } - } - } -} \ No newline at end of file diff --git a/llvm/lib/CodeGen/MachineFunctionPass.cpp b/llvm/lib/CodeGen/MachineFunctionPass.cpp index e803811643f87..62ac3e32d24d9 100644 --- a/llvm/lib/CodeGen/MachineFunctionPass.cpp +++ b/llvm/lib/CodeGen/MachineFunctionPass.cpp @@ -32,11 +32,6 @@ using namespace llvm; using namespace ore; -static cl::opt DroppedVarStatsMIR( - "dropped-variable-stats-mir", cl::Hidden, - cl::desc("Dump dropped debug variables stats for MIR passes"), - cl::init(false)); - Pass *MachineFunctionPass::createPrinterPass(raw_ostream &O, const std::string &Banner) const { return createMachineFunctionPrinterPass(O, Banner); @@ -96,15 +91,7 @@ bool MachineFunctionPass::runOnFunction(Function &F) { MFProps.reset(ClearedProperties); - bool RV; - if (DroppedVarStatsMIR) { - auto PassName = getPassName(); - DroppedVarStatsMF.runBeforePass(PassName, &MF); - RV = runOnMachineFunction(MF); - DroppedVarStatsMF.runAfterPass(PassName, &MF); - } else { - RV = runOnMachineFunction(MF); - } + bool RV = runOnMachineFunction(MF); if (ShouldEmitSizeRemarks) { // We wanted size remarks. Check if there was a change to the number of diff --git a/llvm/unittests/CodeGen/CMakeLists.txt b/llvm/unittests/CodeGen/CMakeLists.txt index 4f580e7539f4d..963cdcc0275e1 100644 --- a/llvm/unittests/CodeGen/CMakeLists.txt +++ b/llvm/unittests/CodeGen/CMakeLists.txt @@ -27,7 +27,6 @@ add_llvm_unittest(CodeGenTests CCStateTest.cpp DIEHashTest.cpp DIETest.cpp - DroppedVariableStatsMIRTest.cpp DwarfStringPoolEntryRefTest.cpp InstrRefLDVTest.cpp LowLevelTypeTest.cpp diff --git a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp b/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp deleted file mode 100644 index b3d6da575f3ba..0000000000000 --- a/llvm/unittests/CodeGen/DroppedVariableStatsMIRTest.cpp +++ /dev/null @@ -1,1080 +0,0 @@ -//===- unittests/CodeGen/DroppedVariableStatsMIRTest.cpp ------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGen/DroppedVariableStatsMIR.h" -#include "llvm/AsmParser/Parser.h" -#include "llvm/CodeGen/MIRParser/MIRParser.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/IR/Function.h" -#include "llvm/IR/LegacyPassManager.h" -#include "llvm/IR/Module.h" -#include "llvm/MC/TargetRegistry.h" -#include "llvm/Pass.h" -#include "llvm/Support/TargetSelect.h" -#include "llvm/Target/TargetMachine.h" -#include "gtest/gtest.h" -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace llvm; - -namespace { - -std::unique_ptr -createTargetMachine(std::string TT, StringRef CPU, StringRef FS) { - std::string Error; - const Target *T = TargetRegistry::lookupTarget(TT, Error); - if (!T) - return nullptr; - TargetOptions Options; - return std::unique_ptr( - static_cast(T->createTargetMachine( - TT, CPU, FS, Options, std::nullopt, std::nullopt))); -} - -std::unique_ptr parseMIR(const TargetMachine &TM, StringRef MIRCode, - MachineModuleInfo &MMI, LLVMContext *Context) { - SMDiagnostic Diagnostic; - std::unique_ptr M; - std::unique_ptr MBuffer = MemoryBuffer::getMemBuffer(MIRCode); - auto MIR = createMIRParser(std::move(MBuffer), *Context); - if (!MIR) - return nullptr; - - std::unique_ptr Mod = MIR->parseIRModule(); - if (!Mod) - return nullptr; - - Mod->setDataLayout(TM.createDataLayout()); - - if (MIR->parseMachineFunctions(*Mod, MMI)) { - M.reset(); - return nullptr; - } - return Mod; -} -// This test ensures that if a DBG_VALUE and an instruction that exists in the -// same scope as that DBG_VALUE are both deleted as a result of an optimization -// pass, debug information is considered not dropped. -TEST(DroppedVariableStatsMIR, BothDeleted) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4) - !12 = !DILocation(line: 2, column: 11, scope: !4) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - for (auto &MI : MBB) { - auto *DbgLoc = MI.getDebugLoc().get(); - if (DbgLoc) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), false); -} - -// This test ensures that if a DBG_VALUE is dropped after an optimization pass, -// but an instruction that shares the same scope as the DBG_VALUE still exists, -// debug information is conisdered dropped. -TEST(DroppedVariableStatsMIR, DbgValLost) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4) - !12 = !DILocation(line: 2, column: 11, scope: !4) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), true); -} - -// This test ensures that if a #dbg_value is dropped after an optimization pass, -// but an instruction that has an unrelated scope as the #dbg_value still -// exists, debug information is conisdered not dropped. -TEST(DroppedVariableStatsMIR, UnrelatedScopes) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4) - !12 = !DILocation(line: 2, column: 11, scope: !13) - !13 = distinct !DISubprogram(name: "bar", linkageName: "_Z3bari", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), false); -} - -// This test ensures that if a #dbg_value is dropped after an optimization pass, -// but an instruction that has a scope which is a child of the #dbg_value scope -// still exists, debug information is conisdered dropped. -TEST(DroppedVariableStatsMIR, ChildScopes) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4) - !12 = !DILocation(line: 2, column: 11, scope: !13) - !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), true); -} - -// This test ensures that if a DBG_VALUE is dropped after an optimization pass, -// but an instruction that has a scope which is a child of the DBG_VALUE scope -// still exists, and the DBG_VALUE is inlined at another location, debug -// information is conisdered not dropped. -TEST(DroppedVariableStatsMIR, InlinedAt) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) - !12 = !DILocation(line: 2, column: 11, scope: !13) - !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) - !14 = !DILocation(line: 3, column: 2, scope: !4) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), false); -} - -// This test ensures that if a DBG_VALUE is dropped after an optimization pass, -// but an instruction that has a scope which is a child of the DBG_VALUE scope -// still exists, and the DBG_VALUE and the instruction are inlined at another -// location, debug information is conisdered dropped. -TEST(DroppedVariableStatsMIR, InlinedAtShared) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) - !12 = !DILocation(line: 2, column: 11, scope: !13, inlinedAt: !14) - !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) - !14 = !DILocation(line: 3, column: 2, scope: !4) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), true); -} - -// This test ensures that if a DBG_VALUE is dropped after an optimization pass, -// but an instruction that has a scope which is a child of the DBG_VALUE scope -// still exists, and the instruction is inlined at a location that is the -// DBG_VALUE's inlined at location, debug information is conisdered dropped. -TEST(DroppedVariableStatsMIR, InlinedAtChild) { - InitializeAllTargetInfos(); - InitializeAllTargets(); - InitializeAllTargetMCs(); - PassInstrumentationCallbacks PIC; - PassInstrumentation PI(&PIC); - - LLVMContext C; - - const char *MIR = - R"( ---- | - ; ModuleID = '/tmp/test.ll' - source_filename = "/tmp/test.ll" - target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32" - - define noundef range(i32 -2147483647, -2147483648) i32 @_Z3fooi(i32 noundef %x) local_unnamed_addr !dbg !4 { - entry: - #dbg_value(i32 %x, !10, !DIExpression(), !11) - %add = add nsw i32 %x, 1, !dbg !12 - ret i32 0 - } - - !llvm.dbg.cu = !{!0} - !llvm.module.flags = !{!2} - !llvm.ident = !{!3} - - !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/") - !1 = !DIFile(filename: "/tmp/code.cpp", directory: "/") - !2 = !{i32 2, !"Debug Info Version", i32 3} - !3 = !{!"clang"} - !4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooi", scope: !5, file: !5, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !9) - !5 = !DIFile(filename: "/tmp/code.cpp", directory: "") - !6 = !DISubroutineType(types: !7) - !7 = !{!8, !8} - !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) - !9 = !{!10} - !10 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 1, type: !8) - !11 = !DILocation(line: 0, scope: !4, inlinedAt: !14) - !12 = !DILocation(line: 2, column: 11, scope: !13, inlinedAt: !15) - !13 = distinct !DILexicalBlock(scope: !4, file: !5, line: 10, column: 28) - !14 = !DILocation(line: 3, column: 2, scope: !4) - !15 = !DILocation(line: 4, column: 5, scope: !13, inlinedAt: !14) - -... ---- -name: _Z3fooi -alignment: 4 -exposesReturnsTwice: false -legalized: false -regBankSelected: false -selected: false -failedISel: false -tracksRegLiveness: true -hasWinCFI: false -noPhis: false -isSSA: true -noVRegs: false -hasFakeUses: false -callsEHReturn: false -callsUnwindInit: false -hasEHCatchret: false -hasEHScopes: false -hasEHFunclets: false -isOutlined: false -debugInstrRef: false -failsVerification: false -tracksDebugUserValues: false -registers: - - { id: 0, class: _, preferred-register: '', flags: [ ] } - - { id: 1, class: _, preferred-register: '', flags: [ ] } - - { id: 2, class: _, preferred-register: '', flags: [ ] } - - { id: 3, class: _, preferred-register: '', flags: [ ] } -liveins: - - { reg: '$w0', virtual-reg: '' } -frameInfo: - isFrameAddressTaken: false - isReturnAddressTaken: false - hasStackMap: false - hasPatchPoint: false - stackSize: 0 - offsetAdjustment: 0 - maxAlignment: 1 - adjustsStack: false - hasCalls: false - stackProtector: '' - functionContext: '' - maxCallFrameSize: 4294967295 - cvBytesOfCalleeSavedRegisters: 0 - hasOpaqueSPAdjustment: false - hasVAStart: false - hasMustTailInVarArgFunc: false - hasTailCall: false - isCalleeSavedInfoValid: false - localFrameSize: 0 - savePoint: '' - restorePoint: '' -fixedStack: [] -stack: [] -entry_values: [] -callSites: [] -debugValueSubstitutions: [] -constants: [] -machineFunctionInfo: {} -body: | - bb.1.entry: - liveins: $w0 - - %0:_(s32) = COPY $w0 - %1:_(s32) = G_CONSTANT i32 1 - %3:_(s32) = G_CONSTANT i32 0 - DBG_VALUE %0(s32), $noreg, !10, !DIExpression(), debug-location !11 - %2:_(s32) = nsw G_ADD %0, %1, debug-location !12 - $w0 = COPY %3(s32) - RET_ReallyLR implicit $w0 - )"; - auto TM = createTargetMachine(Triple::normalize("aarch64--"), "", ""); - if (!TM) - return; - MachineModuleInfo MMI(TM.get()); - std::unique_ptr M = parseMIR(*TM, MIR, MMI, &C); - ASSERT_TRUE(M); - - DroppedVariableStatsMIR Stats; - auto *MF = MMI.getMachineFunction(*M->getFunction("_Z3fooi")); - Stats.runBeforePass("Test", MF); - - // This loop simulates an IR pass that drops debug information. - for (auto &MBB : *MF) { - for (auto &MI : MBB) { - if (MI.isDebugValueLike()) { - MI.eraseFromParent(); - break; - } - } - break; - } - - Stats.runAfterPass("Test", MF); - ASSERT_EQ(Stats.getPassDroppedVariables(), true); -} - -} // end anonymous namespace \ No newline at end of file From 559f0809cc69f0ee55fa56fac1758f43863f2650 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Sat, 21 Dec 2024 03:43:14 +0000 Subject: [PATCH 056/466] [gn build] Port d328d4106139 --- llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn | 1 - llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn | 1 - 2 files changed, 2 deletions(-) diff --git a/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn index 99abbc8ae57b8..ab72ac4ae9f4b 100644 --- a/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn @@ -50,7 +50,6 @@ static_library("CodeGen") { "DFAPacketizer.cpp", "DeadMachineInstructionElim.cpp", "DetectDeadLanes.cpp", - "DroppedVariableStatsMIR.cpp", "DwarfEHPrepare.cpp", "EHContGuardCatchret.cpp", "EarlyIfConversion.cpp", diff --git a/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn index 2fbc127199609..a3f89a5648cb5 100644 --- a/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/unittests/CodeGen/BUILD.gn @@ -26,7 +26,6 @@ unittest("CodeGenTests") { "CCStateTest.cpp", "DIEHashTest.cpp", "DIETest.cpp", - "DroppedVariableStatsMIRTest.cpp", "DwarfStringPoolEntryRefTest.cpp", "InstrRefLDVTest.cpp", "LexicalScopesTest.cpp", From 5cd427477218d8bdb659c6c53a7758f741c3990a Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Fri, 20 Dec 2024 23:32:32 -0500 Subject: [PATCH 057/466] [mlir python] Port in-tree dialects to nanobind. (#119924) This is a companion to #118583, although it can be landed independently because since #117922 dialects do not have to use the same Python binding framework as the Python core code. This PR ports all of the in-tree dialect and pass extensions to nanobind, with the exception of those that remain for testing pybind11 support. This PR also: * removes CollectDiagnosticsToStringScope from NanobindAdaptors.h. This was overlooked in a previous PR and it is duplicated in Diagnostics.h. --------- Co-authored-by: Jacques Pienaar --- mlir/cmake/modules/AddMLIRPython.cmake | 12 +++ mlir/cmake/modules/MLIRDetectPythonEnv.cmake | 12 +++ .../python/StandaloneExtensionNanobind.cpp | 3 +- mlir/include/mlir/Bindings/Python/Nanobind.h | 37 ++++++++ .../mlir/Bindings/Python/NanobindAdaptors.h | 40 +-------- mlir/lib/Bindings/Python/AsyncPasses.cpp | 5 +- mlir/lib/Bindings/Python/DialectGPU.cpp | 44 +++++----- mlir/lib/Bindings/Python/DialectLLVM.cpp | 54 ++++++------ mlir/lib/Bindings/Python/DialectLinalg.cpp | 11 +-- mlir/lib/Bindings/Python/DialectNVGPU.cpp | 20 ++--- mlir/lib/Bindings/Python/DialectPDL.cpp | 43 +++++----- mlir/lib/Bindings/Python/DialectQuant.cpp | 79 +++++++++-------- .../Bindings/Python/DialectSparseTensor.cpp | 45 +++++----- mlir/lib/Bindings/Python/DialectTransform.cpp | 48 +++++------ .../Bindings/Python/ExecutionEngineModule.cpp | 85 ++++++++++--------- mlir/lib/Bindings/Python/GPUPasses.cpp | 5 +- mlir/lib/Bindings/Python/IRAffine.cpp | 7 +- mlir/lib/Bindings/Python/IRAttributes.cpp | 8 +- mlir/lib/Bindings/Python/IRCore.cpp | 10 +-- mlir/lib/Bindings/Python/IRInterfaces.cpp | 5 +- mlir/lib/Bindings/Python/IRModule.cpp | 6 +- mlir/lib/Bindings/Python/IRModule.h | 4 +- mlir/lib/Bindings/Python/IRTypes.cpp | 6 -- mlir/lib/Bindings/Python/LinalgPasses.cpp | 4 +- mlir/lib/Bindings/Python/MainModule.cpp | 3 +- mlir/lib/Bindings/Python/NanobindUtils.h | 5 +- mlir/lib/Bindings/Python/Pass.cpp | 7 +- .../Bindings/Python/RegisterEverything.cpp | 5 +- mlir/lib/Bindings/Python/Rewrite.cpp | 5 +- .../Bindings/Python/SparseTensorPasses.cpp | 4 +- .../Bindings/Python/TransformInterpreter.cpp | 44 +++++----- mlir/python/CMakeLists.txt | 22 +++-- .../python/dialects/sparse_tensor/dialect.py | 2 +- .../python/lib/PythonTestModuleNanobind.cpp | 4 +- .../llvm-project-overlay/mlir/BUILD.bazel | 23 ++--- 35 files changed, 357 insertions(+), 360 deletions(-) create mode 100644 mlir/include/mlir/Bindings/Python/Nanobind.h diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake index 67619a90c90be..53a70139fd5a6 100644 --- a/mlir/cmake/modules/AddMLIRPython.cmake +++ b/mlir/cmake/modules/AddMLIRPython.cmake @@ -661,6 +661,18 @@ function(add_mlir_python_extension libname extname) NB_DOMAIN mlir ${ARG_SOURCES} ) + + if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL) + # Avoids warnings from upstream nanobind. + target_compile_options(nanobind-static + PRIVATE + -Wno-cast-qual + -Wno-zero-length-array + -Wno-nested-anon-types + -Wno-c++98-compat-extra-semi + -Wno-covered-switch-default + ) + endif() endif() # The extension itself must be compiled with RTTI and exceptions enabled. diff --git a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake index d6bb65c64b829..3a87d39c28a06 100644 --- a/mlir/cmake/modules/MLIRDetectPythonEnv.cmake +++ b/mlir/cmake/modules/MLIRDetectPythonEnv.cmake @@ -95,5 +95,17 @@ function(mlir_detect_nanobind_install) endif() message(STATUS "found (${PACKAGE_DIR})") set(nanobind_DIR "${PACKAGE_DIR}" PARENT_SCOPE) + execute_process( + COMMAND "${Python3_EXECUTABLE}" + -c "import nanobind;print(nanobind.include_dir(), end='')" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE STATUS + OUTPUT_VARIABLE PACKAGE_DIR + ERROR_QUIET) + if(NOT STATUS EQUAL "0") + message(STATUS "not found (install via 'pip install nanobind' or set nanobind_DIR)") + return() + endif() + set(nanobind_INCLUDE_DIR "${PACKAGE_DIR}" PARENT_SCOPE) endif() endfunction() diff --git a/mlir/examples/standalone/python/StandaloneExtensionNanobind.cpp b/mlir/examples/standalone/python/StandaloneExtensionNanobind.cpp index 6d83dc585dcd1..189ebac368bf5 100644 --- a/mlir/examples/standalone/python/StandaloneExtensionNanobind.cpp +++ b/mlir/examples/standalone/python/StandaloneExtensionNanobind.cpp @@ -9,9 +9,8 @@ // //===----------------------------------------------------------------------===// -#include - #include "Standalone-c/Dialects.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" namespace nb = nanobind; diff --git a/mlir/include/mlir/Bindings/Python/Nanobind.h b/mlir/include/mlir/Bindings/Python/Nanobind.h new file mode 100644 index 0000000000000..ca942c83d3e2f --- /dev/null +++ b/mlir/include/mlir/Bindings/Python/Nanobind.h @@ -0,0 +1,37 @@ +//===- Nanobind.h - Trampoline header with ignored warnings ---------------===// +// +// 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 is a trampoline for the nanobind headers while disabling warnings +// reported by the LLVM/MLIR build. This file avoids adding complexity build +// system side. +//===----------------------------------------------------------------------===// + +#ifndef MLIR_BINDINGS_PYTHON_NANOBIND_H +#define MLIR_BINDINGS_PYTHON_NANOBIND_H + +#if defined(__clang__) || defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-length-array" +#pragma GCC diagnostic ignored "-Wcast-qual" +#pragma GCC diagnostic ignored "-Wnested-anon-types" +#pragma GCC diagnostic ignored "-Wc++98-compat-extra-semi" +#pragma GCC diagnostic ignored "-Wcovered-switch-default" +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if defined(__clang__) || defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + +#endif // MLIR_BINDINGS_PYTHON_NANOBIND_H diff --git a/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h b/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h index 943981b1fa03d..517351cac6dbc 100644 --- a/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h +++ b/mlir/include/mlir/Bindings/Python/NanobindAdaptors.h @@ -19,14 +19,12 @@ #ifndef MLIR_BINDINGS_PYTHON_NANOBINDADAPTORS_H #define MLIR_BINDINGS_PYTHON_NANOBINDADAPTORS_H -#include -#include - #include -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/Diagnostics.h" #include "mlir-c/IR.h" +#include "mlir/Bindings/Python/Nanobind.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. #include "llvm/ADT/Twine.h" // Raw CAPI type casters need to be declared before use, so always include them @@ -631,40 +629,6 @@ class mlir_value_subclass : public pure_subclass { } // namespace nanobind_adaptors -/// RAII scope intercepting all diagnostics into a string. The message must be -/// checked before this goes out of scope. -class CollectDiagnosticsToStringScope { -public: - explicit CollectDiagnosticsToStringScope(MlirContext ctx) : context(ctx) { - handlerID = mlirContextAttachDiagnosticHandler(ctx, &handler, &errorMessage, - /*deleteUserData=*/nullptr); - } - ~CollectDiagnosticsToStringScope() { - assert(errorMessage.empty() && "unchecked error message"); - mlirContextDetachDiagnosticHandler(context, handlerID); - } - - [[nodiscard]] std::string takeMessage() { return std::move(errorMessage); } - -private: - static MlirLogicalResult handler(MlirDiagnostic diag, void *data) { - auto printer = +[](MlirStringRef message, void *data) { - *static_cast(data) += - llvm::StringRef(message.data, message.length); - }; - MlirLocation loc = mlirDiagnosticGetLocation(diag); - *static_cast(data) += "at "; - mlirLocationPrint(loc, printer, data); - *static_cast(data) += ": "; - mlirDiagnosticPrint(diag, printer, data); - return mlirLogicalResultSuccess(); - } - - MlirContext context; - MlirDiagnosticHandlerID handlerID; - std::string errorMessage = ""; -}; - } // namespace python } // namespace mlir diff --git a/mlir/lib/Bindings/Python/AsyncPasses.cpp b/mlir/lib/Bindings/Python/AsyncPasses.cpp index b611a758dbbb3..cfb8dcaaa72ae 100644 --- a/mlir/lib/Bindings/Python/AsyncPasses.cpp +++ b/mlir/lib/Bindings/Python/AsyncPasses.cpp @@ -8,14 +8,13 @@ #include "mlir-c/Dialect/Async.h" -#include -#include +#include "mlir/Bindings/Python/Nanobind.h" // ----------------------------------------------------------------------------- // Module initialization. // ----------------------------------------------------------------------------- -PYBIND11_MODULE(_mlirAsyncPasses, m) { +NB_MODULE(_mlirAsyncPasses, m) { m.doc() = "MLIR Async Dialect Passes"; // Register all Async passes on load. diff --git a/mlir/lib/Bindings/Python/DialectGPU.cpp b/mlir/lib/Bindings/Python/DialectGPU.cpp index 560a54bcd1591..e5045cf0bba35 100644 --- a/mlir/lib/Bindings/Python/DialectGPU.cpp +++ b/mlir/lib/Bindings/Python/DialectGPU.cpp @@ -9,21 +9,21 @@ #include "mlir-c/Dialect/GPU.h" #include "mlir-c/IR.h" #include "mlir-c/Support.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -#include -#include +namespace nb = nanobind; +using namespace nanobind::literals; -namespace py = pybind11; using namespace mlir; using namespace mlir::python; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; // ----------------------------------------------------------------------------- // Module initialization. // ----------------------------------------------------------------------------- -PYBIND11_MODULE(_mlirDialectsGPU, m) { +NB_MODULE(_mlirDialectsGPU, m) { m.doc() = "MLIR GPU Dialect"; //===-------------------------------------------------------------------===// // AsyncTokenType @@ -34,11 +34,11 @@ PYBIND11_MODULE(_mlirDialectsGPU, m) { mlirGPUAsyncTokenType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirGPUAsyncTokenTypeGet(ctx)); }, - "Gets an instance of AsyncTokenType in the same context", py::arg("cls"), - py::arg("ctx") = py::none()); + "Gets an instance of AsyncTokenType in the same context", nb::arg("cls"), + nb::arg("ctx").none() = nb::none()); //===-------------------------------------------------------------------===// // ObjectAttr @@ -47,12 +47,12 @@ PYBIND11_MODULE(_mlirDialectsGPU, m) { mlir_attribute_subclass(m, "ObjectAttr", mlirAttributeIsAGPUObjectAttr) .def_classmethod( "get", - [](py::object cls, MlirAttribute target, uint32_t format, - py::bytes object, std::optional mlirObjectProps, + [](nb::object cls, MlirAttribute target, uint32_t format, + nb::bytes object, std::optional mlirObjectProps, std::optional mlirKernelsAttr) { - py::buffer_info info(py::buffer(object).request()); - MlirStringRef objectStrRef = - mlirStringRefCreate(static_cast(info.ptr), info.size); + MlirStringRef objectStrRef = mlirStringRefCreate( + static_cast(const_cast(object.data())), + object.size()); return cls(mlirGPUObjectAttrGetWithKernels( mlirAttributeGetContext(target), target, format, objectStrRef, mlirObjectProps.has_value() ? *mlirObjectProps @@ -61,7 +61,7 @@ PYBIND11_MODULE(_mlirDialectsGPU, m) { : MlirAttribute{nullptr})); }, "cls"_a, "target"_a, "format"_a, "object"_a, - "properties"_a = py::none(), "kernels"_a = py::none(), + "properties"_a.none() = nb::none(), "kernels"_a.none() = nb::none(), "Gets a gpu.object from parameters.") .def_property_readonly( "target", @@ -73,18 +73,18 @@ PYBIND11_MODULE(_mlirDialectsGPU, m) { "object", [](MlirAttribute self) { MlirStringRef stringRef = mlirGPUObjectAttrGetObject(self); - return py::bytes(stringRef.data, stringRef.length); + return nb::bytes(stringRef.data, stringRef.length); }) .def_property_readonly("properties", - [](MlirAttribute self) { + [](MlirAttribute self) -> nb::object { if (mlirGPUObjectAttrHasProperties(self)) - return py::cast( + return nb::cast( mlirGPUObjectAttrGetProperties(self)); - return py::none().cast(); + return nb::none(); }) - .def_property_readonly("kernels", [](MlirAttribute self) { + .def_property_readonly("kernels", [](MlirAttribute self) -> nb::object { if (mlirGPUObjectAttrHasKernels(self)) - return py::cast(mlirGPUObjectAttrGetKernels(self)); - return py::none().cast(); + return nb::cast(mlirGPUObjectAttrGetKernels(self)); + return nb::none(); }); } diff --git a/mlir/lib/Bindings/Python/DialectLLVM.cpp b/mlir/lib/Bindings/Python/DialectLLVM.cpp index cccf1370b8cc8..f211e769d66be 100644 --- a/mlir/lib/Bindings/Python/DialectLLVM.cpp +++ b/mlir/lib/Bindings/Python/DialectLLVM.cpp @@ -12,15 +12,19 @@ #include "mlir-c/IR.h" #include "mlir-c/Support.h" #include "mlir/Bindings/Python/Diagnostics.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" + +namespace nb = nanobind; + +using namespace nanobind::literals; -namespace py = pybind11; using namespace llvm; using namespace mlir; using namespace mlir::python; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -void populateDialectLLVMSubmodule(const pybind11::module &m) { +void populateDialectLLVMSubmodule(const nanobind::module_ &m) { //===--------------------------------------------------------------------===// // StructType @@ -31,35 +35,35 @@ void populateDialectLLVMSubmodule(const pybind11::module &m) { llvmStructType.def_classmethod( "get_literal", - [](py::object cls, const std::vector &elements, bool packed, + [](nb::object cls, const std::vector &elements, bool packed, MlirLocation loc) { CollectDiagnosticsToStringScope scope(mlirLocationGetContext(loc)); MlirType type = mlirLLVMStructTypeLiteralGetChecked( loc, elements.size(), elements.data(), packed); if (mlirTypeIsNull(type)) { - throw py::value_error(scope.takeMessage()); + throw nb::value_error(scope.takeMessage().c_str()); } return cls(type); }, - "cls"_a, "elements"_a, py::kw_only(), "packed"_a = false, - "loc"_a = py::none()); + "cls"_a, "elements"_a, nb::kw_only(), "packed"_a = false, + "loc"_a.none() = nb::none()); llvmStructType.def_classmethod( "get_identified", - [](py::object cls, const std::string &name, MlirContext context) { + [](nb::object cls, const std::string &name, MlirContext context) { return cls(mlirLLVMStructTypeIdentifiedGet( context, mlirStringRefCreate(name.data(), name.size()))); }, - "cls"_a, "name"_a, py::kw_only(), "context"_a = py::none()); + "cls"_a, "name"_a, nb::kw_only(), "context"_a.none() = nb::none()); llvmStructType.def_classmethod( "get_opaque", - [](py::object cls, const std::string &name, MlirContext context) { + [](nb::object cls, const std::string &name, MlirContext context) { return cls(mlirLLVMStructTypeOpaqueGet( context, mlirStringRefCreate(name.data(), name.size()))); }, - "cls"_a, "name"_a, "context"_a = py::none()); + "cls"_a, "name"_a, "context"_a.none() = nb::none()); llvmStructType.def( "set_body", @@ -67,22 +71,22 @@ void populateDialectLLVMSubmodule(const pybind11::module &m) { MlirLogicalResult result = mlirLLVMStructTypeSetBody( self, elements.size(), elements.data(), packed); if (!mlirLogicalResultIsSuccess(result)) { - throw py::value_error( + throw nb::value_error( "Struct body already set to different content."); } }, - "elements"_a, py::kw_only(), "packed"_a = false); + "elements"_a, nb::kw_only(), "packed"_a = false); llvmStructType.def_classmethod( "new_identified", - [](py::object cls, const std::string &name, + [](nb::object cls, const std::string &name, const std::vector &elements, bool packed, MlirContext ctx) { return cls(mlirLLVMStructTypeIdentifiedNewGet( ctx, mlirStringRefCreate(name.data(), name.length()), elements.size(), elements.data(), packed)); }, - "cls"_a, "name"_a, "elements"_a, py::kw_only(), "packed"_a = false, - "context"_a = py::none()); + "cls"_a, "name"_a, "elements"_a, nb::kw_only(), "packed"_a = false, + "context"_a.none() = nb::none()); llvmStructType.def_property_readonly( "name", [](MlirType type) -> std::optional { @@ -93,12 +97,12 @@ void populateDialectLLVMSubmodule(const pybind11::module &m) { return StringRef(stringRef.data, stringRef.length).str(); }); - llvmStructType.def_property_readonly("body", [](MlirType type) -> py::object { + llvmStructType.def_property_readonly("body", [](MlirType type) -> nb::object { // Don't crash in absence of a body. if (mlirLLVMStructTypeIsOpaque(type)) - return py::none(); + return nb::none(); - py::list body; + nb::list body; for (intptr_t i = 0, e = mlirLLVMStructTypeGetNumElementTypes(type); i < e; ++i) { body.append(mlirLLVMStructTypeGetElementType(type, i)); @@ -119,24 +123,24 @@ void populateDialectLLVMSubmodule(const pybind11::module &m) { mlir_type_subclass(m, "PointerType", mlirTypeIsALLVMPointerType) .def_classmethod( "get", - [](py::object cls, std::optional addressSpace, + [](nb::object cls, std::optional addressSpace, MlirContext context) { CollectDiagnosticsToStringScope scope(context); MlirType type = mlirLLVMPointerTypeGet( context, addressSpace.has_value() ? *addressSpace : 0); if (mlirTypeIsNull(type)) { - throw py::value_error(scope.takeMessage()); + throw nb::value_error(scope.takeMessage().c_str()); } return cls(type); }, - "cls"_a, "address_space"_a = py::none(), py::kw_only(), - "context"_a = py::none()) + "cls"_a, "address_space"_a.none() = nb::none(), nb::kw_only(), + "context"_a.none() = nb::none()) .def_property_readonly("address_space", [](MlirType type) { return mlirLLVMPointerTypeGetAddressSpace(type); }); } -PYBIND11_MODULE(_mlirDialectsLLVM, m) { +NB_MODULE(_mlirDialectsLLVM, m) { m.doc() = "MLIR LLVM Dialect"; populateDialectLLVMSubmodule(m); diff --git a/mlir/lib/Bindings/Python/DialectLinalg.cpp b/mlir/lib/Bindings/Python/DialectLinalg.cpp index 2e54ebeb61fb1..548df4ee100aa 100644 --- a/mlir/lib/Bindings/Python/DialectLinalg.cpp +++ b/mlir/lib/Bindings/Python/DialectLinalg.cpp @@ -8,20 +8,21 @@ #include "mlir-c/Dialect/Linalg.h" #include "mlir-c/IR.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; -static void populateDialectLinalgSubmodule(py::module m) { +static void populateDialectLinalgSubmodule(nb::module_ m) { m.def( "fill_builtin_region", [](MlirOperation op) { mlirLinalgFillBuiltinNamedOpRegion(op); }, - py::arg("op"), + nb::arg("op"), "Fill the region for `op`, which is assumed to be a builtin named Linalg " "op."); } -PYBIND11_MODULE(_mlirDialectsLinalg, m) { +NB_MODULE(_mlirDialectsLinalg, m) { m.doc() = "MLIR Linalg dialect."; populateDialectLinalgSubmodule(m); diff --git a/mlir/lib/Bindings/Python/DialectNVGPU.cpp b/mlir/lib/Bindings/Python/DialectNVGPU.cpp index 754e0a75b0abc..a0d6a4b4c73f9 100644 --- a/mlir/lib/Bindings/Python/DialectNVGPU.cpp +++ b/mlir/lib/Bindings/Python/DialectNVGPU.cpp @@ -8,33 +8,33 @@ #include "mlir-c/Dialect/NVGPU.h" #include "mlir-c/IR.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; using namespace llvm; using namespace mlir; using namespace mlir::python; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -static void populateDialectNVGPUSubmodule(const pybind11::module &m) { +static void populateDialectNVGPUSubmodule(const nb::module_ &m) { auto nvgpuTensorMapDescriptorType = mlir_type_subclass( m, "TensorMapDescriptorType", mlirTypeIsANVGPUTensorMapDescriptorType); nvgpuTensorMapDescriptorType.def_classmethod( "get", - [](py::object cls, MlirType tensorMemrefType, int swizzle, int l2promo, + [](nb::object cls, MlirType tensorMemrefType, int swizzle, int l2promo, int oobFill, int interleave, MlirContext ctx) { return cls(mlirNVGPUTensorMapDescriptorTypeGet( ctx, tensorMemrefType, swizzle, l2promo, oobFill, interleave)); }, "Gets an instance of TensorMapDescriptorType in the same context", - py::arg("cls"), py::arg("tensor_type"), py::arg("swizzle"), - py::arg("l2promo"), py::arg("oob_fill"), py::arg("interleave"), - py::arg("ctx") = py::none()); + nb::arg("cls"), nb::arg("tensor_type"), nb::arg("swizzle"), + nb::arg("l2promo"), nb::arg("oob_fill"), nb::arg("interleave"), + nb::arg("ctx").none() = nb::none()); } -PYBIND11_MODULE(_mlirDialectsNVGPU, m) { +NB_MODULE(_mlirDialectsNVGPU, m) { m.doc() = "MLIR NVGPU dialect."; populateDialectNVGPUSubmodule(m); diff --git a/mlir/lib/Bindings/Python/DialectPDL.cpp b/mlir/lib/Bindings/Python/DialectPDL.cpp index 8d3f9a7ab1d6a..bcc6ff406c952 100644 --- a/mlir/lib/Bindings/Python/DialectPDL.cpp +++ b/mlir/lib/Bindings/Python/DialectPDL.cpp @@ -8,19 +8,16 @@ #include "mlir-c/Dialect/PDL.h" #include "mlir-c/IR.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include -#include -#include -#include +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; using namespace llvm; using namespace mlir; using namespace mlir::python; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -void populateDialectPDLSubmodule(const pybind11::module &m) { +void populateDialectPDLSubmodule(const nanobind::module_ &m) { //===-------------------------------------------------------------------===// // PDLType //===-------------------------------------------------------------------===// @@ -35,11 +32,11 @@ void populateDialectPDLSubmodule(const pybind11::module &m) { mlir_type_subclass(m, "AttributeType", mlirTypeIsAPDLAttributeType); attributeType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirPDLAttributeTypeGet(ctx)); }, - "Get an instance of AttributeType in given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of AttributeType in given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // OperationType @@ -49,11 +46,11 @@ void populateDialectPDLSubmodule(const pybind11::module &m) { mlir_type_subclass(m, "OperationType", mlirTypeIsAPDLOperationType); operationType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirPDLOperationTypeGet(ctx)); }, - "Get an instance of OperationType in given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of OperationType in given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // RangeType @@ -62,12 +59,12 @@ void populateDialectPDLSubmodule(const pybind11::module &m) { auto rangeType = mlir_type_subclass(m, "RangeType", mlirTypeIsAPDLRangeType); rangeType.def_classmethod( "get", - [](py::object cls, MlirType elementType) { + [](nb::object cls, MlirType elementType) { return cls(mlirPDLRangeTypeGet(elementType)); }, "Gets an instance of RangeType in the same context as the provided " "element type.", - py::arg("cls"), py::arg("element_type")); + nb::arg("cls"), nb::arg("element_type")); rangeType.def_property_readonly( "element_type", [](MlirType type) { return mlirPDLRangeTypeGetElementType(type); }, @@ -80,11 +77,11 @@ void populateDialectPDLSubmodule(const pybind11::module &m) { auto typeType = mlir_type_subclass(m, "TypeType", mlirTypeIsAPDLTypeType); typeType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirPDLTypeTypeGet(ctx)); }, - "Get an instance of TypeType in given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of TypeType in given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // ValueType @@ -93,14 +90,14 @@ void populateDialectPDLSubmodule(const pybind11::module &m) { auto valueType = mlir_type_subclass(m, "ValueType", mlirTypeIsAPDLValueType); valueType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirPDLValueTypeGet(ctx)); }, - "Get an instance of TypeType in given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of TypeType in given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); } -PYBIND11_MODULE(_mlirDialectsPDL, m) { +NB_MODULE(_mlirDialectsPDL, m) { m.doc() = "MLIR PDL dialect."; populateDialectPDLSubmodule(m); } diff --git a/mlir/lib/Bindings/Python/DialectQuant.cpp b/mlir/lib/Bindings/Python/DialectQuant.cpp index 9a871f2c122d1..29f19c9c50065 100644 --- a/mlir/lib/Bindings/Python/DialectQuant.cpp +++ b/mlir/lib/Bindings/Python/DialectQuant.cpp @@ -6,21 +6,20 @@ // //===----------------------------------------------------------------------===// -#include "mlir-c/Dialect/Quant.h" -#include "mlir-c/IR.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" #include -#include -#include -#include #include -namespace py = pybind11; +#include "mlir-c/Dialect/Quant.h" +#include "mlir-c/IR.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" + +namespace nb = nanobind; using namespace llvm; using namespace mlir; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -static void populateDialectQuantSubmodule(const py::module &m) { +static void populateDialectQuantSubmodule(const nb::module_ &m) { //===-------------------------------------------------------------------===// // QuantizedType //===-------------------------------------------------------------------===// @@ -35,7 +34,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Default minimum value for the integer with the specified signedness and " "bit width.", - py::arg("is_signed"), py::arg("integral_width")); + nb::arg("is_signed"), nb::arg("integral_width")); quantizedType.def_staticmethod( "default_maximum_for_integer", [](bool isSigned, unsigned integralWidth) { @@ -44,7 +43,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Default maximum value for the integer with the specified signedness and " "bit width.", - py::arg("is_signed"), py::arg("integral_width")); + nb::arg("is_signed"), nb::arg("integral_width")); quantizedType.def_property_readonly( "expressed_type", [](MlirType type) { return mlirQuantizedTypeGetExpressedType(type); }, @@ -82,7 +81,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Checks whether the candidate type can be expressed by this quantized " "type.", - py::arg("candidate")); + nb::arg("candidate")); quantizedType.def_property_readonly( "quantized_element_type", [](MlirType type) { @@ -96,24 +95,24 @@ static void populateDialectQuantSubmodule(const py::module &m) { mlirQuantizedTypeCastFromStorageType(type, candidate); if (!mlirTypeIsNull(castResult)) return castResult; - throw py::type_error("Invalid cast."); + throw nb::type_error("Invalid cast."); }, "Casts from a type based on the storage type of this quantized type to a " "corresponding type based on the quantized type. Raises TypeError if the " "cast is not valid.", - py::arg("candidate")); + nb::arg("candidate")); quantizedType.def_staticmethod( "cast_to_storage_type", [](MlirType type) { MlirType castResult = mlirQuantizedTypeCastToStorageType(type); if (!mlirTypeIsNull(castResult)) return castResult; - throw py::type_error("Invalid cast."); + throw nb::type_error("Invalid cast."); }, "Casts from a type based on a quantized type to a corresponding type " "based on the storage type of this quantized type. Raises TypeError if " "the cast is not valid.", - py::arg("type")); + nb::arg("type")); quantizedType.def( "cast_from_expressed_type", [](MlirType type, MlirType candidate) { @@ -121,24 +120,24 @@ static void populateDialectQuantSubmodule(const py::module &m) { mlirQuantizedTypeCastFromExpressedType(type, candidate); if (!mlirTypeIsNull(castResult)) return castResult; - throw py::type_error("Invalid cast."); + throw nb::type_error("Invalid cast."); }, "Casts from a type based on the expressed type of this quantized type to " "a corresponding type based on the quantized type. Raises TypeError if " "the cast is not valid.", - py::arg("candidate")); + nb::arg("candidate")); quantizedType.def_staticmethod( "cast_to_expressed_type", [](MlirType type) { MlirType castResult = mlirQuantizedTypeCastToExpressedType(type); if (!mlirTypeIsNull(castResult)) return castResult; - throw py::type_error("Invalid cast."); + throw nb::type_error("Invalid cast."); }, "Casts from a type based on a quantized type to a corresponding type " "based on the expressed type of this quantized type. Raises TypeError if " "the cast is not valid.", - py::arg("type")); + nb::arg("type")); quantizedType.def( "cast_expressed_to_storage_type", [](MlirType type, MlirType candidate) { @@ -146,12 +145,12 @@ static void populateDialectQuantSubmodule(const py::module &m) { mlirQuantizedTypeCastExpressedToStorageType(type, candidate); if (!mlirTypeIsNull(castResult)) return castResult; - throw py::type_error("Invalid cast."); + throw nb::type_error("Invalid cast."); }, "Casts from a type based on the expressed type of this quantized type to " "a corresponding type based on the storage type. Raises TypeError if the " "cast is not valid.", - py::arg("candidate")); + nb::arg("candidate")); quantizedType.get_class().attr("FLAG_SIGNED") = mlirQuantizedTypeGetSignedFlag(); @@ -165,7 +164,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { quantizedType.get_class()); anyQuantizedType.def_classmethod( "get", - [](py::object cls, unsigned flags, MlirType storageType, + [](nb::object cls, unsigned flags, MlirType storageType, MlirType expressedType, int64_t storageTypeMin, int64_t storageTypeMax) { return cls(mlirAnyQuantizedTypeGet(flags, storageType, expressedType, @@ -173,9 +172,9 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Gets an instance of AnyQuantizedType in the same context as the " "provided storage type.", - py::arg("cls"), py::arg("flags"), py::arg("storage_type"), - py::arg("expressed_type"), py::arg("storage_type_min"), - py::arg("storage_type_max")); + nb::arg("cls"), nb::arg("flags"), nb::arg("storage_type"), + nb::arg("expressed_type"), nb::arg("storage_type_min"), + nb::arg("storage_type_max")); //===-------------------------------------------------------------------===// // UniformQuantizedType @@ -186,7 +185,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { quantizedType.get_class()); uniformQuantizedType.def_classmethod( "get", - [](py::object cls, unsigned flags, MlirType storageType, + [](nb::object cls, unsigned flags, MlirType storageType, MlirType expressedType, double scale, int64_t zeroPoint, int64_t storageTypeMin, int64_t storageTypeMax) { return cls(mlirUniformQuantizedTypeGet(flags, storageType, @@ -195,9 +194,9 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Gets an instance of UniformQuantizedType in the same context as the " "provided storage type.", - py::arg("cls"), py::arg("flags"), py::arg("storage_type"), - py::arg("expressed_type"), py::arg("scale"), py::arg("zero_point"), - py::arg("storage_type_min"), py::arg("storage_type_max")); + nb::arg("cls"), nb::arg("flags"), nb::arg("storage_type"), + nb::arg("expressed_type"), nb::arg("scale"), nb::arg("zero_point"), + nb::arg("storage_type_min"), nb::arg("storage_type_max")); uniformQuantizedType.def_property_readonly( "scale", [](MlirType type) { return mlirUniformQuantizedTypeGetScale(type); }, @@ -221,12 +220,12 @@ static void populateDialectQuantSubmodule(const py::module &m) { quantizedType.get_class()); uniformQuantizedPerAxisType.def_classmethod( "get", - [](py::object cls, unsigned flags, MlirType storageType, + [](nb::object cls, unsigned flags, MlirType storageType, MlirType expressedType, std::vector scales, std::vector zeroPoints, int32_t quantizedDimension, int64_t storageTypeMin, int64_t storageTypeMax) { if (scales.size() != zeroPoints.size()) - throw py::value_error( + throw nb::value_error( "Mismatching number of scales and zero points."); auto nDims = static_cast(scales.size()); return cls(mlirUniformQuantizedPerAxisTypeGet( @@ -236,10 +235,10 @@ static void populateDialectQuantSubmodule(const py::module &m) { }, "Gets an instance of UniformQuantizedPerAxisType in the same context as " "the provided storage type.", - py::arg("cls"), py::arg("flags"), py::arg("storage_type"), - py::arg("expressed_type"), py::arg("scales"), py::arg("zero_points"), - py::arg("quantized_dimension"), py::arg("storage_type_min"), - py::arg("storage_type_max")); + nb::arg("cls"), nb::arg("flags"), nb::arg("storage_type"), + nb::arg("expressed_type"), nb::arg("scales"), nb::arg("zero_points"), + nb::arg("quantized_dimension"), nb::arg("storage_type_min"), + nb::arg("storage_type_max")); uniformQuantizedPerAxisType.def_property_readonly( "scales", [](MlirType type) { @@ -294,13 +293,13 @@ static void populateDialectQuantSubmodule(const py::module &m) { quantizedType.get_class()); calibratedQuantizedType.def_classmethod( "get", - [](py::object cls, MlirType expressedType, double min, double max) { + [](nb::object cls, MlirType expressedType, double min, double max) { return cls(mlirCalibratedQuantizedTypeGet(expressedType, min, max)); }, "Gets an instance of CalibratedQuantizedType in the same context as the " "provided expressed type.", - py::arg("cls"), py::arg("expressed_type"), py::arg("min"), - py::arg("max")); + nb::arg("cls"), nb::arg("expressed_type"), nb::arg("min"), + nb::arg("max")); calibratedQuantizedType.def_property_readonly("min", [](MlirType type) { return mlirCalibratedQuantizedTypeGetMin(type); }); @@ -309,7 +308,7 @@ static void populateDialectQuantSubmodule(const py::module &m) { }); } -PYBIND11_MODULE(_mlirDialectsQuant, m) { +NB_MODULE(_mlirDialectsQuant, m) { m.doc() = "MLIR Quantization dialect"; populateDialectQuantSubmodule(m); diff --git a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp index a730bf500be98..97cebcceebd9a 100644 --- a/mlir/lib/Bindings/Python/DialectSparseTensor.cpp +++ b/mlir/lib/Bindings/Python/DialectSparseTensor.cpp @@ -6,32 +6,30 @@ // //===----------------------------------------------------------------------===// +#include +#include + #include "mlir-c/AffineMap.h" #include "mlir-c/Dialect/SparseTensor.h" #include "mlir-c/IR.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include -#include -#include -#include -#include -#include +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; using namespace llvm; using namespace mlir; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -static void populateDialectSparseTensorSubmodule(const py::module &m) { - py::enum_(m, "LevelFormat", py::module_local()) +static void populateDialectSparseTensorSubmodule(const nb::module_ &m) { + nb::enum_(m, "LevelFormat", nb::is_arithmetic(), + nb::is_flag()) .value("dense", MLIR_SPARSE_TENSOR_LEVEL_DENSE) .value("n_out_of_m", MLIR_SPARSE_TENSOR_LEVEL_N_OUT_OF_M) .value("compressed", MLIR_SPARSE_TENSOR_LEVEL_COMPRESSED) .value("singleton", MLIR_SPARSE_TENSOR_LEVEL_SINGLETON) .value("loose_compressed", MLIR_SPARSE_TENSOR_LEVEL_LOOSE_COMPRESSED); - py::enum_(m, "LevelProperty", - py::module_local()) + nb::enum_(m, "LevelProperty") .value("non_ordered", MLIR_SPARSE_PROPERTY_NON_ORDERED) .value("non_unique", MLIR_SPARSE_PROPERTY_NON_UNIQUE) .value("soa", MLIR_SPARSE_PROPERTY_SOA); @@ -40,7 +38,7 @@ static void populateDialectSparseTensorSubmodule(const py::module &m) { mlirAttributeIsASparseTensorEncodingAttr) .def_classmethod( "get", - [](py::object cls, std::vector lvlTypes, + [](nb::object cls, std::vector lvlTypes, std::optional dimToLvl, std::optional lvlToDim, int posWidth, int crdWidth, std::optional explicitVal, @@ -52,24 +50,25 @@ static void populateDialectSparseTensorSubmodule(const py::module &m) { crdWidth, explicitVal ? *explicitVal : MlirAttribute{nullptr}, implicitVal ? *implicitVal : MlirAttribute{nullptr})); }, - py::arg("cls"), py::arg("lvl_types"), py::arg("dim_to_lvl"), - py::arg("lvl_to_dim"), py::arg("pos_width"), py::arg("crd_width"), - py::arg("explicit_val") = py::none(), - py::arg("implicit_val") = py::none(), py::arg("context") = py::none(), + nb::arg("cls"), nb::arg("lvl_types"), nb::arg("dim_to_lvl").none(), + nb::arg("lvl_to_dim").none(), nb::arg("pos_width"), + nb::arg("crd_width"), nb::arg("explicit_val").none() = nb::none(), + nb::arg("implicit_val").none() = nb::none(), + nb::arg("context").none() = nb::none(), "Gets a sparse_tensor.encoding from parameters.") .def_classmethod( "build_level_type", - [](py::object cls, MlirSparseTensorLevelFormat lvlFmt, + [](nb::object cls, MlirSparseTensorLevelFormat lvlFmt, const std::vector &properties, unsigned n, unsigned m) { return mlirSparseTensorEncodingAttrBuildLvlType( lvlFmt, properties.data(), properties.size(), n, m); }, - py::arg("cls"), py::arg("lvl_fmt"), - py::arg("properties") = + nb::arg("cls"), nb::arg("lvl_fmt"), + nb::arg("properties") = std::vector(), - py::arg("n") = 0, py::arg("m") = 0, + nb::arg("n") = 0, nb::arg("m") = 0, "Builds a sparse_tensor.encoding.level_type from parameters.") .def_property_readonly( "lvl_types", @@ -143,7 +142,7 @@ static void populateDialectSparseTensorSubmodule(const py::module &m) { }); } -PYBIND11_MODULE(_mlirDialectsSparseTensor, m) { +NB_MODULE(_mlirDialectsSparseTensor, m) { m.doc() = "MLIR SparseTensor dialect."; populateDialectSparseTensorSubmodule(m); } diff --git a/mlir/lib/Bindings/Python/DialectTransform.cpp b/mlir/lib/Bindings/Python/DialectTransform.cpp index 6b57e652aa9d8..59a030ac67f57 100644 --- a/mlir/lib/Bindings/Python/DialectTransform.cpp +++ b/mlir/lib/Bindings/Python/DialectTransform.cpp @@ -6,22 +6,20 @@ // //===----------------------------------------------------------------------===// +#include + #include "mlir-c/Dialect/Transform.h" #include "mlir-c/IR.h" #include "mlir-c/Support.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" -#include -#include -#include -#include -#include +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; using namespace mlir; using namespace mlir::python; -using namespace mlir::python::adaptors; +using namespace mlir::python::nanobind_adaptors; -void populateDialectTransformSubmodule(const pybind11::module &m) { +void populateDialectTransformSubmodule(const nb::module_ &m) { //===-------------------------------------------------------------------===// // AnyOpType //===-------------------------------------------------------------------===// @@ -31,11 +29,11 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { mlirTransformAnyOpTypeGetTypeID); anyOpType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirTransformAnyOpTypeGet(ctx)); }, - "Get an instance of AnyOpType in the given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of AnyOpType in the given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // AnyParamType @@ -46,11 +44,11 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { mlirTransformAnyParamTypeGetTypeID); anyParamType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirTransformAnyParamTypeGet(ctx)); }, - "Get an instance of AnyParamType in the given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of AnyParamType in the given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // AnyValueType @@ -61,11 +59,11 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { mlirTransformAnyValueTypeGetTypeID); anyValueType.def_classmethod( "get", - [](py::object cls, MlirContext ctx) { + [](nb::object cls, MlirContext ctx) { return cls(mlirTransformAnyValueTypeGet(ctx)); }, - "Get an instance of AnyValueType in the given context.", py::arg("cls"), - py::arg("context") = py::none()); + "Get an instance of AnyValueType in the given context.", nb::arg("cls"), + nb::arg("context").none() = nb::none()); //===-------------------------------------------------------------------===// // OperationType @@ -76,21 +74,21 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { mlirTransformOperationTypeGetTypeID); operationType.def_classmethod( "get", - [](py::object cls, const std::string &operationName, MlirContext ctx) { + [](nb::object cls, const std::string &operationName, MlirContext ctx) { MlirStringRef cOperationName = mlirStringRefCreate(operationName.data(), operationName.size()); return cls(mlirTransformOperationTypeGet(ctx, cOperationName)); }, "Get an instance of OperationType for the given kind in the given " "context", - py::arg("cls"), py::arg("operation_name"), - py::arg("context") = py::none()); + nb::arg("cls"), nb::arg("operation_name"), + nb::arg("context").none() = nb::none()); operationType.def_property_readonly( "operation_name", [](MlirType type) { MlirStringRef operationName = mlirTransformOperationTypeGetOperationName(type); - return py::str(operationName.data, operationName.length); + return nb::str(operationName.data, operationName.length); }, "Get the name of the payload operation accepted by the handle."); @@ -103,11 +101,11 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { mlirTransformParamTypeGetTypeID); paramType.def_classmethod( "get", - [](py::object cls, MlirType type, MlirContext ctx) { + [](nb::object cls, MlirType type, MlirContext ctx) { return cls(mlirTransformParamTypeGet(ctx, type)); }, "Get an instance of ParamType for the given type in the given context.", - py::arg("cls"), py::arg("type"), py::arg("context") = py::none()); + nb::arg("cls"), nb::arg("type"), nb::arg("context").none() = nb::none()); paramType.def_property_readonly( "type", [](MlirType type) { @@ -117,7 +115,7 @@ void populateDialectTransformSubmodule(const pybind11::module &m) { "Get the type this ParamType is associated with."); } -PYBIND11_MODULE(_mlirDialectsTransform, m) { +NB_MODULE(_mlirDialectsTransform, m) { m.doc() = "MLIR Transform dialect."; populateDialectTransformSubmodule(m); } diff --git a/mlir/lib/Bindings/Python/ExecutionEngineModule.cpp b/mlir/lib/Bindings/Python/ExecutionEngineModule.cpp index b3df30583fc96..81dada3553622 100644 --- a/mlir/lib/Bindings/Python/ExecutionEngineModule.cpp +++ b/mlir/lib/Bindings/Python/ExecutionEngineModule.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "mlir-c/ExecutionEngine.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; using namespace mlir; using namespace mlir::python; @@ -34,23 +35,22 @@ class PyExecutionEngine { executionEngine.ptr = nullptr; referencedObjects.clear(); } - pybind11::object getCapsule() { - return py::reinterpret_steal( - mlirPythonExecutionEngineToCapsule(get())); + nb::object getCapsule() { + return nb::steal(mlirPythonExecutionEngineToCapsule(get())); } // Add an object to the list of referenced objects whose lifetime must exceed // those of the ExecutionEngine. - void addReferencedObject(const pybind11::object &obj) { + void addReferencedObject(const nb::object &obj) { referencedObjects.push_back(obj); } - static pybind11::object createFromCapsule(pybind11::object capsule) { + static nb::object createFromCapsule(nb::object capsule) { MlirExecutionEngine rawPm = mlirPythonCapsuleToExecutionEngine(capsule.ptr()); if (mlirExecutionEngineIsNull(rawPm)) - throw py::error_already_set(); - return py::cast(PyExecutionEngine(rawPm), py::return_value_policy::move); + throw nb::python_error(); + return nb::cast(PyExecutionEngine(rawPm), nb::rv_policy::move); } private: @@ -58,44 +58,45 @@ class PyExecutionEngine { // We support Python ctypes closures as callbacks. Keep a list of the objects // so that they don't get garbage collected. (The ExecutionEngine itself // just holds raw pointers with no lifetime semantics). - std::vector referencedObjects; + std::vector referencedObjects; }; } // namespace /// Create the `mlir.execution_engine` module here. -PYBIND11_MODULE(_mlirExecutionEngine, m) { +NB_MODULE(_mlirExecutionEngine, m) { m.doc() = "MLIR Execution Engine"; //---------------------------------------------------------------------------- // Mapping of the top-level PassManager //---------------------------------------------------------------------------- - py::class_(m, "ExecutionEngine", py::module_local()) - .def(py::init<>([](MlirModule module, int optLevel, - const std::vector &sharedLibPaths, - bool enableObjectDump) { - llvm::SmallVector libPaths; - for (const std::string &path : sharedLibPaths) - libPaths.push_back({path.c_str(), path.length()}); - MlirExecutionEngine executionEngine = - mlirExecutionEngineCreate(module, optLevel, libPaths.size(), - libPaths.data(), enableObjectDump); - if (mlirExecutionEngineIsNull(executionEngine)) - throw std::runtime_error( - "Failure while creating the ExecutionEngine."); - return new PyExecutionEngine(executionEngine); - }), - py::arg("module"), py::arg("opt_level") = 2, - py::arg("shared_libs") = py::list(), - py::arg("enable_object_dump") = true, - "Create a new ExecutionEngine instance for the given Module. The " - "module must contain only dialects that can be translated to LLVM. " - "Perform transformations and code generation at the optimization " - "level `opt_level` if specified, or otherwise at the default " - "level of two (-O2). Load a list of libraries specified in " - "`shared_libs`.") - .def_property_readonly(MLIR_PYTHON_CAPI_PTR_ATTR, - &PyExecutionEngine::getCapsule) + nb::class_(m, "ExecutionEngine") + .def( + "__init__", + [](PyExecutionEngine &self, MlirModule module, int optLevel, + const std::vector &sharedLibPaths, + bool enableObjectDump) { + llvm::SmallVector libPaths; + for (const std::string &path : sharedLibPaths) + libPaths.push_back({path.c_str(), path.length()}); + MlirExecutionEngine executionEngine = + mlirExecutionEngineCreate(module, optLevel, libPaths.size(), + libPaths.data(), enableObjectDump); + if (mlirExecutionEngineIsNull(executionEngine)) + throw std::runtime_error( + "Failure while creating the ExecutionEngine."); + new (&self) PyExecutionEngine(executionEngine); + }, + nb::arg("module"), nb::arg("opt_level") = 2, + nb::arg("shared_libs") = nb::list(), + nb::arg("enable_object_dump") = true, + "Create a new ExecutionEngine instance for the given Module. The " + "module must contain only dialects that can be translated to LLVM. " + "Perform transformations and code generation at the optimization " + "level `opt_level` if specified, or otherwise at the default " + "level of two (-O2). Load a list of libraries specified in " + "`shared_libs`.") + .def_prop_ro(MLIR_PYTHON_CAPI_PTR_ATTR, &PyExecutionEngine::getCapsule) .def("_testing_release", &PyExecutionEngine::release, "Releases (leaks) the backing ExecutionEngine (for testing purpose)") .def(MLIR_PYTHON_CAPI_FACTORY_ATTR, &PyExecutionEngine::createFromCapsule) @@ -107,21 +108,21 @@ PYBIND11_MODULE(_mlirExecutionEngine, m) { mlirStringRefCreate(func.c_str(), func.size())); return reinterpret_cast(res); }, - py::arg("func_name"), + nb::arg("func_name"), "Lookup function `func` in the ExecutionEngine.") .def( "raw_register_runtime", [](PyExecutionEngine &executionEngine, const std::string &name, - py::object callbackObj) { + nb::object callbackObj) { executionEngine.addReferencedObject(callbackObj); uintptr_t rawSym = - py::cast(py::getattr(callbackObj, "value")); + nb::cast(nb::getattr(callbackObj, "value")); mlirExecutionEngineRegisterSymbol( executionEngine.get(), mlirStringRefCreate(name.c_str(), name.size()), reinterpret_cast(rawSym)); }, - py::arg("name"), py::arg("callback"), + nb::arg("name"), nb::arg("callback"), "Register `callback` as the runtime symbol `name`.") .def( "dump_to_object_file", @@ -130,5 +131,5 @@ PYBIND11_MODULE(_mlirExecutionEngine, m) { executionEngine.get(), mlirStringRefCreate(fileName.c_str(), fileName.size())); }, - py::arg("file_name"), "Dump ExecutionEngine to an object file."); + nb::arg("file_name"), "Dump ExecutionEngine to an object file."); } diff --git a/mlir/lib/Bindings/Python/GPUPasses.cpp b/mlir/lib/Bindings/Python/GPUPasses.cpp index e276a3ce3a56a..be474edbe9639 100644 --- a/mlir/lib/Bindings/Python/GPUPasses.cpp +++ b/mlir/lib/Bindings/Python/GPUPasses.cpp @@ -8,14 +8,13 @@ #include "mlir-c/Dialect/GPU.h" -#include -#include +#include "mlir/Bindings/Python/Nanobind.h" // ----------------------------------------------------------------------------- // Module initialization. // ----------------------------------------------------------------------------- -PYBIND11_MODULE(_mlirGPUPasses, m) { +NB_MODULE(_mlirGPUPasses, m) { m.doc() = "MLIR GPU Dialect Passes"; // Register all GPU passes on load. diff --git a/mlir/lib/Bindings/Python/IRAffine.cpp b/mlir/lib/Bindings/Python/IRAffine.cpp index 2db690309fab8..a2df824f59a53 100644 --- a/mlir/lib/Bindings/Python/IRAffine.cpp +++ b/mlir/lib/Bindings/Python/IRAffine.cpp @@ -6,10 +6,6 @@ // //===----------------------------------------------------------------------===// -#include -#include -#include - #include #include #include @@ -21,8 +17,9 @@ #include "NanobindUtils.h" #include "mlir-c/AffineExpr.h" #include "mlir-c/AffineMap.h" -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/IntegerSet.h" +#include "mlir/Bindings/Python/Nanobind.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. #include "mlir/Support/LLVM.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/SmallVector.h" diff --git a/mlir/lib/Bindings/Python/IRAttributes.cpp b/mlir/lib/Bindings/Python/IRAttributes.cpp index 779af09509748..08f7d4881e137 100644 --- a/mlir/lib/Bindings/Python/IRAttributes.cpp +++ b/mlir/lib/Bindings/Python/IRAttributes.cpp @@ -6,13 +6,6 @@ // //===----------------------------------------------------------------------===// -#include -#include -#include -#include -#include -#include - #include #include #include @@ -24,6 +17,7 @@ #include "mlir-c/BuiltinAttributes.h" #include "mlir-c/BuiltinTypes.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/Support/raw_ostream.h" diff --git a/mlir/lib/Bindings/Python/IRCore.cpp b/mlir/lib/Bindings/Python/IRCore.cpp index e1c56a3984314..86afa956398ae 100644 --- a/mlir/lib/Bindings/Python/IRCore.cpp +++ b/mlir/lib/Bindings/Python/IRCore.cpp @@ -6,26 +6,20 @@ // //===----------------------------------------------------------------------===// -#include -#include -#include -#include -#include -#include - #include #include #include "Globals.h" #include "IRModule.h" #include "NanobindUtils.h" -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/BuiltinAttributes.h" #include "mlir-c/Debug.h" #include "mlir-c/Diagnostics.h" #include "mlir-c/IR.h" #include "mlir-c/Support.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/SmallVector.h" diff --git a/mlir/lib/Bindings/Python/IRInterfaces.cpp b/mlir/lib/Bindings/Python/IRInterfaces.cpp index c339a93e31857..9e1fedaab5235 100644 --- a/mlir/lib/Bindings/Python/IRInterfaces.cpp +++ b/mlir/lib/Bindings/Python/IRInterfaces.cpp @@ -6,10 +6,6 @@ // //===----------------------------------------------------------------------===// -#include -#include -#include - #include #include #include @@ -21,6 +17,7 @@ #include "mlir-c/IR.h" #include "mlir-c/Interfaces.h" #include "mlir-c/Support.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallVector.h" diff --git a/mlir/lib/Bindings/Python/IRModule.cpp b/mlir/lib/Bindings/Python/IRModule.cpp index 416a14218f125..f7bf77e5a7e04 100644 --- a/mlir/lib/Bindings/Python/IRModule.cpp +++ b/mlir/lib/Bindings/Python/IRModule.cpp @@ -8,16 +8,14 @@ #include "IRModule.h" -#include -#include - #include #include #include "Globals.h" #include "NanobindUtils.h" -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/Support.h" +#include "mlir/Bindings/Python/Nanobind.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. namespace nb = nanobind; using namespace mlir; diff --git a/mlir/lib/Bindings/Python/IRModule.h b/mlir/lib/Bindings/Python/IRModule.h index a242ff26bbbf5..8fb32a225e65f 100644 --- a/mlir/lib/Bindings/Python/IRModule.h +++ b/mlir/lib/Bindings/Python/IRModule.h @@ -10,9 +10,6 @@ #ifndef MLIR_BINDINGS_PYTHON_IRMODULES_H #define MLIR_BINDINGS_PYTHON_IRMODULES_H -#include -#include - #include #include #include @@ -26,6 +23,7 @@ #include "mlir-c/IntegerSet.h" #include "mlir-c/Transforms.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "llvm/ADT/DenseMap.h" namespace mlir { diff --git a/mlir/lib/Bindings/Python/IRTypes.cpp b/mlir/lib/Bindings/Python/IRTypes.cpp index 5cfa51142ac08..0f2719c10a027 100644 --- a/mlir/lib/Bindings/Python/IRTypes.cpp +++ b/mlir/lib/Bindings/Python/IRTypes.cpp @@ -11,12 +11,6 @@ #include "mlir/Bindings/Python/IRTypes.h" // clang-format on -#include -#include -#include -#include -#include - #include #include "IRModule.h" diff --git a/mlir/lib/Bindings/Python/LinalgPasses.cpp b/mlir/lib/Bindings/Python/LinalgPasses.cpp index 3f230207a4211..49f2ea94151a0 100644 --- a/mlir/lib/Bindings/Python/LinalgPasses.cpp +++ b/mlir/lib/Bindings/Python/LinalgPasses.cpp @@ -8,13 +8,13 @@ #include "mlir-c/Dialect/Linalg.h" -#include +#include "mlir/Bindings/Python/Nanobind.h" // ----------------------------------------------------------------------------- // Module initialization. // ----------------------------------------------------------------------------- -PYBIND11_MODULE(_mlirLinalgPasses, m) { +NB_MODULE(_mlirLinalgPasses, m) { m.doc() = "MLIR Linalg Dialect Passes"; // Register all Linalg passes on load. diff --git a/mlir/lib/Bindings/Python/MainModule.cpp b/mlir/lib/Bindings/Python/MainModule.cpp index e5e64a921a79a..7c4064262012e 100644 --- a/mlir/lib/Bindings/Python/MainModule.cpp +++ b/mlir/lib/Bindings/Python/MainModule.cpp @@ -6,14 +6,13 @@ // //===----------------------------------------------------------------------===// -#include -#include #include "Globals.h" #include "IRModule.h" #include "NanobindUtils.h" #include "Pass.h" #include "Rewrite.h" +#include "mlir/Bindings/Python/Nanobind.h" namespace nb = nanobind; using namespace mlir; diff --git a/mlir/lib/Bindings/Python/NanobindUtils.h b/mlir/lib/Bindings/Python/NanobindUtils.h index 3b0f7f698b22d..ee193cf9f8ef8 100644 --- a/mlir/lib/Bindings/Python/NanobindUtils.h +++ b/mlir/lib/Bindings/Python/NanobindUtils.h @@ -10,9 +10,8 @@ #ifndef MLIR_BINDINGS_PYTHON_PYBINDUTILS_H #define MLIR_BINDINGS_PYTHON_PYBINDUTILS_H -#include - #include "mlir-c/Support.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/DataTypes.h" @@ -68,7 +67,7 @@ namespace detail { template struct MlirDefaultingCaster { - NB_TYPE_CASTER(DefaultingTy, const_name(DefaultingTy::kTypeDescription)); + NB_TYPE_CASTER(DefaultingTy, const_name(DefaultingTy::kTypeDescription)) bool from_python(handle src, uint8_t flags, cleanup_list *cleanup) { if (src.is_none()) { diff --git a/mlir/lib/Bindings/Python/Pass.cpp b/mlir/lib/Bindings/Python/Pass.cpp index b5dce4fe4128a..858c3bd5745fe 100644 --- a/mlir/lib/Bindings/Python/Pass.cpp +++ b/mlir/lib/Bindings/Python/Pass.cpp @@ -8,13 +8,10 @@ #include "Pass.h" -#include -#include -#include - #include "IRModule.h" -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/Pass.h" +#include "mlir/Bindings/Python/Nanobind.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. namespace nb = nanobind; using namespace nb::literals; diff --git a/mlir/lib/Bindings/Python/RegisterEverything.cpp b/mlir/lib/Bindings/Python/RegisterEverything.cpp index 6b2f6b0a6a3b8..3ba42bec5d80c 100644 --- a/mlir/lib/Bindings/Python/RegisterEverything.cpp +++ b/mlir/lib/Bindings/Python/RegisterEverything.cpp @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "mlir-c/RegisterEverything.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -PYBIND11_MODULE(_mlirRegisterEverything, m) { +NB_MODULE(_mlirRegisterEverything, m) { m.doc() = "MLIR All Upstream Dialects, Translations and Passes Registration"; m.def("register_dialects", [](MlirDialectRegistry registry) { diff --git a/mlir/lib/Bindings/Python/Rewrite.cpp b/mlir/lib/Bindings/Python/Rewrite.cpp index b2c1de4be9a69..0373f9c7affe9 100644 --- a/mlir/lib/Bindings/Python/Rewrite.cpp +++ b/mlir/lib/Bindings/Python/Rewrite.cpp @@ -8,11 +8,10 @@ #include "Rewrite.h" -#include - #include "IRModule.h" -#include "mlir-c/Bindings/Python/Interop.h" #include "mlir-c/Rewrite.h" +#include "mlir/Bindings/Python/Nanobind.h" +#include "mlir-c/Bindings/Python/Interop.h" // This is expected after nanobind. #include "mlir/Config/mlir-config.h" namespace nb = nanobind; diff --git a/mlir/lib/Bindings/Python/SparseTensorPasses.cpp b/mlir/lib/Bindings/Python/SparseTensorPasses.cpp index 2a8e2b802df9c..8242f0973a446 100644 --- a/mlir/lib/Bindings/Python/SparseTensorPasses.cpp +++ b/mlir/lib/Bindings/Python/SparseTensorPasses.cpp @@ -8,13 +8,13 @@ #include "mlir-c/Dialect/SparseTensor.h" -#include +#include "mlir/Bindings/Python/Nanobind.h" // ----------------------------------------------------------------------------- // Module initialization. // ----------------------------------------------------------------------------- -PYBIND11_MODULE(_mlirSparseTensorPasses, m) { +NB_MODULE(_mlirSparseTensorPasses, m) { m.doc() = "MLIR SparseTensor Dialect Passes"; // Register all SparseTensor passes on load. diff --git a/mlir/lib/Bindings/Python/TransformInterpreter.cpp b/mlir/lib/Bindings/Python/TransformInterpreter.cpp index 0c8c0e0a965aa..f9b0fed62778f 100644 --- a/mlir/lib/Bindings/Python/TransformInterpreter.cpp +++ b/mlir/lib/Bindings/Python/TransformInterpreter.cpp @@ -10,16 +10,14 @@ // //===----------------------------------------------------------------------===// -#include -#include - #include "mlir-c/Dialect/Transform/Interpreter.h" #include "mlir-c/IR.h" #include "mlir-c/Support.h" #include "mlir/Bindings/Python/Diagnostics.h" -#include "mlir/Bindings/Python/PybindAdaptors.h" +#include "mlir/Bindings/Python/NanobindAdaptors.h" +#include "mlir/Bindings/Python/Nanobind.h" -namespace py = pybind11; +namespace nb = nanobind; namespace { struct PyMlirTransformOptions { @@ -36,10 +34,10 @@ struct PyMlirTransformOptions { }; } // namespace -static void populateTransformInterpreterSubmodule(py::module &m) { - py::class_(m, "TransformOptions", py::module_local()) - .def(py::init()) - .def_property( +static void populateTransformInterpreterSubmodule(nb::module_ &m) { + nb::class_(m, "TransformOptions") + .def(nb::init<>()) + .def_prop_rw( "expensive_checks", [](const PyMlirTransformOptions &self) { return mlirTransformOptionsGetExpensiveChecksEnabled(self.options); @@ -47,7 +45,7 @@ static void populateTransformInterpreterSubmodule(py::module &m) { [](PyMlirTransformOptions &self, bool value) { mlirTransformOptionsEnableExpensiveChecks(self.options, value); }) - .def_property( + .def_prop_rw( "enforce_single_top_level_transform_op", [](const PyMlirTransformOptions &self) { return mlirTransformOptionsGetEnforceSingleTopLevelTransformOp( @@ -68,7 +66,7 @@ static void populateTransformInterpreterSubmodule(py::module &m) { // Calling back into Python to invalidate everything under the payload // root. This is awkward, but we don't have access to PyMlirContext // object here otherwise. - py::object obj = py::cast(payloadRoot); + nb::object obj = nb::cast(payloadRoot); obj.attr("context").attr("_clear_live_operations_inside")(payloadRoot); MlirLogicalResult result = mlirTransformApplyNamedSequence( @@ -76,13 +74,14 @@ static void populateTransformInterpreterSubmodule(py::module &m) { if (mlirLogicalResultIsSuccess(result)) return; - throw py::value_error( - "Failed to apply named transform sequence.\nDiagnostic message " + - scope.takeMessage()); + throw nb::value_error( + ("Failed to apply named transform sequence.\nDiagnostic message " + + scope.takeMessage()) + .c_str()); }, - py::arg("payload_root"), py::arg("transform_root"), - py::arg("transform_module"), - py::arg("transform_options") = PyMlirTransformOptions()); + nb::arg("payload_root"), nb::arg("transform_root"), + nb::arg("transform_module"), + nb::arg("transform_options") = PyMlirTransformOptions()); m.def( "copy_symbols_and_merge_into", @@ -92,15 +91,16 @@ static void populateTransformInterpreterSubmodule(py::module &m) { MlirLogicalResult result = mlirMergeSymbolsIntoFromClone(target, other); if (mlirLogicalResultIsFailure(result)) { - throw py::value_error( - "Failed to merge symbols.\nDiagnostic message " + - scope.takeMessage()); + throw nb::value_error( + ("Failed to merge symbols.\nDiagnostic message " + + scope.takeMessage()) + .c_str()); } }, - py::arg("target"), py::arg("other")); + nb::arg("target"), nb::arg("other")); } -PYBIND11_MODULE(_mlirTransformInterpreter, m) { +NB_MODULE(_mlirTransformInterpreter, m) { m.doc() = "MLIR Transform dialect interpreter functionality."; populateTransformInterpreterSubmodule(m); } diff --git a/mlir/python/CMakeLists.txt b/mlir/python/CMakeLists.txt index 6d6b983128b80..fb115a5f43423 100644 --- a/mlir/python/CMakeLists.txt +++ b/mlir/python/CMakeLists.txt @@ -476,9 +476,6 @@ declare_mlir_python_extension(MLIRPythonExtension.Core # Dialects MLIRCAPIFunc ) -if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL) -set_target_properties(MLIRPythonExtension.Core PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-cast-qual;-Wno-zero-length-array;-Wno-extra-semi;-Wno-nested-anon-types;-Wno-pedantic") -endif() # This extension exposes an API to register all dialects, extensions, and passes # packaged in upstream MLIR and it is used for the upstream "mlir" Python @@ -490,6 +487,7 @@ endif() declare_mlir_python_extension(MLIRPythonExtension.RegisterEverything MODULE_NAME _mlirRegisterEverything ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES RegisterEverything.cpp PRIVATE_LINK_LIBS @@ -504,6 +502,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.Linalg.Pybind MODULE_NAME _mlirDialectsLinalg ADD_TO_PARENT MLIRPythonSources.Dialects.linalg ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectLinalg.cpp PRIVATE_LINK_LIBS @@ -517,6 +516,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.GPU.Pybind MODULE_NAME _mlirDialectsGPU ADD_TO_PARENT MLIRPythonSources.Dialects.gpu ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectGPU.cpp PRIVATE_LINK_LIBS @@ -530,6 +530,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.LLVM.Pybind MODULE_NAME _mlirDialectsLLVM ADD_TO_PARENT MLIRPythonSources.Dialects.llvm ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectLLVM.cpp PRIVATE_LINK_LIBS @@ -543,6 +544,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.Quant.Pybind MODULE_NAME _mlirDialectsQuant ADD_TO_PARENT MLIRPythonSources.Dialects.quant ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectQuant.cpp PRIVATE_LINK_LIBS @@ -556,6 +558,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.NVGPU.Pybind MODULE_NAME _mlirDialectsNVGPU ADD_TO_PARENT MLIRPythonSources.Dialects.nvgpu ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectNVGPU.cpp PRIVATE_LINK_LIBS @@ -569,6 +572,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.PDL.Pybind MODULE_NAME _mlirDialectsPDL ADD_TO_PARENT MLIRPythonSources.Dialects.pdl ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectPDL.cpp PRIVATE_LINK_LIBS @@ -582,6 +586,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.SparseTensor.Pybind MODULE_NAME _mlirDialectsSparseTensor ADD_TO_PARENT MLIRPythonSources.Dialects.sparse_tensor ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectSparseTensor.cpp PRIVATE_LINK_LIBS @@ -595,6 +600,7 @@ declare_mlir_python_extension(MLIRPythonExtension.Dialects.Transform.Pybind MODULE_NAME _mlirDialectsTransform ADD_TO_PARENT MLIRPythonSources.Dialects.transform ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES DialectTransform.cpp PRIVATE_LINK_LIBS @@ -608,6 +614,7 @@ declare_mlir_python_extension(MLIRPythonExtension.AsyncDialectPasses MODULE_NAME _mlirAsyncPasses ADD_TO_PARENT MLIRPythonSources.Dialects.async ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES AsyncPasses.cpp PRIVATE_LINK_LIBS @@ -621,6 +628,7 @@ if(MLIR_ENABLE_EXECUTION_ENGINE) MODULE_NAME _mlirExecutionEngine ADD_TO_PARENT MLIRPythonSources.ExecutionEngine ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES ExecutionEngineModule.cpp PRIVATE_LINK_LIBS @@ -634,6 +642,7 @@ declare_mlir_python_extension(MLIRPythonExtension.GPUDialectPasses MODULE_NAME _mlirGPUPasses ADD_TO_PARENT MLIRPythonSources.Dialects.gpu ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES GPUPasses.cpp PRIVATE_LINK_LIBS @@ -646,6 +655,7 @@ declare_mlir_python_extension(MLIRPythonExtension.LinalgPasses MODULE_NAME _mlirLinalgPasses ADD_TO_PARENT MLIRPythonSources.Dialects.linalg ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES LinalgPasses.cpp PRIVATE_LINK_LIBS @@ -658,6 +668,7 @@ declare_mlir_python_extension(MLIRPythonExtension.SparseTensorDialectPasses MODULE_NAME _mlirSparseTensorPasses ADD_TO_PARENT MLIRPythonSources.Dialects.sparse_tensor ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES SparseTensorPasses.cpp PRIVATE_LINK_LIBS @@ -670,6 +681,7 @@ declare_mlir_python_extension(MLIRPythonExtension.TransformInterpreter MODULE_NAME _mlirTransformInterpreter ADD_TO_PARENT MLIRPythonSources.Dialects.transform ROOT_DIR "${PYTHON_SOURCE_DIR}" + PYTHON_BINDINGS_LIBRARY nanobind SOURCES TransformInterpreter.cpp PRIVATE_LINK_LIBS @@ -735,9 +747,6 @@ if(MLIR_INCLUDE_TESTS) EMBED_CAPI_LINK_LIBS MLIRCAPIPythonTestDialect ) - if (LLVM_COMPILER_IS_GCC_COMPATIBLE OR CLANG_CL) - set_target_properties(MLIRPythonTestSources.PythonTestExtensionNanobind PROPERTIES INTERFACE_COMPILE_OPTIONS "-Wno-cast-qual;-Wno-zero-length-array;-Wno-extra-semi;-Wno-nested-anon-types;-Wno-pedantic") - endif() endif() ################################################################################ @@ -794,3 +803,4 @@ add_mlir_python_modules(MLIRPythonModules COMMON_CAPI_LINK_LIBS MLIRPythonCAPI ) + diff --git a/mlir/test/python/dialects/sparse_tensor/dialect.py b/mlir/test/python/dialects/sparse_tensor/dialect.py index 656979f3d9a1d..c72a69830a1e8 100644 --- a/mlir/test/python/dialects/sparse_tensor/dialect.py +++ b/mlir/test/python/dialects/sparse_tensor/dialect.py @@ -90,7 +90,7 @@ def testEncodingAttrStructure(): # CHECK: lvl_types: [65536, 65536, 4406638542848] print(f"lvl_types: {casted.lvl_types}") - # CHECK: lvl_formats_enum: [, , ] + # CHECK: lvl_formats_enum: [{{65536|LevelFormat.dense}}, {{65536|LevelFormat.dense}}, {{2097152|LevelFormat.n_out_of_m}}] print(f"lvl_formats_enum: {casted.lvl_formats_enum}") # CHECK: structured_n: 2 print(f"structured_n: {casted.structured_n}") diff --git a/mlir/test/python/lib/PythonTestModuleNanobind.cpp b/mlir/test/python/lib/PythonTestModuleNanobind.cpp index 7c504d04be0d1..99c81eae97a0c 100644 --- a/mlir/test/python/lib/PythonTestModuleNanobind.cpp +++ b/mlir/test/python/lib/PythonTestModuleNanobind.cpp @@ -8,13 +8,11 @@ // This is the nanobind edition of the PythonTest dialect module. //===----------------------------------------------------------------------===// -#include -#include - #include "PythonTestCAPI.h" #include "mlir-c/BuiltinAttributes.h" #include "mlir-c/BuiltinTypes.h" #include "mlir-c/IR.h" +#include "mlir/Bindings/Python/Nanobind.h" #include "mlir/Bindings/Python/NanobindAdaptors.h" namespace nb = nanobind; diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel index d2ac43ef5bcff..f1192d069fa5f 100644 --- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel +++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel @@ -1131,7 +1131,8 @@ cc_binary( deps = [ ":CAPIIR", ":CAPILinalg", - ":MLIRBindingsPythonHeadersAndDeps", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", ], ) @@ -1145,8 +1146,8 @@ cc_binary( deps = [ ":CAPIIR", ":CAPILLVM", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", ], ) @@ -1160,8 +1161,8 @@ cc_binary( deps = [ ":CAPIIR", ":CAPIQuant", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", ], ) @@ -1175,8 +1176,8 @@ cc_binary( deps = [ ":CAPIIR", ":CAPISparseTensor", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", ], ) @@ -1190,8 +1191,8 @@ cc_binary( linkstatic = 0, deps = [ ":CAPIExecutionEngine", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", "@rules_python//python/cc:current_py_cc_headers", ], ) @@ -1206,8 +1207,8 @@ cc_binary( linkstatic = 0, deps = [ ":CAPILinalg", - ":MLIRBindingsPythonHeadersAndDeps", - "@pybind11", + ":MLIRBindingsPythonNanobindHeadersAndDeps", + "@nanobind", "@rules_python//python/cc:current_py_cc_headers", ], ) From cbf931e16f6d1ebe4c8a2f32315f21615a934f32 Mon Sep 17 00:00:00 2001 From: Sergei Barannikov Date: Sat, 21 Dec 2024 08:06:29 +0300 Subject: [PATCH 058/466] [TableGen][GlobalISel] Add GINodeEquiv for sdivrem/udivrem (#120819) These nodes are not currently used in DAG patterns. Their GlobalISel equivalents are primarily useful for testing TableGen backend, as they produce two results. (There doesn't seem to be other such nodes.) --- llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td | 2 ++ llvm/include/llvm/Target/TargetSelectionDAG.td | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td b/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td index 2148f5be4c41a..c8c0eeb57099a 100644 --- a/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td +++ b/llvm/include/llvm/Target/GlobalISel/SelectionDAGCompat.td @@ -70,6 +70,8 @@ def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; +def : GINodeEquiv; +def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; def : GINodeEquiv; diff --git a/llvm/include/llvm/Target/TargetSelectionDAG.td b/llvm/include/llvm/Target/TargetSelectionDAG.td index 2c58eedce1de0..bee0a4298c786 100644 --- a/llvm/include/llvm/Target/TargetSelectionDAG.td +++ b/llvm/include/llvm/Target/TargetSelectionDAG.td @@ -128,8 +128,8 @@ def SDTIntShiftDOp: SDTypeProfile<1, 3, [ // fshl, fshr def SDTIntSatNoShOp : SDTypeProfile<1, 2, [ // ssat with no shift SDTCisSameAs<0, 1>, SDTCisInt<2> ]>; -def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // mulhi, mullo, sdivrem, udivrem - SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>,SDTCisInt<0> +def SDTIntBinHiLoOp : SDTypeProfile<2, 2, [ // smullohi, umullohi, sdivrem, udivrem + SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisSameAs<0, 3>, SDTCisInt<0> ]>; def SDTIntScaledBinOp : SDTypeProfile<1, 3, [ // smulfix, sdivfix, etc SDTCisSameAs<0, 1>, SDTCisSameAs<0, 2>, SDTCisInt<0>, SDTCisInt<3> From 665d79f2e967a5eee6fff93685e45f50cf24cab2 Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Fri, 20 Dec 2024 22:13:59 -0800 Subject: [PATCH 059/466] [AArch64][GlobalISel] Implement G_ICMP support for oversize pointer vectors. --- .../AArch64/GISel/AArch64LegalizerInfo.cpp | 7 +- .../AArch64/GlobalISel/legalize-cmp.mir | 65 +++++++++++++++++++ 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp index f83ad7aa7460e..155d98f0865f7 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp @@ -563,13 +563,16 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) [=](const LegalityQuery &Query) { return Query.Types[1] == v2s16; }, 1, s32) .minScalarOrEltIf( - [=](const LegalityQuery &Query) { return Query.Types[1] == v2p0; }, 0, - s64) + [=](const LegalityQuery &Query) { + return Query.Types[1].isPointerVector(); + }, + 0, s64) .moreElementsToNextPow2(1) .clampNumElements(1, v8s8, v16s8) .clampNumElements(1, v4s16, v8s16) .clampNumElements(1, v2s32, v4s32) .clampNumElements(1, v2s64, v2s64) + .clampNumElements(1, v2p0, v2p0) .customIf(isVector(0)); getActionDefinitionsBuilder(G_FCMP) diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir index d96f6fbc12c7c..40fd92b9504e0 100644 --- a/llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir +++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir @@ -541,3 +541,68 @@ body: | %zext:_(s32) = G_ZEXT %2(s8) $w0 = COPY %zext(s32) RET_ReallyLR +... +--- +name: test_4xs64_ne +tracksRegLiveness: true +body: | + bb.1: + liveins: + ; CHECK-LABEL: name: test_4xs64_ne + ; CHECK: [[DEF:%[0-9]+]]:_(<2 x s64>) = G_IMPLICIT_DEF + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s64>) = G_ICMP intpred(eq), [[DEF]](<2 x s64>), [[DEF]] + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64) + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(<2 x s64>) = G_XOR [[ICMP]], [[BUILD_VECTOR]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s64>) = G_ICMP intpred(eq), [[DEF]](<2 x s64>), [[DEF]] + ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64) + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(<2 x s64>) = G_XOR [[ICMP1]], [[BUILD_VECTOR1]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(<2 x s32>) = G_TRUNC [[XOR]](<2 x s64>) + ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(<2 x s32>) = G_TRUNC [[XOR1]](<2 x s64>) + ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<4 x s32>) = G_CONCAT_VECTORS [[TRUNC]](<2 x s32>), [[TRUNC1]](<2 x s32>) + ; CHECK-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[CONCAT_VECTORS]](<4 x s32>), [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: %zext:_(s32) = G_AND [[EVEC]], [[C2]] + ; CHECK-NEXT: $w0 = COPY %zext(s32) + ; CHECK-NEXT: RET_ReallyLR + %vec:_(<4 x s64>) = G_IMPLICIT_DEF + %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %vec(<4 x s64>), %vec + %1:_(s64) = G_CONSTANT i64 1 + %elt:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<4 x s1>), %1 + %zext:_(s32) = G_ZEXT %elt(s1) + $w0 = COPY %zext(s32) + RET_ReallyLR +... +--- +name: test_4xp0_ne +tracksRegLiveness: true +body: | + bb.1: + liveins: + ; CHECK-LABEL: name: test_4xp0_ne + ; CHECK: [[DEF:%[0-9]+]]:_(<2 x p0>) = G_IMPLICIT_DEF + ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(<2 x s64>) = G_ICMP intpred(eq), [[DEF]](<2 x p0>), [[DEF]] + ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 -1 + ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64) + ; CHECK-NEXT: [[XOR:%[0-9]+]]:_(<2 x s64>) = G_XOR [[ICMP]], [[BUILD_VECTOR]] + ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(<2 x s64>) = G_ICMP intpred(eq), [[DEF]](<2 x p0>), [[DEF]] + ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s64>) = G_BUILD_VECTOR [[C]](s64), [[C]](s64) + ; CHECK-NEXT: [[XOR1:%[0-9]+]]:_(<2 x s64>) = G_XOR [[ICMP1]], [[BUILD_VECTOR1]] + ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 1 + ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(<2 x s32>) = G_TRUNC [[XOR]](<2 x s64>) + ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(<2 x s32>) = G_TRUNC [[XOR1]](<2 x s64>) + ; CHECK-NEXT: [[CONCAT_VECTORS:%[0-9]+]]:_(<4 x s32>) = G_CONCAT_VECTORS [[TRUNC]](<2 x s32>), [[TRUNC1]](<2 x s32>) + ; CHECK-NEXT: [[EVEC:%[0-9]+]]:_(s32) = G_EXTRACT_VECTOR_ELT [[CONCAT_VECTORS]](<4 x s32>), [[C1]](s64) + ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 1 + ; CHECK-NEXT: %zext:_(s32) = G_AND [[EVEC]], [[C2]] + ; CHECK-NEXT: $w0 = COPY %zext(s32) + ; CHECK-NEXT: RET_ReallyLR + %vec:_(<4 x p0>) = G_IMPLICIT_DEF + %cmp:_(<4 x s1>) = G_ICMP intpred(ne), %vec(<4 x p0>), %vec + %1:_(s64) = G_CONSTANT i64 1 + %elt:_(s1) = G_EXTRACT_VECTOR_ELT %cmp(<4 x s1>), %1 + %zext:_(s32) = G_ZEXT %elt(s1) + $w0 = COPY %zext(s32) + RET_ReallyLR +... From 7a38445ee2ac89fe240479d052373df23561ab57 Mon Sep 17 00:00:00 2001 From: vporpo Date: Fri, 20 Dec 2024 23:10:24 -0800 Subject: [PATCH 060/466] [SandboxVec][DAG] Register move instr callback (#120146) This patch implements the move instruction notifier for the DAG. Whenever an instruction moves the notifier will maintain the DAG. --- .../SandboxVectorizer/DependencyGraph.h | 18 ++++++++ .../SandboxVectorizer/DependencyGraph.cpp | 46 +++++++++++++++++++ .../SandboxVectorizer/DependencyGraphTest.cpp | 35 +++++++++++++- 3 files changed, 98 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h index b1cad2421bc0d..f423e1ee456cd 100644 --- a/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h +++ b/llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.h @@ -220,6 +220,14 @@ class MemDGNode final : public DGNode { void setNextNode(MemDGNode *N) { NextMemN = N; } void setPrevNode(MemDGNode *N) { PrevMemN = N; } friend class DependencyGraph; // For setNextNode(), setPrevNode(). + void detachFromChain() { + if (PrevMemN != nullptr) + PrevMemN->NextMemN = NextMemN; + if (NextMemN != nullptr) + NextMemN->PrevMemN = PrevMemN; + PrevMemN = nullptr; + NextMemN = nullptr; + } public: MemDGNode(Instruction *I) : DGNode(I, DGNodeID::MemDGNode) { @@ -293,6 +301,7 @@ class DependencyGraph { Context *Ctx = nullptr; std::optional CreateInstrCB; std::optional EraseInstrCB; + std::optional MoveInstrCB; std::unique_ptr BatchAA; @@ -343,6 +352,9 @@ class DependencyGraph { /// Called by the callbacks when instruction \p I is about to get /// deleted. void notifyEraseInstr(Instruction *I); + /// Called by the callbacks when instruction \p I is about to be moved to + /// \p To. + void notifyMoveInstr(Instruction *I, const BBIterator &To); public: /// This constructor also registers callbacks. @@ -352,12 +364,18 @@ class DependencyGraph { [this](Instruction *I) { notifyCreateInstr(I); }); EraseInstrCB = Ctx.registerEraseInstrCallback( [this](Instruction *I) { notifyEraseInstr(I); }); + MoveInstrCB = Ctx.registerMoveInstrCallback( + [this](Instruction *I, const BBIterator &To) { + notifyMoveInstr(I, To); + }); } ~DependencyGraph() { if (CreateInstrCB) Ctx->unregisterCreateInstrCallback(*CreateInstrCB); if (EraseInstrCB) Ctx->unregisterEraseInstrCallback(*EraseInstrCB); + if (MoveInstrCB) + Ctx->unregisterMoveInstrCallback(*MoveInstrCB); } DGNode *getNode(Instruction *I) const { diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp index 25f2665d450d1..ba62c45a4e704 100644 --- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp +++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/DependencyGraph.cpp @@ -370,6 +370,52 @@ void DependencyGraph::notifyCreateInstr(Instruction *I) { } } +void DependencyGraph::notifyMoveInstr(Instruction *I, const BBIterator &To) { + // Early return if `I` doesn't actually move. + BasicBlock *BB = To.getNodeParent(); + if (To != BB->end() && &*To == I->getNextNode()) + return; + + // Maintain the DAGInterval. + DAGInterval.notifyMoveInstr(I, To); + + // TODO: Perhaps check if this is legal by checking the dependencies? + + // Update the MemDGNode chain to reflect the instr movement if necessary. + DGNode *N = getNodeOrNull(I); + if (N == nullptr) + return; + MemDGNode *MemN = dyn_cast(N); + if (MemN == nullptr) + return; + // First detach it from the existing chain. + MemN->detachFromChain(); + // Now insert it back into the chain at the new location. + if (To != BB->end()) { + DGNode *ToN = getNodeOrNull(&*To); + if (ToN != nullptr) { + MemDGNode *PrevMemN = getMemDGNodeBefore(ToN, /*IncludingN=*/false); + MemDGNode *NextMemN = getMemDGNodeAfter(ToN, /*IncludingN=*/true); + MemN->PrevMemN = PrevMemN; + if (PrevMemN != nullptr) + PrevMemN->NextMemN = MemN; + MemN->NextMemN = NextMemN; + if (NextMemN != nullptr) + NextMemN->PrevMemN = MemN; + } + } else { + // MemN becomes the last instruction in the BB. + auto *TermN = getNodeOrNull(BB->getTerminator()); + if (TermN != nullptr) { + MemDGNode *PrevMemN = getMemDGNodeBefore(TermN, /*IncludingN=*/false); + PrevMemN->NextMemN = MemN; + MemN->PrevMemN = PrevMemN; + } else { + // The terminator is outside the DAG interval so do nothing. + } + } +} + void DependencyGraph::notifyEraseInstr(Instruction *I) { // Update the MemDGNode chain if this is a memory node. if (auto *MemN = dyn_cast_or_null(getNodeOrNull(I))) { diff --git a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp index 8c73ee1def8ae..3fa4de501f3f5 100644 --- a/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/SandboxVectorizer/DependencyGraphTest.cpp @@ -801,7 +801,7 @@ define void @foo(ptr %ptr, i8 %v1, i8 %v2, i8 %v3, i8 %v4, i8 %v5) { TEST_F(DependencyGraphTest, CreateInstrCallback) { parseIR(C, R"IR( -define void @foo(ptr %ptr, i8 %v1, i8 %v2, i8 %v3, i8 %arg) { +define void @foo(ptr %ptr, ptr noalias %ptr2, i8 %v1, i8 %v2, i8 %v3, i8 %arg) { store i8 %v1, ptr %ptr store i8 %v2, ptr %ptr store i8 %v3, ptr %ptr @@ -893,3 +893,36 @@ define void @foo(ptr %ptr, i8 %v1, i8 %v2, i8 %v3, i8 %arg) { // TODO: Check the dependencies to/from NewSN after they land. } + +TEST_F(DependencyGraphTest, MoveInstrCallback) { + parseIR(C, R"IR( +define void @foo(ptr %ptr, ptr %ptr2, i8 %v1, i8 %v2, i8 %v3, i8 %arg) { + %ld0 = load i8, ptr %ptr2 + store i8 %v1, ptr %ptr + store i8 %v2, ptr %ptr + store i8 %v3, ptr %ptr + ret void +} +)IR"); + llvm::Function *LLVMF = &*M->getFunction("foo"); + sandboxir::Context Ctx(C); + auto *F = Ctx.createFunction(LLVMF); + auto *BB = &*F->begin(); + auto It = BB->begin(); + auto *Ld = cast(&*It++); + auto *S1 = cast(&*It++); + auto *S2 = cast(&*It++); + auto *S3 = cast(&*It++); + + sandboxir::DependencyGraph DAG(getAA(*LLVMF), Ctx); + DAG.extend({Ld, S3}); + auto *LdN = cast(DAG.getNode(Ld)); + auto *S1N = cast(DAG.getNode(S1)); + auto *S2N = cast(DAG.getNode(S2)); + EXPECT_EQ(S1N->getPrevNode(), LdN); + S1->moveBefore(Ld); + EXPECT_EQ(S1N->getPrevNode(), nullptr); + EXPECT_EQ(S1N->getNextNode(), LdN); + EXPECT_EQ(LdN->getPrevNode(), S1N); + EXPECT_EQ(LdN->getNextNode(), S2N); +} From f06756f50e1f70664adc25a41ccabf5b018a504a Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Sat, 21 Dec 2024 20:19:56 +1300 Subject: [PATCH 061/466] Store sysreg names in-line with their descriptors. (#119157) This wastes some disk space, because we have to size the arrays for the maximum possible length. However, it eliminates dynamic relocations from the SysRegsList arrays. --- llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h | 4 ++-- llvm/lib/Target/ARM/Utils/ARMBaseInfo.h | 2 +- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h index 8f34cf054fe28..e0ccba4d6a59e 100644 --- a/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h +++ b/llvm/lib/Target/AArch64/Utils/AArch64BaseInfo.h @@ -700,8 +700,8 @@ AArch64StringToVectorLayout(StringRef LayoutStr) { namespace AArch64SysReg { struct SysReg { - const char *Name; - const char *AltName; + const char Name[32]; + const char AltName[32]; unsigned Encoding; bool Readable; bool Writeable; diff --git a/llvm/lib/Target/ARM/Utils/ARMBaseInfo.h b/llvm/lib/Target/ARM/Utils/ARMBaseInfo.h index 56a925f09ea7a..5562572c5abf4 100644 --- a/llvm/lib/Target/ARM/Utils/ARMBaseInfo.h +++ b/llvm/lib/Target/ARM/Utils/ARMBaseInfo.h @@ -189,7 +189,7 @@ inline static unsigned ARMCondCodeFromString(StringRef CC) { // System Registers namespace ARMSysReg { struct MClassSysReg { - const char *Name; + const char Name[32]; uint16_t M1Encoding12; uint16_t M2M3Encoding8; uint16_t Encoding; diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h index 056b6da34ac70..370350719b230 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -452,9 +452,9 @@ int getLoadFPImm(APFloat FPImm); namespace RISCVSysReg { struct SysReg { - const char *Name; - const char *AltName; - const char *DeprecatedName; + const char Name[32]; + const char AltName[32]; + const char DeprecatedName[32]; unsigned Encoding; // FIXME: add these additional fields when needed. // Privilege Access: Read, Write, Read-Only. From e138f7831e62054d3971f716273fbe174176deca Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Fri, 20 Dec 2024 23:29:58 -0800 Subject: [PATCH 062/466] [RISCV] Remove unnecessary 'let BaseInstr' from Xsfvcp pseudoinstructions. NFC These are identical to the RISCVVPseudo base class. --- llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td | 6 ------ 1 file changed, 6 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td index 1ad3e1b681466..20adda91f6bde 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td @@ -238,7 +238,6 @@ class VPseudoVC_X : let HasVLOp = 1; let HasSEWOp = 1; let hasSideEffects = 0; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoVC_XV : @@ -251,7 +250,6 @@ class VPseudoVC_XV : let HasVLOp = 1; let HasSEWOp = 1; let hasSideEffects = 0; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoVC_XVV(PseudoToVInst.VInst); } class VPseudoVC_V_X : @@ -278,7 +275,6 @@ class VPseudoVC_V_X : let HasVLOp = 1; let HasSEWOp = 1; let hasSideEffects = 0; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoVC_V_XV(PseudoToVInst.VInst); } class VPseudoVC_V_XVV(PseudoToVInst.VInst); } multiclass VPseudoVC_X Date: Sat, 21 Dec 2024 09:47:07 +0000 Subject: [PATCH 063/466] [RISCV][NFCI] Rationalize Immediate Definitions (#120718) --- .../Target/RISCV/MCTargetDesc/RISCVBaseInfo.h | 6 +-- .../RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp | 10 ++--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 18 ++++---- llvm/lib/Target/RISCV/RISCVInstrInfo.td | 42 ++++++++----------- llvm/lib/Target/RISCV/RISCVInstrInfoC.td | 5 +-- llvm/lib/Target/RISCV/RISCVInstrInfoV.td | 8 +--- llvm/lib/Target/RISCV/RISCVInstrInfoXwch.td | 42 ++++++------------- 7 files changed, 48 insertions(+), 83 deletions(-) diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h index 370350719b230..b9f4db065f215 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h @@ -316,6 +316,9 @@ enum OperandType : unsigned { OPERAND_UIMM11, OPERAND_UIMM12, OPERAND_UIMM16, + OPERAND_UIMM20, + OPERAND_UIMMLOG2XLEN, + OPERAND_UIMMLOG2XLEN_NONZERO, OPERAND_UIMM32, OPERAND_UIMM48, OPERAND_UIMM64, @@ -327,9 +330,6 @@ enum OperandType : unsigned { OPERAND_SIMM10_LSB0000_NONZERO, OPERAND_SIMM12, OPERAND_SIMM12_LSB00000, - OPERAND_UIMM20, - OPERAND_UIMMLOG2XLEN, - OPERAND_UIMMLOG2XLEN_NONZERO, OPERAND_CLUI_IMM, OPERAND_VTYPEI10, OPERAND_VTYPEI11, diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp index a28bf1186589d..06d9cce48692a 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp @@ -80,11 +80,11 @@ class RISCVMCCodeEmitter : public MCCodeEmitter { SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; - unsigned getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, + uint64_t getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; - unsigned getImmOpValue(const MCInst &MI, unsigned OpNo, + uint64_t getImmOpValue(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const; @@ -385,14 +385,14 @@ RISCVMCCodeEmitter::getMachineOpValue(const MCInst &MI, const MCOperand &MO, return 0; } -unsigned +uint64_t RISCVMCCodeEmitter::getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const { const MCOperand &MO = MI.getOperand(OpNo); if (MO.isImm()) { - unsigned Res = MO.getImm(); + uint64_t Res = MO.getImm(); assert((Res & 1) == 0 && "LSB is non-zero"); return Res >> 1; } @@ -400,7 +400,7 @@ RISCVMCCodeEmitter::getImmOpValueAsr1(const MCInst &MI, unsigned OpNo, return getImmOpValue(MI, OpNo, Fixups, STI); } -unsigned RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo, +uint64_t RISCVMCCodeEmitter::getImmOpValue(const MCInst &MI, unsigned OpNo, SmallVectorImpl &Fixups, const MCSubtargetInfo &STI) const { bool EnableRelax = STI.hasFeature(RISCV::FeatureRelax); diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp index 0af8161a307ab..ee720ceb22b00 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp @@ -2466,6 +2466,10 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, #define CASE_OPERAND_UIMM(NUM) \ case RISCVOp::OPERAND_UIMM##NUM: \ Ok = isUInt(Imm); \ + break; +#define CASE_OPERAND_SIMM(NUM) \ + case RISCVOp::OPERAND_SIMM##NUM: \ + Ok = isInt(Imm); \ break; CASE_OPERAND_UIMM(1) CASE_OPERAND_UIMM(2) @@ -2511,15 +2515,14 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, case RISCVOp::OPERAND_ZERO: Ok = Imm == 0; break; - case RISCVOp::OPERAND_SIMM5: - Ok = isInt<5>(Imm); - break; + // clang-format off + CASE_OPERAND_SIMM(5) + CASE_OPERAND_SIMM(6) + CASE_OPERAND_SIMM(12) + // clang-format on case RISCVOp::OPERAND_SIMM5_PLUS1: Ok = (isInt<5>(Imm) && Imm != -16) || Imm == 16; break; - case RISCVOp::OPERAND_SIMM6: - Ok = isInt<6>(Imm); - break; case RISCVOp::OPERAND_SIMM6_NONZERO: Ok = Imm != 0 && isInt<6>(Imm); break; @@ -2529,9 +2532,6 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI, case RISCVOp::OPERAND_VTYPEI11: Ok = isUInt<11>(Imm); break; - case RISCVOp::OPERAND_SIMM12: - Ok = isInt<12>(Imm); - break; case RISCVOp::OPERAND_SIMM12_LSB00000: Ok = isShiftedInt<7, 5>(Imm); break; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index ac9805ded9d30..6651aedb0d8d8 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -159,8 +159,15 @@ class RISCVOp : Operand { class RISCVUImmOp : RISCVOp { let ParserMatchClass = UImmAsmOperand; + let EncoderMethod = "getImmOpValue"; let DecoderMethod = "decodeUImmOperand<" # bitsNum # ">"; let OperandType = "OPERAND_UIMM" # bitsNum; + let MCOperandPredicate = [{ + int64_t Imm; + if (!MCOp.evaluateAsConstantImm(Imm)) + return false; + return isUInt<}]# bitsNum #[{>(Imm); + }]; } class RISCVUImmLeafOp : @@ -171,6 +178,12 @@ class RISCVSImmOp : RISCVOp { let EncoderMethod = "getImmOpValue"; let DecoderMethod = "decodeSImmOperand<" # bitsNum # ">"; let OperandType = "OPERAND_SIMM" # bitsNum; + let MCOperandPredicate = [{ + int64_t Imm; + if (!MCOp.evaluateAsConstantImm(Imm)) + return false; + return isInt<}] # bitsNum # [{>(Imm); + }]; } class RISCVSImmLeafOp : @@ -221,16 +234,9 @@ def InsnDirectiveOpcode : AsmOperandClass { } def uimm1 : RISCVUImmLeafOp<1>; -def uimm2 : RISCVUImmLeafOp<2> { - let MCOperandPredicate = [{ - int64_t Imm; - if (!MCOp.evaluateAsConstantImm(Imm)) - return false; - return isUInt<2>(Imm); - }]; -} +def uimm2 : RISCVUImmLeafOp<2>; def uimm3 : RISCVUImmOp<3>; -def uimm4 : RISCVUImmOp<4>; +def uimm4 : RISCVUImmLeafOp<4>; def uimm5 : RISCVUImmLeafOp<5>; def uimm6 : RISCVUImmLeafOp<6>; def uimm7_opcode : RISCVUImmOp<7> { @@ -271,13 +277,7 @@ def simm13_lsb0 : Operand { let OperandType = "OPERAND_PCREL"; } -class UImm20Operand : RISCVOp { - let EncoderMethod = "getImmOpValue"; - let DecoderMethod = "decodeUImmOperand<20>"; - let OperandType = "OPERAND_UIMM20"; -} - -class UImm20OperandMaybeSym : UImm20Operand { +class UImm20OperandMaybeSym : RISCVUImmOp<20> { let MCOperandPredicate = [{ int64_t Imm; if (MCOp.evaluateAsConstantImm(Imm)) @@ -293,15 +293,7 @@ def uimm20_auipc : UImm20OperandMaybeSym { let ParserMatchClass = UImmAsmOperand<20, "AUIPC">; } -def uimm20 : UImm20Operand { - let ParserMatchClass = UImmAsmOperand<20>; - let MCOperandPredicate = [{ - int64_t Imm; - if (!MCOp.evaluateAsConstantImm(Imm)) - return false; - return isUInt<20>(Imm); - }]; -} +def uimm20 : RISCVUImmOp<20>; def Simm21Lsb0JALAsmOperand : SImmAsmOperand<21, "Lsb0JAL"> { let ParserMethod = "parseJALOffset"; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td index e5a5f60f9fec1..ce994206cd785 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoC.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoC.td @@ -151,7 +151,6 @@ def simm9_lsb0 : Operand, if (MCOp.evaluateAsConstantImm(Imm)) return isShiftedInt<8, 1>(Imm); return MCOp.isBareSymbolRef(); - }]; let OperandType = "OPERAND_PCREL"; } @@ -227,10 +226,8 @@ def InsnCDirectiveOpcode : AsmOperandClass { let PredicateMethod = "isImm"; } -def uimm2_opcode : RISCVOp { +def uimm2_opcode : RISCVUImmOp<2> { let ParserMatchClass = InsnCDirectiveOpcode; - let DecoderMethod = "decodeUImmOperand<2>"; - let OperandType = "OPERAND_UIMM2"; } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td index 6506b6746b151..24a881dc6810f 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td @@ -66,15 +66,9 @@ def simm5 : RISCVSImmLeafOp<5> { }]; } -def SImm5Plus1AsmOperand : AsmOperandClass { - let Name = "SImm5Plus1"; - let RenderMethod = "addImmOperands"; - let DiagnosticType = "InvalidSImm5Plus1"; -} - def simm5_plus1 : RISCVOp, ImmLeaf(Imm) && Imm != -16) || Imm == 16;}]> { - let ParserMatchClass = SImm5Plus1AsmOperand; + let ParserMatchClass = SImmAsmOperand<5, "Plus1">; let OperandType = "OPERAND_SIMM5_PLUS1"; let MCOperandPredicate = [{ int64_t Imm; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXwch.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXwch.td index 91ff804ba105a..a43cbadf6f308 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoXwch.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXwch.td @@ -25,24 +25,6 @@ class QKStackInst funct2, dag outs, dag ins, // Operand definitions. //===----------------------------------------------------------------------===// -def uimm4_with_predicate : RISCVUImmLeafOp<4> { - let MCOperandPredicate = [{ - int64_t Imm; - if (!MCOp.evaluateAsConstantImm(Imm)) - return false; - return isUInt<4>(Imm); - }]; -} - -def uimm5_with_predicate : RISCVUImmLeafOp<5> { - let MCOperandPredicate = [{ - int64_t Imm; - if (!MCOp.evaluateAsConstantImm(Imm)) - return false; - return isUInt<5>(Imm); - }]; -} - // A 5-bit unsigned immediate where the least significant bit is zero. def uimm5_lsb0 : RISCVOp, ImmLeaf(Imm);}]> { @@ -80,7 +62,7 @@ let Predicates = [HasVendorXwchc], DecoderNamespace = "Xwchc" in { let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in def QK_C_LBU : RVInst16CL<0b001, 0b00, (outs GPRC:$rd), - (ins GPRCMem:$rs1, uimm5_with_predicate:$imm), + (ins GPRCMem:$rs1, uimm5:$imm), "qk.c.lbu", "$rd, ${imm}(${rs1})">, Sched<[WriteLDB, ReadMemBase]> { bits<5> imm; @@ -91,7 +73,7 @@ def QK_C_LBU : RVInst16CL<0b001, 0b00, (outs GPRC:$rd), let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in def QK_C_SB : RVInst16CS<0b101, 0b00, (outs), (ins GPRC:$rs2, GPRCMem:$rs1, - uimm5_with_predicate:$imm), + uimm5:$imm), "qk.c.sb", "$rs2, ${imm}(${rs1})">, Sched<[WriteSTB, ReadStoreData, ReadMemBase]> { bits<5> imm; @@ -121,7 +103,7 @@ def QK_C_SH : RVInst16CS<0b101, 0b10, (outs), let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in def QK_C_LBUSP : QKStackInst<0b00, (outs GPRC:$rd_rs2), - (ins SPMem:$rs1, uimm4_with_predicate:$imm), + (ins SPMem:$rs1, uimm4:$imm), "qk.c.lbusp", "$rd_rs2, ${imm}(${rs1})">, Sched<[WriteLDB, ReadMemBase]> { bits<4> imm; @@ -130,7 +112,7 @@ def QK_C_LBUSP : QKStackInst<0b00, (outs GPRC:$rd_rs2), let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in def QK_C_SBSP : QKStackInst<0b10, (outs), (ins GPRC:$rd_rs2, SPMem:$rs1, - uimm4_with_predicate:$imm), + uimm4:$imm), "qk.c.sbsp", "$rd_rs2, ${imm}(${rs1})">, Sched<[WriteSTB, ReadStoreData, ReadMemBase]> { bits<4> imm; @@ -180,18 +162,18 @@ def : InstAlias<"qk.c.shsp $rs2, (${rs1})", (QK_C_SHSP GPRC:$rs2, SPMem:$rs1, 0) //===----------------------------------------------------------------------===// let Predicates = [HasVendorXwchc] in { -def : CompressPat<(LBU GPRC:$rd, GPRCMem:$rs1, uimm5_with_predicate:$imm), - (QK_C_LBU GPRC:$rd, GPRCMem:$rs1, uimm5_with_predicate:$imm)>; -def : CompressPat<(SB GPRC:$rs2, GPRCMem:$rs1, uimm5_with_predicate:$imm), - (QK_C_SB GPRC:$rs2, GPRCMem:$rs1, uimm5_with_predicate:$imm)>; +def : CompressPat<(LBU GPRC:$rd, GPRCMem:$rs1, uimm5:$imm), + (QK_C_LBU GPRC:$rd, GPRCMem:$rs1, uimm5:$imm)>; +def : CompressPat<(SB GPRC:$rs2, GPRCMem:$rs1, uimm5:$imm), + (QK_C_SB GPRC:$rs2, GPRCMem:$rs1, uimm5:$imm)>; def : CompressPat<(LHU GPRC:$rd, GPRCMem:$rs1, uimm6_lsb0:$imm), (QK_C_LHU GPRC:$rd, GPRCMem:$rs1, uimm6_lsb0:$imm)>; def : CompressPat<(SH GPRC:$rs2, GPRCMem:$rs1, uimm6_lsb0:$imm), (QK_C_SH GPRC:$rs2, GPRCMem:$rs1, uimm6_lsb0:$imm)>; -def : CompressPat<(LBU GPRC:$rd, SPMem:$rs1, uimm4_with_predicate:$imm), - (QK_C_LBUSP GPRC:$rd, SPMem:$rs1, uimm4_with_predicate:$imm)>; -def : CompressPat<(SB GPRC:$rs2, SPMem:$rs1, uimm4_with_predicate:$imm), - (QK_C_SBSP GPRC:$rs2, SPMem:$rs1, uimm4_with_predicate:$imm)>; +def : CompressPat<(LBU GPRC:$rd, SPMem:$rs1, uimm4:$imm), + (QK_C_LBUSP GPRC:$rd, SPMem:$rs1, uimm4:$imm)>; +def : CompressPat<(SB GPRC:$rs2, SPMem:$rs1, uimm4:$imm), + (QK_C_SBSP GPRC:$rs2, SPMem:$rs1, uimm4:$imm)>; def : CompressPat<(LHU GPRC:$rd, SPMem:$rs1, uimm5_lsb0:$imm), (QK_C_LHUSP GPRC:$rd, SPMem:$rs1, uimm5_lsb0:$imm)>; def : CompressPat<(SH GPRC:$rs2, SPMem:$rs1, uimm5_lsb0:$imm), From c361fd5a7a8d646e11ee51acf4ba6de5f5e1297c Mon Sep 17 00:00:00 2001 From: Sam Elliott Date: Sat, 21 Dec 2024 09:48:31 +0000 Subject: [PATCH 064/466] [RISCV] Fix More RV32 Signed Immediates (#120658) --- .../Target/RISCV/AsmParser/RISCVAsmParser.cpp | 8 ++-- llvm/test/MC/RISCV/rv32c-only-valid.s | 28 ++++++++++++ llvm/test/MC/RISCV/rv32i-only-valid.s | 45 ++++++++++++++++++- llvm/test/MC/RISCV/rv32zcibop-valid-rv32.s | 18 ++++++++ 4 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 llvm/test/MC/RISCV/rv32zcibop-valid-rv32.s diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index 5b9946e5132e4..9dcf2e973e6c5 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -530,7 +530,7 @@ struct RISCVOperand final : public MCParsedAsmOperand { if (!IsConstantImm) IsValid = RISCVAsmParser::classifySymbolRef(getImm(), VK); else - IsValid = isShiftedInt(Imm); + IsValid = isShiftedInt(fixImmediateForRV32(Imm, isRV64Imm())); return IsValid && VK == RISCVMCExpr::VK_RISCV_None; } @@ -943,7 +943,8 @@ struct RISCVOperand final : public MCParsedAsmOperand { RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; int64_t Imm; bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); - return IsConstantImm && isShiftedInt<7, 5>(Imm) && + return IsConstantImm && + isShiftedInt<7, 5>(fixImmediateForRV32(Imm, isRV64Imm())) && VK == RISCVMCExpr::VK_RISCV_None; } @@ -955,7 +956,8 @@ struct RISCVOperand final : public MCParsedAsmOperand { int64_t Imm; RISCVMCExpr::VariantKind VK = RISCVMCExpr::VK_RISCV_None; bool IsConstantImm = evaluateConstantImm(getImm(), Imm, VK); - return IsConstantImm && (Imm != 0) && isShiftedInt<6, 4>(Imm) && + return IsConstantImm && (Imm != 0) && + isShiftedInt<6, 4>(fixImmediateForRV32(Imm, isRV64Imm())) && VK == RISCVMCExpr::VK_RISCV_None; } diff --git a/llvm/test/MC/RISCV/rv32c-only-valid.s b/llvm/test/MC/RISCV/rv32c-only-valid.s index 70f358ef24fce..3321aff115c4d 100644 --- a/llvm/test/MC/RISCV/rv32c-only-valid.s +++ b/llvm/test/MC/RISCV/rv32c-only-valid.s @@ -26,3 +26,31 @@ c.jal 2046 # CHECK-ASM: c.addi a1, -1 # CHECK-ASM: encoding: [0xfd,0x15] c.addi a1, 0xffffffff + +# CHECK-OBJ: c.addi16sp sp, -352 +# CHECK-ASM: c.addi16sp sp, -352 +# CHECK-ASM: encoding: [0x0d,0x71] +c.addi16sp sp, 0xfffffea0 + +## Branch and Jump immediates are relative but printed as their absolute address +## when disassembling. + +# CHECK-OBJ: c.beqz a2, 0xffffff06 +# CHECK-ASM: c.beqz a2, -256 +# CHECK-ASM: encoding: [0x01,0xd2] +c.beqz a2, 0xffffff00 + +# CHECK-OBJ: c.beqz a0, 0xffffff16 +# CHECK-ASM: .insn cb 1, 6, a0, -242 +# CHECK-ASM: encoding: [0x19,0xd5] +.insn cb 1, 6, a0, 0xffffff0e + +# CHECK-OBJ: c.jal 0xfffffab4 +# CHECK-ASM: c.jal -1366 +# CHECK-ASM: encoding: [0x6d,0x34] +c.jal 0xfffffaaa + +# CHECK-OBJ: c.j 0xfffffcd8 +# CHECK-ASM: .insn cj 1, 5, -820 +# CHECK-ASM: encoding: [0xf1,0xb1] +.insn cj 1, 5, 0xfffffccc diff --git a/llvm/test/MC/RISCV/rv32i-only-valid.s b/llvm/test/MC/RISCV/rv32i-only-valid.s index 806219fd4b37d..74232e3c419f1 100644 --- a/llvm/test/MC/RISCV/rv32i-only-valid.s +++ b/llvm/test/MC/RISCV/rv32i-only-valid.s @@ -2,7 +2,7 @@ # RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s # RUN: llvm-mc -filetype=obj -triple=riscv32 < %s \ # RUN: | llvm-objdump -M no-aliases --no-print-imm-hex -d -r - \ -# RUN: | FileCheck -check-prefixes=CHECK-ASM-AND-OBJ %s +# RUN: | FileCheck -check-prefixes=CHECK-OBJ,CHECK-ASM-AND-OBJ %s # CHECK-ASM-AND-OBJ: addi a0, a1, -1 # CHECK-ASM: encoding: [0x13,0x85,0xf5,0xff] @@ -16,3 +16,46 @@ lw a1, 0xfffff9ab(a2) # CHECK-ASM-AND-OBJ: sw a1, -8(a2) # CHECK-ASM: encoding: [0x23,0x2c,0xb6,0xfe] sw a1, 0xfffffff8(a2) + +## Branch and Jump immediates are relative but printed as their absolute address +## when disassembling. + +# CHECK-ASM: beq t0, t1, -4096 +# CHECK-ASM: encoding: [0x63,0x80,0x62,0x80] +# CHECK-OBJ: beq t0, t1, 0xfffff010 +beq t0, t1, 0xfffff000 + +# CHECK-ASM: bne t1, t2, -4082 +# CHECK-ASM: encoding: [0x63,0x17,0x73,0x80] +# CHECK-OBJ: bne t1, t2, 0xfffff022 +bne t1, t2, 0xfffff00e + +# CHECK-ASM: beq t2, zero, -3550 +# CHECK-ASM: encoding: [0x63,0x81,0x03,0xa2] +# CHECK-OBJ: beq t2, zero, 0xfffff23a +beqz t2, 0xfffff222 + +# CHECK-ASM: .insn b 99, 0, a0, a1, -3004 +# CHECK-ASM: encoding: [0x63,0x02,0xb5,0xc4] +# CHECK-OBJ: beq a0, a1, 0xfffff460 +.insn b BRANCH, 0, a0, a1, 0xfffff444 + +# CHECK-ASM: jal ra, -2458 +# CHECK-ASM: encoding: [0xef,0xf0,0x6f,0xe6] +# CHECK-OBJ: jal ra, 0xfffff686 +jal ra, 0xfffff666 + +# CHECK-ASM: jal ra, -1912 +# CHECK-ASM: encoding: [0xef,0xf0,0x9f,0x88] +# CHECK-OBJ: jal ra, 0xfffff8ac +jal 0xfffff888 + +# CHECK-ASM: jal zero, -1366 +# CHECK-ASM: encoding: [0x6f,0xf0,0xbf,0xaa] +# CHECK-OBJ: jal zero, 0xfffffad2 +j 0xfffffaaa + +# CHECK-ASM: .insn j 111, a0, -820 +# CHECK-ASM: encoding: [0x6f,0x65,0xe6,0xff] +# CHECK-OBJ: jal a0, 0xfff6682a +.insn j JAL, a0, 0xfffffccc diff --git a/llvm/test/MC/RISCV/rv32zcibop-valid-rv32.s b/llvm/test/MC/RISCV/rv32zcibop-valid-rv32.s new file mode 100644 index 0000000000000..1b6b284d61ae1 --- /dev/null +++ b/llvm/test/MC/RISCV/rv32zcibop-valid-rv32.s @@ -0,0 +1,18 @@ +# RUN: llvm-mc %s -triple=riscv32 -mattr=+zicbop -show-encoding \ +# RUN: | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s +# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+zicbop < %s \ +# RUN: | llvm-objdump --no-print-imm-hex --mattr=+zicbop -d -r - \ +# RUN: | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s + +## This test checks that 32-bit hex immediates are accepted for the `prefetch.*` +## instructions on rv32. + +# CHECK-ASM-AND-OBJ: prefetch.i -2048(t0) +# CHECK-ASM: encoding: [0x13,0xe0,0x02,0x80] +prefetch.i 0xfffff800(t0) +# CHECK-ASM-AND-OBJ: prefetch.r -2048(t1) +# CHECK-ASM: encoding: [0x13,0x60,0x13,0x80] +prefetch.r 0xfffff800(t1) +# CHECK-ASM-AND-OBJ: prefetch.w -2048(t2) +# CHECK-ASM: encoding: [0x13,0xe0,0x33,0x80] +prefetch.w 0xfffff800(t2) From b9a2658a3e8bd13b0f9e7a8a440832a95b377216 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sat, 21 Dec 2024 13:01:48 +0100 Subject: [PATCH 065/466] [libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002) This patch implements the forwarding to frozen C++03 headers as discussed in https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the RFC, we initially proposed selecting the right headers from the Clang driver, however consensus seemed to steer towards handling this in the library itself. This patch implements that direction. At a high level, the changes basically amount to making each public header look like this: ``` // inside #ifdef _LIBCPP_CXX03_LANG # include <__cxx03/vector> #else // normal content #endif ``` In most cases, public headers are simple umbrella headers so there isn't much code in the #else branch. In other cases, the #else branch contains the actual implementation of the header. --- .github/workflows/libcxx-build-and-test.yaml | 1 + .../cmake/caches/Generic-cxx03-frozen.cmake | 2 + libcxx/include/CMakeLists.txt | 1020 +++++++++ libcxx/include/__cxx03/CMakeLists.txt | 1092 --------- libcxx/include/__cxx03/__config | 2 +- libcxx/include/__cxx03/__configuration/abi.h | 2 +- .../__cxx03/__configuration/compiler.h | 2 +- .../__configuration/config_site_shim.h | 80 + .../__cxx03/__configuration/language.h | 2 +- .../__cxx03/__configuration/platform.h | 2 +- .../locale_base_api/bsd_locale_fallbacks.h | 2 +- .../__cxx03/__thread/support/pthread.h | 4 +- libcxx/include/__cxx03/climits | 2 +- libcxx/include/__cxx03/locale | 2 +- libcxx/include/__cxx03/module.modulemap | 1978 ++++++++--------- libcxx/include/__cxx03/version | 6 +- libcxx/include/algorithm | 7 +- libcxx/include/any | 7 +- libcxx/include/array | 7 +- libcxx/include/atomic | 7 +- libcxx/include/barrier | 7 +- libcxx/include/bit | 7 +- libcxx/include/bitset | 7 +- libcxx/include/cassert | 7 +- libcxx/include/ccomplex | 7 +- libcxx/include/cctype | 7 +- libcxx/include/cerrno | 7 +- libcxx/include/cfenv | 8 +- libcxx/include/cfloat | 7 +- libcxx/include/charconv | 7 +- libcxx/include/chrono | 7 +- libcxx/include/cinttypes | 7 +- libcxx/include/ciso646 | 7 +- libcxx/include/climits | 7 +- libcxx/include/clocale | 7 +- libcxx/include/cmath | 7 +- libcxx/include/codecvt | 7 +- libcxx/include/compare | 7 +- libcxx/include/complex | 7 +- libcxx/include/complex.h | 7 +- libcxx/include/concepts | 7 +- libcxx/include/condition_variable | 7 +- libcxx/include/coroutine | 7 +- libcxx/include/csetjmp | 7 +- libcxx/include/csignal | 7 +- libcxx/include/cstdalign | 7 +- libcxx/include/cstdarg | 7 +- libcxx/include/cstdbool | 7 +- libcxx/include/cstddef | 7 +- libcxx/include/cstdint | 7 +- libcxx/include/cstdio | 7 +- libcxx/include/cstdlib | 7 +- libcxx/include/cstring | 7 +- libcxx/include/ctgmath | 7 +- libcxx/include/ctime | 7 +- libcxx/include/ctype.h | 7 +- libcxx/include/cuchar | 8 +- libcxx/include/cwchar | 7 +- libcxx/include/cwctype | 7 +- libcxx/include/deque | 7 +- libcxx/include/errno.h | 7 +- libcxx/include/exception | 7 +- libcxx/include/execution | 7 +- libcxx/include/expected | 7 +- libcxx/include/experimental/iterator | 7 +- libcxx/include/experimental/memory | 7 +- libcxx/include/experimental/propagate_const | 7 +- libcxx/include/experimental/simd | 7 +- libcxx/include/experimental/type_traits | 7 +- libcxx/include/experimental/utility | 7 +- libcxx/include/ext/hash_map | 7 +- libcxx/include/ext/hash_set | 7 +- libcxx/include/fenv.h | 7 +- libcxx/include/filesystem | 7 +- libcxx/include/flat_map | 7 +- libcxx/include/float.h | 7 +- libcxx/include/format | 7 +- libcxx/include/forward_list | 7 +- libcxx/include/fstream | 7 +- libcxx/include/functional | 7 +- libcxx/include/future | 7 +- libcxx/include/initializer_list | 7 +- libcxx/include/inttypes.h | 7 +- libcxx/include/iomanip | 7 +- libcxx/include/ios | 7 +- libcxx/include/iosfwd | 7 +- libcxx/include/iostream | 7 +- libcxx/include/istream | 7 +- libcxx/include/iterator | 7 +- libcxx/include/latch | 7 +- libcxx/include/limits | 7 +- libcxx/include/list | 7 +- libcxx/include/locale | 7 +- libcxx/include/map | 7 +- libcxx/include/math.h | 7 +- libcxx/include/mdspan | 7 +- libcxx/include/memory | 7 +- libcxx/include/memory_resource | 7 +- libcxx/include/mutex | 7 +- libcxx/include/new | 7 +- libcxx/include/numbers | 7 +- libcxx/include/numeric | 7 +- libcxx/include/optional | 7 +- libcxx/include/ostream | 7 +- libcxx/include/print | 7 +- libcxx/include/queue | 7 +- libcxx/include/random | 7 +- libcxx/include/ranges | 7 +- libcxx/include/ratio | 7 +- libcxx/include/regex | 7 +- libcxx/include/scoped_allocator | 7 +- libcxx/include/semaphore | 7 +- libcxx/include/set | 7 +- libcxx/include/shared_mutex | 7 +- libcxx/include/source_location | 7 +- libcxx/include/span | 7 +- libcxx/include/sstream | 7 +- libcxx/include/stack | 7 +- libcxx/include/stdatomic.h | 7 +- libcxx/include/stdbool.h | 7 +- libcxx/include/stddef.h | 7 +- libcxx/include/stdexcept | 7 +- libcxx/include/stdio.h | 7 +- libcxx/include/stdlib.h | 9 +- libcxx/include/stop_token | 7 +- libcxx/include/streambuf | 7 +- libcxx/include/string | 9 +- libcxx/include/string.h | 7 +- libcxx/include/string_view | 7 +- libcxx/include/strstream | 7 +- libcxx/include/syncstream | 7 +- libcxx/include/system_error | 7 +- libcxx/include/tgmath.h | 7 +- libcxx/include/thread | 7 +- libcxx/include/tuple | 7 +- libcxx/include/type_traits | 7 +- libcxx/include/typeindex | 7 +- libcxx/include/typeinfo | 7 +- libcxx/include/uchar.h | 7 +- libcxx/include/unordered_map | 7 +- libcxx/include/unordered_set | 7 +- libcxx/include/utility | 7 +- libcxx/include/valarray | 7 +- libcxx/include/variant | 7 +- libcxx/include/vector | 7 +- libcxx/include/version | 13 +- libcxx/include/wchar.h | 7 +- libcxx/include/wctype.h | 7 +- .../libcxx/algorithms/half_positive.pass.cpp | 2 + ...customize_verbose_abort.link-time.pass.cpp | 2 + .../assertions/default_verbose_abort.pass.cpp | 2 + .../libcxx/assertions/modes/none.pass.cpp | 2 + .../assertions/single_expression.pass.cpp | 2 + ...compatible_with_stdatomic.compile.pass.cpp | 2 + .../test/libcxx/clang_modules_include.gen.py | 2 + .../tree_balance_after_insert.pass.cpp | 2 + .../tree_key_value_traits.pass.cpp | 2 + .../associative/tree_left_rotate.pass.cpp | 2 + .../associative/tree_remove.pass.cpp | 2 + .../associative/tree_right_rotate.pass.cpp | 2 + .../unord.map/abi.compile.pass.cpp | 2 + .../unord.set/abi.compile.pass.cpp | 2 + .../container_traits.compile.pass.cpp | 2 + .../unord/key_value_traits.pass.cpp | 2 + .../containers/unord/next_pow2.pass.cpp | 2 + .../containers/unord/next_prime.pass.cpp | 2 + .../depr/depr.c.headers/extern_c.pass.cpp | 2 + libcxx/test/libcxx/header_inclusions.gen.py | 3 + .../filebuf/traits_mismatch.verify.cpp | 2 + .../fstreams/traits_mismatch.verify.cpp | 2 + .../input.streams/traits_mismatch.verify.cpp | 2 + .../output.streams/traits_mismatch.verify.cpp | 2 + .../stringbuf/const_sso_buffer.pass.cpp | 2 + .../string.streams/traits_mismatch.verify.cpp | 2 + .../iterators/aliasing_iterator.pass.cpp | 2 + .../bounded_iter/arithmetic.pass.cpp | 2 + .../bounded_iter/comparison.pass.cpp | 2 + .../bounded_iter/pointer_traits.pass.cpp | 2 + .../bounded_iter/types.compile.pass.cpp | 2 + ...contiguous_iterators.conv.compile.pass.cpp | 2 + .../iterators/contiguous_iterators.verify.cpp | 2 + .../iterator.operations/prev.verify.cpp | 2 + .../support.dynamic/libcpp_deallocate.sh.cpp | 2 + libcxx/test/libcxx/lint/lint_cmakelists.sh.py | 4 +- .../libcxx/memory/allocation_guard.pass.cpp | 2 + .../libcxx/memory/swap_allocator.pass.cpp | 2 + libcxx/test/libcxx/numerics/bit.ops.pass.cpp | 2 + .../numerics/clamp_to_integral.pass.cpp | 2 + .../complex.number/cmplx.over.pow.pass.cpp | 2 + .../test/libcxx/selftest/test_macros.pass.cpp | 3 + .../c.strings/constexpr_memmove.pass.cpp | 2 + libcxx/test/libcxx/transitive_includes.gen.py | 2 + .../type_traits/datasizeof.compile.pass.cpp | 2 + .../is_constant_evaluated.pass.cpp | 2 + .../is_trivially_comparable.compile.pass.cpp | 2 + .../is_trivially_relocatable.compile.pass.cpp | 2 + .../utilities/exception_guard.odr.sh.cpp | 2 + .../utilities/is_pointer_in_range.pass.cpp | 2 + .../libcxx/utilities/is_valid_range.pass.cpp | 2 + .../libcxx/utilities/meta/meta_base.pass.cpp | 2 + .../test/libcxx/utilities/no_destroy.pass.cpp | 2 + .../template.bitset/includes.pass.cpp | 2 + .../private_constructor_tag.compile.pass.cpp | 2 + .../array/array.fill/fill.verify.cpp | 2 + .../array/array.swap/swap.verify.cpp | 2 + .../array/array.tuple/get.verify.cpp | 2 + .../array.tuple/tuple_element.verify.cpp | 2 + .../array/size_and_alignment.compile.pass.cpp | 2 + .../sequences/forwardlist/types.pass.cpp | 2 + .../containers/sequences/list/types.pass.cpp | 2 + .../vector/vector.cons/exceptions.pass.cpp | 2 + .../fstreams/fstream.cons/default.pass.cpp | 2 + .../fstreams/fstream.cons/move.pass.cpp | 2 + .../fstreams/fstream.cons/pointer.pass.cpp | 2 + .../fstreams/fstream.cons/string.pass.cpp | 2 + .../fstreams/ifstream.cons/default.pass.cpp | 2 + .../fstreams/ifstream.cons/move.pass.cpp | 2 + .../fstreams/ifstream.cons/pointer.pass.cpp | 2 + .../fstreams/ifstream.cons/string.pass.cpp | 2 + .../fstreams/ofstream.cons/default.pass.cpp | 2 + .../fstreams/ofstream.cons/move.pass.cpp | 2 + .../fstreams/ofstream.cons/pointer.pass.cpp | 2 + .../fstreams/ofstream.cons/string.pass.cpp | 2 + .../ios/basic.ios.members/copyfmt.pass.cpp | 2 + .../istringstream.cons/default.pass.cpp | 2 + .../istringstream.cons/move.pass.cpp | 2 + .../istringstream.cons/string.pass.cpp | 2 + .../ostringstream.cons/default.pass.cpp | 2 + .../ostringstream.cons/move.pass.cpp | 2 + .../ostringstream.cons/string.pass.cpp | 2 + .../stringbuf/stringbuf.cons/default.pass.cpp | 2 + .../stringstream.cons/default.pass.cpp | 2 + .../stringstream.cons/move.pass.cpp | 2 + .../stringstream.cons/string.pass.cpp | 2 + .../cstdalign.compile.pass.cpp | 2 + .../std/numerics/c.math/isnormal.pass.cpp | 2 + .../test/std/numerics/c.math/signbit.pass.cpp | 2 + .../re.tokiter/re.tokiter.cnstr/init.pass.cpp | 2 + .../strings/basic.string/char.bad.verify.cpp | 2 + .../strings/string.view/char.bad.verify.cpp | 2 + .../nonstdmem.uglified.compile.pass.cpp | 2 + libcxx/test/support/test_macros.h | 32 +- .../proper_version_checks.cpp | 3 + libcxx/utils/ci/run-buildbot | 6 + .../generate_feature_test_macro_components.py | 13 +- libcxx/utils/libcxx/test/params.py | 7 + .../vendor/llvm/default_assertion_handler.in | 9 +- 247 files changed, 2889 insertions(+), 2506 deletions(-) create mode 100644 libcxx/cmake/caches/Generic-cxx03-frozen.cmake delete mode 100644 libcxx/include/__cxx03/CMakeLists.txt create mode 100644 libcxx/include/__cxx03/__configuration/config_site_shim.h diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index a061be3892523..a28bf4d5daf6d 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -43,6 +43,7 @@ jobs: fail-fast: false matrix: config: [ + 'frozen-cxx03-headers', 'generic-cxx03', 'generic-cxx26', 'generic-modules' diff --git a/libcxx/cmake/caches/Generic-cxx03-frozen.cmake b/libcxx/cmake/caches/Generic-cxx03-frozen.cmake new file mode 100644 index 0000000000000..dfd158bf6edbe --- /dev/null +++ b/libcxx/cmake/caches/Generic-cxx03-frozen.cmake @@ -0,0 +1,2 @@ +set(LIBCXX_TEST_PARAMS "std=c++03;test_frozen_cxx03_headers=True" CACHE STRING "") +set(LIBCXXABI_TEST_PARAMS "${LIBCXX_TEST_PARAMS}" CACHE STRING "") diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt index b5bbfbe7d3a23..0b484ebe5e87c 100644 --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -1054,6 +1054,1026 @@ set(files version wchar.h wctype.h + +# C++03 frozen headers + __cxx03/__algorithm/adjacent_find.h + __cxx03/__algorithm/all_of.h + __cxx03/__algorithm/any_of.h + __cxx03/__algorithm/binary_search.h + __cxx03/__algorithm/clamp.h + __cxx03/__algorithm/comp.h + __cxx03/__algorithm/comp_ref_type.h + __cxx03/__algorithm/copy.h + __cxx03/__algorithm/copy_backward.h + __cxx03/__algorithm/copy_if.h + __cxx03/__algorithm/copy_move_common.h + __cxx03/__algorithm/copy_n.h + __cxx03/__algorithm/count.h + __cxx03/__algorithm/count_if.h + __cxx03/__algorithm/equal.h + __cxx03/__algorithm/equal_range.h + __cxx03/__algorithm/fill.h + __cxx03/__algorithm/fill_n.h + __cxx03/__algorithm/find.h + __cxx03/__algorithm/find_end.h + __cxx03/__algorithm/find_first_of.h + __cxx03/__algorithm/find_if.h + __cxx03/__algorithm/find_if_not.h + __cxx03/__algorithm/find_segment_if.h + __cxx03/__algorithm/fold.h + __cxx03/__algorithm/for_each.h + __cxx03/__algorithm/for_each_n.h + __cxx03/__algorithm/for_each_segment.h + __cxx03/__algorithm/generate.h + __cxx03/__algorithm/generate_n.h + __cxx03/__algorithm/half_positive.h + __cxx03/__algorithm/in_found_result.h + __cxx03/__algorithm/in_fun_result.h + __cxx03/__algorithm/in_in_out_result.h + __cxx03/__algorithm/in_in_result.h + __cxx03/__algorithm/in_out_out_result.h + __cxx03/__algorithm/in_out_result.h + __cxx03/__algorithm/includes.h + __cxx03/__algorithm/inplace_merge.h + __cxx03/__algorithm/is_heap.h + __cxx03/__algorithm/is_heap_until.h + __cxx03/__algorithm/is_partitioned.h + __cxx03/__algorithm/is_permutation.h + __cxx03/__algorithm/is_sorted.h + __cxx03/__algorithm/is_sorted_until.h + __cxx03/__algorithm/iter_swap.h + __cxx03/__algorithm/iterator_operations.h + __cxx03/__algorithm/lexicographical_compare.h + __cxx03/__algorithm/lexicographical_compare_three_way.h + __cxx03/__algorithm/lower_bound.h + __cxx03/__algorithm/make_heap.h + __cxx03/__algorithm/make_projected.h + __cxx03/__algorithm/max.h + __cxx03/__algorithm/max_element.h + __cxx03/__algorithm/merge.h + __cxx03/__algorithm/min.h + __cxx03/__algorithm/min_element.h + __cxx03/__algorithm/min_max_result.h + __cxx03/__algorithm/minmax.h + __cxx03/__algorithm/minmax_element.h + __cxx03/__algorithm/mismatch.h + __cxx03/__algorithm/move.h + __cxx03/__algorithm/move_backward.h + __cxx03/__algorithm/next_permutation.h + __cxx03/__algorithm/none_of.h + __cxx03/__algorithm/nth_element.h + __cxx03/__algorithm/partial_sort.h + __cxx03/__algorithm/partial_sort_copy.h + __cxx03/__algorithm/partition.h + __cxx03/__algorithm/partition_copy.h + __cxx03/__algorithm/partition_point.h + __cxx03/__algorithm/pop_heap.h + __cxx03/__algorithm/prev_permutation.h + __cxx03/__algorithm/pstl.h + __cxx03/__algorithm/push_heap.h + __cxx03/__algorithm/ranges_adjacent_find.h + __cxx03/__algorithm/ranges_all_of.h + __cxx03/__algorithm/ranges_any_of.h + __cxx03/__algorithm/ranges_binary_search.h + __cxx03/__algorithm/ranges_clamp.h + __cxx03/__algorithm/ranges_contains.h + __cxx03/__algorithm/ranges_contains_subrange.h + __cxx03/__algorithm/ranges_copy.h + __cxx03/__algorithm/ranges_copy_backward.h + __cxx03/__algorithm/ranges_copy_if.h + __cxx03/__algorithm/ranges_copy_n.h + __cxx03/__algorithm/ranges_count.h + __cxx03/__algorithm/ranges_count_if.h + __cxx03/__algorithm/ranges_ends_with.h + __cxx03/__algorithm/ranges_equal.h + __cxx03/__algorithm/ranges_equal_range.h + __cxx03/__algorithm/ranges_fill.h + __cxx03/__algorithm/ranges_fill_n.h + __cxx03/__algorithm/ranges_find.h + __cxx03/__algorithm/ranges_find_end.h + __cxx03/__algorithm/ranges_find_first_of.h + __cxx03/__algorithm/ranges_find_if.h + __cxx03/__algorithm/ranges_find_if_not.h + __cxx03/__algorithm/ranges_find_last.h + __cxx03/__algorithm/ranges_for_each.h + __cxx03/__algorithm/ranges_for_each_n.h + __cxx03/__algorithm/ranges_generate.h + __cxx03/__algorithm/ranges_generate_n.h + __cxx03/__algorithm/ranges_includes.h + __cxx03/__algorithm/ranges_inplace_merge.h + __cxx03/__algorithm/ranges_is_heap.h + __cxx03/__algorithm/ranges_is_heap_until.h + __cxx03/__algorithm/ranges_is_partitioned.h + __cxx03/__algorithm/ranges_is_permutation.h + __cxx03/__algorithm/ranges_is_sorted.h + __cxx03/__algorithm/ranges_is_sorted_until.h + __cxx03/__algorithm/ranges_iterator_concept.h + __cxx03/__algorithm/ranges_lexicographical_compare.h + __cxx03/__algorithm/ranges_lower_bound.h + __cxx03/__algorithm/ranges_make_heap.h + __cxx03/__algorithm/ranges_max.h + __cxx03/__algorithm/ranges_max_element.h + __cxx03/__algorithm/ranges_merge.h + __cxx03/__algorithm/ranges_min.h + __cxx03/__algorithm/ranges_min_element.h + __cxx03/__algorithm/ranges_minmax.h + __cxx03/__algorithm/ranges_minmax_element.h + __cxx03/__algorithm/ranges_mismatch.h + __cxx03/__algorithm/ranges_move.h + __cxx03/__algorithm/ranges_move_backward.h + __cxx03/__algorithm/ranges_next_permutation.h + __cxx03/__algorithm/ranges_none_of.h + __cxx03/__algorithm/ranges_nth_element.h + __cxx03/__algorithm/ranges_partial_sort.h + __cxx03/__algorithm/ranges_partial_sort_copy.h + __cxx03/__algorithm/ranges_partition.h + __cxx03/__algorithm/ranges_partition_copy.h + __cxx03/__algorithm/ranges_partition_point.h + __cxx03/__algorithm/ranges_pop_heap.h + __cxx03/__algorithm/ranges_prev_permutation.h + __cxx03/__algorithm/ranges_push_heap.h + __cxx03/__algorithm/ranges_remove.h + __cxx03/__algorithm/ranges_remove_copy.h + __cxx03/__algorithm/ranges_remove_copy_if.h + __cxx03/__algorithm/ranges_remove_if.h + __cxx03/__algorithm/ranges_replace.h + __cxx03/__algorithm/ranges_replace_copy.h + __cxx03/__algorithm/ranges_replace_copy_if.h + __cxx03/__algorithm/ranges_replace_if.h + __cxx03/__algorithm/ranges_reverse.h + __cxx03/__algorithm/ranges_reverse_copy.h + __cxx03/__algorithm/ranges_rotate.h + __cxx03/__algorithm/ranges_rotate_copy.h + __cxx03/__algorithm/ranges_sample.h + __cxx03/__algorithm/ranges_search.h + __cxx03/__algorithm/ranges_search_n.h + __cxx03/__algorithm/ranges_set_difference.h + __cxx03/__algorithm/ranges_set_intersection.h + __cxx03/__algorithm/ranges_set_symmetric_difference.h + __cxx03/__algorithm/ranges_set_union.h + __cxx03/__algorithm/ranges_shuffle.h + __cxx03/__algorithm/ranges_sort.h + __cxx03/__algorithm/ranges_sort_heap.h + __cxx03/__algorithm/ranges_stable_partition.h + __cxx03/__algorithm/ranges_stable_sort.h + __cxx03/__algorithm/ranges_starts_with.h + __cxx03/__algorithm/ranges_swap_ranges.h + __cxx03/__algorithm/ranges_transform.h + __cxx03/__algorithm/ranges_unique.h + __cxx03/__algorithm/ranges_unique_copy.h + __cxx03/__algorithm/ranges_upper_bound.h + __cxx03/__algorithm/remove.h + __cxx03/__algorithm/remove_copy.h + __cxx03/__algorithm/remove_copy_if.h + __cxx03/__algorithm/remove_if.h + __cxx03/__algorithm/replace.h + __cxx03/__algorithm/replace_copy.h + __cxx03/__algorithm/replace_copy_if.h + __cxx03/__algorithm/replace_if.h + __cxx03/__algorithm/reverse.h + __cxx03/__algorithm/reverse_copy.h + __cxx03/__algorithm/rotate.h + __cxx03/__algorithm/rotate_copy.h + __cxx03/__algorithm/sample.h + __cxx03/__algorithm/search.h + __cxx03/__algorithm/search_n.h + __cxx03/__algorithm/set_difference.h + __cxx03/__algorithm/set_intersection.h + __cxx03/__algorithm/set_symmetric_difference.h + __cxx03/__algorithm/set_union.h + __cxx03/__algorithm/shift_left.h + __cxx03/__algorithm/shift_right.h + __cxx03/__algorithm/shuffle.h + __cxx03/__algorithm/sift_down.h + __cxx03/__algorithm/simd_utils.h + __cxx03/__algorithm/sort.h + __cxx03/__algorithm/sort_heap.h + __cxx03/__algorithm/stable_partition.h + __cxx03/__algorithm/stable_sort.h + __cxx03/__algorithm/swap_ranges.h + __cxx03/__algorithm/three_way_comp_ref_type.h + __cxx03/__algorithm/transform.h + __cxx03/__algorithm/uniform_random_bit_generator_adaptor.h + __cxx03/__algorithm/unique.h + __cxx03/__algorithm/unique_copy.h + __cxx03/__algorithm/unwrap_iter.h + __cxx03/__algorithm/unwrap_range.h + __cxx03/__algorithm/upper_bound.h + __cxx03/__assert + __cxx03/__atomic/aliases.h + __cxx03/__atomic/atomic.h + __cxx03/__atomic/atomic_base.h + __cxx03/__atomic/atomic_flag.h + __cxx03/__atomic/atomic_init.h + __cxx03/__atomic/atomic_lock_free.h + __cxx03/__atomic/atomic_ref.h + __cxx03/__atomic/atomic_sync.h + __cxx03/__atomic/check_memory_order.h + __cxx03/__atomic/contention_t.h + __cxx03/__atomic/cxx_atomic_impl.h + __cxx03/__atomic/fence.h + __cxx03/__atomic/is_always_lock_free.h + __cxx03/__atomic/kill_dependency.h + __cxx03/__atomic/memory_order.h + __cxx03/__atomic/to_gcc_order.h + __cxx03/__bit/bit_cast.h + __cxx03/__bit/bit_ceil.h + __cxx03/__bit/bit_floor.h + __cxx03/__bit/bit_log2.h + __cxx03/__bit/bit_width.h + __cxx03/__bit/blsr.h + __cxx03/__bit/byteswap.h + __cxx03/__bit/countl.h + __cxx03/__bit/countr.h + __cxx03/__bit/endian.h + __cxx03/__bit/has_single_bit.h + __cxx03/__bit/invert_if.h + __cxx03/__bit/popcount.h + __cxx03/__bit/rotate.h + __cxx03/__bit_reference + __cxx03/__charconv/chars_format.h + __cxx03/__charconv/from_chars_integral.h + __cxx03/__charconv/from_chars_result.h + __cxx03/__charconv/tables.h + __cxx03/__charconv/to_chars.h + __cxx03/__charconv/to_chars_base_10.h + __cxx03/__charconv/to_chars_floating_point.h + __cxx03/__charconv/to_chars_integral.h + __cxx03/__charconv/to_chars_result.h + __cxx03/__charconv/traits.h + __cxx03/__chrono/calendar.h + __cxx03/__chrono/concepts.h + __cxx03/__chrono/convert_to_timespec.h + __cxx03/__chrono/convert_to_tm.h + __cxx03/__chrono/day.h + __cxx03/__chrono/duration.h + __cxx03/__chrono/exception.h + __cxx03/__chrono/file_clock.h + __cxx03/__chrono/formatter.h + __cxx03/__chrono/hh_mm_ss.h + __cxx03/__chrono/high_resolution_clock.h + __cxx03/__chrono/leap_second.h + __cxx03/__chrono/literals.h + __cxx03/__chrono/local_info.h + __cxx03/__chrono/month.h + __cxx03/__chrono/month_weekday.h + __cxx03/__chrono/monthday.h + __cxx03/__chrono/ostream.h + __cxx03/__chrono/parser_std_format_spec.h + __cxx03/__chrono/statically_widen.h + __cxx03/__chrono/steady_clock.h + __cxx03/__chrono/sys_info.h + __cxx03/__chrono/system_clock.h + __cxx03/__chrono/time_point.h + __cxx03/__chrono/time_zone.h + __cxx03/__chrono/time_zone_link.h + __cxx03/__chrono/tzdb.h + __cxx03/__chrono/tzdb_list.h + __cxx03/__chrono/weekday.h + __cxx03/__chrono/year.h + __cxx03/__chrono/year_month.h + __cxx03/__chrono/year_month_day.h + __cxx03/__chrono/year_month_weekday.h + __cxx03/__chrono/zoned_time.h + __cxx03/__compare/common_comparison_category.h + __cxx03/__compare/compare_partial_order_fallback.h + __cxx03/__compare/compare_strong_order_fallback.h + __cxx03/__compare/compare_three_way.h + __cxx03/__compare/compare_three_way_result.h + __cxx03/__compare/compare_weak_order_fallback.h + __cxx03/__compare/is_eq.h + __cxx03/__compare/ordering.h + __cxx03/__compare/partial_order.h + __cxx03/__compare/strong_order.h + __cxx03/__compare/synth_three_way.h + __cxx03/__compare/three_way_comparable.h + __cxx03/__compare/weak_order.h + __cxx03/__concepts/arithmetic.h + __cxx03/__concepts/assignable.h + __cxx03/__concepts/boolean_testable.h + __cxx03/__concepts/class_or_enum.h + __cxx03/__concepts/common_reference_with.h + __cxx03/__concepts/common_with.h + __cxx03/__concepts/constructible.h + __cxx03/__concepts/convertible_to.h + __cxx03/__concepts/copyable.h + __cxx03/__concepts/derived_from.h + __cxx03/__concepts/destructible.h + __cxx03/__concepts/different_from.h + __cxx03/__concepts/equality_comparable.h + __cxx03/__concepts/invocable.h + __cxx03/__concepts/movable.h + __cxx03/__concepts/predicate.h + __cxx03/__concepts/regular.h + __cxx03/__concepts/relation.h + __cxx03/__concepts/same_as.h + __cxx03/__concepts/semiregular.h + __cxx03/__concepts/swappable.h + __cxx03/__concepts/totally_ordered.h + __cxx03/__condition_variable/condition_variable.h + __cxx03/__config + __cxx03/__configuration/abi.h + __cxx03/__configuration/availability.h + __cxx03/__configuration/compiler.h + __cxx03/__configuration/config_site_shim.h + __cxx03/__configuration/language.h + __cxx03/__configuration/platform.h + __cxx03/__coroutine/coroutine_handle.h + __cxx03/__coroutine/coroutine_traits.h + __cxx03/__coroutine/noop_coroutine_handle.h + __cxx03/__coroutine/trivial_awaitables.h + __cxx03/__debug_utils/randomize_range.h + __cxx03/__debug_utils/sanitizers.h + __cxx03/__debug_utils/strict_weak_ordering_check.h + __cxx03/__exception/exception.h + __cxx03/__exception/exception_ptr.h + __cxx03/__exception/nested_exception.h + __cxx03/__exception/operations.h + __cxx03/__exception/terminate.h + __cxx03/__expected/bad_expected_access.h + __cxx03/__expected/expected.h + __cxx03/__expected/unexpect.h + __cxx03/__expected/unexpected.h + __cxx03/__filesystem/copy_options.h + __cxx03/__filesystem/directory_entry.h + __cxx03/__filesystem/directory_iterator.h + __cxx03/__filesystem/directory_options.h + __cxx03/__filesystem/file_status.h + __cxx03/__filesystem/file_time_type.h + __cxx03/__filesystem/file_type.h + __cxx03/__filesystem/filesystem_error.h + __cxx03/__filesystem/operations.h + __cxx03/__filesystem/path.h + __cxx03/__filesystem/path_iterator.h + __cxx03/__filesystem/perm_options.h + __cxx03/__filesystem/perms.h + __cxx03/__filesystem/recursive_directory_iterator.h + __cxx03/__filesystem/space_info.h + __cxx03/__filesystem/u8path.h + __cxx03/__format/buffer.h + __cxx03/__format/concepts.h + __cxx03/__format/container_adaptor.h + __cxx03/__format/enable_insertable.h + __cxx03/__format/escaped_output_table.h + __cxx03/__format/extended_grapheme_cluster_table.h + __cxx03/__format/format_arg.h + __cxx03/__format/format_arg_store.h + __cxx03/__format/format_args.h + __cxx03/__format/format_context.h + __cxx03/__format/format_error.h + __cxx03/__format/format_functions.h + __cxx03/__format/format_parse_context.h + __cxx03/__format/format_string.h + __cxx03/__format/format_to_n_result.h + __cxx03/__format/formatter.h + __cxx03/__format/formatter_bool.h + __cxx03/__format/formatter_char.h + __cxx03/__format/formatter_floating_point.h + __cxx03/__format/formatter_integer.h + __cxx03/__format/formatter_integral.h + __cxx03/__format/formatter_output.h + __cxx03/__format/formatter_pointer.h + __cxx03/__format/formatter_string.h + __cxx03/__format/formatter_tuple.h + __cxx03/__format/indic_conjunct_break_table.h + __cxx03/__format/parser_std_format_spec.h + __cxx03/__format/range_default_formatter.h + __cxx03/__format/range_formatter.h + __cxx03/__format/unicode.h + __cxx03/__format/width_estimation_table.h + __cxx03/__format/write_escaped.h + __cxx03/__functional/binary_function.h + __cxx03/__functional/binary_negate.h + __cxx03/__functional/bind.h + __cxx03/__functional/bind_back.h + __cxx03/__functional/bind_front.h + __cxx03/__functional/binder1st.h + __cxx03/__functional/binder2nd.h + __cxx03/__functional/boyer_moore_searcher.h + __cxx03/__functional/compose.h + __cxx03/__functional/default_searcher.h + __cxx03/__functional/function.h + __cxx03/__functional/hash.h + __cxx03/__functional/identity.h + __cxx03/__functional/invoke.h + __cxx03/__functional/is_transparent.h + __cxx03/__functional/mem_fn.h + __cxx03/__functional/mem_fun_ref.h + __cxx03/__functional/not_fn.h + __cxx03/__functional/operations.h + __cxx03/__functional/perfect_forward.h + __cxx03/__functional/pointer_to_binary_function.h + __cxx03/__functional/pointer_to_unary_function.h + __cxx03/__functional/ranges_operations.h + __cxx03/__functional/reference_wrapper.h + __cxx03/__functional/unary_function.h + __cxx03/__functional/unary_negate.h + __cxx03/__functional/weak_result_type.h + __cxx03/__fwd/array.h + __cxx03/__fwd/bit_reference.h + __cxx03/__fwd/complex.h + __cxx03/__fwd/deque.h + __cxx03/__fwd/format.h + __cxx03/__fwd/fstream.h + __cxx03/__fwd/functional.h + __cxx03/__fwd/ios.h + __cxx03/__fwd/istream.h + __cxx03/__fwd/mdspan.h + __cxx03/__fwd/memory.h + __cxx03/__fwd/memory_resource.h + __cxx03/__fwd/ostream.h + __cxx03/__fwd/pair.h + __cxx03/__fwd/queue.h + __cxx03/__fwd/span.h + __cxx03/__fwd/sstream.h + __cxx03/__fwd/stack.h + __cxx03/__fwd/streambuf.h + __cxx03/__fwd/string.h + __cxx03/__fwd/string_view.h + __cxx03/__fwd/subrange.h + __cxx03/__fwd/tuple.h + __cxx03/__fwd/vector.h + __cxx03/__hash_table + __cxx03/__ios/fpos.h + __cxx03/__iterator/access.h + __cxx03/__iterator/advance.h + __cxx03/__iterator/aliasing_iterator.h + __cxx03/__iterator/back_insert_iterator.h + __cxx03/__iterator/bounded_iter.h + __cxx03/__iterator/common_iterator.h + __cxx03/__iterator/concepts.h + __cxx03/__iterator/counted_iterator.h + __cxx03/__iterator/cpp17_iterator_concepts.h + __cxx03/__iterator/data.h + __cxx03/__iterator/default_sentinel.h + __cxx03/__iterator/distance.h + __cxx03/__iterator/empty.h + __cxx03/__iterator/erase_if_container.h + __cxx03/__iterator/front_insert_iterator.h + __cxx03/__iterator/incrementable_traits.h + __cxx03/__iterator/indirectly_comparable.h + __cxx03/__iterator/insert_iterator.h + __cxx03/__iterator/istream_iterator.h + __cxx03/__iterator/istreambuf_iterator.h + __cxx03/__iterator/iter_move.h + __cxx03/__iterator/iter_swap.h + __cxx03/__iterator/iterator.h + __cxx03/__iterator/iterator_traits.h + __cxx03/__iterator/iterator_with_data.h + __cxx03/__iterator/mergeable.h + __cxx03/__iterator/move_iterator.h + __cxx03/__iterator/move_sentinel.h + __cxx03/__iterator/next.h + __cxx03/__iterator/ostream_iterator.h + __cxx03/__iterator/ostreambuf_iterator.h + __cxx03/__iterator/permutable.h + __cxx03/__iterator/prev.h + __cxx03/__iterator/projected.h + __cxx03/__iterator/ranges_iterator_traits.h + __cxx03/__iterator/readable_traits.h + __cxx03/__iterator/reverse_access.h + __cxx03/__iterator/reverse_iterator.h + __cxx03/__iterator/segmented_iterator.h + __cxx03/__iterator/size.h + __cxx03/__iterator/sortable.h + __cxx03/__iterator/unreachable_sentinel.h + __cxx03/__iterator/wrap_iter.h + __cxx03/__locale + __cxx03/__locale_dir/locale_base_api.h + __cxx03/__locale_dir/locale_base_api/android.h + __cxx03/__locale_dir/locale_base_api/bsd_locale_defaults.h + __cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h + __cxx03/__locale_dir/locale_base_api/fuchsia.h + __cxx03/__locale_dir/locale_base_api/ibm.h + __cxx03/__locale_dir/locale_base_api/locale_guard.h + __cxx03/__locale_dir/locale_base_api/musl.h + __cxx03/__locale_dir/locale_base_api/newlib.h + __cxx03/__locale_dir/locale_base_api/openbsd.h + __cxx03/__locale_dir/locale_base_api/win32.h + __cxx03/__math/abs.h + __cxx03/__math/copysign.h + __cxx03/__math/error_functions.h + __cxx03/__math/exponential_functions.h + __cxx03/__math/fdim.h + __cxx03/__math/fma.h + __cxx03/__math/gamma.h + __cxx03/__math/hyperbolic_functions.h + __cxx03/__math/hypot.h + __cxx03/__math/inverse_hyperbolic_functions.h + __cxx03/__math/inverse_trigonometric_functions.h + __cxx03/__math/logarithms.h + __cxx03/__math/min_max.h + __cxx03/__math/modulo.h + __cxx03/__math/remainder.h + __cxx03/__math/roots.h + __cxx03/__math/rounding_functions.h + __cxx03/__math/special_functions.h + __cxx03/__math/traits.h + __cxx03/__math/trigonometric_functions.h + __cxx03/__mbstate_t.h + __cxx03/__mdspan/default_accessor.h + __cxx03/__mdspan/extents.h + __cxx03/__mdspan/layout_left.h + __cxx03/__mdspan/layout_right.h + __cxx03/__mdspan/layout_stride.h + __cxx03/__mdspan/mdspan.h + __cxx03/__memory/addressof.h + __cxx03/__memory/align.h + __cxx03/__memory/aligned_alloc.h + __cxx03/__memory/allocate_at_least.h + __cxx03/__memory/allocation_guard.h + __cxx03/__memory/allocator.h + __cxx03/__memory/allocator_arg_t.h + __cxx03/__memory/allocator_destructor.h + __cxx03/__memory/allocator_traits.h + __cxx03/__memory/assume_aligned.h + __cxx03/__memory/auto_ptr.h + __cxx03/__memory/builtin_new_allocator.h + __cxx03/__memory/compressed_pair.h + __cxx03/__memory/concepts.h + __cxx03/__memory/construct_at.h + __cxx03/__memory/destruct_n.h + __cxx03/__memory/inout_ptr.h + __cxx03/__memory/out_ptr.h + __cxx03/__memory/pointer_traits.h + __cxx03/__memory/ranges_construct_at.h + __cxx03/__memory/ranges_uninitialized_algorithms.h + __cxx03/__memory/raw_storage_iterator.h + __cxx03/__memory/shared_ptr.h + __cxx03/__memory/swap_allocator.h + __cxx03/__memory/temp_value.h + __cxx03/__memory/temporary_buffer.h + __cxx03/__memory/uninitialized_algorithms.h + __cxx03/__memory/unique_ptr.h + __cxx03/__memory/uses_allocator.h + __cxx03/__memory/uses_allocator_construction.h + __cxx03/__memory/voidify.h + __cxx03/__memory_resource/memory_resource.h + __cxx03/__memory_resource/monotonic_buffer_resource.h + __cxx03/__memory_resource/polymorphic_allocator.h + __cxx03/__memory_resource/pool_options.h + __cxx03/__memory_resource/synchronized_pool_resource.h + __cxx03/__memory_resource/unsynchronized_pool_resource.h + __cxx03/__mutex/lock_guard.h + __cxx03/__mutex/mutex.h + __cxx03/__mutex/once_flag.h + __cxx03/__mutex/tag_types.h + __cxx03/__mutex/unique_lock.h + __cxx03/__node_handle + __cxx03/__numeric/accumulate.h + __cxx03/__numeric/adjacent_difference.h + __cxx03/__numeric/exclusive_scan.h + __cxx03/__numeric/gcd_lcm.h + __cxx03/__numeric/inclusive_scan.h + __cxx03/__numeric/inner_product.h + __cxx03/__numeric/iota.h + __cxx03/__numeric/midpoint.h + __cxx03/__numeric/partial_sum.h + __cxx03/__numeric/pstl.h + __cxx03/__numeric/reduce.h + __cxx03/__numeric/saturation_arithmetic.h + __cxx03/__numeric/transform_exclusive_scan.h + __cxx03/__numeric/transform_inclusive_scan.h + __cxx03/__numeric/transform_reduce.h + __cxx03/__ostream/basic_ostream.h + __cxx03/__ostream/print.h + __cxx03/__pstl/backend.h + __cxx03/__pstl/backend_fwd.h + __cxx03/__pstl/backends/default.h + __cxx03/__pstl/backends/libdispatch.h + __cxx03/__pstl/backends/serial.h + __cxx03/__pstl/backends/std_thread.h + __cxx03/__pstl/cpu_algos/any_of.h + __cxx03/__pstl/cpu_algos/cpu_traits.h + __cxx03/__pstl/cpu_algos/fill.h + __cxx03/__pstl/cpu_algos/find_if.h + __cxx03/__pstl/cpu_algos/for_each.h + __cxx03/__pstl/cpu_algos/merge.h + __cxx03/__pstl/cpu_algos/stable_sort.h + __cxx03/__pstl/cpu_algos/transform.h + __cxx03/__pstl/cpu_algos/transform_reduce.h + __cxx03/__pstl/dispatch.h + __cxx03/__pstl/handle_exception.h + __cxx03/__random/bernoulli_distribution.h + __cxx03/__random/binomial_distribution.h + __cxx03/__random/cauchy_distribution.h + __cxx03/__random/chi_squared_distribution.h + __cxx03/__random/clamp_to_integral.h + __cxx03/__random/default_random_engine.h + __cxx03/__random/discard_block_engine.h + __cxx03/__random/discrete_distribution.h + __cxx03/__random/exponential_distribution.h + __cxx03/__random/extreme_value_distribution.h + __cxx03/__random/fisher_f_distribution.h + __cxx03/__random/gamma_distribution.h + __cxx03/__random/generate_canonical.h + __cxx03/__random/geometric_distribution.h + __cxx03/__random/independent_bits_engine.h + __cxx03/__random/is_seed_sequence.h + __cxx03/__random/is_valid.h + __cxx03/__random/knuth_b.h + __cxx03/__random/linear_congruential_engine.h + __cxx03/__random/log2.h + __cxx03/__random/lognormal_distribution.h + __cxx03/__random/mersenne_twister_engine.h + __cxx03/__random/negative_binomial_distribution.h + __cxx03/__random/normal_distribution.h + __cxx03/__random/piecewise_constant_distribution.h + __cxx03/__random/piecewise_linear_distribution.h + __cxx03/__random/poisson_distribution.h + __cxx03/__random/random_device.h + __cxx03/__random/ranlux.h + __cxx03/__random/seed_seq.h + __cxx03/__random/shuffle_order_engine.h + __cxx03/__random/student_t_distribution.h + __cxx03/__random/subtract_with_carry_engine.h + __cxx03/__random/uniform_int_distribution.h + __cxx03/__random/uniform_random_bit_generator.h + __cxx03/__random/uniform_real_distribution.h + __cxx03/__random/weibull_distribution.h + __cxx03/__ranges/access.h + __cxx03/__ranges/all.h + __cxx03/__ranges/as_rvalue_view.h + __cxx03/__ranges/chunk_by_view.h + __cxx03/__ranges/common_view.h + __cxx03/__ranges/concepts.h + __cxx03/__ranges/container_compatible_range.h + __cxx03/__ranges/counted.h + __cxx03/__ranges/dangling.h + __cxx03/__ranges/data.h + __cxx03/__ranges/drop_view.h + __cxx03/__ranges/drop_while_view.h + __cxx03/__ranges/elements_view.h + __cxx03/__ranges/empty.h + __cxx03/__ranges/empty_view.h + __cxx03/__ranges/enable_borrowed_range.h + __cxx03/__ranges/enable_view.h + __cxx03/__ranges/filter_view.h + __cxx03/__ranges/from_range.h + __cxx03/__ranges/iota_view.h + __cxx03/__ranges/istream_view.h + __cxx03/__ranges/join_view.h + __cxx03/__ranges/lazy_split_view.h + __cxx03/__ranges/movable_box.h + __cxx03/__ranges/non_propagating_cache.h + __cxx03/__ranges/owning_view.h + __cxx03/__ranges/range_adaptor.h + __cxx03/__ranges/rbegin.h + __cxx03/__ranges/ref_view.h + __cxx03/__ranges/rend.h + __cxx03/__ranges/repeat_view.h + __cxx03/__ranges/reverse_view.h + __cxx03/__ranges/single_view.h + __cxx03/__ranges/size.h + __cxx03/__ranges/split_view.h + __cxx03/__ranges/subrange.h + __cxx03/__ranges/take_view.h + __cxx03/__ranges/take_while_view.h + __cxx03/__ranges/to.h + __cxx03/__ranges/transform_view.h + __cxx03/__ranges/view_interface.h + __cxx03/__ranges/views.h + __cxx03/__ranges/zip_view.h + __cxx03/__split_buffer + __cxx03/__std_clang_module + __cxx03/__std_mbstate_t.h + __cxx03/__stop_token/atomic_unique_lock.h + __cxx03/__stop_token/intrusive_list_view.h + __cxx03/__stop_token/intrusive_shared_ptr.h + __cxx03/__stop_token/stop_callback.h + __cxx03/__stop_token/stop_source.h + __cxx03/__stop_token/stop_state.h + __cxx03/__stop_token/stop_token.h + __cxx03/__string/char_traits.h + __cxx03/__string/constexpr_c_functions.h + __cxx03/__string/extern_template_lists.h + __cxx03/__support/ibm/gettod_zos.h + __cxx03/__support/ibm/locale_mgmt_zos.h + __cxx03/__support/ibm/nanosleep.h + __cxx03/__support/xlocale/__nop_locale_mgmt.h + __cxx03/__support/xlocale/__posix_l_fallback.h + __cxx03/__support/xlocale/__strtonum_fallback.h + __cxx03/__system_error/errc.h + __cxx03/__system_error/error_category.h + __cxx03/__system_error/error_code.h + __cxx03/__system_error/error_condition.h + __cxx03/__system_error/system_error.h + __cxx03/__thread/formatter.h + __cxx03/__thread/id.h + __cxx03/__thread/jthread.h + __cxx03/__thread/poll_with_backoff.h + __cxx03/__thread/support.h + __cxx03/__thread/support/c11.h + __cxx03/__thread/support/external.h + __cxx03/__thread/support/pthread.h + __cxx03/__thread/support/windows.h + __cxx03/__thread/this_thread.h + __cxx03/__thread/thread.h + __cxx03/__thread/timed_backoff_policy.h + __cxx03/__tree + __cxx03/__tuple/find_index.h + __cxx03/__tuple/ignore.h + __cxx03/__tuple/make_tuple_types.h + __cxx03/__tuple/sfinae_helpers.h + __cxx03/__tuple/tuple_element.h + __cxx03/__tuple/tuple_indices.h + __cxx03/__tuple/tuple_like.h + __cxx03/__tuple/tuple_like_ext.h + __cxx03/__tuple/tuple_like_no_subrange.h + __cxx03/__tuple/tuple_size.h + __cxx03/__tuple/tuple_types.h + __cxx03/__type_traits/add_const.h + __cxx03/__type_traits/add_cv.h + __cxx03/__type_traits/add_lvalue_reference.h + __cxx03/__type_traits/add_pointer.h + __cxx03/__type_traits/add_rvalue_reference.h + __cxx03/__type_traits/add_volatile.h + __cxx03/__type_traits/aligned_storage.h + __cxx03/__type_traits/aligned_union.h + __cxx03/__type_traits/alignment_of.h + __cxx03/__type_traits/can_extract_key.h + __cxx03/__type_traits/common_reference.h + __cxx03/__type_traits/common_type.h + __cxx03/__type_traits/conditional.h + __cxx03/__type_traits/conjunction.h + __cxx03/__type_traits/copy_cv.h + __cxx03/__type_traits/copy_cvref.h + __cxx03/__type_traits/datasizeof.h + __cxx03/__type_traits/decay.h + __cxx03/__type_traits/dependent_type.h + __cxx03/__type_traits/desugars_to.h + __cxx03/__type_traits/disjunction.h + __cxx03/__type_traits/enable_if.h + __cxx03/__type_traits/extent.h + __cxx03/__type_traits/has_unique_object_representation.h + __cxx03/__type_traits/has_virtual_destructor.h + __cxx03/__type_traits/integral_constant.h + __cxx03/__type_traits/invoke.h + __cxx03/__type_traits/is_abstract.h + __cxx03/__type_traits/is_aggregate.h + __cxx03/__type_traits/is_allocator.h + __cxx03/__type_traits/is_always_bitcastable.h + __cxx03/__type_traits/is_arithmetic.h + __cxx03/__type_traits/is_array.h + __cxx03/__type_traits/is_assignable.h + __cxx03/__type_traits/is_base_of.h + __cxx03/__type_traits/is_bounded_array.h + __cxx03/__type_traits/is_callable.h + __cxx03/__type_traits/is_char_like_type.h + __cxx03/__type_traits/is_class.h + __cxx03/__type_traits/is_compound.h + __cxx03/__type_traits/is_const.h + __cxx03/__type_traits/is_constant_evaluated.h + __cxx03/__type_traits/is_constructible.h + __cxx03/__type_traits/is_convertible.h + __cxx03/__type_traits/is_core_convertible.h + __cxx03/__type_traits/is_destructible.h + __cxx03/__type_traits/is_empty.h + __cxx03/__type_traits/is_enum.h + __cxx03/__type_traits/is_equality_comparable.h + __cxx03/__type_traits/is_execution_policy.h + __cxx03/__type_traits/is_final.h + __cxx03/__type_traits/is_floating_point.h + __cxx03/__type_traits/is_function.h + __cxx03/__type_traits/is_fundamental.h + __cxx03/__type_traits/is_implicitly_default_constructible.h + __cxx03/__type_traits/is_integral.h + __cxx03/__type_traits/is_literal_type.h + __cxx03/__type_traits/is_member_pointer.h + __cxx03/__type_traits/is_nothrow_assignable.h + __cxx03/__type_traits/is_nothrow_constructible.h + __cxx03/__type_traits/is_nothrow_convertible.h + __cxx03/__type_traits/is_nothrow_destructible.h + __cxx03/__type_traits/is_null_pointer.h + __cxx03/__type_traits/is_object.h + __cxx03/__type_traits/is_pod.h + __cxx03/__type_traits/is_pointer.h + __cxx03/__type_traits/is_polymorphic.h + __cxx03/__type_traits/is_primary_template.h + __cxx03/__type_traits/is_reference.h + __cxx03/__type_traits/is_reference_wrapper.h + __cxx03/__type_traits/is_referenceable.h + __cxx03/__type_traits/is_same.h + __cxx03/__type_traits/is_scalar.h + __cxx03/__type_traits/is_signed.h + __cxx03/__type_traits/is_signed_integer.h + __cxx03/__type_traits/is_specialization.h + __cxx03/__type_traits/is_standard_layout.h + __cxx03/__type_traits/is_swappable.h + __cxx03/__type_traits/is_trivial.h + __cxx03/__type_traits/is_trivially_assignable.h + __cxx03/__type_traits/is_trivially_constructible.h + __cxx03/__type_traits/is_trivially_copyable.h + __cxx03/__type_traits/is_trivially_destructible.h + __cxx03/__type_traits/is_trivially_lexicographically_comparable.h + __cxx03/__type_traits/is_trivially_relocatable.h + __cxx03/__type_traits/is_unbounded_array.h + __cxx03/__type_traits/is_union.h + __cxx03/__type_traits/is_unsigned.h + __cxx03/__type_traits/is_unsigned_integer.h + __cxx03/__type_traits/is_valid_expansion.h + __cxx03/__type_traits/is_void.h + __cxx03/__type_traits/is_volatile.h + __cxx03/__type_traits/lazy.h + __cxx03/__type_traits/make_32_64_or_128_bit.h + __cxx03/__type_traits/make_const_lvalue_ref.h + __cxx03/__type_traits/make_signed.h + __cxx03/__type_traits/make_unsigned.h + __cxx03/__type_traits/maybe_const.h + __cxx03/__type_traits/nat.h + __cxx03/__type_traits/negation.h + __cxx03/__type_traits/noexcept_move_assign_container.h + __cxx03/__type_traits/promote.h + __cxx03/__type_traits/rank.h + __cxx03/__type_traits/remove_all_extents.h + __cxx03/__type_traits/remove_const.h + __cxx03/__type_traits/remove_const_ref.h + __cxx03/__type_traits/remove_cv.h + __cxx03/__type_traits/remove_cvref.h + __cxx03/__type_traits/remove_extent.h + __cxx03/__type_traits/remove_pointer.h + __cxx03/__type_traits/remove_reference.h + __cxx03/__type_traits/remove_volatile.h + __cxx03/__type_traits/result_of.h + __cxx03/__type_traits/strip_signature.h + __cxx03/__type_traits/type_identity.h + __cxx03/__type_traits/type_list.h + __cxx03/__type_traits/underlying_type.h + __cxx03/__type_traits/unwrap_ref.h + __cxx03/__type_traits/void_t.h + __cxx03/__undef_macros + __cxx03/__utility/as_const.h + __cxx03/__utility/as_lvalue.h + __cxx03/__utility/auto_cast.h + __cxx03/__utility/cmp.h + __cxx03/__utility/convert_to_integral.h + __cxx03/__utility/declval.h + __cxx03/__utility/empty.h + __cxx03/__utility/exception_guard.h + __cxx03/__utility/exchange.h + __cxx03/__utility/forward.h + __cxx03/__utility/forward_like.h + __cxx03/__utility/in_place.h + __cxx03/__utility/integer_sequence.h + __cxx03/__utility/is_pointer_in_range.h + __cxx03/__utility/is_valid_range.h + __cxx03/__utility/move.h + __cxx03/__utility/no_destroy.h + __cxx03/__utility/pair.h + __cxx03/__utility/piecewise_construct.h + __cxx03/__utility/priority_tag.h + __cxx03/__utility/private_constructor_tag.h + __cxx03/__utility/rel_ops.h + __cxx03/__utility/small_buffer.h + __cxx03/__utility/swap.h + __cxx03/__utility/to_underlying.h + __cxx03/__utility/unreachable.h + __cxx03/__variant/monostate.h + __cxx03/__verbose_abort + __cxx03/algorithm + __cxx03/any + __cxx03/array + __cxx03/atomic + __cxx03/barrier + __cxx03/bit + __cxx03/bitset + __cxx03/cassert + __cxx03/ccomplex + __cxx03/cctype + __cxx03/cerrno + __cxx03/cfenv + __cxx03/cfloat + __cxx03/charconv + __cxx03/chrono + __cxx03/cinttypes + __cxx03/ciso646 + __cxx03/climits + __cxx03/clocale + __cxx03/cmath + __cxx03/codecvt + __cxx03/compare + __cxx03/complex + __cxx03/complex.h + __cxx03/concepts + __cxx03/condition_variable + __cxx03/coroutine + __cxx03/csetjmp + __cxx03/csignal + __cxx03/cstdarg + __cxx03/cstdbool + __cxx03/cstddef + __cxx03/cstdint + __cxx03/cstdio + __cxx03/cstdlib + __cxx03/cstring + __cxx03/ctgmath + __cxx03/ctime + __cxx03/ctype.h + __cxx03/cuchar + __cxx03/cwchar + __cxx03/cwctype + __cxx03/deque + __cxx03/errno.h + __cxx03/exception + __cxx03/execution + __cxx03/expected + __cxx03/experimental/__config + __cxx03/experimental/__simd/aligned_tag.h + __cxx03/experimental/__simd/declaration.h + __cxx03/experimental/__simd/reference.h + __cxx03/experimental/__simd/scalar.h + __cxx03/experimental/__simd/simd.h + __cxx03/experimental/__simd/simd_mask.h + __cxx03/experimental/__simd/traits.h + __cxx03/experimental/__simd/utility.h + __cxx03/experimental/__simd/vec_ext.h + __cxx03/experimental/iterator + __cxx03/experimental/memory + __cxx03/experimental/propagate_const + __cxx03/experimental/simd + __cxx03/experimental/type_traits + __cxx03/experimental/utility + __cxx03/ext/__hash + __cxx03/ext/hash_map + __cxx03/ext/hash_set + __cxx03/fenv.h + __cxx03/filesystem + __cxx03/float.h + __cxx03/format + __cxx03/forward_list + __cxx03/fstream + __cxx03/functional + __cxx03/future + __cxx03/initializer_list + __cxx03/inttypes.h + __cxx03/iomanip + __cxx03/ios + __cxx03/iosfwd + __cxx03/iostream + __cxx03/istream + __cxx03/iterator + __cxx03/latch + __cxx03/limits + __cxx03/list + __cxx03/locale + __cxx03/locale.h + __cxx03/map + __cxx03/math.h + __cxx03/mdspan + __cxx03/memory + __cxx03/memory_resource + __cxx03/module.modulemap + __cxx03/mutex + __cxx03/new + __cxx03/numbers + __cxx03/numeric + __cxx03/optional + __cxx03/ostream + __cxx03/print + __cxx03/queue + __cxx03/random + __cxx03/ranges + __cxx03/ratio + __cxx03/regex + __cxx03/scoped_allocator + __cxx03/semaphore + __cxx03/set + __cxx03/shared_mutex + __cxx03/source_location + __cxx03/span + __cxx03/sstream + __cxx03/stack + __cxx03/stdatomic.h + __cxx03/stdbool.h + __cxx03/stddef.h + __cxx03/stdexcept + __cxx03/stdint.h + __cxx03/stdio.h + __cxx03/stdlib.h + __cxx03/stop_token + __cxx03/streambuf + __cxx03/string + __cxx03/string.h + __cxx03/string_view + __cxx03/strstream + __cxx03/syncstream + __cxx03/system_error + __cxx03/tgmath.h + __cxx03/thread + __cxx03/tuple + __cxx03/type_traits + __cxx03/typeindex + __cxx03/typeinfo + __cxx03/uchar.h + __cxx03/unordered_map + __cxx03/unordered_set + __cxx03/utility + __cxx03/valarray + __cxx03/variant + __cxx03/vector + __cxx03/version + __cxx03/wchar.h + __cxx03/wctype.h ) configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY) diff --git a/libcxx/include/__cxx03/CMakeLists.txt b/libcxx/include/__cxx03/CMakeLists.txt deleted file mode 100644 index b61442da89d4b..0000000000000 --- a/libcxx/include/__cxx03/CMakeLists.txt +++ /dev/null @@ -1,1092 +0,0 @@ -set(files - __algorithm/adjacent_find.h - __algorithm/all_of.h - __algorithm/any_of.h - __algorithm/binary_search.h - __algorithm/clamp.h - __algorithm/comp.h - __algorithm/comp_ref_type.h - __algorithm/copy.h - __algorithm/copy_backward.h - __algorithm/copy_if.h - __algorithm/copy_move_common.h - __algorithm/copy_n.h - __algorithm/count.h - __algorithm/count_if.h - __algorithm/equal.h - __algorithm/equal_range.h - __algorithm/fill.h - __algorithm/fill_n.h - __algorithm/find.h - __algorithm/find_end.h - __algorithm/find_first_of.h - __algorithm/find_if.h - __algorithm/find_if_not.h - __algorithm/find_segment_if.h - __algorithm/fold.h - __algorithm/for_each.h - __algorithm/for_each_n.h - __algorithm/for_each_segment.h - __algorithm/generate.h - __algorithm/generate_n.h - __algorithm/half_positive.h - __algorithm/in_found_result.h - __algorithm/in_fun_result.h - __algorithm/in_in_out_result.h - __algorithm/in_in_result.h - __algorithm/in_out_out_result.h - __algorithm/in_out_result.h - __algorithm/includes.h - __algorithm/inplace_merge.h - __algorithm/is_heap.h - __algorithm/is_heap_until.h - __algorithm/is_partitioned.h - __algorithm/is_permutation.h - __algorithm/is_sorted.h - __algorithm/is_sorted_until.h - __algorithm/iter_swap.h - __algorithm/iterator_operations.h - __algorithm/lexicographical_compare.h - __algorithm/lexicographical_compare_three_way.h - __algorithm/lower_bound.h - __algorithm/make_heap.h - __algorithm/make_projected.h - __algorithm/max.h - __algorithm/max_element.h - __algorithm/merge.h - __algorithm/min.h - __algorithm/min_element.h - __algorithm/min_max_result.h - __algorithm/minmax.h - __algorithm/minmax_element.h - __algorithm/mismatch.h - __algorithm/move.h - __algorithm/move_backward.h - __algorithm/next_permutation.h - __algorithm/none_of.h - __algorithm/nth_element.h - __algorithm/partial_sort.h - __algorithm/partial_sort_copy.h - __algorithm/partition.h - __algorithm/partition_copy.h - __algorithm/partition_point.h - __algorithm/pop_heap.h - __algorithm/prev_permutation.h - __algorithm/pstl.h - __algorithm/push_heap.h - __algorithm/ranges_adjacent_find.h - __algorithm/ranges_all_of.h - __algorithm/ranges_any_of.h - __algorithm/ranges_binary_search.h - __algorithm/ranges_clamp.h - __algorithm/ranges_contains.h - __algorithm/ranges_contains_subrange.h - __algorithm/ranges_copy.h - __algorithm/ranges_copy_backward.h - __algorithm/ranges_copy_if.h - __algorithm/ranges_copy_n.h - __algorithm/ranges_count.h - __algorithm/ranges_count_if.h - __algorithm/ranges_ends_with.h - __algorithm/ranges_equal.h - __algorithm/ranges_equal_range.h - __algorithm/ranges_fill.h - __algorithm/ranges_fill_n.h - __algorithm/ranges_find.h - __algorithm/ranges_find_end.h - __algorithm/ranges_find_first_of.h - __algorithm/ranges_find_if.h - __algorithm/ranges_find_if_not.h - __algorithm/ranges_find_last.h - __algorithm/ranges_for_each.h - __algorithm/ranges_for_each_n.h - __algorithm/ranges_generate.h - __algorithm/ranges_generate_n.h - __algorithm/ranges_includes.h - __algorithm/ranges_inplace_merge.h - __algorithm/ranges_is_heap.h - __algorithm/ranges_is_heap_until.h - __algorithm/ranges_is_partitioned.h - __algorithm/ranges_is_permutation.h - __algorithm/ranges_is_sorted.h - __algorithm/ranges_is_sorted_until.h - __algorithm/ranges_iterator_concept.h - __algorithm/ranges_lexicographical_compare.h - __algorithm/ranges_lower_bound.h - __algorithm/ranges_make_heap.h - __algorithm/ranges_max.h - __algorithm/ranges_max_element.h - __algorithm/ranges_merge.h - __algorithm/ranges_min.h - __algorithm/ranges_min_element.h - __algorithm/ranges_minmax.h - __algorithm/ranges_minmax_element.h - __algorithm/ranges_mismatch.h - __algorithm/ranges_move.h - __algorithm/ranges_move_backward.h - __algorithm/ranges_next_permutation.h - __algorithm/ranges_none_of.h - __algorithm/ranges_nth_element.h - __algorithm/ranges_partial_sort.h - __algorithm/ranges_partial_sort_copy.h - __algorithm/ranges_partition.h - __algorithm/ranges_partition_copy.h - __algorithm/ranges_partition_point.h - __algorithm/ranges_pop_heap.h - __algorithm/ranges_prev_permutation.h - __algorithm/ranges_push_heap.h - __algorithm/ranges_remove.h - __algorithm/ranges_remove_copy.h - __algorithm/ranges_remove_copy_if.h - __algorithm/ranges_remove_if.h - __algorithm/ranges_replace.h - __algorithm/ranges_replace_copy.h - __algorithm/ranges_replace_copy_if.h - __algorithm/ranges_replace_if.h - __algorithm/ranges_reverse.h - __algorithm/ranges_reverse_copy.h - __algorithm/ranges_rotate.h - __algorithm/ranges_rotate_copy.h - __algorithm/ranges_sample.h - __algorithm/ranges_search.h - __algorithm/ranges_search_n.h - __algorithm/ranges_set_difference.h - __algorithm/ranges_set_intersection.h - __algorithm/ranges_set_symmetric_difference.h - __algorithm/ranges_set_union.h - __algorithm/ranges_shuffle.h - __algorithm/ranges_sort.h - __algorithm/ranges_sort_heap.h - __algorithm/ranges_stable_partition.h - __algorithm/ranges_stable_sort.h - __algorithm/ranges_starts_with.h - __algorithm/ranges_swap_ranges.h - __algorithm/ranges_transform.h - __algorithm/ranges_unique.h - __algorithm/ranges_unique_copy.h - __algorithm/ranges_upper_bound.h - __algorithm/remove.h - __algorithm/remove_copy.h - __algorithm/remove_copy_if.h - __algorithm/remove_if.h - __algorithm/replace.h - __algorithm/replace_copy.h - __algorithm/replace_copy_if.h - __algorithm/replace_if.h - __algorithm/reverse.h - __algorithm/reverse_copy.h - __algorithm/rotate.h - __algorithm/rotate_copy.h - __algorithm/sample.h - __algorithm/search.h - __algorithm/search_n.h - __algorithm/set_difference.h - __algorithm/set_intersection.h - __algorithm/set_symmetric_difference.h - __algorithm/set_union.h - __algorithm/shift_left.h - __algorithm/shift_right.h - __algorithm/shuffle.h - __algorithm/sift_down.h - __algorithm/simd_utils.h - __algorithm/sort.h - __algorithm/sort_heap.h - __algorithm/stable_partition.h - __algorithm/stable_sort.h - __algorithm/swap_ranges.h - __algorithm/three_way_comp_ref_type.h - __algorithm/transform.h - __algorithm/uniform_random_bit_generator_adaptor.h - __algorithm/unique.h - __algorithm/unique_copy.h - __algorithm/unwrap_iter.h - __algorithm/unwrap_range.h - __algorithm/upper_bound.h - __assert - __atomic/aliases.h - __atomic/atomic.h - __atomic/atomic_base.h - __atomic/atomic_flag.h - __atomic/atomic_init.h - __atomic/atomic_lock_free.h - __atomic/atomic_ref.h - __atomic/atomic_sync.h - __atomic/check_memory_order.h - __atomic/contention_t.h - __atomic/cxx_atomic_impl.h - __atomic/fence.h - __atomic/is_always_lock_free.h - __atomic/kill_dependency.h - __atomic/memory_order.h - __atomic/to_gcc_order.h - __bit/bit_cast.h - __bit/bit_ceil.h - __bit/bit_floor.h - __bit/bit_log2.h - __bit/bit_width.h - __bit/blsr.h - __bit/byteswap.h - __bit/countl.h - __bit/countr.h - __bit/endian.h - __bit/has_single_bit.h - __bit/invert_if.h - __bit/popcount.h - __bit/rotate.h - __bit_reference - __charconv/chars_format.h - __charconv/from_chars_integral.h - __charconv/from_chars_result.h - __charconv/tables.h - __charconv/to_chars.h - __charconv/to_chars_base_10.h - __charconv/to_chars_floating_point.h - __charconv/to_chars_integral.h - __charconv/to_chars_result.h - __charconv/traits.h - __chrono/calendar.h - __chrono/concepts.h - __chrono/convert_to_timespec.h - __chrono/convert_to_tm.h - __chrono/day.h - __chrono/duration.h - __chrono/exception.h - __chrono/file_clock.h - __chrono/formatter.h - __chrono/hh_mm_ss.h - __chrono/high_resolution_clock.h - __chrono/leap_second.h - __chrono/literals.h - __chrono/local_info.h - __chrono/month.h - __chrono/month_weekday.h - __chrono/monthday.h - __chrono/ostream.h - __chrono/parser_std_format_spec.h - __chrono/statically_widen.h - __chrono/steady_clock.h - __chrono/sys_info.h - __chrono/system_clock.h - __chrono/time_point.h - __chrono/time_zone.h - __chrono/time_zone_link.h - __chrono/tzdb.h - __chrono/tzdb_list.h - __chrono/weekday.h - __chrono/year.h - __chrono/year_month.h - __chrono/year_month_day.h - __chrono/year_month_weekday.h - __chrono/zoned_time.h - __compare/common_comparison_category.h - __compare/compare_partial_order_fallback.h - __compare/compare_strong_order_fallback.h - __compare/compare_three_way.h - __compare/compare_three_way_result.h - __compare/compare_weak_order_fallback.h - __compare/is_eq.h - __compare/ordering.h - __compare/partial_order.h - __compare/strong_order.h - __compare/synth_three_way.h - __compare/three_way_comparable.h - __compare/weak_order.h - __concepts/arithmetic.h - __concepts/assignable.h - __concepts/boolean_testable.h - __concepts/class_or_enum.h - __concepts/common_reference_with.h - __concepts/common_with.h - __concepts/constructible.h - __concepts/convertible_to.h - __concepts/copyable.h - __concepts/derived_from.h - __concepts/destructible.h - __concepts/different_from.h - __concepts/equality_comparable.h - __concepts/invocable.h - __concepts/movable.h - __concepts/predicate.h - __concepts/regular.h - __concepts/relation.h - __concepts/same_as.h - __concepts/semiregular.h - __concepts/swappable.h - __concepts/totally_ordered.h - __condition_variable/condition_variable.h - __config - __configuration/abi.h - __configuration/availability.h - __configuration/compiler.h - __configuration/language.h - __configuration/platform.h - __coroutine/coroutine_handle.h - __coroutine/coroutine_traits.h - __coroutine/noop_coroutine_handle.h - __coroutine/trivial_awaitables.h - __debug_utils/randomize_range.h - __debug_utils/sanitizers.h - __debug_utils/strict_weak_ordering_check.h - __exception/exception.h - __exception/exception_ptr.h - __exception/nested_exception.h - __exception/operations.h - __exception/terminate.h - __expected/bad_expected_access.h - __expected/expected.h - __expected/unexpect.h - __expected/unexpected.h - __filesystem/copy_options.h - __filesystem/directory_entry.h - __filesystem/directory_iterator.h - __filesystem/directory_options.h - __filesystem/file_status.h - __filesystem/file_time_type.h - __filesystem/file_type.h - __filesystem/filesystem_error.h - __filesystem/operations.h - __filesystem/path.h - __filesystem/path_iterator.h - __filesystem/perm_options.h - __filesystem/perms.h - __filesystem/recursive_directory_iterator.h - __filesystem/space_info.h - __filesystem/u8path.h - __format/buffer.h - __format/concepts.h - __format/container_adaptor.h - __format/enable_insertable.h - __format/escaped_output_table.h - __format/extended_grapheme_cluster_table.h - __format/format_arg.h - __format/format_arg_store.h - __format/format_args.h - __format/format_context.h - __format/format_error.h - __format/format_functions.h - __format/format_parse_context.h - __format/format_string.h - __format/format_to_n_result.h - __format/formatter.h - __format/formatter_bool.h - __format/formatter_char.h - __format/formatter_floating_point.h - __format/formatter_integer.h - __format/formatter_integral.h - __format/formatter_output.h - __format/formatter_pointer.h - __format/formatter_string.h - __format/formatter_tuple.h - __format/indic_conjunct_break_table.h - __format/parser_std_format_spec.h - __format/range_default_formatter.h - __format/range_formatter.h - __format/unicode.h - __format/width_estimation_table.h - __format/write_escaped.h - __functional/binary_function.h - __functional/binary_negate.h - __functional/bind.h - __functional/bind_back.h - __functional/bind_front.h - __functional/binder1st.h - __functional/binder2nd.h - __functional/boyer_moore_searcher.h - __functional/compose.h - __functional/default_searcher.h - __functional/function.h - __functional/hash.h - __functional/identity.h - __functional/invoke.h - __functional/is_transparent.h - __functional/mem_fn.h - __functional/mem_fun_ref.h - __functional/not_fn.h - __functional/operations.h - __functional/perfect_forward.h - __functional/pointer_to_binary_function.h - __functional/pointer_to_unary_function.h - __functional/ranges_operations.h - __functional/reference_wrapper.h - __functional/unary_function.h - __functional/unary_negate.h - __functional/weak_result_type.h - __fwd/array.h - __fwd/bit_reference.h - __fwd/complex.h - __fwd/deque.h - __fwd/format.h - __fwd/fstream.h - __fwd/functional.h - __fwd/ios.h - __fwd/istream.h - __fwd/mdspan.h - __fwd/memory.h - __fwd/memory_resource.h - __fwd/ostream.h - __fwd/pair.h - __fwd/queue.h - __fwd/span.h - __fwd/sstream.h - __fwd/stack.h - __fwd/streambuf.h - __fwd/string.h - __fwd/string_view.h - __fwd/subrange.h - __fwd/tuple.h - __fwd/vector.h - __hash_table - __ios/fpos.h - __iterator/access.h - __iterator/advance.h - __iterator/aliasing_iterator.h - __iterator/back_insert_iterator.h - __iterator/bounded_iter.h - __iterator/common_iterator.h - __iterator/concepts.h - __iterator/counted_iterator.h - __iterator/cpp17_iterator_concepts.h - __iterator/data.h - __iterator/default_sentinel.h - __iterator/distance.h - __iterator/empty.h - __iterator/erase_if_container.h - __iterator/front_insert_iterator.h - __iterator/incrementable_traits.h - __iterator/indirectly_comparable.h - __iterator/insert_iterator.h - __iterator/istream_iterator.h - __iterator/istreambuf_iterator.h - __iterator/iter_move.h - __iterator/iter_swap.h - __iterator/iterator.h - __iterator/iterator_traits.h - __iterator/iterator_with_data.h - __iterator/mergeable.h - __iterator/move_iterator.h - __iterator/move_sentinel.h - __iterator/next.h - __iterator/ostream_iterator.h - __iterator/ostreambuf_iterator.h - __iterator/permutable.h - __iterator/prev.h - __iterator/projected.h - __iterator/ranges_iterator_traits.h - __iterator/readable_traits.h - __iterator/reverse_access.h - __iterator/reverse_iterator.h - __iterator/segmented_iterator.h - __iterator/size.h - __iterator/sortable.h - __iterator/unreachable_sentinel.h - __iterator/wrap_iter.h - __locale - __locale_dir/locale_base_api.h - __locale_dir/locale_base_api/android.h - __locale_dir/locale_base_api/bsd_locale_defaults.h - __locale_dir/locale_base_api/bsd_locale_fallbacks.h - __locale_dir/locale_base_api/fuchsia.h - __locale_dir/locale_base_api/ibm.h - __locale_dir/locale_base_api/locale_guard.h - __locale_dir/locale_base_api/musl.h - __locale_dir/locale_base_api/newlib.h - __locale_dir/locale_base_api/openbsd.h - __locale_dir/locale_base_api/win32.h - __math/abs.h - __math/copysign.h - __math/error_functions.h - __math/exponential_functions.h - __math/fdim.h - __math/fma.h - __math/gamma.h - __math/hyperbolic_functions.h - __math/hypot.h - __math/inverse_hyperbolic_functions.h - __math/inverse_trigonometric_functions.h - __math/logarithms.h - __math/min_max.h - __math/modulo.h - __math/remainder.h - __math/roots.h - __math/rounding_functions.h - __math/special_functions.h - __math/traits.h - __math/trigonometric_functions.h - __mbstate_t.h - __mdspan/default_accessor.h - __mdspan/extents.h - __mdspan/layout_left.h - __mdspan/layout_right.h - __mdspan/layout_stride.h - __mdspan/mdspan.h - __memory/addressof.h - __memory/align.h - __memory/aligned_alloc.h - __memory/allocate_at_least.h - __memory/allocation_guard.h - __memory/allocator.h - __memory/allocator_arg_t.h - __memory/allocator_destructor.h - __memory/allocator_traits.h - __memory/assume_aligned.h - __memory/auto_ptr.h - __memory/builtin_new_allocator.h - __memory/compressed_pair.h - __memory/concepts.h - __memory/construct_at.h - __memory/destruct_n.h - __memory/inout_ptr.h - __memory/out_ptr.h - __memory/pointer_traits.h - __memory/ranges_construct_at.h - __memory/ranges_uninitialized_algorithms.h - __memory/raw_storage_iterator.h - __memory/shared_ptr.h - __memory/swap_allocator.h - __memory/temp_value.h - __memory/temporary_buffer.h - __memory/uninitialized_algorithms.h - __memory/unique_ptr.h - __memory/uses_allocator.h - __memory/uses_allocator_construction.h - __memory/voidify.h - __memory_resource/memory_resource.h - __memory_resource/monotonic_buffer_resource.h - __memory_resource/polymorphic_allocator.h - __memory_resource/pool_options.h - __memory_resource/synchronized_pool_resource.h - __memory_resource/unsynchronized_pool_resource.h - __mutex/lock_guard.h - __mutex/mutex.h - __mutex/once_flag.h - __mutex/tag_types.h - __mutex/unique_lock.h - __node_handle - __numeric/accumulate.h - __numeric/adjacent_difference.h - __numeric/exclusive_scan.h - __numeric/gcd_lcm.h - __numeric/inclusive_scan.h - __numeric/inner_product.h - __numeric/iota.h - __numeric/midpoint.h - __numeric/partial_sum.h - __numeric/pstl.h - __numeric/reduce.h - __numeric/saturation_arithmetic.h - __numeric/transform_exclusive_scan.h - __numeric/transform_inclusive_scan.h - __numeric/transform_reduce.h - __ostream/basic_ostream.h - __ostream/print.h - __pstl/backend.h - __pstl/backend_fwd.h - __pstl/backends/default.h - __pstl/backends/libdispatch.h - __pstl/backends/serial.h - __pstl/backends/std_thread.h - __pstl/cpu_algos/any_of.h - __pstl/cpu_algos/cpu_traits.h - __pstl/cpu_algos/fill.h - __pstl/cpu_algos/find_if.h - __pstl/cpu_algos/for_each.h - __pstl/cpu_algos/merge.h - __pstl/cpu_algos/stable_sort.h - __pstl/cpu_algos/transform.h - __pstl/cpu_algos/transform_reduce.h - __pstl/dispatch.h - __pstl/handle_exception.h - __random/bernoulli_distribution.h - __random/binomial_distribution.h - __random/cauchy_distribution.h - __random/chi_squared_distribution.h - __random/clamp_to_integral.h - __random/default_random_engine.h - __random/discard_block_engine.h - __random/discrete_distribution.h - __random/exponential_distribution.h - __random/extreme_value_distribution.h - __random/fisher_f_distribution.h - __random/gamma_distribution.h - __random/generate_canonical.h - __random/geometric_distribution.h - __random/independent_bits_engine.h - __random/is_seed_sequence.h - __random/is_valid.h - __random/knuth_b.h - __random/linear_congruential_engine.h - __random/log2.h - __random/lognormal_distribution.h - __random/mersenne_twister_engine.h - __random/negative_binomial_distribution.h - __random/normal_distribution.h - __random/piecewise_constant_distribution.h - __random/piecewise_linear_distribution.h - __random/poisson_distribution.h - __random/random_device.h - __random/ranlux.h - __random/seed_seq.h - __random/shuffle_order_engine.h - __random/student_t_distribution.h - __random/subtract_with_carry_engine.h - __random/uniform_int_distribution.h - __random/uniform_random_bit_generator.h - __random/uniform_real_distribution.h - __random/weibull_distribution.h - __ranges/access.h - __ranges/all.h - __ranges/as_rvalue_view.h - __ranges/chunk_by_view.h - __ranges/common_view.h - __ranges/concepts.h - __ranges/container_compatible_range.h - __ranges/counted.h - __ranges/dangling.h - __ranges/data.h - __ranges/drop_view.h - __ranges/drop_while_view.h - __ranges/elements_view.h - __ranges/empty.h - __ranges/empty_view.h - __ranges/enable_borrowed_range.h - __ranges/enable_view.h - __ranges/filter_view.h - __ranges/from_range.h - __ranges/iota_view.h - __ranges/istream_view.h - __ranges/join_view.h - __ranges/lazy_split_view.h - __ranges/movable_box.h - __ranges/non_propagating_cache.h - __ranges/owning_view.h - __ranges/range_adaptor.h - __ranges/rbegin.h - __ranges/ref_view.h - __ranges/rend.h - __ranges/repeat_view.h - __ranges/reverse_view.h - __ranges/single_view.h - __ranges/size.h - __ranges/split_view.h - __ranges/subrange.h - __ranges/take_view.h - __ranges/take_while_view.h - __ranges/to.h - __ranges/transform_view.h - __ranges/view_interface.h - __ranges/views.h - __ranges/zip_view.h - __split_buffer - __std_clang_module - __std_mbstate_t.h - __stop_token/atomic_unique_lock.h - __stop_token/intrusive_list_view.h - __stop_token/intrusive_shared_ptr.h - __stop_token/stop_callback.h - __stop_token/stop_source.h - __stop_token/stop_state.h - __stop_token/stop_token.h - __string/char_traits.h - __string/constexpr_c_functions.h - __string/extern_template_lists.h - __support/ibm/gettod_zos.h - __support/ibm/locale_mgmt_zos.h - __support/ibm/nanosleep.h - __support/xlocale/__nop_locale_mgmt.h - __support/xlocale/__posix_l_fallback.h - __support/xlocale/__strtonum_fallback.h - __system_error/errc.h - __system_error/error_category.h - __system_error/error_code.h - __system_error/error_condition.h - __system_error/system_error.h - __thread/formatter.h - __thread/id.h - __thread/jthread.h - __thread/poll_with_backoff.h - __thread/support.h - __thread/support/c11.h - __thread/support/external.h - __thread/support/pthread.h - __thread/support/windows.h - __thread/this_thread.h - __thread/thread.h - __thread/timed_backoff_policy.h - __tree - __tuple/find_index.h - __tuple/ignore.h - __tuple/make_tuple_types.h - __tuple/sfinae_helpers.h - __tuple/tuple_element.h - __tuple/tuple_indices.h - __tuple/tuple_like.h - __tuple/tuple_like_ext.h - __tuple/tuple_like_no_subrange.h - __tuple/tuple_size.h - __tuple/tuple_types.h - __type_traits/add_const.h - __type_traits/add_cv.h - __type_traits/add_lvalue_reference.h - __type_traits/add_pointer.h - __type_traits/add_rvalue_reference.h - __type_traits/add_volatile.h - __type_traits/aligned_storage.h - __type_traits/aligned_union.h - __type_traits/alignment_of.h - __type_traits/can_extract_key.h - __type_traits/common_reference.h - __type_traits/common_type.h - __type_traits/conditional.h - __type_traits/conjunction.h - __type_traits/copy_cv.h - __type_traits/copy_cvref.h - __type_traits/datasizeof.h - __type_traits/decay.h - __type_traits/dependent_type.h - __type_traits/desugars_to.h - __type_traits/disjunction.h - __type_traits/enable_if.h - __type_traits/extent.h - __type_traits/has_unique_object_representation.h - __type_traits/has_virtual_destructor.h - __type_traits/integral_constant.h - __type_traits/invoke.h - __type_traits/is_abstract.h - __type_traits/is_aggregate.h - __type_traits/is_allocator.h - __type_traits/is_always_bitcastable.h - __type_traits/is_arithmetic.h - __type_traits/is_array.h - __type_traits/is_assignable.h - __type_traits/is_base_of.h - __type_traits/is_bounded_array.h - __type_traits/is_callable.h - __type_traits/is_char_like_type.h - __type_traits/is_class.h - __type_traits/is_compound.h - __type_traits/is_const.h - __type_traits/is_constant_evaluated.h - __type_traits/is_constructible.h - __type_traits/is_convertible.h - __type_traits/is_core_convertible.h - __type_traits/is_destructible.h - __type_traits/is_empty.h - __type_traits/is_enum.h - __type_traits/is_equality_comparable.h - __type_traits/is_execution_policy.h - __type_traits/is_final.h - __type_traits/is_floating_point.h - __type_traits/is_function.h - __type_traits/is_fundamental.h - __type_traits/is_implicitly_default_constructible.h - __type_traits/is_integral.h - __type_traits/is_literal_type.h - __type_traits/is_member_pointer.h - __type_traits/is_nothrow_assignable.h - __type_traits/is_nothrow_constructible.h - __type_traits/is_nothrow_convertible.h - __type_traits/is_nothrow_destructible.h - __type_traits/is_null_pointer.h - __type_traits/is_object.h - __type_traits/is_pod.h - __type_traits/is_pointer.h - __type_traits/is_polymorphic.h - __type_traits/is_primary_template.h - __type_traits/is_reference.h - __type_traits/is_reference_wrapper.h - __type_traits/is_referenceable.h - __type_traits/is_same.h - __type_traits/is_scalar.h - __type_traits/is_signed.h - __type_traits/is_signed_integer.h - __type_traits/is_specialization.h - __type_traits/is_standard_layout.h - __type_traits/is_swappable.h - __type_traits/is_trivial.h - __type_traits/is_trivially_assignable.h - __type_traits/is_trivially_constructible.h - __type_traits/is_trivially_copyable.h - __type_traits/is_trivially_destructible.h - __type_traits/is_trivially_lexicographically_comparable.h - __type_traits/is_trivially_relocatable.h - __type_traits/is_unbounded_array.h - __type_traits/is_union.h - __type_traits/is_unsigned.h - __type_traits/is_unsigned_integer.h - __type_traits/is_valid_expansion.h - __type_traits/is_void.h - __type_traits/is_volatile.h - __type_traits/lazy.h - __type_traits/make_32_64_or_128_bit.h - __type_traits/make_const_lvalue_ref.h - __type_traits/make_signed.h - __type_traits/make_unsigned.h - __type_traits/maybe_const.h - __type_traits/nat.h - __type_traits/negation.h - __type_traits/noexcept_move_assign_container.h - __type_traits/promote.h - __type_traits/rank.h - __type_traits/remove_all_extents.h - __type_traits/remove_const.h - __type_traits/remove_const_ref.h - __type_traits/remove_cv.h - __type_traits/remove_cvref.h - __type_traits/remove_extent.h - __type_traits/remove_pointer.h - __type_traits/remove_reference.h - __type_traits/remove_volatile.h - __type_traits/result_of.h - __type_traits/strip_signature.h - __type_traits/type_identity.h - __type_traits/type_list.h - __type_traits/underlying_type.h - __type_traits/unwrap_ref.h - __type_traits/void_t.h - __undef_macros - __utility/as_const.h - __utility/as_lvalue.h - __utility/auto_cast.h - __utility/cmp.h - __utility/convert_to_integral.h - __utility/declval.h - __utility/empty.h - __utility/exception_guard.h - __utility/exchange.h - __utility/forward.h - __utility/forward_like.h - __utility/in_place.h - __utility/integer_sequence.h - __utility/is_pointer_in_range.h - __utility/is_valid_range.h - __utility/move.h - __utility/no_destroy.h - __utility/pair.h - __utility/piecewise_construct.h - __utility/priority_tag.h - __utility/private_constructor_tag.h - __utility/rel_ops.h - __utility/small_buffer.h - __utility/swap.h - __utility/to_underlying.h - __utility/unreachable.h - __variant/monostate.h - __verbose_abort - algorithm - any - array - atomic - barrier - bit - bitset - cassert - ccomplex - cctype - cerrno - cfenv - cfloat - charconv - chrono - cinttypes - ciso646 - climits - clocale - cmath - codecvt - compare - complex - complex.h - concepts - condition_variable - coroutine - csetjmp - csignal - cstdarg - cstdbool - cstddef - cstdint - cstdio - cstdlib - cstring - ctgmath - ctime - ctype.h - cuchar - cwchar - cwctype - deque - errno.h - exception - execution - expected - experimental/__config - experimental/__simd/aligned_tag.h - experimental/__simd/declaration.h - experimental/__simd/reference.h - experimental/__simd/scalar.h - experimental/__simd/simd.h - experimental/__simd/simd_mask.h - experimental/__simd/traits.h - experimental/__simd/utility.h - experimental/__simd/vec_ext.h - experimental/iterator - experimental/memory - experimental/propagate_const - experimental/simd - experimental/type_traits - experimental/utility - ext/__hash - ext/hash_map - ext/hash_set - fenv.h - filesystem - float.h - format - forward_list - fstream - functional - future - initializer_list - inttypes.h - iomanip - ios - iosfwd - iostream - istream - iterator - latch - limits - list - locale - locale.h - map - math.h - mdspan - memory - memory_resource - module.modulemap - mutex - new - numbers - numeric - optional - ostream - print - queue - random - ranges - ratio - regex - scoped_allocator - semaphore - set - shared_mutex - source_location - span - sstream - stack - stdatomic.h - stdbool.h - stddef.h - stdexcept - stdint.h - stdio.h - stdlib.h - stop_token - streambuf - string - string.h - string_view - strstream - syncstream - system_error - tgmath.h - thread - tuple - type_traits - typeindex - typeinfo - uchar.h - unordered_map - unordered_set - utility - valarray - variant - vector - version - wchar.h - wctype.h - ) - -configure_file("__config_site.in" "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" @ONLY) -configure_file("${LIBCXX_ASSERTION_HANDLER_FILE}" "${LIBCXX_GENERATED_INCLUDE_DIR}/__assertion_handler" COPYONLY) - -set(_all_includes "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" - "${LIBCXX_GENERATED_INCLUDE_DIR}/__assertion_handler") -foreach(f ${files}) - set(src "${CMAKE_CURRENT_SOURCE_DIR}/${f}") - set(dst "${LIBCXX_GENERATED_INCLUDE_DIR}/${f}") - add_custom_command(OUTPUT ${dst} - DEPENDS ${src} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${src} ${dst} - COMMENT "Copying CXX header ${f}") - list(APPEND _all_includes "${dst}") -endforeach() - -# Generate the IWYU mapping. This depends on all header files but it's also considered as an -# "include" for dependency tracking. -add_custom_command(OUTPUT "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp" - COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_iwyu_mapping.py" "-o" "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp" - DEPENDS "${LIBCXX_SOURCE_DIR}/utils/libcxx/header_information.py" - COMMENT "Generate the mapping file for include-what-you-use" -) -list(APPEND _all_includes "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp") - -add_custom_target(generate-cxx-headers ALL DEPENDS ${_all_includes}) - -add_library(cxx-headers INTERFACE) -target_link_libraries(cxx-headers INTERFACE libcxx-libc-headers libcxx-abi-headers) -add_dependencies(cxx-headers generate-cxx-headers) -# It's important that the arch directory be included first so that its header files -# which interpose on the default include dir be included instead of the default ones. -target_include_directories(cxx-headers INTERFACE ${LIBCXX_GENERATED_INCLUDE_TARGET_DIR} - ${LIBCXX_GENERATED_INCLUDE_DIR}) - -if (LIBCXX_INSTALL_HEADERS) - foreach(file ${files}) - get_filename_component(dir ${file} DIRECTORY) - install(FILES ${file} - DESTINATION "${LIBCXX_INSTALL_INCLUDE_DIR}/${dir}" - COMPONENT cxx-headers - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - ) - endforeach() - - # Install the generated __config_site file to the per-target include dir. - install(FILES "${LIBCXX_GENERATED_INCLUDE_TARGET_DIR}/__config_site" - DESTINATION "${LIBCXX_INSTALL_INCLUDE_TARGET_DIR}" - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - COMPONENT cxx-headers) - - # Install the generated __assertion_handler file to the generic include dir. - install(FILES "${LIBCXX_GENERATED_INCLUDE_DIR}/__assertion_handler" - DESTINATION "${LIBCXX_INSTALL_INCLUDE_DIR}" - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - COMPONENT cxx-headers) - - # Install the generated IWYU file to the generic include dir. - install(FILES "${LIBCXX_GENERATED_INCLUDE_DIR}/libcxx.imp" - DESTINATION "${LIBCXX_INSTALL_INCLUDE_DIR}" - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ - COMPONENT cxx-headers) - - if (NOT CMAKE_CONFIGURATION_TYPES) - add_custom_target(install-cxx-headers - DEPENDS cxx-headers - COMMAND "${CMAKE_COMMAND}" - -DCMAKE_INSTALL_COMPONENT=cxx-headers - -P "${CMAKE_BINARY_DIR}/cmake_install.cmake") - # Stripping is a no-op for headers - add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers) - endif() -endif() diff --git a/libcxx/include/__cxx03/__config b/libcxx/include/__cxx03/__config index 935fa4cc404f4..3e8f181664c97 100644 --- a/libcxx/include/__cxx03/__config +++ b/libcxx/include/__cxx03/__config @@ -10,10 +10,10 @@ #ifndef _LIBCPP___CXX03___CONFIG #define _LIBCPP___CXX03___CONFIG -#include <__config_site> #include <__cxx03/__configuration/abi.h> #include <__cxx03/__configuration/availability.h> #include <__cxx03/__configuration/compiler.h> +#include <__cxx03/__configuration/config_site_shim.h> #include <__cxx03/__configuration/platform.h> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER diff --git a/libcxx/include/__cxx03/__configuration/abi.h b/libcxx/include/__cxx03/__configuration/abi.h index 9e7f7313c8834..740aec39a3487 100644 --- a/libcxx/include/__cxx03/__configuration/abi.h +++ b/libcxx/include/__cxx03/__configuration/abi.h @@ -10,8 +10,8 @@ #ifndef _LIBCPP___CXX03___CONFIGURATION_ABI_H #define _LIBCPP___CXX03___CONFIGURATION_ABI_H -#include <__config_site> #include <__cxx03/__configuration/compiler.h> +#include <__cxx03/__configuration/config_site_shim.h> #include <__cxx03/__configuration/platform.h> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER diff --git a/libcxx/include/__cxx03/__configuration/compiler.h b/libcxx/include/__cxx03/__configuration/compiler.h index 2f33fb1f6ef4d..4d53a2144a501 100644 --- a/libcxx/include/__cxx03/__configuration/compiler.h +++ b/libcxx/include/__cxx03/__configuration/compiler.h @@ -10,7 +10,7 @@ #ifndef _LIBCPP___CXX03___CONFIGURATION_COMPILER_H #define _LIBCPP___CXX03___CONFIGURATION_COMPILER_H -#include <__config_site> +#include <__cxx03/__configuration/config_site_shim.h> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header diff --git a/libcxx/include/__cxx03/__configuration/config_site_shim.h b/libcxx/include/__cxx03/__configuration/config_site_shim.h new file mode 100644 index 0000000000000..974a17af495cd --- /dev/null +++ b/libcxx/include/__cxx03/__configuration/config_site_shim.h @@ -0,0 +1,80 @@ +//===----------------------------------------------------------------------===// +// +// 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 _LIBCPP___CXX03___CONFIGURATION_CONFIG_SITE_SHIM_H +#define _LIBCPP___CXX03___CONFIGURATION_CONFIG_SITE_SHIM_H + +#include <__config_site> + +#if !_LIBCPP_ABI_FORCE_ITANIUM +# undef _LIBCPP_ABI_FORCE_ITANIUM +#endif + +#if !_LIBCPP_ABI_FORCE_MICROSOFT +# undef _LIBCPP_ABI_FORCE_MICROSOFT +#endif + +#if !_LIBCPP_HAS_THREADS +# define _LIBCPP_HAS_NO_THREADS +#endif + +#if !_LIBCPP_HAS_MONOTONIC_CLOCK +# define _LIBCPP_HAS_NO_MONOTONIC_CLOCK +#endif + +#if !_LIBCPP_HAS_MUSL_LIBC +# undef _LIBCPP_HAS_MUSL_LIBC +#endif + +#if !_LIBCPP_HAS_THREAD_API_PTHREAD +# undef _LIBCPP_HAS_THREAD_API_PTHREAD +#endif + +#if !_LIBCPP_HAS_THREAD_API_EXTERNAL +# undef _LIBCPP_HAS_THREAD_API_EXTERNAL +#endif + +#if !_LIBCPP_HAS_THREAD_API_WIN32 +# undef _LIBCPP_HAS_THREAD_API_WIN32 +#endif + +#undef _LIBCPP_HAS_THREAD_API_C11 + +#if !_LIBCPP_HAS_VENDOR_AVAILABILITY_ANNOTATIONS +# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS +#endif + +#if !_LIBCPP_HAS_FILESYSTEM +# define _LIBCPP_HAS_NO_FILESYSTEM +#endif + +#if !_LIBCPP_HAS_RANDOM_DEVICE +# define _LIBCPP_HAS_NO_RANDOM_DEVICE +#endif + +#if !_LIBCPP_HAS_LOCALIZATION +# define _LIBCPP_HAS_NO_LOCALIZATION +#endif + +#if !_LIBCPP_HAS_UNICODE +# define _LIBCPP_HAS_NO_UNICODE +#endif + +#if !_LIBCPP_HAS_WIDE_CHARACTERS +# define _LIBCPP_HAS_NO_WIDE_CHARACTERS +#endif + +#if !_LIBCPP_HAS_TIME_ZONE_DATABASE +# define _LIBCPP_HAS_NO_TIME_ZONE_DATABASE +#endif + +#if !_LIBCPP_INSTRUMENTED_WITH_ASAN +# undef _LIBCPP_INSTRUMENTED_WITH_ASAN +#endif + +#endif // _LIBCPP___CXX03___CONFIGURATION_CONFIG_SITE_SHIM_H diff --git a/libcxx/include/__cxx03/__configuration/language.h b/libcxx/include/__cxx03/__configuration/language.h index 604f2d2cd532a..8fd09f4b22554 100644 --- a/libcxx/include/__cxx03/__configuration/language.h +++ b/libcxx/include/__cxx03/__configuration/language.h @@ -10,7 +10,7 @@ #ifndef _LIBCPP___CXX03___CONFIGURATION_LANGUAGE_H #define _LIBCPP___CXX03___CONFIGURATION_LANGUAGE_H -#include <__config_site> +#include <__cxx03/__configuration/config_site_shim.h> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header diff --git a/libcxx/include/__cxx03/__configuration/platform.h b/libcxx/include/__cxx03/__configuration/platform.h index b4718986ad10d..24590503693ae 100644 --- a/libcxx/include/__cxx03/__configuration/platform.h +++ b/libcxx/include/__cxx03/__configuration/platform.h @@ -10,7 +10,7 @@ #ifndef _LIBCPP___CXX03___CONFIGURATION_PLATFORM_H #define _LIBCPP___CXX03___CONFIGURATION_PLATFORM_H -#include <__config_site> +#include <__cxx03/__configuration/config_site_shim.h> #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER # pragma GCC system_header diff --git a/libcxx/include/__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h b/libcxx/include/__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h index e61e950a42c77..a73b724df6c19 100644 --- a/libcxx/include/__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h +++ b/libcxx/include/__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h @@ -15,8 +15,8 @@ #include <__cxx03/__locale_dir/locale_base_api/locale_guard.h> #include <__cxx03/cstdio> -#include <__cxx03/stdarg.h> #include <__cxx03/stdlib.h> +#include #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS # include <__cxx03/cwchar> diff --git a/libcxx/include/__cxx03/__thread/support/pthread.h b/libcxx/include/__cxx03/__thread/support/pthread.h index a4d7c874e6830..4dc7a4980de2b 100644 --- a/libcxx/include/__cxx03/__thread/support/pthread.h +++ b/libcxx/include/__cxx03/__thread/support/pthread.h @@ -15,8 +15,8 @@ #include <__cxx03/__config> #include <__cxx03/ctime> #include <__cxx03/errno.h> -#include <__cxx03/pthread.h> -#include <__cxx03/sched.h> +#include +#include #ifdef __MVS__ # include <__cxx03/__support/ibm/nanosleep.h> diff --git a/libcxx/include/__cxx03/climits b/libcxx/include/__cxx03/climits index 37d8c41a0c6de..2c6fe5ab95b4b 100644 --- a/libcxx/include/__cxx03/climits +++ b/libcxx/include/__cxx03/climits @@ -39,7 +39,7 @@ Macros: #include <__cxx03/__config> -#include <__cxx03/limits.h> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/libcxx/include/__cxx03/locale b/libcxx/include/__cxx03/locale index 78c0fd7763af2..6360bbc2f6b60 100644 --- a/libcxx/include/__cxx03/locale +++ b/libcxx/include/__cxx03/locale @@ -222,7 +222,7 @@ template class messages_byname; // Most unix variants have catopen. These are the specific ones that don't. # if !defined(__BIONIC__) && !defined(_NEWLIB_VERSION) && !defined(__EMSCRIPTEN__) # define _LIBCPP_HAS_CATOPEN 1 -# include <__cxx03/nl_types.h> +# include # endif # endif diff --git a/libcxx/include/__cxx03/module.modulemap b/libcxx/include/__cxx03/module.modulemap index 13d0dce34d97e..34a2d0f25fc45 100644 --- a/libcxx/include/__cxx03/module.modulemap +++ b/libcxx/include/__cxx03/module.modulemap @@ -1,462 +1,462 @@ // Main C++ standard library interfaces -module std_algorithm [system] { +module cxx03_std_algorithm [system] { header "algorithm" export * } -module std_any [system] { +module cxx03_std_any [system] { header "any" export * } -module std_array [system] { +module cxx03_std_array [system] { header "array" export * } -module std_atomic [system] { +module cxx03_std_atomic [system] { header "atomic" export * } -module std_barrier [system] { +module cxx03_std_barrier [system] { header "barrier" export * } -module std_bit [system] { +module cxx03_std_bit [system] { header "bit" export * } -module std_bitset [system] { +module cxx03_std_bitset [system] { header "bitset" export * } -module std_charconv [system] { +module cxx03_std_charconv [system] { header "charconv" export * } -module std_chrono [system] { +module cxx03_std_chrono [system] { header "chrono" export * } -module std_codecvt [system] { +module cxx03_std_codecvt [system] { header "codecvt" export * } -module std_compare [system] { +module cxx03_std_compare [system] { header "compare" export * } -module std_complex [system] { +module cxx03_std_complex [system] { header "complex" export * } -module std_concepts [system] { +module cxx03_std_concepts [system] { header "concepts" export * } -module std_condition_variable [system] { +module cxx03_std_condition_variable [system] { header "condition_variable" export * } -module std_coroutine [system] { +module cxx03_std_coroutine [system] { header "coroutine" export * } -module std_deque [system] { +module cxx03_std_deque [system] { header "deque" export * } -module std_exception [system] { +module cxx03_std_exception [system] { header "exception" export * } -module std_execution [system] { +module cxx03_std_execution [system] { header "execution" export * } -module std_expected [system] { +module cxx03_std_expected [system] { header "expected" export * } -module std_filesystem [system] { +module cxx03_std_filesystem [system] { header "filesystem" export * } -module std_format [system] { +module cxx03_std_format [system] { header "format" export * } -module std_forward_list [system] { +module cxx03_std_forward_list [system] { header "forward_list" export * } -module std_fstream [system] { +module cxx03_std_fstream [system] { header "fstream" export * } -module std_functional [system] { +module cxx03_std_functional [system] { header "functional" export * } -module std_future [system] { +module cxx03_std_future [system] { header "future" export * } -module std_initializer_list [system] { +module cxx03_std_initializer_list [system] { header "initializer_list" export * } -module std_iomanip [system] { +module cxx03_std_iomanip [system] { header "iomanip" export * } -module std_ios [system] { +module cxx03_std_ios [system] { header "ios" export * } -module std_iosfwd [system] { +module cxx03_std_iosfwd [system] { header "iosfwd" export * } -module std_iostream [system] { +module cxx03_std_iostream [system] { header "iostream" export * } -module std_istream [system] { +module cxx03_std_istream [system] { header "istream" export * } -module std_iterator [system] { +module cxx03_std_iterator [system] { header "iterator" export * } -module std_latch [system] { +module cxx03_std_latch [system] { header "latch" export * } -module std_limits [system] { +module cxx03_std_limits [system] { header "limits" export * } -module std_list [system] { +module cxx03_std_list [system] { header "list" export * } -module std_locale [system] { +module cxx03_std_locale [system] { header "locale" export * } -module std_map [system] { +module cxx03_std_map [system] { header "map" export * } -module std_mdspan [system] { +module cxx03_std_mdspan [system] { header "mdspan" export * } -module std_memory [system] { +module cxx03_std_memory [system] { header "memory" export * } -module std_memory_resource [system] { +module cxx03_std_memory_resource [system] { header "memory_resource" export * } -module std_mutex [system] { +module cxx03_std_mutex [system] { header "mutex" export * } -module std_new [system] { +module cxx03_std_new [system] { header "new" export * } -module std_numbers [system] { +module cxx03_std_numbers [system] { header "numbers" export * } -module std_numeric [system] { +module cxx03_std_numeric [system] { header "numeric" export * } -module std_optional [system] { +module cxx03_std_optional [system] { header "optional" export * } -module std_ostream [system] { +module cxx03_std_ostream [system] { header "ostream" export * } -module std_print [system] { +module cxx03_std_print [system] { header "print" export * } -module std_queue [system] { +module cxx03_std_queue [system] { header "queue" export * } -module std_random [system] { +module cxx03_std_random [system] { header "random" export * } -module std_ranges [system] { +module cxx03_std_ranges [system] { header "ranges" export * } -module std_ratio [system] { +module cxx03_std_ratio [system] { header "ratio" export * } -module std_regex [system] { +module cxx03_std_regex [system] { header "regex" export * } -module std_scoped_allocator [system] { +module cxx03_std_scoped_allocator [system] { header "scoped_allocator" export * } -module std_semaphore [system] { +module cxx03_std_semaphore [system] { header "semaphore" export * } -module std_set [system] { +module cxx03_std_set [system] { header "set" export * } -module std_shared_mutex [system] { +module cxx03_std_shared_mutex [system] { header "shared_mutex" export std_version } -module std_source_location [system] { +module cxx03_std_source_location [system] { header "source_location" export * } -module std_span [system] { +module cxx03_std_span [system] { header "span" export std_private_ranges_enable_borrowed_range export std_version export std_private_span_span_fwd } -module std_sstream [system] { +module cxx03_std_sstream [system] { header "sstream" export * } -module std_stack [system] { +module cxx03_std_stack [system] { header "stack" export * } -module std_stdexcept [system] { +module cxx03_std_stdexcept [system] { header "stdexcept" export * } -module std_stop_token { +module cxx03_std_stop_token { header "stop_token" export * } -module std_streambuf [system] { +module cxx03_std_streambuf [system] { header "streambuf" export * } -module std_string [system] { +module cxx03_std_string [system] { header "string" export * } -module std_string_view [system] { +module cxx03_std_string_view [system] { header "string_view" export * } -module std_strstream [system] { +module cxx03_std_strstream [system] { header "strstream" export * } -module std_syncstream [system] { +module cxx03_std_syncstream [system] { header "syncstream" export * } -module std_system_error [system] { +module cxx03_std_system_error [system] { header "system_error" export * } -module std_thread [system] { +module cxx03_std_thread [system] { header "thread" export * } -module std_tuple [system] { +module cxx03_std_tuple [system] { header "tuple" export * } -module std_type_traits [system] { +module cxx03_std_type_traits [system] { header "type_traits" export * } -module std_typeindex [system] { +module cxx03_std_typeindex [system] { header "typeindex" export * } -module std_typeinfo [system] { +module cxx03_std_typeinfo [system] { header "typeinfo" export * } -module std_unordered_map [system] { +module cxx03_std_unordered_map [system] { header "unordered_map" export * } -module std_unordered_set [system] { +module cxx03_std_unordered_set [system] { header "unordered_set" export * } -module std_utility [system] { +module cxx03_std_utility [system] { header "utility" export * } -module std_valarray [system] { +module cxx03_std_valarray [system] { header "valarray" export * } -module std_variant [system] { +module cxx03_std_variant [system] { header "variant" export * } -module std_vector [system] { +module cxx03_std_vector [system] { header "vector" export * } -module std_version [system] { +module cxx03_std_version [system] { header "version" export * } // C standard library interface wrappers -module std_cassert [system] { +module cxx03_std_cassert [system] { // 's use of NDEBUG requires textual inclusion. textual header "cassert" } -module std_ccomplex [system] { +module cxx03_std_ccomplex [system] { header "ccomplex" export * } -module std_cctype [system] { +module cxx03_std_cctype [system] { header "cctype" export * } -module std_cerrno [system] { +module cxx03_std_cerrno [system] { header "cerrno" export * } -module std_cfenv [system] { +module cxx03_std_cfenv [system] { header "cfenv" export * } -module std_cfloat [system] { +module cxx03_std_cfloat [system] { header "cfloat" export * } -module std_cinttypes [system] { +module cxx03_std_cinttypes [system] { header "cinttypes" export * } -module std_ciso646 [system] { +module cxx03_std_ciso646 [system] { header "ciso646" export * } -module std_climits [system] { +module cxx03_std_climits [system] { header "climits" export * } -module std_clocale [system] { +module cxx03_std_clocale [system] { header "clocale" export * } -module std_cmath [system] { +module cxx03_std_cmath [system] { header "cmath" export * } -module std_csetjmp [system] { +module cxx03_std_csetjmp [system] { header "csetjmp" export * } -module std_csignal [system] { +module cxx03_std_csignal [system] { header "csignal" export * } // FIXME: is missing. -module std_cstdarg [system] { +module cxx03_std_cstdarg [system] { header "cstdarg" export * } -module std_cstdbool [system] { +module cxx03_std_cstdbool [system] { header "cstdbool" export * } -module std_cstddef [system] { +module cxx03_std_cstddef [system] { header "cstddef" export * } -module std_cstdint [system] { +module cxx03_std_cstdint [system] { header "cstdint" export * } -module std_cstdio [system] { +module cxx03_std_cstdio [system] { header "cstdio" export * } -module std_cstdlib [system] { +module cxx03_std_cstdlib [system] { header "cstdlib" export * } -module std_cstring [system] { +module cxx03_std_cstring [system] { header "cstring" export * } -module std_ctgmath [system] { +module cxx03_std_ctgmath [system] { header "ctgmath" export * } -module std_ctime [system] { +module cxx03_std_ctime [system] { header "ctime" export * } -module std_cuchar [system] { +module cxx03_std_cuchar [system] { header "cuchar" export * } -module std_cwchar [system] { +module cxx03_std_cwchar [system] { header "cwchar" export * } -module std_cwctype [system] { +module cxx03_std_cwctype [system] { header "cwctype" export * } // C standard library interfaces augmented/replaced in C++ // provided by C library. -module std_complex_h [system] { +module cxx03_std_complex_h [system] { header "complex.h" export * } -module std_ctype_h [system] { +module cxx03_std_ctype_h [system] { header "ctype.h" export * } -module std_errno_h [system] { +module cxx03_std_errno_h [system] { header "errno.h" export * } -module std_fenv_h [system] { +module cxx03_std_fenv_h [system] { header "fenv.h" export * } -module std_float_h [system] { +module cxx03_std_float_h [system] { header "float.h" export * } -module std_inttypes_h [system] { +module cxx03_std_inttypes_h [system] { header "inttypes.h" export * } // provided by compiler. -module std_locale_h [system] { +module cxx03_std_locale_h [system] { header "locale.h" export * } -module std_math_h [system] { +module cxx03_std_math_h [system] { header "math.h" export * } @@ -464,59 +464,59 @@ module std_math_h [system] { // provided by C library. // FIXME: is missing. // provided by compiler. -module std_stdatomic_h [system] { +module cxx03_std_stdatomic_h [system] { header "stdatomic.h" export * } -module std_stdbool_h [system] { +module cxx03_std_stdbool_h [system] { // 's __bool_true_false_are_defined macro requires textual inclusion. textual header "stdbool.h" export * } -module std_stddef_h [system] { +module cxx03_std_stddef_h [system] { // 's __need_* macros require textual inclusion. textual header "stddef.h" export * } -module std_stdint_h [system] { +module cxx03_std_stdint_h [system] { header "stdint.h" export * } -module std_stdio_h [system] { +module cxx03_std_stdio_h [system] { // 's __need_* macros require textual inclusion. textual header "stdio.h" export * } -module std_stdlib_h [system] { +module cxx03_std_stdlib_h [system] { // 's __need_* macros require textual inclusion. textual header "stdlib.h" export * } -module std_string_h [system] { +module cxx03_std_string_h [system] { header "string.h" export * } -module std_tgmath_h [system] { +module cxx03_std_tgmath_h [system] { header "tgmath.h" export * } -module std_uchar_h [system] { +module cxx03_std_uchar_h [system] { header "uchar.h" export * } // provided by C library. -module std_wchar_h [system] { +module cxx03_std_wchar_h [system] { // 's __need_* macros require textual inclusion. textual header "wchar.h" export * } -module std_wctype_h [system] { +module cxx03_std_wctype_h [system] { header "wctype.h" export * } // Experimental C++ standard library interfaces -module std_experimental [system] { +module cxx03_std_experimental [system] { module iterator { header "experimental/iterator" export * @@ -559,25 +559,25 @@ module std_experimental [system] { // Convenience method to get all of the above modules in a single import statement. // Importing only the needed modules is likely to be more performant. -module std [system] { +module cxx03_std [system] { header "__std_clang_module" export * } // Implementation detail headers that are private to libc++. These modules // must not be directly imported. -module std_private_assert [system] { +module cxx03_std_private_assert [system] { header "__assert" export * } -module std_private_bit_reference [system] { +module cxx03_std_private_bit_reference [system] { header "__bit_reference" export * } -module std_private_fwd_bit_reference [system] { +module cxx03_std_private_fwd_bit_reference [system] { header "__fwd/bit_reference.h" } -module std_private_config [system] { +module cxx03_std_private_config [system] { textual header "__config" textual header "__configuration/abi.h" textual header "__configuration/availability.h" @@ -586,813 +586,813 @@ module std_private_config [system] { textual header "__configuration/platform.h" export * } -module std_private_hash_table [system] { +module cxx03_std_private_hash_table [system] { header "__hash_table" export * } -module std_private_locale [system] { +module cxx03_std_private_locale [system] { header "__locale" export * } -module std_private_mbstate_t [system] { +module cxx03_std_private_mbstate_t [system] { header "__mbstate_t.h" export * } -module std_private_node_handle [system] { +module cxx03_std_private_node_handle [system] { header "__node_handle" export * } -module std_private_split_buffer [system] { +module cxx03_std_private_split_buffer [system] { header "__split_buffer" export * } -module std_private_std_mbstate_t [system] { +module cxx03_std_private_std_mbstate_t [system] { header "__std_mbstate_t.h" export * } -module std_private_tree [system] { +module cxx03_std_private_tree [system] { header "__tree" export * } -module std_private_undef_macros [system] { +module cxx03_std_private_undef_macros [system] { textual header "__undef_macros" export * } -module std_private_verbose_abort [system] { +module cxx03_std_private_verbose_abort [system] { header "__verbose_abort" export * } -module std_private_algorithm_adjacent_find [system] { header "__algorithm/adjacent_find.h" } -module std_private_algorithm_all_of [system] { header "__algorithm/all_of.h" } -module std_private_algorithm_any_of [system] { header "__algorithm/any_of.h" } -module std_private_algorithm_binary_search [system] { header "__algorithm/binary_search.h" } -module std_private_algorithm_clamp [system] { header "__algorithm/clamp.h" } -module std_private_algorithm_comp [system] { header "__algorithm/comp.h" } -module std_private_algorithm_comp_ref_type [system] { header "__algorithm/comp_ref_type.h" } -module std_private_algorithm_copy [system] { +module cxx03_std_private_algorithm_adjacent_find [system] { header "__algorithm/adjacent_find.h" } +module cxx03_std_private_algorithm_all_of [system] { header "__algorithm/all_of.h" } +module cxx03_std_private_algorithm_any_of [system] { header "__algorithm/any_of.h" } +module cxx03_std_private_algorithm_binary_search [system] { header "__algorithm/binary_search.h" } +module cxx03_std_private_algorithm_clamp [system] { header "__algorithm/clamp.h" } +module cxx03_std_private_algorithm_comp [system] { header "__algorithm/comp.h" } +module cxx03_std_private_algorithm_comp_ref_type [system] { header "__algorithm/comp_ref_type.h" } +module cxx03_std_private_algorithm_copy [system] { header "__algorithm/copy.h" export std_private_algorithm_copy_move_common } -module std_private_algorithm_copy_backward [system] { header "__algorithm/copy_backward.h" } -module std_private_algorithm_copy_if [system] { header "__algorithm/copy_if.h" } -module std_private_algorithm_copy_move_common [system] { +module cxx03_std_private_algorithm_copy_backward [system] { header "__algorithm/copy_backward.h" } +module cxx03_std_private_algorithm_copy_if [system] { header "__algorithm/copy_if.h" } +module cxx03_std_private_algorithm_copy_move_common [system] { header "__algorithm/copy_move_common.h" export std_private_type_traits_is_trivially_copyable } -module std_private_algorithm_copy_n [system] { header "__algorithm/copy_n.h" } -module std_private_algorithm_count [system] { header "__algorithm/count.h" } -module std_private_algorithm_count_if [system] { header "__algorithm/count_if.h" } -module std_private_algorithm_equal [system] { header "__algorithm/equal.h" } -module std_private_algorithm_equal_range [system] { header "__algorithm/equal_range.h" } -module std_private_algorithm_fill [system] { header "__algorithm/fill.h" } -module std_private_algorithm_fill_n [system] { header "__algorithm/fill_n.h" } -module std_private_algorithm_find [system] { +module cxx03_std_private_algorithm_copy_n [system] { header "__algorithm/copy_n.h" } +module cxx03_std_private_algorithm_count [system] { header "__algorithm/count.h" } +module cxx03_std_private_algorithm_count_if [system] { header "__algorithm/count_if.h" } +module cxx03_std_private_algorithm_equal [system] { header "__algorithm/equal.h" } +module cxx03_std_private_algorithm_equal_range [system] { header "__algorithm/equal_range.h" } +module cxx03_std_private_algorithm_fill [system] { header "__algorithm/fill.h" } +module cxx03_std_private_algorithm_fill_n [system] { header "__algorithm/fill_n.h" } +module cxx03_std_private_algorithm_find [system] { header "__algorithm/find.h" export std_private_algorithm_unwrap_iter } -module std_private_algorithm_find_end [system] { header "__algorithm/find_end.h" } -module std_private_algorithm_find_first_of [system] { header "__algorithm/find_first_of.h" } -module std_private_algorithm_find_if [system] { header "__algorithm/find_if.h" } -module std_private_algorithm_find_if_not [system] { header "__algorithm/find_if_not.h" } -module std_private_algorithm_find_segment_if [system] { header "__algorithm/find_segment_if.h" } -module std_private_algorithm_fold [system] { header "__algorithm/fold.h" } -module std_private_algorithm_for_each [system] { header "__algorithm/for_each.h" } -module std_private_algorithm_for_each_n [system] { header "__algorithm/for_each_n.h" } -module std_private_algorithm_for_each_segment [system] { header "__algorithm/for_each_segment.h" } -module std_private_algorithm_generate [system] { header "__algorithm/generate.h" } -module std_private_algorithm_generate_n [system] { header "__algorithm/generate_n.h" } -module std_private_algorithm_half_positive [system] { header "__algorithm/half_positive.h" } -module std_private_algorithm_in_found_result [system] { header "__algorithm/in_found_result.h" } -module std_private_algorithm_in_fun_result [system] { header "__algorithm/in_fun_result.h" } -module std_private_algorithm_in_in_out_result [system] { header "__algorithm/in_in_out_result.h" } -module std_private_algorithm_in_in_result [system] { header "__algorithm/in_in_result.h" } -module std_private_algorithm_in_out_out_result [system] { header "__algorithm/in_out_out_result.h" } -module std_private_algorithm_in_out_result [system] { header "__algorithm/in_out_result.h" } -module std_private_algorithm_includes [system] { header "__algorithm/includes.h" } -module std_private_algorithm_inplace_merge [system] { header "__algorithm/inplace_merge.h" } -module std_private_algorithm_is_heap [system] { header "__algorithm/is_heap.h" } -module std_private_algorithm_is_heap_until [system] { header "__algorithm/is_heap_until.h" } -module std_private_algorithm_is_partitioned [system] { header "__algorithm/is_partitioned.h" } -module std_private_algorithm_is_permutation [system] { header "__algorithm/is_permutation.h" } -module std_private_algorithm_is_sorted [system] { header "__algorithm/is_sorted.h" } -module std_private_algorithm_is_sorted_until [system] { header "__algorithm/is_sorted_until.h" } -module std_private_algorithm_iter_swap [system] { header "__algorithm/iter_swap.h" } -module std_private_algorithm_iterator_operations [system] { +module cxx03_std_private_algorithm_find_end [system] { header "__algorithm/find_end.h" } +module cxx03_std_private_algorithm_find_first_of [system] { header "__algorithm/find_first_of.h" } +module cxx03_std_private_algorithm_find_if [system] { header "__algorithm/find_if.h" } +module cxx03_std_private_algorithm_find_if_not [system] { header "__algorithm/find_if_not.h" } +module cxx03_std_private_algorithm_find_segment_if [system] { header "__algorithm/find_segment_if.h" } +module cxx03_std_private_algorithm_fold [system] { header "__algorithm/fold.h" } +module cxx03_std_private_algorithm_for_each [system] { header "__algorithm/for_each.h" } +module cxx03_std_private_algorithm_for_each_n [system] { header "__algorithm/for_each_n.h" } +module cxx03_std_private_algorithm_for_each_segment [system] { header "__algorithm/for_each_segment.h" } +module cxx03_std_private_algorithm_generate [system] { header "__algorithm/generate.h" } +module cxx03_std_private_algorithm_generate_n [system] { header "__algorithm/generate_n.h" } +module cxx03_std_private_algorithm_half_positive [system] { header "__algorithm/half_positive.h" } +module cxx03_std_private_algorithm_in_found_result [system] { header "__algorithm/in_found_result.h" } +module cxx03_std_private_algorithm_in_fun_result [system] { header "__algorithm/in_fun_result.h" } +module cxx03_std_private_algorithm_in_in_out_result [system] { header "__algorithm/in_in_out_result.h" } +module cxx03_std_private_algorithm_in_in_result [system] { header "__algorithm/in_in_result.h" } +module cxx03_std_private_algorithm_in_out_out_result [system] { header "__algorithm/in_out_out_result.h" } +module cxx03_std_private_algorithm_in_out_result [system] { header "__algorithm/in_out_result.h" } +module cxx03_std_private_algorithm_includes [system] { header "__algorithm/includes.h" } +module cxx03_std_private_algorithm_inplace_merge [system] { header "__algorithm/inplace_merge.h" } +module cxx03_std_private_algorithm_is_heap [system] { header "__algorithm/is_heap.h" } +module cxx03_std_private_algorithm_is_heap_until [system] { header "__algorithm/is_heap_until.h" } +module cxx03_std_private_algorithm_is_partitioned [system] { header "__algorithm/is_partitioned.h" } +module cxx03_std_private_algorithm_is_permutation [system] { header "__algorithm/is_permutation.h" } +module cxx03_std_private_algorithm_is_sorted [system] { header "__algorithm/is_sorted.h" } +module cxx03_std_private_algorithm_is_sorted_until [system] { header "__algorithm/is_sorted_until.h" } +module cxx03_std_private_algorithm_iter_swap [system] { header "__algorithm/iter_swap.h" } +module cxx03_std_private_algorithm_iterator_operations [system] { header "__algorithm/iterator_operations.h" export * } -module std_private_algorithm_lexicographical_compare [system] { header "__algorithm/lexicographical_compare.h" } -module std_private_algorithm_lexicographical_compare_three_way [system] { header "__algorithm/lexicographical_compare_three_way.h" } -module std_private_algorithm_lower_bound [system] { header "__algorithm/lower_bound.h" } -module std_private_algorithm_make_heap [system] { header "__algorithm/make_heap.h" } -module std_private_algorithm_make_projected [system] { header "__algorithm/make_projected.h" } -module std_private_algorithm_max [system] { header "__algorithm/max.h" } -module std_private_algorithm_max_element [system] { header "__algorithm/max_element.h" } -module std_private_algorithm_merge [system] { header "__algorithm/merge.h" } -module std_private_algorithm_min [system] { header "__algorithm/min.h" } -module std_private_algorithm_min_element [system] { header "__algorithm/min_element.h" } -module std_private_algorithm_min_max_result [system] { header "__algorithm/min_max_result.h" } -module std_private_algorithm_minmax [system] { +module cxx03_std_private_algorithm_lexicographical_compare [system] { header "__algorithm/lexicographical_compare.h" } +module cxx03_std_private_algorithm_lexicographical_compare_three_way [system] { header "__algorithm/lexicographical_compare_three_way.h" } +module cxx03_std_private_algorithm_lower_bound [system] { header "__algorithm/lower_bound.h" } +module cxx03_std_private_algorithm_make_heap [system] { header "__algorithm/make_heap.h" } +module cxx03_std_private_algorithm_make_projected [system] { header "__algorithm/make_projected.h" } +module cxx03_std_private_algorithm_max [system] { header "__algorithm/max.h" } +module cxx03_std_private_algorithm_max_element [system] { header "__algorithm/max_element.h" } +module cxx03_std_private_algorithm_merge [system] { header "__algorithm/merge.h" } +module cxx03_std_private_algorithm_min [system] { header "__algorithm/min.h" } +module cxx03_std_private_algorithm_min_element [system] { header "__algorithm/min_element.h" } +module cxx03_std_private_algorithm_min_max_result [system] { header "__algorithm/min_max_result.h" } +module cxx03_std_private_algorithm_minmax [system] { header "__algorithm/minmax.h" export * } -module std_private_algorithm_minmax_element [system] { header "__algorithm/minmax_element.h" } -module std_private_algorithm_mismatch [system] { +module cxx03_std_private_algorithm_minmax_element [system] { header "__algorithm/minmax_element.h" } +module cxx03_std_private_algorithm_mismatch [system] { header "__algorithm/mismatch.h" export std_private_algorithm_simd_utils export std_private_iterator_aliasing_iterator } -module std_private_algorithm_move [system] { header "__algorithm/move.h" } -module std_private_algorithm_move_backward [system] { header "__algorithm/move_backward.h" } -module std_private_algorithm_next_permutation [system] { header "__algorithm/next_permutation.h" } -module std_private_algorithm_none_of [system] { header "__algorithm/none_of.h" } -module std_private_algorithm_nth_element [system] { header "__algorithm/nth_element.h" } -module std_private_algorithm_partial_sort [system] { header "__algorithm/partial_sort.h" } -module std_private_algorithm_partial_sort_copy [system] { header "__algorithm/partial_sort_copy.h" } -module std_private_algorithm_partition [system] { header "__algorithm/partition.h" } -module std_private_algorithm_partition_copy [system] { header "__algorithm/partition_copy.h" } -module std_private_algorithm_partition_point [system] { header "__algorithm/partition_point.h" } -module std_private_algorithm_pop_heap [system] { header "__algorithm/pop_heap.h" } -module std_private_algorithm_prev_permutation [system] { header "__algorithm/prev_permutation.h" } -module std_private_algorithm_pstl [system] { +module cxx03_std_private_algorithm_move [system] { header "__algorithm/move.h" } +module cxx03_std_private_algorithm_move_backward [system] { header "__algorithm/move_backward.h" } +module cxx03_std_private_algorithm_next_permutation [system] { header "__algorithm/next_permutation.h" } +module cxx03_std_private_algorithm_none_of [system] { header "__algorithm/none_of.h" } +module cxx03_std_private_algorithm_nth_element [system] { header "__algorithm/nth_element.h" } +module cxx03_std_private_algorithm_partial_sort [system] { header "__algorithm/partial_sort.h" } +module cxx03_std_private_algorithm_partial_sort_copy [system] { header "__algorithm/partial_sort_copy.h" } +module cxx03_std_private_algorithm_partition [system] { header "__algorithm/partition.h" } +module cxx03_std_private_algorithm_partition_copy [system] { header "__algorithm/partition_copy.h" } +module cxx03_std_private_algorithm_partition_point [system] { header "__algorithm/partition_point.h" } +module cxx03_std_private_algorithm_pop_heap [system] { header "__algorithm/pop_heap.h" } +module cxx03_std_private_algorithm_prev_permutation [system] { header "__algorithm/prev_permutation.h" } +module cxx03_std_private_algorithm_pstl [system] { header "__algorithm/pstl.h" export * } -module std_private_algorithm_push_heap [system] { header "__algorithm/push_heap.h" } -module std_private_algorithm_ranges_adjacent_find [system] { header "__algorithm/ranges_adjacent_find.h" } -module std_private_algorithm_ranges_all_of [system] { header "__algorithm/ranges_all_of.h" } -module std_private_algorithm_ranges_any_of [system] { header "__algorithm/ranges_any_of.h" } -module std_private_algorithm_ranges_binary_search [system] { +module cxx03_std_private_algorithm_push_heap [system] { header "__algorithm/push_heap.h" } +module cxx03_std_private_algorithm_ranges_adjacent_find [system] { header "__algorithm/ranges_adjacent_find.h" } +module cxx03_std_private_algorithm_ranges_all_of [system] { header "__algorithm/ranges_all_of.h" } +module cxx03_std_private_algorithm_ranges_any_of [system] { header "__algorithm/ranges_any_of.h" } +module cxx03_std_private_algorithm_ranges_binary_search [system] { header "__algorithm/ranges_binary_search.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_clamp [system] { +module cxx03_std_private_algorithm_ranges_clamp [system] { header "__algorithm/ranges_clamp.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_contains [system] { header "__algorithm/ranges_contains.h" } -module std_private_algorithm_ranges_contains_subrange [system] { header "__algorithm/ranges_contains_subrange.h" } -module std_private_algorithm_ranges_copy [system] { +module cxx03_std_private_algorithm_ranges_contains [system] { header "__algorithm/ranges_contains.h" } +module cxx03_std_private_algorithm_ranges_contains_subrange [system] { header "__algorithm/ranges_contains_subrange.h" } +module cxx03_std_private_algorithm_ranges_copy [system] { header "__algorithm/ranges_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_copy_backward [system] { +module cxx03_std_private_algorithm_ranges_copy_backward [system] { header "__algorithm/ranges_copy_backward.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_copy_if [system] { +module cxx03_std_private_algorithm_ranges_copy_if [system] { header "__algorithm/ranges_copy_if.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_copy_n [system] { +module cxx03_std_private_algorithm_ranges_copy_n [system] { header "__algorithm/ranges_copy_n.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_count [system] { header "__algorithm/ranges_count.h" } -module std_private_algorithm_ranges_count_if [system] { header "__algorithm/ranges_count_if.h" } -module std_private_algorithm_ranges_ends_with [system] { header "__algorithm/ranges_ends_with.h" } -module std_private_algorithm_ranges_equal [system] { header "__algorithm/ranges_equal.h" } -module std_private_algorithm_ranges_equal_range [system] { +module cxx03_std_private_algorithm_ranges_count [system] { header "__algorithm/ranges_count.h" } +module cxx03_std_private_algorithm_ranges_count_if [system] { header "__algorithm/ranges_count_if.h" } +module cxx03_std_private_algorithm_ranges_ends_with [system] { header "__algorithm/ranges_ends_with.h" } +module cxx03_std_private_algorithm_ranges_equal [system] { header "__algorithm/ranges_equal.h" } +module cxx03_std_private_algorithm_ranges_equal_range [system] { header "__algorithm/ranges_equal_range.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_fill [system] { header "__algorithm/ranges_fill.h" } -module std_private_algorithm_ranges_fill_n [system] { header "__algorithm/ranges_fill_n.h" } -module std_private_algorithm_ranges_find [system] { header "__algorithm/ranges_find.h" } -module std_private_algorithm_ranges_find_end [system] { header "__algorithm/ranges_find_end.h" } -module std_private_algorithm_ranges_find_first_of [system] { header "__algorithm/ranges_find_first_of.h" } -module std_private_algorithm_ranges_find_if [system] { header "__algorithm/ranges_find_if.h" } -module std_private_algorithm_ranges_find_if_not [system] { header "__algorithm/ranges_find_if_not.h" } -module std_private_algorithm_ranges_find_last [system] { header "__algorithm/ranges_find_last.h" } -module std_private_algorithm_ranges_for_each [system] { +module cxx03_std_private_algorithm_ranges_fill [system] { header "__algorithm/ranges_fill.h" } +module cxx03_std_private_algorithm_ranges_fill_n [system] { header "__algorithm/ranges_fill_n.h" } +module cxx03_std_private_algorithm_ranges_find [system] { header "__algorithm/ranges_find.h" } +module cxx03_std_private_algorithm_ranges_find_end [system] { header "__algorithm/ranges_find_end.h" } +module cxx03_std_private_algorithm_ranges_find_first_of [system] { header "__algorithm/ranges_find_first_of.h" } +module cxx03_std_private_algorithm_ranges_find_if [system] { header "__algorithm/ranges_find_if.h" } +module cxx03_std_private_algorithm_ranges_find_if_not [system] { header "__algorithm/ranges_find_if_not.h" } +module cxx03_std_private_algorithm_ranges_find_last [system] { header "__algorithm/ranges_find_last.h" } +module cxx03_std_private_algorithm_ranges_for_each [system] { header "__algorithm/ranges_for_each.h" export std_private_algorithm_in_fun_result } -module std_private_algorithm_ranges_for_each_n [system] { +module cxx03_std_private_algorithm_ranges_for_each_n [system] { header "__algorithm/ranges_for_each_n.h" export std_private_algorithm_in_fun_result } -module std_private_algorithm_ranges_generate [system] { header "__algorithm/ranges_generate.h" } -module std_private_algorithm_ranges_generate_n [system] { header "__algorithm/ranges_generate_n.h" } -module std_private_algorithm_ranges_includes [system] { +module cxx03_std_private_algorithm_ranges_generate [system] { header "__algorithm/ranges_generate.h" } +module cxx03_std_private_algorithm_ranges_generate_n [system] { header "__algorithm/ranges_generate_n.h" } +module cxx03_std_private_algorithm_ranges_includes [system] { header "__algorithm/ranges_includes.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_inplace_merge [system] { +module cxx03_std_private_algorithm_ranges_inplace_merge [system] { header "__algorithm/ranges_inplace_merge.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_is_heap [system] { +module cxx03_std_private_algorithm_ranges_is_heap [system] { header "__algorithm/ranges_is_heap.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_is_heap_until [system] { +module cxx03_std_private_algorithm_ranges_is_heap_until [system] { header "__algorithm/ranges_is_heap_until.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_is_partitioned [system] { header "__algorithm/ranges_is_partitioned.h" } -module std_private_algorithm_ranges_is_permutation [system] { header "__algorithm/ranges_is_permutation.h" } -module std_private_algorithm_ranges_is_sorted [system] { +module cxx03_std_private_algorithm_ranges_is_partitioned [system] { header "__algorithm/ranges_is_partitioned.h" } +module cxx03_std_private_algorithm_ranges_is_permutation [system] { header "__algorithm/ranges_is_permutation.h" } +module cxx03_std_private_algorithm_ranges_is_sorted [system] { header "__algorithm/ranges_is_sorted.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_is_sorted_until [system] { +module cxx03_std_private_algorithm_ranges_is_sorted_until [system] { header "__algorithm/ranges_is_sorted_until.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_iterator_concept [system] { header "__algorithm/ranges_iterator_concept.h" } -module std_private_algorithm_ranges_lexicographical_compare [system] { +module cxx03_std_private_algorithm_ranges_iterator_concept [system] { header "__algorithm/ranges_iterator_concept.h" } +module cxx03_std_private_algorithm_ranges_lexicographical_compare [system] { header "__algorithm/ranges_lexicographical_compare.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_lower_bound [system] { +module cxx03_std_private_algorithm_ranges_lower_bound [system] { header "__algorithm/ranges_lower_bound.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_make_heap [system] { +module cxx03_std_private_algorithm_ranges_make_heap [system] { header "__algorithm/ranges_make_heap.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_max [system] { +module cxx03_std_private_algorithm_ranges_max [system] { header "__algorithm/ranges_max.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_max_element [system] { +module cxx03_std_private_algorithm_ranges_max_element [system] { header "__algorithm/ranges_max_element.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_merge [system] { +module cxx03_std_private_algorithm_ranges_merge [system] { header "__algorithm/ranges_merge.h" export std_private_algorithm_in_in_out_result } -module std_private_algorithm_ranges_min [system] { +module cxx03_std_private_algorithm_ranges_min [system] { header "__algorithm/ranges_min.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_min_element [system] { +module cxx03_std_private_algorithm_ranges_min_element [system] { header "__algorithm/ranges_min_element.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_minmax [system] { +module cxx03_std_private_algorithm_ranges_minmax [system] { header "__algorithm/ranges_minmax.h" export std_private_functional_ranges_operations export std_private_algorithm_min_max_result } -module std_private_algorithm_ranges_minmax_element [system] { +module cxx03_std_private_algorithm_ranges_minmax_element [system] { header "__algorithm/ranges_minmax_element.h" export std_private_functional_ranges_operations export std_private_algorithm_min_max_result } -module std_private_algorithm_ranges_mismatch [system] { +module cxx03_std_private_algorithm_ranges_mismatch [system] { header "__algorithm/ranges_mismatch.h" export std_private_algorithm_in_in_result } -module std_private_algorithm_ranges_move [system] { +module cxx03_std_private_algorithm_ranges_move [system] { header "__algorithm/ranges_move.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_move_backward [system] { +module cxx03_std_private_algorithm_ranges_move_backward [system] { header "__algorithm/ranges_move_backward.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_next_permutation [system] { +module cxx03_std_private_algorithm_ranges_next_permutation [system] { header "__algorithm/ranges_next_permutation.h" export std_private_algorithm_in_found_result export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_none_of [system] { header "__algorithm/ranges_none_of.h" } -module std_private_algorithm_ranges_nth_element [system] { +module cxx03_std_private_algorithm_ranges_none_of [system] { header "__algorithm/ranges_none_of.h" } +module cxx03_std_private_algorithm_ranges_nth_element [system] { header "__algorithm/ranges_nth_element.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_partial_sort [system] { +module cxx03_std_private_algorithm_ranges_partial_sort [system] { header "__algorithm/ranges_partial_sort.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_partial_sort_copy [system] { +module cxx03_std_private_algorithm_ranges_partial_sort_copy [system] { header "__algorithm/ranges_partial_sort_copy.h" export std_private_algorithm_in_out_result export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_partition [system] { header "__algorithm/ranges_partition.h" } -module std_private_algorithm_ranges_partition_copy [system] { header "__algorithm/ranges_partition_copy.h" } -module std_private_algorithm_ranges_partition_point [system] { header "__algorithm/ranges_partition_point.h" } -module std_private_algorithm_ranges_pop_heap [system] { +module cxx03_std_private_algorithm_ranges_partition [system] { header "__algorithm/ranges_partition.h" } +module cxx03_std_private_algorithm_ranges_partition_copy [system] { header "__algorithm/ranges_partition_copy.h" } +module cxx03_std_private_algorithm_ranges_partition_point [system] { header "__algorithm/ranges_partition_point.h" } +module cxx03_std_private_algorithm_ranges_pop_heap [system] { header "__algorithm/ranges_pop_heap.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_prev_permutation [system] { +module cxx03_std_private_algorithm_ranges_prev_permutation [system] { header "__algorithm/ranges_prev_permutation.h" export std_private_algorithm_in_found_result export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_push_heap [system] { +module cxx03_std_private_algorithm_ranges_push_heap [system] { header "__algorithm/ranges_push_heap.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_remove [system] { header "__algorithm/ranges_remove.h" } -module std_private_algorithm_ranges_remove_copy [system] { +module cxx03_std_private_algorithm_ranges_remove [system] { header "__algorithm/ranges_remove.h" } +module cxx03_std_private_algorithm_ranges_remove_copy [system] { header "__algorithm/ranges_remove_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_remove_copy_if [system] { +module cxx03_std_private_algorithm_ranges_remove_copy_if [system] { header "__algorithm/ranges_remove_copy_if.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_remove_if [system] { header "__algorithm/ranges_remove_if.h" } -module std_private_algorithm_ranges_replace [system] { header "__algorithm/ranges_replace.h" } -module std_private_algorithm_ranges_replace_copy [system] { +module cxx03_std_private_algorithm_ranges_remove_if [system] { header "__algorithm/ranges_remove_if.h" } +module cxx03_std_private_algorithm_ranges_replace [system] { header "__algorithm/ranges_replace.h" } +module cxx03_std_private_algorithm_ranges_replace_copy [system] { header "__algorithm/ranges_replace_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_replace_copy_if [system] { +module cxx03_std_private_algorithm_ranges_replace_copy_if [system] { header "__algorithm/ranges_replace_copy_if.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_replace_if [system] { header "__algorithm/ranges_replace_if.h" } -module std_private_algorithm_ranges_reverse [system] { header "__algorithm/ranges_reverse.h" } -module std_private_algorithm_ranges_reverse_copy [system] { +module cxx03_std_private_algorithm_ranges_replace_if [system] { header "__algorithm/ranges_replace_if.h" } +module cxx03_std_private_algorithm_ranges_reverse [system] { header "__algorithm/ranges_reverse.h" } +module cxx03_std_private_algorithm_ranges_reverse_copy [system] { header "__algorithm/ranges_reverse_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_rotate [system] { header "__algorithm/ranges_rotate.h" } -module std_private_algorithm_ranges_rotate_copy [system] { +module cxx03_std_private_algorithm_ranges_rotate [system] { header "__algorithm/ranges_rotate.h" } +module cxx03_std_private_algorithm_ranges_rotate_copy [system] { header "__algorithm/ranges_rotate_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_sample [system] { header "__algorithm/ranges_sample.h" } -module std_private_algorithm_ranges_search [system] { header "__algorithm/ranges_search.h" } -module std_private_algorithm_ranges_search_n [system] { header "__algorithm/ranges_search_n.h" } -module std_private_algorithm_ranges_set_difference [system] { +module cxx03_std_private_algorithm_ranges_sample [system] { header "__algorithm/ranges_sample.h" } +module cxx03_std_private_algorithm_ranges_search [system] { header "__algorithm/ranges_search.h" } +module cxx03_std_private_algorithm_ranges_search_n [system] { header "__algorithm/ranges_search_n.h" } +module cxx03_std_private_algorithm_ranges_set_difference [system] { header "__algorithm/ranges_set_difference.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_set_intersection [system] { +module cxx03_std_private_algorithm_ranges_set_intersection [system] { header "__algorithm/ranges_set_intersection.h" export std_private_algorithm_in_in_out_result } -module std_private_algorithm_ranges_set_symmetric_difference [system] { +module cxx03_std_private_algorithm_ranges_set_symmetric_difference [system] { header "__algorithm/ranges_set_symmetric_difference.h" export std_private_algorithm_in_in_out_result export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_set_union [system] { +module cxx03_std_private_algorithm_ranges_set_union [system] { header "__algorithm/ranges_set_union.h" export std_private_algorithm_in_in_out_result export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_shuffle [system] { header "__algorithm/ranges_shuffle.h" } -module std_private_algorithm_ranges_sort [system] { +module cxx03_std_private_algorithm_ranges_shuffle [system] { header "__algorithm/ranges_shuffle.h" } +module cxx03_std_private_algorithm_ranges_sort [system] { header "__algorithm/ranges_sort.h" export std_private_algorithm_make_projected export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_sort_heap [system] { +module cxx03_std_private_algorithm_ranges_sort_heap [system] { header "__algorithm/ranges_sort_heap.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_stable_partition [system] { header "__algorithm/ranges_stable_partition.h" } -module std_private_algorithm_ranges_stable_sort [system] { +module cxx03_std_private_algorithm_ranges_stable_partition [system] { header "__algorithm/ranges_stable_partition.h" } +module cxx03_std_private_algorithm_ranges_stable_sort [system] { header "__algorithm/ranges_stable_sort.h" export std_private_functional_ranges_operations } -module std_private_algorithm_ranges_starts_with [system] { header "__algorithm/ranges_starts_with.h" } -module std_private_algorithm_ranges_swap_ranges [system] { +module cxx03_std_private_algorithm_ranges_starts_with [system] { header "__algorithm/ranges_starts_with.h" } +module cxx03_std_private_algorithm_ranges_swap_ranges [system] { header "__algorithm/ranges_swap_ranges.h" export std_private_algorithm_in_in_result } -module std_private_algorithm_ranges_transform [system] { +module cxx03_std_private_algorithm_ranges_transform [system] { header "__algorithm/ranges_transform.h" export std_private_algorithm_in_in_out_result export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_unique [system] { header "__algorithm/ranges_unique.h" } -module std_private_algorithm_ranges_unique_copy [system] { +module cxx03_std_private_algorithm_ranges_unique [system] { header "__algorithm/ranges_unique.h" } +module cxx03_std_private_algorithm_ranges_unique_copy [system] { header "__algorithm/ranges_unique_copy.h" export std_private_algorithm_in_out_result } -module std_private_algorithm_ranges_upper_bound [system] { +module cxx03_std_private_algorithm_ranges_upper_bound [system] { header "__algorithm/ranges_upper_bound.h" export std_private_functional_ranges_operations } -module std_private_algorithm_remove [system] { header "__algorithm/remove.h" } -module std_private_algorithm_remove_copy [system] { header "__algorithm/remove_copy.h" } -module std_private_algorithm_remove_copy_if [system] { header "__algorithm/remove_copy_if.h" } -module std_private_algorithm_remove_if [system] { header "__algorithm/remove_if.h" } -module std_private_algorithm_replace [system] { header "__algorithm/replace.h" } -module std_private_algorithm_replace_copy [system] { header "__algorithm/replace_copy.h" } -module std_private_algorithm_replace_copy_if [system] { header "__algorithm/replace_copy_if.h" } -module std_private_algorithm_replace_if [system] { header "__algorithm/replace_if.h" } -module std_private_algorithm_reverse [system] { header "__algorithm/reverse.h" } -module std_private_algorithm_reverse_copy [system] { header "__algorithm/reverse_copy.h" } -module std_private_algorithm_rotate [system] { header "__algorithm/rotate.h" } -module std_private_algorithm_rotate_copy [system] { header "__algorithm/rotate_copy.h" } -module std_private_algorithm_sample [system] { header "__algorithm/sample.h" } -module std_private_algorithm_search [system] { header "__algorithm/search.h" } -module std_private_algorithm_search_n [system] { header "__algorithm/search_n.h" } -module std_private_algorithm_set_difference [system] { header "__algorithm/set_difference.h" } -module std_private_algorithm_set_intersection [system] { header "__algorithm/set_intersection.h" } -module std_private_algorithm_set_symmetric_difference [system] { header "__algorithm/set_symmetric_difference.h" } -module std_private_algorithm_set_union [system] { header "__algorithm/set_union.h" } -module std_private_algorithm_shift_left [system] { header "__algorithm/shift_left.h" } -module std_private_algorithm_shift_right [system] { header "__algorithm/shift_right.h" } -module std_private_algorithm_shuffle [system] { header "__algorithm/shuffle.h" } -module std_private_algorithm_sift_down [system] { header "__algorithm/sift_down.h" } -module std_private_algorithm_sort [system] { +module cxx03_std_private_algorithm_remove [system] { header "__algorithm/remove.h" } +module cxx03_std_private_algorithm_remove_copy [system] { header "__algorithm/remove_copy.h" } +module cxx03_std_private_algorithm_remove_copy_if [system] { header "__algorithm/remove_copy_if.h" } +module cxx03_std_private_algorithm_remove_if [system] { header "__algorithm/remove_if.h" } +module cxx03_std_private_algorithm_replace [system] { header "__algorithm/replace.h" } +module cxx03_std_private_algorithm_replace_copy [system] { header "__algorithm/replace_copy.h" } +module cxx03_std_private_algorithm_replace_copy_if [system] { header "__algorithm/replace_copy_if.h" } +module cxx03_std_private_algorithm_replace_if [system] { header "__algorithm/replace_if.h" } +module cxx03_std_private_algorithm_reverse [system] { header "__algorithm/reverse.h" } +module cxx03_std_private_algorithm_reverse_copy [system] { header "__algorithm/reverse_copy.h" } +module cxx03_std_private_algorithm_rotate [system] { header "__algorithm/rotate.h" } +module cxx03_std_private_algorithm_rotate_copy [system] { header "__algorithm/rotate_copy.h" } +module cxx03_std_private_algorithm_sample [system] { header "__algorithm/sample.h" } +module cxx03_std_private_algorithm_search [system] { header "__algorithm/search.h" } +module cxx03_std_private_algorithm_search_n [system] { header "__algorithm/search_n.h" } +module cxx03_std_private_algorithm_set_difference [system] { header "__algorithm/set_difference.h" } +module cxx03_std_private_algorithm_set_intersection [system] { header "__algorithm/set_intersection.h" } +module cxx03_std_private_algorithm_set_symmetric_difference [system] { header "__algorithm/set_symmetric_difference.h" } +module cxx03_std_private_algorithm_set_union [system] { header "__algorithm/set_union.h" } +module cxx03_std_private_algorithm_shift_left [system] { header "__algorithm/shift_left.h" } +module cxx03_std_private_algorithm_shift_right [system] { header "__algorithm/shift_right.h" } +module cxx03_std_private_algorithm_shuffle [system] { header "__algorithm/shuffle.h" } +module cxx03_std_private_algorithm_sift_down [system] { header "__algorithm/sift_down.h" } +module cxx03_std_private_algorithm_sort [system] { header "__algorithm/sort.h" export std_private_debug_utils_strict_weak_ordering_check } -module std_private_algorithm_simd_utils [system] { header "__algorithm/simd_utils.h" } -module std_private_algorithm_sort_heap [system] { header "__algorithm/sort_heap.h" } -module std_private_algorithm_stable_partition [system] { header "__algorithm/stable_partition.h" } -module std_private_algorithm_stable_sort [system] { header "__algorithm/stable_sort.h" } -module std_private_algorithm_swap_ranges [system] { +module cxx03_std_private_algorithm_simd_utils [system] { header "__algorithm/simd_utils.h" } +module cxx03_std_private_algorithm_sort_heap [system] { header "__algorithm/sort_heap.h" } +module cxx03_std_private_algorithm_stable_partition [system] { header "__algorithm/stable_partition.h" } +module cxx03_std_private_algorithm_stable_sort [system] { header "__algorithm/stable_sort.h" } +module cxx03_std_private_algorithm_swap_ranges [system] { header "__algorithm/swap_ranges.h" export std_private_algorithm_iterator_operations } -module std_private_algorithm_three_way_comp_ref_type [system] { header "__algorithm/three_way_comp_ref_type.h" } -module std_private_algorithm_transform [system] { header "__algorithm/transform.h" } -module std_private_algorithm_uniform_random_bit_generator_adaptor [system] { header "__algorithm/uniform_random_bit_generator_adaptor.h" } -module std_private_algorithm_unique [system] { header "__algorithm/unique.h" } -module std_private_algorithm_unique_copy [system] { header "__algorithm/unique_copy.h" } -module std_private_algorithm_unwrap_iter [system] { +module cxx03_std_private_algorithm_three_way_comp_ref_type [system] { header "__algorithm/three_way_comp_ref_type.h" } +module cxx03_std_private_algorithm_transform [system] { header "__algorithm/transform.h" } +module cxx03_std_private_algorithm_uniform_random_bit_generator_adaptor [system] { header "__algorithm/uniform_random_bit_generator_adaptor.h" } +module cxx03_std_private_algorithm_unique [system] { header "__algorithm/unique.h" } +module cxx03_std_private_algorithm_unique_copy [system] { header "__algorithm/unique_copy.h" } +module cxx03_std_private_algorithm_unwrap_iter [system] { header "__algorithm/unwrap_iter.h" export std_private_iterator_iterator_traits } -module std_private_algorithm_unwrap_range [system] { +module cxx03_std_private_algorithm_unwrap_range [system] { header "__algorithm/unwrap_range.h" export std_private_utility_pair } -module std_private_algorithm_upper_bound [system] { header "__algorithm/upper_bound.h" } +module cxx03_std_private_algorithm_upper_bound [system] { header "__algorithm/upper_bound.h" } -module std_private_array_array_fwd [system] { header "__fwd/array.h" } +module cxx03_std_private_array_array_fwd [system] { header "__fwd/array.h" } -module std_private_atomic_aliases [system] { +module cxx03_std_private_atomic_aliases [system] { header "__atomic/aliases.h" export std_private_atomic_atomic } -module std_private_atomic_atomic [system] { +module cxx03_std_private_atomic_atomic [system] { header "__atomic/atomic.h" export std_private_atomic_atomic_base } -module std_private_atomic_atomic_base [system] { header "__atomic/atomic_base.h" } -module std_private_atomic_atomic_flag [system] { +module cxx03_std_private_atomic_atomic_base [system] { header "__atomic/atomic_base.h" } +module cxx03_std_private_atomic_atomic_flag [system] { header "__atomic/atomic_flag.h" export * } -module std_private_atomic_atomic_init [system] { header "__atomic/atomic_init.h" } -module std_private_atomic_atomic_lock_free [system] { header "__atomic/atomic_lock_free.h" } -module std_private_atomic_atomic_ref [system] { header "__atomic/atomic_ref.h" } -module std_private_atomic_atomic_sync [system] { +module cxx03_std_private_atomic_atomic_init [system] { header "__atomic/atomic_init.h" } +module cxx03_std_private_atomic_atomic_lock_free [system] { header "__atomic/atomic_lock_free.h" } +module cxx03_std_private_atomic_atomic_ref [system] { header "__atomic/atomic_ref.h" } +module cxx03_std_private_atomic_atomic_sync [system] { header "__atomic/atomic_sync.h" export std_private_atomic_to_gcc_order } -module std_private_atomic_check_memory_order [system] { header "__atomic/check_memory_order.h" } -module std_private_atomic_contention_t [system] { header "__atomic/contention_t.h" } -module std_private_atomic_cxx_atomic_impl [system] { header "__atomic/cxx_atomic_impl.h" } -module std_private_atomic_fence [system] { header "__atomic/fence.h" } -module std_private_atomic_is_always_lock_free [system] { header "__atomic/is_always_lock_free.h" } -module std_private_atomic_kill_dependency [system] { header "__atomic/kill_dependency.h" } -module std_private_atomic_memory_order [system] { header "__atomic/memory_order.h" } -module std_private_atomic_to_gcc_order [system] { +module cxx03_std_private_atomic_check_memory_order [system] { header "__atomic/check_memory_order.h" } +module cxx03_std_private_atomic_contention_t [system] { header "__atomic/contention_t.h" } +module cxx03_std_private_atomic_cxx_atomic_impl [system] { header "__atomic/cxx_atomic_impl.h" } +module cxx03_std_private_atomic_fence [system] { header "__atomic/fence.h" } +module cxx03_std_private_atomic_is_always_lock_free [system] { header "__atomic/is_always_lock_free.h" } +module cxx03_std_private_atomic_kill_dependency [system] { header "__atomic/kill_dependency.h" } +module cxx03_std_private_atomic_memory_order [system] { header "__atomic/memory_order.h" } +module cxx03_std_private_atomic_to_gcc_order [system] { header "__atomic/to_gcc_order.h" export std_private_atomic_memory_order } -module std_private_bit_bit_cast [system] { header "__bit/bit_cast.h" } -module std_private_bit_bit_ceil [system] { header "__bit/bit_ceil.h" } -module std_private_bit_bit_floor [system] { header "__bit/bit_floor.h" } -module std_private_bit_bit_log2 [system] { header "__bit/bit_log2.h" } -module std_private_bit_bit_width [system] { header "__bit/bit_width.h" } -module std_private_bit_blsr [system] { header "__bit/blsr.h" } -module std_private_bit_byteswap [system] { header "__bit/byteswap.h" } -module std_private_bit_countl [system] { header "__bit/countl.h" } -module std_private_bit_countr [system] { header "__bit/countr.h" } -module std_private_bit_endian [system] { header "__bit/endian.h" } -module std_private_bit_has_single_bit [system] { header "__bit/has_single_bit.h" } -module std_private_bit_invert_if [system] { header "__bit/invert_if.h" } -module std_private_bit_popcount [system] { header "__bit/popcount.h" } -module std_private_bit_rotate [system] { header "__bit/rotate.h" } +module cxx03_std_private_bit_bit_cast [system] { header "__bit/bit_cast.h" } +module cxx03_std_private_bit_bit_ceil [system] { header "__bit/bit_ceil.h" } +module cxx03_std_private_bit_bit_floor [system] { header "__bit/bit_floor.h" } +module cxx03_std_private_bit_bit_log2 [system] { header "__bit/bit_log2.h" } +module cxx03_std_private_bit_bit_width [system] { header "__bit/bit_width.h" } +module cxx03_std_private_bit_blsr [system] { header "__bit/blsr.h" } +module cxx03_std_private_bit_byteswap [system] { header "__bit/byteswap.h" } +module cxx03_std_private_bit_countl [system] { header "__bit/countl.h" } +module cxx03_std_private_bit_countr [system] { header "__bit/countr.h" } +module cxx03_std_private_bit_endian [system] { header "__bit/endian.h" } +module cxx03_std_private_bit_has_single_bit [system] { header "__bit/has_single_bit.h" } +module cxx03_std_private_bit_invert_if [system] { header "__bit/invert_if.h" } +module cxx03_std_private_bit_popcount [system] { header "__bit/popcount.h" } +module cxx03_std_private_bit_rotate [system] { header "__bit/rotate.h" } -module std_private_charconv_chars_format [system] { header "__charconv/chars_format.h" } -module std_private_charconv_from_chars_integral [system] { header "__charconv/from_chars_integral.h" } -module std_private_charconv_from_chars_result [system] { header "__charconv/from_chars_result.h" } -module std_private_charconv_tables [system] { header "__charconv/tables.h" } -module std_private_charconv_to_chars [system] { header "__charconv/to_chars.h" } -module std_private_charconv_to_chars_base_10 [system] { header "__charconv/to_chars_base_10.h" } -module std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" } -module std_private_charconv_to_chars_integral [system] { +module cxx03_std_private_charconv_chars_format [system] { header "__charconv/chars_format.h" } +module cxx03_std_private_charconv_from_chars_integral [system] { header "__charconv/from_chars_integral.h" } +module cxx03_std_private_charconv_from_chars_result [system] { header "__charconv/from_chars_result.h" } +module cxx03_std_private_charconv_tables [system] { header "__charconv/tables.h" } +module cxx03_std_private_charconv_to_chars [system] { header "__charconv/to_chars.h" } +module cxx03_std_private_charconv_to_chars_base_10 [system] { header "__charconv/to_chars_base_10.h" } +module cxx03_std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" } +module cxx03_std_private_charconv_to_chars_integral [system] { header "__charconv/to_chars_integral.h" export std_private_charconv_traits } -module std_private_charconv_to_chars_result [system] { +module cxx03_std_private_charconv_to_chars_result [system] { header "__charconv/to_chars_result.h" export * } -module std_private_charconv_traits [system] { header "__charconv/traits.h" } +module cxx03_std_private_charconv_traits [system] { header "__charconv/traits.h" } -module std_private_chrono_calendar [system] { header "__chrono/calendar.h" } -module std_private_chrono_concepts [system] { header "__chrono/concepts.h" } -module std_private_chrono_convert_to_timespec [system] { header "__chrono/convert_to_timespec.h" } -module std_private_chrono_convert_to_tm [system] { header "__chrono/convert_to_tm.h" } -module std_private_chrono_day [system] { header "__chrono/day.h" } -module std_private_chrono_duration [system] { +module cxx03_std_private_chrono_calendar [system] { header "__chrono/calendar.h" } +module cxx03_std_private_chrono_concepts [system] { header "__chrono/concepts.h" } +module cxx03_std_private_chrono_convert_to_timespec [system] { header "__chrono/convert_to_timespec.h" } +module cxx03_std_private_chrono_convert_to_tm [system] { header "__chrono/convert_to_tm.h" } +module cxx03_std_private_chrono_day [system] { header "__chrono/day.h" } +module cxx03_std_private_chrono_duration [system] { header "__chrono/duration.h" export std_private_type_traits_is_convertible } -module std_private_chrono_exception [system] { header "__chrono/exception.h" } -module std_private_chrono_file_clock [system] { header "__chrono/file_clock.h" } -module std_private_chrono_formatter [system] { +module cxx03_std_private_chrono_exception [system] { header "__chrono/exception.h" } +module cxx03_std_private_chrono_file_clock [system] { header "__chrono/file_clock.h" } +module cxx03_std_private_chrono_formatter [system] { header "__chrono/formatter.h" } -module std_private_chrono_hh_mm_ss [system] { header "__chrono/hh_mm_ss.h" } -module std_private_chrono_high_resolution_clock [system] { +module cxx03_std_private_chrono_hh_mm_ss [system] { header "__chrono/hh_mm_ss.h" } +module cxx03_std_private_chrono_high_resolution_clock [system] { header "__chrono/high_resolution_clock.h" export std_private_chrono_steady_clock export std_private_chrono_system_clock } -module std_private_chrono_leap_second [system] { header "__chrono/leap_second.h" } -module std_private_chrono_literals [system] { header "__chrono/literals.h" } -module std_private_chrono_local_info [system] { +module cxx03_std_private_chrono_leap_second [system] { header "__chrono/leap_second.h" } +module cxx03_std_private_chrono_literals [system] { header "__chrono/literals.h" } +module cxx03_std_private_chrono_local_info [system] { header "__chrono/local_info.h" export std_private_chrono_sys_info } -module std_private_chrono_month [system] { header "__chrono/month.h" } -module std_private_chrono_month_weekday [system] { header "__chrono/month_weekday.h" } -module std_private_chrono_monthday [system] { header "__chrono/monthday.h" } -module std_private_chrono_ostream [system] { +module cxx03_std_private_chrono_month [system] { header "__chrono/month.h" } +module cxx03_std_private_chrono_month_weekday [system] { header "__chrono/month_weekday.h" } +module cxx03_std_private_chrono_monthday [system] { header "__chrono/monthday.h" } +module cxx03_std_private_chrono_ostream [system] { header "__chrono/ostream.h" } -module std_private_chrono_parser_std_format_spec [system] { +module cxx03_std_private_chrono_parser_std_format_spec [system] { header "__chrono/parser_std_format_spec.h" } -module std_private_chrono_statically_widen [system] { header "__chrono/statically_widen.h" } -module std_private_chrono_steady_clock [system] { +module cxx03_std_private_chrono_statically_widen [system] { header "__chrono/statically_widen.h" } +module cxx03_std_private_chrono_steady_clock [system] { header "__chrono/steady_clock.h" export std_private_chrono_time_point } -module std_private_chrono_time_zone [system] { +module cxx03_std_private_chrono_time_zone [system] { header "__chrono/time_zone.h" export std_private_memory_unique_ptr } -module std_private_chrono_time_zone_link [system] { +module cxx03_std_private_chrono_time_zone_link [system] { header "__chrono/time_zone_link.h" } -module std_private_chrono_sys_info [system] { +module cxx03_std_private_chrono_sys_info [system] { header "__chrono/sys_info.h" } -module std_private_chrono_system_clock [system] { +module cxx03_std_private_chrono_system_clock [system] { header "__chrono/system_clock.h" export std_private_chrono_time_point } -module std_private_chrono_tzdb [system] { +module cxx03_std_private_chrono_tzdb [system] { header "__chrono/tzdb.h" export * } -module std_private_chrono_tzdb_list [system] { +module cxx03_std_private_chrono_tzdb_list [system] { header "__chrono/tzdb_list.h" export * } -module std_private_chrono_time_point [system] { header "__chrono/time_point.h" } -module std_private_chrono_weekday [system] { header "__chrono/weekday.h" } -module std_private_chrono_year [system] { header "__chrono/year.h" } -module std_private_chrono_year_month [system] { header "__chrono/year_month.h" } -module std_private_chrono_year_month_day [system] { header "__chrono/year_month_day.h" } -module std_private_chrono_year_month_weekday [system] { header "__chrono/year_month_weekday.h" } -module std_private_chrono_zoned_time [system] { header "__chrono/zoned_time.h" } +module cxx03_std_private_chrono_time_point [system] { header "__chrono/time_point.h" } +module cxx03_std_private_chrono_weekday [system] { header "__chrono/weekday.h" } +module cxx03_std_private_chrono_year [system] { header "__chrono/year.h" } +module cxx03_std_private_chrono_year_month [system] { header "__chrono/year_month.h" } +module cxx03_std_private_chrono_year_month_day [system] { header "__chrono/year_month_day.h" } +module cxx03_std_private_chrono_year_month_weekday [system] { header "__chrono/year_month_weekday.h" } +module cxx03_std_private_chrono_zoned_time [system] { header "__chrono/zoned_time.h" } -module std_private_compare_common_comparison_category [system] { header "__compare/common_comparison_category.h" } -module std_private_compare_compare_partial_order_fallback [system] { header "__compare/compare_partial_order_fallback.h" } -module std_private_compare_compare_strong_order_fallback [system] { header "__compare/compare_strong_order_fallback.h" } -module std_private_compare_compare_three_way [system] { header "__compare/compare_three_way.h" } -module std_private_compare_compare_three_way_result [system] { header "__compare/compare_three_way_result.h" } -module std_private_compare_compare_weak_order_fallback [system] { header "__compare/compare_weak_order_fallback.h" } -module std_private_compare_is_eq [system] { header "__compare/is_eq.h" } -module std_private_compare_ordering [system] { header "__compare/ordering.h" } -module std_private_compare_partial_order [system] { header "__compare/partial_order.h" } -module std_private_compare_strong_order [system] { header "__compare/strong_order.h" } -module std_private_compare_synth_three_way [system] { header "__compare/synth_three_way.h" } -module std_private_compare_three_way_comparable [system] { header "__compare/three_way_comparable.h" } -module std_private_compare_weak_order [system] { header "__compare/weak_order.h" } +module cxx03_std_private_compare_common_comparison_category [system] { header "__compare/common_comparison_category.h" } +module cxx03_std_private_compare_compare_partial_order_fallback [system] { header "__compare/compare_partial_order_fallback.h" } +module cxx03_std_private_compare_compare_strong_order_fallback [system] { header "__compare/compare_strong_order_fallback.h" } +module cxx03_std_private_compare_compare_three_way [system] { header "__compare/compare_three_way.h" } +module cxx03_std_private_compare_compare_three_way_result [system] { header "__compare/compare_three_way_result.h" } +module cxx03_std_private_compare_compare_weak_order_fallback [system] { header "__compare/compare_weak_order_fallback.h" } +module cxx03_std_private_compare_is_eq [system] { header "__compare/is_eq.h" } +module cxx03_std_private_compare_ordering [system] { header "__compare/ordering.h" } +module cxx03_std_private_compare_partial_order [system] { header "__compare/partial_order.h" } +module cxx03_std_private_compare_strong_order [system] { header "__compare/strong_order.h" } +module cxx03_std_private_compare_synth_three_way [system] { header "__compare/synth_three_way.h" } +module cxx03_std_private_compare_three_way_comparable [system] { header "__compare/three_way_comparable.h" } +module cxx03_std_private_compare_weak_order [system] { header "__compare/weak_order.h" } -module std_private_complex_complex_fwd [system] { header "__fwd/complex.h" } +module cxx03_std_private_complex_complex_fwd [system] { header "__fwd/complex.h" } -module std_private_concepts_arithmetic [system] { header "__concepts/arithmetic.h" } -module std_private_concepts_assignable [system] { header "__concepts/assignable.h" } -module std_private_concepts_boolean_testable [system] { header "__concepts/boolean_testable.h" } -module std_private_concepts_class_or_enum [system] { header "__concepts/class_or_enum.h" } -module std_private_concepts_common_reference_with [system] { header "__concepts/common_reference_with.h" } -module std_private_concepts_common_with [system] { header "__concepts/common_with.h" } -module std_private_concepts_constructible [system] { +module cxx03_std_private_concepts_arithmetic [system] { header "__concepts/arithmetic.h" } +module cxx03_std_private_concepts_assignable [system] { header "__concepts/assignable.h" } +module cxx03_std_private_concepts_boolean_testable [system] { header "__concepts/boolean_testable.h" } +module cxx03_std_private_concepts_class_or_enum [system] { header "__concepts/class_or_enum.h" } +module cxx03_std_private_concepts_common_reference_with [system] { header "__concepts/common_reference_with.h" } +module cxx03_std_private_concepts_common_with [system] { header "__concepts/common_with.h" } +module cxx03_std_private_concepts_constructible [system] { header "__concepts/constructible.h" export std_private_concepts_destructible } -module std_private_concepts_convertible_to [system] { header "__concepts/convertible_to.h" } -module std_private_concepts_copyable [system] { header "__concepts/copyable.h" } -module std_private_concepts_derived_from [system] { header "__concepts/derived_from.h" } -module std_private_concepts_destructible [system] { +module cxx03_std_private_concepts_convertible_to [system] { header "__concepts/convertible_to.h" } +module cxx03_std_private_concepts_copyable [system] { header "__concepts/copyable.h" } +module cxx03_std_private_concepts_derived_from [system] { header "__concepts/derived_from.h" } +module cxx03_std_private_concepts_destructible [system] { header "__concepts/destructible.h" export std_private_type_traits_is_nothrow_destructible } -module std_private_concepts_different_from [system] { header "__concepts/different_from.h" } -module std_private_concepts_equality_comparable [system] { +module cxx03_std_private_concepts_different_from [system] { header "__concepts/different_from.h" } +module cxx03_std_private_concepts_equality_comparable [system] { header "__concepts/equality_comparable.h" export std_private_type_traits_common_reference } -module std_private_concepts_invocable [system] { header "__concepts/invocable.h" } -module std_private_concepts_movable [system] { +module cxx03_std_private_concepts_invocable [system] { header "__concepts/invocable.h" } +module cxx03_std_private_concepts_movable [system] { header "__concepts/movable.h" export std_private_type_traits_is_object } -module std_private_concepts_predicate [system] { header "__concepts/predicate.h" } -module std_private_concepts_regular [system] { header "__concepts/regular.h" } -module std_private_concepts_relation [system] { header "__concepts/relation.h" } -module std_private_concepts_same_as [system] { +module cxx03_std_private_concepts_predicate [system] { header "__concepts/predicate.h" } +module cxx03_std_private_concepts_regular [system] { header "__concepts/regular.h" } +module cxx03_std_private_concepts_relation [system] { header "__concepts/relation.h" } +module cxx03_std_private_concepts_same_as [system] { header "__concepts/same_as.h" export std_private_type_traits_is_same } -module std_private_concepts_semiregular [system] { header "__concepts/semiregular.h" } -module std_private_concepts_swappable [system] { header "__concepts/swappable.h" } -module std_private_concepts_totally_ordered [system] { header "__concepts/totally_ordered.h" } +module cxx03_std_private_concepts_semiregular [system] { header "__concepts/semiregular.h" } +module cxx03_std_private_concepts_swappable [system] { header "__concepts/swappable.h" } +module cxx03_std_private_concepts_totally_ordered [system] { header "__concepts/totally_ordered.h" } -module std_private_condition_variable_condition_variable [system] { +module cxx03_std_private_condition_variable_condition_variable [system] { header "__condition_variable/condition_variable.h" export * } -module std_private_coroutine_coroutine_handle [system] { header "__coroutine/coroutine_handle.h" } -module std_private_coroutine_coroutine_traits [system] { header "__coroutine/coroutine_traits.h" } -module std_private_coroutine_noop_coroutine_handle [system] { header "__coroutine/noop_coroutine_handle.h" } -module std_private_coroutine_trivial_awaitables [system] { header "__coroutine/trivial_awaitables.h" } +module cxx03_std_private_coroutine_coroutine_handle [system] { header "__coroutine/coroutine_handle.h" } +module cxx03_std_private_coroutine_coroutine_traits [system] { header "__coroutine/coroutine_traits.h" } +module cxx03_std_private_coroutine_noop_coroutine_handle [system] { header "__coroutine/noop_coroutine_handle.h" } +module cxx03_std_private_coroutine_trivial_awaitables [system] { header "__coroutine/trivial_awaitables.h" } -module std_private_debug_utils_randomize_range [system] { header "__debug_utils/randomize_range.h" } -module std_private_debug_utils_sanitizers [system] { header "__debug_utils/sanitizers.h" } -module std_private_debug_utils_strict_weak_ordering_check [system] { +module cxx03_std_private_debug_utils_randomize_range [system] { header "__debug_utils/randomize_range.h" } +module cxx03_std_private_debug_utils_sanitizers [system] { header "__debug_utils/sanitizers.h" } +module cxx03_std_private_debug_utils_strict_weak_ordering_check [system] { header "__debug_utils/strict_weak_ordering_check.h" export std_private_type_traits_is_constant_evaluated } -module std_private_deque_fwd [system] { header "__fwd/deque.h" } +module cxx03_std_private_deque_fwd [system] { header "__fwd/deque.h" } -module std_private_exception_exception [system] { header "__exception/exception.h" } -module std_private_exception_exception_ptr [system] { +module cxx03_std_private_exception_exception [system] { header "__exception/exception.h" } +module cxx03_std_private_exception_exception_ptr [system] { header "__exception/exception_ptr.h" export std_private_exception_operations } -module std_private_exception_nested_exception [system] { header "__exception/nested_exception.h" } -module std_private_exception_operations [system] { header "__exception/operations.h" } -module std_private_exception_terminate [system] { header "__exception/terminate.h" } +module cxx03_std_private_exception_nested_exception [system] { header "__exception/nested_exception.h" } +module cxx03_std_private_exception_operations [system] { header "__exception/operations.h" } +module cxx03_std_private_exception_terminate [system] { header "__exception/terminate.h" } -module std_private_expected_bad_expected_access [system] { header "__expected/bad_expected_access.h" } -module std_private_expected_expected [system] { header "__expected/expected.h" } -module std_private_expected_unexpect [system] { header "__expected/unexpect.h" } -module std_private_expected_unexpected [system] { header "__expected/unexpected.h" } +module cxx03_std_private_expected_bad_expected_access [system] { header "__expected/bad_expected_access.h" } +module cxx03_std_private_expected_expected [system] { header "__expected/expected.h" } +module cxx03_std_private_expected_unexpect [system] { header "__expected/unexpect.h" } +module cxx03_std_private_expected_unexpected [system] { header "__expected/unexpected.h" } -module std_private_filesystem_copy_options [system] { header "__filesystem/copy_options.h" } -module std_private_filesystem_directory_entry [system] { +module cxx03_std_private_filesystem_copy_options [system] { header "__filesystem/copy_options.h" } +module cxx03_std_private_filesystem_directory_entry [system] { header "__filesystem/directory_entry.h" export * } -module std_private_filesystem_directory_iterator [system] { +module cxx03_std_private_filesystem_directory_iterator [system] { header "__filesystem/directory_iterator.h" export * } -module std_private_filesystem_directory_options [system] { header "__filesystem/directory_options.h" } -module std_private_filesystem_file_status [system] { header "__filesystem/file_status.h" } -module std_private_filesystem_file_time_type [system] { header "__filesystem/file_time_type.h" } -module std_private_filesystem_file_type [system] { header "__filesystem/file_type.h" } -module std_private_filesystem_filesystem_error [system] { +module cxx03_std_private_filesystem_directory_options [system] { header "__filesystem/directory_options.h" } +module cxx03_std_private_filesystem_file_status [system] { header "__filesystem/file_status.h" } +module cxx03_std_private_filesystem_file_time_type [system] { header "__filesystem/file_time_type.h" } +module cxx03_std_private_filesystem_file_type [system] { header "__filesystem/file_type.h" } +module cxx03_std_private_filesystem_filesystem_error [system] { header "__filesystem/filesystem_error.h" export * } -module std_private_filesystem_operations [system] { header "__filesystem/operations.h" } -module std_private_filesystem_path [system] { +module cxx03_std_private_filesystem_operations [system] { header "__filesystem/operations.h" } +module cxx03_std_private_filesystem_path [system] { header "__filesystem/path.h" export * } -module std_private_filesystem_path_iterator [system] { header "__filesystem/path_iterator.h" } -module std_private_filesystem_perm_options [system] { header "__filesystem/perm_options.h" } -module std_private_filesystem_perms [system] { header "__filesystem/perms.h" } -module std_private_filesystem_recursive_directory_iterator [system] { +module cxx03_std_private_filesystem_path_iterator [system] { header "__filesystem/path_iterator.h" } +module cxx03_std_private_filesystem_perm_options [system] { header "__filesystem/perm_options.h" } +module cxx03_std_private_filesystem_perms [system] { header "__filesystem/perms.h" } +module cxx03_std_private_filesystem_recursive_directory_iterator [system] { header "__filesystem/recursive_directory_iterator.h" export * } -module std_private_filesystem_space_info [system] { header "__filesystem/space_info.h" } -module std_private_filesystem_u8path [system] { header "__filesystem/u8path.h" } +module cxx03_std_private_filesystem_space_info [system] { header "__filesystem/space_info.h" } +module cxx03_std_private_filesystem_u8path [system] { header "__filesystem/u8path.h" } -module std_private_format_buffer [system] { header "__format/buffer.h" } -module std_private_format_concepts [system] { header "__format/concepts.h" } -module std_private_format_container_adaptor [system] { header "__format/container_adaptor.h" } -module std_private_format_enable_insertable [system] { header "__format/enable_insertable.h" } -module std_private_format_escaped_output_table [system] { header "__format/escaped_output_table.h" } -module std_private_format_extended_grapheme_cluster_table [system] { header "__format/extended_grapheme_cluster_table.h" } -module std_private_format_format_arg [system] { header "__format/format_arg.h" } -module std_private_format_format_arg_store [system] { header "__format/format_arg_store.h" } -module std_private_format_format_args [system] { header "__format/format_args.h" } -module std_private_format_format_context [system] { +module cxx03_std_private_format_buffer [system] { header "__format/buffer.h" } +module cxx03_std_private_format_concepts [system] { header "__format/concepts.h" } +module cxx03_std_private_format_container_adaptor [system] { header "__format/container_adaptor.h" } +module cxx03_std_private_format_enable_insertable [system] { header "__format/enable_insertable.h" } +module cxx03_std_private_format_escaped_output_table [system] { header "__format/escaped_output_table.h" } +module cxx03_std_private_format_extended_grapheme_cluster_table [system] { header "__format/extended_grapheme_cluster_table.h" } +module cxx03_std_private_format_format_arg [system] { header "__format/format_arg.h" } +module cxx03_std_private_format_format_arg_store [system] { header "__format/format_arg_store.h" } +module cxx03_std_private_format_format_args [system] { header "__format/format_args.h" } +module cxx03_std_private_format_format_context [system] { header "__format/format_context.h" export * } -module std_private_format_format_error [system] { header "__format/format_error.h" } -module std_private_format_format_functions [system] { +module cxx03_std_private_format_format_error [system] { header "__format/format_error.h" } +module cxx03_std_private_format_format_functions [system] { header "__format/format_functions.h" export std_string } -module std_private_format_fwd [system] { header "__fwd/format.h" } -module std_private_format_format_parse_context [system] { header "__format/format_parse_context.h" } -module std_private_format_format_string [system] { header "__format/format_string.h" } -module std_private_format_format_to_n_result [system] { +module cxx03_std_private_format_fwd [system] { header "__fwd/format.h" } +module cxx03_std_private_format_format_parse_context [system] { header "__format/format_parse_context.h" } +module cxx03_std_private_format_format_string [system] { header "__format/format_string.h" } +module cxx03_std_private_format_format_to_n_result [system] { header "__format/format_to_n_result.h" export std_private_iterator_incrementable_traits } -module std_private_format_formatter [system] { header "__format/formatter.h" } -module std_private_format_formatter_bool [system] { header "__format/formatter_bool.h" } -module std_private_format_formatter_char [system] { header "__format/formatter_char.h" } -module std_private_format_formatter_floating_point [system] { header "__format/formatter_floating_point.h" } -module std_private_format_formatter_integer [system] { header "__format/formatter_integer.h" } -module std_private_format_formatter_integral [system] { header "__format/formatter_integral.h" } -module std_private_format_formatter_output [system] { header "__format/formatter_output.h" } -module std_private_format_formatter_pointer [system] { header "__format/formatter_pointer.h" } -module std_private_format_formatter_string [system] { header "__format/formatter_string.h" } -module std_private_format_formatter_tuple [system] { header "__format/formatter_tuple.h" } -module std_private_format_indic_conjunct_break_table [system] { header "__format/indic_conjunct_break_table.h" } -module std_private_format_parser_std_format_spec [system] { header "__format/parser_std_format_spec.h" } -module std_private_format_range_default_formatter [system] { header "__format/range_default_formatter.h" } -module std_private_format_range_formatter [system] { header "__format/range_formatter.h" } -module std_private_format_unicode [system] { +module cxx03_std_private_format_formatter [system] { header "__format/formatter.h" } +module cxx03_std_private_format_formatter_bool [system] { header "__format/formatter_bool.h" } +module cxx03_std_private_format_formatter_char [system] { header "__format/formatter_char.h" } +module cxx03_std_private_format_formatter_floating_point [system] { header "__format/formatter_floating_point.h" } +module cxx03_std_private_format_formatter_integer [system] { header "__format/formatter_integer.h" } +module cxx03_std_private_format_formatter_integral [system] { header "__format/formatter_integral.h" } +module cxx03_std_private_format_formatter_output [system] { header "__format/formatter_output.h" } +module cxx03_std_private_format_formatter_pointer [system] { header "__format/formatter_pointer.h" } +module cxx03_std_private_format_formatter_string [system] { header "__format/formatter_string.h" } +module cxx03_std_private_format_formatter_tuple [system] { header "__format/formatter_tuple.h" } +module cxx03_std_private_format_indic_conjunct_break_table [system] { header "__format/indic_conjunct_break_table.h" } +module cxx03_std_private_format_parser_std_format_spec [system] { header "__format/parser_std_format_spec.h" } +module cxx03_std_private_format_range_default_formatter [system] { header "__format/range_default_formatter.h" } +module cxx03_std_private_format_range_formatter [system] { header "__format/range_formatter.h" } +module cxx03_std_private_format_unicode [system] { header "__format/unicode.h" export std_private_format_extended_grapheme_cluster_table export std_private_format_indic_conjunct_break_table } -module std_private_format_width_estimation_table [system] { header "__format/width_estimation_table.h" } -module std_private_format_write_escaped [system] { header "__format/write_escaped.h" } +module cxx03_std_private_format_width_estimation_table [system] { header "__format/width_estimation_table.h" } +module cxx03_std_private_format_write_escaped [system] { header "__format/write_escaped.h" } -module std_private_functional_binary_function [system] { header "__functional/binary_function.h" } -module std_private_functional_binary_negate [system] { header "__functional/binary_negate.h" } -module std_private_functional_bind [system] { header "__functional/bind.h" } -module std_private_functional_bind_back [system] { header "__functional/bind_back.h" } -module std_private_functional_bind_front [system] { header "__functional/bind_front.h" } -module std_private_functional_binder1st [system] { header "__functional/binder1st.h" } -module std_private_functional_binder2nd [system] { header "__functional/binder2nd.h" } -module std_private_functional_boyer_moore_searcher [system] { +module cxx03_std_private_functional_binary_function [system] { header "__functional/binary_function.h" } +module cxx03_std_private_functional_binary_negate [system] { header "__functional/binary_negate.h" } +module cxx03_std_private_functional_bind [system] { header "__functional/bind.h" } +module cxx03_std_private_functional_bind_back [system] { header "__functional/bind_back.h" } +module cxx03_std_private_functional_bind_front [system] { header "__functional/bind_front.h" } +module cxx03_std_private_functional_binder1st [system] { header "__functional/binder1st.h" } +module cxx03_std_private_functional_binder2nd [system] { header "__functional/binder2nd.h" } +module cxx03_std_private_functional_boyer_moore_searcher [system] { header "__functional/boyer_moore_searcher.h" export std_private_memory_shared_ptr } -module std_private_functional_compose [system] { +module cxx03_std_private_functional_compose [system] { header "__functional/compose.h" export std_private_functional_perfect_forward } -module std_private_functional_default_searcher [system] { header "__functional/default_searcher.h" } -module std_private_functional_function [system] { header "__functional/function.h" } -module std_private_functional_hash [system] { +module cxx03_std_private_functional_default_searcher [system] { header "__functional/default_searcher.h" } +module cxx03_std_private_functional_function [system] { header "__functional/function.h" } +module cxx03_std_private_functional_hash [system] { header "__functional/hash.h" export std_cstdint export std_private_type_traits_underlying_type export std_private_utility_pair } -module std_private_functional_fwd [system] { header "__fwd/functional.h" } -module std_private_functional_identity [system] { header "__functional/identity.h" } -module std_private_functional_invoke [system] { +module cxx03_std_private_functional_fwd [system] { header "__fwd/functional.h" } +module cxx03_std_private_functional_identity [system] { header "__functional/identity.h" } +module cxx03_std_private_functional_invoke [system] { header "__functional/invoke.h" export * } -module std_private_functional_is_transparent [system] { header "__functional/is_transparent.h" } -module std_private_functional_mem_fn [system] { header "__functional/mem_fn.h" } -module std_private_functional_mem_fun_ref [system] { header "__functional/mem_fun_ref.h" } -module std_private_functional_not_fn [system] { +module cxx03_std_private_functional_is_transparent [system] { header "__functional/is_transparent.h" } +module cxx03_std_private_functional_mem_fn [system] { header "__functional/mem_fn.h" } +module cxx03_std_private_functional_mem_fun_ref [system] { header "__functional/mem_fun_ref.h" } +module cxx03_std_private_functional_not_fn [system] { header "__functional/not_fn.h" export std_private_functional_perfect_forward } -module std_private_functional_operations [system] { header "__functional/operations.h" } -module std_private_functional_perfect_forward [system] { +module cxx03_std_private_functional_operations [system] { header "__functional/operations.h" } +module cxx03_std_private_functional_perfect_forward [system] { header "__functional/perfect_forward.h" export * } -module std_private_functional_pointer_to_binary_function [system] { header "__functional/pointer_to_binary_function.h" } -module std_private_functional_pointer_to_unary_function [system] { header "__functional/pointer_to_unary_function.h" } -module std_private_functional_ranges_operations [system] { header "__functional/ranges_operations.h" } -module std_private_functional_reference_wrapper [system] { header "__functional/reference_wrapper.h" } -module std_private_functional_unary_function [system] { header "__functional/unary_function.h" } -module std_private_functional_unary_negate [system] { header "__functional/unary_negate.h" } -module std_private_functional_weak_result_type [system] { header "__functional/weak_result_type.h" } +module cxx03_std_private_functional_pointer_to_binary_function [system] { header "__functional/pointer_to_binary_function.h" } +module cxx03_std_private_functional_pointer_to_unary_function [system] { header "__functional/pointer_to_unary_function.h" } +module cxx03_std_private_functional_ranges_operations [system] { header "__functional/ranges_operations.h" } +module cxx03_std_private_functional_reference_wrapper [system] { header "__functional/reference_wrapper.h" } +module cxx03_std_private_functional_unary_function [system] { header "__functional/unary_function.h" } +module cxx03_std_private_functional_unary_negate [system] { header "__functional/unary_negate.h" } +module cxx03_std_private_functional_weak_result_type [system] { header "__functional/weak_result_type.h" } -module std_private_ios_fpos [system] { header "__ios/fpos.h" } +module cxx03_std_private_ios_fpos [system] { header "__ios/fpos.h" } -module std_private_iosfwd_fstream_fwd [system] { header "__fwd/fstream.h" } -module std_private_iosfwd_ios_fwd [system] { header "__fwd/ios.h" } -module std_private_iosfwd_istream_fwd [system] { header "__fwd/istream.h" } -module std_private_iosfwd_ostream_fwd [system] { header "__fwd/ostream.h" } -module std_private_iosfwd_sstream_fwd [system] { header "__fwd/sstream.h" } -module std_private_iosfwd_streambuf_fwd [system] { header "__fwd/streambuf.h" } +module cxx03_std_private_iosfwd_fstream_fwd [system] { header "__fwd/fstream.h" } +module cxx03_std_private_iosfwd_ios_fwd [system] { header "__fwd/ios.h" } +module cxx03_std_private_iosfwd_istream_fwd [system] { header "__fwd/istream.h" } +module cxx03_std_private_iosfwd_ostream_fwd [system] { header "__fwd/ostream.h" } +module cxx03_std_private_iosfwd_sstream_fwd [system] { header "__fwd/sstream.h" } +module cxx03_std_private_iosfwd_streambuf_fwd [system] { header "__fwd/streambuf.h" } -module std_private_iterator_access [system] { header "__iterator/access.h" } -module std_private_iterator_advance [system] { header "__iterator/advance.h" } -module std_private_iterator_aliasing_iterator [system] { header "__iterator/aliasing_iterator.h" } -module std_private_iterator_back_insert_iterator [system] { header "__iterator/back_insert_iterator.h" } -module std_private_iterator_bounded_iter [system] { header "__iterator/bounded_iter.h" } -module std_private_iterator_common_iterator [system] { header "__iterator/common_iterator.h" } -module std_private_iterator_concepts [system] { +module cxx03_std_private_iterator_access [system] { header "__iterator/access.h" } +module cxx03_std_private_iterator_advance [system] { header "__iterator/advance.h" } +module cxx03_std_private_iterator_aliasing_iterator [system] { header "__iterator/aliasing_iterator.h" } +module cxx03_std_private_iterator_back_insert_iterator [system] { header "__iterator/back_insert_iterator.h" } +module cxx03_std_private_iterator_bounded_iter [system] { header "__iterator/bounded_iter.h" } +module cxx03_std_private_iterator_common_iterator [system] { header "__iterator/common_iterator.h" } +module cxx03_std_private_iterator_concepts [system] { header "__iterator/concepts.h" export std_private_concepts_constructible export std_private_concepts_equality_comparable @@ -1401,509 +1401,509 @@ module std_private_iterator_concepts [system] { export std_private_type_traits_is_reference export std_private_type_traits_remove_cvref } -module std_private_iterator_counted_iterator [system] { header "__iterator/counted_iterator.h" } -module std_private_iterator_cpp17_iterator_concepts [system] { header "__iterator/cpp17_iterator_concepts.h" } -module std_private_iterator_data [system] { header "__iterator/data.h" } -module std_private_iterator_default_sentinel [system] { header "__iterator/default_sentinel.h" } -module std_private_iterator_distance [system] { +module cxx03_std_private_iterator_counted_iterator [system] { header "__iterator/counted_iterator.h" } +module cxx03_std_private_iterator_cpp17_iterator_concepts [system] { header "__iterator/cpp17_iterator_concepts.h" } +module cxx03_std_private_iterator_data [system] { header "__iterator/data.h" } +module cxx03_std_private_iterator_default_sentinel [system] { header "__iterator/default_sentinel.h" } +module cxx03_std_private_iterator_distance [system] { header "__iterator/distance.h" export std_private_ranges_size } -module std_private_iterator_empty [system] { header "__iterator/empty.h" } -module std_private_iterator_erase_if_container [system] { header "__iterator/erase_if_container.h" } -module std_private_iterator_front_insert_iterator [system] { header "__iterator/front_insert_iterator.h" } -module std_private_iterator_incrementable_traits [system] { header "__iterator/incrementable_traits.h" } -module std_private_iterator_indirectly_comparable [system] { header "__iterator/indirectly_comparable.h" } -module std_private_iterator_insert_iterator [system] { header "__iterator/insert_iterator.h" } -module std_private_iterator_istream_iterator [system] { header "__iterator/istream_iterator.h" } -module std_private_iterator_istreambuf_iterator [system] { header "__iterator/istreambuf_iterator.h" } -module std_private_iterator_iter_move [system] { header "__iterator/iter_move.h" } -module std_private_iterator_iter_swap [system] { header "__iterator/iter_swap.h" } -module std_private_iterator_iterator [system] { header "__iterator/iterator.h" } -module std_private_iterator_iterator_traits [system] { +module cxx03_std_private_iterator_empty [system] { header "__iterator/empty.h" } +module cxx03_std_private_iterator_erase_if_container [system] { header "__iterator/erase_if_container.h" } +module cxx03_std_private_iterator_front_insert_iterator [system] { header "__iterator/front_insert_iterator.h" } +module cxx03_std_private_iterator_incrementable_traits [system] { header "__iterator/incrementable_traits.h" } +module cxx03_std_private_iterator_indirectly_comparable [system] { header "__iterator/indirectly_comparable.h" } +module cxx03_std_private_iterator_insert_iterator [system] { header "__iterator/insert_iterator.h" } +module cxx03_std_private_iterator_istream_iterator [system] { header "__iterator/istream_iterator.h" } +module cxx03_std_private_iterator_istreambuf_iterator [system] { header "__iterator/istreambuf_iterator.h" } +module cxx03_std_private_iterator_iter_move [system] { header "__iterator/iter_move.h" } +module cxx03_std_private_iterator_iter_swap [system] { header "__iterator/iter_swap.h" } +module cxx03_std_private_iterator_iterator [system] { header "__iterator/iterator.h" } +module cxx03_std_private_iterator_iterator_traits [system] { header "__iterator/iterator_traits.h" export std_private_type_traits_is_primary_template } -module std_private_iterator_iterator_with_data [system] { header "__iterator/iterator_with_data.h" } -module std_private_iterator_mergeable [system] { +module cxx03_std_private_iterator_iterator_with_data [system] { header "__iterator/iterator_with_data.h" } +module cxx03_std_private_iterator_mergeable [system] { header "__iterator/mergeable.h" export std_private_functional_ranges_operations } -module std_private_iterator_move_iterator [system] { header "__iterator/move_iterator.h" } -module std_private_iterator_move_sentinel [system] { header "__iterator/move_sentinel.h" } -module std_private_iterator_next [system] { header "__iterator/next.h" } -module std_private_iterator_ostream_iterator [system] { header "__iterator/ostream_iterator.h" } -module std_private_iterator_ostreambuf_iterator [system] { +module cxx03_std_private_iterator_move_iterator [system] { header "__iterator/move_iterator.h" } +module cxx03_std_private_iterator_move_sentinel [system] { header "__iterator/move_sentinel.h" } +module cxx03_std_private_iterator_next [system] { header "__iterator/next.h" } +module cxx03_std_private_iterator_ostream_iterator [system] { header "__iterator/ostream_iterator.h" } +module cxx03_std_private_iterator_ostreambuf_iterator [system] { header "__iterator/ostreambuf_iterator.h" export * } -module std_private_iterator_permutable [system] { header "__iterator/permutable.h" } -module std_private_iterator_prev [system] { header "__iterator/prev.h" } -module std_private_iterator_projected [system] { header "__iterator/projected.h" } -module std_private_iterator_ranges_iterator_traits [system] { header "__iterator/ranges_iterator_traits.h" } -module std_private_iterator_readable_traits [system] { header "__iterator/readable_traits.h" } -module std_private_iterator_reverse_access [system] { header "__iterator/reverse_access.h" } -module std_private_iterator_reverse_iterator [system] { header "__iterator/reverse_iterator.h" } -module std_private_iterator_segmented_iterator [system] { header "__iterator/segmented_iterator.h" } -module std_private_iterator_size [system] { header "__iterator/size.h" } -module std_private_iterator_sortable [system] { +module cxx03_std_private_iterator_permutable [system] { header "__iterator/permutable.h" } +module cxx03_std_private_iterator_prev [system] { header "__iterator/prev.h" } +module cxx03_std_private_iterator_projected [system] { header "__iterator/projected.h" } +module cxx03_std_private_iterator_ranges_iterator_traits [system] { header "__iterator/ranges_iterator_traits.h" } +module cxx03_std_private_iterator_readable_traits [system] { header "__iterator/readable_traits.h" } +module cxx03_std_private_iterator_reverse_access [system] { header "__iterator/reverse_access.h" } +module cxx03_std_private_iterator_reverse_iterator [system] { header "__iterator/reverse_iterator.h" } +module cxx03_std_private_iterator_segmented_iterator [system] { header "__iterator/segmented_iterator.h" } +module cxx03_std_private_iterator_size [system] { header "__iterator/size.h" } +module cxx03_std_private_iterator_sortable [system] { header "__iterator/sortable.h" export std_private_functional_ranges_operations } -module std_private_iterator_unreachable_sentinel [system] { header "__iterator/unreachable_sentinel.h" } -module std_private_iterator_wrap_iter [system] { header "__iterator/wrap_iter.h" } +module cxx03_std_private_iterator_unreachable_sentinel [system] { header "__iterator/unreachable_sentinel.h" } +module cxx03_std_private_iterator_wrap_iter [system] { header "__iterator/wrap_iter.h" } -module std_private_locale_locale_base_api_android [system] { textual header "__locale_dir/locale_base_api/android.h" } -module std_private_locale_locale_base_api_bsd_locale_defaults [system] { textual header "__locale_dir/locale_base_api/bsd_locale_defaults.h" } -module std_private_locale_locale_base_api_bsd_locale_fallbacks [system] { textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h" } -module std_private_locale_locale_base_api_fuchsia [system] { textual header "__locale_dir/locale_base_api/fuchsia.h" } -module std_private_locale_locale_base_api_ibm [system] { textual header "__locale_dir/locale_base_api/ibm.h" } -module std_private_locale_locale_base_api_locale_guard [system] { header "__locale_dir/locale_base_api/locale_guard.h" } -module std_private_locale_locale_base_api_musl [system] { textual header "__locale_dir/locale_base_api/musl.h" } -module std_private_locale_locale_base_api_newlib [system] { textual header "__locale_dir/locale_base_api/newlib.h" } -module std_private_locale_locale_base_api_openbsd [system] { textual header "__locale_dir/locale_base_api/openbsd.h" } -module std_private_locale_locale_base_api_win32 [system] { textual header "__locale_dir/locale_base_api/win32.h" } -module std_private_locale_locale_base_api [system] { +module cxx03_std_private_locale_locale_base_api_android [system] { textual header "__locale_dir/locale_base_api/android.h" } +module cxx03_std_private_locale_locale_base_api_bsd_locale_defaults [system] { textual header "__locale_dir/locale_base_api/bsd_locale_defaults.h" } +module cxx03_std_private_locale_locale_base_api_bsd_locale_fallbacks [system] { textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h" } +module cxx03_std_private_locale_locale_base_api_fuchsia [system] { textual header "__locale_dir/locale_base_api/fuchsia.h" } +module cxx03_std_private_locale_locale_base_api_ibm [system] { textual header "__locale_dir/locale_base_api/ibm.h" } +module cxx03_std_private_locale_locale_base_api_locale_guard [system] { header "__locale_dir/locale_base_api/locale_guard.h" } +module cxx03_std_private_locale_locale_base_api_musl [system] { textual header "__locale_dir/locale_base_api/musl.h" } +module cxx03_std_private_locale_locale_base_api_newlib [system] { textual header "__locale_dir/locale_base_api/newlib.h" } +module cxx03_std_private_locale_locale_base_api_openbsd [system] { textual header "__locale_dir/locale_base_api/openbsd.h" } +module cxx03_std_private_locale_locale_base_api_win32 [system] { textual header "__locale_dir/locale_base_api/win32.h" } +module cxx03_std_private_locale_locale_base_api [system] { header "__locale_dir/locale_base_api.h" export * } -module std_private_math_abs [system] { header "__math/abs.h" } -module std_private_math_copysign [system] { header "__math/copysign.h" } -module std_private_math_error_functions [system] { header "__math/error_functions.h" } -module std_private_math_exponential_functions [system] { header "__math/exponential_functions.h" } -module std_private_math_fdim [system] { header "__math/fdim.h" } -module std_private_math_fma [system] { header "__math/fma.h" } -module std_private_math_gamma [system] { header "__math/gamma.h" } -module std_private_math_hyperbolic_functions [system] { header "__math/hyperbolic_functions.h" } -module std_private_math_hypot [system] { header "__math/hypot.h" } -module std_private_math_inverse_hyperbolic_functions [system] { header "__math/inverse_hyperbolic_functions.h" } -module std_private_math_inverse_trigonometric_functions [system] { header "__math/inverse_trigonometric_functions.h" } -module std_private_math_logarithms [system] { header "__math/logarithms.h" } -module std_private_math_min_max [system] { header "__math/min_max.h" } -module std_private_math_modulo [system] { header "__math/modulo.h" } -module std_private_math_remainder [system] { header "__math/remainder.h" } -module std_private_math_roots [system] { header "__math/roots.h" } -module std_private_math_rounding_functions [system] { header "__math/rounding_functions.h" } -module std_private_math_special_functions [system] { header "__math/special_functions.h" } -module std_private_math_traits [system] { header "__math/traits.h" } -module std_private_math_trigonometric_functions [system] { header "__math/trigonometric_functions.h" } +module cxx03_std_private_math_abs [system] { header "__math/abs.h" } +module cxx03_std_private_math_copysign [system] { header "__math/copysign.h" } +module cxx03_std_private_math_error_functions [system] { header "__math/error_functions.h" } +module cxx03_std_private_math_exponential_functions [system] { header "__math/exponential_functions.h" } +module cxx03_std_private_math_fdim [system] { header "__math/fdim.h" } +module cxx03_std_private_math_fma [system] { header "__math/fma.h" } +module cxx03_std_private_math_gamma [system] { header "__math/gamma.h" } +module cxx03_std_private_math_hyperbolic_functions [system] { header "__math/hyperbolic_functions.h" } +module cxx03_std_private_math_hypot [system] { header "__math/hypot.h" } +module cxx03_std_private_math_inverse_hyperbolic_functions [system] { header "__math/inverse_hyperbolic_functions.h" } +module cxx03_std_private_math_inverse_trigonometric_functions [system] { header "__math/inverse_trigonometric_functions.h" } +module cxx03_std_private_math_logarithms [system] { header "__math/logarithms.h" } +module cxx03_std_private_math_min_max [system] { header "__math/min_max.h" } +module cxx03_std_private_math_modulo [system] { header "__math/modulo.h" } +module cxx03_std_private_math_remainder [system] { header "__math/remainder.h" } +module cxx03_std_private_math_roots [system] { header "__math/roots.h" } +module cxx03_std_private_math_rounding_functions [system] { header "__math/rounding_functions.h" } +module cxx03_std_private_math_special_functions [system] { header "__math/special_functions.h" } +module cxx03_std_private_math_traits [system] { header "__math/traits.h" } +module cxx03_std_private_math_trigonometric_functions [system] { header "__math/trigonometric_functions.h" } -module std_private_mdspan_default_accessor [system] { header "__mdspan/default_accessor.h" } -module std_private_mdspan_extents [system] { +module cxx03_std_private_mdspan_default_accessor [system] { header "__mdspan/default_accessor.h" } +module cxx03_std_private_mdspan_extents [system] { header "__mdspan/extents.h" export * } -module std_private_mdspan_layout_left [system] { header "__mdspan/layout_left.h" } -module std_private_mdspan_layout_right [system] { header "__mdspan/layout_right.h" } -module std_private_mdspan_layout_stride [system] { header "__mdspan/layout_stride.h" } -module std_private_mdspan_mdspan [system] { header "__mdspan/mdspan.h" } -module std_private_mdspan_mdspan_fwd [system] { header "__fwd/mdspan.h" } +module cxx03_std_private_mdspan_layout_left [system] { header "__mdspan/layout_left.h" } +module cxx03_std_private_mdspan_layout_right [system] { header "__mdspan/layout_right.h" } +module cxx03_std_private_mdspan_layout_stride [system] { header "__mdspan/layout_stride.h" } +module cxx03_std_private_mdspan_mdspan [system] { header "__mdspan/mdspan.h" } +module cxx03_std_private_mdspan_mdspan_fwd [system] { header "__fwd/mdspan.h" } -module std_private_memory_addressof [system] { header "__memory/addressof.h" } -module std_private_memory_align [system] { header "__memory/align.h" } -module std_private_memory_aligned_alloc [system] { header "__memory/aligned_alloc.h" } -module std_private_memory_allocate_at_least [system] { header "__memory/allocate_at_least.h" } -module std_private_memory_allocation_guard [system] { header "__memory/allocation_guard.h" } -module std_private_memory_allocator [system] { header "__memory/allocator.h" } -module std_private_memory_allocator_arg_t [system] { header "__memory/allocator_arg_t.h" } -module std_private_memory_allocator_destructor [system] { header "__memory/allocator_destructor.h" } -module std_private_memory_allocator_traits [system] { header "__memory/allocator_traits.h" } -module std_private_memory_assume_aligned [system] { header "__memory/assume_aligned.h" } -module std_private_memory_auto_ptr [system] { header "__memory/auto_ptr.h" } -module std_private_memory_builtin_new_allocator [system] { +module cxx03_std_private_memory_addressof [system] { header "__memory/addressof.h" } +module cxx03_std_private_memory_align [system] { header "__memory/align.h" } +module cxx03_std_private_memory_aligned_alloc [system] { header "__memory/aligned_alloc.h" } +module cxx03_std_private_memory_allocate_at_least [system] { header "__memory/allocate_at_least.h" } +module cxx03_std_private_memory_allocation_guard [system] { header "__memory/allocation_guard.h" } +module cxx03_std_private_memory_allocator [system] { header "__memory/allocator.h" } +module cxx03_std_private_memory_allocator_arg_t [system] { header "__memory/allocator_arg_t.h" } +module cxx03_std_private_memory_allocator_destructor [system] { header "__memory/allocator_destructor.h" } +module cxx03_std_private_memory_allocator_traits [system] { header "__memory/allocator_traits.h" } +module cxx03_std_private_memory_assume_aligned [system] { header "__memory/assume_aligned.h" } +module cxx03_std_private_memory_auto_ptr [system] { header "__memory/auto_ptr.h" } +module cxx03_std_private_memory_builtin_new_allocator [system] { header "__memory/builtin_new_allocator.h" export * } -module std_private_memory_compressed_pair [system] { header "__memory/compressed_pair.h" } -module std_private_memory_concepts [system] { +module cxx03_std_private_memory_compressed_pair [system] { header "__memory/compressed_pair.h" } +module cxx03_std_private_memory_concepts [system] { header "__memory/concepts.h" export std_private_type_traits_remove_reference } -module std_private_memory_construct_at [system] { header "__memory/construct_at.h" } -module std_private_memory_destruct_n [system] { header "__memory/destruct_n.h" } -module std_private_memory_fwd [system] { header "__fwd/memory.h" } -module std_private_memory_inout_ptr [system] { header "__memory/inout_ptr.h" } -module std_private_memory_out_ptr [system] { header "__memory/out_ptr.h" } -module std_private_memory_pointer_traits [system] { header "__memory/pointer_traits.h" } -module std_private_memory_ranges_construct_at [system] { header "__memory/ranges_construct_at.h" } -module std_private_memory_ranges_uninitialized_algorithms [system] { +module cxx03_std_private_memory_construct_at [system] { header "__memory/construct_at.h" } +module cxx03_std_private_memory_destruct_n [system] { header "__memory/destruct_n.h" } +module cxx03_std_private_memory_fwd [system] { header "__fwd/memory.h" } +module cxx03_std_private_memory_inout_ptr [system] { header "__memory/inout_ptr.h" } +module cxx03_std_private_memory_out_ptr [system] { header "__memory/out_ptr.h" } +module cxx03_std_private_memory_pointer_traits [system] { header "__memory/pointer_traits.h" } +module cxx03_std_private_memory_ranges_construct_at [system] { header "__memory/ranges_construct_at.h" } +module cxx03_std_private_memory_ranges_uninitialized_algorithms [system] { header "__memory/ranges_uninitialized_algorithms.h" export std_private_algorithm_in_out_result } -module std_private_memory_raw_storage_iterator [system] { header "__memory/raw_storage_iterator.h" } -module std_private_memory_shared_ptr [system] { +module cxx03_std_private_memory_raw_storage_iterator [system] { header "__memory/raw_storage_iterator.h" } +module cxx03_std_private_memory_shared_ptr [system] { header "__memory/shared_ptr.h" export std_private_memory_uninitialized_algorithms } -module std_private_memory_swap_allocator [system] { header "__memory/swap_allocator.h" } -module std_private_memory_temp_value [system] { header "__memory/temp_value.h" } -module std_private_memory_temporary_buffer [system] { +module cxx03_std_private_memory_swap_allocator [system] { header "__memory/swap_allocator.h" } +module cxx03_std_private_memory_temp_value [system] { header "__memory/temp_value.h" } +module cxx03_std_private_memory_temporary_buffer [system] { header "__memory/temporary_buffer.h" export std_private_utility_pair } -module std_private_memory_uninitialized_algorithms [system] { +module cxx03_std_private_memory_uninitialized_algorithms [system] { header "__memory/uninitialized_algorithms.h" export std_private_algorithm_copy } -module std_private_memory_unique_ptr [system] { +module cxx03_std_private_memory_unique_ptr [system] { header "__memory/unique_ptr.h" export std_private_type_traits_add_lvalue_reference export std_private_type_traits_is_pointer export std_private_type_traits_type_identity } -module std_private_memory_uses_allocator [system] { header "__memory/uses_allocator.h" } -module std_private_memory_uses_allocator_construction [system] { header "__memory/uses_allocator_construction.h" } -module std_private_memory_voidify [system] { header "__memory/voidify.h" } +module cxx03_std_private_memory_uses_allocator [system] { header "__memory/uses_allocator.h" } +module cxx03_std_private_memory_uses_allocator_construction [system] { header "__memory/uses_allocator_construction.h" } +module cxx03_std_private_memory_voidify [system] { header "__memory/voidify.h" } -module std_private_memory_resource_memory_resource [system] { header "__memory_resource/memory_resource.h" } -module std_private_memory_resource_memory_resource_fwd [system] { header "__fwd/memory_resource.h" } -module std_private_memory_resource_monotonic_buffer_resource [system] { header "__memory_resource/monotonic_buffer_resource.h" } -module std_private_memory_resource_polymorphic_allocator [system] { header "__memory_resource/polymorphic_allocator.h" } -module std_private_memory_resource_pool_options [system] { header "__memory_resource/pool_options.h" } -module std_private_memory_resource_synchronized_pool_resource [system] { +module cxx03_std_private_memory_resource_memory_resource [system] { header "__memory_resource/memory_resource.h" } +module cxx03_std_private_memory_resource_memory_resource_fwd [system] { header "__fwd/memory_resource.h" } +module cxx03_std_private_memory_resource_monotonic_buffer_resource [system] { header "__memory_resource/monotonic_buffer_resource.h" } +module cxx03_std_private_memory_resource_polymorphic_allocator [system] { header "__memory_resource/polymorphic_allocator.h" } +module cxx03_std_private_memory_resource_pool_options [system] { header "__memory_resource/pool_options.h" } +module cxx03_std_private_memory_resource_synchronized_pool_resource [system] { header "__memory_resource/synchronized_pool_resource.h" export * } -module std_private_memory_resource_unsynchronized_pool_resource [system] { header "__memory_resource/unsynchronized_pool_resource.h" } +module cxx03_std_private_memory_resource_unsynchronized_pool_resource [system] { header "__memory_resource/unsynchronized_pool_resource.h" } -module std_private_mutex_lock_guard [system] { header "__mutex/lock_guard.h" } -module std_private_mutex_mutex [system] { header "__mutex/mutex.h" } -module std_private_mutex_once_flag [system] { header "__mutex/once_flag.h" } -module std_private_mutex_tag_types [system] { header "__mutex/tag_types.h" } -module std_private_mutex_unique_lock [system] { header "__mutex/unique_lock.h" } +module cxx03_std_private_mutex_lock_guard [system] { header "__mutex/lock_guard.h" } +module cxx03_std_private_mutex_mutex [system] { header "__mutex/mutex.h" } +module cxx03_std_private_mutex_once_flag [system] { header "__mutex/once_flag.h" } +module cxx03_std_private_mutex_tag_types [system] { header "__mutex/tag_types.h" } +module cxx03_std_private_mutex_unique_lock [system] { header "__mutex/unique_lock.h" } -module std_private_numeric_accumulate [system] { header "__numeric/accumulate.h" } -module std_private_numeric_adjacent_difference [system] { header "__numeric/adjacent_difference.h" } -module std_private_numeric_exclusive_scan [system] { header "__numeric/exclusive_scan.h" } -module std_private_numeric_gcd_lcm [system] { header "__numeric/gcd_lcm.h" } -module std_private_numeric_inclusive_scan [system] { header "__numeric/inclusive_scan.h" } -module std_private_numeric_inner_product [system] { header "__numeric/inner_product.h" } -module std_private_numeric_iota [system] { header "__numeric/iota.h" } -module std_private_numeric_midpoint [system] { header "__numeric/midpoint.h" } -module std_private_numeric_partial_sum [system] { header "__numeric/partial_sum.h" } -module std_private_numeric_pstl [system] { +module cxx03_std_private_numeric_accumulate [system] { header "__numeric/accumulate.h" } +module cxx03_std_private_numeric_adjacent_difference [system] { header "__numeric/adjacent_difference.h" } +module cxx03_std_private_numeric_exclusive_scan [system] { header "__numeric/exclusive_scan.h" } +module cxx03_std_private_numeric_gcd_lcm [system] { header "__numeric/gcd_lcm.h" } +module cxx03_std_private_numeric_inclusive_scan [system] { header "__numeric/inclusive_scan.h" } +module cxx03_std_private_numeric_inner_product [system] { header "__numeric/inner_product.h" } +module cxx03_std_private_numeric_iota [system] { header "__numeric/iota.h" } +module cxx03_std_private_numeric_midpoint [system] { header "__numeric/midpoint.h" } +module cxx03_std_private_numeric_partial_sum [system] { header "__numeric/partial_sum.h" } +module cxx03_std_private_numeric_pstl [system] { header "__numeric/pstl.h" export * } -module std_private_numeric_reduce [system] { header "__numeric/reduce.h" } -module std_private_numeric_saturation_arithmetic [system] { header "__numeric/saturation_arithmetic.h" } -module std_private_numeric_transform_exclusive_scan [system] { header "__numeric/transform_exclusive_scan.h" } -module std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" } -module std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" } +module cxx03_std_private_numeric_reduce [system] { header "__numeric/reduce.h" } +module cxx03_std_private_numeric_saturation_arithmetic [system] { header "__numeric/saturation_arithmetic.h" } +module cxx03_std_private_numeric_transform_exclusive_scan [system] { header "__numeric/transform_exclusive_scan.h" } +module cxx03_std_private_numeric_transform_inclusive_scan [system] { header "__numeric/transform_inclusive_scan.h" } +module cxx03_std_private_numeric_transform_reduce [system] { header "__numeric/transform_reduce.h" } -module std_private_pstl_backend [system] { +module cxx03_std_private_pstl_backend [system] { header "__pstl/backend.h" export * } -module std_private_pstl_backend_fwd [system] { +module cxx03_std_private_pstl_backend_fwd [system] { header "__pstl/backend_fwd.h" export * } -module std_private_pstl_backends_default [system] { +module cxx03_std_private_pstl_backends_default [system] { header "__pstl/backends/default.h" export * } -module std_private_pstl_backends_libdispatch [system] { +module cxx03_std_private_pstl_backends_libdispatch [system] { header "__pstl/backends/libdispatch.h" export * } -module std_private_pstl_backends_serial [system] { +module cxx03_std_private_pstl_backends_serial [system] { header "__pstl/backends/serial.h" export * } -module std_private_pstl_backends_std_thread [system] { +module cxx03_std_private_pstl_backends_std_thread [system] { header "__pstl/backends/std_thread.h" export * } -module std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" } -module std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" } -module std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" } -module std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" } -module std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" } -module std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" } -module std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" } -module std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" } -module std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" } -module std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" } -module std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" } +module cxx03_std_private_pstl_cpu_algos_any_of [system] { header "__pstl/cpu_algos/any_of.h" } +module cxx03_std_private_pstl_cpu_algos_cpu_traits [system] { header "__pstl/cpu_algos/cpu_traits.h" } +module cxx03_std_private_pstl_cpu_algos_fill [system] { header "__pstl/cpu_algos/fill.h" } +module cxx03_std_private_pstl_cpu_algos_find_if [system] { header "__pstl/cpu_algos/find_if.h" } +module cxx03_std_private_pstl_cpu_algos_for_each [system] { header "__pstl/cpu_algos/for_each.h" } +module cxx03_std_private_pstl_cpu_algos_merge [system] { header "__pstl/cpu_algos/merge.h" } +module cxx03_std_private_pstl_cpu_algos_stable_sort [system] { header "__pstl/cpu_algos/stable_sort.h" } +module cxx03_std_private_pstl_cpu_algos_transform [system] { header "__pstl/cpu_algos/transform.h" } +module cxx03_std_private_pstl_cpu_algos_transform_reduce [system] { header "__pstl/cpu_algos/transform_reduce.h" } +module cxx03_std_private_pstl_dispatch [system] { header "__pstl/dispatch.h" } +module cxx03_std_private_pstl_handle_exception [system] { header "__pstl/handle_exception.h" } -module std_private_queue_fwd [system] { header "__fwd/queue.h" } +module cxx03_std_private_queue_fwd [system] { header "__fwd/queue.h" } -module std_private_ostream_basic_ostream [system] { +module cxx03_std_private_ostream_basic_ostream [system] { header "__ostream/basic_ostream.h" export std_streambuf } -module std_private_ostream_print [system] { +module cxx03_std_private_ostream_print [system] { header "__ostream/print.h" export std_print } -module std_private_random_bernoulli_distribution [system] { header "__random/bernoulli_distribution.h" } -module std_private_random_binomial_distribution [system] { header "__random/binomial_distribution.h" } -module std_private_random_cauchy_distribution [system] { header "__random/cauchy_distribution.h" } -module std_private_random_chi_squared_distribution [system] { header "__random/chi_squared_distribution.h" } -module std_private_random_clamp_to_integral [system] { header "__random/clamp_to_integral.h" } -module std_private_random_default_random_engine [system] { header "__random/default_random_engine.h" } -module std_private_random_discard_block_engine [system] { header "__random/discard_block_engine.h" } -module std_private_random_discrete_distribution [system] { +module cxx03_std_private_random_bernoulli_distribution [system] { header "__random/bernoulli_distribution.h" } +module cxx03_std_private_random_binomial_distribution [system] { header "__random/binomial_distribution.h" } +module cxx03_std_private_random_cauchy_distribution [system] { header "__random/cauchy_distribution.h" } +module cxx03_std_private_random_chi_squared_distribution [system] { header "__random/chi_squared_distribution.h" } +module cxx03_std_private_random_clamp_to_integral [system] { header "__random/clamp_to_integral.h" } +module cxx03_std_private_random_default_random_engine [system] { header "__random/default_random_engine.h" } +module cxx03_std_private_random_discard_block_engine [system] { header "__random/discard_block_engine.h" } +module cxx03_std_private_random_discrete_distribution [system] { header "__random/discrete_distribution.h" export * } -module std_private_random_exponential_distribution [system] { header "__random/exponential_distribution.h" } -module std_private_random_extreme_value_distribution [system] { header "__random/extreme_value_distribution.h" } -module std_private_random_fisher_f_distribution [system] { header "__random/fisher_f_distribution.h" } -module std_private_random_gamma_distribution [system] { header "__random/gamma_distribution.h" } -module std_private_random_generate_canonical [system] { header "__random/generate_canonical.h" } -module std_private_random_geometric_distribution [system] { header "__random/geometric_distribution.h" } -module std_private_random_independent_bits_engine [system] { header "__random/independent_bits_engine.h" } -module std_private_random_is_seed_sequence [system] { header "__random/is_seed_sequence.h" } -module std_private_random_is_valid [system] { header "__random/is_valid.h" } -module std_private_random_knuth_b [system] { header "__random/knuth_b.h" } -module std_private_random_linear_congruential_engine [system] { header "__random/linear_congruential_engine.h" } -module std_private_random_log2 [system] { header "__random/log2.h" } -module std_private_random_lognormal_distribution [system] { header "__random/lognormal_distribution.h" } -module std_private_random_mersenne_twister_engine [system] { header "__random/mersenne_twister_engine.h" } -module std_private_random_negative_binomial_distribution [system] { header "__random/negative_binomial_distribution.h" } -module std_private_random_normal_distribution [system] { header "__random/normal_distribution.h" } -module std_private_random_piecewise_constant_distribution [system] { +module cxx03_std_private_random_exponential_distribution [system] { header "__random/exponential_distribution.h" } +module cxx03_std_private_random_extreme_value_distribution [system] { header "__random/extreme_value_distribution.h" } +module cxx03_std_private_random_fisher_f_distribution [system] { header "__random/fisher_f_distribution.h" } +module cxx03_std_private_random_gamma_distribution [system] { header "__random/gamma_distribution.h" } +module cxx03_std_private_random_generate_canonical [system] { header "__random/generate_canonical.h" } +module cxx03_std_private_random_geometric_distribution [system] { header "__random/geometric_distribution.h" } +module cxx03_std_private_random_independent_bits_engine [system] { header "__random/independent_bits_engine.h" } +module cxx03_std_private_random_is_seed_sequence [system] { header "__random/is_seed_sequence.h" } +module cxx03_std_private_random_is_valid [system] { header "__random/is_valid.h" } +module cxx03_std_private_random_knuth_b [system] { header "__random/knuth_b.h" } +module cxx03_std_private_random_linear_congruential_engine [system] { header "__random/linear_congruential_engine.h" } +module cxx03_std_private_random_log2 [system] { header "__random/log2.h" } +module cxx03_std_private_random_lognormal_distribution [system] { header "__random/lognormal_distribution.h" } +module cxx03_std_private_random_mersenne_twister_engine [system] { header "__random/mersenne_twister_engine.h" } +module cxx03_std_private_random_negative_binomial_distribution [system] { header "__random/negative_binomial_distribution.h" } +module cxx03_std_private_random_normal_distribution [system] { header "__random/normal_distribution.h" } +module cxx03_std_private_random_piecewise_constant_distribution [system] { header "__random/piecewise_constant_distribution.h" export * } -module std_private_random_piecewise_linear_distribution [system] { +module cxx03_std_private_random_piecewise_linear_distribution [system] { header "__random/piecewise_linear_distribution.h" export * } -module std_private_random_poisson_distribution [system] { header "__random/poisson_distribution.h" } -module std_private_random_random_device [system] { +module cxx03_std_private_random_poisson_distribution [system] { header "__random/poisson_distribution.h" } +module cxx03_std_private_random_random_device [system] { header "__random/random_device.h" export * } -module std_private_random_ranlux [system] { header "__random/ranlux.h" } -module std_private_random_seed_seq [system] { +module cxx03_std_private_random_ranlux [system] { header "__random/ranlux.h" } +module cxx03_std_private_random_seed_seq [system] { header "__random/seed_seq.h" export * } -module std_private_random_shuffle_order_engine [system] { header "__random/shuffle_order_engine.h" } -module std_private_random_student_t_distribution [system] { header "__random/student_t_distribution.h" } -module std_private_random_subtract_with_carry_engine [system] { header "__random/subtract_with_carry_engine.h" } -module std_private_random_uniform_int_distribution [system] { header "__random/uniform_int_distribution.h" } -module std_private_random_uniform_random_bit_generator [system] { header "__random/uniform_random_bit_generator.h" } -module std_private_random_uniform_real_distribution [system] { header "__random/uniform_real_distribution.h" } -module std_private_random_weibull_distribution [system] { header "__random/weibull_distribution.h" } +module cxx03_std_private_random_shuffle_order_engine [system] { header "__random/shuffle_order_engine.h" } +module cxx03_std_private_random_student_t_distribution [system] { header "__random/student_t_distribution.h" } +module cxx03_std_private_random_subtract_with_carry_engine [system] { header "__random/subtract_with_carry_engine.h" } +module cxx03_std_private_random_uniform_int_distribution [system] { header "__random/uniform_int_distribution.h" } +module cxx03_std_private_random_uniform_random_bit_generator [system] { header "__random/uniform_random_bit_generator.h" } +module cxx03_std_private_random_uniform_real_distribution [system] { header "__random/uniform_real_distribution.h" } +module cxx03_std_private_random_weibull_distribution [system] { header "__random/weibull_distribution.h" } -module std_private_ranges_access [system] { header "__ranges/access.h" } -module std_private_ranges_all [system] { +module cxx03_std_private_ranges_access [system] { header "__ranges/access.h" } +module cxx03_std_private_ranges_all [system] { header "__ranges/all.h" export std_private_functional_compose export std_private_functional_perfect_forward export std_private_ranges_owning_view } -module std_private_ranges_as_rvalue_view [system] { header "__ranges/as_rvalue_view.h" } -module std_private_ranges_chunk_by_view [system] { header "__ranges/chunk_by_view.h" } -module std_private_ranges_common_view [system] { header "__ranges/common_view.h" } -module std_private_ranges_concepts [system] { +module cxx03_std_private_ranges_as_rvalue_view [system] { header "__ranges/as_rvalue_view.h" } +module cxx03_std_private_ranges_chunk_by_view [system] { header "__ranges/chunk_by_view.h" } +module cxx03_std_private_ranges_common_view [system] { header "__ranges/common_view.h" } +module cxx03_std_private_ranges_concepts [system] { header "__ranges/concepts.h" export std_private_iterator_concepts } -module std_private_ranges_container_compatible_range [system] { header "__ranges/container_compatible_range.h" } -module std_private_ranges_counted [system] { +module cxx03_std_private_ranges_container_compatible_range [system] { header "__ranges/container_compatible_range.h" } +module cxx03_std_private_ranges_counted [system] { header "__ranges/counted.h" export std_span } -module std_private_ranges_dangling [system] { header "__ranges/dangling.h" } -module std_private_ranges_data [system] { header "__ranges/data.h" } -module std_private_ranges_drop_view [system] { header "__ranges/drop_view.h" } -module std_private_ranges_drop_while_view [system] { header "__ranges/drop_while_view.h" } -module std_private_ranges_elements_view [system] { header "__ranges/elements_view.h" } -module std_private_ranges_empty [system] { header "__ranges/empty.h" } -module std_private_ranges_empty_view [system] { header "__ranges/empty_view.h" } -module std_private_ranges_enable_borrowed_range [system] { header "__ranges/enable_borrowed_range.h" } -module std_private_ranges_enable_view [system] { header "__ranges/enable_view.h" } -module std_private_ranges_filter_view [system] { +module cxx03_std_private_ranges_dangling [system] { header "__ranges/dangling.h" } +module cxx03_std_private_ranges_data [system] { header "__ranges/data.h" } +module cxx03_std_private_ranges_drop_view [system] { header "__ranges/drop_view.h" } +module cxx03_std_private_ranges_drop_while_view [system] { header "__ranges/drop_while_view.h" } +module cxx03_std_private_ranges_elements_view [system] { header "__ranges/elements_view.h" } +module cxx03_std_private_ranges_empty [system] { header "__ranges/empty.h" } +module cxx03_std_private_ranges_empty_view [system] { header "__ranges/empty_view.h" } +module cxx03_std_private_ranges_enable_borrowed_range [system] { header "__ranges/enable_borrowed_range.h" } +module cxx03_std_private_ranges_enable_view [system] { header "__ranges/enable_view.h" } +module cxx03_std_private_ranges_filter_view [system] { header "__ranges/filter_view.h" export std_private_ranges_range_adaptor } -module std_private_ranges_from_range [system] { header "__ranges/from_range.h" } -module std_private_ranges_iota_view [system] { header "__ranges/iota_view.h" } -module std_private_ranges_istream_view [system] { +module cxx03_std_private_ranges_from_range [system] { header "__ranges/from_range.h" } +module cxx03_std_private_ranges_iota_view [system] { header "__ranges/iota_view.h" } +module cxx03_std_private_ranges_istream_view [system] { header "__ranges/istream_view.h" } -module std_private_ranges_join_view [system] { +module cxx03_std_private_ranges_join_view [system] { header "__ranges/join_view.h" export std_private_iterator_iterator_with_data export std_private_iterator_segmented_iterator } -module std_private_ranges_lazy_split_view [system] { +module cxx03_std_private_ranges_lazy_split_view [system] { header "__ranges/lazy_split_view.h" export std_private_ranges_non_propagating_cache } -module std_private_ranges_movable_box [system] { header "__ranges/movable_box.h" } -module std_private_ranges_non_propagating_cache [system] { header "__ranges/non_propagating_cache.h" } -module std_private_ranges_owning_view [system] { header "__ranges/owning_view.h" } -module std_private_ranges_range_adaptor [system] { header "__ranges/range_adaptor.h" } -module std_private_ranges_rbegin [system] { header "__ranges/rbegin.h" } -module std_private_ranges_ref_view [system] { header "__ranges/ref_view.h" } -module std_private_ranges_rend [system] { header "__ranges/rend.h" } -module std_private_ranges_repeat_view [system] { header "__ranges/repeat_view.h" } -module std_private_ranges_reverse_view [system] { header "__ranges/reverse_view.h" } -module std_private_ranges_single_view [system] { header "__ranges/single_view.h" } -module std_private_ranges_size [system] { +module cxx03_std_private_ranges_movable_box [system] { header "__ranges/movable_box.h" } +module cxx03_std_private_ranges_non_propagating_cache [system] { header "__ranges/non_propagating_cache.h" } +module cxx03_std_private_ranges_owning_view [system] { header "__ranges/owning_view.h" } +module cxx03_std_private_ranges_range_adaptor [system] { header "__ranges/range_adaptor.h" } +module cxx03_std_private_ranges_rbegin [system] { header "__ranges/rbegin.h" } +module cxx03_std_private_ranges_ref_view [system] { header "__ranges/ref_view.h" } +module cxx03_std_private_ranges_rend [system] { header "__ranges/rend.h" } +module cxx03_std_private_ranges_repeat_view [system] { header "__ranges/repeat_view.h" } +module cxx03_std_private_ranges_reverse_view [system] { header "__ranges/reverse_view.h" } +module cxx03_std_private_ranges_single_view [system] { header "__ranges/single_view.h" } +module cxx03_std_private_ranges_size [system] { header "__ranges/size.h" export std_private_type_traits_make_unsigned } -module std_private_ranges_split_view [system] { header "__ranges/split_view.h" } -module std_private_ranges_subrange [system] { +module cxx03_std_private_ranges_split_view [system] { header "__ranges/split_view.h" } +module cxx03_std_private_ranges_subrange [system] { header "__ranges/subrange.h" export std_private_ranges_subrange_fwd } -module std_private_ranges_subrange_fwd [system] { +module cxx03_std_private_ranges_subrange_fwd [system] { header "__fwd/subrange.h" export std_private_iterator_concepts } -module std_private_ranges_take_view [system] { header "__ranges/take_view.h" } -module std_private_ranges_take_while_view [system] { header "__ranges/take_while_view.h" } -module std_private_ranges_to [system] { header "__ranges/to.h" } -module std_private_ranges_transform_view [system] { +module cxx03_std_private_ranges_take_view [system] { header "__ranges/take_view.h" } +module cxx03_std_private_ranges_take_while_view [system] { header "__ranges/take_while_view.h" } +module cxx03_std_private_ranges_to [system] { header "__ranges/to.h" } +module cxx03_std_private_ranges_transform_view [system] { header "__ranges/transform_view.h" export std_private_functional_bind_back export std_private_functional_perfect_forward export std_private_ranges_movable_box } -module std_private_ranges_view_interface [system] { header "__ranges/view_interface.h" } -module std_private_ranges_views [system] { header "__ranges/views.h" } -module std_private_ranges_zip_view [system] { +module cxx03_std_private_ranges_view_interface [system] { header "__ranges/view_interface.h" } +module cxx03_std_private_ranges_views [system] { header "__ranges/views.h" } +module cxx03_std_private_ranges_zip_view [system] { header "__ranges/zip_view.h" export std_private_utility_pair } -module std_private_span_span_fwd [system] { header "__fwd/span.h" } +module cxx03_std_private_span_span_fwd [system] { header "__fwd/span.h" } -module std_private_stack_fwd [system] { header "__fwd/stack.h" } +module cxx03_std_private_stack_fwd [system] { header "__fwd/stack.h" } -module std_private_stop_token_atomic_unique_lock [system] { header "__stop_token/atomic_unique_lock.h" } -module std_private_stop_token_intrusive_list_view [system] { header "__stop_token/intrusive_list_view.h" } -module std_private_stop_token_intrusive_shared_ptr [system] { header "__stop_token/intrusive_shared_ptr.h" } -module std_private_stop_token_stop_callback [system] { header "__stop_token/stop_callback.h" } -module std_private_stop_token_stop_source [system] { +module cxx03_std_private_stop_token_atomic_unique_lock [system] { header "__stop_token/atomic_unique_lock.h" } +module cxx03_std_private_stop_token_intrusive_list_view [system] { header "__stop_token/intrusive_list_view.h" } +module cxx03_std_private_stop_token_intrusive_shared_ptr [system] { header "__stop_token/intrusive_shared_ptr.h" } +module cxx03_std_private_stop_token_stop_callback [system] { header "__stop_token/stop_callback.h" } +module cxx03_std_private_stop_token_stop_source [system] { header "__stop_token/stop_source.h" export * } -module std_private_stop_token_stop_state [system] { +module cxx03_std_private_stop_token_stop_state [system] { header "__stop_token/stop_state.h" export * } -module std_private_stop_token_stop_token [system] { +module cxx03_std_private_stop_token_stop_token [system] { header "__stop_token/stop_token.h" export * } -module std_private_string_char_traits [system] { +module cxx03_std_private_string_char_traits [system] { header "__string/char_traits.h" export * } -module std_private_string_constexpr_c_functions [system] { +module cxx03_std_private_string_constexpr_c_functions [system] { header "__string/constexpr_c_functions.h" export std_private_type_traits_is_equality_comparable } -module std_private_string_extern_template_lists [system] { header "__string/extern_template_lists.h" } -module std_private_string_string_fwd [system] { header "__fwd/string.h" } +module cxx03_std_private_string_extern_template_lists [system] { header "__string/extern_template_lists.h" } +module cxx03_std_private_string_string_fwd [system] { header "__fwd/string.h" } -module std_private_string_view_string_view_fwd [system] { header "__fwd/string_view.h" } +module cxx03_std_private_string_view_string_view_fwd [system] { header "__fwd/string_view.h" } -module std_private_system_error_errc [system] { header "__system_error/errc.h" } -module std_private_system_error_error_category [system] { header "__system_error/error_category.h" } -module std_private_system_error_error_code [system] { +module cxx03_std_private_system_error_errc [system] { header "__system_error/errc.h" } +module cxx03_std_private_system_error_error_category [system] { header "__system_error/error_category.h" } +module cxx03_std_private_system_error_error_code [system] { header "__system_error/error_code.h" export std_private_functional_hash export std_private_functional_unary_function } -module std_private_system_error_error_condition [system] { +module cxx03_std_private_system_error_error_condition [system] { header "__system_error/error_condition.h" export std_private_functional_hash export std_private_functional_unary_function } -module std_private_system_error_system_error [system] { header "__system_error/system_error.h" } +module cxx03_std_private_system_error_system_error [system] { header "__system_error/system_error.h" } -module std_private_thread_formatter [system] { header "__thread/formatter.h" } -module std_private_thread_id [system] { header "__thread/id.h" } -module std_private_thread_jthread [system] { +module cxx03_std_private_thread_formatter [system] { header "__thread/formatter.h" } +module cxx03_std_private_thread_id [system] { header "__thread/id.h" } +module cxx03_std_private_thread_jthread [system] { header "__thread/jthread.h" export * } -module std_private_thread_poll_with_backoff [system] { header "__thread/poll_with_backoff.h" } -module std_private_thread_support [system] { +module cxx03_std_private_thread_poll_with_backoff [system] { header "__thread/poll_with_backoff.h" } +module cxx03_std_private_thread_support [system] { header "__thread/support.h" export * } -module std_private_thread_support_c11 [system] { textual header "__thread/support/c11.h" } -module std_private_thread_support_external [system] { textual header "__thread/support/external.h" } -module std_private_thread_support_pthread [system] { textual header "__thread/support/pthread.h" } -module std_private_thread_support_windows [system] { textual header "__thread/support/windows.h" } -module std_private_thread_this_thread [system] { header "__thread/this_thread.h" } -module std_private_thread_thread [system] { +module cxx03_std_private_thread_support_c11 [system] { textual header "__thread/support/c11.h" } +module cxx03_std_private_thread_support_external [system] { textual header "__thread/support/external.h" } +module cxx03_std_private_thread_support_pthread [system] { textual header "__thread/support/pthread.h" } +module cxx03_std_private_thread_support_windows [system] { textual header "__thread/support/windows.h" } +module cxx03_std_private_thread_this_thread [system] { header "__thread/this_thread.h" } +module cxx03_std_private_thread_thread [system] { header "__thread/thread.h" export * } -module std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" } +module cxx03_std_private_thread_timed_backoff_policy [system] { header "__thread/timed_backoff_policy.h" } -module std_private_tuple_find_index [system] { header "__tuple/find_index.h" } -module std_private_tuple_ignore [system] { header "__tuple/ignore.h" } -module std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" } -module std_private_tuple_tuple_like_no_subrange [system] { +module cxx03_std_private_tuple_find_index [system] { header "__tuple/find_index.h" } +module cxx03_std_private_tuple_ignore [system] { header "__tuple/ignore.h" } +module cxx03_std_private_tuple_make_tuple_types [system] { header "__tuple/make_tuple_types.h" } +module cxx03_std_private_tuple_tuple_like_no_subrange [system] { header "__tuple/tuple_like_no_subrange.h" } -module std_private_tuple_sfinae_helpers [system] { header "__tuple/sfinae_helpers.h" } -module std_private_tuple_tuple_element [system] { header "__tuple/tuple_element.h" } -module std_private_tuple_tuple_fwd [system] { header "__fwd/tuple.h" } -module std_private_tuple_tuple_indices [system] { header "__tuple/tuple_indices.h" } -module std_private_tuple_tuple_like [system] { +module cxx03_std_private_tuple_sfinae_helpers [system] { header "__tuple/sfinae_helpers.h" } +module cxx03_std_private_tuple_tuple_element [system] { header "__tuple/tuple_element.h" } +module cxx03_std_private_tuple_tuple_fwd [system] { header "__fwd/tuple.h" } +module cxx03_std_private_tuple_tuple_indices [system] { header "__tuple/tuple_indices.h" } +module cxx03_std_private_tuple_tuple_like [system] { header "__tuple/tuple_like.h" export * } -module std_private_tuple_tuple_like_ext [system] { header "__tuple/tuple_like_ext.h" } -module std_private_tuple_tuple_size [system] { header "__tuple/tuple_size.h" } -module std_private_tuple_tuple_types [system] { header "__tuple/tuple_types.h" } +module cxx03_std_private_tuple_tuple_like_ext [system] { header "__tuple/tuple_like_ext.h" } +module cxx03_std_private_tuple_tuple_size [system] { header "__tuple/tuple_size.h" } +module cxx03_std_private_tuple_tuple_types [system] { header "__tuple/tuple_types.h" } -module std_private_type_traits_add_const [system] { header "__type_traits/add_const.h" } -module std_private_type_traits_add_cv [system] { header "__type_traits/add_cv.h" } -module std_private_type_traits_add_lvalue_reference [system] { +module cxx03_std_private_type_traits_add_const [system] { header "__type_traits/add_const.h" } +module cxx03_std_private_type_traits_add_cv [system] { header "__type_traits/add_cv.h" } +module cxx03_std_private_type_traits_add_lvalue_reference [system] { header "__type_traits/add_lvalue_reference.h" export std_private_type_traits_is_referenceable } -module std_private_type_traits_add_pointer [system] { header "__type_traits/add_pointer.h" } -module std_private_type_traits_add_rvalue_reference [system] { header "__type_traits/add_rvalue_reference.h" } -module std_private_type_traits_add_volatile [system] { header "__type_traits/add_volatile.h" } -module std_private_type_traits_aligned_storage [system] { header "__type_traits/aligned_storage.h" } -module std_private_type_traits_aligned_union [system] { header "__type_traits/aligned_union.h" } -module std_private_type_traits_alignment_of [system] { header "__type_traits/alignment_of.h" } -module std_private_type_traits_can_extract_key [system] { header "__type_traits/can_extract_key.h" } -module std_private_type_traits_common_reference [system] { +module cxx03_std_private_type_traits_add_pointer [system] { header "__type_traits/add_pointer.h" } +module cxx03_std_private_type_traits_add_rvalue_reference [system] { header "__type_traits/add_rvalue_reference.h" } +module cxx03_std_private_type_traits_add_volatile [system] { header "__type_traits/add_volatile.h" } +module cxx03_std_private_type_traits_aligned_storage [system] { header "__type_traits/aligned_storage.h" } +module cxx03_std_private_type_traits_aligned_union [system] { header "__type_traits/aligned_union.h" } +module cxx03_std_private_type_traits_alignment_of [system] { header "__type_traits/alignment_of.h" } +module cxx03_std_private_type_traits_can_extract_key [system] { header "__type_traits/can_extract_key.h" } +module cxx03_std_private_type_traits_common_reference [system] { header "__type_traits/common_reference.h" export std_private_type_traits_remove_cvref } -module std_private_type_traits_common_type [system] { +module cxx03_std_private_type_traits_common_type [system] { header "__type_traits/common_type.h" export std_private_utility_declval } -module std_private_type_traits_conditional [system] { header "__type_traits/conditional.h" } -module std_private_type_traits_conjunction [system] { header "__type_traits/conjunction.h" } -module std_private_type_traits_copy_cv [system] { header "__type_traits/copy_cv.h" } -module std_private_type_traits_copy_cvref [system] { header "__type_traits/copy_cvref.h" } -module std_private_type_traits_datasizeof [system] { header "__type_traits/datasizeof.h" } -module std_private_type_traits_decay [system] { +module cxx03_std_private_type_traits_conditional [system] { header "__type_traits/conditional.h" } +module cxx03_std_private_type_traits_conjunction [system] { header "__type_traits/conjunction.h" } +module cxx03_std_private_type_traits_copy_cv [system] { header "__type_traits/copy_cv.h" } +module cxx03_std_private_type_traits_copy_cvref [system] { header "__type_traits/copy_cvref.h" } +module cxx03_std_private_type_traits_datasizeof [system] { header "__type_traits/datasizeof.h" } +module cxx03_std_private_type_traits_decay [system] { header "__type_traits/decay.h" export std_private_type_traits_add_pointer } -module std_private_type_traits_dependent_type [system] { header "__type_traits/dependent_type.h" } -module std_private_type_traits_desugars_to [system] { header "__type_traits/desugars_to.h" } -module std_private_type_traits_disjunction [system] { header "__type_traits/disjunction.h" } -module std_private_type_traits_enable_if [system] { header "__type_traits/enable_if.h" } -module std_private_type_traits_extent [system] { header "__type_traits/extent.h" } -module std_private_type_traits_has_unique_object_representation [system] { header "__type_traits/has_unique_object_representation.h" } -module std_private_type_traits_has_virtual_destructor [system] { header "__type_traits/has_virtual_destructor.h" } -module std_private_type_traits_integral_constant [system] { header "__type_traits/integral_constant.h" } -module std_private_type_traits_invoke [system] { +module cxx03_std_private_type_traits_dependent_type [system] { header "__type_traits/dependent_type.h" } +module cxx03_std_private_type_traits_desugars_to [system] { header "__type_traits/desugars_to.h" } +module cxx03_std_private_type_traits_disjunction [system] { header "__type_traits/disjunction.h" } +module cxx03_std_private_type_traits_enable_if [system] { header "__type_traits/enable_if.h" } +module cxx03_std_private_type_traits_extent [system] { header "__type_traits/extent.h" } +module cxx03_std_private_type_traits_has_unique_object_representation [system] { header "__type_traits/has_unique_object_representation.h" } +module cxx03_std_private_type_traits_has_virtual_destructor [system] { header "__type_traits/has_virtual_destructor.h" } +module cxx03_std_private_type_traits_integral_constant [system] { header "__type_traits/integral_constant.h" } +module cxx03_std_private_type_traits_invoke [system] { header "__type_traits/invoke.h" export std_private_type_traits_conditional export std_private_type_traits_decay @@ -1917,194 +1917,194 @@ module std_private_type_traits_invoke [system export std_private_type_traits_nat export std_private_type_traits_remove_cv } -module std_private_type_traits_is_abstract [system] { header "__type_traits/is_abstract.h" } -module std_private_type_traits_is_aggregate [system] { header "__type_traits/is_aggregate.h" } -module std_private_type_traits_is_allocator [system] { header "__type_traits/is_allocator.h" } -module std_private_type_traits_is_always_bitcastable [system] { header "__type_traits/is_always_bitcastable.h" } -module std_private_type_traits_is_arithmetic [system] { +module cxx03_std_private_type_traits_is_abstract [system] { header "__type_traits/is_abstract.h" } +module cxx03_std_private_type_traits_is_aggregate [system] { header "__type_traits/is_aggregate.h" } +module cxx03_std_private_type_traits_is_allocator [system] { header "__type_traits/is_allocator.h" } +module cxx03_std_private_type_traits_is_always_bitcastable [system] { header "__type_traits/is_always_bitcastable.h" } +module cxx03_std_private_type_traits_is_arithmetic [system] { header "__type_traits/is_arithmetic.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_array [system] { +module cxx03_std_private_type_traits_is_array [system] { header "__type_traits/is_array.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_assignable [system] { header "__type_traits/is_assignable.h" } -module std_private_type_traits_is_base_of [system] { header "__type_traits/is_base_of.h" } -module std_private_type_traits_is_bounded_array [system] { header "__type_traits/is_bounded_array.h" } -module std_private_type_traits_is_callable [system] { +module cxx03_std_private_type_traits_is_assignable [system] { header "__type_traits/is_assignable.h" } +module cxx03_std_private_type_traits_is_base_of [system] { header "__type_traits/is_base_of.h" } +module cxx03_std_private_type_traits_is_bounded_array [system] { header "__type_traits/is_bounded_array.h" } +module cxx03_std_private_type_traits_is_callable [system] { header "__type_traits/is_callable.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_char_like_type [system] { header "__type_traits/is_char_like_type.h" } -module std_private_type_traits_is_class [system] { header "__type_traits/is_class.h" } -module std_private_type_traits_is_compound [system] { header "__type_traits/is_compound.h" } -module std_private_type_traits_is_const [system] { header "__type_traits/is_const.h" } -module std_private_type_traits_is_constant_evaluated [system] { header "__type_traits/is_constant_evaluated.h" } -module std_private_type_traits_is_constructible [system] { header "__type_traits/is_constructible.h" } -module std_private_type_traits_is_convertible [system] { +module cxx03_std_private_type_traits_is_char_like_type [system] { header "__type_traits/is_char_like_type.h" } +module cxx03_std_private_type_traits_is_class [system] { header "__type_traits/is_class.h" } +module cxx03_std_private_type_traits_is_compound [system] { header "__type_traits/is_compound.h" } +module cxx03_std_private_type_traits_is_const [system] { header "__type_traits/is_const.h" } +module cxx03_std_private_type_traits_is_constant_evaluated [system] { header "__type_traits/is_constant_evaluated.h" } +module cxx03_std_private_type_traits_is_constructible [system] { header "__type_traits/is_constructible.h" } +module cxx03_std_private_type_traits_is_convertible [system] { header "__type_traits/is_convertible.h" export std_private_type_traits_is_array } -module std_private_type_traits_is_copy_assignable [system] { header "__type_traits/is_copy_assignable.h" } -module std_private_type_traits_is_copy_constructible [system] { header "__type_traits/is_copy_constructible.h" } -module std_private_type_traits_is_core_convertible [system] { +module cxx03_std_private_type_traits_is_copy_assignable [system] { header "__type_traits/is_copy_assignable.h" } +module cxx03_std_private_type_traits_is_copy_constructible [system] { header "__type_traits/is_copy_constructible.h" } +module cxx03_std_private_type_traits_is_core_convertible [system] { header "__type_traits/is_core_convertible.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_destructible [system] { header "__type_traits/is_destructible.h" } -module std_private_type_traits_is_empty [system] { header "__type_traits/is_empty.h" } -module std_private_type_traits_is_enum [system] { +module cxx03_std_private_type_traits_is_destructible [system] { header "__type_traits/is_destructible.h" } +module cxx03_std_private_type_traits_is_empty [system] { header "__type_traits/is_empty.h" } +module cxx03_std_private_type_traits_is_enum [system] { header "__type_traits/is_enum.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_equality_comparable [system] { +module cxx03_std_private_type_traits_is_equality_comparable [system] { header "__type_traits/is_equality_comparable.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_execution_policy [system] { +module cxx03_std_private_type_traits_is_execution_policy [system] { header "__type_traits/is_execution_policy.h" export std_private_type_traits_remove_cvref } -module std_private_type_traits_is_final [system] { header "__type_traits/is_final.h" } -module std_private_type_traits_is_floating_point [system] { header "__type_traits/is_floating_point.h" } -module std_private_type_traits_is_function [system] { header "__type_traits/is_function.h" } -module std_private_type_traits_is_fundamental [system] { header "__type_traits/is_fundamental.h" } -module std_private_type_traits_is_implicitly_default_constructible [system] { +module cxx03_std_private_type_traits_is_final [system] { header "__type_traits/is_final.h" } +module cxx03_std_private_type_traits_is_floating_point [system] { header "__type_traits/is_floating_point.h" } +module cxx03_std_private_type_traits_is_function [system] { header "__type_traits/is_function.h" } +module cxx03_std_private_type_traits_is_fundamental [system] { header "__type_traits/is_fundamental.h" } +module cxx03_std_private_type_traits_is_implicitly_default_constructible [system] { header "__type_traits/is_implicitly_default_constructible.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_integral [system] { header "__type_traits/is_integral.h" } -module std_private_type_traits_is_literal_type [system] { header "__type_traits/is_literal_type.h" } -module std_private_type_traits_is_member_pointer [system] { header "__type_traits/is_member_pointer.h" } -module std_private_type_traits_is_nothrow_assignable [system] { header "__type_traits/is_nothrow_assignable.h" } -module std_private_type_traits_is_nothrow_constructible [system] { +module cxx03_std_private_type_traits_is_integral [system] { header "__type_traits/is_integral.h" } +module cxx03_std_private_type_traits_is_literal_type [system] { header "__type_traits/is_literal_type.h" } +module cxx03_std_private_type_traits_is_member_pointer [system] { header "__type_traits/is_member_pointer.h" } +module cxx03_std_private_type_traits_is_nothrow_assignable [system] { header "__type_traits/is_nothrow_assignable.h" } +module cxx03_std_private_type_traits_is_nothrow_constructible [system] { header "__type_traits/is_nothrow_constructible.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_nothrow_convertible [system] { header "__type_traits/is_nothrow_convertible.h" } -module std_private_type_traits_is_nothrow_destructible [system] { +module cxx03_std_private_type_traits_is_nothrow_convertible [system] { header "__type_traits/is_nothrow_convertible.h" } +module cxx03_std_private_type_traits_is_nothrow_destructible [system] { header "__type_traits/is_nothrow_destructible.h" export std_private_type_traits_is_destructible } -module std_private_type_traits_is_null_pointer [system] { +module cxx03_std_private_type_traits_is_null_pointer [system] { header "__type_traits/is_null_pointer.h" export std_cstddef } -module std_private_type_traits_is_object [system] { +module cxx03_std_private_type_traits_is_object [system] { header "__type_traits/is_object.h" export std_private_type_traits_is_scalar } -module std_private_type_traits_is_pod [system] { header "__type_traits/is_pod.h" } -module std_private_type_traits_is_pointer [system] { header "__type_traits/is_pointer.h" } -module std_private_type_traits_is_polymorphic [system] { header "__type_traits/is_polymorphic.h" } -module std_private_type_traits_is_primary_template [system] { +module cxx03_std_private_type_traits_is_pod [system] { header "__type_traits/is_pod.h" } +module cxx03_std_private_type_traits_is_pointer [system] { header "__type_traits/is_pointer.h" } +module cxx03_std_private_type_traits_is_polymorphic [system] { header "__type_traits/is_polymorphic.h" } +module cxx03_std_private_type_traits_is_primary_template [system] { header "__type_traits/is_primary_template.h" export std_private_type_traits_enable_if } -module std_private_type_traits_is_reference [system] { header "__type_traits/is_reference.h" } -module std_private_type_traits_is_reference_wrapper [system] { header "__type_traits/is_reference_wrapper.h" } -module std_private_type_traits_is_referenceable [system] { header "__type_traits/is_referenceable.h" } -module std_private_type_traits_is_same [system] { +module cxx03_std_private_type_traits_is_reference [system] { header "__type_traits/is_reference.h" } +module cxx03_std_private_type_traits_is_reference_wrapper [system] { header "__type_traits/is_reference_wrapper.h" } +module cxx03_std_private_type_traits_is_referenceable [system] { header "__type_traits/is_referenceable.h" } +module cxx03_std_private_type_traits_is_same [system] { header "__type_traits/is_same.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_scalar [system] { +module cxx03_std_private_type_traits_is_scalar [system] { header "__type_traits/is_scalar.h" export std_private_type_traits_is_null_pointer } -module std_private_type_traits_is_signed [system] { header "__type_traits/is_signed.h" } -module std_private_type_traits_is_signed_integer [system] { header "__type_traits/is_signed_integer.h" } -module std_private_type_traits_is_specialization [system] { header "__type_traits/is_specialization.h" } -module std_private_type_traits_is_standard_layout [system] { header "__type_traits/is_standard_layout.h" } -module std_private_type_traits_is_swappable [system] { +module cxx03_std_private_type_traits_is_signed [system] { header "__type_traits/is_signed.h" } +module cxx03_std_private_type_traits_is_signed_integer [system] { header "__type_traits/is_signed_integer.h" } +module cxx03_std_private_type_traits_is_specialization [system] { header "__type_traits/is_specialization.h" } +module cxx03_std_private_type_traits_is_standard_layout [system] { header "__type_traits/is_standard_layout.h" } +module cxx03_std_private_type_traits_is_swappable [system] { header "__type_traits/is_swappable.h" export std_private_type_traits_is_move_constructible } -module std_private_type_traits_is_trivial [system] { header "__type_traits/is_trivial.h" } -module std_private_type_traits_is_trivially_assignable [system] { header "__type_traits/is_trivially_assignable.h" } -module std_private_type_traits_is_trivially_constructible [system] { header "__type_traits/is_trivially_constructible.h" } -module std_private_type_traits_is_trivially_copyable [system] { header "__type_traits/is_trivially_copyable.h" } -module std_private_type_traits_is_trivially_destructible [system] { header "__type_traits/is_trivially_destructible.h" } -module std_private_type_traits_is_trivially_lexicographically_comparable [system] { header "__type_traits/is_trivially_lexicographically_comparable.h" } -module std_private_type_traits_is_trivially_relocatable [system] { header "__type_traits/is_trivially_relocatable.h" } -module std_private_type_traits_is_unbounded_array [system] { header "__type_traits/is_unbounded_array.h" } -module std_private_type_traits_is_union [system] { header "__type_traits/is_union.h" } -module std_private_type_traits_is_unsigned [system] { header "__type_traits/is_unsigned.h" } -module std_private_type_traits_is_unsigned_integer [system] { header "__type_traits/is_unsigned_integer.h" } -module std_private_type_traits_is_valid_expansion [system] { header "__type_traits/is_valid_expansion.h" } -module std_private_type_traits_is_void [system] { +module cxx03_std_private_type_traits_is_trivial [system] { header "__type_traits/is_trivial.h" } +module cxx03_std_private_type_traits_is_trivially_assignable [system] { header "__type_traits/is_trivially_assignable.h" } +module cxx03_std_private_type_traits_is_trivially_constructible [system] { header "__type_traits/is_trivially_constructible.h" } +module cxx03_std_private_type_traits_is_trivially_copyable [system] { header "__type_traits/is_trivially_copyable.h" } +module cxx03_std_private_type_traits_is_trivially_destructible [system] { header "__type_traits/is_trivially_destructible.h" } +module cxx03_std_private_type_traits_is_trivially_lexicographically_comparable [system] { header "__type_traits/is_trivially_lexicographically_comparable.h" } +module cxx03_std_private_type_traits_is_trivially_relocatable [system] { header "__type_traits/is_trivially_relocatable.h" } +module cxx03_std_private_type_traits_is_unbounded_array [system] { header "__type_traits/is_unbounded_array.h" } +module cxx03_std_private_type_traits_is_union [system] { header "__type_traits/is_union.h" } +module cxx03_std_private_type_traits_is_unsigned [system] { header "__type_traits/is_unsigned.h" } +module cxx03_std_private_type_traits_is_unsigned_integer [system] { header "__type_traits/is_unsigned_integer.h" } +module cxx03_std_private_type_traits_is_valid_expansion [system] { header "__type_traits/is_valid_expansion.h" } +module cxx03_std_private_type_traits_is_void [system] { header "__type_traits/is_void.h" export std_private_type_traits_integral_constant } -module std_private_type_traits_is_volatile [system] { header "__type_traits/is_volatile.h" } -module std_private_type_traits_lazy [system] { header "__type_traits/lazy.h" } -module std_private_type_traits_make_32_64_or_128_bit [system] { header "__type_traits/make_32_64_or_128_bit.h" } -module std_private_type_traits_make_const_lvalue_ref [system] { header "__type_traits/make_const_lvalue_ref.h" } -module std_private_type_traits_make_signed [system] { header "__type_traits/make_signed.h" } -module std_private_type_traits_make_unsigned [system] { +module cxx03_std_private_type_traits_is_volatile [system] { header "__type_traits/is_volatile.h" } +module cxx03_std_private_type_traits_lazy [system] { header "__type_traits/lazy.h" } +module cxx03_std_private_type_traits_make_32_64_or_128_bit [system] { header "__type_traits/make_32_64_or_128_bit.h" } +module cxx03_std_private_type_traits_make_const_lvalue_ref [system] { header "__type_traits/make_const_lvalue_ref.h" } +module cxx03_std_private_type_traits_make_signed [system] { header "__type_traits/make_signed.h" } +module cxx03_std_private_type_traits_make_unsigned [system] { header "__type_traits/make_unsigned.h" export std_private_type_traits_is_unsigned } -module std_private_type_traits_maybe_const [system] { header "__type_traits/maybe_const.h" } -module std_private_type_traits_nat [system] { header "__type_traits/nat.h" } -module std_private_type_traits_negation [system] { header "__type_traits/negation.h" } -module std_private_type_traits_noexcept_move_assign_container [system] { header "__type_traits/noexcept_move_assign_container.h" } -module std_private_type_traits_promote [system] { header "__type_traits/promote.h" } -module std_private_type_traits_rank [system] { header "__type_traits/rank.h" } -module std_private_type_traits_remove_all_extents [system] { header "__type_traits/remove_all_extents.h" } -module std_private_type_traits_remove_const [system] { header "__type_traits/remove_const.h" } -module std_private_type_traits_remove_const_ref [system] { header "__type_traits/remove_const_ref.h" } -module std_private_type_traits_remove_cv [system] { +module cxx03_std_private_type_traits_maybe_const [system] { header "__type_traits/maybe_const.h" } +module cxx03_std_private_type_traits_nat [system] { header "__type_traits/nat.h" } +module cxx03_std_private_type_traits_negation [system] { header "__type_traits/negation.h" } +module cxx03_std_private_type_traits_noexcept_move_assign_container [system] { header "__type_traits/noexcept_move_assign_container.h" } +module cxx03_std_private_type_traits_promote [system] { header "__type_traits/promote.h" } +module cxx03_std_private_type_traits_rank [system] { header "__type_traits/rank.h" } +module cxx03_std_private_type_traits_remove_all_extents [system] { header "__type_traits/remove_all_extents.h" } +module cxx03_std_private_type_traits_remove_const [system] { header "__type_traits/remove_const.h" } +module cxx03_std_private_type_traits_remove_const_ref [system] { header "__type_traits/remove_const_ref.h" } +module cxx03_std_private_type_traits_remove_cv [system] { header "__type_traits/remove_cv.h" export std_private_type_traits_remove_const export std_private_type_traits_remove_volatile } -module std_private_type_traits_remove_cvref [system] { header "__type_traits/remove_cvref.h" } -module std_private_type_traits_remove_extent [system] { header "__type_traits/remove_extent.h" } -module std_private_type_traits_remove_pointer [system] { header "__type_traits/remove_pointer.h" } -module std_private_type_traits_remove_reference [system] { header "__type_traits/remove_reference.h" } -module std_private_type_traits_remove_volatile [system] { header "__type_traits/remove_volatile.h" } -module std_private_type_traits_result_of [system] { header "__type_traits/result_of.h" } -module std_private_type_traits_strip_signature [system] { header "__type_traits/strip_signature.h" } -module std_private_type_traits_type_identity [system] { header "__type_traits/type_identity.h" } -module std_private_type_traits_type_list [system] { header "__type_traits/type_list.h" } -module std_private_type_traits_underlying_type [system] { +module cxx03_std_private_type_traits_remove_cvref [system] { header "__type_traits/remove_cvref.h" } +module cxx03_std_private_type_traits_remove_extent [system] { header "__type_traits/remove_extent.h" } +module cxx03_std_private_type_traits_remove_pointer [system] { header "__type_traits/remove_pointer.h" } +module cxx03_std_private_type_traits_remove_reference [system] { header "__type_traits/remove_reference.h" } +module cxx03_std_private_type_traits_remove_volatile [system] { header "__type_traits/remove_volatile.h" } +module cxx03_std_private_type_traits_result_of [system] { header "__type_traits/result_of.h" } +module cxx03_std_private_type_traits_strip_signature [system] { header "__type_traits/strip_signature.h" } +module cxx03_std_private_type_traits_type_identity [system] { header "__type_traits/type_identity.h" } +module cxx03_std_private_type_traits_type_list [system] { header "__type_traits/type_list.h" } +module cxx03_std_private_type_traits_underlying_type [system] { header "__type_traits/underlying_type.h" export std_private_type_traits_is_enum } -module std_private_type_traits_unwrap_ref [system] { header "__type_traits/unwrap_ref.h" } -module std_private_type_traits_void_t [system] { header "__type_traits/void_t.h" } +module cxx03_std_private_type_traits_unwrap_ref [system] { header "__type_traits/unwrap_ref.h" } +module cxx03_std_private_type_traits_void_t [system] { header "__type_traits/void_t.h" } -module std_private_utility_as_const [system] { header "__utility/as_const.h" } -module std_private_utility_as_lvalue [system] { header "__utility/as_lvalue.h" } -module std_private_utility_auto_cast [system] { +module cxx03_std_private_utility_as_const [system] { header "__utility/as_const.h" } +module cxx03_std_private_utility_as_lvalue [system] { header "__utility/as_lvalue.h" } +module cxx03_std_private_utility_auto_cast [system] { header "__utility/auto_cast.h" export std_private_type_traits_decay } -module std_private_utility_cmp [system] { +module cxx03_std_private_utility_cmp [system] { header "__utility/cmp.h" export std_private_type_traits_make_unsigned } -module std_private_utility_convert_to_integral [system] { header "__utility/convert_to_integral.h" } -module std_private_utility_declval [system] { header "__utility/declval.h" } -module std_private_utility_empty [system] { header "__utility/empty.h" } -module std_private_utility_exception_guard [system] { header "__utility/exception_guard.h" } -module std_private_utility_exchange [system] { header "__utility/exchange.h" } -module std_private_utility_forward [system] { header "__utility/forward.h" } -module std_private_utility_forward_like [system] { header "__utility/forward_like.h" } -module std_private_utility_in_place [system] { header "__utility/in_place.h" } -module std_private_utility_integer_sequence [system] { header "__utility/integer_sequence.h" } -module std_private_utility_is_pointer_in_range [system] { header "__utility/is_pointer_in_range.h" } -module std_private_utility_is_valid_range [system] { header "__utility/is_valid_range.h" } -module std_private_utility_move [system] { +module cxx03_std_private_utility_convert_to_integral [system] { header "__utility/convert_to_integral.h" } +module cxx03_std_private_utility_declval [system] { header "__utility/declval.h" } +module cxx03_std_private_utility_empty [system] { header "__utility/empty.h" } +module cxx03_std_private_utility_exception_guard [system] { header "__utility/exception_guard.h" } +module cxx03_std_private_utility_exchange [system] { header "__utility/exchange.h" } +module cxx03_std_private_utility_forward [system] { header "__utility/forward.h" } +module cxx03_std_private_utility_forward_like [system] { header "__utility/forward_like.h" } +module cxx03_std_private_utility_in_place [system] { header "__utility/in_place.h" } +module cxx03_std_private_utility_integer_sequence [system] { header "__utility/integer_sequence.h" } +module cxx03_std_private_utility_is_pointer_in_range [system] { header "__utility/is_pointer_in_range.h" } +module cxx03_std_private_utility_is_valid_range [system] { header "__utility/is_valid_range.h" } +module cxx03_std_private_utility_move [system] { header "__utility/move.h" export std_private_type_traits_is_copy_constructible export std_private_type_traits_is_nothrow_move_constructible export std_private_type_traits_remove_reference } -module std_private_utility_no_destroy [system] { header "__utility/no_destroy.h" } -module std_private_utility_pair [system] { +module cxx03_std_private_utility_no_destroy [system] { header "__utility/no_destroy.h" } +module cxx03_std_private_utility_pair [system] { header "__utility/pair.h" export std_private_ranges_subrange_fwd export std_private_tuple_pair_like @@ -2118,19 +2118,19 @@ module std_private_utility_pair [system] { export std_private_type_traits_is_nothrow_move_assignable export std_private_utility_pair_fwd } -module std_private_utility_pair_fwd [system] { header "__fwd/pair.h" } -module std_private_utility_piecewise_construct [system] { header "__utility/piecewise_construct.h" } -module std_private_utility_priority_tag [system] { header "__utility/priority_tag.h" } -module std_private_utility_private_constructor_tag [system] { header "__utility/private_constructor_tag.h" } -module std_private_utility_rel_ops [system] { header "__utility/rel_ops.h" } -module std_private_utility_small_buffer [system] { header "__utility/small_buffer.h" } -module std_private_utility_swap [system] { +module cxx03_std_private_utility_pair_fwd [system] { header "__fwd/pair.h" } +module cxx03_std_private_utility_piecewise_construct [system] { header "__utility/piecewise_construct.h" } +module cxx03_std_private_utility_priority_tag [system] { header "__utility/priority_tag.h" } +module cxx03_std_private_utility_private_constructor_tag [system] { header "__utility/private_constructor_tag.h" } +module cxx03_std_private_utility_rel_ops [system] { header "__utility/rel_ops.h" } +module cxx03_std_private_utility_small_buffer [system] { header "__utility/small_buffer.h" } +module cxx03_std_private_utility_swap [system] { header "__utility/swap.h" export std_private_type_traits_is_swappable } -module std_private_utility_to_underlying [system] { header "__utility/to_underlying.h" } -module std_private_utility_unreachable [system] { header "__utility/unreachable.h" } +module cxx03_std_private_utility_to_underlying [system] { header "__utility/to_underlying.h" } +module cxx03_std_private_utility_unreachable [system] { header "__utility/unreachable.h" } -module std_private_variant_monostate [system] { header "__variant/monostate.h" } +module cxx03_std_private_variant_monostate [system] { header "__variant/monostate.h" } -module std_private_vector_fwd [system] { header "__fwd/vector.h" } +module cxx03_std_private_vector_fwd [system] { header "__fwd/vector.h" } diff --git a/libcxx/include/__cxx03/version b/libcxx/include/__cxx03/version index dd0fe4b4d2817..ed1857db05b31 100644 --- a/libcxx/include/__cxx03/version +++ b/libcxx/include/__cxx03/version @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP_VERSIONH -#define _LIBCPP_VERSIONH +#ifndef _LIBCPP___CXX03_VERSIONH +#define _LIBCPP___CXX03_VERSIONH /* version synopsis @@ -563,4 +563,4 @@ __cpp_lib_void_t 201411L // clang-format on -#endif // _LIBCPP_VERSIONH +#endif // _LIBCPP___CXX03_VERSIONH diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm index 080fca8c1ca51..e593ae26ed6e2 100644 --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -1827,8 +1827,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/algorithm> +#else # include <__config> # include <__algorithm/adjacent_find.h> @@ -2056,6 +2057,6 @@ template # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ALGORITHM diff --git a/libcxx/include/any b/libcxx/include/any index c8658a468713c..934c4dbd45a68 100644 --- a/libcxx/include/any +++ b/libcxx/include/any @@ -80,8 +80,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/any> +#else # include <__config> # include <__memory/allocator.h> # include <__memory/allocator_destructor.h> @@ -611,6 +612,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ANY diff --git a/libcxx/include/array b/libcxx/include/array index 7aed70f91fdd7..516d96538f5ad 100644 --- a/libcxx/include/array +++ b/libcxx/include/array @@ -111,8 +111,9 @@ template const T&& get(const array&&) noexce */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/array> +#else # include <__algorithm/equal.h> # include <__algorithm/fill_n.h> # include <__algorithm/lexicographical_compare.h> @@ -567,6 +568,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ARRAY diff --git a/libcxx/include/atomic b/libcxx/include/atomic index 64635d099af92..80f9e437bfaab 100644 --- a/libcxx/include/atomic +++ b/libcxx/include/atomic @@ -587,8 +587,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/atomic> +#else # include <__config> # include <__atomic/aliases.h> @@ -625,6 +626,6 @@ template # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ATOMIC diff --git a/libcxx/include/barrier b/libcxx/include/barrier index 705cb7d9ac52e..6861532b02ba2 100644 --- a/libcxx/include/barrier +++ b/libcxx/include/barrier @@ -45,8 +45,9 @@ namespace std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/barrier> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -306,6 +307,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_BARRIER diff --git a/libcxx/include/bit b/libcxx/include/bit index a5a317ebb232b..3fea10ba25c4d 100644 --- a/libcxx/include/bit +++ b/libcxx/include/bit @@ -61,8 +61,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/bit> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -95,6 +96,6 @@ namespace std { # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_BIT diff --git a/libcxx/include/bitset b/libcxx/include/bitset index e2dc7b459f1c4..8b36182480557 100644 --- a/libcxx/include/bitset +++ b/libcxx/include/bitset @@ -126,8 +126,9 @@ template struct hash>; // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/bitset> +#else # include <__algorithm/count.h> # include <__algorithm/fill.h> # include <__algorithm/fill_n.h> @@ -971,6 +972,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_BITSET diff --git a/libcxx/include/cassert b/libcxx/include/cassert index 18e6e29353362..9d3cd77fcf2d7 100644 --- a/libcxx/include/cassert +++ b/libcxx/include/cassert @@ -16,8 +16,9 @@ Macros: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cassert> +#else # include <__config> // is not provided by libc++ @@ -31,4 +32,4 @@ Macros: # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) diff --git a/libcxx/include/ccomplex b/libcxx/include/ccomplex index bd5a811b7e9fb..10eb8a36e417c 100644 --- a/libcxx/include/ccomplex +++ b/libcxx/include/ccomplex @@ -17,8 +17,9 @@ */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ccomplex> +#else # include # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -36,6 +37,6 @@ using __standard_header_ccomplex _LIBCPP_DEPRECATED_("Include instead. using __use_standard_header_ccomplex = __standard_header_ccomplex; # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CCOMPLEX diff --git a/libcxx/include/cctype b/libcxx/include/cctype index ee3002b2cc5fe..abe0ec44e3a64 100644 --- a/libcxx/include/cctype +++ b/libcxx/include/cctype @@ -34,8 +34,9 @@ int toupper(int c); } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cctype> +#else # include <__config> # include @@ -125,6 +126,6 @@ using ::tolower _LIBCPP_USING_IF_EXISTS; using ::toupper _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CCTYPE diff --git a/libcxx/include/cerrno b/libcxx/include/cerrno index 63017d07c019a..15925d4381095 100644 --- a/libcxx/include/cerrno +++ b/libcxx/include/cerrno @@ -22,8 +22,9 @@ Macros: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cerrno> +#else # include <__config> # include @@ -46,6 +47,6 @@ Macros: // deprecated in libc++ in https://github.com/llvm/llvm-project/pull/80542. // Based on the post commit feedback the macro are no longer deprecated. // Instead libc++ leaves the deprecation to the provider of errno.h. -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CERRNO diff --git a/libcxx/include/cfenv b/libcxx/include/cfenv index 47ed700f4bee6..d7ea770297530 100644 --- a/libcxx/include/cfenv +++ b/libcxx/include/cfenv @@ -52,8 +52,9 @@ int feupdateenv(const fenv_t* envp); } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cfenv> +#else # include <__config> # include @@ -86,8 +87,9 @@ using ::fegetenv _LIBCPP_USING_IF_EXISTS; using ::feholdexcept _LIBCPP_USING_IF_EXISTS; using ::fesetenv _LIBCPP_USING_IF_EXISTS; using ::feupdateenv _LIBCPP_USING_IF_EXISTS; -#endif // 0 _LIBCPP_END_NAMESPACE_STD +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) + #endif // _LIBCPP_CFENV diff --git a/libcxx/include/cfloat b/libcxx/include/cfloat index fc37f58f4f12c..18b4afd28ee87 100644 --- a/libcxx/include/cfloat +++ b/libcxx/include/cfloat @@ -69,8 +69,9 @@ Macros: LDBL_TRUE_MIN // C11 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cfloat> +#else # include <__config> # include @@ -86,6 +87,6 @@ Macros: # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CFLOAT diff --git a/libcxx/include/charconv b/libcxx/include/charconv index 258779ad0a557..3526bb9ae05f4 100644 --- a/libcxx/include/charconv +++ b/libcxx/include/charconv @@ -75,8 +75,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/charconv> +#else # include <__config> # if _LIBCPP_STD_VER >= 17 @@ -115,6 +116,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CHARCONV diff --git a/libcxx/include/chrono b/libcxx/include/chrono index 6654a6776d397..d9a8afef933b9 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -939,8 +939,9 @@ constexpr chrono::year operator ""y(unsigned lo // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/chrono> +#else # include <__config> # include <__chrono/duration.h> @@ -1019,6 +1020,6 @@ constexpr chrono::year operator ""y(unsigned lo # include # endif # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CHRONO diff --git a/libcxx/include/cinttypes b/libcxx/include/cinttypes index 053067d4d6250..4c7e2c5a5bf38 100644 --- a/libcxx/include/cinttypes +++ b/libcxx/include/cinttypes @@ -234,8 +234,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cinttypes> +#else # include <__config> // standard-mandated includes @@ -269,6 +270,6 @@ using ::wcstoumax _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CINTTYPES diff --git a/libcxx/include/ciso646 b/libcxx/include/ciso646 index 965b78741a0b4..5b956401430a7 100644 --- a/libcxx/include/ciso646 +++ b/libcxx/include/ciso646 @@ -15,8 +15,9 @@ */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ciso646> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -29,6 +30,6 @@ using __standard_header_ciso646 _LIBCPP_DEPRECATED_("removed in C++20. Include < using __use_standard_header_ciso646 = __standard_header_ciso646; # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CISO646 diff --git a/libcxx/include/climits b/libcxx/include/climits index b31f77d9e859d..a051d964bbce9 100644 --- a/libcxx/include/climits +++ b/libcxx/include/climits @@ -37,8 +37,9 @@ Macros: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/climits> +#else # include <__config> # include @@ -47,6 +48,6 @@ Macros: # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CLIMITS diff --git a/libcxx/include/clocale b/libcxx/include/clocale index 4199487a3992f..9ca82fa15be25 100644 --- a/libcxx/include/clocale +++ b/libcxx/include/clocale @@ -34,8 +34,9 @@ lconv* localeconv(); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/clocale> +#else # include <__config> # if __has_include() @@ -54,6 +55,6 @@ using ::localeconv _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CLOCALE diff --git a/libcxx/include/cmath b/libcxx/include/cmath index ff8e7e1bf1481..9cf044d4d023b 100644 --- a/libcxx/include/cmath +++ b/libcxx/include/cmath @@ -312,8 +312,9 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cmath> +#else # include <__config> # include <__math/hypot.h> # include <__type_traits/enable_if.h> @@ -616,6 +617,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CMATH diff --git a/libcxx/include/codecvt b/libcxx/include/codecvt index ce6d995f37aba..f7ae804c6789c 100644 --- a/libcxx/include/codecvt +++ b/libcxx/include/codecvt @@ -54,8 +54,9 @@ class codecvt_utf8_utf16 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/codecvt> +#else # include <__config> # include <__locale> # include @@ -595,6 +596,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CODECVT diff --git a/libcxx/include/compare b/libcxx/include/compare index 97871e679bf32..0c19a5bb5f810 100644 --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -140,8 +140,9 @@ namespace std { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/compare> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -171,6 +172,6 @@ namespace std { # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_COMPARE diff --git a/libcxx/include/complex b/libcxx/include/complex index bfc27bb383416..bc73f313c2ce1 100644 --- a/libcxx/include/complex +++ b/libcxx/include/complex @@ -256,8 +256,9 @@ template complex tanh (const complex&); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/complex> +#else # include <__config> # include <__fwd/complex.h> # include <__fwd/tuple.h> @@ -1476,6 +1477,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_COMPLEX diff --git a/libcxx/include/complex.h b/libcxx/include/complex.h index 5bc7ab435ca72..8a1f92689601f 100644 --- a/libcxx/include/complex.h +++ b/libcxx/include/complex.h @@ -17,8 +17,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/complex.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -30,6 +31,6 @@ # elif __has_include_next() # include_next # endif -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_COMPLEX_H diff --git a/libcxx/include/concepts b/libcxx/include/concepts index 2fe5400c2c715..ff3fd153a38d5 100644 --- a/libcxx/include/concepts +++ b/libcxx/include/concepts @@ -129,8 +129,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/concepts> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -168,6 +169,6 @@ namespace std { # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CONCEPTS diff --git a/libcxx/include/condition_variable b/libcxx/include/condition_variable index f351f13b71389..81699bf6adbf7 100644 --- a/libcxx/include/condition_variable +++ b/libcxx/include/condition_variable @@ -118,8 +118,9 @@ public: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/condition_variable> +#else # include <__chrono/duration.h> # include <__chrono/steady_clock.h> # include <__chrono/time_point.h> @@ -367,6 +368,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CONDITION_VARIABLE diff --git a/libcxx/include/coroutine b/libcxx/include/coroutine index c39aa9a3da0ce..d745844da8e9d 100644 --- a/libcxx/include/coroutine +++ b/libcxx/include/coroutine @@ -38,8 +38,9 @@ struct suspend_always; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/coroutine> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -66,6 +67,6 @@ struct suspend_always; # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_COROUTINE diff --git a/libcxx/include/csetjmp b/libcxx/include/csetjmp index bd512720be008..39ab035a5f384 100644 --- a/libcxx/include/csetjmp +++ b/libcxx/include/csetjmp @@ -30,8 +30,9 @@ void longjmp(jmp_buf env, int val); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/csetjmp> +#else # include <__config> // is not provided by libc++ @@ -53,6 +54,6 @@ using ::longjmp _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSETJMP diff --git a/libcxx/include/csignal b/libcxx/include/csignal index 92edf08f683e7..a15d17d3169da 100644 --- a/libcxx/include/csignal +++ b/libcxx/include/csignal @@ -39,8 +39,9 @@ int raise(int sig); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/csignal> +#else # include <__config> // is not provided by libc++ @@ -63,6 +64,6 @@ using ::raise _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSIGNAL diff --git a/libcxx/include/cstdalign b/libcxx/include/cstdalign index ab78344cd36c6..6a277e4673003 100644 --- a/libcxx/include/cstdalign +++ b/libcxx/include/cstdalign @@ -20,8 +20,9 @@ Macros: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/__config> +#else # include <__config> // is not provided by libc++ @@ -53,6 +54,6 @@ using __standard_header_cstdalign _LIBCPP_DEPRECATED = void; using __use_standard_header_cstdalign = __standard_header_cstdalign; # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDALIGN diff --git a/libcxx/include/cstdarg b/libcxx/include/cstdarg index 1930fc95cf851..069fe100880a2 100644 --- a/libcxx/include/cstdarg +++ b/libcxx/include/cstdarg @@ -31,8 +31,9 @@ Types: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstdarg> +#else # include <__config> // is not provided by libc++ @@ -53,6 +54,6 @@ using ::va_list _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDARG diff --git a/libcxx/include/cstdbool b/libcxx/include/cstdbool index a436c5c851a84..a12954f07398c 100644 --- a/libcxx/include/cstdbool +++ b/libcxx/include/cstdbool @@ -19,8 +19,9 @@ Macros: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstdbool> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -41,6 +42,6 @@ using __standard_header_cstdbool _LIBCPP_DEPRECATED = void; using __use_standard_header_cstdbool = __standard_header_cstdbool; # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDBOOL diff --git a/libcxx/include/cstddef b/libcxx/include/cstddef index 2e79d05243666..d86d87bbbb9b5 100644 --- a/libcxx/include/cstddef +++ b/libcxx/include/cstddef @@ -33,8 +33,9 @@ Types: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstddef> +#else # include <__config> # include @@ -57,6 +58,6 @@ Types: # include <__cstddef/nullptr_t.h> # include <__cstddef/ptrdiff_t.h> # include <__cstddef/size_t.h> -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDDEF diff --git a/libcxx/include/cstdint b/libcxx/include/cstdint index 594478930500c..11839eeb071e5 100644 --- a/libcxx/include/cstdint +++ b/libcxx/include/cstdint @@ -140,8 +140,9 @@ Types: } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstdint> +#else # include <__config> # if __has_include() @@ -192,6 +193,6 @@ using ::uintmax_t _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDINT diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio index 1b1a05d264b37..df9da1b4c8784 100644 --- a/libcxx/include/cstdio +++ b/libcxx/include/cstdio @@ -95,8 +95,9 @@ void perror(const char* s); } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstdio> +#else # include <__config> # include <__cstddef/size_t.h> @@ -173,6 +174,6 @@ using ::vprintf _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDIO diff --git a/libcxx/include/cstdlib b/libcxx/include/cstdlib index 03e68957f71e4..adeee29b93fd7 100644 --- a/libcxx/include/cstdlib +++ b/libcxx/include/cstdlib @@ -81,8 +81,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstdlib> +#else # include <__config> # include <__cstddef/size_t.h> @@ -153,6 +154,6 @@ using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTDLIB diff --git a/libcxx/include/cstring b/libcxx/include/cstring index f414885864106..4aa14feeec280 100644 --- a/libcxx/include/cstring +++ b/libcxx/include/cstring @@ -56,8 +56,9 @@ size_t strlen(const char* s); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cstring> +#else # include <__config> # include <__cstddef/size_t.h> # include <__type_traits/is_constant_evaluated.h> @@ -103,6 +104,6 @@ using ::strlen _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CSTRING diff --git a/libcxx/include/ctgmath b/libcxx/include/ctgmath index d8bb64032eca4..237f474f01c24 100644 --- a/libcxx/include/ctgmath +++ b/libcxx/include/ctgmath @@ -18,8 +18,9 @@ */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ctgmath> +#else # include # include @@ -39,6 +40,6 @@ using __use_standard_header_ctgmath = __standard_header_ctgmath; # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CTGMATH diff --git a/libcxx/include/ctime b/libcxx/include/ctime index 6c5b0166f9e42..1e845a8de0930 100644 --- a/libcxx/include/ctime +++ b/libcxx/include/ctime @@ -45,8 +45,9 @@ int timespec_get( struct timespec *ts, int base); // C++17 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ctime> +#else # include <__config> # include <__cstddef/size_t.h> @@ -85,6 +86,6 @@ using ::timespec_get _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CTIME diff --git a/libcxx/include/ctype.h b/libcxx/include/ctype.h index 611f94036a1bd..066f45018bbf5 100644 --- a/libcxx/include/ctype.h +++ b/libcxx/include/ctype.h @@ -29,8 +29,9 @@ int tolower(int c); int toupper(int c); */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ctype.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -59,6 +60,6 @@ int toupper(int c); # undef toupper # endif -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CTYPE_H diff --git a/libcxx/include/cuchar b/libcxx/include/cuchar index 3ace72f1f8b1f..38505eb336f84 100644 --- a/libcxx/include/cuchar +++ b/libcxx/include/cuchar @@ -36,8 +36,9 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cuchar> +#else # include <__config> # include <__cstddef/size_t.h> @@ -71,8 +72,9 @@ using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS; using ::c32rtomb _LIBCPP_USING_IF_EXISTS; # endif // _LIBCPP_CXX03_LANG -#endif // 0 _LIBCPP_END_NAMESPACE_STD +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) + #endif // _LIBCPP_CUCHAR diff --git a/libcxx/include/cwchar b/libcxx/include/cwchar index f97d9c43433a1..4a4b052831a9a 100644 --- a/libcxx/include/cwchar +++ b/libcxx/include/cwchar @@ -102,8 +102,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cwchar> +#else # include <__config> # include <__cstddef/size_t.h> # include <__type_traits/copy_cv.h> @@ -259,6 +260,6 @@ _LIBCPP_END_NAMESPACE_STD # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CWCHAR diff --git a/libcxx/include/cwctype b/libcxx/include/cwctype index 848aadd8a1d11..b7f9cbb835e32 100644 --- a/libcxx/include/cwctype +++ b/libcxx/include/cwctype @@ -49,8 +49,9 @@ wctrans_t wctrans(const char* property); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/cwctype> +#else # include <__config> # include @@ -96,6 +97,6 @@ using ::wctrans _LIBCPP_USING_IF_EXISTS; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_CWCTYPE diff --git a/libcxx/include/deque b/libcxx/include/deque index 63eb836553106..883332f1ebdcb 100644 --- a/libcxx/include/deque +++ b/libcxx/include/deque @@ -177,8 +177,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/deque> +#else # include <__algorithm/copy.h> # include <__algorithm/copy_backward.h> # include <__algorithm/copy_n.h> @@ -2648,6 +2649,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_DEQUE diff --git a/libcxx/include/errno.h b/libcxx/include/errno.h index 648d22e98846b..692f00f022c53 100644 --- a/libcxx/include/errno.h +++ b/libcxx/include/errno.h @@ -22,8 +22,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/errno.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -397,6 +398,6 @@ static const int __elast2 = 105; # endif # endif // __cplusplus -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ERRNO_H diff --git a/libcxx/include/exception b/libcxx/include/exception index 6565f1b4641d1..74229cd16c006 100644 --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -76,8 +76,9 @@ template void rethrow_if_nested(const E& e); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/exception> +#else # include <__config> # include <__exception/exception.h> # include <__exception/exception_ptr.h> @@ -96,6 +97,6 @@ template void rethrow_if_nested(const E& e); # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_EXCEPTION diff --git a/libcxx/include/execution b/libcxx/include/execution index e8ef8b1e6ee79..7c695997cd047 100644 --- a/libcxx/include/execution +++ b/libcxx/include/execution @@ -32,8 +32,9 @@ namespace std { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/execution> +#else # include <__config> # include <__type_traits/is_execution_policy.h> # include <__type_traits/is_same.h> @@ -147,6 +148,6 @@ _LIBCPP_END_NAMESPACE_STD # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_EXECUTION diff --git a/libcxx/include/expected b/libcxx/include/expected index ac2415ff5a62d..38038d328f17d 100644 --- a/libcxx/include/expected +++ b/libcxx/include/expected @@ -38,8 +38,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/expected> +#else # include <__config> # if _LIBCPP_STD_VER >= 23 @@ -54,6 +55,6 @@ namespace std { # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_EXPECTED diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator index 5075de537b6ac..8448654e8d94c 100644 --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -52,8 +52,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/iterator> +#else # include <__config> # include <__memory/addressof.h> # include <__ostream/basic_ostream.h> @@ -128,6 +129,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_EXPERIMENTAL_ITERATOR diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory index cb02ecb8e2bee..1daa1cc4f3ed7 100644 --- a/libcxx/include/experimental/memory +++ b/libcxx/include/experimental/memory @@ -49,8 +49,9 @@ public: } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/memory> +#else # include <__config> # include <__cstddef/nullptr_t.h> # include <__cstddef/size_t.h> @@ -199,6 +200,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif /* _LIBCPP_EXPERIMENTAL_MEMORY */ diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const index 4d06e9f844acf..8af3be366ad58 100644 --- a/libcxx/include/experimental/propagate_const +++ b/libcxx/include/experimental/propagate_const @@ -107,8 +107,9 @@ */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/propagate_const> +#else # include <__config> # include <__cstddef/nullptr_t.h> # include <__cstddef/size_t.h> @@ -491,6 +492,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd index 374ab57cdbca5..224cc75ba0eb0 100644 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -75,8 +75,9 @@ inline namespace parallelism_v2 { # pragma GCC system_header #endif -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/simd> +#else # include <__config> # include # include @@ -90,6 +91,6 @@ inline namespace parallelism_v2 { # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif /* _LIBCPP_EXPERIMENTAL_SIMD */ diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits index 0da95b79f8ab7..0353526bc8f66 100644 --- a/libcxx/include/experimental/type_traits +++ b/libcxx/include/experimental/type_traits @@ -68,8 +68,9 @@ inline namespace fundamentals_v1 { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/type_traits> +#else # include <__config> # if _LIBCPP_STD_VER >= 14 @@ -155,6 +156,6 @@ _LIBCPP_END_NAMESPACE_LFTS # endif # endif /* _LIBCPP_STD_VER >= 14 */ -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */ diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility index 1cb9c6a3617a8..0c9b2b0c789ca 100644 --- a/libcxx/include/experimental/utility +++ b/libcxx/include/experimental/utility @@ -30,8 +30,9 @@ inline namespace fundamentals_v1 { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/experimental/utility> +#else # include <__config> # include @@ -48,6 +49,6 @@ _LIBCPP_END_NAMESPACE_LFTS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif /* _LIBCPP_EXPERIMENTAL_UTILITY */ diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map index c9e35479b88c8..c0336620cf88f 100644 --- a/libcxx/include/ext/hash_map +++ b/libcxx/include/ext/hash_map @@ -201,8 +201,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ext/hash_map> +#else # include <__config> # include <__hash_table> # include @@ -870,6 +871,6 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multimap<_Key, _Tp, _Has # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_HASH_MAP diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set index 073fcf2fd9911..2f86649d6e983 100644 --- a/libcxx/include/ext/hash_set +++ b/libcxx/include/ext/hash_set @@ -192,8 +192,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ext/hash_set> +#else # include <__config> # include <__hash_table> # include @@ -582,6 +583,6 @@ inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const hash_multiset<_Value, _Hash, # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_HASH_SET diff --git a/libcxx/include/fenv.h b/libcxx/include/fenv.h index dddf59d47f021..157c24faa1042 100644 --- a/libcxx/include/fenv.h +++ b/libcxx/include/fenv.h @@ -49,8 +49,9 @@ int feupdateenv(const fenv_t* envp); */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/fenv.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -112,6 +113,6 @@ extern "C++" { } // extern "C++" # endif // defined(__cplusplus) -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FENV_H diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem index f6f5dcb1cc405..f9eb0ea1e24d2 100644 --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -533,8 +533,9 @@ inline constexpr bool std::ranges::enable_view +#else # include <__config> # if _LIBCPP_STD_VER >= 17 @@ -575,6 +576,6 @@ inline constexpr bool std::ranges::enable_view # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FILESYSTEM diff --git a/libcxx/include/flat_map b/libcxx/include/flat_map index 1f2c204e2ef21..dbe5d8ee8f8c3 100644 --- a/libcxx/include/flat_map +++ b/libcxx/include/flat_map @@ -37,8 +37,9 @@ namespace std { erase_if(flat_map& c, Predicate pred); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/__config> +#else # include <__config> # if _LIBCPP_STD_VER >= 23 @@ -56,6 +57,6 @@ namespace std { # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FLAT_MAP diff --git a/libcxx/include/float.h b/libcxx/include/float.h index 2874323538b70..a6e79db912487 100644 --- a/libcxx/include/float.h +++ b/libcxx/include/float.h @@ -70,8 +70,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/float.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -93,6 +94,6 @@ # endif # endif // __cplusplus -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FLOAT_H diff --git a/libcxx/include/format b/libcxx/include/format index 6ac1e928b26a5..ecf8f7ce1eedb 100644 --- a/libcxx/include/format +++ b/libcxx/include/format @@ -191,8 +191,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/format> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -258,6 +259,6 @@ namespace std { # include # endif # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FORMAT diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list index 23e8e51632171..c1ab155d5a133 100644 --- a/libcxx/include/forward_list +++ b/libcxx/include/forward_list @@ -195,8 +195,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/forward_list> +#else # include <__algorithm/comp.h> # include <__algorithm/lexicographical_compare.h> # include <__algorithm/lexicographical_compare_three_way.h> @@ -1586,6 +1587,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FORWARD_LIST diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 9722440808e36..f0e9425e0a53d 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -186,8 +186,9 @@ typedef basic_fstream wfstream; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/fstream> +#else # include <__algorithm/max.h> # include <__assert> # include <__config> @@ -1585,6 +1586,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 23 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FSTREAM diff --git a/libcxx/include/functional b/libcxx/include/functional index 69f71314f0514..4bb163fd1f33c 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -527,8 +527,9 @@ POLICY: For non-variadic implementations, the number of arguments is limited */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/functional> +#else # include <__config> # include <__functional/binary_function.h> @@ -596,6 +597,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FUNCTIONAL diff --git a/libcxx/include/future b/libcxx/include/future index 3a612d80bc85c..95a51fa425e41 100644 --- a/libcxx/include/future +++ b/libcxx/include/future @@ -362,8 +362,9 @@ template struct uses_allocator, Alloc>; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/future> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -2084,6 +2085,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_FUTURE diff --git a/libcxx/include/initializer_list b/libcxx/include/initializer_list index 46ffb95f83a69..07c51f32fee7d 100644 --- a/libcxx/include/initializer_list +++ b/libcxx/include/initializer_list @@ -42,8 +42,9 @@ template const E* end(initializer_list il) noexcept; // constexpr in */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/initializer_list> +#else # include <__config> # include <__cstddef/size_t.h> # include @@ -101,6 +102,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Ep* end(initia # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_INITIALIZER_LIST diff --git a/libcxx/include/inttypes.h b/libcxx/include/inttypes.h index 552324516c11f..1869284550e90 100644 --- a/libcxx/include/inttypes.h +++ b/libcxx/include/inttypes.h @@ -235,8 +235,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/inttypes.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -262,6 +263,6 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int # undef imaxdiv # endif // __cplusplus -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_INTTYPES_H diff --git a/libcxx/include/iomanip b/libcxx/include/iomanip index 84842dc3fa6ca..a97b4a94d232f 100644 --- a/libcxx/include/iomanip +++ b/libcxx/include/iomanip @@ -42,8 +42,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/iomanip> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -563,6 +564,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_IOMANIP diff --git a/libcxx/include/ios b/libcxx/include/ios index 23e8fdf1a6075..7c2ee83d4624b 100644 --- a/libcxx/include/ios +++ b/libcxx/include/ios @@ -211,8 +211,9 @@ storage-class-specifier const error_category& iostream_category() noexcept; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ios> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -891,6 +892,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_IOS diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd index 3f8a4cd3d4d8c..708134daf98c9 100644 --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -105,8 +105,9 @@ using wosyncstream = basic_osyncstream; // C++20 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/iosfwd> +#else # include <__config> # include <__fwd/fstream.h> # include <__fwd/ios.h> @@ -185,6 +186,6 @@ public: _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_IOSFWD diff --git a/libcxx/include/iostream b/libcxx/include/iostream index 067a7c111f437..0e83f0002ae6e 100644 --- a/libcxx/include/iostream +++ b/libcxx/include/iostream @@ -33,8 +33,9 @@ extern wostream wclog; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/iostream> +#else # include <__config> # include @@ -66,6 +67,6 @@ extern _LIBCPP_EXPORTED_FROM_ABI wostream wclog; _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_IOSTREAM diff --git a/libcxx/include/istream b/libcxx/include/istream index c2edc9ab22608..4b177c41cc325 100644 --- a/libcxx/include/istream +++ b/libcxx/include/istream @@ -158,8 +158,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/istream> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -1383,6 +1384,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ISTREAM diff --git a/libcxx/include/iterator b/libcxx/include/iterator index b9bc188110685..74ee712b945b3 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -679,8 +679,9 @@ template constexpr const E* data(initializer_list il) noexcept; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/iterator> +#else # include <__config> # include <__iterator/access.h> # include <__iterator/advance.h> @@ -753,6 +754,6 @@ template constexpr const E* data(initializer_list il) noexcept; # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_ITERATOR diff --git a/libcxx/include/latch b/libcxx/include/latch index d21b689cc4815..471ef143e8d5a 100644 --- a/libcxx/include/latch +++ b/libcxx/include/latch @@ -40,8 +40,9 @@ namespace std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/latch> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -129,6 +130,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_LATCH diff --git a/libcxx/include/limits b/libcxx/include/limits index c27950f42106d..1c1a0b29b7187 100644 --- a/libcxx/include/limits +++ b/libcxx/include/limits @@ -102,8 +102,9 @@ template<> class numeric_limits; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/limits> +#else # include <__config> # include <__type_traits/is_arithmetic.h> # include <__type_traits/is_signed.h> @@ -535,6 +536,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_LIMITS diff --git a/libcxx/include/list b/libcxx/include/list index a9d14272742bd..5e2fd40d6ee9d 100644 --- a/libcxx/include/list +++ b/libcxx/include/list @@ -197,8 +197,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/list> +#else # include <__algorithm/comp.h> # include <__algorithm/equal.h> # include <__algorithm/lexicographical_compare.h> @@ -1749,6 +1750,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_LIST diff --git a/libcxx/include/locale b/libcxx/include/locale index 8421dc696106a..981f25ed1e98c 100644 --- a/libcxx/include/locale +++ b/libcxx/include/locale @@ -187,8 +187,9 @@ template class messages_byname; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/locale> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -3700,6 +3701,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_LOCALE diff --git a/libcxx/include/map b/libcxx/include/map index 90f807f89bdcf..76d32ad883d6a 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -571,8 +571,9 @@ erase_if(multimap& c, Predicate pred); // C++20 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/map> +#else # include <__algorithm/equal.h> # include <__algorithm/lexicographical_compare.h> # include <__algorithm/lexicographical_compare_three_way.h> @@ -2203,6 +2204,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_MAP diff --git a/libcxx/include/math.h b/libcxx/include/math.h index c338d3225dd55..de2dacde282c1 100644 --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -291,8 +291,9 @@ long double truncl(long double x); */ -# if 0 -# else // 0 +# if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/math.h> +# else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -504,7 +505,7 @@ using std::__math::trunc; } // extern "C++" # endif // __cplusplus -# endif // 0 +# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #else // _LIBCPP_MATH_H diff --git a/libcxx/include/mdspan b/libcxx/include/mdspan index 02582c6f39c15..a67ed1834e3bd 100644 --- a/libcxx/include/mdspan +++ b/libcxx/include/mdspan @@ -408,8 +408,9 @@ namespace std { #ifndef _LIBCPP_MDSPAN #define _LIBCPP_MDSPAN -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/mdspan> +#else # include <__config> # if _LIBCPP_STD_VER >= 23 @@ -427,6 +428,6 @@ namespace std { # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_MDSPAN diff --git a/libcxx/include/memory b/libcxx/include/memory index 883666b9e1bef..fc62606ea0fd3 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -934,8 +934,9 @@ template // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/memory> +#else # include <__config> # include <__memory/addressof.h> # include <__memory/align.h> @@ -996,6 +997,6 @@ template # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_MEMORY diff --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource index e852e96536c97..5464fc09c7cdc 100644 --- a/libcxx/include/memory_resource +++ b/libcxx/include/memory_resource @@ -49,8 +49,9 @@ namespace std::pmr { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/memory_resource> +#else # include <__config> # if _LIBCPP_STD_VER >= 17 @@ -75,6 +76,6 @@ namespace std::pmr { # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif /* _LIBCPP_MEMORY_RESOURCE */ diff --git a/libcxx/include/mutex b/libcxx/include/mutex index b699439c5ce5a..9b128e8710aae 100644 --- a/libcxx/include/mutex +++ b/libcxx/include/mutex @@ -186,8 +186,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/mutex> +#else # include <__chrono/steady_clock.h> # include <__chrono/time_point.h> # include <__condition_variable/condition_variable.h> @@ -512,6 +513,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_MUTEX diff --git a/libcxx/include/new b/libcxx/include/new index 8dd726f63a0e7..4d72ec27675c9 100644 --- a/libcxx/include/new +++ b/libcxx/include/new @@ -86,8 +86,9 @@ void operator delete[](void* ptr, void*) noexcept; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/new> +#else # include <__config> # include <__new/align_val_t.h> # include <__new/allocate.h> @@ -118,6 +119,6 @@ void operator delete[](void* ptr, void*) noexcept; # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_NEW diff --git a/libcxx/include/numbers b/libcxx/include/numbers index 41ee888ba8a9c..7c9e38ecb9da9 100644 --- a/libcxx/include/numbers +++ b/libcxx/include/numbers @@ -58,8 +58,9 @@ namespace std::numbers { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/numbers> +#else # include <__concepts/arithmetic.h> # include <__config> # include @@ -163,6 +164,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_NUMBERS diff --git a/libcxx/include/numeric b/libcxx/include/numeric index 6055524b04997..2f2b86136fb98 100644 --- a/libcxx/include/numeric +++ b/libcxx/include/numeric @@ -156,8 +156,9 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/numeric> +#else # include <__config> # include <__numeric/accumulate.h> @@ -205,6 +206,6 @@ constexpr T saturate_cast(U x) noexcept; // freestanding, Sin # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_NUMERIC diff --git a/libcxx/include/optional b/libcxx/include/optional index 1556b8b8fd942..165e0f16cab90 100644 --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -177,8 +177,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/optional> +#else # include <__assert> # include <__compare/compare_three_way_result.h> # include <__compare/ordering.h> @@ -1306,6 +1307,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_OPTIONAL diff --git a/libcxx/include/ostream b/libcxx/include/ostream index 900863c035be7..4a627a07a4a2f 100644 --- a/libcxx/include/ostream +++ b/libcxx/include/ostream @@ -172,8 +172,9 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ostream> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -204,6 +205,6 @@ void vprint_nonunicode(ostream& os, string_view fmt, format_args args); # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_OSTREAM diff --git a/libcxx/include/print b/libcxx/include/print index 3d846aeab3a88..1794d6014efcd 100644 --- a/libcxx/include/print +++ b/libcxx/include/print @@ -33,8 +33,9 @@ namespace std { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/print> +#else # include <__assert> # include <__concepts/same_as.h> # include <__config> @@ -401,6 +402,6 @@ _LIBCPP_HIDE_FROM_ABI inline void vprint_nonunicode(string_view __fmt, format_ar _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_PRINT diff --git a/libcxx/include/queue b/libcxx/include/queue index bebea92fc7425..ff69d75591deb 100644 --- a/libcxx/include/queue +++ b/libcxx/include/queue @@ -254,8 +254,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/queue> +#else # include <__algorithm/make_heap.h> # include <__algorithm/pop_heap.h> # include <__algorithm/push_heap.h> @@ -954,6 +955,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_QUEUE diff --git a/libcxx/include/random b/libcxx/include/random index 08e9c384538f5..a2fc2bd5197e5 100644 --- a/libcxx/include/random +++ b/libcxx/include/random @@ -1677,8 +1677,9 @@ class piecewise_linear_distribution } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/random> +#else # include <__config> # include <__random/bernoulli_distribution.h> # include <__random/binomial_distribution.h> @@ -1740,6 +1741,6 @@ class piecewise_linear_distribution # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_RANDOM diff --git a/libcxx/include/ranges b/libcxx/include/ranges index 2c6057e30420a..9ef614d21f525 100644 --- a/libcxx/include/ranges +++ b/libcxx/include/ranges @@ -380,8 +380,9 @@ namespace std { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ranges> +#else # include <__config> # if _LIBCPP_STD_VER >= 20 @@ -453,6 +454,6 @@ namespace std { # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_RANGES diff --git a/libcxx/include/ratio b/libcxx/include/ratio index 9e56eacae0f2d..b35e2bd9dad65 100644 --- a/libcxx/include/ratio +++ b/libcxx/include/ratio @@ -81,8 +81,9 @@ using quetta = ratio <1'000'000'000'000'000'000'000'000'000'000, 1>; // Since C+ } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/ratio> +#else # include <__config> # include <__type_traits/integral_constant.h> # include @@ -493,6 +494,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_RATIO diff --git a/libcxx/include/regex b/libcxx/include/regex index 1983ca9d9ff80..15ec15a6985e2 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -789,8 +789,9 @@ typedef regex_token_iterator wsregex_token_iterator; } // std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/regex> +#else # include <__algorithm/find.h> # include <__algorithm/search.h> # include <__assert> @@ -5834,6 +5835,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_REGEX diff --git a/libcxx/include/scoped_allocator b/libcxx/include/scoped_allocator index c207ac07bdc4d..94a35f64603ba 100644 --- a/libcxx/include/scoped_allocator +++ b/libcxx/include/scoped_allocator @@ -109,8 +109,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/scoped_allocator> +#else # include <__config> # include <__memory/allocator_traits.h> # include <__memory/uses_allocator_construction.h> @@ -571,6 +572,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SCOPED_ALLOCATOR diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore index 82f9726a96f62..4194dbe91b481 100644 --- a/libcxx/include/semaphore +++ b/libcxx/include/semaphore @@ -45,8 +45,9 @@ using binary_semaphore = counting_semaphore<1>; // since C++20 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/semaphore> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -186,6 +187,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SEMAPHORE diff --git a/libcxx/include/set b/libcxx/include/set index c4b0b018f27c4..2784e82760d7e 100644 --- a/libcxx/include/set +++ b/libcxx/include/set @@ -512,8 +512,9 @@ erase_if(multiset& c, Predicate pred); // C++20 */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/set> +#else # include <__algorithm/equal.h> # include <__algorithm/lexicographical_compare.h> # include <__algorithm/lexicographical_compare_three_way.h> @@ -1524,6 +1525,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SET diff --git a/libcxx/include/shared_mutex b/libcxx/include/shared_mutex index a6615ea8962fd..6738efeedb3c2 100644 --- a/libcxx/include/shared_mutex +++ b/libcxx/include/shared_mutex @@ -122,8 +122,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/shared_mutex> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -462,6 +463,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SHARED_MUTEX diff --git a/libcxx/include/source_location b/libcxx/include/source_location index faa6b0eeb6c00..bbbb86bc68c83 100644 --- a/libcxx/include/source_location +++ b/libcxx/include/source_location @@ -25,8 +25,9 @@ namespace std { } */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/source_location> +#else # include <__config> # include # include @@ -84,6 +85,6 @@ public: _LIBCPP_END_NAMESPACE_STD -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SOURCE_LOCATION diff --git a/libcxx/include/span b/libcxx/include/span index 2d43d1d1079e4..5bb09ec515cea 100644 --- a/libcxx/include/span +++ b/libcxx/include/span @@ -144,8 +144,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/span> +#else # include <__assert> # include <__concepts/convertible_to.h> # include <__concepts/equality_comparable.h> @@ -640,6 +641,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SPAN diff --git a/libcxx/include/sstream b/libcxx/include/sstream index 920c29dee62f3..5dcfb446a5d6a 100644 --- a/libcxx/include/sstream +++ b/libcxx/include/sstream @@ -312,8 +312,9 @@ typedef basic_stringstream wstringstream; // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/sstream> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -1291,6 +1292,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SSTREAM diff --git a/libcxx/include/stack b/libcxx/include/stack index da3dcf0216aea..3ff3df2c9650f 100644 --- a/libcxx/include/stack +++ b/libcxx/include/stack @@ -113,8 +113,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stack> +#else # include <__algorithm/ranges_copy.h> # include <__config> # include <__fwd/stack.h> @@ -377,6 +378,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STACK diff --git a/libcxx/include/stdatomic.h b/libcxx/include/stdatomic.h index 8c96bd636dd45..a0b46e3b7bc17 100644 --- a/libcxx/include/stdatomic.h +++ b/libcxx/include/stdatomic.h @@ -117,8 +117,9 @@ using std::atomic_signal_fence // see below */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stdatomic.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -237,6 +238,6 @@ using std::atomic_thread_fence _LIBCPP_USING_IF_EXISTS; # endif # endif // defined(__cplusplus) -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDATOMIC_H diff --git a/libcxx/include/stdbool.h b/libcxx/include/stdbool.h index 9f1779e992c72..c34853b97b854 100644 --- a/libcxx/include/stdbool.h +++ b/libcxx/include/stdbool.h @@ -19,8 +19,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stdbool.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -38,6 +39,6 @@ # undef __bool_true_false_are_defined # define __bool_true_false_are_defined 1 # endif -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDBOOL_H diff --git a/libcxx/include/stddef.h b/libcxx/include/stddef.h index 66ad85fe631de..46bed2a1e1a68 100644 --- a/libcxx/include/stddef.h +++ b/libcxx/include/stddef.h @@ -24,8 +24,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stddef.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -42,6 +43,6 @@ # ifdef __cplusplus typedef decltype(nullptr) nullptr_t; # endif -# endif // 0 +# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDDEF_H diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept index 58c55092026a9..85e11629bd6e3 100644 --- a/libcxx/include/stdexcept +++ b/libcxx/include/stdexcept @@ -41,8 +41,9 @@ public: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stdexcept> +#else # include <__config> # include <__exception/exception.h> # include <__fwd/string.h> @@ -286,6 +287,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDEXCEPT diff --git a/libcxx/include/stdio.h b/libcxx/include/stdio.h index 7c73671ade08f..d1e57b08f5da4 100644 --- a/libcxx/include/stdio.h +++ b/libcxx/include/stdio.h @@ -87,8 +87,9 @@ int ferror(FILE* stream); void perror(const char* s); */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stdio.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -120,6 +121,6 @@ void perror(const char* s); # undef getchar # endif -# endif // 0 +# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDIO_H diff --git a/libcxx/include/stdlib.h b/libcxx/include/stdlib.h index b8a28809a951c..e32b7b7d751b3 100644 --- a/libcxx/include/stdlib.h +++ b/libcxx/include/stdlib.h @@ -73,8 +73,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11 */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stdlib.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -147,7 +148,7 @@ inline _LIBCPP_HIDE_FROM_ABI lldiv_t div(long long __x, long long __y) _NOEXCEPT # endif # endif // _LIBCPP_MSVCRT } // extern "C++" -# endif // __cplusplus -# endif // 0 +# endif // __cplusplus +# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STDLIB_H diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token index 6a6d1330248c7..d240dd77a9136 100644 --- a/libcxx/include/stop_token +++ b/libcxx/include/stop_token @@ -31,8 +31,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/stop_token> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -55,6 +56,6 @@ namespace std { # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STOP_TOKEN diff --git a/libcxx/include/streambuf b/libcxx/include/streambuf index 12f6b319f70e9..7f02a9b331411 100644 --- a/libcxx/include/streambuf +++ b/libcxx/include/streambuf @@ -107,8 +107,9 @@ protected: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/streambuf> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -448,6 +449,6 @@ _LIBCPP_POP_MACROS # if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STREAMBUF diff --git a/libcxx/include/string b/libcxx/include/string index e96237488b80c..7808f56f60017 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -586,8 +586,9 @@ basic_string operator""s( const char32_t *str, size_t len ); // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/string> +#else # include <__algorithm/max.h> # include <__algorithm/min.h> # include <__algorithm/remove.h> @@ -2495,7 +2496,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir __alloc_traits::deallocate(__alloc_, __get_long_pointer(), __get_long_cap()); throw; } -# endif // _LIBCPP_HAS_EXCEPTIONS +# endif // _LIBCPP_HAS_EXCEPTIONS __annotate_new(__sz); } @@ -4347,6 +4348,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STRING diff --git a/libcxx/include/string.h b/libcxx/include/string.h index 58a4bcbc3e704..6bdcd6a6eecbd 100644 --- a/libcxx/include/string.h +++ b/libcxx/include/string.h @@ -51,8 +51,9 @@ size_t strlen(const char* s); */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/string.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -109,6 +110,6 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD char* strstr(char* __s1, } } // extern "C++" # endif -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STRING_H diff --git a/libcxx/include/string_view b/libcxx/include/string_view index a62d75a008c0c..e79746318cfa6 100644 --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -205,8 +205,9 @@ namespace std { // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/string_view> +#else # include <__algorithm/min.h> # include <__assert> # include <__config> @@ -949,6 +950,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STRING_VIEW diff --git a/libcxx/include/strstream b/libcxx/include/strstream index 81dbdf14d9e6a..90d56694e7a6c 100644 --- a/libcxx/include/strstream +++ b/libcxx/include/strstream @@ -129,8 +129,9 @@ private: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/strstream> +#else # include <__config> # include <__ostream/basic_ostream.h> # include @@ -350,6 +351,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS # endif // _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM) || defined(_LIBCPP_BUILDING_LIBRARY) -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_STRSTREAM diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream index f801132d436b4..82761be765420 100644 --- a/libcxx/include/syncstream +++ b/libcxx/include/syncstream @@ -117,8 +117,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/syncstream> +#else # include <__config> # if _LIBCPP_HAS_LOCALIZATION @@ -518,6 +519,6 @@ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS # endif // _LIBCPP_HAS_LOCALIZATION -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SYNCSTREAM diff --git a/libcxx/include/system_error b/libcxx/include/system_error index 351e26fd47350..4dadc0a6ab483 100644 --- a/libcxx/include/system_error +++ b/libcxx/include/system_error @@ -144,8 +144,9 @@ template <> struct hash; */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/system_error> +#else # include <__config> # include <__system_error/errc.h> # include <__system_error/error_category.h> @@ -169,6 +170,6 @@ template <> struct hash; # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_SYSTEM_ERROR diff --git a/libcxx/include/tgmath.h b/libcxx/include/tgmath.h index 41cae5c2318c1..3f8f14fd579a9 100644 --- a/libcxx/include/tgmath.h +++ b/libcxx/include/tgmath.h @@ -17,8 +17,9 @@ */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/tgmath.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -33,6 +34,6 @@ # include_next # endif # endif -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_TGMATH_H diff --git a/libcxx/include/thread b/libcxx/include/thread index 719ebe9a7a237..029ed418e2070 100644 --- a/libcxx/include/thread +++ b/libcxx/include/thread @@ -86,8 +86,9 @@ void sleep_for(const chrono::duration& rel_time); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/thread> +#else # include <__config> # if _LIBCPP_HAS_THREADS @@ -127,6 +128,6 @@ void sleep_for(const chrono::duration& rel_time); # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_THREAD diff --git a/libcxx/include/tuple b/libcxx/include/tuple index 035c67a12f856..016cdda6decb8 100644 --- a/libcxx/include/tuple +++ b/libcxx/include/tuple @@ -210,8 +210,9 @@ template // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/tuple> +#else # include <__compare/common_comparison_category.h> # include <__compare/ordering.h> # include <__compare/synth_three_way.h> @@ -1421,6 +1422,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_TUPLE diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index d7fa8c3ad8f2e..ffcddb0176615 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -424,8 +424,9 @@ namespace std */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/type_traits> +#else # include <__config> # include <__type_traits/add_cv_quals.h> # include <__type_traits/add_lvalue_reference.h> @@ -529,6 +530,6 @@ namespace std # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_TYPE_TRAITS diff --git a/libcxx/include/typeindex b/libcxx/include/typeindex index 5ecba006ff1c1..76faee4bf199e 100644 --- a/libcxx/include/typeindex +++ b/libcxx/include/typeindex @@ -45,8 +45,9 @@ struct hash */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/typeindex> +#else # include <__config> # include <__functional/unary_function.h> # include @@ -105,6 +106,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_TYPEINDEX diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo index 8d3ebea08d8dd..799c6ebd5ecbb 100644 --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -56,8 +56,9 @@ public: */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/typeinfo> +#else # include <__config> # include <__cstddef/size_t.h> # include <__exception/exception.h> @@ -390,6 +391,6 @@ _LIBCPP_END_NAMESPACE_STD # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_TYPEINFO diff --git a/libcxx/include/uchar.h b/libcxx/include/uchar.h index 440e00511a660..01e1d57db7454 100644 --- a/libcxx/include/uchar.h +++ b/libcxx/include/uchar.h @@ -32,8 +32,9 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/uchar.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -54,6 +55,6 @@ size_t c32rtomb(char* s, char32_t c32, mbstate_t* ps); # endif # endif // _LIBCPP_CXX03_LANG -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_UCHAR_H diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map index e55b7b7ef1403..0ae4138491774 100644 --- a/libcxx/include/unordered_map +++ b/libcxx/include/unordered_map @@ -583,8 +583,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/unordered_map> +#else # include <__algorithm/is_permutation.h> # include <__assert> # include <__config> @@ -2571,6 +2572,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_UNORDERED_MAP diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set index 6f243e0235ce9..87f0a9f438eff 100644 --- a/libcxx/include/unordered_set +++ b/libcxx/include/unordered_set @@ -531,8 +531,9 @@ template // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/unordered_set> +#else # include <__algorithm/is_permutation.h> # include <__assert> # include <__config> @@ -1843,6 +1844,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_UNORDERED_SET diff --git a/libcxx/include/utility b/libcxx/include/utility index c761a83000f34..fb8a6f81350be 100644 --- a/libcxx/include/utility +++ b/libcxx/include/utility @@ -246,8 +246,9 @@ template */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/utility> +#else # include <__config> # include <__utility/declval.h> @@ -308,6 +309,6 @@ template # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_UTILITY diff --git a/libcxx/include/valarray b/libcxx/include/valarray index ef94dde9bc887..d0b76ee06e796 100644 --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -343,8 +343,9 @@ template unspecified2 end(const valarray& v); */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/valarray> +#else # include <__algorithm/copy.h> # include <__algorithm/count.h> # include <__algorithm/fill.h> @@ -3361,6 +3362,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_VALARRAY diff --git a/libcxx/include/variant b/libcxx/include/variant index 7d2788e2414ea..3fa1b4b30f058 100644 --- a/libcxx/include/variant +++ b/libcxx/include/variant @@ -212,8 +212,9 @@ namespace std { */ -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/variant> +#else # include <__compare/common_comparison_category.h> # include <__compare/compare_three_way_result.h> # include <__compare/ordering.h> @@ -1636,6 +1637,6 @@ _LIBCPP_POP_MACROS # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_VARIANT diff --git a/libcxx/include/vector b/libcxx/include/vector index a35686f56b0d5..9fa81dcb7e76e 100644 --- a/libcxx/include/vector +++ b/libcxx/include/vector @@ -304,8 +304,9 @@ template requires is-vector-bool-reference // Since C++ // clang-format on -#if 0 -#else // 0 +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/vector> +#else # include <__config> # include <__vector/comparison.h> @@ -368,6 +369,6 @@ template requires is-vector-bool-reference // Since C++ # include # include # endif -#endif // 0 +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_VECTOR diff --git a/libcxx/include/version b/libcxx/include/version index fc57aeade9daf..23cffd960e5d3 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -269,11 +269,14 @@ __cpp_lib_void_t 201411L */ -#include <__config> +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/version> +#else +# include <__config> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif // clang-format off @@ -581,6 +584,8 @@ __cpp_lib_void_t 201411L # define __cpp_lib_variant 202306L #endif +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) + // clang-format on #endif // _LIBCPP_VERSIONH diff --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h index 85f16fcf476f2..436027b7842ae 100644 --- a/libcxx/include/wchar.h +++ b/libcxx/include/wchar.h @@ -94,8 +94,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len, */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/wchar.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -205,6 +206,6 @@ size_t wcsnrtombs( } // extern "C" # endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__) # endif // _LIBCPP_HAS_WIDE_CHARACTERS -# endif // 0 +# endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_WCHAR_H diff --git a/libcxx/include/wctype.h b/libcxx/include/wctype.h index fb48d495e0392..9a5b163ba43a9 100644 --- a/libcxx/include/wctype.h +++ b/libcxx/include/wctype.h @@ -44,8 +44,9 @@ wctrans_t wctrans(const char* property); */ -#if 0 -#else // 0 +#if defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/wctype.h> +#else # include <__config> # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -88,6 +89,6 @@ wctrans_t wctrans(const char* property); # undef wctrans # endif // __cplusplus -#endif // 0 +#endif // defined(__cplusplus) && __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) #endif // _LIBCPP_WCTYPE_H diff --git a/libcxx/test/libcxx/algorithms/half_positive.pass.cpp b/libcxx/test/libcxx/algorithms/half_positive.pass.cpp index 40f4697419572..88a18e8592921 100644 --- a/libcxx/test/libcxx/algorithms/half_positive.pass.cpp +++ b/libcxx/test/libcxx/algorithms/half_positive.pass.cpp @@ -11,6 +11,8 @@ // __half_positive divides an integer number by 2 as unsigned number for known types. // It can be an important optimization for lower bound, for example. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__algorithm/half_positive.h> #include #include diff --git a/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp b/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp index 21e9003c30b70..390c6b6db190d 100644 --- a/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp +++ b/libcxx/test/libcxx/assertions/customize_verbose_abort.link-time.pass.cpp @@ -12,6 +12,8 @@ // failures when back-deploying. // XFAIL: availability-verbose_abort-missing +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__verbose_abort> #include diff --git a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp index 0cc4b1e005226..803868b757794 100644 --- a/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp +++ b/libcxx/test/libcxx/assertions/default_verbose_abort.pass.cpp @@ -9,6 +9,8 @@ // Test that the default verbose termination function aborts the program. // XFAIL: availability-verbose_abort-missing +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__verbose_abort> #include #include diff --git a/libcxx/test/libcxx/assertions/modes/none.pass.cpp b/libcxx/test/libcxx/assertions/modes/none.pass.cpp index 8332848c1a8e0..b64290a31a129 100644 --- a/libcxx/test/libcxx/assertions/modes/none.pass.cpp +++ b/libcxx/test/libcxx/assertions/modes/none.pass.cpp @@ -11,6 +11,8 @@ // REQUIRES: libcpp-hardening-mode=none +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__assert> #include diff --git a/libcxx/test/libcxx/assertions/single_expression.pass.cpp b/libcxx/test/libcxx/assertions/single_expression.pass.cpp index 13253e4cb6ef5..474edc9dc0833 100644 --- a/libcxx/test/libcxx/assertions/single_expression.pass.cpp +++ b/libcxx/test/libcxx/assertions/single_expression.pass.cpp @@ -10,6 +10,8 @@ // This is useful so we can use them in places that require an expression, such as // in a constructor initializer list. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__assert> #include diff --git a/libcxx/test/libcxx/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp b/libcxx/test/libcxx/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp index a52459abb9e0a..323072da14463 100644 --- a/libcxx/test/libcxx/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp +++ b/libcxx/test/libcxx/atomics/atomics.syn/compatible_with_stdatomic.compile.pass.cpp @@ -8,6 +8,8 @@ // UNSUPPORTED: no-threads +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // This test verifies that redirects to . As an extension, // libc++ enables this redirection even before C++23. diff --git a/libcxx/test/libcxx/clang_modules_include.gen.py b/libcxx/test/libcxx/clang_modules_include.gen.py index dc815d9c772b5..379ac22c8f47f 100644 --- a/libcxx/test/libcxx/clang_modules_include.gen.py +++ b/libcxx/test/libcxx/clang_modules_include.gen.py @@ -52,6 +52,8 @@ // TODO: Fix seemingly circular inclusion or on AIX // UNSUPPORTED: LIBCXX-AIX-FIXME +// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME + {lit_header_restrictions.get(header, '')} {lit_header_undeprecations.get(header, '')} diff --git a/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp index c3d100e53711b..a99f4fff1300e 100644 --- a/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/tree_balance_after_insert.pass.cpp @@ -13,6 +13,8 @@ // void // __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__tree> #include diff --git a/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp index 12289c84a9cc3..bebdcaaedf103 100644 --- a/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/tree_key_value_traits.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__tree> #include #include diff --git a/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp index b766489adc692..f8073d6233c9b 100644 --- a/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/tree_left_rotate.pass.cpp @@ -13,6 +13,8 @@ // void // __tree_left_rotate(_NodePtr __x); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__tree> #include diff --git a/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp index e9afd845a7e31..0b2d86722912e 100644 --- a/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/tree_remove.pass.cpp @@ -13,6 +13,8 @@ // void // __tree_remove(_NodePtr __root, _NodePtr __z) +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__tree> #include diff --git a/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp b/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp index 04d2b094aad69..16ca81fddc7dc 100644 --- a/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/tree_right_rotate.pass.cpp @@ -13,6 +13,8 @@ // void // __tree_right_rotate(_NodePtr __x); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__tree> #include diff --git a/libcxx/test/libcxx/containers/associative/unord.map/abi.compile.pass.cpp b/libcxx/test/libcxx/containers/associative/unord.map/abi.compile.pass.cpp index cea074a4e70f1..55d42a8d017e1 100644 --- a/libcxx/test/libcxx/containers/associative/unord.map/abi.compile.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/unord.map/abi.compile.pass.cpp @@ -12,6 +12,8 @@ // unordered containers changes when bounded unique_ptr is enabled. // UNSUPPORTED: libcpp-has-abi-bounded-unique_ptr +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/libcxx/containers/associative/unord.set/abi.compile.pass.cpp b/libcxx/test/libcxx/containers/associative/unord.set/abi.compile.pass.cpp index 2a112aff227d8..bee2012bbea29 100644 --- a/libcxx/test/libcxx/containers/associative/unord.set/abi.compile.pass.cpp +++ b/libcxx/test/libcxx/containers/associative/unord.set/abi.compile.pass.cpp @@ -12,6 +12,8 @@ // unordered containers changes when bounded unique_ptr is enabled. // UNSUPPORTED: libcpp-has-abi-bounded-unique_ptr +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/libcxx/containers/container_traits.compile.pass.cpp b/libcxx/test/libcxx/containers/container_traits.compile.pass.cpp index 1452bfbaf3960..22be217487951 100644 --- a/libcxx/test/libcxx/containers/container_traits.compile.pass.cpp +++ b/libcxx/test/libcxx/containers/container_traits.compile.pass.cpp @@ -9,6 +9,8 @@ // <__type_traits/container_traits.h> // +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__type_traits/container_traits.h> #include diff --git a/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp b/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp index c5e420387fdaf..4b389fa759f89 100644 --- a/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/key_value_traits.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__hash_table> #include #include diff --git a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp index 0b56c96f8d4e4..8a5d448dbf922 100644 --- a/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/next_pow2.pass.cpp @@ -18,6 +18,8 @@ // If n <= 1, return n. If n is a power of 2, return n. // Otherwise, return the next power of 2. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__hash_table> #include #include diff --git a/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp b/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp index 0efbe0342d0b6..17a29033856c9 100644 --- a/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp +++ b/libcxx/test/libcxx/containers/unord/next_prime.pass.cpp @@ -16,6 +16,8 @@ // If n == 0, return 0, else return the lowest prime greater than or equal to n +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__hash_table> #include #include diff --git a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp index d0ac71739d7e3..f756aacbc1cd5 100644 --- a/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp +++ b/libcxx/test/libcxx/depr/depr.c.headers/extern_c.pass.cpp @@ -10,6 +10,8 @@ // that we don't want to support and can't support with LSV enabled. // UNSUPPORTED: clang-modules-build +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // Sometimes C++'s headers get included within extern "C" contexts. This // is ill-formed (no diagnostic required), per [using.headers]p3, but we permit // it as an extension. diff --git a/libcxx/test/libcxx/header_inclusions.gen.py b/libcxx/test/libcxx/header_inclusions.gen.py index 739caf915c09a..e00cf180d17ad 100644 --- a/libcxx/test/libcxx/header_inclusions.gen.py +++ b/libcxx/test/libcxx/header_inclusions.gen.py @@ -10,6 +10,7 @@ # prescribed by the Standard. # RUN: %{python} %s %{libcxx-dir}/utils +# END. import sys @@ -45,6 +46,8 @@ print( f"""\ //--- {header}.compile.pass.cpp +// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME + {lit_header_restrictions.get(header, '')} {lit_header_undeprecations.get(header, '')} diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp index 2157b2eb3cdf5..37ab176ea26a0 100644 --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp @@ -15,6 +15,8 @@ // UNSUPPORTED: no-wide-characters +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include std::basic_filebuf > f; diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp index b77f6a0201312..f936d8db47af5 100644 --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp @@ -15,6 +15,8 @@ // UNSUPPORTED: no-wide-characters +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include std::basic_fstream > f; diff --git a/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp index 435e1df6dc4ba..7d713ed581631 100644 --- a/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp @@ -15,6 +15,8 @@ // UNSUPPORTED: no-wide-characters +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp index f947507b23a17..445ddd1eb9e42 100644 --- a/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp @@ -15,6 +15,8 @@ // UNSUPPORTED: no-wide-characters +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/libcxx/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp b/libcxx/test/libcxx/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp index d6caa3389b8fa..2b6c3802a56b6 100644 --- a/libcxx/test/libcxx/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp +++ b/libcxx/test/libcxx/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp @@ -8,6 +8,8 @@ // +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // How the constructors of basic_stringbuf initialize the buffer pointers is // not specified. For some constructors it's implementation defined whether the // pointers are set to nullptr. Libc++'s implementation directly uses the SSO diff --git a/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.verify.cpp index 466ad70558fe5..89dc884c5da12 100644 --- a/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/string.streams/traits_mismatch.verify.cpp @@ -16,6 +16,8 @@ // UNSUPPORTED: no-wide-characters +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include std::basic_stringbuf > sb; diff --git a/libcxx/test/libcxx/iterators/aliasing_iterator.pass.cpp b/libcxx/test/libcxx/iterators/aliasing_iterator.pass.cpp index 60587d5bfe5d7..33774578e2337 100644 --- a/libcxx/test/libcxx/iterators/aliasing_iterator.pass.cpp +++ b/libcxx/test/libcxx/iterators/aliasing_iterator.pass.cpp @@ -8,6 +8,8 @@ // ADDITIONAL_COMPILE_FLAGS(clang): -Wprivate-header +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__iterator/aliasing_iterator.h> #include diff --git a/libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp index 45d0cc3b95f90..3fc735b441676 100644 --- a/libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp @@ -11,6 +11,8 @@ // // Arithmetic operators +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__iterator/bounded_iter.h> #include diff --git a/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp index cef2157469c8f..a12b77afa0db0 100644 --- a/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp @@ -11,6 +11,8 @@ // // Comparison operators +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include <__iterator/bounded_iter.h> diff --git a/libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp index bfd779d644f51..22ad8c6706d6f 100644 --- a/libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp @@ -11,6 +11,8 @@ // // std::pointer_traits specialization +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__iterator/bounded_iter.h> #include #include diff --git a/libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp b/libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp index 56ded9ae5ed21..d205c5b03ee3f 100644 --- a/libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp +++ b/libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp @@ -11,6 +11,8 @@ // // Nested types +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__iterator/bounded_iter.h> #include #include diff --git a/libcxx/test/libcxx/iterators/contiguous_iterators.conv.compile.pass.cpp b/libcxx/test/libcxx/iterators/contiguous_iterators.conv.compile.pass.cpp index 372559594143e..4d3690953070f 100644 --- a/libcxx/test/libcxx/iterators/contiguous_iterators.conv.compile.pass.cpp +++ b/libcxx/test/libcxx/iterators/contiguous_iterators.conv.compile.pass.cpp @@ -15,6 +15,8 @@ // Verify that libc++-wrapped iterators do not permit slicing conversion or construction. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp b/libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp index 479d40a5eb088..ba2697c78986c 100644 --- a/libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp +++ b/libcxx/test/libcxx/iterators/contiguous_iterators.verify.cpp @@ -11,6 +11,8 @@ // __bounded_iter<_Iter> +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // Verify that __bounded_iter does not accept non-contiguous iterators as determined by __libcpp_is_contiguous_iterator. // static_assert should be used, see https://github.com/llvm/llvm-project/issues/115002. // __wrap_iter cannot be so handled because it may directly wrap user-defined fancy pointers in libc++'s vector. diff --git a/libcxx/test/libcxx/iterators/iterator.primitives/iterator.operations/prev.verify.cpp b/libcxx/test/libcxx/iterators/iterator.primitives/iterator.operations/prev.verify.cpp index da0a336815a5c..ffef687723983 100644 --- a/libcxx/test/libcxx/iterators/iterator.primitives/iterator.operations/prev.verify.cpp +++ b/libcxx/test/libcxx/iterators/iterator.primitives/iterator.operations/prev.verify.cpp @@ -8,6 +8,8 @@ // std::prev +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_iterators.h" diff --git a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp index 37e3f8167051a..b283c8aa06f0c 100644 --- a/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp +++ b/libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp @@ -21,6 +21,8 @@ // GCC doesn't support the aligned-allocation flags. // XFAIL: gcc +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // RUN: %{build} -faligned-allocation -fsized-deallocation // RUN: %{run} // RUN: %{build} -faligned-allocation -fno-sized-deallocation -DNO_SIZE diff --git a/libcxx/test/libcxx/lint/lint_cmakelists.sh.py b/libcxx/test/libcxx/lint/lint_cmakelists.sh.py index 417f9acdbbdcd..286508c0d4f6d 100644 --- a/libcxx/test/libcxx/lint/lint_cmakelists.sh.py +++ b/libcxx/test/libcxx/lint/lint_cmakelists.sh.py @@ -20,7 +20,9 @@ okay = True prevline = lines[1] for line in lines[2:]: - if line == " )\n": + if line == "\n": + continue + if line == "# C++03 frozen headers\n": break if line < prevline: okay = False diff --git a/libcxx/test/libcxx/memory/allocation_guard.pass.cpp b/libcxx/test/libcxx/memory/allocation_guard.pass.cpp index 493ebf044187c..20c05b381ef0e 100644 --- a/libcxx/test/libcxx/memory/allocation_guard.pass.cpp +++ b/libcxx/test/libcxx/memory/allocation_guard.pass.cpp @@ -12,6 +12,8 @@ // To allow checking that self-move works correctly. // ADDITIONAL_COMPILE_FLAGS: -Wno-self-move +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // template // struct __allocation_guard; diff --git a/libcxx/test/libcxx/memory/swap_allocator.pass.cpp b/libcxx/test/libcxx/memory/swap_allocator.pass.cpp index 311660290eaef..f70f8134d1dda 100644 --- a/libcxx/test/libcxx/memory/swap_allocator.pass.cpp +++ b/libcxx/test/libcxx/memory/swap_allocator.pass.cpp @@ -7,6 +7,8 @@ //===----------------------------------------------------------------------===// // +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template diff --git a/libcxx/test/libcxx/numerics/bit.ops.pass.cpp b/libcxx/test/libcxx/numerics/bit.ops.pass.cpp index 7f502d6e01d1e..1bf9d3890f45f 100644 --- a/libcxx/test/libcxx/numerics/bit.ops.pass.cpp +++ b/libcxx/test/libcxx/numerics/bit.ops.pass.cpp @@ -9,6 +9,8 @@ // Test the __XXXX routines in the header. // These are not supposed to be exhaustive tests, just sanity checks. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__bit/bit_log2.h> #include <__bit/countl.h> #include <__bit/rotate.h> diff --git a/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp b/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp index aed78f9cddf84..68d55afa1f280 100644 --- a/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp +++ b/libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp @@ -12,6 +12,8 @@ // closest representable value for the specified integer type, or // numeric_limits::max()/min() if the value isn't representable. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__random/clamp_to_integral.h> #include #include diff --git a/libcxx/test/libcxx/numerics/complex.number/cmplx.over.pow.pass.cpp b/libcxx/test/libcxx/numerics/complex.number/cmplx.over.pow.pass.cpp index 1c790c283e438..8c1b3a17c669f 100644 --- a/libcxx/test/libcxx/numerics/complex.number/cmplx.over.pow.pass.cpp +++ b/libcxx/test/libcxx/numerics/complex.number/cmplx.over.pow.pass.cpp @@ -8,6 +8,8 @@ // +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // template complex<__promote::type> pow(const complex&, const U&); // template complex<__promote::type> pow(const complex&, const complex&); // template complex<__promote::type> pow(const T&, const complex&); diff --git a/libcxx/test/libcxx/selftest/test_macros.pass.cpp b/libcxx/test/libcxx/selftest/test_macros.pass.cpp index caa31ba333d3c..9bcf7cf9a31f5 100644 --- a/libcxx/test/libcxx/selftest/test_macros.pass.cpp +++ b/libcxx/test/libcxx/selftest/test_macros.pass.cpp @@ -7,6 +7,9 @@ //===----------------------------------------------------------------------===// // // Test the "test_macros.h" header. + +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__config> #include "test_macros.h" diff --git a/libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp b/libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp index bdc18448d03a4..2009cbe28a91f 100644 --- a/libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp +++ b/libcxx/test/libcxx/strings/c.strings/constexpr_memmove.pass.cpp @@ -19,6 +19,8 @@ // and is_trivially_XXX_assignable), so we use some funky types to test these // corner cases. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__string/constexpr_c_functions.h> #include #include diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py index f01dbac26a8e8..6f99240436632 100644 --- a/libcxx/test/libcxx/transitive_includes.gen.py +++ b/libcxx/test/libcxx/transitive_includes.gen.py @@ -90,6 +90,8 @@ // TODO: Figure out why doesn't work on FreeBSD // UNSUPPORTED: LIBCXX-FREEBSD-FIXME +// UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME + // RUN: mkdir %t // RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} --trace-includes -fshow-skipped-includes --preprocess > /dev/null 2> %t/trace-includes.txt // RUN: %{{python}} %{{libcxx-dir}}/test/libcxx/transitive_includes/to_csv.py %t/trace-includes.txt > %t/actual_transitive_includes.csv diff --git a/libcxx/test/libcxx/type_traits/datasizeof.compile.pass.cpp b/libcxx/test/libcxx/type_traits/datasizeof.compile.pass.cpp index 51e3a8534baea..67a4dccb0f5fe 100644 --- a/libcxx/test/libcxx/type_traits/datasizeof.compile.pass.cpp +++ b/libcxx/test/libcxx/type_traits/datasizeof.compile.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__type_traits/datasizeof.h> #include #include diff --git a/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp b/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp index 5a779c0e96e21..a538c52a534e7 100644 --- a/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp +++ b/libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp @@ -14,6 +14,8 @@ // returns false when there's no constant evaluation support from the compiler. // as well as when called not in a constexpr context +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__type_traits/is_constant_evaluated.h> #include diff --git a/libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp b/libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp index e2be399456b1b..e9b53080fcd6d 100644 --- a/libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp +++ b/libcxx/test/libcxx/type_traits/is_trivially_comparable.compile.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__type_traits/conditional.h> #include <__type_traits/is_equality_comparable.h> #include <__type_traits/is_signed.h> diff --git a/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp b/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp index 110180ffa055a..674df1d021905 100644 --- a/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp +++ b/libcxx/test/libcxx/type_traits/is_trivially_relocatable.compile.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__type_traits/is_trivially_relocatable.h> #include #include diff --git a/libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp b/libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp index f6b8a29d36821..fb51a4bf4ed27 100644 --- a/libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp +++ b/libcxx/test/libcxx/utilities/exception_guard.odr.sh.cpp @@ -9,6 +9,8 @@ // This test relies on `typeid` and thus requires `-frtti`. // UNSUPPORTED: no-rtti +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // Make sure that we don't get ODR violations with __exception_guard when // linking together TUs compiled with different values of -f[no-]exceptions. diff --git a/libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp b/libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp index fc4d3a9800d11..b0a27c79287d4 100644 --- a/libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp +++ b/libcxx/test/libcxx/utilities/is_pointer_in_range.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__utility/is_pointer_in_range.h> #include diff --git a/libcxx/test/libcxx/utilities/is_valid_range.pass.cpp b/libcxx/test/libcxx/utilities/is_valid_range.pass.cpp index 345e2feeda81c..cb800aee5674b 100644 --- a/libcxx/test/libcxx/utilities/is_valid_range.pass.cpp +++ b/libcxx/test/libcxx/utilities/is_valid_range.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__utility/is_valid_range.h> #include diff --git a/libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp b/libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp index 89f08088921d5..66c25b1d75638 100644 --- a/libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp +++ b/libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp @@ -7,6 +7,8 @@ //===----------------------------------------------------------------------===// // +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include "test_macros.h" TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header") diff --git a/libcxx/test/libcxx/utilities/no_destroy.pass.cpp b/libcxx/test/libcxx/utilities/no_destroy.pass.cpp index 9a874a6407537..8693bb17089dc 100644 --- a/libcxx/test/libcxx/utilities/no_destroy.pass.cpp +++ b/libcxx/test/libcxx/utilities/no_destroy.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include <__utility/no_destroy.h> #include diff --git a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp index 214b0eff8d9d2..ae8464ac946a9 100644 --- a/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp +++ b/libcxx/test/libcxx/utilities/template.bitset/includes.pass.cpp @@ -8,6 +8,8 @@ // test that includes , and +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_macros.h" diff --git a/libcxx/test/libcxx/utilities/utility/private_constructor_tag.compile.pass.cpp b/libcxx/test/libcxx/utilities/utility/private_constructor_tag.compile.pass.cpp index 097e05f29cebd..bae0824109071 100644 --- a/libcxx/test/libcxx/utilities/utility/private_constructor_tag.compile.pass.cpp +++ b/libcxx/test/libcxx/utilities/utility/private_constructor_tag.compile.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // struct __private_constructor_tag{}; // The private constructor tag is intended to be a trivial type that can easily diff --git a/libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp b/libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp index da16fd4626632..d82d0d6249b00 100644 --- a/libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp +++ b/libcxx/test/std/containers/sequences/array/array.fill/fill.verify.cpp @@ -10,6 +10,8 @@ // void fill(const T& u); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp b/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp index 03cfccac80b73..7816b26578246 100644 --- a/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp +++ b/libcxx/test/std/containers/sequences/array/array.swap/swap.verify.cpp @@ -10,6 +10,8 @@ // void swap(array& a); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp index d776d72b05467..f3a425e6537cb 100644 --- a/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp +++ b/libcxx/test/std/containers/sequences/array/array.tuple/get.verify.cpp @@ -10,6 +10,8 @@ // template T& get(array& a); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify. // ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-array-bounds diff --git a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.verify.cpp b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.verify.cpp index 168467a6ed361..b5c852225e7df 100644 --- a/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.verify.cpp +++ b/libcxx/test/std/containers/sequences/array/array.tuple/tuple_element.verify.cpp @@ -10,6 +10,8 @@ // tuple_element >::type +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/containers/sequences/array/size_and_alignment.compile.pass.cpp b/libcxx/test/std/containers/sequences/array/size_and_alignment.compile.pass.cpp index 7ba56577d1bb7..53356b4c7eee4 100644 --- a/libcxx/test/std/containers/sequences/array/size_and_alignment.compile.pass.cpp +++ b/libcxx/test/std/containers/sequences/array/size_and_alignment.compile.pass.cpp @@ -14,6 +14,8 @@ // Make sure std::array has the correct object size and alignment. // This test is mostly meant to catch subtle ABI-breaking regressions. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // Ignore error about requesting a large alignment not being ABI compatible with older AIX systems. #if defined(_AIX) # pragma clang diagnostic ignored "-Waix-compat" diff --git a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp b/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp index 54766013d907d..116891d4980be 100644 --- a/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp +++ b/libcxx/test/std/containers/sequences/forwardlist/types.pass.cpp @@ -24,6 +24,8 @@ // ... // }; +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/containers/sequences/list/types.pass.cpp b/libcxx/test/std/containers/sequences/list/types.pass.cpp index 0c0a127bd76f9..a2d49080f1bcb 100644 --- a/libcxx/test/std/containers/sequences/list/types.pass.cpp +++ b/libcxx/test/std/containers/sequences/list/types.pass.cpp @@ -21,6 +21,8 @@ // typedef typename allocator_type::pointer pointer; // typedef typename allocator_type::const_pointer const_pointer; +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp index 679eec2413793..00de05347bfd9 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp @@ -11,6 +11,8 @@ // (bug report: https://llvm.org/PR58392) // Check that vector constructors don't leak memory when an operation inside the constructor throws an exception +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp index d15276b440157..d2efaf1561631 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/default.pass.cpp @@ -13,6 +13,8 @@ // basic_fstream(); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_macros.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp index 95a04bdfccdbc..153487898e157 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/move.pass.cpp @@ -13,6 +13,8 @@ // basic_fstream(basic_fstream&& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp index 2e0ebcd684d79..ca226242773ad 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp @@ -18,6 +18,8 @@ // XFAIL: LIBCXX-AIX-FIXME +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp index ca0921a00b9b6..28cefc77d6a90 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp @@ -13,6 +13,8 @@ // explicit basic_fstream(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp index 70d1efca20c65..256380d2c164a 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/default.pass.cpp @@ -13,6 +13,8 @@ // basic_ifstream(); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_macros.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp index 81ec800954cc2..c8be388f40698 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/move.pass.cpp @@ -8,6 +8,8 @@ // FILE_DEPENDENCIES: test.dat +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template > diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp index 6bbe6f1ff7754..711ab2a74b516 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/pointer.pass.cpp @@ -8,6 +8,8 @@ // FILE_DEPENDENCIES: test.dat +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // template > diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp index e1a9b53da1348..d4bbb3c0cabfc 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/string.pass.cpp @@ -15,6 +15,8 @@ // explicit basic_ifstream(const string& s, ios_base::openmode mode = ios_base::in); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp index a7b0918f79365..4cda1db438342 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/default.pass.cpp @@ -13,6 +13,8 @@ // basic_ofstream(); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_macros.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp index ec02fa2621c19..501a4c90ca3fe 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/move.pass.cpp @@ -13,6 +13,8 @@ // basic_ofstream(basic_ofstream&& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp index fbb03f1e85841..1b5a55df73717 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp @@ -18,6 +18,8 @@ // XFAIL: LIBCXX-AIX-FIXME +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp index 33a7e9b2b6f50..bb18c88bd326e 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/string.pass.cpp @@ -13,6 +13,8 @@ // explicit basic_ofstream(const string& s, ios_base::openmode mode = ios_base::out); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp b/libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp index d78f7df8f6b5e..768922192038b 100644 --- a/libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp +++ b/libcxx/test/std/input.output/iostreams.base/ios/basic.ios.members/copyfmt.pass.cpp @@ -15,6 +15,8 @@ // basic_ios& copyfmt(const basic_ios& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp index 8c73df42ae4be..8cd23d45598b8 100644 --- a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/default.pass.cpp @@ -15,6 +15,8 @@ // basic_istringstream() : basic_istringstream(ios_base::in) {} // C++20 // explicit basic_istringstream(ios_base::openmode which); // C++20 +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp index 00ac7cc6414e9..1af3304d08971 100644 --- a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/move.pass.cpp @@ -13,6 +13,8 @@ // basic_istringstream(basic_istringstream&& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp index 4a5965e7e96e9..7755dd926c2f6 100644 --- a/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/istringstream/istringstream.cons/string.pass.cpp @@ -14,6 +14,8 @@ // explicit basic_istringstream(const basic_string& str, // ios_base::openmode which = ios_base::in); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp index a6b98a4e36293..eb248a7801a3c 100644 --- a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/default.pass.cpp @@ -15,6 +15,8 @@ // basic_ostringstream() : basic_ostringstream(ios_base::out) {} // C++20 // explicit basic_ostringstream(ios_base::openmode which); // C++20 +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp index 596a3e7d53584..62ece7b63b31c 100644 --- a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/move.pass.cpp @@ -13,6 +13,8 @@ // basic_ostringstream(basic_ostringstream&& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp index 9e9405ad49217..bbec8f79a1862 100644 --- a/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.cons/string.pass.cpp @@ -14,6 +14,8 @@ // explicit basic_ostringstream(const basic_string& str, // ios_base::openmode which = ios_base::in); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp b/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp index d131f5c9a6fa7..dac43967d815f 100644 --- a/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp @@ -15,6 +15,8 @@ // basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20 // explicit basic_stringbuf(ios_base::openmode which); // C++20 +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/default.pass.cpp b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/default.pass.cpp index 4f9e7e026c50f..0e535814ae54e 100644 --- a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/default.pass.cpp @@ -15,6 +15,8 @@ // basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {} // C++20 // explicit basic_stringstream(ios_base::openmode which); // C++20 +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/move.pass.cpp b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/move.pass.cpp index 0702d9a278d3c..e905f5f7c686a 100644 --- a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/move.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/move.pass.cpp @@ -13,6 +13,8 @@ // basic_stringstream(basic_stringstream&& rhs); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/string.pass.cpp b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/string.pass.cpp index 08880878361da..d4fe18afbd28f 100644 --- a/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/string.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/stringstream/stringstream.cons/string.pass.cpp @@ -14,6 +14,8 @@ // explicit basic_stringstream(const basic_string& str, // ios_base::openmode which = ios_base::out|ios_base::in); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include diff --git a/libcxx/test/std/language.support/support.runtime/cstdalign.compile.pass.cpp b/libcxx/test/std/language.support/support.runtime/cstdalign.compile.pass.cpp index fbbaf9b2d136f..69296dfa50121 100644 --- a/libcxx/test/std/language.support/support.runtime/cstdalign.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.runtime/cstdalign.compile.pass.cpp @@ -10,6 +10,8 @@ // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #ifndef __alignas_is_defined diff --git a/libcxx/test/std/numerics/c.math/isnormal.pass.cpp b/libcxx/test/std/numerics/c.math/isnormal.pass.cpp index 76c3d13520d99..03b086fa3f48e 100644 --- a/libcxx/test/std/numerics/c.math/isnormal.pass.cpp +++ b/libcxx/test/std/numerics/c.math/isnormal.pass.cpp @@ -11,6 +11,8 @@ // We don't control the implementation on windows // UNSUPPORTED: windows +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/numerics/c.math/signbit.pass.cpp b/libcxx/test/std/numerics/c.math/signbit.pass.cpp index a8a566f7de643..cbad968a8aa20 100644 --- a/libcxx/test/std/numerics/c.math/signbit.pass.cpp +++ b/libcxx/test/std/numerics/c.math/signbit.pass.cpp @@ -14,6 +14,8 @@ // These compilers don't support constexpr `__builtin_signbit` yet. // UNSUPPORTED: clang-17, clang-18, clang-19, apple-clang-15, apple-clang-16 +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp index a5087817223c5..2f9f6360a8b8e 100644 --- a/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp +++ b/libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.pass.cpp @@ -18,6 +18,8 @@ // regex_constants::match_flag_type m = // regex_constants::match_default); +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/std/strings/basic.string/char.bad.verify.cpp b/libcxx/test/std/strings/basic.string/char.bad.verify.cpp index bedc5f19a6a88..c206c1ce8df45 100644 --- a/libcxx/test/std/strings/basic.string/char.bad.verify.cpp +++ b/libcxx/test/std/strings/basic.string/char.bad.verify.cpp @@ -9,6 +9,8 @@ // // ... manipulating sequences of any non-array trivial standard-layout types. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include "test_traits.h" diff --git a/libcxx/test/std/strings/string.view/char.bad.verify.cpp b/libcxx/test/std/strings/string.view/char.bad.verify.cpp index 735e3e5d2e716..df91736388150 100644 --- a/libcxx/test/std/strings/string.view/char.bad.verify.cpp +++ b/libcxx/test/std/strings/string.view/char.bad.verify.cpp @@ -8,6 +8,8 @@ // UNSUPPORTED: !stdlib=libc++ && (c++03 || c++11 || c++14) +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + // // ... manipulating sequences of any non-array trivial standard-layout types. diff --git a/libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp b/libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp index f1daa7c3dcce9..ae3ac819b1f9c 100644 --- a/libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/bitset.members/nonstdmem.uglified.compile.pass.cpp @@ -13,6 +13,8 @@ // // See https://github.com/llvm/llvm-project/issues/111125. +// XFAIL: FROZEN-CXX03-HEADERS-FIXME + #include #include #include diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 7f50282d62717..676c865914b40 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -214,7 +214,11 @@ #define TEST_IS_EXECUTED_IN_A_SLOW_ENVIRONMENT #endif -#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_ALIGNED_ALLOCATION +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +# ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION +# define TEST_HAS_NO_ALIGNED_ALLOCATION +# endif +#elif defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_ALIGNED_ALLOCATION # define TEST_HAS_NO_ALIGNED_ALLOCATION #elif TEST_STD_VER < 17 && (!defined(__cpp_aligned_new) || __cpp_aligned_new < 201606L) # define TEST_HAS_NO_ALIGNED_ALLOCATION @@ -262,7 +266,9 @@ #define TEST_IGNORE_NODISCARD (void) -#if !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +// from-chars is a C++17 feature, so it's never available anyways +#elif !defined(_LIBCPP_VERSION) || _LIBCPP_AVAILABILITY_HAS_FROM_CHARS_FLOATING_POINT # define TEST_HAS_FROM_CHARS_FLOATING_POINT #endif @@ -401,11 +407,19 @@ inline Tp const& DoNotOptimize(Tp const& value) { # define TEST_HAS_NO_UNICODE #endif -#if defined(_LIBCPP_VERSION) && _LIBCPP_HAS_OPEN_WITH_WCHAR +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR +# define TEST_HAS_OPEN_WITH_WCHAR +# endif +#elif defined(_LIBCPP_VERSION) && _LIBCPP_HAS_OPEN_WITH_WCHAR # define TEST_HAS_OPEN_WITH_WCHAR #endif -#if (defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_INT128) || defined(_MSVC_STL_VERSION) +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +# ifdef _LIBCPP_HAS_NO_INT128 +# define TEST_HAS_NO_INT128 +# endif +#elif (defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_INT128) || defined(_MSVC_STL_VERSION) # define TEST_HAS_NO_INT128 #endif @@ -425,7 +439,11 @@ inline Tp const& DoNotOptimize(Tp const& value) { # define TEST_HAS_NO_FILESYSTEM #endif -#if defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_C8RTOMB_MBRTOC8 +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +# ifdef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 +# define TEST_HAS_NO_C8RTOMB_MBRTOC8 +# endif +#elif defined(_LIBCPP_VERSION) && !_LIBCPP_HAS_C8RTOMB_MBRTOC8 # define TEST_HAS_NO_C8RTOMB_MBRTOC8 #endif @@ -499,7 +517,9 @@ inline Tp const& DoNotOptimize(Tp const& value) { #endif // Clang-18 has support for deducing this, but it does not set the FTM. -#if defined(_LIBCPP_VERSION) && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER +#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS +// This is a C++20 featue, so we don't care whether the compiler could support it +#elif defined(_LIBCPP_VERSION) && _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER # define TEST_HAS_EXPLICIT_THIS_PARAMETER #endif diff --git a/libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp b/libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp index 15093a4357bb7..ebd0d8892fa94 100644 --- a/libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp +++ b/libcxx/test/tools/clang_tidy_checks/proper_version_checks.cpp @@ -39,6 +39,9 @@ class proper_version_checks_callbacks : public clang::PPCallbacks { if (preprocessor_.getSourceManager().isInMainFile(location)) return; + if (condition == "__cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)") + return; + if (condition.starts_with("_LIBCPP_STD_VER") && condition.find(">") != std::string_view::npos && condition.find(">=") == std::string_view::npos) check_.diag(location, "_LIBCPP_STD_VER >= version should be used instead of _LIBCPP_STD_VER > prev_version"); diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot index a832380e16cd8..f1ede6474eb9e 100755 --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -281,6 +281,12 @@ check-generated-output) # # Various Standard modes # +frozen-cxx03-headers) + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03-frozen.cmake" + check-runtimes + check-abi-list +;; generic-cxx03) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake" diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 0b5c0f107134b..a2ce69892eeb7 100755 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -1629,16 +1629,21 @@ def produce_version_header(): */ -#include <__config> +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/version> +#else +# include <__config> -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif +# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +# endif // clang-format off {cxx_macros} +#endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) + // clang-format on #endif // _LIBCPP_VERSIONH diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py index 2c5cb169c0a9a..947cfd2651364 100644 --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -448,5 +448,12 @@ def getSuitableClangTidy(cfg): AddSubstitution('%{clang-tidy}', exe), ] ), + Parameter( + name='test_frozen_cxx03_headers', + type=bool, + default=False, + help="Whether to test the main or C++03-specific headers. Only changes behaviour when std=c++03.", + actions=lambda enabled: [] if not enabled else [AddFlag("-D_LIBCPP_USE_FROZEN_CXX03_HEADERS"), AddFeature("FROZEN-CXX03-HEADERS-FIXME")], + ), ] # fmt: on diff --git a/libcxx/vendor/llvm/default_assertion_handler.in b/libcxx/vendor/llvm/default_assertion_handler.in index e12ccccdaff37..1d6b21fc6bb45 100644 --- a/libcxx/vendor/llvm/default_assertion_handler.in +++ b/libcxx/vendor/llvm/default_assertion_handler.in @@ -10,8 +10,13 @@ #ifndef _LIBCPP___ASSERTION_HANDLER #define _LIBCPP___ASSERTION_HANDLER -#include <__config> -#include <__verbose_abort> +#if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS) +# include <__cxx03/__config> +# include <__cxx03/__verbose_abort> +#else +# include <__config> +# include <__verbose_abort> +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header From f77152d9a44b49ee38b15085034bbfe22b4b3992 Mon Sep 17 00:00:00 2001 From: Julian Schmidt Date: Sat, 21 Dec 2024 13:06:30 +0100 Subject: [PATCH 066/466] [clang-tidy] use specified type verbatim in modernize-use-using fix (#113837) Previously, the implementation used the printed type, which contains expanded macro arguments, deletes comments, and removes function argument names from the alias declaration. Instead, this check can be more surgical and use the actual written type verbatim. Fixes #33760 Fixes #37846 Fixes #41685 Fixes #83568 Fixes #95716 Fixes #97009 --- .../clang-tidy/modernize/UseUsingCheck.cpp | 75 +++++++++++++++---- .../clang-tidy/modernize/UseUsingCheck.h | 1 + clang-tools-extra/docs/ReleaseNotes.rst | 3 + .../checkers/modernize/use-using.cpp | 64 ++++++++++++++-- 4 files changed, 123 insertions(+), 20 deletions(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index 24eefdb082eb3..30fcba367db67 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -7,9 +7,14 @@ //===----------------------------------------------------------------------===// #include "UseUsingCheck.h" -#include "clang/AST/ASTContext.h" +#include "../utils/LexerUtils.h" #include "clang/AST/DeclGroup.h" +#include "clang/Basic/LangOptions.h" +#include "clang/Basic/SourceLocation.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Basic/TokenKinds.h" #include "clang/Lex/Lexer.h" +#include using namespace clang::ast_matchers; namespace { @@ -83,6 +88,9 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { if (!ParentDecl) return; + const SourceManager &SM = *Result.SourceManager; + const LangOptions &LO = getLangOpts(); + // Match CXXRecordDecl only to store the range of the last non-implicit full // declaration, to later check whether it's within the typdef itself. const auto *MatchedTagDecl = Result.Nodes.getNodeAs(TagDeclName); @@ -119,14 +127,51 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { return; } - PrintingPolicy PrintPolicy(getLangOpts()); - PrintPolicy.SuppressScope = true; - PrintPolicy.ConstantArraySizeAsWritten = true; - PrintPolicy.UseVoidForZeroParams = false; - PrintPolicy.PrintInjectedClassNameWithArguments = false; + const TypeLoc TL = MatchedDecl->getTypeSourceInfo()->getTypeLoc(); + + auto [Type, QualifierStr] = [MatchedDecl, this, &TL, &SM, + &LO]() -> std::pair { + SourceRange TypeRange = TL.getSourceRange(); + + // Function pointer case, get the left and right side of the identifier + // without the identifier. + if (TypeRange.fullyContains(MatchedDecl->getLocation())) { + const auto RangeLeftOfIdentifier = CharSourceRange::getCharRange( + TypeRange.getBegin(), MatchedDecl->getLocation()); + const auto RangeRightOfIdentifier = CharSourceRange::getCharRange( + Lexer::getLocForEndOfToken(MatchedDecl->getLocation(), 0, SM, LO), + Lexer::getLocForEndOfToken(TypeRange.getEnd(), 0, SM, LO)); + const std::string VerbatimType = + (Lexer::getSourceText(RangeLeftOfIdentifier, SM, LO) + + Lexer::getSourceText(RangeRightOfIdentifier, SM, LO)) + .str(); + return {VerbatimType, ""}; + } + + StringRef ExtraReference = ""; + if (MainTypeEndLoc.isValid() && TypeRange.fullyContains(MainTypeEndLoc)) { + // Each type introduced in a typedef can specify being a reference or + // pointer type seperately, so we need to sigure out if the new using-decl + // needs to be to a reference or pointer as well. + const SourceLocation Tok = utils::lexer::findPreviousAnyTokenKind( + MatchedDecl->getLocation(), SM, LO, tok::TokenKind::star, + tok::TokenKind::amp, tok::TokenKind::comma, + tok::TokenKind::kw_typedef); + + ExtraReference = Lexer::getSourceText( + CharSourceRange::getCharRange(Tok, Tok.getLocWithOffset(1)), SM, LO); - std::string Type = MatchedDecl->getUnderlyingType().getAsString(PrintPolicy); - std::string Name = MatchedDecl->getNameAsString(); + if (ExtraReference != "*" && ExtraReference != "&") + ExtraReference = ""; + + TypeRange.setEnd(MainTypeEndLoc); + } + return { + Lexer::getSourceText(CharSourceRange::getTokenRange(TypeRange), SM, LO) + .str(), + ExtraReference.str()}; + }(); + StringRef Name = MatchedDecl->getName(); SourceRange ReplaceRange = MatchedDecl->getSourceRange(); // typedefs with multiple comma-separated definitions produce multiple @@ -143,7 +188,8 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { // This is the first (and possibly the only) TypedefDecl in a typedef. Save // Type and Name in case we find subsequent TypedefDecl's in this typedef. FirstTypedefType = Type; - FirstTypedefName = Name; + FirstTypedefName = Name.str(); + MainTypeEndLoc = TL.getEndLoc(); } else { // This is additional TypedefDecl in a comma-separated typedef declaration. // Start replacement *after* prior replacement and separate with semicolon. @@ -153,10 +199,10 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { // If this additional TypedefDecl's Type starts with the first TypedefDecl's // type, make this using statement refer back to the first type, e.g. make // "typedef int Foo, *Foo_p;" -> "using Foo = int;\nusing Foo_p = Foo*;" - if (Type.size() > FirstTypedefType.size() && - Type.substr(0, FirstTypedefType.size()) == FirstTypedefType) - Type = FirstTypedefName + Type.substr(FirstTypedefType.size() + 1); + if (Type == FirstTypedefType && !QualifierStr.empty()) + Type = FirstTypedefName; } + if (!ReplaceRange.getEnd().isMacroID()) { const SourceLocation::IntTy Offset = MatchedDecl->getFunctionType() ? 0 : Name.size(); @@ -171,13 +217,12 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { LastTagDeclRange->second.isValid() && ReplaceRange.fullyContains(LastTagDeclRange->second)) { Type = std::string(Lexer::getSourceText( - CharSourceRange::getTokenRange(LastTagDeclRange->second), - *Result.SourceManager, getLangOpts())); + CharSourceRange::getTokenRange(LastTagDeclRange->second), SM, LO)); if (Type.empty()) return; } - std::string Replacement = Using + Name + " = " + Type; + std::string Replacement = (Using + Name + " = " + Type + QualifierStr).str(); Diag << FixItHint::CreateReplacement(ReplaceRange, Replacement); } } // namespace clang::tidy::modernize diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h index 7054778d84a0c..1e54bbf23c984 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.h @@ -26,6 +26,7 @@ class UseUsingCheck : public ClangTidyCheck { std::string FirstTypedefType; std::string FirstTypedefName; + SourceLocation MainTypeEndLoc; public: UseUsingCheck(StringRef Name, ClangTidyContext *Context); diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 3fd7a4f9da18a..fa3a8e577a33a 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -317,6 +317,9 @@ Changes in existing checks member function calls too and to only expand macros starting with ``PRI`` and ``__PRI`` from ```` in the format string. +- Improved :doc:`modernize-use-using + ` check by not expanding macros. + - Improved :doc:`performance-avoid-endl ` check to use ``std::endl`` as placeholder when lexer cannot get source text. diff --git a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp index 925e5f9c1ca54..214a66f3dcc88 100644 --- a/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp +++ b/clang-tools-extra/test/clang-tidy/checkers/modernize/use-using.cpp @@ -80,7 +80,7 @@ typedef Test another; typedef int* PInt; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' -// CHECK-FIXES: using PInt = int *; +// CHECK-FIXES: using PInt = int*; typedef int bla1, bla2, bla3; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' @@ -112,7 +112,7 @@ TYPEDEF Foo Bak; typedef FOO Bam; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' // CHECK-FIXES: #define FOO Foo -// CHECK-FIXES: using Bam = Foo; +// CHECK-FIXES: using Bam = FOO; typedef struct Foo Bap; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' @@ -247,7 +247,7 @@ typedef Q Q3_t; typedef TwoArgTemplate >, S<(0 < 0), Q > > Nested_t; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' -// CHECK-FIXES: using Nested_t = TwoArgTemplate>, S<(0 < 0), Q>>; +// CHECK-FIXES: using Nested_t = TwoArgTemplate >, S<(0 < 0), Q > >; template class TemplateKeyword { @@ -265,12 +265,12 @@ class Variadic {}; typedef Variadic >, S<(0 < 0), Variadic > > > Variadic_t; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' -// CHECK-FIXES: using Variadic_t = Variadic>, S<(0 < 0), Variadic>>> +// CHECK-FIXES: using Variadic_t = Variadic >, S<(0 < 0), Variadic > > > typedef Variadic >, S<(0 < 0), Variadic > > > Variadic_t, *Variadic_p; // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' // CHECK-MESSAGES: :[[@LINE-2]]:103: warning: use 'using' instead of 'typedef' -// CHECK-FIXES: using Variadic_t = Variadic>, S<(0 < 0), Variadic>>>; +// CHECK-FIXES: using Variadic_t = Variadic >, S<(0 < 0), Variadic > > >; // CHECK-FIXES-NEXT: using Variadic_p = Variadic_t*; typedef struct { int a; } R_t, *R_p; @@ -383,3 +383,57 @@ namespace ISSUE_72179 // CHECK-MESSAGES: :[[@LINE-1]]:31: warning: use 'using' instead of 'typedef' [modernize-use-using] // CHECK-FIXES: const auto foo4 = [](int a){using d = int;}; } + + +typedef int* int_ptr, *int_ptr_ptr; +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-MESSAGES: :[[@LINE-2]]:21: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using int_ptr = int*; +// CHECK-FIXES-NEXT: using int_ptr_ptr = int_ptr*; + +#ifndef SpecialMode +#define SomeMacro(x) x +#else +#define SomeMacro(x) SpecialType +#endif + +class SomeMacro(GH33760) { }; + +typedef void(SomeMacro(GH33760)::* FunctionType)(float, int); +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using FunctionType = void(SomeMacro(GH33760)::* )(float, int); + +#define CDECL __attribute((cdecl)) + +// GH37846 & GH41685 +typedef void (CDECL *GH37846)(int); +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using GH37846 = void (CDECL *)(int); + +typedef void (__attribute((cdecl)) *GH41685)(int); +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using GH41685 = void (__attribute((cdecl)) *)(int); + +namespace GH83568 { + typedef int(*name)(int arg1, int arg2); +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using name = int(*)(int arg1, int arg2); +} + +#ifdef FOO +#define GH95716 float +#else +#define GH95716 double +#endif + +typedef GH95716 foo; +// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using foo = GH95716; + +namespace GH97009 { + typedef double PointType[3]; +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using] + typedef bool (*Function)(PointType, PointType); +// CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using] +// CHECK-FIXES: using Function = bool (*)(PointType, PointType); +} From 93c2577020fe70087f99f48f7ce1fd62178455c3 Mon Sep 17 00:00:00 2001 From: LLVM GN Syncbot Date: Sat, 21 Dec 2024 12:08:12 +0000 Subject: [PATCH 067/466] [gn build] Port b9a2658a3e8b --- .../gn/secondary/libcxx/include/BUILD.gn | 891 ++++++++++++++++++ 1 file changed, 891 insertions(+) diff --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn index 0a18e67ca5c42..d4f0a2924ab4d 100644 --- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn +++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn @@ -403,6 +403,897 @@ if (current_toolchain == default_toolchain) { "__cstddef/nullptr_t.h", "__cstddef/ptrdiff_t.h", "__cstddef/size_t.h", + "__cxx03/__algorithm/adjacent_find.h", + "__cxx03/__algorithm/all_of.h", + "__cxx03/__algorithm/any_of.h", + "__cxx03/__algorithm/binary_search.h", + "__cxx03/__algorithm/clamp.h", + "__cxx03/__algorithm/comp.h", + "__cxx03/__algorithm/comp_ref_type.h", + "__cxx03/__algorithm/copy.h", + "__cxx03/__algorithm/copy_backward.h", + "__cxx03/__algorithm/copy_if.h", + "__cxx03/__algorithm/copy_move_common.h", + "__cxx03/__algorithm/copy_n.h", + "__cxx03/__algorithm/count.h", + "__cxx03/__algorithm/count_if.h", + "__cxx03/__algorithm/equal.h", + "__cxx03/__algorithm/equal_range.h", + "__cxx03/__algorithm/fill.h", + "__cxx03/__algorithm/fill_n.h", + "__cxx03/__algorithm/find.h", + "__cxx03/__algorithm/find_end.h", + "__cxx03/__algorithm/find_first_of.h", + "__cxx03/__algorithm/find_if.h", + "__cxx03/__algorithm/find_if_not.h", + "__cxx03/__algorithm/find_segment_if.h", + "__cxx03/__algorithm/fold.h", + "__cxx03/__algorithm/for_each.h", + "__cxx03/__algorithm/for_each_n.h", + "__cxx03/__algorithm/for_each_segment.h", + "__cxx03/__algorithm/generate.h", + "__cxx03/__algorithm/generate_n.h", + "__cxx03/__algorithm/half_positive.h", + "__cxx03/__algorithm/in_found_result.h", + "__cxx03/__algorithm/in_fun_result.h", + "__cxx03/__algorithm/in_in_out_result.h", + "__cxx03/__algorithm/in_in_result.h", + "__cxx03/__algorithm/in_out_out_result.h", + "__cxx03/__algorithm/in_out_result.h", + "__cxx03/__algorithm/includes.h", + "__cxx03/__algorithm/inplace_merge.h", + "__cxx03/__algorithm/is_heap.h", + "__cxx03/__algorithm/is_heap_until.h", + "__cxx03/__algorithm/is_partitioned.h", + "__cxx03/__algorithm/is_permutation.h", + "__cxx03/__algorithm/is_sorted.h", + "__cxx03/__algorithm/is_sorted_until.h", + "__cxx03/__algorithm/iter_swap.h", + "__cxx03/__algorithm/iterator_operations.h", + "__cxx03/__algorithm/lexicographical_compare.h", + "__cxx03/__algorithm/lexicographical_compare_three_way.h", + "__cxx03/__algorithm/lower_bound.h", + "__cxx03/__algorithm/make_heap.h", + "__cxx03/__algorithm/make_projected.h", + "__cxx03/__algorithm/max.h", + "__cxx03/__algorithm/max_element.h", + "__cxx03/__algorithm/merge.h", + "__cxx03/__algorithm/min.h", + "__cxx03/__algorithm/min_element.h", + "__cxx03/__algorithm/min_max_result.h", + "__cxx03/__algorithm/minmax.h", + "__cxx03/__algorithm/minmax_element.h", + "__cxx03/__algorithm/mismatch.h", + "__cxx03/__algorithm/move.h", + "__cxx03/__algorithm/move_backward.h", + "__cxx03/__algorithm/next_permutation.h", + "__cxx03/__algorithm/none_of.h", + "__cxx03/__algorithm/nth_element.h", + "__cxx03/__algorithm/partial_sort.h", + "__cxx03/__algorithm/partial_sort_copy.h", + "__cxx03/__algorithm/partition.h", + "__cxx03/__algorithm/partition_copy.h", + "__cxx03/__algorithm/partition_point.h", + "__cxx03/__algorithm/pop_heap.h", + "__cxx03/__algorithm/prev_permutation.h", + "__cxx03/__algorithm/pstl.h", + "__cxx03/__algorithm/push_heap.h", + "__cxx03/__algorithm/ranges_adjacent_find.h", + "__cxx03/__algorithm/ranges_all_of.h", + "__cxx03/__algorithm/ranges_any_of.h", + "__cxx03/__algorithm/ranges_binary_search.h", + "__cxx03/__algorithm/ranges_clamp.h", + "__cxx03/__algorithm/ranges_contains.h", + "__cxx03/__algorithm/ranges_contains_subrange.h", + "__cxx03/__algorithm/ranges_copy.h", + "__cxx03/__algorithm/ranges_copy_backward.h", + "__cxx03/__algorithm/ranges_copy_if.h", + "__cxx03/__algorithm/ranges_copy_n.h", + "__cxx03/__algorithm/ranges_count.h", + "__cxx03/__algorithm/ranges_count_if.h", + "__cxx03/__algorithm/ranges_ends_with.h", + "__cxx03/__algorithm/ranges_equal.h", + "__cxx03/__algorithm/ranges_equal_range.h", + "__cxx03/__algorithm/ranges_fill.h", + "__cxx03/__algorithm/ranges_fill_n.h", + "__cxx03/__algorithm/ranges_find.h", + "__cxx03/__algorithm/ranges_find_end.h", + "__cxx03/__algorithm/ranges_find_first_of.h", + "__cxx03/__algorithm/ranges_find_if.h", + "__cxx03/__algorithm/ranges_find_if_not.h", + "__cxx03/__algorithm/ranges_find_last.h", + "__cxx03/__algorithm/ranges_for_each.h", + "__cxx03/__algorithm/ranges_for_each_n.h", + "__cxx03/__algorithm/ranges_generate.h", + "__cxx03/__algorithm/ranges_generate_n.h", + "__cxx03/__algorithm/ranges_includes.h", + "__cxx03/__algorithm/ranges_inplace_merge.h", + "__cxx03/__algorithm/ranges_is_heap.h", + "__cxx03/__algorithm/ranges_is_heap_until.h", + "__cxx03/__algorithm/ranges_is_partitioned.h", + "__cxx03/__algorithm/ranges_is_permutation.h", + "__cxx03/__algorithm/ranges_is_sorted.h", + "__cxx03/__algorithm/ranges_is_sorted_until.h", + "__cxx03/__algorithm/ranges_iterator_concept.h", + "__cxx03/__algorithm/ranges_lexicographical_compare.h", + "__cxx03/__algorithm/ranges_lower_bound.h", + "__cxx03/__algorithm/ranges_make_heap.h", + "__cxx03/__algorithm/ranges_max.h", + "__cxx03/__algorithm/ranges_max_element.h", + "__cxx03/__algorithm/ranges_merge.h", + "__cxx03/__algorithm/ranges_min.h", + "__cxx03/__algorithm/ranges_min_element.h", + "__cxx03/__algorithm/ranges_minmax.h", + "__cxx03/__algorithm/ranges_minmax_element.h", + "__cxx03/__algorithm/ranges_mismatch.h", + "__cxx03/__algorithm/ranges_move.h", + "__cxx03/__algorithm/ranges_move_backward.h", + "__cxx03/__algorithm/ranges_next_permutation.h", + "__cxx03/__algorithm/ranges_none_of.h", + "__cxx03/__algorithm/ranges_nth_element.h", + "__cxx03/__algorithm/ranges_partial_sort.h", + "__cxx03/__algorithm/ranges_partial_sort_copy.h", + "__cxx03/__algorithm/ranges_partition.h", + "__cxx03/__algorithm/ranges_partition_copy.h", + "__cxx03/__algorithm/ranges_partition_point.h", + "__cxx03/__algorithm/ranges_pop_heap.h", + "__cxx03/__algorithm/ranges_prev_permutation.h", + "__cxx03/__algorithm/ranges_push_heap.h", + "__cxx03/__algorithm/ranges_remove.h", + "__cxx03/__algorithm/ranges_remove_copy.h", + "__cxx03/__algorithm/ranges_remove_copy_if.h", + "__cxx03/__algorithm/ranges_remove_if.h", + "__cxx03/__algorithm/ranges_replace.h", + "__cxx03/__algorithm/ranges_replace_copy.h", + "__cxx03/__algorithm/ranges_replace_copy_if.h", + "__cxx03/__algorithm/ranges_replace_if.h", + "__cxx03/__algorithm/ranges_reverse.h", + "__cxx03/__algorithm/ranges_reverse_copy.h", + "__cxx03/__algorithm/ranges_rotate.h", + "__cxx03/__algorithm/ranges_rotate_copy.h", + "__cxx03/__algorithm/ranges_sample.h", + "__cxx03/__algorithm/ranges_search.h", + "__cxx03/__algorithm/ranges_search_n.h", + "__cxx03/__algorithm/ranges_set_difference.h", + "__cxx03/__algorithm/ranges_set_intersection.h", + "__cxx03/__algorithm/ranges_set_symmetric_difference.h", + "__cxx03/__algorithm/ranges_set_union.h", + "__cxx03/__algorithm/ranges_shuffle.h", + "__cxx03/__algorithm/ranges_sort.h", + "__cxx03/__algorithm/ranges_sort_heap.h", + "__cxx03/__algorithm/ranges_stable_partition.h", + "__cxx03/__algorithm/ranges_stable_sort.h", + "__cxx03/__algorithm/ranges_starts_with.h", + "__cxx03/__algorithm/ranges_swap_ranges.h", + "__cxx03/__algorithm/ranges_transform.h", + "__cxx03/__algorithm/ranges_unique.h", + "__cxx03/__algorithm/ranges_unique_copy.h", + "__cxx03/__algorithm/ranges_upper_bound.h", + "__cxx03/__algorithm/remove.h", + "__cxx03/__algorithm/remove_copy.h", + "__cxx03/__algorithm/remove_copy_if.h", + "__cxx03/__algorithm/remove_if.h", + "__cxx03/__algorithm/replace.h", + "__cxx03/__algorithm/replace_copy.h", + "__cxx03/__algorithm/replace_copy_if.h", + "__cxx03/__algorithm/replace_if.h", + "__cxx03/__algorithm/reverse.h", + "__cxx03/__algorithm/reverse_copy.h", + "__cxx03/__algorithm/rotate.h", + "__cxx03/__algorithm/rotate_copy.h", + "__cxx03/__algorithm/sample.h", + "__cxx03/__algorithm/search.h", + "__cxx03/__algorithm/search_n.h", + "__cxx03/__algorithm/set_difference.h", + "__cxx03/__algorithm/set_intersection.h", + "__cxx03/__algorithm/set_symmetric_difference.h", + "__cxx03/__algorithm/set_union.h", + "__cxx03/__algorithm/shift_left.h", + "__cxx03/__algorithm/shift_right.h", + "__cxx03/__algorithm/shuffle.h", + "__cxx03/__algorithm/sift_down.h", + "__cxx03/__algorithm/simd_utils.h", + "__cxx03/__algorithm/sort.h", + "__cxx03/__algorithm/sort_heap.h", + "__cxx03/__algorithm/stable_partition.h", + "__cxx03/__algorithm/stable_sort.h", + "__cxx03/__algorithm/swap_ranges.h", + "__cxx03/__algorithm/three_way_comp_ref_type.h", + "__cxx03/__algorithm/transform.h", + "__cxx03/__algorithm/uniform_random_bit_generator_adaptor.h", + "__cxx03/__algorithm/unique.h", + "__cxx03/__algorithm/unique_copy.h", + "__cxx03/__algorithm/unwrap_iter.h", + "__cxx03/__algorithm/unwrap_range.h", + "__cxx03/__algorithm/upper_bound.h", + "__cxx03/__atomic/aliases.h", + "__cxx03/__atomic/atomic.h", + "__cxx03/__atomic/atomic_base.h", + "__cxx03/__atomic/atomic_flag.h", + "__cxx03/__atomic/atomic_init.h", + "__cxx03/__atomic/atomic_lock_free.h", + "__cxx03/__atomic/atomic_ref.h", + "__cxx03/__atomic/atomic_sync.h", + "__cxx03/__atomic/check_memory_order.h", + "__cxx03/__atomic/contention_t.h", + "__cxx03/__atomic/cxx_atomic_impl.h", + "__cxx03/__atomic/fence.h", + "__cxx03/__atomic/is_always_lock_free.h", + "__cxx03/__atomic/kill_dependency.h", + "__cxx03/__atomic/memory_order.h", + "__cxx03/__atomic/to_gcc_order.h", + "__cxx03/__bit/bit_cast.h", + "__cxx03/__bit/bit_ceil.h", + "__cxx03/__bit/bit_floor.h", + "__cxx03/__bit/bit_log2.h", + "__cxx03/__bit/bit_width.h", + "__cxx03/__bit/blsr.h", + "__cxx03/__bit/byteswap.h", + "__cxx03/__bit/countl.h", + "__cxx03/__bit/countr.h", + "__cxx03/__bit/endian.h", + "__cxx03/__bit/has_single_bit.h", + "__cxx03/__bit/invert_if.h", + "__cxx03/__bit/popcount.h", + "__cxx03/__bit/rotate.h", + "__cxx03/__charconv/chars_format.h", + "__cxx03/__charconv/from_chars_integral.h", + "__cxx03/__charconv/from_chars_result.h", + "__cxx03/__charconv/tables.h", + "__cxx03/__charconv/to_chars.h", + "__cxx03/__charconv/to_chars_base_10.h", + "__cxx03/__charconv/to_chars_floating_point.h", + "__cxx03/__charconv/to_chars_integral.h", + "__cxx03/__charconv/to_chars_result.h", + "__cxx03/__charconv/traits.h", + "__cxx03/__chrono/calendar.h", + "__cxx03/__chrono/concepts.h", + "__cxx03/__chrono/convert_to_timespec.h", + "__cxx03/__chrono/convert_to_tm.h", + "__cxx03/__chrono/day.h", + "__cxx03/__chrono/duration.h", + "__cxx03/__chrono/exception.h", + "__cxx03/__chrono/file_clock.h", + "__cxx03/__chrono/formatter.h", + "__cxx03/__chrono/hh_mm_ss.h", + "__cxx03/__chrono/high_resolution_clock.h", + "__cxx03/__chrono/leap_second.h", + "__cxx03/__chrono/literals.h", + "__cxx03/__chrono/local_info.h", + "__cxx03/__chrono/month.h", + "__cxx03/__chrono/month_weekday.h", + "__cxx03/__chrono/monthday.h", + "__cxx03/__chrono/ostream.h", + "__cxx03/__chrono/parser_std_format_spec.h", + "__cxx03/__chrono/statically_widen.h", + "__cxx03/__chrono/steady_clock.h", + "__cxx03/__chrono/sys_info.h", + "__cxx03/__chrono/system_clock.h", + "__cxx03/__chrono/time_point.h", + "__cxx03/__chrono/time_zone.h", + "__cxx03/__chrono/time_zone_link.h", + "__cxx03/__chrono/tzdb.h", + "__cxx03/__chrono/tzdb_list.h", + "__cxx03/__chrono/weekday.h", + "__cxx03/__chrono/year.h", + "__cxx03/__chrono/year_month.h", + "__cxx03/__chrono/year_month_day.h", + "__cxx03/__chrono/year_month_weekday.h", + "__cxx03/__chrono/zoned_time.h", + "__cxx03/__compare/common_comparison_category.h", + "__cxx03/__compare/compare_partial_order_fallback.h", + "__cxx03/__compare/compare_strong_order_fallback.h", + "__cxx03/__compare/compare_three_way.h", + "__cxx03/__compare/compare_three_way_result.h", + "__cxx03/__compare/compare_weak_order_fallback.h", + "__cxx03/__compare/is_eq.h", + "__cxx03/__compare/ordering.h", + "__cxx03/__compare/partial_order.h", + "__cxx03/__compare/strong_order.h", + "__cxx03/__compare/synth_three_way.h", + "__cxx03/__compare/three_way_comparable.h", + "__cxx03/__compare/weak_order.h", + "__cxx03/__concepts/arithmetic.h", + "__cxx03/__concepts/assignable.h", + "__cxx03/__concepts/boolean_testable.h", + "__cxx03/__concepts/class_or_enum.h", + "__cxx03/__concepts/common_reference_with.h", + "__cxx03/__concepts/common_with.h", + "__cxx03/__concepts/constructible.h", + "__cxx03/__concepts/convertible_to.h", + "__cxx03/__concepts/copyable.h", + "__cxx03/__concepts/derived_from.h", + "__cxx03/__concepts/destructible.h", + "__cxx03/__concepts/different_from.h", + "__cxx03/__concepts/equality_comparable.h", + "__cxx03/__concepts/invocable.h", + "__cxx03/__concepts/movable.h", + "__cxx03/__concepts/predicate.h", + "__cxx03/__concepts/regular.h", + "__cxx03/__concepts/relation.h", + "__cxx03/__concepts/same_as.h", + "__cxx03/__concepts/semiregular.h", + "__cxx03/__concepts/swappable.h", + "__cxx03/__concepts/totally_ordered.h", + "__cxx03/__condition_variable/condition_variable.h", + "__cxx03/__configuration/abi.h", + "__cxx03/__configuration/availability.h", + "__cxx03/__configuration/compiler.h", + "__cxx03/__configuration/config_site_shim.h", + "__cxx03/__configuration/language.h", + "__cxx03/__configuration/platform.h", + "__cxx03/__coroutine/coroutine_handle.h", + "__cxx03/__coroutine/coroutine_traits.h", + "__cxx03/__coroutine/noop_coroutine_handle.h", + "__cxx03/__coroutine/trivial_awaitables.h", + "__cxx03/__debug_utils/randomize_range.h", + "__cxx03/__debug_utils/sanitizers.h", + "__cxx03/__debug_utils/strict_weak_ordering_check.h", + "__cxx03/__exception/exception.h", + "__cxx03/__exception/exception_ptr.h", + "__cxx03/__exception/nested_exception.h", + "__cxx03/__exception/operations.h", + "__cxx03/__exception/terminate.h", + "__cxx03/__expected/bad_expected_access.h", + "__cxx03/__expected/expected.h", + "__cxx03/__expected/unexpect.h", + "__cxx03/__expected/unexpected.h", + "__cxx03/__filesystem/copy_options.h", + "__cxx03/__filesystem/directory_entry.h", + "__cxx03/__filesystem/directory_iterator.h", + "__cxx03/__filesystem/directory_options.h", + "__cxx03/__filesystem/file_status.h", + "__cxx03/__filesystem/file_time_type.h", + "__cxx03/__filesystem/file_type.h", + "__cxx03/__filesystem/filesystem_error.h", + "__cxx03/__filesystem/operations.h", + "__cxx03/__filesystem/path.h", + "__cxx03/__filesystem/path_iterator.h", + "__cxx03/__filesystem/perm_options.h", + "__cxx03/__filesystem/perms.h", + "__cxx03/__filesystem/recursive_directory_iterator.h", + "__cxx03/__filesystem/space_info.h", + "__cxx03/__filesystem/u8path.h", + "__cxx03/__format/buffer.h", + "__cxx03/__format/concepts.h", + "__cxx03/__format/container_adaptor.h", + "__cxx03/__format/enable_insertable.h", + "__cxx03/__format/escaped_output_table.h", + "__cxx03/__format/extended_grapheme_cluster_table.h", + "__cxx03/__format/format_arg.h", + "__cxx03/__format/format_arg_store.h", + "__cxx03/__format/format_args.h", + "__cxx03/__format/format_context.h", + "__cxx03/__format/format_error.h", + "__cxx03/__format/format_functions.h", + "__cxx03/__format/format_parse_context.h", + "__cxx03/__format/format_string.h", + "__cxx03/__format/format_to_n_result.h", + "__cxx03/__format/formatter.h", + "__cxx03/__format/formatter_bool.h", + "__cxx03/__format/formatter_char.h", + "__cxx03/__format/formatter_floating_point.h", + "__cxx03/__format/formatter_integer.h", + "__cxx03/__format/formatter_integral.h", + "__cxx03/__format/formatter_output.h", + "__cxx03/__format/formatter_pointer.h", + "__cxx03/__format/formatter_string.h", + "__cxx03/__format/formatter_tuple.h", + "__cxx03/__format/indic_conjunct_break_table.h", + "__cxx03/__format/parser_std_format_spec.h", + "__cxx03/__format/range_default_formatter.h", + "__cxx03/__format/range_formatter.h", + "__cxx03/__format/unicode.h", + "__cxx03/__format/width_estimation_table.h", + "__cxx03/__format/write_escaped.h", + "__cxx03/__functional/binary_function.h", + "__cxx03/__functional/binary_negate.h", + "__cxx03/__functional/bind.h", + "__cxx03/__functional/bind_back.h", + "__cxx03/__functional/bind_front.h", + "__cxx03/__functional/binder1st.h", + "__cxx03/__functional/binder2nd.h", + "__cxx03/__functional/boyer_moore_searcher.h", + "__cxx03/__functional/compose.h", + "__cxx03/__functional/default_searcher.h", + "__cxx03/__functional/function.h", + "__cxx03/__functional/hash.h", + "__cxx03/__functional/identity.h", + "__cxx03/__functional/invoke.h", + "__cxx03/__functional/is_transparent.h", + "__cxx03/__functional/mem_fn.h", + "__cxx03/__functional/mem_fun_ref.h", + "__cxx03/__functional/not_fn.h", + "__cxx03/__functional/operations.h", + "__cxx03/__functional/perfect_forward.h", + "__cxx03/__functional/pointer_to_binary_function.h", + "__cxx03/__functional/pointer_to_unary_function.h", + "__cxx03/__functional/ranges_operations.h", + "__cxx03/__functional/reference_wrapper.h", + "__cxx03/__functional/unary_function.h", + "__cxx03/__functional/unary_negate.h", + "__cxx03/__functional/weak_result_type.h", + "__cxx03/__fwd/array.h", + "__cxx03/__fwd/bit_reference.h", + "__cxx03/__fwd/complex.h", + "__cxx03/__fwd/deque.h", + "__cxx03/__fwd/format.h", + "__cxx03/__fwd/fstream.h", + "__cxx03/__fwd/functional.h", + "__cxx03/__fwd/ios.h", + "__cxx03/__fwd/istream.h", + "__cxx03/__fwd/mdspan.h", + "__cxx03/__fwd/memory.h", + "__cxx03/__fwd/memory_resource.h", + "__cxx03/__fwd/ostream.h", + "__cxx03/__fwd/pair.h", + "__cxx03/__fwd/queue.h", + "__cxx03/__fwd/span.h", + "__cxx03/__fwd/sstream.h", + "__cxx03/__fwd/stack.h", + "__cxx03/__fwd/streambuf.h", + "__cxx03/__fwd/string.h", + "__cxx03/__fwd/string_view.h", + "__cxx03/__fwd/subrange.h", + "__cxx03/__fwd/tuple.h", + "__cxx03/__fwd/vector.h", + "__cxx03/__ios/fpos.h", + "__cxx03/__iterator/access.h", + "__cxx03/__iterator/advance.h", + "__cxx03/__iterator/aliasing_iterator.h", + "__cxx03/__iterator/back_insert_iterator.h", + "__cxx03/__iterator/bounded_iter.h", + "__cxx03/__iterator/common_iterator.h", + "__cxx03/__iterator/concepts.h", + "__cxx03/__iterator/counted_iterator.h", + "__cxx03/__iterator/cpp17_iterator_concepts.h", + "__cxx03/__iterator/data.h", + "__cxx03/__iterator/default_sentinel.h", + "__cxx03/__iterator/distance.h", + "__cxx03/__iterator/empty.h", + "__cxx03/__iterator/erase_if_container.h", + "__cxx03/__iterator/front_insert_iterator.h", + "__cxx03/__iterator/incrementable_traits.h", + "__cxx03/__iterator/indirectly_comparable.h", + "__cxx03/__iterator/insert_iterator.h", + "__cxx03/__iterator/istream_iterator.h", + "__cxx03/__iterator/istreambuf_iterator.h", + "__cxx03/__iterator/iter_move.h", + "__cxx03/__iterator/iter_swap.h", + "__cxx03/__iterator/iterator.h", + "__cxx03/__iterator/iterator_traits.h", + "__cxx03/__iterator/iterator_with_data.h", + "__cxx03/__iterator/mergeable.h", + "__cxx03/__iterator/move_iterator.h", + "__cxx03/__iterator/move_sentinel.h", + "__cxx03/__iterator/next.h", + "__cxx03/__iterator/ostream_iterator.h", + "__cxx03/__iterator/ostreambuf_iterator.h", + "__cxx03/__iterator/permutable.h", + "__cxx03/__iterator/prev.h", + "__cxx03/__iterator/projected.h", + "__cxx03/__iterator/ranges_iterator_traits.h", + "__cxx03/__iterator/readable_traits.h", + "__cxx03/__iterator/reverse_access.h", + "__cxx03/__iterator/reverse_iterator.h", + "__cxx03/__iterator/segmented_iterator.h", + "__cxx03/__iterator/size.h", + "__cxx03/__iterator/sortable.h", + "__cxx03/__iterator/unreachable_sentinel.h", + "__cxx03/__iterator/wrap_iter.h", + "__cxx03/__locale_dir/locale_base_api.h", + "__cxx03/__locale_dir/locale_base_api/android.h", + "__cxx03/__locale_dir/locale_base_api/bsd_locale_defaults.h", + "__cxx03/__locale_dir/locale_base_api/bsd_locale_fallbacks.h", + "__cxx03/__locale_dir/locale_base_api/fuchsia.h", + "__cxx03/__locale_dir/locale_base_api/ibm.h", + "__cxx03/__locale_dir/locale_base_api/locale_guard.h", + "__cxx03/__locale_dir/locale_base_api/musl.h", + "__cxx03/__locale_dir/locale_base_api/newlib.h", + "__cxx03/__locale_dir/locale_base_api/openbsd.h", + "__cxx03/__locale_dir/locale_base_api/win32.h", + "__cxx03/__math/abs.h", + "__cxx03/__math/copysign.h", + "__cxx03/__math/error_functions.h", + "__cxx03/__math/exponential_functions.h", + "__cxx03/__math/fdim.h", + "__cxx03/__math/fma.h", + "__cxx03/__math/gamma.h", + "__cxx03/__math/hyperbolic_functions.h", + "__cxx03/__math/hypot.h", + "__cxx03/__math/inverse_hyperbolic_functions.h", + "__cxx03/__math/inverse_trigonometric_functions.h", + "__cxx03/__math/logarithms.h", + "__cxx03/__math/min_max.h", + "__cxx03/__math/modulo.h", + "__cxx03/__math/remainder.h", + "__cxx03/__math/roots.h", + "__cxx03/__math/rounding_functions.h", + "__cxx03/__math/special_functions.h", + "__cxx03/__math/traits.h", + "__cxx03/__math/trigonometric_functions.h", + "__cxx03/__mbstate_t.h", + "__cxx03/__mdspan/default_accessor.h", + "__cxx03/__mdspan/extents.h", + "__cxx03/__mdspan/layout_left.h", + "__cxx03/__mdspan/layout_right.h", + "__cxx03/__mdspan/layout_stride.h", + "__cxx03/__mdspan/mdspan.h", + "__cxx03/__memory/addressof.h", + "__cxx03/__memory/align.h", + "__cxx03/__memory/aligned_alloc.h", + "__cxx03/__memory/allocate_at_least.h", + "__cxx03/__memory/allocation_guard.h", + "__cxx03/__memory/allocator.h", + "__cxx03/__memory/allocator_arg_t.h", + "__cxx03/__memory/allocator_destructor.h", + "__cxx03/__memory/allocator_traits.h", + "__cxx03/__memory/assume_aligned.h", + "__cxx03/__memory/auto_ptr.h", + "__cxx03/__memory/builtin_new_allocator.h", + "__cxx03/__memory/compressed_pair.h", + "__cxx03/__memory/concepts.h", + "__cxx03/__memory/construct_at.h", + "__cxx03/__memory/destruct_n.h", + "__cxx03/__memory/inout_ptr.h", + "__cxx03/__memory/out_ptr.h", + "__cxx03/__memory/pointer_traits.h", + "__cxx03/__memory/ranges_construct_at.h", + "__cxx03/__memory/ranges_uninitialized_algorithms.h", + "__cxx03/__memory/raw_storage_iterator.h", + "__cxx03/__memory/shared_ptr.h", + "__cxx03/__memory/swap_allocator.h", + "__cxx03/__memory/temp_value.h", + "__cxx03/__memory/temporary_buffer.h", + "__cxx03/__memory/uninitialized_algorithms.h", + "__cxx03/__memory/unique_ptr.h", + "__cxx03/__memory/uses_allocator.h", + "__cxx03/__memory/uses_allocator_construction.h", + "__cxx03/__memory/voidify.h", + "__cxx03/__memory_resource/memory_resource.h", + "__cxx03/__memory_resource/monotonic_buffer_resource.h", + "__cxx03/__memory_resource/polymorphic_allocator.h", + "__cxx03/__memory_resource/pool_options.h", + "__cxx03/__memory_resource/synchronized_pool_resource.h", + "__cxx03/__memory_resource/unsynchronized_pool_resource.h", + "__cxx03/__mutex/lock_guard.h", + "__cxx03/__mutex/mutex.h", + "__cxx03/__mutex/once_flag.h", + "__cxx03/__mutex/tag_types.h", + "__cxx03/__mutex/unique_lock.h", + "__cxx03/__numeric/accumulate.h", + "__cxx03/__numeric/adjacent_difference.h", + "__cxx03/__numeric/exclusive_scan.h", + "__cxx03/__numeric/gcd_lcm.h", + "__cxx03/__numeric/inclusive_scan.h", + "__cxx03/__numeric/inner_product.h", + "__cxx03/__numeric/iota.h", + "__cxx03/__numeric/midpoint.h", + "__cxx03/__numeric/partial_sum.h", + "__cxx03/__numeric/pstl.h", + "__cxx03/__numeric/reduce.h", + "__cxx03/__numeric/saturation_arithmetic.h", + "__cxx03/__numeric/transform_exclusive_scan.h", + "__cxx03/__numeric/transform_inclusive_scan.h", + "__cxx03/__numeric/transform_reduce.h", + "__cxx03/__ostream/basic_ostream.h", + "__cxx03/__ostream/print.h", + "__cxx03/__pstl/backend.h", + "__cxx03/__pstl/backend_fwd.h", + "__cxx03/__pstl/backends/default.h", + "__cxx03/__pstl/backends/libdispatch.h", + "__cxx03/__pstl/backends/serial.h", + "__cxx03/__pstl/backends/std_thread.h", + "__cxx03/__pstl/cpu_algos/any_of.h", + "__cxx03/__pstl/cpu_algos/cpu_traits.h", + "__cxx03/__pstl/cpu_algos/fill.h", + "__cxx03/__pstl/cpu_algos/find_if.h", + "__cxx03/__pstl/cpu_algos/for_each.h", + "__cxx03/__pstl/cpu_algos/merge.h", + "__cxx03/__pstl/cpu_algos/stable_sort.h", + "__cxx03/__pstl/cpu_algos/transform.h", + "__cxx03/__pstl/cpu_algos/transform_reduce.h", + "__cxx03/__pstl/dispatch.h", + "__cxx03/__pstl/handle_exception.h", + "__cxx03/__random/bernoulli_distribution.h", + "__cxx03/__random/binomial_distribution.h", + "__cxx03/__random/cauchy_distribution.h", + "__cxx03/__random/chi_squared_distribution.h", + "__cxx03/__random/clamp_to_integral.h", + "__cxx03/__random/default_random_engine.h", + "__cxx03/__random/discard_block_engine.h", + "__cxx03/__random/discrete_distribution.h", + "__cxx03/__random/exponential_distribution.h", + "__cxx03/__random/extreme_value_distribution.h", + "__cxx03/__random/fisher_f_distribution.h", + "__cxx03/__random/gamma_distribution.h", + "__cxx03/__random/generate_canonical.h", + "__cxx03/__random/geometric_distribution.h", + "__cxx03/__random/independent_bits_engine.h", + "__cxx03/__random/is_seed_sequence.h", + "__cxx03/__random/is_valid.h", + "__cxx03/__random/knuth_b.h", + "__cxx03/__random/linear_congruential_engine.h", + "__cxx03/__random/log2.h", + "__cxx03/__random/lognormal_distribution.h", + "__cxx03/__random/mersenne_twister_engine.h", + "__cxx03/__random/negative_binomial_distribution.h", + "__cxx03/__random/normal_distribution.h", + "__cxx03/__random/piecewise_constant_distribution.h", + "__cxx03/__random/piecewise_linear_distribution.h", + "__cxx03/__random/poisson_distribution.h", + "__cxx03/__random/random_device.h", + "__cxx03/__random/ranlux.h", + "__cxx03/__random/seed_seq.h", + "__cxx03/__random/shuffle_order_engine.h", + "__cxx03/__random/student_t_distribution.h", + "__cxx03/__random/subtract_with_carry_engine.h", + "__cxx03/__random/uniform_int_distribution.h", + "__cxx03/__random/uniform_random_bit_generator.h", + "__cxx03/__random/uniform_real_distribution.h", + "__cxx03/__random/weibull_distribution.h", + "__cxx03/__ranges/access.h", + "__cxx03/__ranges/all.h", + "__cxx03/__ranges/as_rvalue_view.h", + "__cxx03/__ranges/chunk_by_view.h", + "__cxx03/__ranges/common_view.h", + "__cxx03/__ranges/concepts.h", + "__cxx03/__ranges/container_compatible_range.h", + "__cxx03/__ranges/counted.h", + "__cxx03/__ranges/dangling.h", + "__cxx03/__ranges/data.h", + "__cxx03/__ranges/drop_view.h", + "__cxx03/__ranges/drop_while_view.h", + "__cxx03/__ranges/elements_view.h", + "__cxx03/__ranges/empty.h", + "__cxx03/__ranges/empty_view.h", + "__cxx03/__ranges/enable_borrowed_range.h", + "__cxx03/__ranges/enable_view.h", + "__cxx03/__ranges/filter_view.h", + "__cxx03/__ranges/from_range.h", + "__cxx03/__ranges/iota_view.h", + "__cxx03/__ranges/istream_view.h", + "__cxx03/__ranges/join_view.h", + "__cxx03/__ranges/lazy_split_view.h", + "__cxx03/__ranges/movable_box.h", + "__cxx03/__ranges/non_propagating_cache.h", + "__cxx03/__ranges/owning_view.h", + "__cxx03/__ranges/range_adaptor.h", + "__cxx03/__ranges/rbegin.h", + "__cxx03/__ranges/ref_view.h", + "__cxx03/__ranges/rend.h", + "__cxx03/__ranges/repeat_view.h", + "__cxx03/__ranges/reverse_view.h", + "__cxx03/__ranges/single_view.h", + "__cxx03/__ranges/size.h", + "__cxx03/__ranges/split_view.h", + "__cxx03/__ranges/subrange.h", + "__cxx03/__ranges/take_view.h", + "__cxx03/__ranges/take_while_view.h", + "__cxx03/__ranges/to.h", + "__cxx03/__ranges/transform_view.h", + "__cxx03/__ranges/view_interface.h", + "__cxx03/__ranges/views.h", + "__cxx03/__ranges/zip_view.h", + "__cxx03/__std_mbstate_t.h", + "__cxx03/__stop_token/atomic_unique_lock.h", + "__cxx03/__stop_token/intrusive_list_view.h", + "__cxx03/__stop_token/intrusive_shared_ptr.h", + "__cxx03/__stop_token/stop_callback.h", + "__cxx03/__stop_token/stop_source.h", + "__cxx03/__stop_token/stop_state.h", + "__cxx03/__stop_token/stop_token.h", + "__cxx03/__string/char_traits.h", + "__cxx03/__string/constexpr_c_functions.h", + "__cxx03/__string/extern_template_lists.h", + "__cxx03/__support/ibm/gettod_zos.h", + "__cxx03/__support/ibm/locale_mgmt_zos.h", + "__cxx03/__support/ibm/nanosleep.h", + "__cxx03/__support/xlocale/__nop_locale_mgmt.h", + "__cxx03/__support/xlocale/__posix_l_fallback.h", + "__cxx03/__support/xlocale/__strtonum_fallback.h", + "__cxx03/__system_error/errc.h", + "__cxx03/__system_error/error_category.h", + "__cxx03/__system_error/error_code.h", + "__cxx03/__system_error/error_condition.h", + "__cxx03/__system_error/system_error.h", + "__cxx03/__thread/formatter.h", + "__cxx03/__thread/id.h", + "__cxx03/__thread/jthread.h", + "__cxx03/__thread/poll_with_backoff.h", + "__cxx03/__thread/support.h", + "__cxx03/__thread/support/c11.h", + "__cxx03/__thread/support/external.h", + "__cxx03/__thread/support/pthread.h", + "__cxx03/__thread/support/windows.h", + "__cxx03/__thread/this_thread.h", + "__cxx03/__thread/thread.h", + "__cxx03/__thread/timed_backoff_policy.h", + "__cxx03/__tuple/find_index.h", + "__cxx03/__tuple/ignore.h", + "__cxx03/__tuple/make_tuple_types.h", + "__cxx03/__tuple/sfinae_helpers.h", + "__cxx03/__tuple/tuple_element.h", + "__cxx03/__tuple/tuple_indices.h", + "__cxx03/__tuple/tuple_like.h", + "__cxx03/__tuple/tuple_like_ext.h", + "__cxx03/__tuple/tuple_like_no_subrange.h", + "__cxx03/__tuple/tuple_size.h", + "__cxx03/__tuple/tuple_types.h", + "__cxx03/__type_traits/add_const.h", + "__cxx03/__type_traits/add_cv.h", + "__cxx03/__type_traits/add_lvalue_reference.h", + "__cxx03/__type_traits/add_pointer.h", + "__cxx03/__type_traits/add_rvalue_reference.h", + "__cxx03/__type_traits/add_volatile.h", + "__cxx03/__type_traits/aligned_storage.h", + "__cxx03/__type_traits/aligned_union.h", + "__cxx03/__type_traits/alignment_of.h", + "__cxx03/__type_traits/can_extract_key.h", + "__cxx03/__type_traits/common_reference.h", + "__cxx03/__type_traits/common_type.h", + "__cxx03/__type_traits/conditional.h", + "__cxx03/__type_traits/conjunction.h", + "__cxx03/__type_traits/copy_cv.h", + "__cxx03/__type_traits/copy_cvref.h", + "__cxx03/__type_traits/datasizeof.h", + "__cxx03/__type_traits/decay.h", + "__cxx03/__type_traits/dependent_type.h", + "__cxx03/__type_traits/desugars_to.h", + "__cxx03/__type_traits/disjunction.h", + "__cxx03/__type_traits/enable_if.h", + "__cxx03/__type_traits/extent.h", + "__cxx03/__type_traits/has_unique_object_representation.h", + "__cxx03/__type_traits/has_virtual_destructor.h", + "__cxx03/__type_traits/integral_constant.h", + "__cxx03/__type_traits/invoke.h", + "__cxx03/__type_traits/is_abstract.h", + "__cxx03/__type_traits/is_aggregate.h", + "__cxx03/__type_traits/is_allocator.h", + "__cxx03/__type_traits/is_always_bitcastable.h", + "__cxx03/__type_traits/is_arithmetic.h", + "__cxx03/__type_traits/is_array.h", + "__cxx03/__type_traits/is_assignable.h", + "__cxx03/__type_traits/is_base_of.h", + "__cxx03/__type_traits/is_bounded_array.h", + "__cxx03/__type_traits/is_callable.h", + "__cxx03/__type_traits/is_char_like_type.h", + "__cxx03/__type_traits/is_class.h", + "__cxx03/__type_traits/is_compound.h", + "__cxx03/__type_traits/is_const.h", + "__cxx03/__type_traits/is_constant_evaluated.h", + "__cxx03/__type_traits/is_constructible.h", + "__cxx03/__type_traits/is_convertible.h", + "__cxx03/__type_traits/is_core_convertible.h", + "__cxx03/__type_traits/is_destructible.h", + "__cxx03/__type_traits/is_empty.h", + "__cxx03/__type_traits/is_enum.h", + "__cxx03/__type_traits/is_equality_comparable.h", + "__cxx03/__type_traits/is_execution_policy.h", + "__cxx03/__type_traits/is_final.h", + "__cxx03/__type_traits/is_floating_point.h", + "__cxx03/__type_traits/is_function.h", + "__cxx03/__type_traits/is_fundamental.h", + "__cxx03/__type_traits/is_implicitly_default_constructible.h", + "__cxx03/__type_traits/is_integral.h", + "__cxx03/__type_traits/is_literal_type.h", + "__cxx03/__type_traits/is_member_pointer.h", + "__cxx03/__type_traits/is_nothrow_assignable.h", + "__cxx03/__type_traits/is_nothrow_constructible.h", + "__cxx03/__type_traits/is_nothrow_convertible.h", + "__cxx03/__type_traits/is_nothrow_destructible.h", + "__cxx03/__type_traits/is_null_pointer.h", + "__cxx03/__type_traits/is_object.h", + "__cxx03/__type_traits/is_pod.h", + "__cxx03/__type_traits/is_pointer.h", + "__cxx03/__type_traits/is_polymorphic.h", + "__cxx03/__type_traits/is_primary_template.h", + "__cxx03/__type_traits/is_reference.h", + "__cxx03/__type_traits/is_reference_wrapper.h", + "__cxx03/__type_traits/is_referenceable.h", + "__cxx03/__type_traits/is_same.h", + "__cxx03/__type_traits/is_scalar.h", + "__cxx03/__type_traits/is_signed.h", + "__cxx03/__type_traits/is_signed_integer.h", + "__cxx03/__type_traits/is_specialization.h", + "__cxx03/__type_traits/is_standard_layout.h", + "__cxx03/__type_traits/is_swappable.h", + "__cxx03/__type_traits/is_trivial.h", + "__cxx03/__type_traits/is_trivially_assignable.h", + "__cxx03/__type_traits/is_trivially_constructible.h", + "__cxx03/__type_traits/is_trivially_copyable.h", + "__cxx03/__type_traits/is_trivially_destructible.h", + "__cxx03/__type_traits/is_trivially_lexicographically_comparable.h", + "__cxx03/__type_traits/is_trivially_relocatable.h", + "__cxx03/__type_traits/is_unbounded_array.h", + "__cxx03/__type_traits/is_union.h", + "__cxx03/__type_traits/is_unsigned.h", + "__cxx03/__type_traits/is_unsigned_integer.h", + "__cxx03/__type_traits/is_valid_expansion.h", + "__cxx03/__type_traits/is_void.h", + "__cxx03/__type_traits/is_volatile.h", + "__cxx03/__type_traits/lazy.h", + "__cxx03/__type_traits/make_32_64_or_128_bit.h", + "__cxx03/__type_traits/make_const_lvalue_ref.h", + "__cxx03/__type_traits/make_signed.h", + "__cxx03/__type_traits/make_unsigned.h", + "__cxx03/__type_traits/maybe_const.h", + "__cxx03/__type_traits/nat.h", + "__cxx03/__type_traits/negation.h", + "__cxx03/__type_traits/noexcept_move_assign_container.h", + "__cxx03/__type_traits/promote.h", + "__cxx03/__type_traits/rank.h", + "__cxx03/__type_traits/remove_all_extents.h", + "__cxx03/__type_traits/remove_const.h", + "__cxx03/__type_traits/remove_const_ref.h", + "__cxx03/__type_traits/remove_cv.h", + "__cxx03/__type_traits/remove_cvref.h", + "__cxx03/__type_traits/remove_extent.h", + "__cxx03/__type_traits/remove_pointer.h", + "__cxx03/__type_traits/remove_reference.h", + "__cxx03/__type_traits/remove_volatile.h", + "__cxx03/__type_traits/result_of.h", + "__cxx03/__type_traits/strip_signature.h", + "__cxx03/__type_traits/type_identity.h", + "__cxx03/__type_traits/type_list.h", + "__cxx03/__type_traits/underlying_type.h", + "__cxx03/__type_traits/unwrap_ref.h", + "__cxx03/__type_traits/void_t.h", + "__cxx03/__utility/as_const.h", + "__cxx03/__utility/as_lvalue.h", + "__cxx03/__utility/auto_cast.h", + "__cxx03/__utility/cmp.h", + "__cxx03/__utility/convert_to_integral.h", + "__cxx03/__utility/declval.h", + "__cxx03/__utility/empty.h", + "__cxx03/__utility/exception_guard.h", + "__cxx03/__utility/exchange.h", + "__cxx03/__utility/forward.h", + "__cxx03/__utility/forward_like.h", + "__cxx03/__utility/in_place.h", + "__cxx03/__utility/integer_sequence.h", + "__cxx03/__utility/is_pointer_in_range.h", + "__cxx03/__utility/is_valid_range.h", + "__cxx03/__utility/move.h", + "__cxx03/__utility/no_destroy.h", + "__cxx03/__utility/pair.h", + "__cxx03/__utility/piecewise_construct.h", + "__cxx03/__utility/priority_tag.h", + "__cxx03/__utility/private_constructor_tag.h", + "__cxx03/__utility/rel_ops.h", + "__cxx03/__utility/small_buffer.h", + "__cxx03/__utility/swap.h", + "__cxx03/__utility/to_underlying.h", + "__cxx03/__utility/unreachable.h", + "__cxx03/__variant/monostate.h", + "__cxx03/complex.h", + "__cxx03/ctype.h", + "__cxx03/errno.h", + "__cxx03/experimental/__simd/aligned_tag.h", + "__cxx03/experimental/__simd/declaration.h", + "__cxx03/experimental/__simd/reference.h", + "__cxx03/experimental/__simd/scalar.h", + "__cxx03/experimental/__simd/simd.h", + "__cxx03/experimental/__simd/simd_mask.h", + "__cxx03/experimental/__simd/traits.h", + "__cxx03/experimental/__simd/utility.h", + "__cxx03/experimental/__simd/vec_ext.h", + "__cxx03/fenv.h", + "__cxx03/float.h", + "__cxx03/inttypes.h", + "__cxx03/locale.h", + "__cxx03/math.h", + "__cxx03/stdatomic.h", + "__cxx03/stdbool.h", + "__cxx03/stddef.h", + "__cxx03/stdint.h", + "__cxx03/stdio.h", + "__cxx03/stdlib.h", + "__cxx03/string.h", + "__cxx03/tgmath.h", + "__cxx03/uchar.h", + "__cxx03/wchar.h", + "__cxx03/wctype.h", "__debug_utils/randomize_range.h", "__debug_utils/sanitizers.h", "__debug_utils/strict_weak_ordering_check.h", From bb86c5dd4d32c42183ed27a1ff7b34b1201215c4 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 21 Dec 2024 15:55:18 +0000 Subject: [PATCH 068/466] [VPlan] Use inferScalarType in VPInstruction::ResumePhi codegen (NFC). Use VPlan-based type analysis to retrieve type of phi node. Also adds missing type inference for ResumePhi and ComputeReductionResult opcodes. --- llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp | 6 ++++++ llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp index 0d981ff5826ed..35497a7431f76 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp @@ -61,10 +61,16 @@ Type *VPTypeAnalysis::inferScalarTypeForRecipe(const VPInstruction *R) { case Instruction::ICmp: case VPInstruction::ActiveLaneMask: return inferScalarType(R->getOperand(1)); + case VPInstruction::ComputeReductionResult: { + auto *PhiR = cast(R->getOperand(0)); + auto *OrigPhi = cast(PhiR->getUnderlyingValue()); + return OrigPhi->getType(); + } case VPInstruction::ExplicitVectorLength: return Type::getIntNTy(Ctx, 32); case VPInstruction::FirstOrderRecurrenceSplice: case VPInstruction::Not: + case VPInstruction::ResumePhi: return SetResultTyFromOp(); case VPInstruction::ExtractFromEnd: { Type *BaseTy = inferScalarType(R->getOperand(0)); diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index cda90d70e5c8d..2f9ff3e420433 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -629,7 +629,7 @@ Value *VPInstruction::generate(VPTransformState &State) { Value *IncomingFromOtherPreds = State.get(getOperand(1), /* IsScalar */ true); auto *NewPhi = - Builder.CreatePHI(IncomingFromOtherPreds->getType(), 2, Name); + Builder.CreatePHI(State.TypeAnalysis.inferScalarType(this), 2, Name); BasicBlock *VPlanPred = State.CFG .VPBB2IRBB[cast(getParent()->getPredecessors()[0])]; From 1e146dfb4fc82229c17ba5a7da847d87de214351 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 21 Dec 2024 08:17:41 -0800 Subject: [PATCH 069/466] [Sema] Migrate away from PointerUnion::{is,get} (NFC) (#120829) Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa, cast and the llvm::dyn_cast I'm moving the definitions of several functions to SemaConcept.cpp because llvm::cast requires the full definitions of NormalizedConstraintPair, which is used like so: using CompoundConstraint = llvm::PointerIntPair; --- clang/include/clang/Sema/SemaConcept.h | 23 ++++++----------------- clang/lib/Sema/SemaConcept.cpp | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/clang/include/clang/Sema/SemaConcept.h b/clang/include/clang/Sema/SemaConcept.h index fa5309a597b3a..5c599a70532f6 100644 --- a/clang/include/clang/Sema/SemaConcept.h +++ b/clang/include/clang/Sema/SemaConcept.h @@ -135,31 +135,20 @@ struct NormalizedConstraint { return *this; } - bool isAtomic() const { return Constraint.is(); } + bool isAtomic() const { return llvm::isa(Constraint); } bool isFoldExpanded() const { - return Constraint.is(); + return llvm::isa(Constraint); } - bool isCompound() const { return Constraint.is(); } + bool isCompound() const { return llvm::isa(Constraint); } - CompoundConstraintKind getCompoundKind() const { - assert(isCompound() && "getCompoundKind on a non-compound constraint.."); - return Constraint.get().getInt(); - } + CompoundConstraintKind getCompoundKind() const; NormalizedConstraint &getLHS() const; NormalizedConstraint &getRHS() const; - AtomicConstraint *getAtomicConstraint() const { - assert(isAtomic() && - "getAtomicConstraint called on non-atomic constraint."); - return Constraint.get(); - } + AtomicConstraint *getAtomicConstraint() const; - FoldExpandedConstraint *getFoldExpandedConstraint() const { - assert(isFoldExpanded() && - "getFoldExpandedConstraint called on non-fold-expanded constraint."); - return Constraint.get(); - } + FoldExpandedConstraint *getFoldExpandedConstraint() const; private: static std::optional diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp index ff1df7b71b1a4..539de00bd104f 100644 --- a/clang/lib/Sema/SemaConcept.cpp +++ b/clang/lib/Sema/SemaConcept.cpp @@ -1958,3 +1958,21 @@ concepts::TypeRequirement::TypeRequirement(TypeSourceInfo *T) : Value(T), Status(T->getType()->isInstantiationDependentType() ? SS_Dependent : SS_Satisfied) {} + +NormalizedConstraint::CompoundConstraintKind +NormalizedConstraint::getCompoundKind() const { + assert(isCompound() && "getCompoundKind on a non-compound constraint.."); + return cast(Constraint).getInt(); +} + +AtomicConstraint *NormalizedConstraint::getAtomicConstraint() const { + assert(isAtomic() && "getAtomicConstraint called on non-atomic constraint."); + return cast(Constraint); +} + +FoldExpandedConstraint * +NormalizedConstraint::getFoldExpandedConstraint() const { + assert(isFoldExpanded() && + "getFoldExpandedConstraint called on non-fold-expanded constraint."); + return cast(Constraint); +} From 129f1001c3b1b5200de43917d53c0efbdf08f11f Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 21 Dec 2024 08:17:51 -0800 Subject: [PATCH 070/466] [Dialect] Migrate away from PointerUnion::{is,get} (NFC) (#120818) Note that PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa, cast and the llvm::dyn_cast I'm not touching PointerUnion::dyn_cast for now because it's a bit complicated; we could blindly migrate it to dyn_cast_if_present, but we should probably use dyn_cast when the operand is known to be non-null. --- mlir/lib/Dialect/Arith/Utils/Utils.cpp | 2 +- .../IR/BufferizableOpInterface.cpp | 2 +- mlir/lib/Dialect/DLTI/DLTI.cpp | 6 ++--- mlir/lib/Dialect/GPU/TransformOps/Utils.cpp | 26 +++++++++---------- .../Dialect/Mesh/Transforms/Transforms.cpp | 2 +- mlir/lib/Dialect/Ptr/IR/PtrTypes.cpp | 6 ++--- mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp | 2 +- .../Transforms/Utils/LoopEmitter.cpp | 2 +- .../Interfaces/TransformInterfaces.cpp | 8 +++--- mlir/lib/Dialect/Utils/StaticValueUtils.cpp | 12 ++++----- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/mlir/lib/Dialect/Arith/Utils/Utils.cpp b/mlir/lib/Dialect/Arith/Utils/Utils.cpp index 67dcce454f028..0fa7d32184411 100644 --- a/mlir/lib/Dialect/Arith/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Arith/Utils/Utils.cpp @@ -66,7 +66,7 @@ mlir::inferExpandShapeOutputShape(OpBuilder &b, Location loc, int64_t inputIndex = it.index(); // Call get() under the assumption that we're not casting // dynamism. - Value indexGroupSize = inputShape[inputIndex].get(); + Value indexGroupSize = cast(inputShape[inputIndex]); Value indexGroupStaticSizesProduct = b.create(loc, indexGroupStaticSizesProductInt); Value dynamicDimSize = b.createOrFold( diff --git a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp index f8a7a22787404..349841f06959c 100644 --- a/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp +++ b/mlir/lib/Dialect/Bufferization/IR/BufferizableOpInterface.cpp @@ -174,7 +174,7 @@ FailureOr bufferization::allocateTensorForShapedValue( resultDims[llvm::cast(shapedValue).getResultNumber()]; for (const auto &dim : enumerate(tensorType.getShape())) if (ShapedType::isDynamic(dim.value())) - dynamicSizes.push_back(shape[dim.index()].get()); + dynamicSizes.push_back(cast(shape[dim.index()])); } } diff --git a/mlir/lib/Dialect/DLTI/DLTI.cpp b/mlir/lib/Dialect/DLTI/DLTI.cpp index 508e50d42e4cf..2510e774f2b2a 100644 --- a/mlir/lib/Dialect/DLTI/DLTI.cpp +++ b/mlir/lib/Dialect/DLTI/DLTI.cpp @@ -312,7 +312,7 @@ combineOneSpec(DataLayoutSpecInterface spec, continue; } - Type typeSample = kvp.second.front().getKey().get(); + Type typeSample = cast(kvp.second.front().getKey()); assert(&typeSample.getDialect() != typeSample.getContext()->getLoadedDialect() && "unexpected data layout entry for built-in type"); @@ -325,7 +325,7 @@ combineOneSpec(DataLayoutSpecInterface spec, } for (const auto &kvp : newEntriesForID) { - StringAttr id = kvp.second.getKey().get(); + StringAttr id = cast(kvp.second.getKey()); Dialect *dialect = id.getReferencedDialect(); if (!entriesForID.count(id)) { entriesForID[id] = kvp.second; @@ -574,7 +574,7 @@ class TargetDataLayoutInterface : public DataLayoutDialectInterface { LogicalResult verifyEntry(DataLayoutEntryInterface entry, Location loc) const final { - StringRef entryName = entry.getKey().get().strref(); + StringRef entryName = cast(entry.getKey()).strref(); if (entryName == DLTIDialect::kDataLayoutEndiannessKey) { auto value = dyn_cast(entry.getValue()); if (value && diff --git a/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp b/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp index 17bda27b55811..f4d36129bae77 100644 --- a/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp +++ b/mlir/lib/Dialect/GPU/TransformOps/Utils.cpp @@ -113,16 +113,17 @@ static GpuIdBuilderFnType commonLinearIdBuilderFn(int64_t multiplicity = 1) { // clang-format on // Return n-D ids for indexing and 1-D size + id for predicate generation. - return IdBuilderResult{ - /*mappingIdOps=*/ids, - /*availableMappingSizes=*/ - SmallVector{computeProduct(originalBasis)}, - // `forallMappingSizes` iterate in the scaled basis, they need to be - // scaled back into the original basis to provide tight - // activeMappingSizes quantities for predication. - /*activeMappingSizes=*/ - SmallVector{computeProduct(forallMappingSizes) * multiplicity}, - /*activeIdOps=*/SmallVector{linearId.get()}}; + return IdBuilderResult{ + /*mappingIdOps=*/ids, + /*availableMappingSizes=*/ + SmallVector{computeProduct(originalBasis)}, + // `forallMappingSizes` iterate in the scaled basis, they need to be + // scaled back into the original basis to provide tight + // activeMappingSizes quantities for predication. + /*activeMappingSizes=*/ + SmallVector{computeProduct(forallMappingSizes) * + multiplicity}, + /*activeIdOps=*/SmallVector{cast(linearId)}}; }; return res; @@ -144,9 +145,8 @@ static GpuIdBuilderFnType common3DIdBuilderFn(int64_t multiplicity = 1) { // In the 3-D mapping case, scale the first dimension by the multiplicity. SmallVector scaledIds = ids; AffineExpr d0 = getAffineDimExpr(0, rewriter.getContext()); - scaledIds[0] = affine::makeComposedFoldedAffineApply( - rewriter, loc, d0.floorDiv(multiplicity), {scaledIds[0]}) - .get(); + scaledIds[0] = cast(affine::makeComposedFoldedAffineApply( + rewriter, loc, d0.floorDiv(multiplicity), {scaledIds[0]})); // In the 3-D mapping case, unscale the first dimension by the multiplicity. SmallVector forallMappingSizeInOriginalBasis(forallMappingSizes); forallMappingSizeInOriginalBasis[0] *= multiplicity; diff --git a/mlir/lib/Dialect/Mesh/Transforms/Transforms.cpp b/mlir/lib/Dialect/Mesh/Transforms/Transforms.cpp index 60c4e07a118cb..447668cc0ea50 100644 --- a/mlir/lib/Dialect/Mesh/Transforms/Transforms.cpp +++ b/mlir/lib/Dialect/Mesh/Transforms/Transforms.cpp @@ -217,7 +217,7 @@ TypedValue createProcessLinearIndex(StringRef mesh, OpFoldResult processInGroupLinearIndex = affine::linearizeIndex( llvm::to_vector_of(processInGroupMultiIndex), llvm::to_vector_of(processGroupShape), builder); - return cast>(processInGroupLinearIndex.get()); + return cast>(cast(processInGroupLinearIndex)); } } // namespace mlir::mesh diff --git a/mlir/lib/Dialect/Ptr/IR/PtrTypes.cpp b/mlir/lib/Dialect/Ptr/IR/PtrTypes.cpp index 2866d4eb10feb..49c8ed977d50c 100644 --- a/mlir/lib/Dialect/Ptr/IR/PtrTypes.cpp +++ b/mlir/lib/Dialect/Ptr/IR/PtrTypes.cpp @@ -33,7 +33,7 @@ static SpecAttr getPointerSpec(DataLayoutEntryListRef params, PtrType type) { for (DataLayoutEntryInterface entry : params) { if (!entry.isTypeEntry()) continue; - if (cast(entry.getKey().get()).getMemorySpace() == + if (cast(cast(entry.getKey())).getMemorySpace() == type.getMemorySpace()) { if (auto spec = dyn_cast(entry.getValue())) return spec; @@ -55,7 +55,7 @@ bool PtrType::areCompatible(DataLayoutEntryListRef oldLayout, continue; uint32_t size = kDefaultPointerSizeBits; uint32_t abi = kDefaultPointerAlignment; - auto newType = llvm::cast(newEntry.getKey().get()); + auto newType = llvm::cast(llvm::cast(newEntry.getKey())); const auto *it = llvm::find_if(oldLayout, [&](DataLayoutEntryInterface entry) { if (auto type = llvm::dyn_cast_if_present(entry.getKey())) { @@ -134,7 +134,7 @@ LogicalResult PtrType::verifyEntries(DataLayoutEntryListRef entries, for (DataLayoutEntryInterface entry : entries) { if (!entry.isTypeEntry()) continue; - auto key = entry.getKey().get(); + auto key = llvm::cast(entry.getKey()); if (!llvm::isa(entry.getValue())) { return emitError(loc) << "expected layout attribute for " << key << " to be a #ptr.spec attribute"; diff --git a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp index 3e317319b68fc..191bb330df756 100644 --- a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp @@ -205,7 +205,7 @@ CallInterfaceCallable FunctionCallOp::getCallableForCallee() { } void FunctionCallOp::setCalleeFromCallable(CallInterfaceCallable callee) { - (*this)->setAttr(getCalleeAttrName(), callee.get()); + (*this)->setAttr(getCalleeAttrName(), cast(callee)); } Operation::operand_range FunctionCallOp::getArgOperands() { diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp index cb5874ff45068..ea5533dfc6bac 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp @@ -87,7 +87,7 @@ static Value unFoldOpIntResult(OpBuilder &builder, Location loc, OpFoldResult ofr) { if (std::optional i = getConstantIntValue(ofr); i.has_value()) return constantIndex(builder, loc, *i); - return ofr.get(); + return cast(ofr); } static Value tryFoldTensors(Value t) { diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp index fdd968238667e..1e0ef5add358e 100644 --- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp +++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp @@ -1475,19 +1475,19 @@ transform::detail::checkApplyToOne(Operation *transformOp, if (ptr.isNull()) continue; if (llvm::isa(res.getType()) && - !ptr.is()) { + !isa(ptr)) { return emitDiag() << "application of " << transformOpName << " expected to produce an Operation * for result #" << res.getResultNumber(); } if (llvm::isa(res.getType()) && - !ptr.is()) { + !isa(ptr)) { return emitDiag() << "application of " << transformOpName << " expected to produce an Attribute for result #" << res.getResultNumber(); } if (llvm::isa(res.getType()) && - !ptr.is()) { + !isa(ptr)) { return emitDiag() << "application of " << transformOpName << " expected to produce a Value for result #" << res.getResultNumber(); @@ -1499,7 +1499,7 @@ transform::detail::checkApplyToOne(Operation *transformOp, template static SmallVector castVector(ArrayRef range) { return llvm::to_vector(llvm::map_range( - range, [](transform::MappedValue value) { return value.get(); })); + range, [](transform::MappedValue value) { return cast(value); })); } void transform::detail::setApplyToOneResults( diff --git a/mlir/lib/Dialect/Utils/StaticValueUtils.cpp b/mlir/lib/Dialect/Utils/StaticValueUtils.cpp index 0b399fba3f263..5c8f6ded39ba4 100644 --- a/mlir/lib/Dialect/Utils/StaticValueUtils.cpp +++ b/mlir/lib/Dialect/Utils/StaticValueUtils.cpp @@ -50,7 +50,7 @@ void dispatchIndexOpFoldResult(OpFoldResult ofr, SmallVectorImpl &staticVec) { auto v = llvm::dyn_cast_if_present(ofr); if (!v) { - APInt apInt = cast(ofr.get()).getValue(); + APInt apInt = cast(cast(ofr)).getValue(); staticVec.push_back(apInt.getSExtValue()); return; } @@ -212,11 +212,11 @@ decomposeMixedValues(const SmallVectorImpl &mixedValues) { SmallVector staticValues; SmallVector dynamicValues; for (const auto &it : mixedValues) { - if (it.is()) { - staticValues.push_back(cast(it.get()).getInt()); + if (auto attr = dyn_cast(it)) { + staticValues.push_back(cast(attr).getInt()); } else { staticValues.push_back(ShapedType::kDynamic); - dynamicValues.push_back(it.get()); + dynamicValues.push_back(cast(it)); } } return {staticValues, dynamicValues}; @@ -294,10 +294,10 @@ LogicalResult foldDynamicIndexList(SmallVectorImpl &ofrs, bool onlyNonNegative, bool onlyNonZero) { bool valuesChanged = false; for (OpFoldResult &ofr : ofrs) { - if (ofr.is()) + if (isa(ofr)) continue; Attribute attr; - if (matchPattern(ofr.get(), m_Constant(&attr))) { + if (matchPattern(cast(ofr), m_Constant(&attr))) { // Note: All ofrs have index type. if (onlyNonNegative && *getConstantIntValue(attr) < 0) continue; From e072cffe3b639e8c433138b10ff68dc577497cf8 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 21 Dec 2024 08:55:59 -0800 Subject: [PATCH 071/466] [RISCV] Add immop_oneuse PatLeaf. Use it to replace some PatLeafs with ImmLeaf/IntImmLeaf. NFC (#120804) If we needed a one use check of a constant, we used a PatLeaf instead of an IntLeaf or IntImmLeaf so we could add the one use check. Unfortunately, this required the custom code to be duplicated for GISel too. Instead we can use a PatLeaf that does the one use check and defers to an IntLeaf or IntImmLeaf for the immediate check. This allows GISel to automically import the IntLeaf/IntImmLeaf part and we only need the custom GISel predicate in the immop_oneuse PatLeaf. --- llvm/lib/Target/RISCV/RISCVInstrInfo.td | 97 +++++++++---------------- 1 file changed, 33 insertions(+), 64 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index 6651aedb0d8d8..af3ab88f700bf 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -440,20 +440,10 @@ def GIImmSubFrom32 : GICustomOperandRenderer<"renderImmSubFrom32">, // in which imm = imm0 + imm1 and both imm0 and imm1 are simm12. We make imm0 // as large as possible and imm1 as small as possible so that we might be able // to use c.addi for the small immediate. -def AddiPair : PatLeaf<(imm), [{ - if (!N->hasOneUse()) - return false; +def AddiPair : ImmLeafgetSExtValue(); return (-4096 <= Imm && Imm <= -2049) || (2048 <= Imm && Imm <= 4094); -}]> { - let GISelPredicateCode = [{ - if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg())) - return false; - int64_t Imm = MI.getOperand(1).getCImm()->getSExtValue(); - return (-4096 <= Imm && Imm <= -2049) || (2048 <= Imm && Imm <= 4094); - }]; -} +}]>; // Return imm - (imm < 0 ? -2048 : 2047). def AddiPairImmSmall : SDNodeXForm // Checks if this mask is a non-empty sequence of ones starting at the // most/least significant bit with the remainder zero and exceeds simm32/simm12. -def LeadingOnesMask : PatLeaf<(imm), [{ - if (!N->hasOneUse()) - return false; - return !isInt<32>(N->getSExtValue()) && isMask_64(~N->getSExtValue()); -}], TrailingZeros> { - let GISelPredicateCode = [{ - if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg())) - return false; - const auto &MO = MI.getOperand(1); - return !isInt<32>(MO.getCImm()->getSExtValue()) && - isMask_64(~MO.getCImm()->getSExtValue()); - }]; -} +def LeadingOnesMask : ImmLeaf(Imm) && isMask_64(~Imm); +}], TrailingZeros>; -def TrailingOnesMask : PatLeaf<(imm), [{ - if (!N->hasOneUse()) - return false; - return !isInt<12>(N->getSExtValue()) && isMask_64(N->getZExtValue()); -}], XLenSubTrailingOnes> { - let GISelPredicateCode = [{ - if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg())) - return false; - const auto &MO = MI.getOperand(1); - return !isInt<12>(MO.getCImm()->getSExtValue()) && - isMask_64(MO.getCImm()->getZExtValue()); - }]; -} +def TrailingOnesMask : IntImmLeaf(Imm.getSExtValue()) && isMask_64(Imm.getZExtValue()); +}], XLenSubTrailingOnes>; // Similar to LeadingOnesMask, but only consider leading ones in the lower 32 // bits. -def LeadingOnesWMask : PatLeaf<(imm), [{ - if (!N->hasOneUse()) - return false; +def LeadingOnesWMask : ImmLeafgetSExtValue(); return !isInt<32>(Imm) && isUInt<32>(Imm) && isShiftedMask_64(Imm) && Imm != UINT64_C(0xffffffff); -}], TrailingZeros> { - let GISelPredicateCode = [{ - if (!MRI.hasOneNonDBGUse(MI.getOperand(0).getReg())) - return false; - const auto &MO = MI.getOperand(1); - int64_t Imm = MO.getCImm()->getSExtValue(); - return !isInt<32>(Imm) && isUInt<32>(Imm) && isShiftedMask_64(Imm) && - Imm != UINT64_C(0xffffffff); - }]; -} +}], TrailingZeros>; //===----------------------------------------------------------------------===// // Instruction Formats @@ -1350,6 +1308,14 @@ def 33signbits_node : PatLeaf<(i64 GPR:$src), [{ return CurDAG->ComputeNumSignBits(SDValue(N, 0)) > 32; }]>; +class immop_oneuse : PatLeaf<(leaf), [{ + return N->hasOneUse(); +}]> { + let GISelPredicateCode = [{ + return MRI.hasOneNonDBGUse(MI.getOperand(0).getReg()); + }]; +} + /// Simple arithmetic operations def : PatGprGpr; @@ -1387,10 +1353,12 @@ def : Pat<(XLenVT (sub 0, (and_oneuse GPR:$rs, 1))), (ImmSubFromXLen (XLenVT 1)))>; // AND with leading/trailing ones mask exceeding simm32/simm12. -def : Pat<(i64 (and GPR:$rs, LeadingOnesMask:$mask)), - (SLLI (i64 (SRLI $rs, LeadingOnesMask:$mask)), LeadingOnesMask:$mask)>; -def : Pat<(XLenVT (and GPR:$rs, TrailingOnesMask:$mask)), - (SRLI (XLenVT (SLLI $rs, TrailingOnesMask:$mask)), TrailingOnesMask:$mask)>; +def : Pat<(i64 (and GPR:$rs, immop_oneuse:$mask)), + (SLLI (i64 (SRLI $rs, (TrailingZeros imm:$mask))), + (TrailingZeros imm:$mask))>; +def : Pat<(XLenVT (and GPR:$rs, immop_oneuse:$mask)), + (SRLI (XLenVT (SLLI $rs, (XLenSubTrailingOnes imm:$mask))), + (XLenSubTrailingOnes imm:$mask))>; // Match both a plain shift and one where the shift amount is masked (this is // typically introduced when the legalizer promotes the shift amount and @@ -1981,8 +1949,9 @@ def u32simm12 : ImmLeaf; +def : Pat<(i64 (and GPR:$rs, immop_oneuse:$mask)), + (SLLI (i64 (SRLIW $rs, (TrailingZeros imm:$mask))), + (TrailingZeros imm:$mask))>; /// sext and zext @@ -2081,15 +2050,15 @@ def KCFI_CHECK } /// Simple optimization -def : Pat<(XLenVT (add GPR:$rs1, (AddiPair:$rs2))), - (ADDI (XLenVT (ADDI GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2))), - (AddiPairImmSmall GPR:$rs2))>; +def : Pat<(XLenVT (add GPR:$rs1, immop_oneuse:$rs2)), + (ADDI (XLenVT (ADDI GPR:$rs1, (AddiPairImmLarge imm:$rs2))), + (AddiPairImmSmall imm:$rs2))>; let Predicates = [IsRV64] in { // Select W instructions if only the lower 32-bits of the result are used. -def : Pat<(binop_allwusers GPR:$rs1, (AddiPair:$rs2)), - (ADDIW (i64 (ADDIW GPR:$rs1, (AddiPairImmLarge AddiPair:$rs2))), - (AddiPairImmSmall AddiPair:$rs2))>; +def : Pat<(binop_allwusers GPR:$rs1, immop_oneuse:$rs2), + (ADDIW (i64 (ADDIW GPR:$rs1, (AddiPairImmLarge imm:$rs2))), + (AddiPairImmSmall imm:$rs2))>; } //===----------------------------------------------------------------------===// From f7ba2bdf863b589140cb97a3fafb2f4688532456 Mon Sep 17 00:00:00 2001 From: GrumpyPigSkin <130710602+GrumpyPigSkin@users.noreply.github.com> Date: Sat, 21 Dec 2024 17:37:44 +0000 Subject: [PATCH 072/466] [LLVM][SLSR] Add a debug counter (#119981) Added debug counter and test for SLSR. Fixes: https://github.com/llvm/llvm-project/issues/119770 --- .../Scalar/StraightLineStrengthReduce.cpp | 11 ++++++-- llvm/test/Other/debugcounter-slsr.ll | 26 +++++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 llvm/test/Other/debugcounter-slsr.ll diff --git a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp index 75585fcc80266..7d017095c88ce 100644 --- a/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/StraightLineStrengthReduce.cpp @@ -78,6 +78,7 @@ #include "llvm/InitializePasses.h" #include "llvm/Pass.h" #include "llvm/Support/Casting.h" +#include "llvm/Support/DebugCounter.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Utils/Local.h" @@ -93,6 +94,9 @@ using namespace PatternMatch; static const unsigned UnknownAddressSpace = std::numeric_limits::max(); +DEBUG_COUNTER(StraightLineStrengthReduceCounter, "slsr-counter", + "Controls whether rewriteCandidateWithBasis is executed."); + namespace { class StraightLineStrengthReduceLegacyPass : public FunctionPass { @@ -268,8 +272,8 @@ FunctionPass *llvm::createStraightLineStrengthReducePass() { bool StraightLineStrengthReduce::isBasisFor(const Candidate &Basis, const Candidate &C) { return (Basis.Ins != C.Ins && // skip the same instruction - // They must have the same type too. Basis.Base == C.Base doesn't - // guarantee their types are the same (PR23975). + // They must have the same type too. Basis.Base == C.Base + // doesn't guarantee their types are the same (PR23975). Basis.Ins->getType() == C.Ins->getType() && // Basis must dominate C in order to rewrite C with respect to Basis. DT->dominates(Basis.Ins->getParent(), C.Ins->getParent()) && @@ -610,6 +614,9 @@ Value *StraightLineStrengthReduce::emitBump(const Candidate &Basis, void StraightLineStrengthReduce::rewriteCandidateWithBasis( const Candidate &C, const Candidate &Basis) { + if (!DebugCounter::shouldExecute(StraightLineStrengthReduceCounter)) + return; + assert(C.CandidateKind == Basis.CandidateKind && C.Base == Basis.Base && C.Stride == Basis.Stride); // We run rewriteCandidateWithBasis on all candidates in a post-order, so the diff --git a/llvm/test/Other/debugcounter-slsr.ll b/llvm/test/Other/debugcounter-slsr.ll new file mode 100644 index 0000000000000..a9ca45222a5cc --- /dev/null +++ b/llvm/test/Other/debugcounter-slsr.ll @@ -0,0 +1,26 @@ +; REQUIRES: asserts +; RUN: opt -passes=slsr -S -debug-counter=slsr-counter=1 < %s | FileCheck %s + +; Test that, with debug counters on, we will skip the first slsr opportunity. + +define void @stride_is_2s(i32 %b, i32 %s) { +; CHECK-LABEL: @stride_is_2s( +; CHECK-NEXT: %s2 = shl i32 %s, 1 +; CHECK-NEXT: %t1 = add i32 %b, %s2 +; CHECK-NEXT: call void @foo(i32 %t1) +; CHECK-NEXT: %s4 = shl i32 %s, 2 +; CHECK-NEXT: %t2 = add i32 %b, %s4 +; CHECK-NEXT: call void @foo(i32 %t2) +; CHECK-NEXT: ret void +; + %s2 = shl i32 %s, 1 + %t1 = add i32 %b, %s2 + call void @foo(i32 %t1) + %s4 = shl i32 %s, 2 + %t2 = add i32 %b, %s4 + call void @foo(i32 %t2) + ret void +} + +declare void @foo(i32) + From fd784726db70a5155594c32ee839b8807fafd87d Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sat, 21 Dec 2024 20:05:21 +0100 Subject: [PATCH 073/466] [libc++] Rewrite minmax_element benchmark The benchmark currently uses makeCartesianProductBenchmark, which doesn't make a ton of sense, since minmax_element always goes through every element one by one. The runtime doesn't depend on the values of the elements. Fixes #120758 --- .../algorithms/min_max_element.bench.cpp | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp b/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp index 4dbfed66d0c2c..dea48b826e307 100644 --- a/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp +++ b/libcxx/test/benchmarks/algorithms/min_max_element.bench.cpp @@ -6,33 +6,42 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++03, c++11, c++14 +// UNSUPPORTED: c++03, c++11, c++14, c++17 #include +#include -#include "common.h" +#include -namespace { -template -struct MinMaxElement { - size_t Quantity; +void run_sizes(auto benchmark) { + benchmark->Arg(1) + ->Arg(2) + ->Arg(3) + ->Arg(4) + ->Arg(64) + ->Arg(512) + ->Arg(1024) + ->Arg(4000) + ->Arg(4096) + ->Arg(5500) + ->Arg(64000) + ->Arg(65536) + ->Arg(70000); +} - void run(benchmark::State& state) const { - runOpOnCopies(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) { - benchmark::DoNotOptimize(std::minmax_element(Copy.begin(), Copy.end())); - }); - } +template +void BM_std_minmax_element(benchmark::State& state) { + std::vector vec(state.range(), 3); - std::string name() const { - return "BM_MinMaxElement" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity); + for (auto _ : state) { + benchmark::DoNotOptimize(vec); + benchmark::DoNotOptimize(std::minmax_element(vec.begin(), vec.end())); } -}; -} // namespace - -int main(int argc, char** argv) { - benchmark::Initialize(&argc, argv); - if (benchmark::ReportUnrecognizedArguments(argc, argv)) - return 1; - makeCartesianProductBenchmark(Quantities); - benchmark::RunSpecifiedBenchmarks(); } + +BENCHMARK(BM_std_minmax_element)->Apply(run_sizes); +BENCHMARK(BM_std_minmax_element)->Apply(run_sizes); +BENCHMARK(BM_std_minmax_element)->Apply(run_sizes); +BENCHMARK(BM_std_minmax_element)->Apply(run_sizes); + +BENCHMARK_MAIN(); From 9b496deb90381f352a2bceb8794a0c7881a63bd5 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 21 Dec 2024 21:57:05 +0000 Subject: [PATCH 074/466] [VPlan] Set and use debug location for VPPredInstPHIRecipe. Update the recipe it always set its debug location and use it during IR generation. --- llvm/lib/Transforms/Vectorize/VPlan.h | 6 +-- .../lib/Transforms/Vectorize/VPlanRecipes.cpp | 1 + .../Transforms/Vectorize/VPlanTransforms.cpp | 3 +- .../preserve-dbg-loc-and-loop-metadata.ll | 37 +++++++++++++++++-- .../Transforms/Vectorize/VPlanTest.cpp | 2 +- 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 8dd94a292f707..d4f8767bcf100 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -2839,12 +2839,12 @@ class VPPredInstPHIRecipe : public VPSingleDefRecipe { public: /// Construct a VPPredInstPHIRecipe given \p PredInst whose value needs a phi /// nodes after merging back from a Branch-on-Mask. - VPPredInstPHIRecipe(VPValue *PredV) - : VPSingleDefRecipe(VPDef::VPPredInstPHISC, PredV) {} + VPPredInstPHIRecipe(VPValue *PredV, DebugLoc DL) + : VPSingleDefRecipe(VPDef::VPPredInstPHISC, PredV, DL) {} ~VPPredInstPHIRecipe() override = default; VPPredInstPHIRecipe *clone() override { - return new VPPredInstPHIRecipe(getOperand(0)); + return new VPPredInstPHIRecipe(getOperand(0), getDebugLoc()); } VP_CLASSOF_IMPL(VPDef::VPPredInstPHISC) diff --git a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp index 2f9ff3e420433..a6f2446414105 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp @@ -2392,6 +2392,7 @@ InstructionCost VPBranchOnMaskRecipe::computeCost(ElementCount VF, } void VPPredInstPHIRecipe::execute(VPTransformState &State) { + State.setDebugLocFrom(getDebugLoc()); assert(State.Lane && "Predicated instruction PHI works per instance."); Instruction *ScalarPredInst = cast(State.get(getOperand(0), *State.Lane)); diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp index aacb27f9325d0..59133034c8285 100644 --- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp @@ -322,7 +322,8 @@ static VPRegionBlock *createReplicateRegion(VPReplicateRecipe *PredRecipe, VPPredInstPHIRecipe *PHIRecipe = nullptr; if (PredRecipe->getNumUsers() != 0) { - PHIRecipe = new VPPredInstPHIRecipe(RecipeWithoutMask); + PHIRecipe = new VPPredInstPHIRecipe(RecipeWithoutMask, + RecipeWithoutMask->getDebugLoc()); PredRecipe->replaceAllUsesWith(PHIRecipe); PHIRecipe->setOperand(0, RecipeWithoutMask); } diff --git a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll index 2eec61b859f13..3e423d3f9e265 100644 --- a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll +++ b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll @@ -1,6 +1,6 @@ -; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -S 2>&1 | FileCheck %s -; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S | FileCheck %s -check-prefix DEBUGLOC -; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC +; RUN: opt < %s -passes=loop-vectorize -force-vector-width=4 -force-widen-divrem-via-safe-divisor=0 -S 2>&1 | FileCheck %s +; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -force-widen-divrem-via-safe-divisor=0 -S | FileCheck %s -check-prefix DEBUGLOC +; RUN: opt < %s -passes=debugify,loop-vectorize -force-vector-width=4 -force-widen-divrem-via-safe-divisor=0 -S --try-experimental-debuginfo-iterators | FileCheck %s -check-prefix DEBUGLOC target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" ; This test makes sure we don't duplicate the loop vectorizer's metadata @@ -54,6 +54,37 @@ exit: ret void } +define void @predicated_phi_dbg(i64 %n, ptr %x) { +; DEBUGLOC-LABEL: define void @predicated_phi_dbg( +; DEBUGLOC: pred.udiv.continue{{.+}}: +; DEBUGLOC-NEXT: = phi <4 x i64> {{.+}}, !dbg [[PREDPHILOC:![0-9]+]] +; +; DEBUGLOC: for.body: +; DEBUGLOC: %tmp4 = udiv i64 %n, %i, !dbg [[PREDPHILOC]] +; +entry: + br label %for.body + +for.body: + %i = phi i64 [ 0, %entry ], [ %i.next, %for.inc ] + %cmp = icmp ult i64 %i, 5 + br i1 %cmp, label %if.then, label %for.inc + +if.then: + %tmp4 = udiv i64 %n, %i + br label %for.inc + +for.inc: + %d = phi i64 [ 0, %for.body ], [ %tmp4, %if.then ] + %idx = getelementptr i64, ptr %x, i64 %i + store i64 %d, ptr %idx + %i.next = add nuw nsw i64 %i, 1 + %cond = icmp slt i64 %i.next, %n + br i1 %cond, label %for.body, label %for.end + +for.end: + ret void +} !0 = !{!0, !1} !1 = !{!"llvm.loop.vectorize.width", i32 4} diff --git a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp index 6402d6f212660..f3a1bba518c83 100644 --- a/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp +++ b/llvm/unittests/Transforms/Vectorize/VPlanTest.cpp @@ -1287,7 +1287,7 @@ TEST(VPRecipeTest, MayHaveSideEffectsAndMayReadWriteMemory) { } { VPValue Op1; - VPPredInstPHIRecipe Recipe(&Op1); + VPPredInstPHIRecipe Recipe(&Op1, {}); EXPECT_FALSE(Recipe.mayHaveSideEffects()); EXPECT_FALSE(Recipe.mayReadFromMemory()); EXPECT_FALSE(Recipe.mayWriteToMemory()); From bc23ef3feba9f1c0ca55bc12754017712252b64d Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sat, 21 Dec 2024 22:30:34 +0000 Subject: [PATCH 075/466] [LV] Add test showing incorrect debug location for scalar casts. --- .../preserve-dbg-loc-and-loop-metadata.ll | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll index 3e423d3f9e265..5052ba8117751 100644 --- a/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll +++ b/llvm/test/Transforms/LoopVectorize/preserve-dbg-loc-and-loop-metadata.ll @@ -86,6 +86,29 @@ for.end: ret void } +define void @scalar_cast_dbg(ptr nocapture %a, i32 %start, i64 %k) { +; DEBUGLOC-LABEL: define void @scalar_cast_dbg( +; DEBUGLOC: = trunc i64 %index to i32, !dbg [[CASTLOC:![0-9]+]] +; +; DEBUGLOC: loop: +; DEBUGLOC-NOT: %trunc.iv = trunc i64 %iv to i32, !dbg [[CASTLOC]] +; +entry: + br label %loop + +loop: + %iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ] + %trunc.iv = trunc i64 %iv to i32 + %arrayidx = getelementptr inbounds i32, ptr %a, i32 %trunc.iv + store i32 %trunc.iv, ptr %arrayidx, align 4 + %iv.next = add nuw nsw i64 %iv, 1 + %exitcond = icmp eq i64 %iv.next, %k + br i1 %exitcond, label %exit, label %loop + +exit: + ret void +} + !0 = !{!0, !1} !1 = !{!"llvm.loop.vectorize.width", i32 4} ; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4} From 3b8faee6c6f44343c3f9de76c40ff305f72dfcd6 Mon Sep 17 00:00:00 2001 From: Nikolas Klauser Date: Sun, 22 Dec 2024 00:55:35 +0100 Subject: [PATCH 076/466] [libc++] Switch _LIBCPP_NODEBUG to [[gnu::nodebug]] (#120720) This makes the placement of the attribute more consistent. This also avoids clang dropping the attribute silently (see #120722). --- libcxx/include/__config | 6 +----- libcxx/include/__functional/function.h | 6 +++--- libcxx/include/__memory/allocator_arg_t.h | 8 ++++---- .../include/__memory/allocator_destructor.h | 6 +++--- libcxx/include/__memory/pointer_traits.h | 18 ++++++++--------- libcxx/include/__memory/unique_ptr.h | 2 +- libcxx/include/__ranges/join_view.h | 4 ++-- libcxx/include/__tuple/make_tuple_types.h | 4 ++-- libcxx/include/__tuple/sfinae_helpers.h | 2 +- libcxx/include/__tuple/tuple_element.h | 8 ++++---- libcxx/include/__type_traits/add_cv_quals.h | 6 +++--- .../__type_traits/add_lvalue_reference.h | 4 ++-- libcxx/include/__type_traits/add_pointer.h | 4 ++-- .../__type_traits/add_rvalue_reference.h | 4 ++-- libcxx/include/__type_traits/common_type.h | 2 +- libcxx/include/__type_traits/decay.h | 11 +++++----- libcxx/include/__type_traits/remove_pointer.h | 10 +++++----- libcxx/include/__type_traits/type_list.h | 4 ++-- libcxx/include/__type_traits/unwrap_ref.h | 4 ++-- libcxx/include/__utility/exception_guard.h | 10 +++++----- libcxx/include/__utility/move.h | 2 +- libcxx/include/tuple | 20 +++++++++---------- 22 files changed, 70 insertions(+), 75 deletions(-) diff --git a/libcxx/include/__config b/libcxx/include/__config index fe01b58b8e627..ace6e1cd73e3e 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -1170,11 +1170,7 @@ typedef __char32_t char32_t; # define _LIBCPP_NOESCAPE # endif -# if __has_attribute(__nodebug__) -# define _LIBCPP_NODEBUG __attribute__((__nodebug__)) -# else -# define _LIBCPP_NODEBUG -# endif +# define _LIBCPP_NODEBUG [[__gnu__::__nodebug__]] # if __has_attribute(__standalone_debug__) # define _LIBCPP_STANDALONE_DEBUG __attribute__((__standalone_debug__)) diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h index 06d3225a6e22d..a421a3ef4f5f9 100644 --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -146,8 +146,8 @@ class __alloc_func<_Fp, _Ap, _Rp(_ArgTypes...)> { _LIBCPP_COMPRESSED_PAIR(_Fp, __func_, _Ap, __alloc_); public: - typedef _LIBCPP_NODEBUG _Fp _Target; - typedef _LIBCPP_NODEBUG _Ap _Alloc; + using _Target _LIBCPP_NODEBUG = _Fp; + using _Alloc _LIBCPP_NODEBUG = _Ap; _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __func_; } @@ -198,7 +198,7 @@ class __default_alloc_func<_Fp, _Rp(_ArgTypes...)> { _Fp __f_; public: - typedef _LIBCPP_NODEBUG _Fp _Target; + using _Target _LIBCPP_NODEBUG = _Fp; _LIBCPP_HIDE_FROM_ABI const _Target& __target() const { return __f_; } diff --git a/libcxx/include/__memory/allocator_arg_t.h b/libcxx/include/__memory/allocator_arg_t.h index dc4398bb02d34..72a0a9c399bd4 100644 --- a/libcxx/include/__memory/allocator_arg_t.h +++ b/libcxx/include/__memory/allocator_arg_t.h @@ -39,10 +39,10 @@ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); template struct __uses_alloc_ctor_imp { - typedef _LIBCPP_NODEBUG __remove_cvref_t<_Alloc> _RawAlloc; - static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; - static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - static const int value = __ua ? 2 - __ic : 0; + using _RawAlloc _LIBCPP_NODEBUG = __remove_cvref_t<_Alloc>; + static const bool __ua = uses_allocator<_Tp, _RawAlloc>::value; + static const bool __ic = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; + static const int value = __ua ? 2 - __ic : 0; }; template diff --git a/libcxx/include/__memory/allocator_destructor.h b/libcxx/include/__memory/allocator_destructor.h index ed3d8918f5fe3..aac92a23fa0d4 100644 --- a/libcxx/include/__memory/allocator_destructor.h +++ b/libcxx/include/__memory/allocator_destructor.h @@ -20,11 +20,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD template class __allocator_destructor { - typedef _LIBCPP_NODEBUG allocator_traits<_Alloc> __alloc_traits; + using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<_Alloc>; public: - typedef _LIBCPP_NODEBUG typename __alloc_traits::pointer pointer; - typedef _LIBCPP_NODEBUG typename __alloc_traits::size_type size_type; + using pointer _LIBCPP_NODEBUG = typename __alloc_traits::pointer; + using size_type _LIBCPP_NODEBUG = typename __alloc_traits::size_type; private: _Alloc& __alloc_; diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h index 4acf3d18401ae..e35cfb7c3b878 100644 --- a/libcxx/include/__memory/pointer_traits.h +++ b/libcxx/include/__memory/pointer_traits.h @@ -50,17 +50,17 @@ struct __pointer_traits_element_type {}; template struct __pointer_traits_element_type<_Ptr, true> { - typedef _LIBCPP_NODEBUG typename _Ptr::element_type type; + using type _LIBCPP_NODEBUG = typename _Ptr::element_type; }; template