From c6110496b346d7963f8f9f62a7d2696da12a943e Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 5 Oct 2024 11:52:10 -0700 Subject: [PATCH 1/8] [RISCV] Use THShift_ri class instead of RVBShift_ri for TH_TST instruction. NFC --- llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td index c0fe624a9b709c..90747a6b745cfc 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXTHead.td @@ -270,7 +270,7 @@ def TH_REVW : THRev_r<0b10010, 0b00, "th.revw">; let Predicates = [HasVendorXTHeadBs], DecoderNamespace = "XTHeadBs", IsSignExtendingOpW = 1 in -def TH_TST : RVBShift_ri<0b10001, 0b001, OPC_CUSTOM_0, "th.tst">, +def TH_TST : THShift_ri<0b10001, 0b001, "th.tst">, Sched<[WriteSingleBitImm, ReadSingleBitImm]>; let Predicates = [HasVendorXTHeadCondMov] in { From 73683cc1ab0fe79a4b02b956cf3c033250537bff Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sat, 5 Oct 2024 12:11:01 -0700 Subject: [PATCH 2/8] [Basic] Avoid repeated hash lookups (NFC) (#111228) --- clang/lib/Basic/TargetID.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clang/lib/Basic/TargetID.cpp b/clang/lib/Basic/TargetID.cpp index fa1bfec2aacb9c..b42d1f07013c26 100644 --- a/clang/lib/Basic/TargetID.cpp +++ b/clang/lib/Basic/TargetID.cpp @@ -92,11 +92,9 @@ parseTargetIDWithFormatCheckingOnly(llvm::StringRef TargetID, if (Sign != '+' && Sign != '-') return std::nullopt; bool IsOn = Sign == '+'; - auto Loc = FeatureMap->find(Feature); // Each feature can only show up at most once in target ID. - if (Loc != FeatureMap->end()) + if (!FeatureMap->try_emplace(Feature, IsOn).second) return std::nullopt; - (*FeatureMap)[Feature] = IsOn; Features = Splits.second; } return Processor; @@ -147,15 +145,15 @@ getConflictTargetIDCombination(const std::set &TargetIDs) { struct Info { llvm::StringRef TargetID; llvm::StringMap Features; + Info(llvm::StringRef TargetID, const llvm::StringMap &Features) + : TargetID(TargetID), Features(Features) {} }; llvm::StringMap FeatureMap; for (auto &&ID : TargetIDs) { llvm::StringMap Features; llvm::StringRef Proc = *parseTargetIDWithFormatCheckingOnly(ID, &Features); - auto Loc = FeatureMap.find(Proc); - if (Loc == FeatureMap.end()) - FeatureMap[Proc] = Info{ID, Features}; - else { + auto [Loc, Inserted] = FeatureMap.try_emplace(Proc, ID, Features); + if (!Inserted) { auto &ExistingFeatures = Loc->second.Features; if (llvm::any_of(Features, [&](auto &F) { return ExistingFeatures.count(F.first()) == 0; From 206fad0e218e83799e49ca15545d997c6c5e8a03 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 5 Oct 2024 21:32:40 +0200 Subject: [PATCH 3/8] [mlir][NFC] Mark type converter in `populate...` functions as `const` (#111250) This commit marks the type converter in `populate...` functions as `const`. This is useful for debugging. Patterns already take a `const` type converter. However, some `populate...` functions do not only add new patterns, but also add additional type conversion rules. That makes it difficult to find the place where a type conversion was added in the code base. With this change, all `populate...` functions that only populate pattern now have a `const` type converter. Programmers can then conclude from the function signature that these functions do not register any new type conversion rules. Also some minor cleanups around the 1:N dialect conversion infrastructure, which did not always pass the type converter as a `const` object internally. --- .../include/flang/Optimizer/CodeGen/CodeGen.h | 6 +- .../flang/Optimizer/CodeGen/CodeGenOpenMP.h | 2 +- .../Optimizer/Transforms/CufOpConversion.h | 2 +- flang/lib/Optimizer/CodeGen/CodeGen.cpp | 2 +- flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp | 2 +- .../Optimizer/Transforms/CufOpConversion.cpp | 6 +- mlir/docs/Bufferization.md | 2 +- .../Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h | 2 +- .../mlir/Conversion/ArithToLLVM/ArithToLLVM.h | 2 +- .../Conversion/ArithToSPIRV/ArithToSPIRV.h | 2 +- .../Conversion/ComplexToLLVM/ComplexToLLVM.h | 2 +- .../ComplexToSPIRV/ComplexToSPIRV.h | 2 +- .../ControlFlowToLLVM/ControlFlowToLLVM.h | 6 +- .../ControlFlowToSPIRV/ControlFlowToSPIRV.h | 2 +- .../Conversion/FuncToLLVM/ConvertFuncToLLVM.h | 6 +- .../mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h | 2 +- .../GPUToLLVMSPV/GPUToLLVMSPVPass.h | 2 +- .../mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h | 8 +- .../Conversion/GPUToROCDL/GPUToROCDLPass.h | 2 +- .../mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h | 4 +- .../mlir/Conversion/IndexToLLVM/IndexToLLVM.h | 2 +- .../Conversion/IndexToSPIRV/IndexToSPIRV.h | 2 +- .../mlir/Conversion/MathToLLVM/MathToLLVM.h | 2 +- .../mlir/Conversion/MathToROCDL/MathToROCDL.h | 2 +- .../mlir/Conversion/MathToSPIRV/MathToSPIRV.h | 2 +- .../Conversion/MemRefToEmitC/MemRefToEmitC.h | 2 +- .../Conversion/MemRefToLLVM/MemRefToLLVM.h | 2 +- .../Conversion/MemRefToSPIRV/MemRefToSPIRV.h | 2 +- .../mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h | 2 +- .../OpenMPToLLVM/ConvertOpenMPToLLVM.h | 4 +- .../mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h | 2 +- .../mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h | 17 +-- .../Conversion/TensorToSPIRV/TensorToSPIRV.h | 2 +- .../Conversion/TosaToLinalg/TosaToLinalg.h | 2 +- .../Conversion/TosaToTensor/TosaToTensor.h | 2 +- .../mlir/Conversion/UBToLLVM/UBToLLVM.h | 2 +- .../mlir/Conversion/UBToSPIRV/UBToSPIRV.h | 2 +- .../VectorToLLVM/ConvertVectorToLLVM.h | 6 +- .../Conversion/VectorToSPIRV/VectorToSPIRV.h | 2 +- mlir/include/mlir/Dialect/AMX/Transforms.h | 4 +- .../mlir/Dialect/Arith/Transforms/Passes.h | 10 +- .../Dialect/ArmSVE/Transforms/Transforms.h | 4 +- .../Bufferization/Transforms/Bufferize.h | 2 +- .../Func/Transforms/DecomposeCallGraphTypes.h | 2 +- .../Dialect/Func/Transforms/FuncConversions.h | 12 +- .../Func/Transforms/OneToNFuncConversions.h | 2 +- .../mlir/Dialect/Math/Transforms/Passes.h | 2 +- .../Dialect/MemRef/Transforms/Transforms.h | 4 +- .../mlir/Dialect/SCF/Transforms/Patterns.h | 8 +- .../SPIRV/Transforms/SPIRVConversion.h | 2 +- .../Dialect/SparseTensor/Transforms/Passes.h | 8 +- .../Vector/Transforms/VectorRewritePatterns.h | 9 +- .../mlir/Dialect/X86Vector/Transforms.h | 2 +- .../mlir/Transforms/OneToNTypeConversion.h | 21 ++-- .../AMDGPUToROCDL/AMDGPUToROCDL.cpp | 20 ++-- .../Conversion/ArithToLLVM/ArithToLLVM.cpp | 2 +- .../Conversion/ArithToSPIRV/ArithToSPIRV.cpp | 2 +- .../ComplexToLLVM/ComplexToLLVM.cpp | 2 +- .../ComplexToSPIRV/ComplexToSPIRV.cpp | 4 +- .../ControlFlowToLLVM/ControlFlowToLLVM.cpp | 6 +- .../ControlFlowToSPIRV/ControlFlowToSPIRV.cpp | 2 +- .../ConvertToSPIRV/ConvertToSPIRVPass.cpp | 2 +- mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp | 4 +- .../Conversion/FuncToSPIRV/FuncToSPIRV.cpp | 2 +- .../GPUCommon/IndexIntrinsicsOpLowering.h | 6 +- .../GPUCommon/OpToFuncCallLowering.h | 6 +- .../Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp | 4 +- .../GPUToNVVM/LowerGpuOpsToNVVMOps.cpp | 8 +- .../Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp | 2 +- .../GPUToROCDL/LowerGpuOpsToROCDLOps.cpp | 4 +- mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp | 5 +- .../Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp | 2 +- .../Conversion/IndexToLLVM/IndexToLLVM.cpp | 2 +- .../Conversion/IndexToSPIRV/IndexToSPIRV.cpp | 4 +- mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp | 6 +- .../Conversion/MathToROCDL/MathToROCDL.cpp | 6 +- .../Conversion/MathToSPIRV/MathToSPIRV.cpp | 2 +- .../MemRefToEmitC/MemRefToEmitC.cpp | 4 +- .../Conversion/MemRefToLLVM/MemRefToLLVM.cpp | 2 +- .../MemRefToSPIRV/MemRefToSPIRV.cpp | 2 +- .../Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp | 4 +- .../Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp | 2 +- mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp | 6 +- .../Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp | 107 +++++++++--------- .../TensorToSPIRV/TensorToSPIRV.cpp | 8 +- .../Conversion/TosaToLinalg/TosaToLinalg.cpp | 2 +- .../Conversion/TosaToTensor/TosaToTensor.cpp | 2 +- mlir/lib/Conversion/UBToLLVM/UBToLLVM.cpp | 4 +- mlir/lib/Conversion/UBToSPIRV/UBToSPIRV.cpp | 2 +- .../VectorToLLVM/ConvertVectorToLLVM.cpp | 4 +- .../VectorToSPIRV/VectorToSPIRV.cpp | 4 +- .../AMX/Transforms/LegalizeForLLVMExport.cpp | 2 +- .../Arith/Transforms/EmulateNarrowType.cpp | 3 +- .../Transforms/EmulateUnsupportedFloats.cpp | 6 +- .../Arith/Transforms/EmulateWideInt.cpp | 3 +- .../Transforms/LegalizeForLLVMExport.cpp | 2 +- .../Bufferization/Transforms/Bufferize.cpp | 2 +- .../Transforms/DecomposeCallGraphTypes.cpp | 4 +- .../Func/Transforms/FuncConversions.cpp | 17 ++- .../Func/Transforms/OneToNFuncConversions.cpp | 2 +- .../Transforms/ExtendToSupportedTypes.cpp | 4 +- .../MemRef/Transforms/EmulateNarrowType.cpp | 2 +- .../MemRef/Transforms/EmulateWideInt.cpp | 2 +- .../SCF/Transforms/OneToNTypeConversion.cpp | 4 +- .../Transforms/StructuralTypeConversions.cpp | 4 +- .../SPIRV/Transforms/SPIRVConversion.cpp | 4 +- .../Transforms/SparseIterationToScf.cpp | 2 +- .../SparseStorageSpecifierToLLVM.cpp | 4 +- .../Transforms/SparseTensorCodegen.cpp | 14 +-- .../Transforms/SparseTensorConversion.cpp | 4 +- .../Transforms/VectorEmulateNarrowType.cpp | 2 +- .../Vector/Transforms/VectorLinearize.cpp | 2 +- .../Transforms/LegalizeForLLVMExport.cpp | 6 +- .../Transforms/Utils/OneToNTypeConversion.cpp | 4 +- .../TestOneToNTypeConversionPass.cpp | 5 +- 115 files changed, 293 insertions(+), 282 deletions(-) diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGen.h b/flang/include/flang/Optimizer/CodeGen/CodeGen.h index 390f00e1ac77c2..255b1950c84256 100644 --- a/flang/include/flang/Optimizer/CodeGen/CodeGen.h +++ b/flang/include/flang/Optimizer/CodeGen/CodeGen.h @@ -72,9 +72,9 @@ std::unique_ptr createLLVMDialectToLLVMPass( [](llvm::Module &m, llvm::raw_ostream &out) { m.print(out, nullptr); }); /// Populate the given list with patterns that convert from FIR to LLVM. -void populateFIRToLLVMConversionPatterns(fir::LLVMTypeConverter &converter, - mlir::RewritePatternSet &patterns, - fir::FIRToLLVMPassOptions &options); +void populateFIRToLLVMConversionPatterns( + const fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns, + fir::FIRToLLVMPassOptions &options); /// Populate the pattern set with the PreCGRewrite patterns. void populatePreCGRewritePatterns(mlir::RewritePatternSet &patterns, diff --git a/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h b/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h index 1832d4967b7ecd..04b59da72f6bae 100644 --- a/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h +++ b/flang/include/flang/Optimizer/CodeGen/CodeGenOpenMP.h @@ -19,7 +19,7 @@ class LLVMTypeConverter; /// dialect, utilised in cases where the default OpenMP dialect handling cannot /// handle all cases for intermingled fir types and operations. void populateOpenMPFIRToLLVMConversionPatterns( - LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns); + const LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns); } // namespace fir diff --git a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h b/flang/include/flang/Optimizer/Transforms/CufOpConversion.h index 3e13c72cc0e3e4..79ce4ac5c6cbc0 100644 --- a/flang/include/flang/Optimizer/Transforms/CufOpConversion.h +++ b/flang/include/flang/Optimizer/Transforms/CufOpConversion.h @@ -22,7 +22,7 @@ class DataLayout; namespace cuf { -void populateCUFToFIRConversionPatterns(fir::LLVMTypeConverter &converter, +void populateCUFToFIRConversionPatterns(const fir::LLVMTypeConverter &converter, mlir::DataLayout &dl, mlir::RewritePatternSet &patterns); diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp index 1cb869bfeb95a8..1611de9e6389a5 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -3823,7 +3823,7 @@ fir::createLLVMDialectToLLVMPass(llvm::raw_ostream &output, } void fir::populateFIRToLLVMConversionPatterns( - fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns, + const fir::LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns, fir::FIRToLLVMPassOptions &options) { patterns.insert< AbsentOpConversion, AddcOpConversion, AddrOfOpConversion, diff --git a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp index 48d6c000ee44a3..da13ed648e44e6 100644 --- a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp @@ -93,6 +93,6 @@ struct MapInfoOpConversion } // namespace void fir::populateOpenMPFIRToLLVMConversionPatterns( - LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, mlir::RewritePatternSet &patterns) { patterns.add(converter); } diff --git a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp index 24dc8e2354b120..91ef1259332de9 100644 --- a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp @@ -222,7 +222,7 @@ struct CufAllocOpConversion : public mlir::OpRewritePattern { using OpRewritePattern::OpRewritePattern; CufAllocOpConversion(mlir::MLIRContext *context, mlir::DataLayout *dl, - fir::LLVMTypeConverter *typeConverter) + const fir::LLVMTypeConverter *typeConverter) : OpRewritePattern(context), dl{dl}, typeConverter{typeConverter} {} mlir::LogicalResult @@ -311,7 +311,7 @@ struct CufAllocOpConversion : public mlir::OpRewritePattern { private: mlir::DataLayout *dl; - fir::LLVMTypeConverter *typeConverter; + const fir::LLVMTypeConverter *typeConverter; }; struct CufFreeOpConversion : public mlir::OpRewritePattern { @@ -583,7 +583,7 @@ class CufOpConversion : public fir::impl::CufOpConversionBase { } // namespace void cuf::populateCUFToFIRConversionPatterns( - fir::LLVMTypeConverter &converter, mlir::DataLayout &dl, + const fir::LLVMTypeConverter &converter, mlir::DataLayout &dl, mlir::RewritePatternSet &patterns) { patterns.insert(patterns.getContext(), &dl, &converter); patterns.insert(typeConverter, patterns.getContext()); } diff --git a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h index e445c58fe6c547..e7637a6013e68a 100644 --- a/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h +++ b/mlir/include/mlir/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.h @@ -24,7 +24,7 @@ class Pass; /// Note: The ROCDL target does not support the LLVM bfloat type at this time /// and so this function will add conversions to change all `bfloat` uses /// to `i16`. -void populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter, +void populateAMDGPUToROCDLConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, amdgpu::Chipset chipset); diff --git a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h index 25b82aed9c968a..173fea7c352d93 100644 --- a/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h +++ b/mlir/include/mlir/Conversion/ArithToLLVM/ArithToLLVM.h @@ -22,7 +22,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace arith { -void populateArithToLLVMConversionPatterns(LLVMTypeConverter &converter, +void populateArithToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); void registerConvertArithToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h b/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h index bb30deb9dc10e5..a15e56bfdf04bf 100644 --- a/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h +++ b/mlir/include/mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h @@ -22,7 +22,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace arith { -void populateArithToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateArithToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); std::unique_ptr> createConvertArithToSPIRVPass(); diff --git a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h index 69b01b471dd984..65d6f165c7448d 100644 --- a/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h +++ b/mlir/include/mlir/Conversion/ComplexToLLVM/ComplexToLLVM.h @@ -39,7 +39,7 @@ class ComplexStructBuilder : public StructBuilder { }; /// Populate the given list with patterns that convert from Complex to LLVM. -void populateComplexToLLVMConversionPatterns(LLVMTypeConverter &converter, +void populateComplexToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); void registerConvertComplexToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h b/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h index 19dba5b870cb6f..777481f00b3592 100644 --- a/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h +++ b/mlir/include/mlir/Conversion/ComplexToSPIRV/ComplexToSPIRV.h @@ -20,7 +20,7 @@ class SPIRVTypeConverter; /// Appends to a pattern list additional patterns for translating Complex ops /// to SPIR-V ops. -void populateComplexToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateComplexToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h index 35b691b8bc44b5..b88c1e8b20f32b 100644 --- a/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h +++ b/mlir/include/mlir/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.h @@ -29,13 +29,13 @@ namespace cf { /// Collect the patterns to convert from the ControlFlow dialect to LLVM. The /// conversion patterns capture the LLVMTypeConverter by reference meaning the /// references have to remain alive during the entire pattern lifetime. -void populateControlFlowToLLVMConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateControlFlowToLLVMConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Populate the cf.assert to LLVM conversion pattern. If `abortOnFailure` is /// set to false, the program execution continues when a condition is /// unsatisfied. -void populateAssertToLLVMConversionPattern(LLVMTypeConverter &converter, +void populateAssertToLLVMConversionPattern(const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool abortOnFailure = true); diff --git a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h index 43578ffffae2dc..6de46960ff8029 100644 --- a/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h +++ b/mlir/include/mlir/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.h @@ -20,7 +20,7 @@ class SPIRVTypeConverter; namespace cf { /// Appends to a pattern list additional patterns for translating ControlFLow /// ops to SPIR-V ops. -void populateControlFlowToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateControlFlowToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace cf } // namespace mlir diff --git a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h index 76eb3b5dd11e95..b1ea2740c06059 100644 --- a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h +++ b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h @@ -39,8 +39,8 @@ convertFuncOpToLLVMFuncOp(FunctionOpInterface funcOp, /// `emitCWrappers` is set, the pattern will also produce functions /// that pass memref descriptors by pointer-to-structure in addition to the /// default unpacked form. -void populateFuncToLLVMFuncOpConversionPattern(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateFuncToLLVMFuncOpConversionPattern( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Collect the patterns to convert from the Func dialect to LLVM. The /// conversion patterns capture the LLVMTypeConverter and the LowerToLLVMOptions @@ -56,7 +56,7 @@ void populateFuncToLLVMFuncOpConversionPattern(LLVMTypeConverter &converter, /// needed if `converter.getOptions().useBarePtrCallConv` is `true`, but it's /// not an error to provide it anyway. void populateFuncToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, const SymbolTable *symbolTable = nullptr); void registerConvertFuncToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h index 2fa55f40dd9700..68728755a2fbdb 100644 --- a/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h +++ b/mlir/include/mlir/Conversion/FuncToSPIRV/FuncToSPIRV.h @@ -21,7 +21,7 @@ class SPIRVTypeConverter; /// Appends to a pattern list additional patterns for translating Func ops /// to SPIR-V ops. Also adds the patterns to legalize ops not directly /// translated to SPIR-V dialect. -void populateFuncToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateFuncToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h b/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h index 20c9f9c394525d..3bf30ae99f2bf1 100644 --- a/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h +++ b/mlir/include/mlir/Conversion/GPUToLLVMSPV/GPUToLLVMSPVPass.h @@ -21,7 +21,7 @@ class TypeConverter; #define GEN_PASS_DECL_CONVERTGPUOPSTOLLVMSPVOPS #include "mlir/Conversion/Passes.h.inc" -void populateGpuToLLVMSPVConversionPatterns(LLVMTypeConverter &converter, +void populateGpuToLLVMSPVConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Populates memory space attribute conversion rules for lowering diff --git a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h index e0f4c71051e506..645e86a4309621 100644 --- a/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h +++ b/mlir/include/mlir/Conversion/GPUToNVVM/GPUToNVVMPass.h @@ -32,16 +32,16 @@ LLVM::LLVMStructType convertMMAToLLVMType(gpu::MMAMatrixType type); void configureGpuToNVVMConversionLegality(ConversionTarget &target); /// Collect a set of patterns to convert from the GPU dialect to NVVM. -void populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter, +void populateGpuToNVVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Populate GpuSubgroupReduce pattern to NVVM. It generates a specific nvvm /// op that is not available on every GPU. -void populateGpuSubgroupReduceOpLoweringPattern(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateGpuSubgroupReduceOpLoweringPattern( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Collect a set of patterns to convert WMMA ops from GPU dialect to NVVM. -void populateGpuWMMAToNVVMConversionPatterns(LLVMTypeConverter &converter, +void populateGpuWMMAToNVVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h index 5647787712997b..1a917932a9a84a 100644 --- a/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h +++ b/mlir/include/mlir/Conversion/GPUToROCDL/GPUToROCDLPass.h @@ -30,7 +30,7 @@ class GPUModuleOp; /// Collect a set of patterns to convert from the GPU dialect to ROCDL. /// If `runtime` is Unknown, gpu.printf will not be lowered /// The resulting pattern set should be run over a gpu.module op -void populateGpuToROCDLConversionPatterns(LLVMTypeConverter &converter, +void populateGpuToROCDLConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, gpu::amd::Runtime runtime); diff --git a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h index d34549432161db..825142d120587f 100644 --- a/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h +++ b/mlir/include/mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h @@ -23,13 +23,13 @@ class SPIRVTypeConverter; /// Appends to a pattern list additional patterns for translating GPU Ops to /// SPIR-V ops. For a gpu.func to be converted, it should have a /// spirv.entry_point_abi attribute. -void populateGPUToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateGPUToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); /// Collect a set of patterns to convert WMMA ops from GPU dialect to SPIRV, /// using the KHR Cooperative Matrix extension. void populateGpuWMMAToSPIRVCoopMatrixKHRConversionPatterns( - SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); /// Adds `MMAMatrixType` conversions to SPIR-V cooperative matrix KHR type /// conversion to the type converter. diff --git a/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h b/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h index df605adae669be..16d3d74b135588 100644 --- a/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h +++ b/mlir/include/mlir/Conversion/IndexToLLVM/IndexToLLVM.h @@ -21,7 +21,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace index { -void populateIndexToLLVMConversionPatterns(LLVMTypeConverter &converter, +void populateIndexToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); void registerConvertIndexToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h b/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h index 58a1c5246eef99..e5e7d3318a8717 100644 --- a/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h +++ b/mlir/include/mlir/Conversion/IndexToSPIRV/IndexToSPIRV.h @@ -21,7 +21,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace index { -void populateIndexToSPIRVPatterns(SPIRVTypeConverter &converter, +void populateIndexToSPIRVPatterns(const SPIRVTypeConverter &converter, RewritePatternSet &patterns); std::unique_ptr> createConvertIndexToSPIRVPass(); } // namespace index diff --git a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h index 4ddc1637000fdb..93cd780bba4381 100644 --- a/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h +++ b/mlir/include/mlir/Conversion/MathToLLVM/MathToLLVM.h @@ -21,7 +21,7 @@ class Pass; #define GEN_PASS_DECL_CONVERTMATHTOLLVMPASS #include "mlir/Conversion/Passes.h.inc" -void populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter, +void populateMathToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool approximateLog1p = true); diff --git a/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h b/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h index fa7a635568c7c2..46573e7966cccc 100644 --- a/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h +++ b/mlir/include/mlir/Conversion/MathToROCDL/MathToROCDL.h @@ -19,7 +19,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" /// Populate the given list with patterns that convert from Math to ROCDL calls. -void populateMathToROCDLConversionPatterns(LLVMTypeConverter &converter, +void populateMathToROCDLConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h index 10090268a46636..452b3f5df931e1 100644 --- a/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h +++ b/mlir/include/mlir/Conversion/MathToSPIRV/MathToSPIRV.h @@ -20,7 +20,7 @@ class SPIRVTypeConverter; /// Appends to a pattern list additional patterns for translating Math ops /// to SPIR-V ops. -void populateMathToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateMathToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/MemRefToEmitC/MemRefToEmitC.h b/mlir/include/mlir/Conversion/MemRefToEmitC/MemRefToEmitC.h index 734ffdba520c9f..950d50229bac16 100644 --- a/mlir/include/mlir/Conversion/MemRefToEmitC/MemRefToEmitC.h +++ b/mlir/include/mlir/Conversion/MemRefToEmitC/MemRefToEmitC.h @@ -15,7 +15,7 @@ class TypeConverter; void populateMemRefToEmitCTypeConversion(TypeConverter &typeConverter); void populateMemRefToEmitCConversionPatterns(RewritePatternSet &patterns, - TypeConverter &converter); + const TypeConverter &converter); } // namespace mlir #endif // MLIR_CONVERSION_MEMREFTOEMITC_MEMREFTOEMITC_H diff --git a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h index db1c222643d571..996a64baf9dd58 100644 --- a/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h +++ b/mlir/include/mlir/Conversion/MemRefToLLVM/MemRefToLLVM.h @@ -23,7 +23,7 @@ class RewritePatternSet; /// Collect a set of patterns to convert memory-related operations from the /// MemRef dialect to the LLVM dialect. void populateFinalizeMemRefToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns); + const LLVMTypeConverter &converter, RewritePatternSet &patterns); void registerConvertMemRefToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h index 54711c8ad727fb..4aa2bac98a7bb9 100644 --- a/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h +++ b/mlir/include/mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h @@ -67,7 +67,7 @@ void convertMemRefTypesAndAttrs( /// Appends to a pattern list additional patterns for translating MemRef ops /// to SPIR-V ops. -void populateMemRefToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateMemRefToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h b/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h index 4b8d5c5fe2a893..ee5b8cecb529c4 100644 --- a/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h +++ b/mlir/include/mlir/Conversion/NVGPUToNVVM/NVGPUToNVVM.h @@ -34,7 +34,7 @@ MemRefType getMBarrierMemrefType(MLIRContext *context, MBarrierGroupType barrierType); } // namespace nvgpu -void populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter, +void populateNVGPUToNVVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h b/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h index 2ed077f8f83e91..5ae484eadf49ff 100644 --- a/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h +++ b/mlir/include/mlir/Conversion/OpenMPToLLVM/ConvertOpenMPToLLVM.h @@ -22,8 +22,8 @@ class RewritePatternSet; /// Configure dynamic conversion legality of regionless operations from OpenMP /// to LLVM. -void configureOpenMPToLLVMConversionLegality(ConversionTarget &target, - LLVMTypeConverter &typeConverter); +void configureOpenMPToLLVMConversionLegality( + ConversionTarget &target, const LLVMTypeConverter &typeConverter); /// Populate the given list with patterns that convert from OpenMP to LLVM. void populateOpenMPToLLVMConversionPatterns(LLVMTypeConverter &converter, diff --git a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h index 4effa7186ef36f..5b960cde1050cb 100644 --- a/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h +++ b/mlir/include/mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h @@ -34,7 +34,7 @@ struct ScfToSPIRVContext { /// Collects a set of patterns to lower from scf.for, scf.if, and /// loop.terminator to CFG operations within the SPIR-V dialect. -void populateSCFToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateSCFToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, ScfToSPIRVContext &scfToSPIRVContext, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h index 84935d19670437..e59373c955fc3b 100644 --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h @@ -25,13 +25,16 @@ class ModuleOp; template class SPIRVToLLVMConversion : public OpConversionPattern { public: - SPIRVToLLVMConversion(MLIRContext *context, LLVMTypeConverter &typeConverter, + SPIRVToLLVMConversion(MLIRContext *context, + const LLVMTypeConverter &typeConverter, PatternBenefit benefit = 1) - : OpConversionPattern(typeConverter, context, benefit), - typeConverter(typeConverter) {} + : OpConversionPattern(typeConverter, context, benefit) {} protected: - LLVMTypeConverter &typeConverter; + const LLVMTypeConverter *getTypeConverter() const { + return static_cast( + ConversionPattern::getTypeConverter()); + } }; /// Encodes global variable's descriptor set and binding into its name if they @@ -46,18 +49,18 @@ void populateSPIRVToLLVMTypeConversion( /// Populates the given list with patterns that convert from SPIR-V to LLVM. void populateSPIRVToLLVMConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns, + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns, spirv::ClientAPI clientAPIForAddressSpaceMapping = spirv::ClientAPI::Unknown); /// Populates the given list with patterns for function conversion from SPIR-V /// to LLVM. void populateSPIRVToLLVMFunctionConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns); + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns); /// Populates the given patterns for module conversion from SPIR-V to LLVM. void populateSPIRVToLLVMModuleConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns); + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h b/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h index fc122df23bc5ce..49cb862f780514 100644 --- a/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h +++ b/mlir/include/mlir/Conversion/TensorToSPIRV/TensorToSPIRV.h @@ -30,7 +30,7 @@ class SPIRVTypeConverter; /// variables. SPIR-V consumers in GPU drivers may or may not optimize that /// away. So this has implications over register pressure. Therefore, a /// threshold is used to control when the patterns should kick in. -void populateTensorToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateTensorToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, int64_t byteCountThreshold, RewritePatternSet &patterns); diff --git a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h index c84e4f17c38d88..192583f347b8a4 100644 --- a/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h +++ b/mlir/include/mlir/Conversion/TosaToLinalg/TosaToLinalg.h @@ -47,7 +47,7 @@ void addTosaToLinalgPasses( void registerTosaToLinalgPipelines(); /// Populates conversion passes from TOSA dialect to Linalg dialect. -void populateTosaToLinalgConversionPatterns(TypeConverter &converter, +void populateTosaToLinalgConversionPatterns(const TypeConverter &converter, RewritePatternSet *patterns); /// Populates conversion passes from TOSA dialect to Linalg named operations. diff --git a/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h b/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h index 76a4b1b1563366..66c381f5174183 100644 --- a/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h +++ b/mlir/include/mlir/Conversion/TosaToTensor/TosaToTensor.h @@ -25,7 +25,7 @@ namespace tosa { std::unique_ptr createTosaToTensor(); -void populateTosaToTensorConversionPatterns(TypeConverter &converter, +void populateTosaToTensorConversionPatterns(const TypeConverter &converter, RewritePatternSet *patterns); } // namespace tosa diff --git a/mlir/include/mlir/Conversion/UBToLLVM/UBToLLVM.h b/mlir/include/mlir/Conversion/UBToLLVM/UBToLLVM.h index 787f69bdc31e95..ff9cd4759b9e89 100644 --- a/mlir/include/mlir/Conversion/UBToLLVM/UBToLLVM.h +++ b/mlir/include/mlir/Conversion/UBToLLVM/UBToLLVM.h @@ -22,7 +22,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace ub { -void populateUBToLLVMConversionPatterns(LLVMTypeConverter &converter, +void populateUBToLLVMConversionPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns); void registerConvertUBToLLVMInterface(DialectRegistry ®istry); diff --git a/mlir/include/mlir/Conversion/UBToSPIRV/UBToSPIRV.h b/mlir/include/mlir/Conversion/UBToSPIRV/UBToSPIRV.h index 3843f2707a520d..5e6cf7fac6a220 100644 --- a/mlir/include/mlir/Conversion/UBToSPIRV/UBToSPIRV.h +++ b/mlir/include/mlir/Conversion/UBToSPIRV/UBToSPIRV.h @@ -21,7 +21,7 @@ class Pass; #include "mlir/Conversion/Passes.h.inc" namespace ub { -void populateUBToSPIRVConversionPatterns(SPIRVTypeConverter &converter, +void populateUBToSPIRVConversionPatterns(const SPIRVTypeConverter &converter, RewritePatternSet &patterns); } // namespace ub } // namespace mlir diff --git a/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h b/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h index ecd33779236cc3..5fda62e3584c79 100644 --- a/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h +++ b/mlir/include/mlir/Conversion/VectorToLLVM/ConvertVectorToLLVM.h @@ -16,12 +16,12 @@ class LLVMTypeConverter; /// Collect a set of patterns to convert from Vector contractions to LLVM Matrix /// Intrinsics. To lower to assembly, the LLVM flag -lower-matrix-intrinsics /// will be needed when invoking LLVM. -void populateVectorToLLVMMatrixConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateVectorToLLVMMatrixConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Collect a set of patterns to convert from the Vector dialect to LLVM. void populateVectorToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool reassociateFPReductions = false, bool force32BitVectorIndices = false); } // namespace mlir diff --git a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h index f8c02c54066b81..b64be4f733ec07 100644 --- a/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h +++ b/mlir/include/mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h @@ -20,7 +20,7 @@ class SPIRVTypeConverter; /// Appends to a pattern list additional patterns for translating Vector Ops to /// SPIR-V ops. -void populateVectorToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateVectorToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); /// Appends patterns to convert vector reduction of the form: diff --git a/mlir/include/mlir/Dialect/AMX/Transforms.h b/mlir/include/mlir/Dialect/AMX/Transforms.h index 19608dff6f160f..d00ac52e274f9f 100644 --- a/mlir/include/mlir/Dialect/AMX/Transforms.h +++ b/mlir/include/mlir/Dialect/AMX/Transforms.h @@ -17,8 +17,8 @@ class RewritePatternSet; /// Collect a set of patterns to lower AMX ops to ops that map to LLVM /// intrinsics. -void populateAMXLegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateAMXLegalizeForLLVMExportPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Configure the target to support lowering AMX ops to ops that map to LLVM /// intrinsics. diff --git a/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h b/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h index 9dc262cc72ed00..aee64475171a43 100644 --- a/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h +++ b/mlir/include/mlir/Dialect/Arith/Transforms/Passes.h @@ -28,13 +28,15 @@ class NarrowTypeEmulationConverter; /// types into supported ones. This is done by splitting original power-of-two /// i2N integer types into two iN halves. void populateArithWideIntEmulationPatterns( - WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns); + const WideIntEmulationConverter &typeConverter, + RewritePatternSet &patterns); /// Adds patterns to emulate narrow Arith and Function ops into wide /// supported types. Users need to add conversions about the computation /// domain of narrow types. void populateArithNarrowTypeEmulationPatterns( - NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns); + const NarrowTypeEmulationConverter &typeConverter, + RewritePatternSet &patterns); /// Populate the type conversions needed to emulate the unsupported /// `sourceTypes` with `destType` @@ -45,12 +47,12 @@ void populateEmulateUnsupportedFloatsConversions(TypeConverter &converter, /// Add rewrite patterns for converting operations that use illegal float types /// to ones that use legal ones. void populateEmulateUnsupportedFloatsPatterns(RewritePatternSet &patterns, - TypeConverter &converter); + const TypeConverter &converter); /// Set up a dialect conversion to reject arithmetic operations on unsupported /// float types. void populateEmulateUnsupportedFloatsLegality(ConversionTarget &target, - TypeConverter &converter); + const TypeConverter &converter); /// Add patterns to expand Arith ceil/floor division ops. void populateCeilFloorDivExpandOpsPatterns(RewritePatternSet &patterns); diff --git a/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h b/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h index dcc485789875d3..8665c8224cc45a 100644 --- a/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/ArmSVE/Transforms/Transforms.h @@ -17,8 +17,8 @@ class RewritePatternSet; /// Collect a set of patterns to lower ArmSVE ops to ops that map to LLVM /// intrinsics. -void populateArmSVELegalizeForLLVMExportPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns); +void populateArmSVELegalizeForLLVMExportPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Configure the target to support lowering ArmSVE ops to ops that map to LLVM /// intrinsics. diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h index cab997e1aff297..1603dfcbae5589 100644 --- a/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h +++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/Bufferize.h @@ -60,7 +60,7 @@ void populateBufferizeMaterializationLegality(ConversionTarget &target); /// /// In particular, these are the tensor_load/buffer_cast ops. void populateEliminateBufferizeMaterializationsPatterns( - BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns); + const BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns); /// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`. /// diff --git a/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h b/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h index 4af4c65148da3d..1d311b37b37a4f 100644 --- a/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h +++ b/mlir/include/mlir/Dialect/Func/Transforms/DecomposeCallGraphTypes.h @@ -85,7 +85,7 @@ class ValueDecomposer { /// Populates the patterns needed to drive the conversion process for /// decomposing call graph types with the given `ValueDecomposer`. void populateDecomposeCallGraphTypesPatterns(MLIRContext *context, - TypeConverter &typeConverter, + const TypeConverter &typeConverter, ValueDecomposer &decomposer, RewritePatternSet &patterns); diff --git a/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h b/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h index adcd3087b7e2fd..642f704c144301 100644 --- a/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h +++ b/mlir/include/mlir/Dialect/Func/Transforms/FuncConversions.h @@ -29,7 +29,7 @@ class RewritePatternSet; /// Add a pattern to the given pattern list to convert the operand and result /// types of a CallOp with the given type converter. void populateCallOpTypeConversionPattern(RewritePatternSet &patterns, - TypeConverter &converter); + const TypeConverter &converter); /// Add a pattern to the given pattern list to rewrite branch operations to use /// operands that have been legalized by the conversion framework. This can only @@ -41,25 +41,25 @@ void populateCallOpTypeConversionPattern(RewritePatternSet &patterns, /// shouldConvertBranchOperand. This callback should return true if branchOp's /// operand at index idx should be converted. void populateBranchOpInterfaceTypeConversionPattern( - RewritePatternSet &patterns, TypeConverter &converter, + RewritePatternSet &patterns, const TypeConverter &converter, function_ref shouldConvertBranchOperand = nullptr); /// Return true if op is a BranchOpInterface op whose operands are all legal /// according to converter. -bool isLegalForBranchOpInterfaceTypeConversionPattern(Operation *op, - TypeConverter &converter); +bool isLegalForBranchOpInterfaceTypeConversionPattern( + Operation *op, const TypeConverter &converter); /// Add a pattern to the given pattern list to rewrite `return` ops to use /// operands that have been legalized by the conversion framework. void populateReturnOpTypeConversionPattern(RewritePatternSet &patterns, - TypeConverter &converter); + const TypeConverter &converter); /// For ReturnLike ops (except `return`), return True. If op is a `return` && /// returnOpAlwaysLegal is false, legalize op according to converter. Otherwise, /// return false. bool isLegalForReturnOpTypeConversionPattern(Operation *op, - TypeConverter &converter, + const TypeConverter &converter, bool returnOpAlwaysLegal = false); /// Return true if op is neither BranchOpInterface nor ReturnLike. diff --git a/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h b/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h index 2fba342ea80e71..c9e407daf9bf8c 100644 --- a/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h +++ b/mlir/include/mlir/Dialect/Func/Transforms/OneToNFuncConversions.h @@ -18,7 +18,7 @@ namespace mlir { // Populates the provided pattern set with patterns that do 1:N type conversions // on func ops. This is intended to be used with `applyPartialOneToNConversion`. -void populateFuncTypeConversionPatterns(TypeConverter &typeConverter, +void populateFuncTypeConversionPatterns(const TypeConverter &typeConverter, RewritePatternSet &patterns); } // namespace mlir diff --git a/mlir/include/mlir/Dialect/Math/Transforms/Passes.h b/mlir/include/mlir/Dialect/Math/Transforms/Passes.h index 2974bb344ad965..74ba91322ea857 100644 --- a/mlir/include/mlir/Dialect/Math/Transforms/Passes.h +++ b/mlir/include/mlir/Dialect/Math/Transforms/Passes.h @@ -62,7 +62,7 @@ void populateExtendToSupportedTypesTypeConverter( void populateExtendToSupportedTypesConversionTarget( ConversionTarget &target, TypeConverter &typeConverter); void populateExtendToSupportedTypesPatterns(RewritePatternSet &patterns, - TypeConverter &typeConverter); + const TypeConverter &typeConverter); } // namespace math } // namespace mlir diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h b/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h index 4444a7651b4072..62a2297c80e788 100644 --- a/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h +++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h @@ -72,7 +72,7 @@ void populateExpandReallocPatterns(RewritePatternSet &patterns, /// Appends patterns for emulating wide integer memref operations with ops over /// narrower integer types. void populateMemRefWideIntEmulationPatterns( - arith::WideIntEmulationConverter &typeConverter, + const arith::WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns); /// Appends type conversions for emulating wide integer memref operations with @@ -83,7 +83,7 @@ void populateMemRefWideIntEmulationConversions( /// Appends patterns for emulating memref operations over narrow types with ops /// over wider types. void populateMemRefNarrowTypeEmulationPatterns( - arith::NarrowTypeEmulationConverter &typeConverter, + const arith::NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns); /// Appends type conversions for emulating memref operations over narrow types diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/Patterns.h b/mlir/include/mlir/Dialect/SCF/Transforms/Patterns.h index 5e66774d2f1430..b87407d302a823 100644 --- a/mlir/include/mlir/Dialect/SCF/Transforms/Patterns.h +++ b/mlir/include/mlir/Dialect/SCF/Transforms/Patterns.h @@ -50,12 +50,12 @@ class ForLoopPipeliningPattern : public OpRewritePattern { /// corresponding scf.yield ops need to update their types accordingly to the /// TypeConverter, but otherwise don't care what type conversions are happening. void populateSCFStructuralTypeConversionsAndLegality( - TypeConverter &typeConverter, RewritePatternSet &patterns, + const TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target); /// Similar to `populateSCFStructuralTypeConversionsAndLegality` but does not /// populate the conversion target. -void populateSCFStructuralTypeConversions(TypeConverter &typeConverter, +void populateSCFStructuralTypeConversions(const TypeConverter &typeConverter, RewritePatternSet &patterns); /// Updates the ConversionTarget with dynamic legality of SCF operations based @@ -66,8 +66,8 @@ void populateSCFStructuralTypeConversionTarget( /// Populates the provided pattern set with patterns that do 1:N type /// conversions on (some) SCF ops. This is intended to be used with /// applyPartialOneToNConversion. -void populateSCFStructuralOneToNTypeConversions(TypeConverter &typeConverter, - RewritePatternSet &patterns); +void populateSCFStructuralOneToNTypeConversions( + const TypeConverter &typeConverter, RewritePatternSet &patterns); /// Populate patterns for SCF software pipelining transformation. See the /// ForLoopPipeliningPattern for the transformation details. diff --git a/mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h b/mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h index f54c93a09e7270..bed4d66ccd6cbe 100644 --- a/mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h +++ b/mlir/include/mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h @@ -135,7 +135,7 @@ class SPIRVConversionTarget : public ConversionTarget { /// `func` op to the SPIR-V dialect. These patterns do not handle shader /// interface/ABI; they convert function parameters to be of SPIR-V allowed /// types. -void populateBuiltinFuncToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateBuiltinFuncToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns); void populateFuncOpVectorRewritePatterns(RewritePatternSet &patterns); diff --git a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h index d22df6a7857c1d..6ccbc40bdd6034 100644 --- a/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h +++ b/mlir/include/mlir/Dialect/SparseTensor/Transforms/Passes.h @@ -154,7 +154,7 @@ struct SparseIterationTypeConverter : public OneToNTypeConverter { SparseIterationTypeConverter(); }; -void populateLowerSparseIterationToSCFPatterns(TypeConverter &converter, +void populateLowerSparseIterationToSCFPatterns(const TypeConverter &converter, RewritePatternSet &patterns); std::unique_ptr createLowerSparseIterationToSCFPass(); @@ -170,7 +170,7 @@ class SparseTensorTypeToPtrConverter : public TypeConverter { }; /// Sets up sparse tensor conversion rules. -void populateSparseTensorConversionPatterns(TypeConverter &typeConverter, +void populateSparseTensorConversionPatterns(const TypeConverter &typeConverter, RewritePatternSet &patterns); std::unique_ptr createSparseTensorConversionPass(); @@ -186,7 +186,7 @@ class SparseTensorTypeToBufferConverter : public TypeConverter { }; /// Sets up sparse tensor codegen rules. -void populateSparseTensorCodegenPatterns(TypeConverter &typeConverter, +void populateSparseTensorCodegenPatterns(const TypeConverter &typeConverter, RewritePatternSet &patterns, bool createSparseDeallocs, bool enableBufferInitialization); @@ -244,7 +244,7 @@ class StorageSpecifierToLLVMTypeConverter : public TypeConverter { StorageSpecifierToLLVMTypeConverter(); }; -void populateStorageSpecifierToLLVMPatterns(TypeConverter &converter, +void populateStorageSpecifierToLLVMPatterns(const TypeConverter &converter, RewritePatternSet &patterns); std::unique_ptr createStorageSpecifierToLLVMPass(); diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h index 456d021bc79358..a59f06f3c1ef1b 100644 --- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h +++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h @@ -366,7 +366,7 @@ void populateVectorMaskMaterializationPatterns(RewritePatternSet &patterns, /// Appends patterns for emulating vector operations over narrow types with ops /// over wider types. void populateVectorNarrowTypeEmulationPatterns( - arith::NarrowTypeEmulationConverter &typeConverter, + const arith::NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns); /// Rewrite a vector `bitcast(trunci)` to use a more efficient sequence of @@ -403,10 +403,9 @@ void populateVectorLinearizeTypeConversionsAndLegality( /// Populates patterns for linearizing ND (N >= 2) vector operations to 1D /// vector shuffle operations. -void populateVectorLinearizeShuffleLikeOpsPatterns(TypeConverter &typeConverter, - RewritePatternSet &patterns, - ConversionTarget &target, - unsigned targetBitWidth); +void populateVectorLinearizeShuffleLikeOpsPatterns( + const TypeConverter &typeConverter, RewritePatternSet &patterns, + ConversionTarget &target, unsigned targetBitWidth); } // namespace vector } // namespace mlir diff --git a/mlir/include/mlir/Dialect/X86Vector/Transforms.h b/mlir/include/mlir/Dialect/X86Vector/Transforms.h index fe98ebd955aa31..d54111ca41e69b 100644 --- a/mlir/include/mlir/Dialect/X86Vector/Transforms.h +++ b/mlir/include/mlir/Dialect/X86Vector/Transforms.h @@ -176,7 +176,7 @@ void populateSpecializedTransposeLoweringPatterns( /// Collect a set of patterns to lower X86Vector ops to ops that map to LLVM /// intrinsics. void populateX86VectorLegalizeForLLVMExportPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns); + const LLVMTypeConverter &converter, RewritePatternSet &patterns); /// Configure the target to support lowering X86Vector ops to ops that map to /// LLVM intrinsics. diff --git a/mlir/include/mlir/Transforms/OneToNTypeConversion.h b/mlir/include/mlir/Transforms/OneToNTypeConversion.h index 4c689ba219e884..c59a3a52f028f3 100644 --- a/mlir/include/mlir/Transforms/OneToNTypeConversion.h +++ b/mlir/include/mlir/Transforms/OneToNTypeConversion.h @@ -53,7 +53,7 @@ class OneToNTypeConverter : public TypeConverter { /// `TypeConverter::convertSignatureArgs` and exists here with a different /// name to reflect the broader semantic. LogicalResult computeTypeMapping(TypeRange types, - SignatureConversion &result) { + SignatureConversion &result) const { return convertSignatureArgs(types, result); } @@ -126,24 +126,25 @@ class RewritePatternWithConverter : public mlir::RewritePattern { /// Construct a conversion pattern with the given converter, and forward the /// remaining arguments to RewritePattern. template - RewritePatternWithConverter(TypeConverter &typeConverter, Args &&...args) + RewritePatternWithConverter(const TypeConverter &typeConverter, + Args &&...args) : RewritePattern(std::forward(args)...), typeConverter(&typeConverter) {} /// Return the type converter held by this pattern, or nullptr if the pattern /// does not require type conversion. - TypeConverter *getTypeConverter() const { return typeConverter; } + const TypeConverter *getTypeConverter() const { return typeConverter; } template std::enable_if_t::value, - ConverterTy *> + const ConverterTy *> getTypeConverter() const { - return static_cast(typeConverter); + return static_cast(typeConverter); } protected: /// A type converter for use by this pattern. - TypeConverter *const typeConverter; + const TypeConverter *const typeConverter; }; /// Specialization of `PatternRewriter` that `OneToNConversionPattern`s use. The @@ -212,8 +213,8 @@ class OneToNConversionPattern : public RewritePatternWithConverter { template class OneToNOpConversionPattern : public OneToNConversionPattern { public: - OneToNOpConversionPattern(TypeConverter &typeConverter, MLIRContext *context, - PatternBenefit benefit = 1, + OneToNOpConversionPattern(const TypeConverter &typeConverter, + MLIRContext *context, PatternBenefit benefit = 1, ArrayRef generatedNames = {}) : OneToNConversionPattern(typeConverter, SourceOp::getOperationName(), benefit, context, generatedNames) {} @@ -302,11 +303,11 @@ applyPartialOneToNConversion(Operation *op, OneToNTypeConverter &typeConverter, /// ops which use FunctionType to represent their type. This is intended to be /// used with the 1:N dialect conversion. void populateOneToNFunctionOpInterfaceTypeConversionPattern( - StringRef functionLikeOpName, TypeConverter &converter, + StringRef functionLikeOpName, const TypeConverter &converter, RewritePatternSet &patterns); template void populateOneToNFunctionOpInterfaceTypeConversionPattern( - TypeConverter &converter, RewritePatternSet &patterns) { + const TypeConverter &converter, RewritePatternSet &patterns) { populateOneToNFunctionOpInterfaceTypeConversionPattern( FuncOpT::getOperationName(), converter, patterns); } diff --git a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp index 7112d1607dfdca..2b33f3773dc7d1 100644 --- a/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp +++ b/mlir/lib/Conversion/AMDGPUToROCDL/AMDGPUToROCDL.cpp @@ -277,7 +277,7 @@ struct RawBufferOpLowering : public ConvertOpToLLVMPattern { }; struct LDSBarrierOpLowering : public ConvertOpToLLVMPattern { - LDSBarrierOpLowering(LLVMTypeConverter &converter, Chipset chipset) + LDSBarrierOpLowering(const LLVMTypeConverter &converter, Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -335,7 +335,7 @@ struct LDSBarrierOpLowering : public ConvertOpToLLVMPattern { }; struct SchedBarrierOpLowering : public ConvertOpToLLVMPattern { - SchedBarrierOpLowering(LLVMTypeConverter &converter, Chipset chipset) + SchedBarrierOpLowering(const LLVMTypeConverter &converter, Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -725,7 +725,7 @@ struct WMMAOpLowering : public ConvertOpToLLVMPattern { namespace { struct ExtPackedFp8OpLowering final : public ConvertOpToLLVMPattern { - ExtPackedFp8OpLowering(LLVMTypeConverter &converter, Chipset chipset) + ExtPackedFp8OpLowering(const LLVMTypeConverter &converter, Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -737,7 +737,8 @@ struct ExtPackedFp8OpLowering final struct PackedTrunc2xFp8OpLowering final : public ConvertOpToLLVMPattern { - PackedTrunc2xFp8OpLowering(LLVMTypeConverter &converter, Chipset chipset) + PackedTrunc2xFp8OpLowering(const LLVMTypeConverter &converter, + Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -749,7 +750,8 @@ struct PackedTrunc2xFp8OpLowering final struct PackedStochRoundFp8OpLowering final : public ConvertOpToLLVMPattern { - PackedStochRoundFp8OpLowering(LLVMTypeConverter &converter, Chipset chipset) + PackedStochRoundFp8OpLowering(const LLVMTypeConverter &converter, + Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -880,7 +882,7 @@ LogicalResult PackedStochRoundFp8OpLowering::matchAndRewrite( // Implement the AMDGPU_DPPLowering class that will convert the amdgpu.dpp // operation into the corresponding ROCDL instructions. struct AMDGPUDPPLowering : public ConvertOpToLLVMPattern { - AMDGPUDPPLowering(LLVMTypeConverter &converter, Chipset chipset) + AMDGPUDPPLowering(const LLVMTypeConverter &converter, Chipset chipset) : ConvertOpToLLVMPattern(converter), chipset(chipset) {} Chipset chipset; @@ -1052,9 +1054,9 @@ struct ConvertAMDGPUToROCDLPass }; } // namespace -void mlir::populateAMDGPUToROCDLConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns, - Chipset chipset) { +void mlir::populateAMDGPUToROCDLConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns, + Chipset chipset) { patterns .add, RawBufferOpLowering, diff --git a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp index d882f1184f4570..aac24f113d891f 100644 --- a/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp +++ b/mlir/lib/Conversion/ArithToLLVM/ArithToLLVM.cpp @@ -520,7 +520,7 @@ void mlir::arith::registerConvertArithToLLVMInterface( //===----------------------------------------------------------------------===// void mlir::arith::populateArithToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // clang-format off patterns.add< AddFOpLowering, diff --git a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp index e6c01f063e8b80..382b93cd9f21b1 100644 --- a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp +++ b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp @@ -1262,7 +1262,7 @@ class MinNumMaxNumFOpPattern final : public OpConversionPattern { //===----------------------------------------------------------------------===// void mlir::arith::populateArithToSPIRVPatterns( - SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { // clang-format off patterns.add< ConstantCompositeOpPattern, diff --git a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp index 0a3c3a330ff699..fcc18e6eee9980 100644 --- a/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp +++ b/mlir/lib/Conversion/ComplexToLLVM/ComplexToLLVM.cpp @@ -323,7 +323,7 @@ struct SubOpConversion : public ConvertOpToLLVMPattern { } // namespace void mlir::populateComplexToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // clang-format off patterns.add< AbsOpConversion, diff --git a/mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp b/mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp index d531659e0623a0..5e7d2d8491533f 100644 --- a/mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp +++ b/mlir/lib/Conversion/ComplexToSPIRV/ComplexToSPIRV.cpp @@ -102,8 +102,8 @@ struct ImOpPattern final : OpConversionPattern { // Pattern population //===----------------------------------------------------------------------===// -void mlir::populateComplexToSPIRVPatterns(SPIRVTypeConverter &typeConverter, - RewritePatternSet &patterns) { +void mlir::populateComplexToSPIRVPatterns( + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { MLIRContext *context = patterns.getContext(); patterns.add( diff --git a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp index b8e5aec25286d2..e5c735e10703a7 100644 --- a/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp +++ b/mlir/lib/Conversion/ControlFlowToLLVM/ControlFlowToLLVM.cpp @@ -43,7 +43,7 @@ namespace { /// ignored by the default lowering but should be propagated by any custom /// lowering. struct AssertOpLowering : public ConvertOpToLLVMPattern { - explicit AssertOpLowering(LLVMTypeConverter &typeConverter, + explicit AssertOpLowering(const LLVMTypeConverter &typeConverter, bool abortOnFailedAssert = true) : ConvertOpToLLVMPattern(typeConverter, /*benefit=*/1), abortOnFailedAssert(abortOnFailedAssert) {} @@ -201,7 +201,7 @@ struct SwitchOpLowering : public ConvertOpToLLVMPattern { } // namespace void mlir::cf::populateControlFlowToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // clang-format off patterns.add< AssertOpLowering, @@ -212,7 +212,7 @@ void mlir::cf::populateControlFlowToLLVMConversionPatterns( } void mlir::cf::populateAssertToLLVMConversionPattern( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool abortOnFailure) { patterns.add(converter, abortOnFailure); } diff --git a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp index f96bfd6f788b9c..d8f3e995109538 100644 --- a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp +++ b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp @@ -109,7 +109,7 @@ struct CondBranchOpPattern final : OpConversionPattern { //===----------------------------------------------------------------------===// void mlir::cf::populateControlFlowToSPIRVPatterns( - SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { MLIRContext *context = patterns.getContext(); patterns.add(typeConverter, context); diff --git a/mlir/lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp b/mlir/lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp index f85993e52b4052..4b7f7ff114deeb 100644 --- a/mlir/lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp +++ b/mlir/lib/Conversion/ConvertToSPIRV/ConvertToSPIRVPass.cpp @@ -55,7 +55,7 @@ void mapToMemRef(Operation *op, spirv::TargetEnvAttr &targetAttr) { } /// Populate patterns for each dialect. -void populateConvertToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateConvertToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, ScfToSPIRVContext &scfToSPIRVContext, RewritePatternSet &patterns) { arith::populateCeilFloorDivExpandOpsPatterns(patterns); diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp index 2cc77e8fd41b9a..27c43e0daad072 100644 --- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp +++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp @@ -722,12 +722,12 @@ struct ReturnOpLowering : public ConvertOpToLLVMPattern { } // namespace void mlir::populateFuncToLLVMFuncOpConversionPattern( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); } void mlir::populateFuncToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, const SymbolTable *symbolTable) { populateFuncToLLVMFuncOpConversionPattern(converter, patterns); patterns.add(converter); diff --git a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp index 4740b7cc6c385b..a5c2b92ca191df 100644 --- a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp +++ b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp @@ -87,7 +87,7 @@ class CallOpPattern final : public OpConversionPattern { // Pattern population //===----------------------------------------------------------------------===// -void mlir::populateFuncToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void mlir::populateFuncToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { MLIRContext *context = patterns.getContext(); diff --git a/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h b/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h index eaf1554a83f89a..c9ddc942bd6821 100644 --- a/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h +++ b/mlir/lib/Conversion/GPUCommon/IndexIntrinsicsOpLowering.h @@ -36,13 +36,13 @@ struct OpLowering : public ConvertOpToLLVMPattern { IntrType intrType; public: - explicit OpLowering(LLVMTypeConverter &typeConverter) + explicit OpLowering(const LLVMTypeConverter &typeConverter) : ConvertOpToLLVMPattern(typeConverter), indexBitwidth(typeConverter.getIndexTypeBitwidth()), indexKind(IndexKind::Other), intrType(IntrType::None) {} - explicit OpLowering(LLVMTypeConverter &typeConverter, IndexKind indexKind, - IntrType intrType) + explicit OpLowering(const LLVMTypeConverter &typeConverter, + IndexKind indexKind, IntrType intrType) : ConvertOpToLLVMPattern(typeConverter), indexBitwidth(typeConverter.getIndexTypeBitwidth()), indexKind(indexKind), intrType(intrType) {} diff --git a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h index 8ff4d4ec67b9fd..1cf8a1acb31935 100644 --- a/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h +++ b/mlir/lib/Conversion/GPUCommon/OpToFuncCallLowering.h @@ -42,9 +42,9 @@ namespace mlir { template struct OpToFuncCallLowering : public ConvertOpToLLVMPattern { public: - explicit OpToFuncCallLowering(LLVMTypeConverter &lowering, StringRef f32Func, - StringRef f64Func, StringRef f32ApproxFunc, - StringRef f16Func) + explicit OpToFuncCallLowering(const LLVMTypeConverter &lowering, + StringRef f32Func, StringRef f64Func, + StringRef f32ApproxFunc, StringRef f16Func) : ConvertOpToLLVMPattern(lowering), f32Func(f32Func), f64Func(f64Func), f32ApproxFunc(f32ApproxFunc), f16Func(f16Func) {} diff --git a/mlir/lib/Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp b/mlir/lib/Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp index 739a34e0aa610e..544f1f4a4f6a79 100644 --- a/mlir/lib/Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp +++ b/mlir/lib/Conversion/GPUToLLVMSPV/GPUToLLVMSPV.cpp @@ -412,8 +412,8 @@ gpuAddressSpaceToOCLAddressSpace(gpu::AddressSpace addressSpace) { } } // namespace -void populateGpuToLLVMSPVConversionPatterns(LLVMTypeConverter &typeConverter, - RewritePatternSet &patterns) { +void populateGpuToLLVMSPVConversionPatterns( + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add, GPUSubgroupOpConversion, diff --git a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp index 2b91a6c28c05e8..e83574b7342725 100644 --- a/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp +++ b/mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp @@ -333,7 +333,7 @@ void mlir::configureGpuToNVVMConversionLegality(ConversionTarget &target) { } template -static void populateOpPatterns(LLVMTypeConverter &converter, +static void populateOpPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, StringRef f32Func, StringRef f64Func, StringRef f32ApproxFunc = "", StringRef f16Func = "") { @@ -343,12 +343,12 @@ static void populateOpPatterns(LLVMTypeConverter &converter, } void mlir::populateGpuSubgroupReduceOpLoweringPattern( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); } -void mlir::populateGpuToNVVMConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns) { +void mlir::populateGpuToNVVMConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { using gpu::index_lowering::IndexKind; using gpu::index_lowering::IntrType; populateWithGenerated(patterns); diff --git a/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp b/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp index b7fd454c60902f..2b040fddac7486 100644 --- a/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp +++ b/mlir/lib/Conversion/GPUToNVVM/WmmaOpsToNvvm.cpp @@ -388,7 +388,7 @@ LLVM::LLVMStructType mlir::convertMMAToLLVMType(gpu::MMAMatrixType type) { } void mlir::populateGpuWMMAToNVVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); diff --git a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp index 482c9e2c2d0017..e253037e0edcea 100644 --- a/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp +++ b/mlir/lib/Conversion/GPUToROCDL/LowerGpuOpsToROCDLOps.cpp @@ -343,7 +343,7 @@ void mlir::configureGpuToROCDLConversionLegality(ConversionTarget &target) { } template -static void populateOpPatterns(LLVMTypeConverter &converter, +static void populateOpPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, StringRef f32Func, StringRef f64Func, StringRef f32ApproxFunc, StringRef f16Func) { @@ -353,7 +353,7 @@ static void populateOpPatterns(LLVMTypeConverter &converter, } void mlir::populateGpuToROCDLConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, mlir::gpu::amd::Runtime runtime) { using gpu::index_lowering::IndexKind; using gpu::index_lowering::IntrType; diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp index 53b4c720ae56d2..3cc64b82950b56 100644 --- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp @@ -59,7 +59,8 @@ class SingleDimLaunchConfigConversion : public OpConversionPattern { /// attribute on the surrounding FuncOp is used to replace the gpu::BlockDimOp. class WorkGroupSizeConversion : public OpConversionPattern { public: - WorkGroupSizeConversion(TypeConverter &typeConverter, MLIRContext *context) + WorkGroupSizeConversion(const TypeConverter &typeConverter, + MLIRContext *context) : OpConversionPattern(typeConverter, context, /*benefit*/ 10) {} LogicalResult @@ -728,7 +729,7 @@ LogicalResult GPUPrintfConversion::matchAndRewrite( // GPU To SPIRV Patterns. //===----------------------------------------------------------------------===// -void mlir::populateGPUToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void mlir::populateGPUToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add< GPUBarrierConversion, GPUFuncOpConversion, GPUModuleConversion, diff --git a/mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp index 92cc0eadb9784c..1b0f0235278916 100644 --- a/mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp +++ b/mlir/lib/Conversion/GPUToSPIRV/WmmaOpsToSPIRV.cpp @@ -293,7 +293,7 @@ struct WmmaMmaOpToSPIRVLowering final } // namespace mlir void mlir::populateGpuWMMAToSPIRVCoopMatrixKHRConversionPatterns( - SPIRVTypeConverter &converter, RewritePatternSet &patterns) { + const SPIRVTypeConverter &converter, RewritePatternSet &patterns) { using namespace mlir; MLIRContext *context = patterns.getContext(); patterns.add { // Pattern Population //===----------------------------------------------------------------------===// -void index::populateIndexToSPIRVPatterns(SPIRVTypeConverter &typeConverter, - RewritePatternSet &patterns) { +void index::populateIndexToSPIRVPatterns( + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add< // clang-format off ConvertIndexAdd, diff --git a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp index 23e957288eb95e..668f8385ac2dcf 100644 --- a/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp +++ b/mlir/lib/Conversion/MathToLLVM/MathToLLVM.cpp @@ -298,9 +298,9 @@ struct ConvertMathToLLVMPass }; } // namespace -void mlir::populateMathToLLVMConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns, - bool approximateLog1p) { +void mlir::populateMathToLLVMConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns, + bool approximateLog1p) { if (approximateLog1p) patterns.add(converter); // clang-format off diff --git a/mlir/lib/Conversion/MathToROCDL/MathToROCDL.cpp b/mlir/lib/Conversion/MathToROCDL/MathToROCDL.cpp index 8330713ea66e5c..c17bfe4f71a98d 100644 --- a/mlir/lib/Conversion/MathToROCDL/MathToROCDL.cpp +++ b/mlir/lib/Conversion/MathToROCDL/MathToROCDL.cpp @@ -36,7 +36,7 @@ using namespace mlir; #define DBGS() (llvm::dbgs() << "[" DEBUG_TYPE "]: ") template -static void populateOpPatterns(LLVMTypeConverter &converter, +static void populateOpPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns, StringRef f32Func, StringRef f64Func, StringRef f16Func, StringRef f32ApproxFunc = "") { @@ -45,8 +45,8 @@ static void populateOpPatterns(LLVMTypeConverter &converter, f32ApproxFunc, f16Func); } -void mlir::populateMathToROCDLConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns) { +void mlir::populateMathToROCDLConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // Handled by mathToLLVM: math::AbsIOp // Handled by mathToLLVM: math::AbsFOp // Handled by mathToLLVM: math::CopySignOp diff --git a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp index 52ff138bedf65b..6f948e80d5af8f 100644 --- a/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp +++ b/mlir/lib/Conversion/MathToSPIRV/MathToSPIRV.cpp @@ -462,7 +462,7 @@ struct RoundOpPattern final : public OpConversionPattern { //===----------------------------------------------------------------------===// namespace mlir { -void populateMathToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateMathToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { // Core patterns patterns.add(typeConverter, patterns.getContext()); diff --git a/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp b/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp index 1392bf924002ee..2b7ac4b529cf0d 100644 --- a/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp +++ b/mlir/lib/Conversion/MemRefToEmitC/MemRefToEmitC.cpp @@ -179,8 +179,8 @@ void mlir::populateMemRefToEmitCTypeConversion(TypeConverter &typeConverter) { }); } -void mlir::populateMemRefToEmitCConversionPatterns(RewritePatternSet &patterns, - TypeConverter &converter) { +void mlir::populateMemRefToEmitCConversionPatterns( + RewritePatternSet &patterns, const TypeConverter &converter) { patterns.add(converter, patterns.getContext()); } diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp index 054827d40f0f32..4bfa536cc8a44a 100644 --- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp +++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp @@ -1667,7 +1667,7 @@ class ExtractStridedMetadataOpLowering } // namespace void mlir::populateFinalizeMemRefToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // clang-format off patterns.add< AllocaOpLowering, diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp index 90b0d727ddee7f..285398311fd197 100644 --- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp +++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp @@ -926,7 +926,7 @@ LogicalResult ReinterpretCastPattern::matchAndRewrite( //===----------------------------------------------------------------------===// namespace mlir { -void populateMemRefToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void populateMemRefToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add { }; } // namespace -void mlir::populateNVGPUToNVVMConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns) { +void mlir::populateNVGPUToNVVMConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add< NVGPUMBarrierCreateLowering, // nvgpu.mbarrier.create NVGPUMBarrierInitLowering, // nvgpu.mbarrier.init diff --git a/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp b/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp index d6b4ec8584b082..bf1b59a9913f49 100644 --- a/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp +++ b/mlir/lib/Conversion/OpenMPToLLVM/OpenMPToLLVM.cpp @@ -221,7 +221,7 @@ void MultiRegionOpConversion::forwardOpAttrs( } // namespace void mlir::configureOpenMPToLLVMConversionLegality( - ConversionTarget &target, LLVMTypeConverter &typeConverter) { + ConversionTarget &target, const LLVMTypeConverter &typeConverter) { target.addDynamicallyLegalOp< omp::AtomicReadOp, omp::AtomicWriteOp, omp::CancellationPointOp, omp::CancelOp, omp::CriticalDeclareOp, omp::FlushOp, omp::MapBoundsOp, diff --git a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp index f62de1f17a6668..31d8cd2206148f 100644 --- a/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp +++ b/mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp @@ -96,7 +96,7 @@ Region::iterator getBlockIt(Region ®ion, unsigned index) { template class SCFToSPIRVPattern : public OpConversionPattern { public: - SCFToSPIRVPattern(MLIRContext *context, SPIRVTypeConverter &converter, + SCFToSPIRVPattern(MLIRContext *context, const SPIRVTypeConverter &converter, ScfToSPIRVContextImpl *scfToSPIRVContext) : OpConversionPattern::OpConversionPattern(converter, context), scfToSPIRVContext(scfToSPIRVContext), typeConverter(converter) {} @@ -117,7 +117,7 @@ class SCFToSPIRVPattern : public OpConversionPattern { // conversion. There isn't a straightforward way to do that yet, as when // converting types, ops aren't taken into consideration. Therefore, we just // bypass the framework's type conversion for now. - SPIRVTypeConverter &typeConverter; + const SPIRVTypeConverter &typeConverter; }; //===----------------------------------------------------------------------===// @@ -436,7 +436,7 @@ struct WhileOpConversion final : SCFToSPIRVPattern { // Public API //===----------------------------------------------------------------------===// -void mlir::populateSCFToSPIRVPatterns(SPIRVTypeConverter &typeConverter, +void mlir::populateSCFToSPIRVPatterns(const SPIRVTypeConverter &typeConverter, ScfToSPIRVContext &scfToSPIRVContext, RewritePatternSet &patterns) { patterns.add(srcType)) { unsigned numElements = vectorType.getNumElements(); @@ -186,7 +186,8 @@ static Value optionallyBroadcast(Location loc, Value value, Type srcType, /// Then cast `Offset` and `Count` if their bit width is different /// from `Base` bit width. static Value processCountOrOffset(Location loc, Value value, Type srcType, - Type dstType, LLVMTypeConverter &converter, + Type dstType, + const LLVMTypeConverter &converter, ConversionPatternRewriter &rewriter) { Value broadcasted = optionallyBroadcast(loc, value, srcType, converter, rewriter); @@ -196,7 +197,7 @@ static Value processCountOrOffset(Location loc, Value value, Type srcType, /// Converts SPIR-V struct with a regular (according to `VulkanLayoutUtils`) /// offset to LLVM struct. Otherwise, the conversion is not supported. static Type convertStructTypeWithOffset(spirv::StructType type, - LLVMTypeConverter &converter) { + const LLVMTypeConverter &converter) { if (type != VulkanLayoutUtils::decorateType(type)) return nullptr; @@ -209,7 +210,7 @@ static Type convertStructTypeWithOffset(spirv::StructType type, /// Converts SPIR-V struct with no offset to packed LLVM struct. static Type convertStructTypePacked(spirv::StructType type, - LLVMTypeConverter &converter) { + const LLVMTypeConverter &converter) { SmallVector elementsVector; if (failed(converter.convertTypes(type.getElementTypes(), elementsVector))) return nullptr; @@ -226,11 +227,10 @@ static Value createI32ConstantOf(Location loc, PatternRewriter &rewriter, } /// Utility for `spirv.Load` and `spirv.Store` conversion. -static LogicalResult replaceWithLoadOrStore(Operation *op, ValueRange operands, - ConversionPatternRewriter &rewriter, - LLVMTypeConverter &typeConverter, - unsigned alignment, bool isVolatile, - bool isNonTemporal) { +static LogicalResult replaceWithLoadOrStore( + Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter, + const LLVMTypeConverter &typeConverter, unsigned alignment, bool isVolatile, + bool isNonTemporal) { if (auto loadOp = dyn_cast(op)) { auto dstType = typeConverter.convertType(loadOp.getType()); if (!dstType) @@ -271,7 +271,7 @@ static std::optional convertArrayType(spirv::ArrayType type, /// Converts SPIR-V pointer type to LLVM pointer. Pointer's storage class is not /// modelled at the moment. static Type convertPointerType(spirv::PointerType type, - LLVMTypeConverter &converter, + const LLVMTypeConverter &converter, spirv::ClientAPI clientAPI) { unsigned addressSpace = storageClassToAddressSpace(clientAPI, type.getStorageClass()); @@ -292,7 +292,7 @@ static std::optional convertRuntimeArrayType(spirv::RuntimeArrayType type, /// Converts SPIR-V struct to LLVM struct. There is no support of structs with /// member decorations. Also, only natural offset is supported. static Type convertStructType(spirv::StructType type, - LLVMTypeConverter &converter) { + const LLVMTypeConverter &converter) { SmallVector memberDecorations; type.getMemberDecorations(memberDecorations); if (!memberDecorations.empty()) @@ -315,20 +315,21 @@ class AccessChainPattern : public SPIRVToLLVMConversion { LogicalResult matchAndRewrite(spirv::AccessChainOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = typeConverter.convertType(op.getComponentPtr().getType()); + auto dstType = + getTypeConverter()->convertType(op.getComponentPtr().getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); // To use GEP we need to add a first 0 index to go through the pointer. auto indices = llvm::to_vector<4>(adaptor.getIndices()); Type indexType = op.getIndices().front().getType(); - auto llvmIndexType = typeConverter.convertType(indexType); + auto llvmIndexType = getTypeConverter()->convertType(indexType); if (!llvmIndexType) return rewriter.notifyMatchFailure(op, "type conversion failed"); Value zero = rewriter.create( op.getLoc(), llvmIndexType, rewriter.getIntegerAttr(indexType, 0)); indices.insert(indices.begin(), zero); - auto elementType = typeConverter.convertType( + auto elementType = getTypeConverter()->convertType( cast(op.getBasePtr().getType()).getPointeeType()); if (!elementType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -345,7 +346,7 @@ class AddressOfPattern : public SPIRVToLLVMConversion { LogicalResult matchAndRewrite(spirv::AddressOfOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = typeConverter.convertType(op.getPointer().getType()); + auto dstType = getTypeConverter()->convertType(op.getPointer().getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); rewriter.replaceOpWithNewOp(op, dstType, @@ -363,16 +364,16 @@ class BitFieldInsertPattern matchAndRewrite(spirv::BitFieldInsertOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); Location loc = op.getLoc(); // Process `Offset` and `Count`: broadcast and extend/truncate if needed. Value offset = processCountOrOffset(loc, op.getOffset(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); Value count = processCountOrOffset(loc, op.getCount(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); // Create a mask with bits set outside [Offset, Offset + Count - 1]. Value minusOne = createConstantAllBitsSet(loc, srcType, dstType, rewriter); @@ -410,7 +411,7 @@ class ConstantScalarAndVectorPattern if (!isa(srcType) && !srcType.isIntOrFloat()) return failure(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(constOp, "type conversion failed"); @@ -451,16 +452,16 @@ class BitFieldSExtractPattern matchAndRewrite(spirv::BitFieldSExtractOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); Location loc = op.getLoc(); // Process `Offset` and `Count`: broadcast and extend/truncate if needed. Value offset = processCountOrOffset(loc, op.getOffset(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); Value count = processCountOrOffset(loc, op.getCount(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); // Create a constant that holds the size of the `Base`. IntegerType integerType; @@ -504,16 +505,16 @@ class BitFieldUExtractPattern matchAndRewrite(spirv::BitFieldUExtractOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); Location loc = op.getLoc(); // Process `Offset` and `Count`: broadcast and extend/truncate if needed. Value offset = processCountOrOffset(loc, op.getOffset(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); Value count = processCountOrOffset(loc, op.getCount(), srcType, dstType, - typeConverter, rewriter); + *getTypeConverter(), rewriter); // Create a mask with bits set at [0, Count - 1]. Value minusOne = createConstantAllBitsSet(loc, srcType, dstType, rewriter); @@ -580,7 +581,7 @@ class CompositeExtractPattern LogicalResult matchAndRewrite(spirv::CompositeExtractOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -612,7 +613,7 @@ class CompositeInsertPattern LogicalResult matchAndRewrite(spirv::CompositeInsertOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -643,7 +644,7 @@ class DirectConversionPattern : public SPIRVToLLVMConversion { LogicalResult matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); rewriter.template replaceOpWithNewOp( @@ -749,7 +750,7 @@ class GlobalVariablePattern return failure(); auto srcType = cast(op.getType()); - auto dstType = typeConverter.convertType(srcType.getPointeeType()); + auto dstType = getTypeConverter()->convertType(srcType.getPointeeType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -810,7 +811,7 @@ class IndirectCastPattern : public SPIRVToLLVMConversion { Type fromType = op.getOperand().getType(); Type toType = op.getType(); - auto dstType = this->typeConverter.convertType(toType); + auto dstType = this->getTypeConverter()->convertType(toType); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -846,7 +847,7 @@ class FunctionCallPattern } // Function returns a single result. - auto dstType = typeConverter.convertType(callOp.getType(0)); + auto dstType = getTypeConverter()->convertType(callOp.getType(0)); if (!dstType) return rewriter.notifyMatchFailure(callOp, "type conversion failed"); auto newOp = rewriter.replaceOpWithNewOp( @@ -868,7 +869,7 @@ class FComparePattern : public SPIRVToLLVMConversion { matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -888,7 +889,7 @@ class IComparePattern : public SPIRVToLLVMConversion { matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -907,7 +908,7 @@ class InverseSqrtPattern matchAndRewrite(spirv::GLInverseSqrtOp op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = op.getType(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -930,7 +931,7 @@ class LoadStorePattern : public SPIRVToLLVMConversion { ConversionPatternRewriter &rewriter) const override { if (!op.getMemoryAccess()) { return replaceWithLoadOrStore(op, adaptor.getOperands(), rewriter, - this->typeConverter, /*alignment=*/0, + *this->getTypeConverter(), /*alignment=*/0, /*isVolatile=*/false, /*isNonTemporal=*/false); } @@ -945,8 +946,8 @@ class LoadStorePattern : public SPIRVToLLVMConversion { bool isNonTemporal = memoryAccess == spirv::MemoryAccess::Nontemporal; bool isVolatile = memoryAccess == spirv::MemoryAccess::Volatile; return replaceWithLoadOrStore(op, adaptor.getOperands(), rewriter, - this->typeConverter, alignment, isVolatile, - isNonTemporal); + *this->getTypeConverter(), alignment, + isVolatile, isNonTemporal); } default: // There is no support of other memory access attributes. @@ -965,7 +966,7 @@ class NotPattern : public SPIRVToLLVMConversion { matchAndRewrite(SPIRVOp notOp, typename SPIRVOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = notOp.getType(); - auto dstType = this->typeConverter.convertType(srcType); + auto dstType = this->getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(notOp, "type conversion failed"); @@ -1196,7 +1197,7 @@ class ShiftPattern : public SPIRVToLLVMConversion { matchAndRewrite(SPIRVOp op, typename SPIRVOp::Adaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = this->typeConverter.convertType(op.getType()); + auto dstType = this->getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); @@ -1247,7 +1248,7 @@ class TanPattern : public SPIRVToLLVMConversion { LogicalResult matchAndRewrite(spirv::GLTanOp tanOp, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = typeConverter.convertType(tanOp.getType()); + auto dstType = getTypeConverter()->convertType(tanOp.getType()); if (!dstType) return rewriter.notifyMatchFailure(tanOp, "type conversion failed"); @@ -1273,7 +1274,7 @@ class TanhPattern : public SPIRVToLLVMConversion { matchAndRewrite(spirv::GLTanhOp tanhOp, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { auto srcType = tanhOp.getType(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(tanhOp, "type conversion failed"); @@ -1307,21 +1308,21 @@ class VariablePattern : public SPIRVToLLVMConversion { if (init && !pointerTo.isIntOrFloat() && !isa(pointerTo)) return failure(); - auto dstType = typeConverter.convertType(srcType); + auto dstType = getTypeConverter()->convertType(srcType); if (!dstType) return rewriter.notifyMatchFailure(varOp, "type conversion failed"); Location loc = varOp.getLoc(); Value size = createI32ConstantOf(loc, rewriter, 1); if (!init) { - auto elementType = typeConverter.convertType(pointerTo); + auto elementType = getTypeConverter()->convertType(pointerTo); if (!elementType) return rewriter.notifyMatchFailure(varOp, "type conversion failed"); rewriter.replaceOpWithNewOp(varOp, dstType, elementType, size); return success(); } - auto elementType = typeConverter.convertType(pointerTo); + auto elementType = getTypeConverter()->convertType(pointerTo); if (!elementType) return rewriter.notifyMatchFailure(varOp, "type conversion failed"); Value allocated = @@ -1344,7 +1345,7 @@ class BitcastConversionPattern LogicalResult matchAndRewrite(spirv::BitcastOp bitcastOp, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const override { - auto dstType = typeConverter.convertType(bitcastOp.getType()); + auto dstType = getTypeConverter()->convertType(bitcastOp.getType()); if (!dstType) return rewriter.notifyMatchFailure(bitcastOp, "type conversion failed"); @@ -1377,7 +1378,7 @@ class FuncConversionPattern : public SPIRVToLLVMConversion { auto funcType = funcOp.getFunctionType(); TypeConverter::SignatureConversion signatureConverter( funcType.getNumInputs()); - auto llvmType = typeConverter.convertFunctionSignature( + auto llvmType = getTypeConverter()->convertFunctionSignature( funcType, /*isVariadic=*/false, /*useBarePtrCallConv=*/false, signatureConverter); if (!llvmType) @@ -1418,8 +1419,8 @@ class FuncConversionPattern : public SPIRVToLLVMConversion { rewriter.inlineRegionBefore(funcOp.getBody(), newFuncOp.getBody(), newFuncOp.end()); - if (failed(rewriter.convertRegionTypes(&newFuncOp.getBody(), typeConverter, - &signatureConverter))) { + if (failed(rewriter.convertRegionTypes( + &newFuncOp.getBody(), *getTypeConverter(), &signatureConverter))) { return failure(); } rewriter.eraseOp(funcOp); @@ -1474,7 +1475,7 @@ class VectorShufflePattern return success(); } - auto dstType = typeConverter.convertType(op.getType()); + auto dstType = getTypeConverter()->convertType(op.getType()); if (!dstType) return rewriter.notifyMatchFailure(op, "type conversion failed"); auto scalarType = cast(dstType).getElementType(); @@ -1535,7 +1536,7 @@ void mlir::populateSPIRVToLLVMTypeConversion(LLVMTypeConverter &typeConverter, } void mlir::populateSPIRVToLLVMConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns, + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns, spirv::ClientAPI clientAPI) { patterns.add< // Arithmetic ops @@ -1653,12 +1654,12 @@ void mlir::populateSPIRVToLLVMConversionPatterns( } void mlir::populateSPIRVToLLVMFunctionConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns) { + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add(patterns.getContext(), typeConverter); } void mlir::populateSPIRVToLLVMModuleConversionPatterns( - LLVMTypeConverter &typeConverter, RewritePatternSet &patterns) { + const LLVMTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add(patterns.getContext(), typeConverter); } diff --git a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp index 468fffdd2df91b..ef3f4bc22fb898 100644 --- a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp +++ b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp @@ -35,7 +35,7 @@ namespace { class TensorExtractPattern final : public OpConversionPattern { public: - TensorExtractPattern(TypeConverter &typeConverter, MLIRContext *context, + TensorExtractPattern(const TypeConverter &typeConverter, MLIRContext *context, int64_t threshold, PatternBenefit benefit = 1) : OpConversionPattern(typeConverter, context, benefit), byteCountThreshold(threshold) {} @@ -103,9 +103,9 @@ class TensorExtractPattern final // Pattern population //===----------------------------------------------------------------------===// -void mlir::populateTensorToSPIRVPatterns(SPIRVTypeConverter &typeConverter, - int64_t byteCountThreshold, - RewritePatternSet &patterns) { +void mlir::populateTensorToSPIRVPatterns( + const SPIRVTypeConverter &typeConverter, int64_t byteCountThreshold, + RewritePatternSet &patterns) { patterns.add(typeConverter, patterns.getContext(), byteCountThreshold); } diff --git a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp index 01fdd57260797b..c88f4db27c304e 100644 --- a/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp +++ b/mlir/lib/Conversion/TosaToLinalg/TosaToLinalg.cpp @@ -2588,7 +2588,7 @@ struct FFT2dConverter final : OpRewritePattern { } // namespace void mlir::tosa::populateTosaToLinalgConversionPatterns( - TypeConverter &converter, RewritePatternSet *patterns) { + const TypeConverter &converter, RewritePatternSet *patterns) { // We have multiple resize coverters to handle degenerate cases. patterns->add(patterns->getContext(), diff --git a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp index 3f104ed1e3f7fb..6f085cb6ed06d2 100644 --- a/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp +++ b/mlir/lib/Conversion/TosaToTensor/TosaToTensor.cpp @@ -438,7 +438,7 @@ struct ConcatConverter : public OpConversionPattern { } // namespace void mlir::tosa::populateTosaToTensorConversionPatterns( - TypeConverter &converter, RewritePatternSet *patterns) { + const TypeConverter &converter, RewritePatternSet *patterns) { patterns ->add( converter, patterns->getContext()); diff --git a/mlir/lib/Conversion/UBToLLVM/UBToLLVM.cpp b/mlir/lib/Conversion/UBToLLVM/UBToLLVM.cpp index 0051333a35dcdc..9921a06778dd7d 100644 --- a/mlir/lib/Conversion/UBToLLVM/UBToLLVM.cpp +++ b/mlir/lib/Conversion/UBToLLVM/UBToLLVM.cpp @@ -91,8 +91,8 @@ struct UBToLLVMConversionPass // Pattern Population //===----------------------------------------------------------------------===// -void mlir::ub::populateUBToLLVMConversionPatterns(LLVMTypeConverter &converter, - RewritePatternSet &patterns) { +void mlir::ub::populateUBToLLVMConversionPatterns( + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); } diff --git a/mlir/lib/Conversion/UBToSPIRV/UBToSPIRV.cpp b/mlir/lib/Conversion/UBToSPIRV/UBToSPIRV.cpp index 001b7fefb175df..a3806189e40608 100644 --- a/mlir/lib/Conversion/UBToSPIRV/UBToSPIRV.cpp +++ b/mlir/lib/Conversion/UBToSPIRV/UBToSPIRV.cpp @@ -79,6 +79,6 @@ struct UBToSPIRVConversionPass final //===----------------------------------------------------------------------===// void mlir::ub::populateUBToSPIRVConversionPatterns( - SPIRVTypeConverter &converter, RewritePatternSet &patterns) { + const SPIRVTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter, patterns.getContext()); } diff --git a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp index 687061e9988f8f..a150e2be11736a 100644 --- a/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp +++ b/mlir/lib/Conversion/VectorToLLVM/ConvertVectorToLLVM.cpp @@ -1881,7 +1881,7 @@ struct VectorStepOpLowering : public ConvertOpToLLVMPattern { /// Populate the given list with patterns that convert from Vector to LLVM. void mlir::populateVectorToLLVMConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns, + const LLVMTypeConverter &converter, RewritePatternSet &patterns, bool reassociateFPReductions, bool force32BitVectorIndices) { MLIRContext *ctx = converter.getDialect()->getContext(); patterns.add(ctx); @@ -1909,7 +1909,7 @@ void mlir::populateVectorToLLVMConversionPatterns( } void mlir::populateVectorToLLVMMatrixConversionPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); patterns.add(converter); } diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp index 21b8858989839b..6184225cb6285d 100644 --- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp +++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp @@ -950,8 +950,8 @@ struct VectorStepOpConvert final : OpConversionPattern { #define CL_FLOAT_MAX_MIN_OPS spirv::CLFMaxOp, spirv::CLFMinOp #define GL_FLOAT_MAX_MIN_OPS spirv::GLFMaxOp, spirv::GLFMinOp -void mlir::populateVectorToSPIRVPatterns(SPIRVTypeConverter &typeConverter, - RewritePatternSet &patterns) { +void mlir::populateVectorToSPIRVPatterns( + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add< VectorBitcastConvert, VectorBroadcastConvert, VectorExtractElementOpConvert, VectorExtractOpConvert, diff --git a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp index a8b10f63315d41..c8cfcc3d945bec 100644 --- a/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp +++ b/mlir/lib/Dialect/AMX/Transforms/LegalizeForLLVMExport.cpp @@ -203,7 +203,7 @@ struct TileMulIConversion : public ConvertOpToLLVMPattern { } // namespace void mlir::populateAMXLegalizeForLLVMExportPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns.add(converter); } diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp index 1c1f65e580eb0c..4be0e06fe2a5e5 100644 --- a/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp @@ -51,7 +51,8 @@ arith::NarrowTypeEmulationConverter::NarrowTypeEmulationConverter( } void arith::populateArithNarrowTypeEmulationPatterns( - NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns) { + const NarrowTypeEmulationConverter &typeConverter, + RewritePatternSet &patterns) { // Populate `func.*` conversion patterns. populateFunctionOpInterfaceTypeConversionPattern(patterns, typeConverter); diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp index b51444e884aaee..836ebb65e7d17b 100644 --- a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp @@ -41,7 +41,7 @@ struct EmulateUnsupportedFloatsPass }; struct EmulateFloatPattern final : ConversionPattern { - EmulateFloatPattern(TypeConverter &converter, MLIRContext *ctx) + EmulateFloatPattern(const TypeConverter &converter, MLIRContext *ctx) : ConversionPattern(converter, Pattern::MatchAnyOpTypeTag(), 1, ctx) {} LogicalResult match(Operation *op) const override; @@ -106,12 +106,12 @@ void mlir::arith::populateEmulateUnsupportedFloatsConversions( } void mlir::arith::populateEmulateUnsupportedFloatsPatterns( - RewritePatternSet &patterns, TypeConverter &converter) { + RewritePatternSet &patterns, const TypeConverter &converter) { patterns.add(converter, patterns.getContext()); } void mlir::arith::populateEmulateUnsupportedFloatsLegality( - ConversionTarget &target, TypeConverter &converter) { + ConversionTarget &target, const TypeConverter &converter) { // Don't try to legalize functions and other ops that don't need expansion. target.markUnknownOpDynamicallyLegal([](Operation *op) { return true; }); target.addDynamicallyLegalDialect( diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp index 9c91dd71b3e15d..c48ded094eacff 100644 --- a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp @@ -1122,7 +1122,8 @@ arith::WideIntEmulationConverter::WideIntEmulationConverter( } void arith::populateArithWideIntEmulationPatterns( - WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns) { + const WideIntEmulationConverter &typeConverter, + RewritePatternSet &patterns) { // Populate `func.*` conversion patterns. populateFunctionOpInterfaceTypeConversionPattern(patterns, typeConverter); diff --git a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp index 10f39a0855f5f5..845a32c4d97b5e 100644 --- a/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp +++ b/mlir/lib/Dialect/ArmSVE/Transforms/LegalizeForLLVMExport.cpp @@ -200,7 +200,7 @@ struct CreateMaskOpLowering /// Populate the given list with patterns that convert from ArmSVE to LLVM. void mlir::populateArmSVELegalizeForLLVMExportPatterns( - LLVMTypeConverter &converter, RewritePatternSet &patterns) { + const LLVMTypeConverter &converter, RewritePatternSet &patterns) { // Populate conversion patterns // clang-format off diff --git a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp index e422086c9fde6d..875d8c40e92cc1 100644 --- a/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp +++ b/mlir/lib/Dialect/Bufferization/Transforms/Bufferize.cpp @@ -130,7 +130,7 @@ class BufferizeToMemrefOp } // namespace void mlir::bufferization::populateEliminateBufferizeMaterializationsPatterns( - BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns) { + const BufferizeTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add(typeConverter, patterns.getContext()); } diff --git a/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp b/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp index fa030cb18e035d..357f993710a26a 100644 --- a/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp +++ b/mlir/lib/Dialect/Func/Transforms/DecomposeCallGraphTypes.cpp @@ -37,7 +37,7 @@ template class DecomposeCallGraphTypesOpConversionPattern : public OpConversionPattern { public: - DecomposeCallGraphTypesOpConversionPattern(TypeConverter &typeConverter, + DecomposeCallGraphTypesOpConversionPattern(const TypeConverter &typeConverter, MLIRContext *context, ValueDecomposer &decomposer, PatternBenefit benefit = 1) @@ -188,7 +188,7 @@ struct DecomposeCallGraphTypesForCallOp } // namespace void mlir::populateDecomposeCallGraphTypesPatterns( - MLIRContext *context, TypeConverter &typeConverter, + MLIRContext *context, const TypeConverter &typeConverter, ValueDecomposer &decomposer, RewritePatternSet &patterns) { patterns .add { } // namespace void mlir::populateCallOpTypeConversionPattern(RewritePatternSet &patterns, - TypeConverter &converter) { + const TypeConverter &converter) { patterns.add(converter, patterns.getContext()); } @@ -59,7 +59,7 @@ class BranchOpInterfaceTypeConversion BranchOpInterface>::OpInterfaceConversionPattern; BranchOpInterfaceTypeConversion( - TypeConverter &typeConverter, MLIRContext *ctx, + const TypeConverter &typeConverter, MLIRContext *ctx, function_ref shouldConvertBranchOperand) : OpInterfaceConversionPattern(typeConverter, ctx, /*benefit=*/1), shouldConvertBranchOperand(shouldConvertBranchOperand) {} @@ -115,14 +115,14 @@ class ReturnOpTypeConversion : public OpConversionPattern { } // namespace void mlir::populateBranchOpInterfaceTypeConversionPattern( - RewritePatternSet &patterns, TypeConverter &typeConverter, + RewritePatternSet &patterns, const TypeConverter &typeConverter, function_ref shouldConvertBranchOperand) { patterns.add( typeConverter, patterns.getContext(), shouldConvertBranchOperand); } bool mlir::isLegalForBranchOpInterfaceTypeConversionPattern( - Operation *op, TypeConverter &converter) { + Operation *op, const TypeConverter &converter) { // All successor operands of branch like operations must be rewritten. if (auto branchOp = dyn_cast(op)) { for (int p = 0, e = op->getBlock()->getNumSuccessors(); p < e; ++p) { @@ -137,14 +137,13 @@ bool mlir::isLegalForBranchOpInterfaceTypeConversionPattern( return false; } -void mlir::populateReturnOpTypeConversionPattern(RewritePatternSet &patterns, - TypeConverter &typeConverter) { +void mlir::populateReturnOpTypeConversionPattern( + RewritePatternSet &patterns, const TypeConverter &typeConverter) { patterns.add(typeConverter, patterns.getContext()); } -bool mlir::isLegalForReturnOpTypeConversionPattern(Operation *op, - TypeConverter &converter, - bool returnOpAlwaysLegal) { +bool mlir::isLegalForReturnOpTypeConversionPattern( + Operation *op, const TypeConverter &converter, bool returnOpAlwaysLegal) { // If this is a `return` and the user pass wants to convert/transform across // function boundaries, then `converter` is invoked to check whether the // `return` op is legal. diff --git a/mlir/lib/Dialect/Func/Transforms/OneToNFuncConversions.cpp b/mlir/lib/Dialect/Func/Transforms/OneToNFuncConversions.cpp index 8489396da7a2c4..3b8982257a9c95 100644 --- a/mlir/lib/Dialect/Func/Transforms/OneToNFuncConversions.cpp +++ b/mlir/lib/Dialect/Func/Transforms/OneToNFuncConversions.cpp @@ -72,7 +72,7 @@ class ConvertTypesInFuncReturnOp : public OneToNOpConversionPattern { namespace mlir { -void populateFuncTypeConversionPatterns(TypeConverter &typeConverter, +void populateFuncTypeConversionPatterns(const TypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add< // clang-format off diff --git a/mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp b/mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp index 1a9eafec9fdd57..a570ed5118ef0b 100644 --- a/mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp +++ b/mlir/lib/Dialect/Math/Transforms/ExtendToSupportedTypes.cpp @@ -32,7 +32,7 @@ using namespace mlir; namespace { struct ExtendToSupportedTypesRewritePattern final : ConversionPattern { - ExtendToSupportedTypesRewritePattern(TypeConverter &converter, + ExtendToSupportedTypesRewritePattern(const TypeConverter &converter, MLIRContext *context) : ConversionPattern(converter, MatchAnyOpTypeTag{}, 1, context) {} LogicalResult @@ -114,7 +114,7 @@ LogicalResult ExtendToSupportedTypesRewritePattern::matchAndRewrite( } void mlir::math::populateExtendToSupportedTypesPatterns( - RewritePatternSet &patterns, TypeConverter &typeConverter) { + RewritePatternSet &patterns, const TypeConverter &typeConverter) { patterns.add(typeConverter, patterns.getContext()); } diff --git a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp index a45b79194a7580..9efea066a03c85 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp @@ -583,7 +583,7 @@ struct ConvertMemRefExpandShape final //===----------------------------------------------------------------------===// void memref::populateMemRefNarrowTypeEmulationPatterns( - arith::NarrowTypeEmulationConverter &typeConverter, + const arith::NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns) { // Populate `memref.*` conversion patterns. diff --git a/mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp b/mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp index 57f0141c95dc56..bc4535f97acf04 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/EmulateWideInt.cpp @@ -138,7 +138,7 @@ struct EmulateWideIntPass final //===----------------------------------------------------------------------===// void memref::populateMemRefWideIntEmulationPatterns( - arith::WideIntEmulationConverter &typeConverter, + const arith::WideIntEmulationConverter &typeConverter, RewritePatternSet &patterns) { // Populate `memref.*` conversion patterns. patterns.add( diff --git a/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp b/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp index 5aa35e79babfce..4cd17f77dfb941 100644 --- a/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/OneToNTypeConversion.cpp @@ -198,8 +198,8 @@ class ConvertTypesInSCFForOp final : public OneToNOpConversionPattern { namespace mlir { namespace scf { -void populateSCFStructuralOneToNTypeConversions(TypeConverter &typeConverter, - RewritePatternSet &patterns) { +void populateSCFStructuralOneToNTypeConversions( + const TypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add< // clang-format off ConvertTypesInSCFConditionOp, diff --git a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp index e2cc5b4c5ff49b..93a78056db1944 100644 --- a/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/StructuralTypeConversions.cpp @@ -248,7 +248,7 @@ class ConvertConditionOpTypes : public OpConversionPattern { } // namespace void mlir::scf::populateSCFStructuralTypeConversions( - TypeConverter &typeConverter, RewritePatternSet &patterns) { + const TypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add( typeConverter, patterns.getContext()); @@ -271,7 +271,7 @@ void mlir::scf::populateSCFStructuralTypeConversionTarget( } void mlir::scf::populateSCFStructuralTypeConversionsAndLegality( - TypeConverter &typeConverter, RewritePatternSet &patterns, + const TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target) { populateSCFStructuralTypeConversions(typeConverter, patterns); populateSCFStructuralTypeConversionTarget(typeConverter, target); diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp index d833ec9309baaf..656090314d650e 100644 --- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp +++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp @@ -1573,8 +1573,8 @@ bool SPIRVConversionTarget::isLegalOp(Operation *op) { // Public functions for populating patterns //===----------------------------------------------------------------------===// -void mlir::populateBuiltinFuncToSPIRVPatterns(SPIRVTypeConverter &typeConverter, - RewritePatternSet &patterns) { +void mlir::populateBuiltinFuncToSPIRVPatterns( + const SPIRVTypeConverter &typeConverter, RewritePatternSet &patterns) { patterns.add(typeConverter, patterns.getContext()); } diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp index 71a229bea990c0..04466d198b5b67 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseIterationToScf.cpp @@ -434,7 +434,7 @@ mlir::SparseIterationTypeConverter::SparseIterationTypeConverter() { } void mlir::populateLowerSparseIterationToSCFPatterns( - TypeConverter &converter, RewritePatternSet &patterns) { + const TypeConverter &converter, RewritePatternSet &patterns) { IterateOp::getCanonicalizationPatterns(patterns, patterns.getContext()); patterns.add(converter, patterns.getContext()); diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp index 164e722c45dba8..062a0ea6cc47cb 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorCodegen.cpp @@ -746,8 +746,8 @@ class SparseTensorAllocConverter : public OpConversionPattern { public: using OpConversionPattern::OpConversionPattern; - SparseTensorAllocConverter(TypeConverter &typeConverter, MLIRContext *context, - bool enableInit) + SparseTensorAllocConverter(const TypeConverter &typeConverter, + MLIRContext *context, bool enableInit) : OpConversionPattern(typeConverter, context), enableBufferInitialization(enableInit) {} @@ -808,8 +808,8 @@ class SparseTensorAllocConverter class SparseTensorEmptyConverter : public OpConversionPattern { public: using OpConversionPattern::OpConversionPattern; - SparseTensorEmptyConverter(TypeConverter &typeConverter, MLIRContext *context, - bool enableInit) + SparseTensorEmptyConverter(const TypeConverter &typeConverter, + MLIRContext *context, bool enableInit) : OpConversionPattern(typeConverter, context), enableBufferInitialization(enableInit) {} @@ -850,7 +850,7 @@ class SparseTensorDeallocConverter : public OpConversionPattern { public: using OpConversionPattern::OpConversionPattern; - SparseTensorDeallocConverter(TypeConverter &typeConverter, + SparseTensorDeallocConverter(const TypeConverter &typeConverter, MLIRContext *context, bool createDeallocs) : OpConversionPattern(typeConverter, context), createDeallocs(createDeallocs) {} @@ -1411,7 +1411,7 @@ struct SparseAssembleOpConverter : public OpConversionPattern { struct SparseDisassembleOpConverter : public OpConversionPattern { using OpConversionPattern::OpConversionPattern; - SparseDisassembleOpConverter(TypeConverter &typeConverter, + SparseDisassembleOpConverter(const TypeConverter &typeConverter, MLIRContext *context) : OpConversionPattern(typeConverter, context) {} @@ -1604,7 +1604,7 @@ struct SparseHasRuntimeLibraryConverter /// Populates the given patterns list with conversion rules required for /// the sparsification of linear algebra operations. void mlir::populateSparseTensorCodegenPatterns( - TypeConverter &typeConverter, RewritePatternSet &patterns, + const TypeConverter &typeConverter, RewritePatternSet &patterns, bool createSparseDeallocs, bool enableBufferInitialization) { patterns.add< SparseAssembleOpConverter, SparseDisassembleOpConverter, diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp index f0d162bdb84d96..9ffa64dc821d8f 100644 --- a/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp +++ b/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorConversion.cpp @@ -909,8 +909,8 @@ mlir::SparseTensorTypeToPtrConverter::SparseTensorTypeToPtrConverter() { /// Populates the given patterns list with conversion rules required for /// the sparsification of linear algebra operations. -void mlir::populateSparseTensorConversionPatterns(TypeConverter &typeConverter, - RewritePatternSet &patterns) { +void mlir::populateSparseTensorConversionPatterns( + const TypeConverter &typeConverter, RewritePatternSet &patterns) { patterns .add { //===----------------------------------------------------------------------===// void vector::populateVectorNarrowTypeEmulationPatterns( - arith::NarrowTypeEmulationConverter &typeConverter, + const arith::NarrowTypeEmulationConverter &typeConverter, RewritePatternSet &patterns) { // Populate `vector.*` conversion patterns. diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp index 11917ac1e40226..757631944f224f 100644 --- a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp +++ b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp @@ -500,7 +500,7 @@ void mlir::vector::populateVectorLinearizeTypeConversionsAndLegality( } void mlir::vector::populateVectorLinearizeShuffleLikeOpsPatterns( - TypeConverter &typeConverter, RewritePatternSet &patterns, + const TypeConverter &typeConverter, RewritePatternSet &patterns, ConversionTarget &target, unsigned int targetBitWidth) { target.addDynamicallyLegalOp( [=](vector::ShuffleOp shuffleOp) -> bool { diff --git a/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp b/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp index c33304c18fe48a..e918473cae9e3a 100644 --- a/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp +++ b/mlir/lib/Dialect/X86Vector/Transforms/LegalizeForLLVMExport.cpp @@ -37,7 +37,7 @@ namespace { /// results of multi-result intrinsic ops. template struct LowerToIntrinsic : public OpConversionPattern { - explicit LowerToIntrinsic(LLVMTypeConverter &converter) + explicit LowerToIntrinsic(const LLVMTypeConverter &converter) : OpConversionPattern(converter, &converter.getContext()) {} const LLVMTypeConverter &getTypeConverter() const { @@ -135,7 +135,7 @@ template struct RegistryImpl { /// Registers the patterns specializing the "main" op to one of the /// "intrinsic" ops depending on elemental type. - static void registerPatterns(LLVMTypeConverter &converter, + static void registerPatterns(const LLVMTypeConverter &converter, RewritePatternSet &patterns) { patterns .add( converter); diff --git a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp index f6e8e9e7ad339e..19e29d48623e04 100644 --- a/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp +++ b/mlir/lib/Transforms/Utils/OneToNTypeConversion.cpp @@ -418,7 +418,7 @@ class FunctionOpInterfaceSignatureConversion : public OneToNConversionPattern { public: FunctionOpInterfaceSignatureConversion(StringRef functionLikeOpName, MLIRContext *ctx, - TypeConverter &converter) + const TypeConverter &converter) : OneToNConversionPattern(converter, functionLikeOpName, /*benefit=*/1, ctx) {} @@ -466,7 +466,7 @@ class FunctionOpInterfaceSignatureConversion : public OneToNConversionPattern { } // namespace void populateOneToNFunctionOpInterfaceTypeConversionPattern( - StringRef functionLikeOpName, TypeConverter &converter, + StringRef functionLikeOpName, const TypeConverter &converter, RewritePatternSet &patterns) { patterns.add( functionLikeOpName, patterns.getContext(), converter); diff --git a/mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp b/mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp index cc1af59c5e15bb..1ea65109bf79db 100644 --- a/mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp +++ b/mlir/test/lib/Conversion/OneToNTypeConversion/TestOneToNTypeConversionPass.cpp @@ -129,8 +129,9 @@ class ConvertGetTupleElementOp } // namespace -static void populateDecomposeTuplesTestPatterns(TypeConverter &typeConverter, - RewritePatternSet &patterns) { +static void +populateDecomposeTuplesTestPatterns(const TypeConverter &typeConverter, + RewritePatternSet &patterns) { patterns.add< // clang-format off ConvertMakeTupleOp, From e36a39346796528f75ff01ef1084b2dfe0a2a747 Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 5 Oct 2024 21:46:31 +0200 Subject: [PATCH 4/8] [mlir][SPIRV] Fix build error (#111264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix build error that was introduced by #111250. Also, the deleted function is not needed at all. ``` ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h: In member function ‘const mlir::LLVMTypeConverter* mlir::SPIRVToLLVMConversion::getTypeConverter() const’: ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h:35:12: error: invalid ‘static_cast’ from type ‘const mlir::TypeConverter*’ to type ‘const mlir::LLVMTypeConverter*’ 35 | return static_cast( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 36 | ConversionPattern::getTypeConverter()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../llvm-project/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h:21:7: note: class type ‘const mlir::LLVMTypeConverter’ is incomplete ``` --- mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h index e59373c955fc3b..e78b954d5e0d52 100644 --- a/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h +++ b/mlir/include/mlir/Conversion/SPIRVToLLVM/SPIRVToLLVM.h @@ -29,12 +29,6 @@ class SPIRVToLLVMConversion : public OpConversionPattern { const LLVMTypeConverter &typeConverter, PatternBenefit benefit = 1) : OpConversionPattern(typeConverter, context, benefit) {} - -protected: - const LLVMTypeConverter *getTypeConverter() const { - return static_cast( - ConversionPattern::getTypeConverter()); - } }; /// Encodes global variable's descriptor set and binding into its name if they From 98723e656618345f05a8e66b18e0f5d37866e75e Mon Sep 17 00:00:00 2001 From: Matthias Springer Date: Sat, 5 Oct 2024 22:01:57 +0200 Subject: [PATCH 5/8] [mlir][SPIRV] Fix build (2) (#111265) --- .../Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp index e36e3951a31ecc..74c169c9a7e76a 100644 --- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp +++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp @@ -149,7 +149,7 @@ static Value optionallyTruncateOrExtend(Location loc, Value value, /// Broadcasts the value to vector with `numElements` number of elements. static Value broadcast(Location loc, Value toBroadcast, unsigned numElements, - const LLVMTypeConverter &typeConverter, + const TypeConverter &typeConverter, ConversionPatternRewriter &rewriter) { auto vectorType = VectorType::get(numElements, toBroadcast.getType()); auto llvmVectorType = typeConverter.convertType(vectorType); @@ -166,7 +166,7 @@ static Value broadcast(Location loc, Value toBroadcast, unsigned numElements, /// Broadcasts the value. If `srcType` is a scalar, the value remains unchanged. static Value optionallyBroadcast(Location loc, Value value, Type srcType, - const LLVMTypeConverter &typeConverter, + const TypeConverter &typeConverter, ConversionPatternRewriter &rewriter) { if (auto vectorType = dyn_cast(srcType)) { unsigned numElements = vectorType.getNumElements(); @@ -186,8 +186,7 @@ static Value optionallyBroadcast(Location loc, Value value, Type srcType, /// Then cast `Offset` and `Count` if their bit width is different /// from `Base` bit width. static Value processCountOrOffset(Location loc, Value value, Type srcType, - Type dstType, - const LLVMTypeConverter &converter, + Type dstType, const TypeConverter &converter, ConversionPatternRewriter &rewriter) { Value broadcasted = optionallyBroadcast(loc, value, srcType, converter, rewriter); @@ -197,7 +196,7 @@ static Value processCountOrOffset(Location loc, Value value, Type srcType, /// Converts SPIR-V struct with a regular (according to `VulkanLayoutUtils`) /// offset to LLVM struct. Otherwise, the conversion is not supported. static Type convertStructTypeWithOffset(spirv::StructType type, - const LLVMTypeConverter &converter) { + const TypeConverter &converter) { if (type != VulkanLayoutUtils::decorateType(type)) return nullptr; @@ -210,7 +209,7 @@ static Type convertStructTypeWithOffset(spirv::StructType type, /// Converts SPIR-V struct with no offset to packed LLVM struct. static Type convertStructTypePacked(spirv::StructType type, - const LLVMTypeConverter &converter) { + const TypeConverter &converter) { SmallVector elementsVector; if (failed(converter.convertTypes(type.getElementTypes(), elementsVector))) return nullptr; @@ -227,10 +226,11 @@ static Value createI32ConstantOf(Location loc, PatternRewriter &rewriter, } /// Utility for `spirv.Load` and `spirv.Store` conversion. -static LogicalResult replaceWithLoadOrStore( - Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter, - const LLVMTypeConverter &typeConverter, unsigned alignment, bool isVolatile, - bool isNonTemporal) { +static LogicalResult replaceWithLoadOrStore(Operation *op, ValueRange operands, + ConversionPatternRewriter &rewriter, + const TypeConverter &typeConverter, + unsigned alignment, bool isVolatile, + bool isNonTemporal) { if (auto loadOp = dyn_cast(op)) { auto dstType = typeConverter.convertType(loadOp.getType()); if (!dstType) @@ -271,7 +271,7 @@ static std::optional convertArrayType(spirv::ArrayType type, /// Converts SPIR-V pointer type to LLVM pointer. Pointer's storage class is not /// modelled at the moment. static Type convertPointerType(spirv::PointerType type, - const LLVMTypeConverter &converter, + const TypeConverter &converter, spirv::ClientAPI clientAPI) { unsigned addressSpace = storageClassToAddressSpace(clientAPI, type.getStorageClass()); @@ -292,7 +292,7 @@ static std::optional convertRuntimeArrayType(spirv::RuntimeArrayType type, /// Converts SPIR-V struct to LLVM struct. There is no support of structs with /// member decorations. Also, only natural offset is supported. static Type convertStructType(spirv::StructType type, - const LLVMTypeConverter &converter) { + const TypeConverter &converter) { SmallVector memberDecorations; type.getMemberDecorations(memberDecorations); if (!memberDecorations.empty()) @@ -1378,9 +1378,10 @@ class FuncConversionPattern : public SPIRVToLLVMConversion { auto funcType = funcOp.getFunctionType(); TypeConverter::SignatureConversion signatureConverter( funcType.getNumInputs()); - auto llvmType = getTypeConverter()->convertFunctionSignature( - funcType, /*isVariadic=*/false, /*useBarePtrCallConv=*/false, - signatureConverter); + auto llvmType = static_cast(getTypeConverter()) + ->convertFunctionSignature( + funcType, /*isVariadic=*/false, + /*useBarePtrCallConv=*/false, signatureConverter); if (!llvmType) return failure(); From d3a367dea515f147ac1380afdc286932ccf82eb0 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 5 Oct 2024 13:23:35 -0700 Subject: [PATCH 6/8] [RISCV] Give ZEXT_H_RV32 and ZEXT_H_RV64 R-type format to match PACK. NFC These are different than other Zb* unary instructions because they are specializations of PACKW or PACKH. So they should use RVInstR instead of RVInstI. This doesn't cause any functional difference since we only use the format for relocations and we never have relocations on these instructions. --- llvm/lib/Target/RISCV/RISCVInstrInfoZb.td | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td index 3eb1fc68694032..d9ce00c7704de8 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td @@ -224,6 +224,14 @@ def sh3add_uw_op : ComplexPattern", [], [], 6>; // Instruction class templates //===----------------------------------------------------------------------===// +let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +class RVBUnaryR funct7, bits<3> funct3, + RISCVOpcode opcode, string opcodestr> + : RVInstR { + let rs2 = 0; +} + let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in class RVBUnary imm12, bits<3> funct3, RISCVOpcode opcode, string opcodestr> @@ -392,12 +400,12 @@ def PACKW : ALUW_rr<0b0000100, 0b100, "packw">, Sched<[WritePACK32, ReadPACK32, ReadPACK32]>; let Predicates = [HasStdExtZbb, IsRV32] in { -def ZEXT_H_RV32 : RVBUnary<0b000010000000, 0b100, OPC_OP, "zext.h">, +def ZEXT_H_RV32 : RVBUnaryR<0b0000100, 0b100, OPC_OP, "zext.h">, Sched<[WriteIALU, ReadIALU]>; } // Predicates = [HasStdExtZbb, IsRV32] let Predicates = [HasStdExtZbb, IsRV64], IsSignExtendingOpW = 1 in { -def ZEXT_H_RV64 : RVBUnary<0b000010000000, 0b100, OPC_OP_32, "zext.h">, +def ZEXT_H_RV64 : RVBUnaryR<0b0000100, 0b100, OPC_OP_32, "zext.h">, Sched<[WriteIALU, ReadIALU]>; } // Predicates = [HasStdExtZbb, IsRV64] From 47e6d1816251e90b3d589710c5203a92c6015a7c Mon Sep 17 00:00:00 2001 From: davidtrevelyan Date: Sat, 5 Oct 2024 21:46:32 +0100 Subject: [PATCH 7/8] [NFC][rtsan] Update docs to include [[clang::blocking]] (#111249) Updates the RealtimeSanitizer documentation to: - include information about how to use `[[clang::blocking]]`, and - update the displayed error messages to the latest style --- clang/docs/RealtimeSanitizer.rst | 80 ++++++++++++++++++++++++-------- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/clang/docs/RealtimeSanitizer.rst b/clang/docs/RealtimeSanitizer.rst index 3f96267603aefa..103842e055db70 100644 --- a/clang/docs/RealtimeSanitizer.rst +++ b/clang/docs/RealtimeSanitizer.rst @@ -9,7 +9,7 @@ Introduction ============ RealtimeSanitizer (a.k.a. RTSan) is a real-time safety testing tool for C and C++ projects. RTSan can be used to detect real-time violations, i.e. calls to methods -that are not safe for use in functions with deterministic runtime requirements. +that are not safe for use in functions with deterministic run time requirements. RTSan considers any function marked with the ``[[clang::nonblocking]]`` attribute to be a real-time function. If RTSan detects a call to ``malloc``, ``free``, ``pthread_mutex_lock``, or anything else that could have a non-deterministic @@ -58,7 +58,7 @@ code. return 0; } # Compile and link - % clang++ -fsanitize=realtime -g example_realtime_violation.cpp + % clang++ -fsanitize=realtime example_realtime_violation.cpp If a real-time safety violation is detected in a ``[[clang::nonblocking]]`` context, or any function invoked by that function, the program will exit with a @@ -66,23 +66,63 @@ non-zero exit code. .. code-block:: console - % clang++ -fsanitize=realtime -g example_realtime_violation.cpp + % clang++ -fsanitize=realtime example_realtime_violation.cpp % ./a.out - Real-time violation: intercepted call to real-time unsafe function `malloc` in real-time context! Stack trace: - #0 0x000102893034 in __rtsan::PrintStackTrace() rtsan_stack.cpp:45 - #1 0x000102892e64 in __rtsan::Context::ExpectNotRealtime(char const*) rtsan_context.cpp:78 - #2 0x00010289397c in malloc rtsan_interceptors.cpp:286 - #3 0x000195bd7bd0 in operator new(unsigned long)+0x1c (libc++abi.dylib:arm64+0x16bd0) - #4 0x5c7f00010230f07c () - #5 0x00010230f058 in std::__1::__libcpp_allocate[abi:ue170006](unsigned long, unsigned long) new:324 - #6 0x00010230effc in std::__1::allocator::allocate[abi:ue170006](unsigned long) allocator.h:114 - ... snip ... - #10 0x00010230e4bc in std::__1::vector>::__append(unsigned long) vector:1162 - #11 0x00010230dcdc in std::__1::vector>::resize(unsigned long) vector:1981 - #12 0x00010230dc28 in violation() main.cpp:5 - #13 0x00010230dd64 in main main.cpp:9 - #14 0x0001958960dc () - #15 0x2f557ffffffffffc () + ==76290==ERROR: RealtimeSanitizer: unsafe-library-call + Intercepted call to real-time unsafe function `malloc` in real-time context! + #0 0x000102a7b884 in malloc rtsan_interceptors.cpp:426 + #1 0x00019c326bd0 in operator new(unsigned long)+0x1c (libc++abi.dylib:arm64+0x16bd0) + #2 0xa30d0001024f79a8 () + #3 0x0001024f794c in std::__1::__libcpp_allocate[abi:ne200000](unsigned long, unsigned long)+0x44 + #4 0x0001024f78c4 in std::__1::allocator::allocate[abi:ne200000](unsigned long)+0x44 + ... snip ... + #9 0x0001024f6868 in std::__1::vector>::resize(unsigned long)+0x48 + #10 0x0001024f67b4 in violation()+0x24 + #11 0x0001024f68f0 in main+0x18 (a.out:arm64+0x1000028f0) + #12 0x00019bfe3150 () + #13 0xed5efffffffffffc () + + +Blocking functions +------------------ + +Calls to system library functions such as ``malloc`` are automatically caught by +RealtimeSanitizer. Real-time programmers may also write their own blocking +(real-time unsafe) functions that they wish RealtimeSanitizer to be aware of. +RealtimeSanitizer will raise an error at run time if any function attributed +with ``[[clang::blocking]]`` is called in a ``[[clang::nonblocking]]`` context. + +.. code-block:: console + + $ cat example_blocking_violation.cpp + #include + #include + + std::atomic has_permission{false}; + + int wait_for_permission() [[clang::blocking]] { + while (has_permission.load() == false) + std::this_thread::yield(); + return 0; + } + + int real_time_function() [[clang::nonblocking]] { + return wait_for_permission(); + } + + int main() { + return real_time_function(); + } + + $ clang++ -fsanitize=realtime example_blocking_violation.cpp && ./a.out + ==76131==ERROR: RealtimeSanitizer: blocking-call + Call to blocking function `wait_for_permission()` in real-time context! + #0 0x0001000c3db0 in wait_for_permission()+0x10 (a.out:arm64+0x100003db0) + #1 0x0001000c3e3c in real_time_function()+0x10 (a.out:arm64+0x100003e3c) + #2 0x0001000c3e68 in main+0x10 (a.out:arm64+0x100003e68) + #3 0x00019bfe3150 () + #4 0x5a27fffffffffffc () + Run-time flags -------------- @@ -159,7 +199,7 @@ Disabling In some circumstances, you may want to suppress error reporting in a specific scope. -In C++, this is achieved via ``__rtsan::ScopedDisabler``. Within the scope where the ``ScopedDisabler`` object is instantiated, all sanitizer error reports are suppressed. This suppression applies to the current scope as well as all invoked functions, including any functions called transitively. +In C++, this is achieved via ``__rtsan::ScopedDisabler``. Within the scope where the ``ScopedDisabler`` object is instantiated, all sanitizer error reports are suppressed. This suppression applies to the current scope as well as all invoked functions, including any functions called transitively. .. code-block:: c++ @@ -174,7 +214,7 @@ In C++, this is achieved via ``__rtsan::ScopedDisabler``. Within the scope wher If RealtimeSanitizer is not enabled at compile time (i.e., the code is not compiled with the ``-fsanitize=realtime`` flag), the ``ScopedDisabler`` is compiled as a no-op. -In C, you can use the ``__rtsan_disable()`` and ``rtsan_enable()`` functions to manually disable and re-enable RealtimeSanitizer checks. +In C, you can use the ``__rtsan_disable()`` and ``rtsan_enable()`` functions to manually disable and re-enable RealtimeSanitizer checks. .. code-block:: c++ From 46944b0cbc9a9d8daad0182c40fcd3560bc9ca35 Mon Sep 17 00:00:00 2001 From: Job Henandez Lara Date: Sat, 5 Oct 2024 16:31:36 -0700 Subject: [PATCH 8/8] [libc] remove errno.h includes (#110934) --- .../linux/error-number-macros.h | 8 +++++ .../StringUtil/tables/CMakeLists.txt | 6 ++-- .../tables/linux_extension_errors.h | 3 +- .../StringUtil/tables/posix_errors.h | 3 +- .../__support/StringUtil/tables/stdc_errors.h | 2 -- libc/src/math/generic/CMakeLists.txt | 10 ------ libc/src/math/generic/acosf.cpp | 2 -- libc/src/math/generic/asinf.cpp | 2 -- libc/src/math/generic/cosf.cpp | 2 -- libc/src/math/generic/exp.cpp | 2 -- libc/src/math/generic/exp10.cpp | 2 -- libc/src/math/generic/exp10f_impl.h | 2 -- libc/src/math/generic/exp2.cpp | 2 -- libc/src/math/generic/exp2f_impl.h | 2 -- libc/src/math/generic/expf.cpp | 2 -- libc/src/math/generic/explogxf.h | 2 -- libc/src/math/generic/expm1f.cpp | 2 -- libc/src/math/generic/powf.cpp | 2 -- libc/src/math/generic/sincosf.cpp | 2 -- libc/src/math/generic/sinf.cpp | 2 -- libc/src/math/generic/tanf.cpp | 2 -- libc/src/pthread/CMakeLists.txt | 35 ++++++++++++------- libc/src/pthread/pthread_atfork.cpp | 2 +- .../pthread/pthread_attr_setdetachstate.cpp | 2 +- .../src/pthread/pthread_attr_setguardsize.cpp | 2 +- libc/src/pthread/pthread_attr_setstack.cpp | 2 +- .../src/pthread/pthread_attr_setstacksize.cpp | 2 +- .../src/pthread/pthread_condattr_setclock.cpp | 2 +- .../pthread/pthread_condattr_setpshared.cpp | 2 +- libc/src/pthread/pthread_create.cpp | 2 +- libc/src/pthread/pthread_key_create.cpp | 2 +- libc/src/pthread/pthread_key_delete.cpp | 2 +- libc/src/pthread/pthread_mutex_init.cpp | 1 - .../src/pthread/pthread_mutexattr_destroy.cpp | 2 -- .../pthread/pthread_mutexattr_getpshared.cpp | 2 -- .../pthread/pthread_mutexattr_getrobust.cpp | 2 -- .../src/pthread/pthread_mutexattr_gettype.cpp | 2 -- .../pthread/pthread_mutexattr_setpshared.cpp | 2 +- .../pthread/pthread_mutexattr_setrobust.cpp | 2 +- .../src/pthread/pthread_mutexattr_settype.cpp | 2 +- libc/src/pthread/pthread_rwlock_destroy.cpp | 1 - libc/src/pthread/pthread_rwlock_init.cpp | 1 - libc/src/pthread/pthread_rwlock_rdlock.cpp | 1 - .../pthread/pthread_rwlock_timedrdlock.cpp | 3 +- .../pthread/pthread_rwlock_timedwrlock.cpp | 1 - libc/src/pthread/pthread_rwlock_tryrdlock.cpp | 1 - libc/src/pthread/pthread_rwlock_trywrlock.cpp | 2 +- libc/src/pthread/pthread_rwlock_unlock.cpp | 2 +- libc/src/pthread/pthread_rwlock_wrlock.cpp | 1 - .../pthread/pthread_rwlockattr_setkind_np.cpp | 2 +- .../pthread/pthread_rwlockattr_setpshared.cpp | 2 +- libc/src/pthread/pthread_setspecific.cpp | 2 +- libc/src/spawn/CMakeLists.txt | 8 ++--- .../posix_spawn_file_actions_addclose.cpp | 2 +- .../posix_spawn_file_actions_adddup2.cpp | 2 +- .../posix_spawn_file_actions_addopen.cpp | 2 +- .../posix_spawn_file_actions_destroy.cpp | 3 +- libc/src/threads/CMakeLists.txt | 1 + libc/src/threads/thrd_create.cpp | 2 +- libc/test/UnitTest/PrintfMatcher.h | 2 -- libc/test/UnitTest/ScanfMatcher.h | 2 -- .../integration/src/pthread/CMakeLists.txt | 5 ++- .../src/pthread/pthread_name_test.cpp | 2 +- .../src/spawn/posix_spawn_test_binary.cpp | 1 - .../integration/src/unistd/CMakeLists.txt | 8 ++--- .../test/integration/src/unistd/fork_test.cpp | 1 - .../src/unistd/stack_smashing_test.cpp | 1 - .../integration/startup/linux/CMakeLists.txt | 1 - .../integration/startup/linux/tls_test.cpp | 1 - libc/test/src/__support/File/CMakeLists.txt | 2 +- libc/test/src/math/RoundToIntegerTest.h | 1 - libc/test/src/math/acosf_test.cpp | 1 - libc/test/src/math/acoshf_test.cpp | 1 - libc/test/src/math/asinf_test.cpp | 1 - libc/test/src/math/asinhf_test.cpp | 1 - libc/test/src/math/atanf_test.cpp | 1 - libc/test/src/math/atanhf_test.cpp | 1 - libc/test/src/math/cosf_test.cpp | 1 - libc/test/src/math/coshf_test.cpp | 1 - libc/test/src/math/erff_test.cpp | 1 - libc/test/src/math/exp10_test.cpp | 1 - libc/test/src/math/exp2_test.cpp | 1 - libc/test/src/math/exp_test.cpp | 1 - libc/test/src/math/log10_test.cpp | 1 - libc/test/src/math/log10f_test.cpp | 1 - libc/test/src/math/log1p_test.cpp | 1 - libc/test/src/math/log1pf_test.cpp | 1 - libc/test/src/math/log2_test.cpp | 1 - libc/test/src/math/log_test.cpp | 1 - libc/test/src/math/powf_test.cpp | 1 - libc/test/src/math/sincosf_test.cpp | 1 - libc/test/src/math/sinf_test.cpp | 1 - libc/test/src/math/sinhf_test.cpp | 1 - libc/test/src/math/smoke/RoundToIntegerTest.h | 1 - libc/test/src/math/smoke/acosf_test.cpp | 1 - libc/test/src/math/smoke/acoshf_test.cpp | 1 - libc/test/src/math/smoke/asinf_test.cpp | 1 - libc/test/src/math/smoke/asinhf_test.cpp | 1 - libc/test/src/math/smoke/atanf_test.cpp | 1 - libc/test/src/math/smoke/atanhf_test.cpp | 1 - libc/test/src/math/smoke/cosf_test.cpp | 1 - libc/test/src/math/smoke/coshf_test.cpp | 1 - libc/test/src/math/smoke/erff_test.cpp | 1 - libc/test/src/math/smoke/exp10_test.cpp | 1 - libc/test/src/math/smoke/exp2_test.cpp | 1 - libc/test/src/math/smoke/exp_test.cpp | 1 - libc/test/src/math/smoke/expm1_test.cpp | 1 - libc/test/src/math/smoke/log10_test.cpp | 1 - libc/test/src/math/smoke/log10f_test.cpp | 1 - libc/test/src/math/smoke/log1p_test.cpp | 1 - libc/test/src/math/smoke/log1pf_test.cpp | 1 - libc/test/src/math/smoke/log2_test.cpp | 1 - libc/test/src/math/smoke/log_test.cpp | 1 - libc/test/src/math/smoke/powf_test.cpp | 1 - libc/test/src/math/smoke/sincosf_test.cpp | 1 - libc/test/src/math/smoke/sinf_test.cpp | 1 - libc/test/src/math/smoke/sinhf_test.cpp | 1 - libc/test/src/math/smoke/tanf_test.cpp | 1 - libc/test/src/math/smoke/tanhf_test.cpp | 1 - libc/test/src/math/tanf_test.cpp | 1 - libc/test/src/math/tanhf_test.cpp | 1 - libc/test/src/pthread/CMakeLists.txt | 6 ++-- libc/test/src/pthread/pthread_attr_test.cpp | 2 +- .../src/pthread/pthread_mutexattr_test.cpp | 3 +- libc/test/src/signal/CMakeLists.txt | 6 ++-- libc/test/src/signal/sigaddset_test.cpp | 1 - libc/test/src/signal/sigdelset_test.cpp | 1 - libc/test/src/signal/sigfillset_test.cpp | 1 - libc/test/src/spawn/CMakeLists.txt | 2 +- .../spawn/posix_spawn_file_actions_test.cpp | 2 +- libc/test/src/sys/prctl/linux/CMakeLists.txt | 1 - libc/test/src/sys/prctl/linux/prctl_test.cpp | 1 - libc/test/src/sys/resource/CMakeLists.txt | 2 +- libc/test/src/sys/select/CMakeLists.txt | 4 +-- .../src/sys/select/select_failure_test.cpp | 1 - libc/test/src/sys/sendfile/CMakeLists.txt | 2 +- libc/test/src/sys/utsname/CMakeLists.txt | 2 +- libc/test/src/sys/utsname/uname_test.cpp | 1 - libc/test/src/sys/wait/CMakeLists.txt | 4 +-- libc/test/src/sys/wait/wait4_test.cpp | 1 - libc/test/src/sys/wait/waitpid_test.cpp | 1 - libc/test/src/unistd/CMakeLists.txt | 21 +---------- 142 files changed, 91 insertions(+), 222 deletions(-) diff --git a/libc/include/llvm-libc-macros/linux/error-number-macros.h b/libc/include/llvm-libc-macros/linux/error-number-macros.h index 1643a70918da49..9a7304fa161ad0 100644 --- a/libc/include/llvm-libc-macros/linux/error-number-macros.h +++ b/libc/include/llvm-libc-macros/linux/error-number-macros.h @@ -21,4 +21,12 @@ #define EHWPOISON 133 #endif // EHWPOISON +#ifndef EOPNOTSUPP +#define EOPNOTSUPP 95 +#endif + +#ifndef ENOTSUP +#define ENOTSUP EOPNOTSUPP +#endif + #endif // LLVM_LIBC_MACROS_LINUX_ERROR_NUMBER_MACROS_H diff --git a/libc/src/__support/StringUtil/tables/CMakeLists.txt b/libc/src/__support/StringUtil/tables/CMakeLists.txt index b7bb33ee0a0fe2..ad4007f494749e 100644 --- a/libc/src/__support/StringUtil/tables/CMakeLists.txt +++ b/libc/src/__support/StringUtil/tables/CMakeLists.txt @@ -3,7 +3,7 @@ add_header_library( HDRS stdc_errors.h DEPENDS - libc.include.errno + libc.src.errno.errno libc.src.__support.StringUtil.message_mapper ) @@ -12,7 +12,7 @@ add_header_library( HDRS posix_errors.h DEPENDS - libc.include.errno + libc.src.errno.errno libc.src.__support.StringUtil.message_mapper ) @@ -21,8 +21,8 @@ add_header_library( HDRS linux_extension_errors.h DEPENDS - libc.include.errno libc.src.__support.StringUtil.message_mapper + libc.src.errno.errno ) add_header_library( diff --git a/libc/src/__support/StringUtil/tables/linux_extension_errors.h b/libc/src/__support/StringUtil/tables/linux_extension_errors.h index f6e8dea154d3be..425590f6e91c9b 100644 --- a/libc/src/__support/StringUtil/tables/linux_extension_errors.h +++ b/libc/src/__support/StringUtil/tables/linux_extension_errors.h @@ -11,8 +11,7 @@ #include "src/__support/StringUtil/message_mapper.h" #include "src/__support/macros/config.h" - -#include // For error macros +#include "src/errno/libc_errno.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/__support/StringUtil/tables/posix_errors.h b/libc/src/__support/StringUtil/tables/posix_errors.h index 5294f85eb8d24e..b21f28f0b1321c 100644 --- a/libc/src/__support/StringUtil/tables/posix_errors.h +++ b/libc/src/__support/StringUtil/tables/posix_errors.h @@ -9,11 +9,10 @@ #ifndef LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H #define LLVM_LIBC_SRC___SUPPORT_STRINGUTIL_TABLES_POSIX_ERRORS_H +#include "hdr/errno_macros.h" #include "src/__support/StringUtil/message_mapper.h" #include "src/__support/macros/config.h" -#include // For error macros - namespace LIBC_NAMESPACE_DECL { LIBC_INLINE_VAR constexpr MsgTable<76> POSIX_ERRORS = { diff --git a/libc/src/__support/StringUtil/tables/stdc_errors.h b/libc/src/__support/StringUtil/tables/stdc_errors.h index 1f0beef82001cd..b2a0d36a53637c 100644 --- a/libc/src/__support/StringUtil/tables/stdc_errors.h +++ b/libc/src/__support/StringUtil/tables/stdc_errors.h @@ -12,8 +12,6 @@ #include "src/__support/StringUtil/message_mapper.h" #include "src/__support/macros/config.h" -#include // For error macros - namespace LIBC_NAMESPACE_DECL { LIBC_INLINE_VAR constexpr const MsgTable<4> STDC_ERRORS = { diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt index 93e632c38af238..627168ee136997 100644 --- a/libc/src/math/generic/CMakeLists.txt +++ b/libc/src/math/generic/CMakeLists.txt @@ -1372,7 +1372,6 @@ add_entrypoint_object( DEPENDS .common_constants .explogxf - libc.include.errno libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.FPUtil.dyadic_float @@ -1406,7 +1405,6 @@ add_entrypoint_object( libc.src.__support.FPUtil.polyeval libc.src.__support.FPUtil.rounding_mode libc.src.__support.macros.optimization - libc.include.errno libc.src.errno.errno COMPILE_OPTIONS -O3 @@ -1445,7 +1443,6 @@ add_entrypoint_object( DEPENDS .common_constants .explogxf - libc.include.errno libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.FPUtil.dyadic_float @@ -1478,7 +1475,6 @@ add_header_library( libc.src.__support.FPUtil.rounding_mode libc.src.__support.macros.optimization libc.src.__support.common - libc.include.errno libc.src.errno.errno ) @@ -1548,7 +1544,6 @@ add_entrypoint_object( DEPENDS .common_constants .explogxf - libc.include.errno libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.FPUtil.dyadic_float @@ -1580,7 +1575,6 @@ add_header_library( libc.src.__support.FPUtil.rounding_mode libc.src.__support.macros.optimization libc.src.__support.common - libc.include.errno libc.src.errno.errno COMPILE_OPTIONS -O3 @@ -1632,7 +1626,6 @@ add_entrypoint_object( DEPENDS .common_constants .explogxf - libc.include.errno libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.FPUtil.dyadic_float @@ -1666,7 +1659,6 @@ add_entrypoint_object( libc.src.__support.FPUtil.polyeval libc.src.__support.FPUtil.rounding_mode libc.src.__support.macros.optimization - libc.include.errno libc.src.errno.errno COMPILE_OPTIONS -O3 @@ -1705,7 +1697,6 @@ add_entrypoint_object( .exp10f_impl .exp2f_impl .explogxf - libc.include.errno libc.src.__support.CPP.bit libc.src.__support.CPP.optional libc.src.__support.FPUtil.fenv_impl @@ -4144,7 +4135,6 @@ add_object_library( libc.src.__support.FPUtil.nearest_integer libc.src.__support.FPUtil.polyeval libc.src.__support.common - libc.include.errno libc.src.errno.errno COMPILE_OPTIONS -O3 diff --git a/libc/src/math/generic/acosf.cpp b/libc/src/math/generic/acosf.cpp index 95d8bc0213cba7..3c097a7871380d 100644 --- a/libc/src/math/generic/acosf.cpp +++ b/libc/src/math/generic/acosf.cpp @@ -16,8 +16,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - #include "inv_trigf_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/math/generic/asinf.cpp b/libc/src/math/generic/asinf.cpp index d6acc3a1692bc4..3a89def8f6e0c1 100644 --- a/libc/src/math/generic/asinf.cpp +++ b/libc/src/math/generic/asinf.cpp @@ -17,8 +17,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - #include "inv_trigf_utils.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/math/generic/cosf.cpp b/libc/src/math/generic/cosf.cpp index 6a59b3763b6e87..972ffa923aedf8 100644 --- a/libc/src/math/generic/cosf.cpp +++ b/libc/src/math/generic/cosf.cpp @@ -18,8 +18,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - namespace LIBC_NAMESPACE_DECL { // Exceptional cases for cosf. diff --git a/libc/src/math/generic/exp.cpp b/libc/src/math/generic/exp.cpp index df0c2eab7155c6..38b683aa011664 100644 --- a/libc/src/math/generic/exp.cpp +++ b/libc/src/math/generic/exp.cpp @@ -25,8 +25,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - namespace LIBC_NAMESPACE_DECL { using fputil::DoubleDouble; diff --git a/libc/src/math/generic/exp10.cpp b/libc/src/math/generic/exp10.cpp index d01bbd8fc01c32..748c8a22b23688 100644 --- a/libc/src/math/generic/exp10.cpp +++ b/libc/src/math/generic/exp10.cpp @@ -25,8 +25,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - namespace LIBC_NAMESPACE_DECL { using fputil::DoubleDouble; diff --git a/libc/src/math/generic/exp10f_impl.h b/libc/src/math/generic/exp10f_impl.h index fe2195c6e04739..d741318382e1f2 100644 --- a/libc/src/math/generic/exp10f_impl.h +++ b/libc/src/math/generic/exp10f_impl.h @@ -21,8 +21,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - namespace LIBC_NAMESPACE_DECL { namespace generic { diff --git a/libc/src/math/generic/exp2.cpp b/libc/src/math/generic/exp2.cpp index fbabb625af51fa..935548b538b94f 100644 --- a/libc/src/math/generic/exp2.cpp +++ b/libc/src/math/generic/exp2.cpp @@ -25,8 +25,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - namespace LIBC_NAMESPACE_DECL { using fputil::DoubleDouble; diff --git a/libc/src/math/generic/exp2f_impl.h b/libc/src/math/generic/exp2f_impl.h index 3f1c5ee68f081e..ae2d0628c12051 100644 --- a/libc/src/math/generic/exp2f_impl.h +++ b/libc/src/math/generic/exp2f_impl.h @@ -21,8 +21,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" -#include - #include "explogxf.h" namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/math/generic/expf.cpp b/libc/src/math/generic/expf.cpp index 1d7c0478eb2250..ee5c2a32b6c6ba 100644 --- a/libc/src/math/generic/expf.cpp +++ b/libc/src/math/generic/expf.cpp @@ -19,8 +19,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(float, expf, (float x)) { diff --git a/libc/src/math/generic/explogxf.h b/libc/src/math/generic/explogxf.h index 7daed558f74b1e..f3f50c21aacce7 100644 --- a/libc/src/math/generic/explogxf.h +++ b/libc/src/math/generic/explogxf.h @@ -20,8 +20,6 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/properties/cpu_features.h" -#include - namespace LIBC_NAMESPACE_DECL { struct ExpBase { diff --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/generic/expm1f.cpp index b1a0fe16de0771..d5e9e85ed4bd35 100644 --- a/libc/src/math/generic/expm1f.cpp +++ b/libc/src/math/generic/expm1f.cpp @@ -21,8 +21,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(float, expm1f, (float x)) { diff --git a/libc/src/math/generic/powf.cpp b/libc/src/math/generic/powf.cpp index e3dee678a1a70a..8ce2465ba229cb 100644 --- a/libc/src/math/generic/powf.cpp +++ b/libc/src/math/generic/powf.cpp @@ -25,8 +25,6 @@ #include "exp10f_impl.h" // Speedup for powf(10, y) = exp10f(y) #include "exp2f_impl.h" // Speedup for powf(2, y) = exp2f(y) -#include - namespace LIBC_NAMESPACE_DECL { using fputil::DoubleDouble; diff --git a/libc/src/math/generic/sincosf.cpp b/libc/src/math/generic/sincosf.cpp index 3bf8e9772231d6..ccaa29c10c4c68 100644 --- a/libc/src/math/generic/sincosf.cpp +++ b/libc/src/math/generic/sincosf.cpp @@ -17,8 +17,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - namespace LIBC_NAMESPACE_DECL { // Exceptional values diff --git a/libc/src/math/generic/sinf.cpp b/libc/src/math/generic/sinf.cpp index 43c2c2a8d883d2..cea267d4c683e5 100644 --- a/libc/src/math/generic/sinf.cpp +++ b/libc/src/math/generic/sinf.cpp @@ -19,8 +19,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - #if defined(LIBC_TARGET_CPU_HAS_FMA) #include "range_reduction_fma.h" #else diff --git a/libc/src/math/generic/tanf.cpp b/libc/src/math/generic/tanf.cpp index 01d8c9855d461b..6fd5f9a103676c 100644 --- a/libc/src/math/generic/tanf.cpp +++ b/libc/src/math/generic/tanf.cpp @@ -19,8 +19,6 @@ #include "src/__support/macros/optimization.h" // LIBC_UNLIKELY #include "src/__support/macros/properties/cpu_features.h" // LIBC_TARGET_CPU_HAS_FMA -#include - namespace LIBC_NAMESPACE_DECL { // Exceptional cases for tanf. diff --git a/libc/src/pthread/CMakeLists.txt b/libc/src/pthread/CMakeLists.txt index e7e92e5b60dc2a..8480fd89422223 100644 --- a/libc/src/pthread/CMakeLists.txt +++ b/libc/src/pthread/CMakeLists.txt @@ -36,6 +36,7 @@ add_entrypoint_object( pthread_attr_setdetachstate.h DEPENDS libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -56,6 +57,7 @@ add_entrypoint_object( pthread_attr_setguardsize.h DEPENDS libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -76,6 +78,7 @@ add_entrypoint_object( pthread_attr_setstacksize.h DEPENDS libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -98,6 +101,7 @@ add_entrypoint_object( DEPENDS libc.include.pthread libc.src.pthread.pthread_attr_setstacksize + libc.src.errno.errno ) add_entrypoint_object( @@ -149,10 +153,10 @@ add_entrypoint_object( HDRS pthread_condattr_setclock.h DEPENDS - libc.include.errno libc.include.pthread libc.include.sys_types libc.include.time + libc.src.errno.errno ) add_entrypoint_object( @@ -163,6 +167,7 @@ add_entrypoint_object( pthread_condattr_setpshared.h DEPENDS libc.include.pthread + libc.src.errno.errno ) add_header_library( @@ -205,6 +210,7 @@ add_entrypoint_object( DEPENDS .pthread_mutexattr libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -215,7 +221,7 @@ add_entrypoint_object( pthread_mutexattr_destroy.h DEPENDS .pthread_mutexattr - libc.include.errno + libc.src.errno.errno libc.include.pthread ) @@ -238,8 +244,8 @@ add_entrypoint_object( pthread_mutexattr_setrobust.h DEPENDS .pthread_mutexattr - libc.include.errno libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -261,8 +267,8 @@ add_entrypoint_object( pthread_mutexattr_setpshared.h DEPENDS .pthread_mutexattr - libc.include.errno libc.include.pthread + libc.src.errno.errno ) add_entrypoint_object( @@ -273,7 +279,7 @@ add_entrypoint_object( pthread_mutex_init.h DEPENDS .pthread_mutexattr - libc.include.errno + libc.src.errno.errno libc.include.pthread libc.src.__support.threads.mutex ) @@ -318,7 +324,6 @@ add_entrypoint_object( HDRS pthread_create.h DEPENDS - libc.include.errno libc.include.pthread libc.src.__support.threads.thread libc.src.pthread.pthread_attr_destroy @@ -326,6 +331,7 @@ add_entrypoint_object( libc.src.pthread.pthread_attr_getdetachstate libc.src.pthread.pthread_attr_getguardsize libc.src.pthread.pthread_attr_getstack + libc.src.errno.errno COMPILE_OPTIONS -O3 -fno-omit-frame-pointer @@ -419,9 +425,9 @@ add_entrypoint_object( HDRS pthread_key_create.h DEPENDS - libc.include.errno libc.include.pthread libc.src.__support.threads.thread + libc.src.errno.errno ) add_entrypoint_object( @@ -431,9 +437,9 @@ add_entrypoint_object( HDRS pthread_key_delete.h DEPENDS - libc.include.errno libc.include.pthread libc.src.__support.threads.thread + libc.src.errno.errno ) add_entrypoint_object( @@ -443,8 +449,8 @@ add_entrypoint_object( HDRS pthread_getspecific.h DEPENDS - libc.include.errno libc.include.pthread + libc.src.errno.errno libc.src.__support.threads.thread ) @@ -455,9 +461,9 @@ add_entrypoint_object( HDRS pthread_setspecific.h DEPENDS - libc.include.errno libc.include.pthread libc.src.__support.threads.thread + libc.src.errno.errno ) add_entrypoint_object( @@ -508,7 +514,7 @@ add_entrypoint_object( pthread_rwlockattr_setkind_np.h DEPENDS libc.include.pthread - libc.include.errno + libc.src.errno.errno ) add_entrypoint_object( @@ -519,7 +525,7 @@ add_entrypoint_object( pthread_rwlockattr_setpshared.h DEPENDS libc.include.pthread - libc.include.errno + libc.src.errno.errno ) add_entrypoint_object( @@ -554,6 +560,7 @@ add_entrypoint_object( DEPENDS libc.include.pthread libc.src.__support.threads.linux.rwlock + libc.src.errno.errno ) add_entrypoint_object( @@ -587,6 +594,7 @@ add_entrypoint_object( DEPENDS libc.include.pthread libc.src.__support.threads.linux.rwlock + libc.src.errno.errno ) add_entrypoint_object( @@ -631,6 +639,7 @@ add_entrypoint_object( DEPENDS libc.include.pthread libc.src.__support.threads.linux.rwlock + libc.src.errno.errno ) add_entrypoint_object( @@ -727,7 +736,7 @@ add_entrypoint_object( HDRS pthread_atfork.h DEPENDS - libc.include.errno libc.include.pthread libc.src.__support.threads.fork_callbacks + libc.src.errno.errno ) diff --git a/libc/src/pthread/pthread_atfork.cpp b/libc/src/pthread/pthread_atfork.cpp index d3f3c259992ec2..b2c67c78e5d94e 100644 --- a/libc/src/pthread/pthread_atfork.cpp +++ b/libc/src/pthread/pthread_atfork.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/fork_callbacks.h" +#include "src/errno/libc_errno.h" -#include #include // For pthread_* type definitions. namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_attr_setdetachstate.cpp b/libc/src/pthread/pthread_attr_setdetachstate.cpp index 3aa72d217f28b3..872f694e01f3ae 100644 --- a/libc/src/pthread/pthread_attr_setdetachstate.cpp +++ b/libc/src/pthread/pthread_attr_setdetachstate.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_attr_setguardsize.cpp b/libc/src/pthread/pthread_attr_setguardsize.cpp index 389ee773fc5db5..fa4375e915ab47 100644 --- a/libc/src/pthread/pthread_attr_setguardsize.cpp +++ b/libc/src/pthread/pthread_attr_setguardsize.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include // For EXEC_PAGESIZE. #include diff --git a/libc/src/pthread/pthread_attr_setstack.cpp b/libc/src/pthread/pthread_attr_setstack.cpp index f4f2d1450633ea..1154055a63a7ef 100644 --- a/libc/src/pthread/pthread_attr_setstack.cpp +++ b/libc/src/pthread/pthread_attr_setstack.cpp @@ -12,8 +12,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/thread.h" // For STACK_ALIGNMENT +#include "src/errno/libc_errno.h" -#include #include #include diff --git a/libc/src/pthread/pthread_attr_setstacksize.cpp b/libc/src/pthread/pthread_attr_setstacksize.cpp index f327d3365b5d85..0a5d1af661abfa 100644 --- a/libc/src/pthread/pthread_attr_setstacksize.cpp +++ b/libc/src/pthread/pthread_attr_setstacksize.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_condattr_setclock.cpp b/libc/src/pthread/pthread_condattr_setclock.cpp index 5c0144523f93e6..37fbd6b27143dd 100644 --- a/libc/src/pthread/pthread_condattr_setclock.cpp +++ b/libc/src/pthread/pthread_condattr_setclock.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include // EINVAL #include // pthread_condattr_t #include // clockid_t #include // CLOCK_MONOTONIC, CLOCK_REALTIME diff --git a/libc/src/pthread/pthread_condattr_setpshared.cpp b/libc/src/pthread/pthread_condattr_setpshared.cpp index 536aeadac5d446..433b2dc1d2d931 100644 --- a/libc/src/pthread/pthread_condattr_setpshared.cpp +++ b/libc/src/pthread/pthread_condattr_setpshared.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include // EINVAL #include // pthread_condattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_create.cpp b/libc/src/pthread/pthread_create.cpp index 1fb4b50109401c..e1b1f3b325d1cb 100644 --- a/libc/src/pthread/pthread_create.cpp +++ b/libc/src/pthread/pthread_create.cpp @@ -19,8 +19,8 @@ #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" #include "src/__support/threads/thread.h" +#include "src/errno/libc_errno.h" -#include #include // For pthread_* type definitions. namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_key_create.cpp b/libc/src/pthread/pthread_key_create.cpp index 0583baca22f4d4..383762f273e7a7 100644 --- a/libc/src/pthread/pthread_key_create.cpp +++ b/libc/src/pthread/pthread_key_create.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/thread.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_key_delete.cpp b/libc/src/pthread/pthread_key_delete.cpp index 20484fa9bdf828..b54db821ab05a8 100644 --- a/libc/src/pthread/pthread_key_delete.cpp +++ b/libc/src/pthread/pthread_key_delete.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/thread.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_mutex_init.cpp b/libc/src/pthread/pthread_mutex_init.cpp index 0281f732473d9d..94052e53d8c0ab 100644 --- a/libc/src/pthread/pthread_mutex_init.cpp +++ b/libc/src/pthread/pthread_mutex_init.cpp @@ -13,7 +13,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/mutex.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_mutexattr_destroy.cpp b/libc/src/pthread/pthread_mutexattr_destroy.cpp index 3b2551afd11b55..bddeb8b75acd15 100644 --- a/libc/src/pthread/pthread_mutexattr_destroy.cpp +++ b/libc/src/pthread/pthread_mutexattr_destroy.cpp @@ -12,8 +12,6 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_destroy, (pthread_mutexattr_t *)) { diff --git a/libc/src/pthread/pthread_mutexattr_getpshared.cpp b/libc/src/pthread/pthread_mutexattr_getpshared.cpp index 2d83a5229e9ecd..0ea5d428346183 100644 --- a/libc/src/pthread/pthread_mutexattr_getpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_getpshared.cpp @@ -12,8 +12,6 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getpshared, diff --git a/libc/src/pthread/pthread_mutexattr_getrobust.cpp b/libc/src/pthread/pthread_mutexattr_getrobust.cpp index 508b502a580087..b2359e0ac8c9c2 100644 --- a/libc/src/pthread/pthread_mutexattr_getrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_getrobust.cpp @@ -12,8 +12,6 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_getrobust, diff --git a/libc/src/pthread/pthread_mutexattr_gettype.cpp b/libc/src/pthread/pthread_mutexattr_gettype.cpp index 3747bf5ce73e94..0bd226ef89e5ed 100644 --- a/libc/src/pthread/pthread_mutexattr_gettype.cpp +++ b/libc/src/pthread/pthread_mutexattr_gettype.cpp @@ -12,8 +12,6 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" -#include - namespace LIBC_NAMESPACE_DECL { LLVM_LIBC_FUNCTION(int, pthread_mutexattr_gettype, diff --git a/libc/src/pthread/pthread_mutexattr_setpshared.cpp b/libc/src/pthread/pthread_mutexattr_setpshared.cpp index b290de764c91b6..deeae15be23035 100644 --- a/libc/src/pthread/pthread_mutexattr_setpshared.cpp +++ b/libc/src/pthread/pthread_mutexattr_setpshared.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_mutexattr_setrobust.cpp b/libc/src/pthread/pthread_mutexattr_setrobust.cpp index e572827486c077..9fd46f4c928d70 100644 --- a/libc/src/pthread/pthread_mutexattr_setrobust.cpp +++ b/libc/src/pthread/pthread_mutexattr_setrobust.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_mutexattr_settype.cpp b/libc/src/pthread/pthread_mutexattr_settype.cpp index 27e8ff859ba347..c7e78271f9c38b 100644 --- a/libc/src/pthread/pthread_mutexattr_settype.cpp +++ b/libc/src/pthread/pthread_mutexattr_settype.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_destroy.cpp b/libc/src/pthread/pthread_rwlock_destroy.cpp index 345076aae43488..afc5622e54a003 100644 --- a/libc/src/pthread/pthread_rwlock_destroy.cpp +++ b/libc/src/pthread/pthread_rwlock_destroy.cpp @@ -12,7 +12,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_init.cpp b/libc/src/pthread/pthread_rwlock_init.cpp index d1a31625d0dabd..dc5424cbc4838d 100644 --- a/libc/src/pthread/pthread_rwlock_init.cpp +++ b/libc/src/pthread/pthread_rwlock_init.cpp @@ -14,7 +14,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_rdlock.cpp b/libc/src/pthread/pthread_rwlock_rdlock.cpp index 16d82301c54a9a..7dee8eb9a44b12 100644 --- a/libc/src/pthread/pthread_rwlock_rdlock.cpp +++ b/libc/src/pthread/pthread_rwlock_rdlock.cpp @@ -12,7 +12,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp index 905541014a4a46..112ff5c9cdad35 100644 --- a/libc/src/pthread/pthread_rwlock_timedrdlock.cpp +++ b/libc/src/pthread/pthread_rwlock_timedrdlock.cpp @@ -7,15 +7,14 @@ //===----------------------------------------------------------------------===// #include "src/pthread/pthread_rwlock_timedrdlock.h" - #include "src/__support/common.h" #include "src/__support/libc_assert.h" #include "src/__support/macros/config.h" #include "src/__support/macros/optimization.h" #include "src/__support/threads/linux/rwlock.h" #include "src/__support/time/linux/abs_timeout.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_timedwrlock.cpp b/libc/src/pthread/pthread_rwlock_timedwrlock.cpp index f77ac40f22b897..d2dc70e992e82e 100644 --- a/libc/src/pthread/pthread_rwlock_timedwrlock.cpp +++ b/libc/src/pthread/pthread_rwlock_timedwrlock.cpp @@ -15,7 +15,6 @@ #include "src/__support/threads/linux/rwlock.h" #include "src/__support/time/linux/abs_timeout.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_tryrdlock.cpp b/libc/src/pthread/pthread_rwlock_tryrdlock.cpp index da59a576b82747..d54b57f0560908 100644 --- a/libc/src/pthread/pthread_rwlock_tryrdlock.cpp +++ b/libc/src/pthread/pthread_rwlock_tryrdlock.cpp @@ -12,7 +12,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_trywrlock.cpp b/libc/src/pthread/pthread_rwlock_trywrlock.cpp index ccd1bd49c402c6..a63dc893e7169c 100644 --- a/libc/src/pthread/pthread_rwlock_trywrlock.cpp +++ b/libc/src/pthread/pthread_rwlock_trywrlock.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_unlock.cpp b/libc/src/pthread/pthread_rwlock_unlock.cpp index 77c50a8e65fdfb..e61290179bd629 100644 --- a/libc/src/pthread/pthread_rwlock_unlock.cpp +++ b/libc/src/pthread/pthread_rwlock_unlock.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlock_wrlock.cpp b/libc/src/pthread/pthread_rwlock_wrlock.cpp index c2561c81f4bd0e..f02fb6b5db9c09 100644 --- a/libc/src/pthread/pthread_rwlock_wrlock.cpp +++ b/libc/src/pthread/pthread_rwlock_wrlock.cpp @@ -12,7 +12,6 @@ #include "src/__support/macros/config.h" #include "src/__support/threads/linux/rwlock.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp index 45dbb05c7ab893..80d34a35c717ad 100644 --- a/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp +++ b/libc/src/pthread/pthread_rwlockattr_setkind_np.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include // pthread_rwlockattr_t namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp index 8088b68fdf33f4..5a7191aefd3d0d 100644 --- a/libc/src/pthread/pthread_rwlockattr_setpshared.cpp +++ b/libc/src/pthread/pthread_rwlockattr_setpshared.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include // EINVAL #include // pthread_rwlockattr_t, PTHREAD_PROCESS_SHARED, PTHREAD_PROCESS_PRIVATE namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/pthread/pthread_setspecific.cpp b/libc/src/pthread/pthread_setspecific.cpp index 5587a2d937abbb..70c29c16708411 100644 --- a/libc/src/pthread/pthread_setspecific.cpp +++ b/libc/src/pthread/pthread_setspecific.cpp @@ -11,8 +11,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/thread.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/spawn/CMakeLists.txt b/libc/src/spawn/CMakeLists.txt index 4fbbaacb10d265..11621da782ed12 100644 --- a/libc/src/spawn/CMakeLists.txt +++ b/libc/src/spawn/CMakeLists.txt @@ -28,9 +28,9 @@ add_entrypoint_object( posix_spawn_file_actions_destroy.h DEPENDS .file_actions - libc.include.errno libc.include.spawn libc.src.__support.CPP.new + libc.src.errno.errno ) add_entrypoint_object( @@ -41,9 +41,9 @@ add_entrypoint_object( posix_spawn_file_actions_adddup2.h DEPENDS .file_actions - libc.include.errno libc.include.spawn libc.src.__support.CPP.new + libc.src.errno.errno ) add_entrypoint_object( @@ -54,9 +54,9 @@ add_entrypoint_object( posix_spawn_file_actions_addopen.h DEPENDS .file_actions - libc.include.errno libc.include.spawn libc.src.__support.CPP.new + libc.src.errno.errno ) add_entrypoint_object( @@ -67,9 +67,9 @@ add_entrypoint_object( posix_spawn_file_actions_addclose.h DEPENDS .file_actions - libc.include.errno libc.include.spawn libc.src.__support.CPP.new + libc.src.errno.errno ) add_entrypoint_object( diff --git a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp index e43af8f665f959..bb8504f655c4a2 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addclose.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addclose.cpp @@ -12,8 +12,8 @@ #include "src/__support/CPP/new.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp index 9f28ffa48bee04..710063d52e74dd 100644 --- a/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_adddup2.cpp @@ -12,8 +12,8 @@ #include "src/__support/CPP/new.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp index 7f9286099573e2..028d6e895f3c44 100644 --- a/libc/src/spawn/posix_spawn_file_actions_addopen.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_addopen.cpp @@ -12,8 +12,8 @@ #include "src/__support/CPP/new.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp index 155e4c6a3b2bee..168118da249d1e 100644 --- a/libc/src/spawn/posix_spawn_file_actions_destroy.cpp +++ b/libc/src/spawn/posix_spawn_file_actions_destroy.cpp @@ -9,11 +9,12 @@ #include "posix_spawn_file_actions_destroy.h" #include "file_actions.h" + #include "src/__support/CPP/new.h" #include "src/__support/common.h" #include "src/__support/macros/config.h" +#include "src/errno/libc_errno.h" -#include #include namespace LIBC_NAMESPACE_DECL { diff --git a/libc/src/threads/CMakeLists.txt b/libc/src/threads/CMakeLists.txt index b3b22e7f5c735a..c33be265369fec 100644 --- a/libc/src/threads/CMakeLists.txt +++ b/libc/src/threads/CMakeLists.txt @@ -22,6 +22,7 @@ add_entrypoint_object( DEPENDS libc.src.__support.threads.thread libc.include.threads + libc.src.errno.errno COMPILE_OPTIONS -O3 -fno-omit-frame-pointer # This allows us to sniff out the thread args from diff --git a/libc/src/threads/thrd_create.cpp b/libc/src/threads/thrd_create.cpp index 52af72b07c8a80..4680944c2eee09 100644 --- a/libc/src/threads/thrd_create.cpp +++ b/libc/src/threads/thrd_create.cpp @@ -10,8 +10,8 @@ #include "src/__support/common.h" #include "src/__support/macros/config.h" #include "src/__support/threads/thread.h" +#include "src/errno/libc_errno.h" -#include #include // For thrd_* type definitions. namespace LIBC_NAMESPACE_DECL { diff --git a/libc/test/UnitTest/PrintfMatcher.h b/libc/test/UnitTest/PrintfMatcher.h index e0c16cf05f2816..4f79832ab59fac 100644 --- a/libc/test/UnitTest/PrintfMatcher.h +++ b/libc/test/UnitTest/PrintfMatcher.h @@ -13,8 +13,6 @@ #include "src/stdio/printf_core/core_structs.h" #include "test/UnitTest/Test.h" -#include - namespace LIBC_NAMESPACE_DECL { namespace testing { diff --git a/libc/test/UnitTest/ScanfMatcher.h b/libc/test/UnitTest/ScanfMatcher.h index d64258f3f4f2c0..cb9d13f7572b75 100644 --- a/libc/test/UnitTest/ScanfMatcher.h +++ b/libc/test/UnitTest/ScanfMatcher.h @@ -13,8 +13,6 @@ #include "src/stdio/scanf_core/core_structs.h" #include "test/UnitTest/Test.h" -#include - namespace LIBC_NAMESPACE_DECL { namespace testing { diff --git a/libc/test/integration/src/pthread/CMakeLists.txt b/libc/test/integration/src/pthread/CMakeLists.txt index 48d4368df156d8..208ba3fd435079 100644 --- a/libc/test/integration/src/pthread/CMakeLists.txt +++ b/libc/test/integration/src/pthread/CMakeLists.txt @@ -115,7 +115,6 @@ add_integration_test( SRCS pthread_name_test.cpp DEPENDS - libc.include.errno libc.include.pthread libc.src.errno.errno libc.src.pthread.pthread_create @@ -185,8 +184,8 @@ add_integration_test( pthread_join_test.cpp DEPENDS libc.include.pthread - libc.include.errno libc.include.stdio + libc.src.errno.errno libc.src.pthread.pthread_create libc.src.pthread.pthread_join ) @@ -199,7 +198,7 @@ add_integration_test( pthread_create_test.cpp DEPENDS libc.include.pthread - libc.include.errno + libc.src.errno.errno libc.src.pthread.pthread_create libc.src.pthread.pthread_join libc.src.pthread.pthread_attr_getdetachstate diff --git a/libc/test/integration/src/pthread/pthread_name_test.cpp b/libc/test/integration/src/pthread/pthread_name_test.cpp index d341792d11d6cb..37ceceee880de2 100644 --- a/libc/test/integration/src/pthread/pthread_name_test.cpp +++ b/libc/test/integration/src/pthread/pthread_name_test.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// #include "src/__support/CPP/string_view.h" +#include "src/errno/libc_errno.h" #include "src/pthread/pthread_create.h" #include "src/pthread/pthread_getname_np.h" #include "src/pthread/pthread_join.h" @@ -19,7 +20,6 @@ #include "test/IntegrationTest/test.h" -#include #include #include // uintptr_t diff --git a/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp b/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp index 7aec39c1929287..c1b0cd671da718 100644 --- a/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp +++ b/libc/test/integration/src/spawn/posix_spawn_test_binary.cpp @@ -1,5 +1,4 @@ #include "test_binary_properties.h" -#include #include #include diff --git a/libc/test/integration/src/unistd/CMakeLists.txt b/libc/test/integration/src/unistd/CMakeLists.txt index 644f16fa46347a..5bcb712dd56d37 100644 --- a/libc/test/integration/src/unistd/CMakeLists.txt +++ b/libc/test/integration/src/unistd/CMakeLists.txt @@ -21,10 +21,10 @@ add_integration_test( SRCS fork_test.cpp DEPENDS - libc.include.errno libc.include.signal libc.include.sys_wait libc.include.unistd + libc.src.errno.errno libc.src.pthread.pthread_atfork libc.src.signal.raise libc.src.sys.wait.wait @@ -45,11 +45,11 @@ if((${LIBC_TARGET_OS} STREQUAL "linux") AND (${LIBC_TARGET_ARCHITECTURE_IS_X86}) SRCS stack_smashing_test.cpp DEPENDS - libc.include.errno libc.include.signal libc.include.sys_wait libc.include.unistd libc.src.compiler.__stack_chk_fail + libc.src.errno.errno libc.src.pthread.pthread_atfork libc.src.signal.raise libc.src.sys.wait.wait @@ -94,7 +94,7 @@ add_integration_test( DEPENDS libc_execv_test_normal_exit libc_execv_test_signal_exit - libc.include.errno + libc.src.errno.errno libc.src.sys.wait.waitpid libc.src.unistd.execv libc.src.unistd.fork @@ -111,7 +111,7 @@ add_integration_test( DEPENDS libc_execv_test_normal_exit libc_execv_test_signal_exit - libc.include.errno + libc.errno.errno libc.src.sys.wait.waitpid libc.src.unistd.execve libc.src.unistd.fork diff --git a/libc/test/integration/src/unistd/fork_test.cpp b/libc/test/integration/src/unistd/fork_test.cpp index 87f314f305101c..010f57a7d24486 100644 --- a/libc/test/integration/src/unistd/fork_test.cpp +++ b/libc/test/integration/src/unistd/fork_test.cpp @@ -18,7 +18,6 @@ #include "test/IntegrationTest/test.h" -#include #include #include #include diff --git a/libc/test/integration/src/unistd/stack_smashing_test.cpp b/libc/test/integration/src/unistd/stack_smashing_test.cpp index 89fc53dac506ac..3508b1695cfdc5 100644 --- a/libc/test/integration/src/unistd/stack_smashing_test.cpp +++ b/libc/test/integration/src/unistd/stack_smashing_test.cpp @@ -17,7 +17,6 @@ #include "test/IntegrationTest/test.h" -#include #include #include #include diff --git a/libc/test/integration/startup/linux/CMakeLists.txt b/libc/test/integration/startup/linux/CMakeLists.txt index 6f0517a832d200..511b16d6130261 100644 --- a/libc/test/integration/startup/linux/CMakeLists.txt +++ b/libc/test/integration/startup/linux/CMakeLists.txt @@ -38,7 +38,6 @@ add_integration_test( SRCS tls_test.cpp DEPENDS - libc.include.errno libc.include.sys_mman libc.src.errno.errno libc.src.sys.mman.mmap diff --git a/libc/test/integration/startup/linux/tls_test.cpp b/libc/test/integration/startup/linux/tls_test.cpp index 2a6385e195a496..ef9fd9fcb7ff42 100644 --- a/libc/test/integration/startup/linux/tls_test.cpp +++ b/libc/test/integration/startup/linux/tls_test.cpp @@ -10,7 +10,6 @@ #include "src/sys/mman/mmap.h" #include "test/IntegrationTest/test.h" -#include #include constexpr int threadLocalDataSize = 101; diff --git a/libc/test/src/__support/File/CMakeLists.txt b/libc/test/src/__support/File/CMakeLists.txt index 9191469b4927c2..9fa3b518421ccb 100644 --- a/libc/test/src/__support/File/CMakeLists.txt +++ b/libc/test/src/__support/File/CMakeLists.txt @@ -14,9 +14,9 @@ add_libc_test( LINK_LIBRARIES LibcMemoryHelpers DEPENDS - libc.include.errno libc.include.stdio libc.include.stdlib + libc.src.errno.errno libc.src.__support.CPP.new libc.src.__support.File.file ) diff --git a/libc/test/src/math/RoundToIntegerTest.h b/libc/test/src/math/RoundToIntegerTest.h index 910ff968c1a035..995aba7b233ec8 100644 --- a/libc/test/src/math/RoundToIntegerTest.h +++ b/libc/test/src/math/RoundToIntegerTest.h @@ -19,7 +19,6 @@ #include "utils/MPFRWrapper/MPFRUtils.h" #include "hdr/math_macros.h" -#include namespace mpfr = LIBC_NAMESPACE::testing::mpfr; using LIBC_NAMESPACE::Sign; diff --git a/libc/test/src/math/acosf_test.cpp b/libc/test/src/math/acosf_test.cpp index 488058237d191e..2e4c8eb2ab9610 100644 --- a/libc/test/src/math/acosf_test.cpp +++ b/libc/test/src/math/acosf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include namespace mpfr = LIBC_NAMESPACE::testing::mpfr; diff --git a/libc/test/src/math/acoshf_test.cpp b/libc/test/src/math/acoshf_test.cpp index 5d7f59792b52be..18ed5a11d50a7e 100644 --- a/libc/test/src/math/acoshf_test.cpp +++ b/libc/test/src/math/acoshf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/asinf_test.cpp b/libc/test/src/math/asinf_test.cpp index 09dc3c960ed9ab..5197810d8bd583 100644 --- a/libc/test/src/math/asinf_test.cpp +++ b/libc/test/src/math/asinf_test.cpp @@ -15,7 +15,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/asinhf_test.cpp b/libc/test/src/math/asinhf_test.cpp index 3e55a563879d03..ac125c3520c44d 100644 --- a/libc/test/src/math/asinhf_test.cpp +++ b/libc/test/src/math/asinhf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/atanf_test.cpp b/libc/test/src/math/atanf_test.cpp index 376b4724b5a3a2..575ec89bd493c4 100644 --- a/libc/test/src/math/atanf_test.cpp +++ b/libc/test/src/math/atanf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/atanhf_test.cpp b/libc/test/src/math/atanhf_test.cpp index 488a9a942ce913..8b9db1dfdd9763 100644 --- a/libc/test/src/math/atanhf_test.cpp +++ b/libc/test/src/math/atanhf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcAtanhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/cosf_test.cpp b/libc/test/src/math/cosf_test.cpp index 82790e3a9d4809..2143c36f3d30b7 100644 --- a/libc/test/src/math/cosf_test.cpp +++ b/libc/test/src/math/cosf_test.cpp @@ -15,7 +15,6 @@ #include "test/src/math/sdcomp26094.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LIBC_NAMESPACE::testing::SDCOMP26094_VALUES; diff --git a/libc/test/src/math/coshf_test.cpp b/libc/test/src/math/coshf_test.cpp index 00bbf4b0bd9465..0d1c322b8e6222 100644 --- a/libc/test/src/math/coshf_test.cpp +++ b/libc/test/src/math/coshf_test.cpp @@ -15,7 +15,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/erff_test.cpp b/libc/test/src/math/erff_test.cpp index 851eda4b1542fd..f9b03377daa9b1 100644 --- a/libc/test/src/math/erff_test.cpp +++ b/libc/test/src/math/erff_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcErffTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/exp10_test.cpp b/libc/test/src/math/exp10_test.cpp index 61ae33ecae525e..6fb1d2d9d925e6 100644 --- a/libc/test/src/math/exp10_test.cpp +++ b/libc/test/src/math/exp10_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcExp10Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/exp2_test.cpp b/libc/test/src/math/exp2_test.cpp index f218eea0b358f1..adfceceeef4b76 100644 --- a/libc/test/src/math/exp2_test.cpp +++ b/libc/test/src/math/exp2_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcExp2Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/exp_test.cpp b/libc/test/src/math/exp_test.cpp index ee674c5fe6cb52..0ab3a4e543464b 100644 --- a/libc/test/src/math/exp_test.cpp +++ b/libc/test/src/math/exp_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcExpTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log10_test.cpp b/libc/test/src/math/log10_test.cpp index 32b84686badea7..01aa1f82ae5d87 100644 --- a/libc/test/src/math/log10_test.cpp +++ b/libc/test/src/math/log10_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLog10Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log10f_test.cpp b/libc/test/src/math/log10f_test.cpp index 4ba118455df4dd..b2c1c283e08e5c 100644 --- a/libc/test/src/math/log10f_test.cpp +++ b/libc/test/src/math/log10f_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLog10fTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log1p_test.cpp b/libc/test/src/math/log1p_test.cpp index 98486deb12c744..107e965a0d3aec 100644 --- a/libc/test/src/math/log1p_test.cpp +++ b/libc/test/src/math/log1p_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLog1pTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log1pf_test.cpp b/libc/test/src/math/log1pf_test.cpp index b42cf3b8681b22..bb181dc5e43b04 100644 --- a/libc/test/src/math/log1pf_test.cpp +++ b/libc/test/src/math/log1pf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLog1pfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log2_test.cpp b/libc/test/src/math/log2_test.cpp index f9bd93d44e50f5..8a07991a688867 100644 --- a/libc/test/src/math/log2_test.cpp +++ b/libc/test/src/math/log2_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLog2Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/log_test.cpp b/libc/test/src/math/log_test.cpp index c0f9edfc540a1e..969a469b2e1c63 100644 --- a/libc/test/src/math/log_test.cpp +++ b/libc/test/src/math/log_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcLogTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/powf_test.cpp b/libc/test/src/math/powf_test.cpp index c13231f9d83b86..448dcc0035e9b0 100644 --- a/libc/test/src/math/powf_test.cpp +++ b/libc/test/src/math/powf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcPowfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/sincosf_test.cpp b/libc/test/src/math/sincosf_test.cpp index 7254c3be5b75f3..2823110331f302 100644 --- a/libc/test/src/math/sincosf_test.cpp +++ b/libc/test/src/math/sincosf_test.cpp @@ -15,7 +15,6 @@ #include "test/src/math/sdcomp26094.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcSinCosfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/sinf_test.cpp b/libc/test/src/math/sinf_test.cpp index 370362639490b4..8fd3ed1577ceeb 100644 --- a/libc/test/src/math/sinf_test.cpp +++ b/libc/test/src/math/sinf_test.cpp @@ -15,7 +15,6 @@ #include "test/src/math/sdcomp26094.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcSinfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/sinhf_test.cpp b/libc/test/src/math/sinhf_test.cpp index 400df2f18dabc9..6867c7aec57dff 100644 --- a/libc/test/src/math/sinhf_test.cpp +++ b/libc/test/src/math/sinhf_test.cpp @@ -15,7 +15,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/RoundToIntegerTest.h b/libc/test/src/math/smoke/RoundToIntegerTest.h index 8b5f678b32449f..6ae97ce35a0d63 100644 --- a/libc/test/src/math/smoke/RoundToIntegerTest.h +++ b/libc/test/src/math/smoke/RoundToIntegerTest.h @@ -17,7 +17,6 @@ #include "test/UnitTest/Test.h" #include "hdr/math_macros.h" -#include static constexpr int ROUNDING_MODES[4] = {FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO, FE_TONEAREST}; diff --git a/libc/test/src/math/smoke/acosf_test.cpp b/libc/test/src/math/smoke/acosf_test.cpp index 732c29548c60d3..039d8c2013830d 100644 --- a/libc/test/src/math/smoke/acosf_test.cpp +++ b/libc/test/src/math/smoke/acosf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcAcosfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/acoshf_test.cpp b/libc/test/src/math/smoke/acoshf_test.cpp index 2e94216ede364b..91d433df80558d 100644 --- a/libc/test/src/math/smoke/acoshf_test.cpp +++ b/libc/test/src/math/smoke/acoshf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcAcoshfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/asinf_test.cpp b/libc/test/src/math/smoke/asinf_test.cpp index c67d07711cd132..450255ccd3020d 100644 --- a/libc/test/src/math/smoke/asinf_test.cpp +++ b/libc/test/src/math/smoke/asinf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcAsinfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/asinhf_test.cpp b/libc/test/src/math/smoke/asinhf_test.cpp index f95184676303d6..a8e54f379a1fd0 100644 --- a/libc/test/src/math/smoke/asinhf_test.cpp +++ b/libc/test/src/math/smoke/asinhf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcAsinhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/atanf_test.cpp b/libc/test/src/math/smoke/atanf_test.cpp index 56bf2f951b3361..0fe11d79533810 100644 --- a/libc/test/src/math/smoke/atanf_test.cpp +++ b/libc/test/src/math/smoke/atanf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcAtanfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/atanhf_test.cpp b/libc/test/src/math/smoke/atanhf_test.cpp index fa07b62e9f43f5..e22926bd2f0376 100644 --- a/libc/test/src/math/smoke/atanhf_test.cpp +++ b/libc/test/src/math/smoke/atanhf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LIBC_NAMESPACE::Sign; diff --git a/libc/test/src/math/smoke/cosf_test.cpp b/libc/test/src/math/smoke/cosf_test.cpp index 7000fe2f2b07de..62f7ede9cf1781 100644 --- a/libc/test/src/math/smoke/cosf_test.cpp +++ b/libc/test/src/math/smoke/cosf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcCosfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/coshf_test.cpp b/libc/test/src/math/smoke/coshf_test.cpp index 4d915b12dee164..ddaa19f4c392f7 100644 --- a/libc/test/src/math/smoke/coshf_test.cpp +++ b/libc/test/src/math/smoke/coshf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcCoshfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/erff_test.cpp b/libc/test/src/math/smoke/erff_test.cpp index 102126ee4e23fe..8a970f3a4b7ed1 100644 --- a/libc/test/src/math/smoke/erff_test.cpp +++ b/libc/test/src/math/smoke/erff_test.cpp @@ -12,7 +12,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcErffTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/exp10_test.cpp b/libc/test/src/math/smoke/exp10_test.cpp index 7154cb176038c2..282ddc987b4993 100644 --- a/libc/test/src/math/smoke/exp10_test.cpp +++ b/libc/test/src/math/smoke/exp10_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcExp10Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/exp2_test.cpp b/libc/test/src/math/smoke/exp2_test.cpp index a8ef6cfa7f6a12..d148d27fad38dc 100644 --- a/libc/test/src/math/smoke/exp2_test.cpp +++ b/libc/test/src/math/smoke/exp2_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcExp2Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/exp_test.cpp b/libc/test/src/math/smoke/exp_test.cpp index 2abaa7230831f2..5fe6f3e92f4a6a 100644 --- a/libc/test/src/math/smoke/exp_test.cpp +++ b/libc/test/src/math/smoke/exp_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcExpTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/expm1_test.cpp b/libc/test/src/math/smoke/expm1_test.cpp index d5f166d53a50eb..bafdbda8af03bd 100644 --- a/libc/test/src/math/smoke/expm1_test.cpp +++ b/libc/test/src/math/smoke/expm1_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcExpm1Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log10_test.cpp b/libc/test/src/math/smoke/log10_test.cpp index 37baf89128f2ec..e03416ae20c8f3 100644 --- a/libc/test/src/math/smoke/log10_test.cpp +++ b/libc/test/src/math/smoke/log10_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLog10Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log10f_test.cpp b/libc/test/src/math/smoke/log10f_test.cpp index 721045d355da8c..2524545e018123 100644 --- a/libc/test/src/math/smoke/log10f_test.cpp +++ b/libc/test/src/math/smoke/log10f_test.cpp @@ -12,7 +12,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLog10fTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log1p_test.cpp b/libc/test/src/math/smoke/log1p_test.cpp index 993dbf8001df86..63237f3259b215 100644 --- a/libc/test/src/math/smoke/log1p_test.cpp +++ b/libc/test/src/math/smoke/log1p_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLog1pTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log1pf_test.cpp b/libc/test/src/math/smoke/log1pf_test.cpp index 6127cc89a74216..c14d6552946979 100644 --- a/libc/test/src/math/smoke/log1pf_test.cpp +++ b/libc/test/src/math/smoke/log1pf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLog1pfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log2_test.cpp b/libc/test/src/math/smoke/log2_test.cpp index b59767e668eb61..89d8e565109118 100644 --- a/libc/test/src/math/smoke/log2_test.cpp +++ b/libc/test/src/math/smoke/log2_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLog2Test = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/log_test.cpp b/libc/test/src/math/smoke/log_test.cpp index fd527dee50847c..e7897add575fad 100644 --- a/libc/test/src/math/smoke/log_test.cpp +++ b/libc/test/src/math/smoke/log_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcLogTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/powf_test.cpp b/libc/test/src/math/smoke/powf_test.cpp index 6aa1ac2b661be2..bd4f98e30fbdc7 100644 --- a/libc/test/src/math/smoke/powf_test.cpp +++ b/libc/test/src/math/smoke/powf_test.cpp @@ -12,7 +12,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcPowfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/sincosf_test.cpp b/libc/test/src/math/smoke/sincosf_test.cpp index 8c35953240d8da..e6896ca3dc21ac 100644 --- a/libc/test/src/math/smoke/sincosf_test.cpp +++ b/libc/test/src/math/smoke/sincosf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcSinCosfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/sinf_test.cpp b/libc/test/src/math/smoke/sinf_test.cpp index 9fc208dd545b2d..1bf6eaa8b78d7d 100644 --- a/libc/test/src/math/smoke/sinf_test.cpp +++ b/libc/test/src/math/smoke/sinf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcSinfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/sinhf_test.cpp b/libc/test/src/math/smoke/sinhf_test.cpp index 1e052988eb2862..635a10627a2109 100644 --- a/libc/test/src/math/smoke/sinhf_test.cpp +++ b/libc/test/src/math/smoke/sinhf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcSinhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/tanf_test.cpp b/libc/test/src/math/smoke/tanf_test.cpp index ab3f7c1aeb7e4e..b90c5da8741892 100644 --- a/libc/test/src/math/smoke/tanf_test.cpp +++ b/libc/test/src/math/smoke/tanf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/smoke/tanhf_test.cpp b/libc/test/src/math/smoke/tanhf_test.cpp index ddae021d2bc423..748e6fe8c62693 100644 --- a/libc/test/src/math/smoke/tanhf_test.cpp +++ b/libc/test/src/math/smoke/tanhf_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/FPMatcher.h" #include "test/UnitTest/Test.h" -#include #include using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/tanf_test.cpp b/libc/test/src/math/tanf_test.cpp index 9b9e1278cf5636..9061cf6fb30b82 100644 --- a/libc/test/src/math/tanf_test.cpp +++ b/libc/test/src/math/tanf_test.cpp @@ -15,7 +15,6 @@ #include "test/src/math/sdcomp26094.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcTanfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/math/tanhf_test.cpp b/libc/test/src/math/tanhf_test.cpp index 2e74984ad9549f..389abe4d858979 100644 --- a/libc/test/src/math/tanhf_test.cpp +++ b/libc/test/src/math/tanhf_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/Test.h" #include "utils/MPFRWrapper/MPFRUtils.h" -#include #include using LlvmLibcTanhfTest = LIBC_NAMESPACE::testing::FPTest; diff --git a/libc/test/src/pthread/CMakeLists.txt b/libc/test/src/pthread/CMakeLists.txt index 0eeec445d5f49c..2cb80e2b6ae2e9 100644 --- a/libc/test/src/pthread/CMakeLists.txt +++ b/libc/test/src/pthread/CMakeLists.txt @@ -7,7 +7,6 @@ add_libc_unittest( SRCS pthread_attr_test.cpp DEPENDS - libc.include.errno libc.include.pthread libc.src.pthread.pthread_attr_destroy libc.src.pthread.pthread_attr_init @@ -19,6 +18,7 @@ add_libc_unittest( libc.src.pthread.pthread_attr_setguardsize libc.src.pthread.pthread_attr_setstacksize libc.src.pthread.pthread_attr_setstack + libc.hdr.errno_macros ) add_libc_unittest( @@ -28,7 +28,6 @@ add_libc_unittest( SRCS pthread_mutexattr_test.cpp DEPENDS - libc.include.errno libc.include.pthread libc.src.pthread.pthread_mutexattr_destroy libc.src.pthread.pthread_mutexattr_init @@ -38,6 +37,7 @@ add_libc_unittest( libc.src.pthread.pthread_mutexattr_setpshared libc.src.pthread.pthread_mutexattr_setrobust libc.src.pthread.pthread_mutexattr_settype + libc.hdr.errno_macros ) add_libc_unittest( @@ -65,8 +65,8 @@ add_libc_unittest( SRCS pthread_rwlockattr_test.cpp DEPENDS - libc.include.errno libc.include.pthread + libc.src.errno.errno libc.src.pthread.pthread_rwlockattr_destroy libc.src.pthread.pthread_rwlockattr_getkind_np libc.src.pthread.pthread_rwlockattr_getpshared diff --git a/libc/test/src/pthread/pthread_attr_test.cpp b/libc/test/src/pthread/pthread_attr_test.cpp index 1af585a003e3b0..bee9a1ca4f893a 100644 --- a/libc/test/src/pthread/pthread_attr_test.cpp +++ b/libc/test/src/pthread/pthread_attr_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "hdr/errno_macros.h" #include "src/pthread/pthread_attr_destroy.h" #include "src/pthread/pthread_attr_getdetachstate.h" #include "src/pthread/pthread_attr_getguardsize.h" @@ -19,7 +20,6 @@ #include "test/UnitTest/Test.h" -#include #include // For EXEC_PAGESIZE. #include diff --git a/libc/test/src/pthread/pthread_mutexattr_test.cpp b/libc/test/src/pthread/pthread_mutexattr_test.cpp index a7acd580a6b8e5..7fbdd2efd9858e 100644 --- a/libc/test/src/pthread/pthread_mutexattr_test.cpp +++ b/libc/test/src/pthread/pthread_mutexattr_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "hdr/errno_macros.h" #include "src/pthread/pthread_mutexattr_destroy.h" #include "src/pthread/pthread_mutexattr_getpshared.h" #include "src/pthread/pthread_mutexattr_getrobust.h" @@ -15,8 +16,6 @@ #include "src/pthread/pthread_mutexattr_setrobust.h" #include "src/pthread/pthread_mutexattr_settype.h" #include "test/UnitTest/Test.h" - -#include #include TEST(LlvmLibcPThreadMutexAttrTest, InitAndDestroy) { diff --git a/libc/test/src/signal/CMakeLists.txt b/libc/test/src/signal/CMakeLists.txt index f7923204eaf499..87aa42faae8e5f 100644 --- a/libc/test/src/signal/CMakeLists.txt +++ b/libc/test/src/signal/CMakeLists.txt @@ -61,8 +61,8 @@ add_libc_unittest( SRCS sigaddset_test.cpp DEPENDS - libc.include.errno libc.include.signal + libc.src.errno.errno libc.src.signal.sigaddset libc.test.UnitTest.ErrnoSetterMatcher ) @@ -88,8 +88,8 @@ add_libc_unittest( SRCS sigfillset_test.cpp DEPENDS - libc.include.errno libc.include.signal + libc.src.errno.errno libc.src.signal.raise libc.src.signal.sigfillset libc.src.signal.sigprocmask @@ -103,8 +103,8 @@ add_libc_unittest( SRCS sigdelset_test.cpp DEPENDS - libc.include.errno libc.include.signal + libc.src.errno.errno libc.src.signal.raise libc.src.signal.sigdelset libc.src.signal.sigfillset diff --git a/libc/test/src/signal/sigaddset_test.cpp b/libc/test/src/signal/sigaddset_test.cpp index ac9334f4ff68c0..bc33750cf787d7 100644 --- a/libc/test/src/signal/sigaddset_test.cpp +++ b/libc/test/src/signal/sigaddset_test.cpp @@ -11,7 +11,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include // This tests invalid inputs and ensures errno is properly set. diff --git a/libc/test/src/signal/sigdelset_test.cpp b/libc/test/src/signal/sigdelset_test.cpp index aeae66f86bf886..622f1a32fbbe9a 100644 --- a/libc/test/src/signal/sigdelset_test.cpp +++ b/libc/test/src/signal/sigdelset_test.cpp @@ -14,7 +14,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include TEST(LlvmLibcSigdelset, Invalid) { diff --git a/libc/test/src/signal/sigfillset_test.cpp b/libc/test/src/signal/sigfillset_test.cpp index 7922b3a4e11902..0604bc2a95bf6f 100644 --- a/libc/test/src/signal/sigfillset_test.cpp +++ b/libc/test/src/signal/sigfillset_test.cpp @@ -13,7 +13,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include TEST(LlvmLibcSigfillset, Invalid) { diff --git a/libc/test/src/spawn/CMakeLists.txt b/libc/test/src/spawn/CMakeLists.txt index 39b63df1908494..ce246d4a1b7749 100644 --- a/libc/test/src/spawn/CMakeLists.txt +++ b/libc/test/src/spawn/CMakeLists.txt @@ -7,7 +7,6 @@ add_libc_unittest( SRCS posix_spawn_file_actions_test.cpp DEPENDS - libc.include.errno libc.include.spawn libc.src.spawn.file_actions libc.src.spawn.posix_spawn_file_actions_addclose @@ -15,4 +14,5 @@ add_libc_unittest( libc.src.spawn.posix_spawn_file_actions_addopen libc.src.spawn.posix_spawn_file_actions_destroy libc.src.spawn.posix_spawn_file_actions_init + libc.src.errno.errno ) diff --git a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp index 008167e07221f4..c1edf56bdbd87c 100644 --- a/libc/test/src/spawn/posix_spawn_file_actions_test.cpp +++ b/libc/test/src/spawn/posix_spawn_file_actions_test.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +#include "src/errno/libc_errno.h" #include "src/spawn/file_actions.h" #include "src/spawn/posix_spawn_file_actions_addclose.h" #include "src/spawn/posix_spawn_file_actions_adddup2.h" @@ -14,7 +15,6 @@ #include "src/spawn/posix_spawn_file_actions_init.h" #include "test/UnitTest/Test.h" -#include #include #include diff --git a/libc/test/src/sys/prctl/linux/CMakeLists.txt b/libc/test/src/sys/prctl/linux/CMakeLists.txt index 25e9b8fd8a0070..845452c9099eb1 100644 --- a/libc/test/src/sys/prctl/linux/CMakeLists.txt +++ b/libc/test/src/sys/prctl/linux/CMakeLists.txt @@ -8,7 +8,6 @@ add_libc_unittest( prctl_test.cpp DEPENDS libc.include.sys_prctl - libc.include.errno libc.src.sys.prctl.prctl libc.src.errno.errno ) diff --git a/libc/test/src/sys/prctl/linux/prctl_test.cpp b/libc/test/src/sys/prctl/linux/prctl_test.cpp index b528edc65595d8..987c35d5534707 100644 --- a/libc/test/src/sys/prctl/linux/prctl_test.cpp +++ b/libc/test/src/sys/prctl/linux/prctl_test.cpp @@ -9,7 +9,6 @@ #include "src/errno/libc_errno.h" #include "src/sys/prctl/prctl.h" #include "test/UnitTest/ErrnoSetterMatcher.h" -#include #include using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails; diff --git a/libc/test/src/sys/resource/CMakeLists.txt b/libc/test/src/sys/resource/CMakeLists.txt index 90dc0e846df6d9..32186de4b111be 100644 --- a/libc/test/src/sys/resource/CMakeLists.txt +++ b/libc/test/src/sys/resource/CMakeLists.txt @@ -9,9 +9,9 @@ add_libc_unittest( SRCS getrlimit_setrlimit_test.cpp DEPENDS - libc.include.errno libc.include.fcntl libc.include.sys_resource + libc.src.errno.errno libc.src.fcntl.open libc.src.sys.resource.getrlimit libc.src.sys.resource.setrlimit diff --git a/libc/test/src/sys/select/CMakeLists.txt b/libc/test/src/sys/select/CMakeLists.txt index c2d57052c38376..2b465d32c2c33e 100644 --- a/libc/test/src/sys/select/CMakeLists.txt +++ b/libc/test/src/sys/select/CMakeLists.txt @@ -8,8 +8,8 @@ add_libc_unittest( SRCS select_ui_test.cpp DEPENDS - libc.include.errno libc.include.unistd + libc.src.errno.errno libc.src.sys.select.select libc.src.unistd.read ) @@ -21,8 +21,8 @@ add_libc_unittest( SRCS select_failure_test.cpp DEPENDS - libc.include.errno libc.include.unistd + libc.src.errno.errno libc.src.sys.select.select libc.src.unistd.read libc.test.UnitTest.ErrnoSetterMatcher diff --git a/libc/test/src/sys/select/select_failure_test.cpp b/libc/test/src/sys/select/select_failure_test.cpp index 61df532b3e96cc..a4990bfd4b1b53 100644 --- a/libc/test/src/sys/select/select_failure_test.cpp +++ b/libc/test/src/sys/select/select_failure_test.cpp @@ -11,7 +11,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include #include diff --git a/libc/test/src/sys/sendfile/CMakeLists.txt b/libc/test/src/sys/sendfile/CMakeLists.txt index 57dac4accd8286..82efaa147bd89d 100644 --- a/libc/test/src/sys/sendfile/CMakeLists.txt +++ b/libc/test/src/sys/sendfile/CMakeLists.txt @@ -9,9 +9,9 @@ add_libc_unittest( SRCS sendfile_test.cpp DEPENDS - libc.include.errno libc.include.fcntl libc.include.sys_stat + libc.src.errno.errno libc.src.fcntl.open libc.src.sys.sendfile.sendfile libc.src.unistd.close diff --git a/libc/test/src/sys/utsname/CMakeLists.txt b/libc/test/src/sys/utsname/CMakeLists.txt index 435c190cc6212d..3640fc3bc5e251 100644 --- a/libc/test/src/sys/utsname/CMakeLists.txt +++ b/libc/test/src/sys/utsname/CMakeLists.txt @@ -7,8 +7,8 @@ add_libc_unittest( SRCS uname_test.cpp DEPENDS - libc.include.errno libc.include.sys_utsname + libc.src.errno.errno libc.src.__support.common libc.src.sys.utsname.uname libc.test.UnitTest.ErrnoSetterMatcher diff --git a/libc/test/src/sys/utsname/uname_test.cpp b/libc/test/src/sys/utsname/uname_test.cpp index 79822c112a5b6b..6452021bd6c358 100644 --- a/libc/test/src/sys/utsname/uname_test.cpp +++ b/libc/test/src/sys/utsname/uname_test.cpp @@ -12,7 +12,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include TEST(LlvmLibcUnameTest, GetMachineName) { diff --git a/libc/test/src/sys/wait/CMakeLists.txt b/libc/test/src/sys/wait/CMakeLists.txt index 4ba1a939d6a8e5..db737a46f0d0f3 100644 --- a/libc/test/src/sys/wait/CMakeLists.txt +++ b/libc/test/src/sys/wait/CMakeLists.txt @@ -7,8 +7,8 @@ add_libc_unittest( SRCS waitpid_test.cpp DEPENDS - libc.include.errno libc.include.sys_wait + libc.src.errno.errno libc.src.sys.wait.waitpid ) @@ -19,7 +19,7 @@ add_libc_unittest( SRCS wait4_test.cpp DEPENDS - libc.include.errno libc.include.sys_wait + libc.src.errno.errno libc.src.sys.wait.wait4 ) diff --git a/libc/test/src/sys/wait/wait4_test.cpp b/libc/test/src/sys/wait/wait4_test.cpp index 70d4d436927e6b..c4080047ee38f8 100644 --- a/libc/test/src/sys/wait/wait4_test.cpp +++ b/libc/test/src/sys/wait/wait4_test.cpp @@ -10,7 +10,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include // The test here is a simpl test for WNOHANG functionality. For a more diff --git a/libc/test/src/sys/wait/waitpid_test.cpp b/libc/test/src/sys/wait/waitpid_test.cpp index b2ace2617d2d3f..fb456bfaedc7df 100644 --- a/libc/test/src/sys/wait/waitpid_test.cpp +++ b/libc/test/src/sys/wait/waitpid_test.cpp @@ -10,7 +10,6 @@ #include "test/UnitTest/ErrnoSetterMatcher.h" #include "test/UnitTest/Test.h" -#include #include // The test here is a simpl test for WNOHANG functionality. For a more diff --git a/libc/test/src/unistd/CMakeLists.txt b/libc/test/src/unistd/CMakeLists.txt index 332455b791aee5..e03e56b3cf8ad7 100644 --- a/libc/test/src/unistd/CMakeLists.txt +++ b/libc/test/src/unistd/CMakeLists.txt @@ -39,7 +39,6 @@ add_libc_unittest( SRCS dup_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -58,7 +57,6 @@ add_libc_unittest( SRCS dup2_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -77,7 +75,6 @@ add_libc_unittest( SRCS dup3_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -96,7 +93,6 @@ add_libc_unittest( SRCS fchdir_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -112,7 +108,6 @@ add_libc_unittest( SRCS ftruncate_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -131,7 +126,6 @@ add_libc_unittest( SRCS pread_pwrite_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -151,7 +145,6 @@ add_libc_unittest( SRCS read_write_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -170,7 +163,6 @@ add_libc_unittest( SRCS link_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -186,7 +178,6 @@ add_libc_unittest( SRCS linkat_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -202,7 +193,6 @@ add_libc_unittest( SRCS lseek_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -219,7 +209,6 @@ add_libc_unittest( SRCS pipe_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.unistd.close @@ -234,7 +223,6 @@ add_libc_unittest( SRCS rmdir_test.cpp DEPENDS - libc.include.errno libc.include.fcntl libc.src.errno.errno libc.src.sys.stat.mkdir @@ -258,7 +246,6 @@ add_libc_unittest( SRCS readlink_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.unistd.readlink @@ -275,7 +262,6 @@ add_libc_unittest( SRCS readlinkat_test.cpp DEPENDS - libc.include.errno libc.include.fcntl libc.include.unistd libc.src.errno.errno @@ -293,7 +279,6 @@ add_libc_unittest( SRCS symlink_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -309,7 +294,6 @@ add_libc_unittest( SRCS symlinkat_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -325,7 +309,6 @@ add_libc_unittest( SRCS truncate_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -344,7 +327,6 @@ add_libc_unittest( SRCS unlink_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -359,7 +341,6 @@ add_libc_unittest( SRCS unlinkat_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.src.errno.errno libc.src.fcntl.open @@ -428,10 +409,10 @@ add_libc_unittest( SRCS syscall_test.cpp DEPENDS - libc.include.errno libc.include.unistd libc.include.fcntl libc.include.sys_syscall + libc.src.errno.errno libc.src.unistd.__llvm_libc_syscall libc.test.UnitTest.ErrnoSetterMatcher )