aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2024-07-02 08:24:03 -0700
committerPaul Kirth <paulkirth@google.com>2024-07-02 08:24:03 -0700
commit803a88c3bcf182072533186d3bb07716fe8ea8cd (patch)
tree3859a561fed884f6981ca1a071f6123b984a3d39
parent9bfd2224f4d783ffe74ded69c4f8d15a70df5608 (diff)
parentac7b1d0cf1ff30183bb9487fbfef3c4e48bbbf53 (diff)
downloadllvm-users/ilovepi/spr/reapply-llvmriscv-enable-trailing-fences-for-seq-cst-stores-by-default-87376.zip
llvm-users/ilovepi/spr/reapply-llvmriscv-enable-trailing-fences-for-seq-cst-stores-by-default-87376.tar.gz
llvm-users/ilovepi/spr/reapply-llvmriscv-enable-trailing-fences-for-seq-cst-stores-by-default-87376.tar.bz2
Created using spr 1.3.4
-rw-r--r--bolt/include/bolt/Rewrite/DWARFRewriter.h3
-rw-r--r--bolt/lib/Core/BinaryContext.cpp4
-rw-r--r--bolt/lib/Rewrite/DWARFRewriter.cpp5
-rw-r--r--bolt/lib/Rewrite/RewriteInstance.cpp6
-rw-r--r--clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp21
-rw-r--r--clang-tools-extra/docs/ReleaseNotes.rst8
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-2.c12
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-any-pointer.cpp76
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-warn-on-sizeof-pointer-to-aggregate.cpp2
-rw-r--r--clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp74
-rw-r--r--clang/docs/ClangFormatStyleOptions.rst23
-rw-r--r--clang/docs/ReleaseNotes.rst21
-rw-r--r--clang/docs/UsersManual.rst10
-rw-r--r--clang/docs/tools/clang-formatted-files.txt1
-rw-r--r--clang/include/clang/AST/Redeclarable.h4
-rw-r--r--clang/include/clang/AST/TemplateName.h3
-rw-r--r--clang/include/clang/Basic/DiagnosticGroups.td7
-rw-r--r--clang/include/clang/Basic/DiagnosticParseKinds.td9
-rw-r--r--clang/include/clang/Basic/DiagnosticSemaKinds.td15
-rw-r--r--clang/include/clang/Basic/LangOptions.def1
-rw-r--r--clang/include/clang/Basic/LangStandard.h28
-rw-r--r--clang/include/clang/Basic/LangStandards.def9
-rw-r--r--clang/include/clang/Driver/ToolChain.h3
-rw-r--r--clang/include/clang/Format/Format.h35
-rw-r--r--clang/lib/AST/Interp/Compiler.cpp42
-rw-r--r--clang/lib/AST/Interp/Compiler.h6
-rw-r--r--clang/lib/AST/Interp/Interp.h7
-rw-r--r--clang/lib/AST/Interp/Opcodes.td1
-rw-r--r--clang/lib/Basic/LangOptions.cpp1
-rw-r--r--clang/lib/Basic/OpenMPKinds.cpp176
-rw-r--r--clang/lib/Basic/Targets/NVPTX.h1
-rw-r--r--clang/lib/CodeGen/CGDeclCXX.cpp4
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp43
-rw-r--r--clang/lib/Driver/ToolChain.cpp6
-rw-r--r--clang/lib/Driver/ToolChains/BareMetal.cpp56
-rw-r--r--clang/lib/Driver/ToolChains/Linux.cpp10
-rw-r--r--clang/lib/Format/Format.cpp5
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp9
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp4
-rw-r--r--clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp37
-rw-r--r--clang/lib/Interpreter/CMakeLists.txt6
-rw-r--r--clang/lib/Interpreter/IncrementalExecutor.cpp2
-rw-r--r--clang/lib/Interpreter/IncrementalExecutor.h11
-rw-r--r--clang/lib/Interpreter/Interpreter.cpp13
-rw-r--r--clang/lib/Interpreter/Wasm.cpp114
-rw-r--r--clang/lib/Interpreter/Wasm.h37
-rw-r--r--clang/lib/Parse/ParseExpr.cpp3
-rw-r--r--clang/lib/Sema/CheckExprLifetime.cpp69
-rw-r--r--clang/lib/Sema/SemaExpr.cpp15
-rw-r--r--clang/lib/Sema/SemaOverload.cpp52
-rw-r--r--clang/test/AST/Interp/c.c8
-rw-r--r--clang/test/AST/Interp/literals.cpp23
-rw-r--r--clang/test/C/C2y/n3192.c43
-rw-r--r--clang/test/C/C2y/n3259.c66
-rw-r--r--clang/test/C/C2y/n3260.c16
-rw-r--r--clang/test/C/C2y/n3273.c14
-rw-r--r--clang/test/C/C99/n809.c8
-rw-r--r--clang/test/CXX/drs/cwg26xx.cpp3
-rw-r--r--clang/test/CXX/expr/expr.post/expr.type.conv/p1.cpp2
-rw-r--r--clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp5
-rw-r--r--clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp12
-rw-r--r--clang/test/Driver/Inputs/basic_baremetal_tree/bin/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/c++/v1/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_baremetal_tree/include/c++/v1/.keep0
-rw-r--r--clang/test/Driver/Inputs/basic_baremetal_tree/lib/armv6m-unknown-none-eabi/.keep0
-rw-r--r--clang/test/Driver/baremetal.cpp16
-rw-r--r--clang/test/Driver/unknown-std.c2
-rw-r--r--clang/test/Misc/warning-flags.c2
-rw-r--r--clang/test/Modules/pr97244.cppm30
-rw-r--r--clang/test/Modules/pr97313.cppm118
-rw-r--r--clang/test/Modules/template_name_lookup.cpp2
-rw-r--r--clang/test/PCH/cxx-explicit-specifier.cpp4
-rw-r--r--clang/test/Parser/generic-selection-type-extension-pedantic.c2
-rw-r--r--clang/test/Preprocessor/c2y.c6
-rw-r--r--clang/test/Sema/complex-inc-dec.c24
-rw-r--r--clang/test/Sema/tls_alignment.cpp4
-rw-r--r--clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp12
-rw-r--r--clang/test/SemaCXX/cxx20-ctad-type-alias.cpp21
-rw-r--r--clang/test/SemaCXX/cxx2a-explicit-bool.cpp4
-rw-r--r--clang/test/SemaCXX/gh65522.cpp6
-rw-r--r--clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp4
-rw-r--r--clang/test/SemaCXX/lookup-template-name-extern-CXX.cpp6
-rw-r--r--clang/test/SemaCXX/warn-dangling-local.cpp11
-rw-r--r--clang/test/SemaTemplate/aggregate-deduction-candidate.cpp24
-rw-r--r--clang/test/SemaTemplate/class-template-id.cpp2
-rw-r--r--clang/test/SemaTemplate/ctad.cpp12
-rw-r--r--clang/test/SemaTemplate/deduction-crash.cpp3
-rw-r--r--clang/test/SemaTemplate/deduction-guide.cpp12
-rw-r--r--clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp3
-rw-r--r--clang/test/SemaTemplate/temp_arg.cpp4
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp21
-rw-r--r--clang/unittests/Format/FormatTest.cpp109
-rw-r--r--clang/www/c_status.html5
-rw-r--r--compiler-rt/lib/asan/asan_suppressions.cpp3
-rw-r--r--compiler-rt/lib/sanitizer_common/sancov_flags.cpp6
-rw-r--r--flang/include/flang/Optimizer/Builder/FIRBuilder.h4
-rw-r--r--flang/include/flang/Optimizer/CodeGen/FIROpPatterns.h12
-rw-r--r--flang/include/flang/Optimizer/CodeGen/TypeConverter.h2
-rw-r--r--flang/include/flang/Optimizer/Dialect/FIROps.td24
-rw-r--r--flang/include/flang/Optimizer/Dialect/FirAliasTagOpInterface.h4
-rw-r--r--flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td2
-rw-r--r--flang/include/flang/Optimizer/Dialect/Support/KindMapping.h2
-rw-r--r--flang/include/flang/Optimizer/HLFIR/HLFIROps.td8
-rw-r--r--flang/include/flang/Optimizer/Support/InternalNames.h6
-rw-r--r--flang/include/flang/Optimizer/Support/Utils.h23
-rw-r--r--flang/lib/Lower/Bridge.cpp119
-rw-r--r--flang/lib/Lower/ConvertProcedureDesignator.cpp8
-rw-r--r--flang/lib/Optimizer/Builder/FIRBuilder.cpp17
-rw-r--r--flang/lib/Optimizer/CodeGen/CodeGen.cpp138
-rw-r--r--flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp2
-rw-r--r--flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp14
-rw-r--r--flang/lib/Optimizer/CodeGen/TargetRewrite.cpp2
-rw-r--r--flang/lib/Optimizer/CodeGen/TypeConverter.cpp2
-rw-r--r--flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp14
-rw-r--r--flang/lib/Optimizer/Dialect/FIROps.cpp87
-rw-r--r--flang/lib/Optimizer/Dialect/FIRType.cpp22
-rw-r--r--flang/lib/Optimizer/Dialect/FirAliasTagOpInterface.cpp6
-rw-r--r--flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp2
-rw-r--r--flang/lib/Optimizer/Dialect/Support/KindMapping.cpp4
-rw-r--r--flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp84
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp27
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp18
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp2
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp13
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp8
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp16
-rw-r--r--flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp2
-rw-r--r--flang/lib/Optimizer/Support/CMakeLists.txt2
-rw-r--r--flang/lib/Optimizer/Support/InternalNames.cpp9
-rw-r--r--flang/lib/Optimizer/Support/Utils.cpp52
-rw-r--r--flang/lib/Optimizer/Transforms/AbstractResult.cpp10
-rw-r--r--flang/lib/Optimizer/Transforms/AffineDemotion.cpp4
-rw-r--r--flang/lib/Optimizer/Transforms/AffinePromotion.cpp4
-rw-r--r--flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp14
-rw-r--r--flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp4
-rw-r--r--flang/lib/Optimizer/Transforms/CharacterConversion.cpp2
-rw-r--r--flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp2
-rw-r--r--flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp6
-rw-r--r--flang/lib/Optimizer/Transforms/MemoryAllocation.cpp2
-rw-r--r--flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp14
-rw-r--r--flang/lib/Optimizer/Transforms/StackArrays.cpp9
-rw-r--r--flang/lib/Semantics/resolve-directives.cpp56
-rw-r--r--flang/test/Fir/fir-ops.fir7
-rw-r--r--flang/test/Lower/HLFIR/procedure-pointer.f904
-rw-r--r--flang/test/Lower/HLFIR/type-info-components.f9055
-rw-r--r--flang/test/Lower/dummy-procedure-character.f904
-rw-r--r--flang/test/Semantics/OpenMP/doconcurrent01.f9017
-rw-r--r--flang/tools/bbc/bbc.cpp4
-rw-r--r--flang/tools/tco/tco.cpp2
-rw-r--r--libc/config/linux/aarch64/entrypoints.txt2
-rw-r--r--libc/config/linux/x86_64/entrypoints.txt2
-rw-r--r--libc/docs/math/index.rst4
-rw-r--r--libc/newhdrgen/yaml_to_classes.py96
-rw-r--r--libc/spec/llvm_libc_ext.td4
-rw-r--r--libc/src/__support/FPUtil/generic/CMakeLists.txt19
-rw-r--r--libc/src/__support/FPUtil/generic/add_sub.h206
-rw-r--r--libc/src/math/CMakeLists.txt4
-rw-r--r--libc/src/math/f16addf.h20
-rw-r--r--libc/src/math/f16subf.h20
-rw-r--r--libc/src/math/generic/CMakeLists.txt26
-rw-r--r--libc/src/math/generic/f16addf.cpp19
-rw-r--r--libc/src/math/generic/f16subf.cpp19
-rw-r--r--libc/test/src/math/AddTest.h74
-rw-r--r--libc/test/src/math/CMakeLists.txt38
-rw-r--r--libc/test/src/math/FMulTest.h121
-rw-r--r--libc/test/src/math/SubTest.h74
-rw-r--r--libc/test/src/math/f16addf_test.cpp13
-rw-r--r--libc/test/src/math/f16subf_test.cpp13
-rw-r--r--libc/test/src/math/fmul_test.cpp13
-rw-r--r--libc/test/src/math/smoke/AddTest.h156
-rw-r--r--libc/test/src/math/smoke/CMakeLists.txt29
-rw-r--r--libc/test/src/math/smoke/SubTest.h158
-rw-r--r--libc/test/src/math/smoke/f16addf_test.cpp13
-rw-r--r--libc/test/src/math/smoke/f16subf_test.cpp13
-rw-r--r--libc/utils/MPFRWrapper/MPFRUtils.cpp31
-rw-r--r--libc/utils/MPFRWrapper/MPFRUtils.h21
-rw-r--r--libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp22
-rw-r--r--lldb/source/Commands/CMakeLists.txt2
-rw-r--r--lldb/source/Commands/CommandObjectScript.cpp113
-rw-r--r--lldb/source/Commands/CommandObjectScript.h42
-rw-r--r--lldb/source/Commands/CommandObjectScripting.cpp144
-rw-r--r--lldb/source/Commands/CommandObjectScripting.h25
-rw-r--r--lldb/source/Commands/Options.td2
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp13
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp27
-rw-r--r--lldb/source/Utility/Listener.cpp2
-rw-r--r--lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py2
-rw-r--r--lldb/test/API/functionalities/abbreviation/TestAbbreviations.py8
-rw-r--r--lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp2
-rw-r--r--llvm/CMakeLists.txt19
-rw-r--r--llvm/docs/CommandGuide/FileCheck.rst2
-rw-r--r--llvm/docs/LangRef.rst1
-rw-r--r--llvm/include/llvm/IR/IRBuilder.h8
-rw-r--r--llvm/include/llvm/IR/PassManagerImpl.h24
-rw-r--r--llvm/include/llvm/MC/MCAsmBackend.h4
-rw-r--r--llvm/include/llvm/MC/MCAsmLayout.h31
-rw-r--r--llvm/include/llvm/MC/MCAssembler.h13
-rw-r--r--llvm/include/llvm/MC/MCCodeView.h6
-rw-r--r--llvm/include/llvm/MC/MCExpr.h15
-rw-r--r--llvm/include/llvm/MC/MCFragment.h1
-rw-r--r--llvm/include/llvm/MC/MCLinkerOptimizationHint.h22
-rw-r--r--llvm/include/llvm/MC/MCMachObjectWriter.h4
-rw-r--r--llvm/include/llvm/MC/MCObjectWriter.h1
-rw-r--r--llvm/include/llvm/Support/LogicalResult.h128
-rw-r--r--llvm/include/llvm/TargetParser/RISCVISAInfo.h2
-rw-r--r--llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp1
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp8
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp4
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp2
-rw-r--r--llvm/lib/CodeGen/MIRPrinter.cpp6
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp3
-rw-r--r--llvm/lib/CodeGen/MachineSSAUpdater.cpp8
-rw-r--r--llvm/lib/CodeGen/MachineScheduler.cpp2
-rw-r--r--llvm/lib/CodeGen/ScheduleDAGInstrs.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp2
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp6
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp2
-rw-r--r--llvm/lib/CodeGen/TargetInstrInfo.cpp4
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp3
-rw-r--r--llvm/lib/MC/GOFFObjectWriter.cpp1
-rw-r--r--llvm/lib/MC/MCAssembler.cpp41
-rw-r--r--llvm/lib/MC/MCCodeView.cpp25
-rw-r--r--llvm/lib/MC/MCDXContainerWriter.cpp1
-rw-r--r--llvm/lib/MC/MCExpr.cpp34
-rw-r--r--llvm/lib/MC/MCLinkerOptimizationHint.cpp22
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp27
-rw-r--r--llvm/lib/MC/WasmObjectWriter.cpp60
-rw-r--r--llvm/lib/MC/WinCOFFObjectWriter.cpp22
-rw-r--r--llvm/lib/MC/XCOFFObjectWriter.cpp45
-rw-r--r--llvm/lib/Target/AArch64/AArch64ISelLowering.cpp20
-rw-r--r--llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp36
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp8
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h4
-rw-r--r--llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp23
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPU.td1
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp7
-rw-r--r--llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.cpp35
-rw-r--r--llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h10
-rw-r--r--llvm/lib/Target/AMDGPU/SIInstructions.td15
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp1
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h3
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp9
-rw-r--r--llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp9
-rw-r--r--llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.h2
-rw-r--r--llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp1
-rw-r--r--llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp5
-rw-r--r--llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h2
-rw-r--r--llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp4
-rw-r--r--llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp4
-rw-r--r--llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h2
-rw-r--r--llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp4
-rw-r--r--llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h2
-rw-r--r--llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp19
-rw-r--r--llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp2
-rw-r--r--llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h2
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp12
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h3
-rw-r--r--llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp3
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp68
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h3
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp88
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXISelLowering.h8
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp2
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXInstrInfo.td12
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXMCExpr.h6
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp4
-rw-r--r--llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td3
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp12
-rw-r--r--llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h4
-rw-r--r--llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp14
-rw-r--r--llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp3
-rw-r--r--llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h2
-rw-r--r--llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp7
-rw-r--r--llvm/lib/Target/RISCV/RISCVTargetMachine.cpp5
-rw-r--r--llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp9
-rw-r--r--llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h3
-rw-r--r--llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp4
-rw-r--r--llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h2
-rw-r--r--llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp5
-rw-r--r--llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h2
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssembly.td12
-rw-r--r--llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp6
-rw-r--r--llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h2
-rw-r--r--llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp19
-rw-r--r--llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp4
-rw-r--r--llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h2
-rw-r--r--llvm/lib/TargetParser/RISCVISAInfo.cpp83
-rw-r--r--llvm/lib/Transforms/IPO/AlwaysInliner.cpp123
-rw-r--r--llvm/lib/Transforms/IPO/AttributorAttributes.cpp25
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp25
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineInternal.h7
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp84
-rw-r--r--llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp17
-rw-r--r--llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp35
-rw-r--r--llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp14
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyIndVar.cpp3
-rw-r--r--llvm/lib/Transforms/Utils/SplitModule.cpp25
-rw-r--r--llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp4
-rw-r--r--llvm/llvm.spec.in68
-rw-r--r--llvm/test/Analysis/ValueTracking/phi-known-bits.ll7
-rw-r--r--llvm/test/CodeGen/AArch64/popcount.ll312
-rw-r--r--llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll48
-rw-r--r--llvm/test/CodeGen/AMDGPU/global_atomics_optimizer_fp_no_rtn.ll32
-rw-r--r--llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmax.ll192
-rw-r--r--llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmin.ll192
-rw-r--r--llvm/test/CodeGen/AMDGPU/trunc-store.ll416
-rw-r--r--llvm/test/CodeGen/NVPTX/inline-asm-b128-test1.ll148
-rw-r--r--llvm/test/CodeGen/NVPTX/inline-asm-b128-test2.ll122
-rw-r--r--llvm/test/CodeGen/NVPTX/inline-asm-b128-test3.ll67
-rw-r--r--llvm/test/CodeGen/RISCV/O3-pipeline.ll2
-rw-r--r--llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll33
-rw-r--r--llvm/test/CodeGen/WebAssembly/call-indirect.ll2
-rw-r--r--llvm/test/CodeGen/WebAssembly/function-pointer64.ll4
-rw-r--r--llvm/test/CodeGen/WebAssembly/reg-stackify.ll2
-rw-r--r--llvm/test/CodeGen/WebAssembly/swiftcc.ll8
-rw-r--r--llvm/test/CodeGen/WebAssembly/target-features-cpus.ll39
-rw-r--r--llvm/test/MC/WebAssembly/function-alias.ll2
-rw-r--r--llvm/test/MC/WebAssembly/no-dead-strip.ll5
-rw-r--r--llvm/test/Transforms/Attributor/phi_bug_pointer_info.ll41
-rw-r--r--llvm/test/Transforms/CorrelatedValuePropagation/uscmp.ll258
-rw-r--r--llvm/test/Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll182
-rw-r--r--llvm/test/Transforms/Inline/always-inline-phase-ordering.ll1
-rw-r--r--llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-comb-no-active-lanes-stores.ll310
-rw-r--r--llvm/test/Transforms/InstCombine/known-bits.ll28
-rw-r--r--llvm/test/Transforms/InstCombine/ldexp.ll128
-rw-r--r--llvm/test/Transforms/PhaseOrdering/generate-fabs.ll29
-rw-r--r--llvm/test/Transforms/SLPVectorizer/AArch64/uselistorder.ll43
-rw-r--r--llvm/test/Transforms/SROA/propagate-fast-math-flags-on-phi.ll79
-rw-r--r--llvm/tools/dsymutil/MachOUtils.cpp4
-rw-r--r--llvm/utils/gn/secondary/lldb/source/Commands/BUILD.gn2
-rw-r--r--llvm/utils/gn/secondary/llvm/lib/SandboxIR/BUILD.gn8
-rw-r--r--llvm/utils/gn/secondary/llvm/unittests/BUILD.gn1
-rw-r--r--llvm/utils/gn/secondary/llvm/unittests/SandboxIR/BUILD.gn10
-rw-r--r--mlir/cmake/modules/AddMLIRPython.cmake17
-rw-r--r--mlir/docs/PDLL.md14
-rw-r--r--mlir/docs/Tutorials/Toy/Ch-2.md6
-rw-r--r--mlir/docs/Tutorials/Toy/Ch-3.md6
-rw-r--r--mlir/docs/Tutorials/Toy/Ch-5.md2
-rw-r--r--mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp1
-rw-r--r--mlir/examples/standalone/standalone-translate/standalone-translate.cpp3
-rw-r--r--mlir/examples/toy/Ch2/mlir/Dialect.cpp7
-rw-r--r--mlir/examples/toy/Ch2/mlir/MLIRGen.cpp9
-rw-r--r--mlir/examples/toy/Ch3/mlir/Dialect.cpp7
-rw-r--r--mlir/examples/toy/Ch3/mlir/MLIRGen.cpp9
-rw-r--r--mlir/examples/toy/Ch3/mlir/ToyCombine.cpp3
-rw-r--r--mlir/examples/toy/Ch3/toyc.cpp1
-rw-r--r--mlir/examples/toy/Ch4/mlir/Dialect.cpp7
-rw-r--r--mlir/examples/toy/Ch4/mlir/MLIRGen.cpp9
-rw-r--r--mlir/examples/toy/Ch4/mlir/ToyCombine.cpp3
-rw-r--r--mlir/examples/toy/Ch4/toyc.cpp1
-rw-r--r--mlir/examples/toy/Ch5/mlir/Dialect.cpp7
-rw-r--r--mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp1
-rw-r--r--mlir/examples/toy/Ch5/mlir/MLIRGen.cpp9
-rw-r--r--mlir/examples/toy/Ch5/mlir/ToyCombine.cpp3
-rw-r--r--mlir/examples/toy/Ch5/toyc.cpp1
-rw-r--r--mlir/examples/toy/Ch6/mlir/Dialect.cpp7
-rw-r--r--mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp1
-rw-r--r--mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp1
-rw-r--r--mlir/examples/toy/Ch6/mlir/MLIRGen.cpp9
-rw-r--r--mlir/examples/toy/Ch6/mlir/ToyCombine.cpp3
-rw-r--r--mlir/examples/toy/Ch6/toyc.cpp1
-rw-r--r--mlir/examples/toy/Ch7/mlir/Dialect.cpp13
-rw-r--r--mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp1
-rw-r--r--mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp1
-rw-r--r--mlir/examples/toy/Ch7/mlir/MLIRGen.cpp11
-rw-r--r--mlir/examples/toy/Ch7/mlir/ToyCombine.cpp3
-rw-r--r--mlir/examples/toy/Ch7/toyc.cpp1
-rw-r--r--mlir/examples/transform-opt/mlir-transform-opt.cpp10
-rw-r--r--mlir/examples/transform/Ch4/lib/MyExtension.cpp2
-rw-r--r--mlir/include/mlir/Analysis/FlatLinearValueConstraints.h1
-rw-r--r--mlir/include/mlir/Bytecode/BytecodeImplementation.h1
-rw-r--r--mlir/include/mlir/Bytecode/BytecodeOpInterface.h1
-rw-r--r--mlir/include/mlir/Bytecode/BytecodeReader.h1
-rw-r--r--mlir/include/mlir/Bytecode/BytecodeReaderConfig.h1
-rw-r--r--mlir/include/mlir/CAPI/Support.h6
-rw-r--r--mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h1
-rw-r--r--mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h1
-rw-r--r--mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h1
-rw-r--r--mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h1
-rw-r--r--mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h1
-rw-r--r--mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h1
-rw-r--r--mlir/include/mlir/Debug/CLOptionsSetup.h1
-rw-r--r--mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h2
-rw-r--r--mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h1
-rw-r--r--mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h2
-rw-r--r--mlir/include/mlir/Dialect/Affine/LoopUtils.h1
-rw-r--r--mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h1
-rw-r--r--mlir/include/mlir/Dialect/Affine/Utils.h2
-rw-r--r--mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h1
-rw-r--r--mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td8
-rw-r--r--mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h19
-rw-r--r--mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td4
-rw-r--r--mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h1
-rw-r--r--mlir/include/mlir/Dialect/GPU/Transforms/Utils.h1
-rw-r--r--mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h1
-rw-r--r--mlir/include/mlir/Dialect/IRDL/IR/IRDLTraits.h1
-rw-r--r--mlir/include/mlir/Dialect/IRDL/IRDLLoading.h7
-rw-r--r--mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h1
-rw-r--r--mlir/include/mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h1
-rw-r--r--mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h1
-rw-r--r--mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h1
-rw-r--r--mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h2
-rw-r--r--mlir/include/mlir/Dialect/Mesh/Transforms/Spmdization.h1
-rw-r--r--mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h3
-rw-r--r--mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td24
-rw-r--r--mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h1
-rw-r--r--mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h2
-rw-r--r--mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h2
-rw-r--r--mlir/include/mlir/Dialect/SCF/Utils/Utils.h1
-rw-r--r--mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td2
-rw-r--r--mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h3
-rw-r--r--mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td2
-rw-r--r--mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h1
-rw-r--r--mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h1
-rw-r--r--mlir/include/mlir/ExecutionEngine/JitRunner.h6
-rw-r--r--mlir/include/mlir/IR/Action.h1
-rw-r--r--mlir/include/mlir/IR/AffineExpr.h1
-rw-r--r--mlir/include/mlir/IR/AffineExprVisitor.h2
-rw-r--r--mlir/include/mlir/IR/AffineMap.h1
-rw-r--r--mlir/include/mlir/IR/BuiltinAttributeInterfaces.h1
-rw-r--r--mlir/include/mlir/IR/BuiltinAttributeInterfaces.td2
-rw-r--r--mlir/include/mlir/IR/Diagnostics.h1
-rw-r--r--mlir/include/mlir/IR/Dialect.h3
-rw-r--r--mlir/include/mlir/IR/EnumAttr.td4
-rw-r--r--mlir/include/mlir/IR/ExtensibleDialect.h1
-rw-r--r--mlir/include/mlir/IR/OperationSupport.h1
-rw-r--r--mlir/include/mlir/IR/StorageUniquerSupport.h1
-rw-r--r--mlir/include/mlir/IR/SymbolInterfaces.td4
-rw-r--r--mlir/include/mlir/IR/TensorEncoding.td2
-rw-r--r--mlir/include/mlir/IR/Verifier.h3
-rw-r--r--mlir/include/mlir/IR/Visitors.h1
-rw-r--r--mlir/include/mlir/InitAllPasses.h2
-rw-r--r--mlir/include/mlir/Interfaces/DataLayoutInterfaces.td10
-rw-r--r--mlir/include/mlir/Interfaces/FoldInterfaces.h1
-rw-r--r--mlir/include/mlir/Interfaces/FunctionInterfaces.td4
-rw-r--r--mlir/include/mlir/Interfaces/InferTypeOpInterface.td20
-rw-r--r--mlir/include/mlir/Interfaces/LoopLikeInterface.td2
-rw-r--r--mlir/include/mlir/Interfaces/MemorySlotInterfaces.td6
-rw-r--r--mlir/include/mlir/Interfaces/TilingInterface.td20
-rw-r--r--mlir/include/mlir/Pass/Pass.h1
-rw-r--r--mlir/include/mlir/Pass/PassManager.h1
-rw-r--r--mlir/include/mlir/Pass/PassOptions.h1
-rw-r--r--mlir/include/mlir/Query/Query.h13
-rw-r--r--mlir/include/mlir/Reducer/ReductionNode.h1
-rw-r--r--mlir/include/mlir/Support/LLVM.h14
-rw-r--r--mlir/include/mlir/Support/LogicalResult.h127
-rw-r--r--mlir/include/mlir/Support/StorageUniquer.h1
-rw-r--r--mlir/include/mlir/Support/ToolUtilities.h2
-rw-r--r--mlir/include/mlir/Target/Cpp/CppEmitter.h1
-rw-r--r--mlir/include/mlir/Target/LLVM/ROCDL/Utils.h1
-rw-r--r--mlir/include/mlir/Target/LLVMIR/LLVMImportInterface.h1
-rw-r--r--mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h1
-rw-r--r--mlir/include/mlir/Target/SPIRV/Serialization.h1
-rw-r--r--mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h1
-rw-r--r--mlir/include/mlir/Tools/PDLL/CodeGen/MLIRGen.h2
-rw-r--r--mlir/include/mlir/Tools/PDLL/Parser/Parser.h2
-rw-r--r--mlir/include/mlir/Tools/lsp-server-support/CompilationDatabase.h1
-rw-r--r--mlir/include/mlir/Tools/lsp-server-support/Protocol.h3
-rw-r--r--mlir/include/mlir/Tools/lsp-server-support/Transport.h1
-rw-r--r--mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h9
-rw-r--r--mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h1
-rw-r--r--mlir/include/mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h6
-rw-r--r--mlir/include/mlir/Tools/mlir-query/MlirQueryMain.h2
-rw-r--r--mlir/include/mlir/Tools/mlir-reduce/MlirReduceMain.h2
-rw-r--r--mlir/include/mlir/Tools/mlir-translate/MlirTranslateMain.h2
-rw-r--r--mlir/include/mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h7
-rw-r--r--mlir/include/mlir/Transforms/HomomorphismSimplification.h1
-rw-r--r--mlir/include/mlir/Transforms/Inliner.h1
-rw-r--r--mlir/include/mlir/Transforms/LocationSnapshot.h1
-rw-r--r--mlir/include/mlir/Transforms/SROA.h2
-rw-r--r--mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp1
-rw-r--r--mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp1
-rw-r--r--mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp1
-rw-r--r--mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp1
-rw-r--r--mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp1
-rw-r--r--mlir/lib/Analysis/DataFlowFramework.cpp1
-rw-r--r--mlir/lib/Analysis/FlatLinearValueConstraints.cpp1
-rw-r--r--mlir/lib/AsmParser/AffineParser.cpp1
-rw-r--r--mlir/lib/AsmParser/AsmParserState.cpp1
-rw-r--r--mlir/lib/AsmParser/DialectSymbolParser.cpp1
-rw-r--r--mlir/lib/AsmParser/LocationParser.cpp1
-rw-r--r--mlir/lib/AsmParser/Parser.cpp1
-rw-r--r--mlir/lib/AsmParser/TypeParser.cpp1
-rw-r--r--mlir/lib/Bytecode/Reader/BytecodeReader.cpp1
-rw-r--r--mlir/lib/Bytecode/Writer/BytecodeWriter.cpp1
-rw-r--r--mlir/lib/CAPI/IR/BuiltinTypes.cpp1
-rw-r--r--mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp1
-rw-r--r--mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp1
-rw-r--r--mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp1
-rw-r--r--mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp1
-rw-r--r--mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp1
-rw-r--r--mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp1
-rw-r--r--mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp1
-rw-r--r--mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp1
-rw-r--r--mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp1
-rw-r--r--mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp1
-rw-r--r--mlir/lib/Conversion/TensorToLinalg/TensorToLinalg.cpp1
-rw-r--r--mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp1
-rw-r--r--mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp1
-rw-r--r--mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp1
-rw-r--r--mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp1
-rw-r--r--mlir/lib/Dialect/Arith/IR/ArithOps.cpp1
-rw-r--r--mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp1
-rw-r--r--mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp1
-rw-r--r--mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp1
-rw-r--r--mlir/lib/Dialect/ArmNeon/Transforms/LowerContractionToSMMLAPattern.cpp1
-rw-r--r--mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp1
-rw-r--r--mlir/lib/Dialect/GPU/IR/GPUDialect.cpp1
-rw-r--r--mlir/lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp3
-rw-r--r--mlir/lib/Dialect/GPU/Transforms/ModuleToBinary.cpp15
-rw-r--r--mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp1
-rw-r--r--mlir/lib/Dialect/IRDL/IR/IRDL.cpp1
-rw-r--r--mlir/lib/Dialect/IRDL/IRDLLoading.cpp1
-rw-r--r--mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp1
-rw-r--r--mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp1
-rw-r--r--mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp1
-rw-r--r--mlir/lib/Dialect/Linalg/Transforms/MeshShardingInterfaceImpl.cpp1
-rw-r--r--mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp1
-rw-r--r--mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp1
-rw-r--r--mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp1
-rw-r--r--mlir/lib/Dialect/Mesh/IR/MeshOps.cpp1
-rw-r--r--mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp1
-rw-r--r--mlir/lib/Dialect/Mesh/Transforms/ShardingPropagation.cpp1
-rw-r--r--mlir/lib/Dialect/Mesh/Transforms/Simplifications.cpp1
-rw-r--r--mlir/lib/Dialect/Mesh/Transforms/Spmdization.cpp1
-rw-r--r--mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp1
-rw-r--r--mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp3
-rw-r--r--mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp1
-rw-r--r--mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp1
-rw-r--r--mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp1
-rw-r--r--mlir/lib/Dialect/Polynomial/IR/PolynomialDialect.cpp1
-rw-r--r--mlir/lib/Dialect/Polynomial/IR/PolynomialOps.cpp1
-rw-r--r--mlir/lib/Dialect/Quant/IR/QuantDialectBytecode.cpp1
-rw-r--r--mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp1
-rw-r--r--mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp1
-rw-r--r--mlir/lib/Dialect/Tosa/IR/TosaOps.cpp2
-rw-r--r--mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp1
-rw-r--r--mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorBitCast.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorInterleave.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp1
-rw-r--r--mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp1
-rw-r--r--mlir/lib/IR/AffineMap.cpp1
-rw-r--r--mlir/lib/IR/ExtensibleDialect.cpp1
-rw-r--r--mlir/lib/Query/Query.cpp16
-rw-r--r--mlir/lib/Support/ToolUtilities.cpp1
-rw-r--r--mlir/lib/TableGen/CodeGenHelpers.cpp12
-rw-r--r--mlir/lib/Target/LLVM/NVVM/Target.cpp14
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp4
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp1
-rw-r--r--mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp1
-rw-r--r--mlir/lib/Target/LLVMIR/ModuleTranslation.cpp1
-rw-r--r--mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp1
-rw-r--r--mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp1
-rw-r--r--mlir/lib/Target/SPIRV/Serialization/Serializer.cpp1
-rw-r--r--mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp2
-rw-r--r--mlir/lib/Tools/PDLL/Parser/Lexer.cpp1
-rw-r--r--mlir/lib/Tools/PDLL/Parser/Lexer.h2
-rw-r--r--mlir/lib/Tools/PDLL/Parser/Parser.cpp1
-rw-r--r--mlir/lib/Tools/lsp-server-support/Protocol.cpp1
-rw-r--r--mlir/lib/Tools/mlir-lsp-server/LSPServer.h7
-rw-r--r--mlir/lib/Tools/mlir-opt/MlirOptMain.cpp1
-rw-r--r--mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.h7
-rw-r--r--mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h3
-rw-r--r--mlir/lib/Tools/mlir-query/MlirQueryMain.cpp3
-rw-r--r--mlir/lib/Tools/mlir-reduce/MlirReduceMain.cpp1
-rw-r--r--mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp1
-rw-r--r--mlir/lib/Tools/tblgen-lsp-server/LSPServer.h8
-rw-r--r--mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp4
-rw-r--r--mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h3
-rw-r--r--mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp1
-rw-r--r--mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp1
-rw-r--r--mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp1
-rw-r--r--mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp1
-rw-r--r--mlir/test/lib/Dialect/Test/TestAttributes.cpp1
-rw-r--r--mlir/test/lib/Dialect/Test/TestDialect.cpp1
-rw-r--r--mlir/test/lib/Dialect/Test/TestOpDefs.cpp2
-rw-r--r--mlir/test/lib/Dialect/Test/TestOps.h10
-rw-r--r--mlir/test/lib/Dialect/Test/TestOps.td12
-rw-r--r--mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp2
-rw-r--r--mlir/test/lib/Dialect/Test/TestOpsSyntax.td8
-rw-r--r--mlir/test/lib/Dialect/Test/TestTypeDefs.td2
-rw-r--r--mlir/test/lib/Dialect/Test/TestTypes.h4
-rw-r--r--mlir/test/mlir-pdll/CodeGen/CPP/general.pdll2
-rw-r--r--mlir/test/mlir-tblgen/attrdefs.td2
-rw-r--r--mlir/test/mlir-tblgen/constraint-unique.td18
-rw-r--r--mlir/test/mlir-tblgen/interfaces-as-constraints.td8
-rw-r--r--mlir/test/mlir-tblgen/op-attribute.td4
-rw-r--r--mlir/test/mlir-tblgen/op-decl-and-defs.td10
-rw-r--r--mlir/test/mlir-tblgen/predicate.td6
-rw-r--r--mlir/test/mlir-tblgen/rewriter-static-matcher.td6
-rw-r--r--mlir/test/mlir-tblgen/typedefs.td2
-rw-r--r--mlir/test/python/python_test_ops.td6
-rw-r--r--mlir/tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp2
-rw-r--r--mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp2
-rw-r--r--mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp6
-rw-r--r--mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp1
-rw-r--r--mlir/tools/mlir-tblgen/DialectGen.cpp6
-rw-r--r--mlir/tools/mlir-tblgen/FormatGen.h1
-rw-r--r--mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp1
-rw-r--r--mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp22
-rw-r--r--mlir/tools/mlir-tblgen/OpFormatGen.cpp2
-rw-r--r--mlir/tools/mlir-tblgen/OpInterfacesGen.cpp2
-rw-r--r--mlir/tools/mlir-tblgen/RewriterGen.cpp4
-rw-r--r--mlir/tools/mlir-translate/mlir-translate.cpp2
-rw-r--r--mlir/tools/mlir-vulkan-runner/VulkanRuntime.h2
-rw-r--r--mlir/tools/tblgen-lsp-server/tblgen-lsp-server.cpp2
-rw-r--r--mlir/unittests/Analysis/Presburger/ParserTest.cpp58
-rw-r--r--mlir/unittests/Rewrite/PatternBenefit.cpp4
-rw-r--r--openmp/runtime/src/dllexports1
-rw-r--r--utils/bazel/llvm-project-overlay/clang/BUILD.bazel18
619 files changed, 7252 insertions, 2630 deletions
diff --git a/bolt/include/bolt/Rewrite/DWARFRewriter.h b/bolt/include/bolt/Rewrite/DWARFRewriter.h
index 4559ff5..c34fbd5 100644
--- a/bolt/include/bolt/Rewrite/DWARFRewriter.h
+++ b/bolt/include/bolt/Rewrite/DWARFRewriter.h
@@ -16,7 +16,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/DWP/DWP.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/ToolOutputFile.h"
#include <cstdint>
@@ -183,7 +182,7 @@ public:
void updateDebugInfo();
/// Update stmt_list for CUs based on the new .debug_line \p Layout.
- void updateLineTableOffsets(const MCAsmLayout &Layout);
+ void updateLineTableOffsets(const MCAssembler &Asm);
uint64_t getDwoRangesBase(uint64_t DWOId) { return DwoRangesBase[DWOId]; }
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index 3bd715d..f28a0cd 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -20,7 +20,6 @@
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -2416,8 +2415,7 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
MCAssembler &Assembler =
static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler();
- MCAsmLayout Layout(Assembler);
- Assembler.layout(Layout);
+ Assembler.layout();
// Obtain fragment sizes.
std::vector<uint64_t> FragmentSizes;
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 110f53f..1f5c3a4 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewrite/DWARFRewriter.cpp
@@ -29,7 +29,6 @@
#include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCStreamer.h"
@@ -1352,7 +1351,7 @@ void DWARFRewriter::updateDWARFObjectAddressRanges(
}
}
-void DWARFRewriter::updateLineTableOffsets(const MCAsmLayout &Layout) {
+void DWARFRewriter::updateLineTableOffsets(const MCAssembler &Asm) {
ErrorOr<BinarySection &> DbgInfoSection =
BC.getUniqueSectionByName(".debug_info");
ErrorOr<BinarySection &> TypeInfoSection =
@@ -1394,7 +1393,7 @@ void DWARFRewriter::updateLineTableOffsets(const MCAsmLayout &Layout) {
continue;
const uint64_t LineTableOffset =
- Layout.getAssembler().getSymbolOffset(*Label);
+ Asm.getSymbolOffset(*Label);
DebugLineOffsetMap[*StmtOffset] = LineTableOffset;
assert(DbgInfoSection && ".debug_info section must exist");
LineTablePatchMap[CU.get()] = LineTableOffset;
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index c118f2c..8248c1c 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -40,7 +40,6 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCStreamer.h"
@@ -3508,9 +3507,8 @@ void RewriteInstance::emitAndLink() {
updateOutputValues(*Linker);
if (opts::UpdateDebugSections) {
- MCAsmLayout FinalLayout(
- static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler());
- DebugInfoRewriter->updateLineTableOffsets(FinalLayout);
+ DebugInfoRewriter->updateLineTableOffsets(
+ static_cast<MCObjectStreamer &>(*Streamer).getAssembler());
}
if (RuntimeLibrary *RtLibrary = BC->getRuntimeLibrary())
diff --git a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
index c25ee42..d517e84 100644
--- a/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
@@ -296,7 +296,7 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
} else if (const auto *E =
Result.Nodes.getNodeAs<Expr>("sizeof-integer-call")) {
diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression "
- "that results in an integer")
+ "of integer type")
<< E->getSourceRange();
} else if (const auto *E = Result.Nodes.getNodeAs<Expr>("sizeof-this")) {
diag(E->getBeginLoc(),
@@ -314,7 +314,7 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
<< E->getSourceRange();
} else {
diag(E->getBeginLoc(), "suspicious usage of 'sizeof()' on an expression "
- "that results in a pointer")
+ "of pointer type")
<< E->getSourceRange();
}
} else if (const auto *E = Result.Nodes.getNodeAs<BinaryOperator>(
@@ -348,25 +348,28 @@ void SizeofExpressionCheck::check(const MatchFinder::MatchResult &Result) {
} else if (ElementSize > CharUnits::Zero() &&
DenominatorSize > CharUnits::Zero() &&
ElementSize != DenominatorSize) {
- diag(E->getOperatorLoc(), "suspicious usage of 'sizeof(...)/sizeof(...)';"
- " numerator is not a multiple of denominator")
+ // FIXME: Apparently there are no testcases that cover this branch!
+ diag(E->getOperatorLoc(),
+ "suspicious usage of 'sizeof(array)/sizeof(...)';"
+ " denominator differs from the size of array elements")
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (NumTy && DenomTy && NumTy == DenomTy) {
- // FIXME: This message is wrong, it should not refer to sizeof "pointer"
- // usage (and by the way, it would be to clarify all the messages).
diag(E->getOperatorLoc(),
- "suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'")
+ "suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions "
+ "have the same type")
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (!WarnOnSizeOfPointer) {
// When 'WarnOnSizeOfPointer' is enabled, these messages become redundant:
if (PointedTy && DenomTy && PointedTy == DenomTy) {
diag(E->getOperatorLoc(),
- "suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'")
+ "suspicious usage of 'sizeof(...)/sizeof(...)'; size of pointer "
+ "is divided by size of pointed type")
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (NumTy && DenomTy && NumTy->isPointerType() &&
DenomTy->isPointerType()) {
diag(E->getOperatorLoc(),
- "suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'")
+ "suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions "
+ "have pointer types")
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
}
}
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst
index 4d2cd0a..fe81973 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -241,10 +241,10 @@ Changes in existing checks
false positives resulting from use of optionals in unevaluated context.
- Improved :doc:`bugprone-sizeof-expression
- <clang-tidy/checks/bugprone/sizeof-expression>` check by eliminating some
- false positives and adding a new (off-by-default) option
- `WarnOnSizeOfPointer` that reports all ``sizeof(pointer)`` expressions
- (except for a few that are idiomatic).
+ <clang-tidy/checks/bugprone/sizeof-expression>` check by clarifying the
+ diagnostics, eliminating some false positives and adding a new
+ (off-by-default) option `WarnOnSizeOfPointer` that reports all
+ ``sizeof(pointer)`` expressions (except for a few that are idiomatic).
- Improved :doc:`bugprone-suspicious-include
<clang-tidy/checks/bugprone/suspicious-include>` check by replacing the local
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-2.c b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-2.c
index aef930f..b898071 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-2.c
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-2.c
@@ -34,24 +34,24 @@ int Test5() {
int sum = 0;
sum += sizeof(&S);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(__typeof(&S));
sum += sizeof(&TS);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(__typeof(&TS));
sum += sizeof(STRKWD MyStruct*);
sum += sizeof(__typeof(STRKWD MyStruct*));
sum += sizeof(TypedefStruct*);
sum += sizeof(__typeof(TypedefStruct*));
sum += sizeof(PTTS);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PMyStruct);
sum += sizeof(PS);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PS2);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&A10);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
#ifdef __cplusplus
MyStruct &rS = S;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-any-pointer.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-any-pointer.cpp
index bfb2ec3..4c65d25 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-any-pointer.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-any-pointer.cpp
@@ -38,17 +38,17 @@ int Test1(const char* ptr) {
sum += sizeof(sum, LEN);
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: suspicious usage of 'sizeof(..., ...)'
sum += sizeof(AsBool());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsInt());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsEnum());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsEnumClass());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(M{}.AsInt());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(M{}.AsEnum());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(sizeof(X));
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(sizeof(...))'
sum += sizeof(LEN + sizeof(X));
@@ -62,7 +62,7 @@ int Test1(const char* ptr) {
sum += sizeof(LEN + - + -sizeof(X));
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(sizeof(...))'
sum += sizeof(char) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(A) / sizeof(S);
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
sum += sizeof(char) / sizeof(int);
@@ -72,21 +72,21 @@ int Test1(const char* ptr) {
sum += sizeof(B[0]) / sizeof(A);
// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
sum += sizeof(ptr) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(ptr) / sizeof(ptr[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(ptr) / sizeof(char*);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(ptr) / sizeof(void*);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(ptr) / sizeof(const void volatile*);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(ptr) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(int) * sizeof(char);
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious 'sizeof' by 'sizeof' multiplication
sum += sizeof(ptr) * sizeof(ptr[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
// CHECK-MESSAGES: :[[@LINE-2]]:22: warning: suspicious 'sizeof' by 'sizeof' multiplication
sum += sizeof(int) * (2 * sizeof(char));
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious 'sizeof' by 'sizeof' multiplication
@@ -127,54 +127,54 @@ int Test5() {
int sum = 0;
sum += sizeof(&S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStruct.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStructPtr->arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(S.arr + 0);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(+ S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof((int*)S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(S.ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(kGlocalMyStruct.ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(kGlocalMyStructPtr->ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStruct);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&S);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(MyStruct*);
sum += sizeof(PMyStruct);
sum += sizeof(PS);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PS2);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&A10);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PtrArray) / sizeof(PtrArray[1]);
- // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(A10) / sizeof(PtrArray[0]);
sum += sizeof(PC) / sizeof(PtrArray[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
- // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
+ // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(ArrayC) / sizeof(PtrArray[0]);
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
sum += sizeof(PChar);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PInt);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PPInt);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PPMyStruct);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
return sum;
}
@@ -200,9 +200,9 @@ void GenericFunctionTest() {
// reported by the `sizeof(pointer)` checks, but this causes some false
// positives, so it would be good to create an exception for them.
some_generic_function(&IntPP, sizeof(IntP));
- // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: suspicious usage of 'sizeof()' on an expression of pointer type
some_generic_function(&ClassPP, sizeof(ClassP));
- // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: suspicious usage of 'sizeof()' on an expression of pointer type
}
int ValidExpressions() {
@@ -222,7 +222,7 @@ int ValidExpressions() {
sum += sizeof(A[sizeof(A) / sizeof(int)]);
// Here the outer sizeof is reported, but the inner ones are accepted:
sum += sizeof(&A[sizeof(A) / sizeof(int)]);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(sizeof(0)); // Special case: sizeof size_t.
sum += sizeof(void*);
sum += sizeof(void const *);
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-warn-on-sizeof-pointer-to-aggregate.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-warn-on-sizeof-pointer-to-aggregate.cpp
index 5ef2c46..5c6b728 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-warn-on-sizeof-pointer-to-aggregate.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression-warn-on-sizeof-pointer-to-aggregate.cpp
@@ -68,7 +68,7 @@ int Test5() {
sum += sizeof(A10) / sizeof(PtrArray[0]);
// No warning.
sum += sizeof(PC) / sizeof(PtrArray[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(ArrayC) / sizeof(PtrArray[0]);
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
diff --git a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp
index 064f31c..671fd83 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/bugprone/sizeof-expression.cpp
@@ -48,13 +48,13 @@ bool TestTrait2() {
template <class T>
bool TestTrait3() {
return sizeof(ReturnOverload(0)) == sizeof(T{});
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
}
template <class T>
bool TestTrait4() {
return sizeof(ReturnTemplate(0)) == sizeof(T{});
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
}
bool TestTemplates() {
@@ -79,17 +79,17 @@ int Test1(const char* ptr) {
sum += sizeof(sum, LEN);
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: suspicious usage of 'sizeof(..., ...)'
sum += sizeof(AsBool());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsInt());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsEnum());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(AsEnumClass());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(M{}.AsInt());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(M{}.AsEnum());
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in an integer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of integer type
sum += sizeof(sizeof(X));
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(sizeof(...))'
sum += sizeof(LEN + sizeof(X));
@@ -103,7 +103,7 @@ int Test1(const char* ptr) {
sum += sizeof(LEN + - + -sizeof(X));
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof(sizeof(...))'
sum += sizeof(char) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(A) / sizeof(S);
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
sum += sizeof(char) / sizeof(int);
@@ -113,17 +113,17 @@ int Test1(const char* ptr) {
sum += sizeof(B[0]) / sizeof(A);
// CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
sum += sizeof(ptr) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; size of pointer is divided by size of pointed type
sum += sizeof(ptr) / sizeof(ptr[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; size of pointer is divided by size of pointed type
sum += sizeof(ptr) / sizeof(char*);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have pointer types
sum += sizeof(ptr) / sizeof(void*);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have pointer types
sum += sizeof(ptr) / sizeof(const void volatile*);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(P*)/sizeof(Q*)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have pointer types
sum += sizeof(ptr) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of sizeof pointer 'sizeof(T*)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; size of pointer is divided by size of pointed type
sum += sizeof(int) * sizeof(char);
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: suspicious 'sizeof' by 'sizeof' multiplication
sum += sizeof(ptr) * sizeof(ptr[0]);
@@ -156,11 +156,11 @@ int CE4 = sizeof sizeof(MyConstChar);
int Test2(MyConstChar* A) {
int sum = 0;
sum += sizeof(MyConstChar) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(MyConstChar) / sizeof(MyChar);
- // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(A[0]) / sizeof(char);
- // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
return sum;
}
@@ -169,7 +169,7 @@ int Foo() { int A[T]; return sizeof(T); }
// CHECK-MESSAGES: :[[@LINE-1]]:30: warning: suspicious usage of 'sizeof(K)'
template <typename T>
int Bar() { T A[5]; return sizeof(A[0]) / sizeof(T); }
-// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+// CHECK-MESSAGES: :[[@LINE-1]]:41: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
int Test3() { return Foo<42>() + Bar<char>(); }
static const char* kABC = "abc";
@@ -211,43 +211,43 @@ int Test5() {
int sum = 0;
sum += sizeof(&S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStruct.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStructPtr->arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(S.arr + 0);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(+ S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof((int*)S.arr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(S.ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(kGlocalMyStruct.ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(kGlocalMyStructPtr->ptr);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&kGlocalMyStruct);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&S);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(MyStruct*);
sum += sizeof(PMyStruct);
sum += sizeof(PS);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PS2);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(&A10);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(PtrArray) / sizeof(PtrArray[1]);
- // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:29: warning: suspicious usage of 'sizeof()' on an expression of pointer type
sum += sizeof(A10) / sizeof(PtrArray[0]);
sum += sizeof(PC) / sizeof(PtrArray[0]);
- // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
- // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: suspicious usage of 'sizeof()' on an expression of pointer type
+ // CHECK-MESSAGES: :[[@LINE-2]]:21: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; both expressions have the same type
sum += sizeof(ArrayC) / sizeof(PtrArray[0]);
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: suspicious usage of 'sizeof(...)/sizeof(...)'; numerator is not a multiple of denominator
@@ -321,7 +321,7 @@ void GenericFunctionTest() {
// NOTE: `sizeof(IntP)` is only reported with `WarnOnSizeOfPointer=true`.
some_generic_function(&IntPP, sizeof(IntP));
some_generic_function(&ClassPP, sizeof(ClassP));
- // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: suspicious usage of 'sizeof()' on an expression that results in a pointer
+ // CHECK-MESSAGES: :[[@LINE-1]]:35: warning: suspicious usage of 'sizeof()' on an expression of pointer type
}
int ValidExpressions() {
diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst
index 080cba9..6c2e6da 100644
--- a/clang/docs/ClangFormatStyleOptions.rst
+++ b/clang/docs/ClangFormatStyleOptions.rst
@@ -6242,6 +6242,7 @@ the configuration (without a prefix: ``Auto``).
# Example of usage:
SpacesInParens: Custom
SpacesInParensOptions:
+ ExceptDoubleParentheses: false
InConditionalStatements: true
InEmptyParentheses: true
@@ -6254,9 +6255,22 @@ the configuration (without a prefix: ``Auto``).
# Should be declared this way:
SpacesInParens: Custom
SpacesInParensOptions:
+ ExceptDoubleParentheses: false
InConditionalStatements: true
Other: true
+ * ``bool ExceptDoubleParentheses`` Override any of the following options to prevent addition of space
+ when both opening and closing parentheses use multiple parentheses.
+
+ .. code-block:: c++
+
+ true:
+ __attribute__(( noreturn ))
+ __decltype__(( x ))
+ if (( a = b ))
+ false:
+ Uses the applicable option.
+
* ``bool InConditionalStatements`` Put a space in parentheses only inside conditional statements
(``for/if/while/switch...``).
@@ -6270,8 +6284,9 @@ the configuration (without a prefix: ``Auto``).
.. code-block:: c++
- true: false:
- x = ( int32 )y vs. x = (int32)y
+ true: false:
+ x = ( int32 )y vs. x = (int32)y
+ y = (( int (*)(int) )foo)(x); y = ((int (*)(int))foo)(x);
* ``bool InEmptyParentheses`` Insert a space in empty parentheses, i.e. ``()``.
@@ -6289,8 +6304,8 @@ the configuration (without a prefix: ``Auto``).
.. code-block:: c++
- true: false:
- t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
+ true: false:
+ t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
.. _SpacesInParentheses:
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 90c2469..181d100 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -320,6 +320,12 @@ Resolutions to C++ Defect Reports
C Language Changes
------------------
+C2y Feature Support
+^^^^^^^^^^^^^^^^^^^
+- Clang now enables C2y mode with ``-std=c2y``. This sets ``__STDC_VERSION__``
+ to ``202400L`` so that it's greater than the value for C23. The value of this
+ macro is subject to change in the future.
+
C23 Feature Support
^^^^^^^^^^^^^^^^^^^
- No longer diagnose use of binary literals as an extension in C23 mode. Fixes
@@ -403,6 +409,11 @@ Non-comprehensive list of changes in this release
- ``#pragma GCC diagnostic warning "-Wfoo"`` can now downgrade ``-Werror=foo``
errors and certain default-to-error ``-W`` diagnostics to warnings.
+- Support importing C++20 modules in clang-repl.
+
+- Added support for ``TypeLoc::dump()`` for easier debugging, and improved
+ textual and JSON dumping for various ``TypeLoc``-related nodes.
+
New Compiler Flags
------------------
- ``-fsanitize=implicit-bitfield-conversion`` checks implicit truncation and
@@ -645,6 +656,8 @@ Improvements to Clang's diagnostics
that will be destroyed at the end of the full expression.
Fixes #GH54492.
+- Clang now shows implicit deduction guides when diagnosing overload resolution failure. #GH92393.
+
Improvements to Clang's time-trace
----------------------------------
@@ -1130,6 +1143,9 @@ clang-format
- Adds ``LeftWithLastLine`` suboption to ``AlignEscapedNewlines``.
- Adds ``KeepEmptyLines`` option to deprecate ``KeepEmptyLinesAtEOF``
and ``KeepEmptyLinesAtTheStartOfBlocks``.
+- Add ``ExceptDoubleParentheses`` sub-option for ``SpacesInParensOptions``
+ to override addition of spaces between multiple, non-redundant parentheses
+ similar to the rules used for ``RemoveParentheses``.
libclang
--------
@@ -1158,11 +1174,6 @@ Crash and bug fixes
Improvements
^^^^^^^^^^^^
-- Support importing C++20 modules in clang-repl.
-
-- Added support for ``TypeLoc::dump()`` for easier debugging, and improved
- textual and JSON dumping for various ``TypeLoc``-related nodes.
-
Moved checkers
^^^^^^^^^^^^^^
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index d273102..087c75b 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3458,9 +3458,9 @@ Differences between various standard modes
clang supports the -std option, which changes what language mode clang uses.
The supported modes for C are c89, gnu89, c94, c99, gnu99, c11, gnu11, c17,
-gnu17, c23, gnu23, and various aliases for those modes. If no -std option is
-specified, clang defaults to gnu17 mode. Many C99 and C11 features are
-supported in earlier modes as a conforming extension, with a warning. Use
+gnu17, c23, gnu23, c2y, gnu2y, and various aliases for those modes. If no -std
+option is specified, clang defaults to gnu17 mode. Many C99 and C11 features
+are supported in earlier modes as a conforming extension, with a warning. Use
``-pedantic-errors`` to request an error if a feature from a later standard
revision is used in an earlier mode.
@@ -3523,6 +3523,10 @@ Differences between ``*17`` and ``*23`` modes:
- ``[[]]`` attributes are supported by default in ``*23`` mode, and as an
extension in ``*17`` and earlier modes.
+Differences between ``*23`` and ``*2y`` modes:
+
+- ``__STDC_VERSION__`` is defined to ``202400L`` rather than ``202311L``.
+
GCC extensions not implemented yet
----------------------------------
diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt
index 4866bd4..a8ee8f1 100644
--- a/clang/docs/tools/clang-formatted-files.txt
+++ b/clang/docs/tools/clang-formatted-files.txt
@@ -5357,7 +5357,6 @@ llvm/include/llvm/MC/MCAsmInfoELF.h
llvm/include/llvm/MC/MCAsmInfoGOFF.h
llvm/include/llvm/MC/MCAsmInfoWasm.h
llvm/include/llvm/MC/MCAsmInfoXCOFF.h
-llvm/include/llvm/MC/MCAsmLayout.h
llvm/include/llvm/MC/MCCodeView.h
llvm/include/llvm/MC/MCContext.h
llvm/include/llvm/MC/MCFixedLenDisassembler.h
diff --git a/clang/include/clang/AST/Redeclarable.h b/clang/include/clang/AST/Redeclarable.h
index 091bb88..74ccd74 100644
--- a/clang/include/clang/AST/Redeclarable.h
+++ b/clang/include/clang/AST/Redeclarable.h
@@ -281,10 +281,10 @@ public:
return tmp;
}
- friend bool operator==(redecl_iterator x, redecl_iterator y) {
+ friend bool operator==(const redecl_iterator &x, const redecl_iterator &y) {
return x.Current == y.Current;
}
- friend bool operator!=(redecl_iterator x, redecl_iterator y) {
+ friend bool operator!=(const redecl_iterator &x, const redecl_iterator &y) {
return x.Current != y.Current;
}
};
diff --git a/clang/include/clang/AST/TemplateName.h b/clang/include/clang/AST/TemplateName.h
index 24a7fde..e3b7dd2 100644
--- a/clang/include/clang/AST/TemplateName.h
+++ b/clang/include/clang/AST/TemplateName.h
@@ -198,7 +198,8 @@ public:
///
/// Here, "apply" is treated as a template name within the typename
/// specifier in the typedef. "apply" is a nested template, and can
-/// only be understood in the context of
+/// only be understood in the context of a template instantiation,
+/// hence is represented as a dependent template name.
class TemplateName {
// NameDecl is either a TemplateDecl or a UsingShadowDecl depending on the
// NameKind.
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 74deb92..9431eea 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -299,6 +299,10 @@ def CPre23CompatPedantic : DiagGroup<"pre-c23-compat-pedantic",
def : DiagGroup<"pre-c2x-compat", [CPre23Compat]>;
def : DiagGroup<"pre-c2x-compat-pedantic", [CPre23CompatPedantic]>;
+def CPre2yCompat : DiagGroup<"pre-c2y-compat">;
+def CPre2yCompatPedantic : DiagGroup<"pre-c2y-compat-pedantic",
+ [CPre2yCompat]>;
+
// Warnings for C++ code which is not compatible with previous C++ standards.
def CXXPre14Compat : DiagGroup<"pre-c++14-compat">;
def : DiagGroup<"c++98-c++11-compat", [CXXPre14Compat]>;
@@ -1197,6 +1201,9 @@ def C23 : DiagGroup<"c23-extensions">;
def : DiagGroup<"c2x-extensions", [C23]>;
+// A warning group for warnings about using C2y features as extensions.
+def C2y : DiagGroup<"c2y-extensions">;
+
// Previously supported warning group which is no longer pertinent as binary
// literals are a C++14 and C23 extension now instead of a GNU extension.
def GNUBinaryLiteral : DiagGroup<"gnu-binary-literal">;
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 1160b0f..12aab09 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -157,9 +157,12 @@ def err_duplicate_default_assoc : Error<
"duplicate default generic association">;
def note_previous_default_assoc : Note<
"previous default generic association is here">;
-def ext_generic_with_type_arg : Extension<
- "passing a type argument as the first operand to '_Generic' is a Clang "
- "extension">, InGroup<DiagGroup<"generic-type-extension">>;
+def ext_c2y_generic_with_type_arg : Extension<
+ "passing a type argument as the first operand to '_Generic' is a C2y "
+ "extension">, InGroup<C2y>;
+def warn_c2y_compat_generic_with_type_arg : Warning<
+ "passing a type argument as the first operand to '_Generic' is incompatible "
+ "with C standards before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
def ext_c99_feature : Extension<
"'%0' is a C99 extension">, InGroup<C99>;
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 64f7935d..3df64b2e 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -2419,6 +2419,7 @@ def err_selected_explicit_constructor : Error<
"chosen constructor is explicit in copy-initialization">;
def note_explicit_ctor_deduction_guide_here : Note<
"explicit %select{constructor|deduction guide}0 declared here">;
+def note_implicit_deduction_guide : Note<"implicit deduction guide declared as '%0'">;
// C++11 auto
def warn_cxx98_compat_auto_type_specifier : Warning<
@@ -3546,6 +3547,12 @@ def warn_alignment_not_power_of_two : Warning<
InGroup<DiagGroup<"non-power-of-two-alignment">>;
def err_alignment_dependent_typedef_name : Error<
"requested alignment is dependent but declaration is not dependent">;
+def ext_c2y_alignof_incomplete_array : Extension<
+ "'alignof' on an incomplete array type is a C2y extension">,
+ InGroup<C2y>;
+def warn_c2y_compat_alignof_incomplete_array : Warning<
+ "'alignof' on an incomplete array type is incompatible with C standards "
+ "before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
def warn_alignment_builtin_useless : Warning<
"%select{aligning a value|the result of checking whether a value is aligned}0"
@@ -7663,8 +7670,12 @@ def ext_gnu_ptr_func_arith : Extension<
InGroup<GNUPointerArith>;
def err_readonly_message_assignment : Error<
"assigning to 'readonly' return result of an Objective-C message not allowed">;
-def ext_increment_complex : Extension<
- "'%select{--|++}0' on an object of complex type is a Clang extension">;
+def ext_c2y_increment_complex : Extension<
+ "'%select{--|++}0' on an object of complex type is a C2y extension">,
+ InGroup<C2y>;
+def warn_c2y_compat_increment_complex : Warning<
+ "'%select{--|++}0' on an object of complex type is incompatible with C "
+ "standards before C2y">, InGroup<CPre2yCompat>, DefaultIgnore;
def ext_integer_complement_complex : Extension<
"ISO C does not support '~' for complex conjugation of %0">;
def err_nosetter_property_assignment : Error<
diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index 6dd6b56..491759e 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -87,6 +87,7 @@ LANGOPT(C99 , 1, 0, "C99")
LANGOPT(C11 , 1, 0, "C11")
LANGOPT(C17 , 1, 0, "C17")
LANGOPT(C23 , 1, 0, "C23")
+LANGOPT(C2y , 1, 0, "C2y")
LANGOPT(MSVCCompat , 1, 0, "Microsoft Visual C++ full compatibility mode")
LANGOPT(Kernel , 1, 0, "Kernel mode")
LANGOPT(MicrosoftExt , 1, 0, "Microsoft C++ extensions")
diff --git a/clang/include/clang/Basic/LangStandard.h b/clang/include/clang/Basic/LangStandard.h
index 8e25afc..f79b4aa 100644
--- a/clang/include/clang/Basic/LangStandard.h
+++ b/clang/include/clang/Basic/LangStandard.h
@@ -52,18 +52,19 @@ enum LangFeatures {
C11 = (1 << 2),
C17 = (1 << 3),
C23 = (1 << 4),
- CPlusPlus = (1 << 5),
- CPlusPlus11 = (1 << 6),
- CPlusPlus14 = (1 << 7),
- CPlusPlus17 = (1 << 8),
- CPlusPlus20 = (1 << 9),
- CPlusPlus23 = (1 << 10),
- CPlusPlus26 = (1 << 11),
- Digraphs = (1 << 12),
- GNUMode = (1 << 13),
- HexFloat = (1 << 14),
- OpenCL = (1 << 15),
- HLSL = (1 << 16)
+ C2y = (1 << 5),
+ CPlusPlus = (1 << 6),
+ CPlusPlus11 = (1 << 7),
+ CPlusPlus14 = (1 << 8),
+ CPlusPlus17 = (1 << 9),
+ CPlusPlus20 = (1 << 10),
+ CPlusPlus23 = (1 << 11),
+ CPlusPlus26 = (1 << 12),
+ Digraphs = (1 << 13),
+ GNUMode = (1 << 14),
+ HexFloat = (1 << 15),
+ OpenCL = (1 << 16),
+ HLSL = (1 << 17)
};
/// LangStandard - Information about the properties of a particular language
@@ -106,6 +107,9 @@ public:
/// isC23 - Language is a superset of C23.
bool isC23() const { return Flags & C23; }
+ /// isC2y - Language is a superset of C2y.
+ bool isC2y() const { return Flags & C2y; }
+
/// isCPlusPlus - Language is a C++ variant.
bool isCPlusPlus() const { return Flags & CPlusPlus; }
diff --git a/clang/include/clang/Basic/LangStandards.def b/clang/include/clang/Basic/LangStandards.def
index b6192e4..f0c2593 100644
--- a/clang/include/clang/Basic/LangStandards.def
+++ b/clang/include/clang/Basic/LangStandards.def
@@ -99,6 +99,15 @@ LANGSTANDARD_ALIAS_DEPR(gnu23, "gnu2x")
// FIXME: Add the alias for iso9899:202* once we know the year ISO publishes
// the document (expected to be 2024).
+// C2y modes
+LANGSTANDARD(c2y, "c2y",
+ C, "Working Draft for ISO C2y",
+ LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | HexFloat)
+LANGSTANDARD(gnu2y, "gnu2y",
+ C, "Working Draft for ISO C2y with GNU extensions",
+ LineComment | C99 | C11 | C17 | C23 | C2y | Digraphs | GNUMode | HexFloat)
+
+
// C++ modes
LANGSTANDARD(cxx98, "c++98",
CXX, "ISO C++ 1998 with amendments",
diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h
index 1f93bd6..ece1384 100644
--- a/clang/include/clang/Driver/ToolChain.h
+++ b/clang/include/clang/Driver/ToolChain.h
@@ -526,6 +526,9 @@ public:
// Returns target specific standard library path if it exists.
std::optional<std::string> getStdlibPath() const;
+ // Returns target specific standard library include path if it exists.
+ std::optional<std::string> getStdlibIncludePath() const;
+
// Returns <ResourceDir>/lib/<OSName>/<arch> or <ResourceDir>/lib/<triple>.
// This is used by runtimes (such as OpenMP) to find arch-specific libraries.
virtual path_list getArchSpecificLibPaths() const;
diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h
index efc2e450..c454ab2 100644
--- a/clang/include/clang/Format/Format.h
+++ b/clang/include/clang/Format/Format.h
@@ -4679,10 +4679,22 @@ struct FormatStyle {
/// # Should be declared this way:
/// SpacesInParens: Custom
/// SpacesInParensOptions:
+ /// ExceptDoubleParentheses: false
/// InConditionalStatements: true
/// Other: true
/// \endcode
struct SpacesInParensCustom {
+ /// Override any of the following options to prevent addition of space
+ /// when both opening and closing parentheses use multiple parentheses.
+ /// \code
+ /// true:
+ /// __attribute__(( noreturn ))
+ /// __decltype__(( x ))
+ /// if (( a = b ))
+ /// \endcode
+ /// false:
+ /// Uses the applicable option.
+ bool ExceptDoubleParentheses;
/// Put a space in parentheses only inside conditional statements
/// (``for/if/while/switch...``).
/// \code
@@ -4693,8 +4705,9 @@ struct FormatStyle {
bool InConditionalStatements;
/// Put a space in C style casts.
/// \code
- /// true: false:
- /// x = ( int32 )y vs. x = (int32)y
+ /// true: false:
+ /// x = ( int32 )y vs. x = (int32)y
+ /// y = (( int (*)(int) )foo)(x); y = ((int (*)(int))foo)(x);
/// \endcode
bool InCStyleCasts;
/// Insert a space in empty parentheses, i.e. ``()``.
@@ -4710,23 +4723,26 @@ struct FormatStyle {
bool InEmptyParentheses;
/// Put a space in parentheses not covered by preceding options.
/// \code
- /// true: false:
- /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
+ /// true: false:
+ /// t f( Deleted & ) & = delete; vs. t f(Deleted &) & = delete;
/// \endcode
bool Other;
SpacesInParensCustom()
- : InConditionalStatements(false), InCStyleCasts(false),
- InEmptyParentheses(false), Other(false) {}
+ : ExceptDoubleParentheses(false), InConditionalStatements(false),
+ InCStyleCasts(false), InEmptyParentheses(false), Other(false) {}
- SpacesInParensCustom(bool InConditionalStatements, bool InCStyleCasts,
+ SpacesInParensCustom(bool ExceptDoubleParentheses,
+ bool InConditionalStatements, bool InCStyleCasts,
bool InEmptyParentheses, bool Other)
- : InConditionalStatements(InConditionalStatements),
+ : ExceptDoubleParentheses(ExceptDoubleParentheses),
+ InConditionalStatements(InConditionalStatements),
InCStyleCasts(InCStyleCasts), InEmptyParentheses(InEmptyParentheses),
Other(Other) {}
bool operator==(const SpacesInParensCustom &R) const {
- return InConditionalStatements == R.InConditionalStatements &&
+ return ExceptDoubleParentheses == R.ExceptDoubleParentheses &&
+ InConditionalStatements == R.InConditionalStatements &&
InCStyleCasts == R.InCStyleCasts &&
InEmptyParentheses == R.InEmptyParentheses && Other == R.Other;
}
@@ -4744,6 +4760,7 @@ struct FormatStyle {
/// # Example of usage:
/// SpacesInParens: Custom
/// SpacesInParensOptions:
+ /// ExceptDoubleParentheses: false
/// InConditionalStatements: true
/// InEmptyParentheses: true
/// \endcode
diff --git a/clang/lib/AST/Interp/Compiler.cpp b/clang/lib/AST/Interp/Compiler.cpp
index 5ae36da..9ca71e0 100644
--- a/clang/lib/AST/Interp/Compiler.cpp
+++ b/clang/lib/AST/Interp/Compiler.cpp
@@ -154,6 +154,19 @@ private:
CaseMap OldCaseLabels;
};
+template <class Emitter> class StmtExprScope final {
+public:
+ StmtExprScope(Compiler<Emitter> *Ctx) : Ctx(Ctx), OldFlag(Ctx->InStmtExpr) {
+ Ctx->InStmtExpr = true;
+ }
+
+ ~StmtExprScope() { Ctx->InStmtExpr = OldFlag; }
+
+private:
+ Compiler<Emitter> *Ctx;
+ bool OldFlag;
+};
+
} // namespace interp
} // namespace clang
@@ -3028,6 +3041,7 @@ bool Compiler<Emitter>::VisitCXXStdInitializerListExpr(
template <class Emitter>
bool Compiler<Emitter>::VisitStmtExpr(const StmtExpr *E) {
BlockScope<Emitter> BS(this);
+ StmtExprScope<Emitter> SS(this);
const CompoundStmt *CS = E->getSubStmt();
const Stmt *Result = CS->getStmtExprResult();
@@ -3460,7 +3474,7 @@ bool Compiler<Emitter>::visitDecl(const VarDecl *VD, bool ConstantContext) {
}
// Create and initialize the variable.
- if (!this->visitVarDecl(VD))
+ if (!this->visitVarDecl(VD, /*Toplevel=*/true))
return false;
// Get a pointer to the variable
@@ -3507,7 +3521,7 @@ bool Compiler<Emitter>::visitDecl(const VarDecl *VD, bool ConstantContext) {
}
template <class Emitter>
-VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD) {
+VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD, bool Toplevel) {
// We don't know what to do with these, so just return false.
if (VD->getType().isNull())
return false;
@@ -3521,7 +3535,7 @@ VarCreationState Compiler<Emitter>::visitVarDecl(const VarDecl *VD) {
std::optional<PrimType> VarT = classify(VD->getType());
auto checkDecl = [&]() -> bool {
- bool NeedsOp = VD->isLocalVarDecl() && VD->isStaticLocal();
+ bool NeedsOp = !Toplevel && VD->isLocalVarDecl() && VD->isStaticLocal();
return !NeedsOp || this->emitCheckDecl(VD, VD);
};
@@ -4019,7 +4033,7 @@ template <class Emitter> bool Compiler<Emitter>::visitLoopBody(const Stmt *S) {
return true;
if (const auto *CS = dyn_cast<CompoundStmt>(S)) {
- for (auto *InnerStmt : CS->body())
+ for (const auto *InnerStmt : CS->body())
if (!visitStmt(InnerStmt))
return false;
return true;
@@ -4031,7 +4045,7 @@ template <class Emitter> bool Compiler<Emitter>::visitLoopBody(const Stmt *S) {
template <class Emitter>
bool Compiler<Emitter>::visitCompoundStmt(const CompoundStmt *S) {
BlockScope<Emitter> Scope(this);
- for (auto *InnerStmt : S->body())
+ for (const auto *InnerStmt : S->body())
if (!visitStmt(InnerStmt))
return false;
return true;
@@ -4056,6 +4070,9 @@ bool Compiler<Emitter>::visitDeclStmt(const DeclStmt *DS) {
template <class Emitter>
bool Compiler<Emitter>::visitReturnStmt(const ReturnStmt *RS) {
+ if (this->InStmtExpr)
+ return this->emitUnsupported(RS);
+
if (const Expr *RE = RS->getRetValue()) {
ExprScope<Emitter> RetScope(this);
if (ReturnType) {
@@ -4139,6 +4156,7 @@ bool Compiler<Emitter>::visitWhileStmt(const WhileStmt *S) {
LabelTy EndLabel = this->getLabel(); // Label after the loop.
LoopScope<Emitter> LS(this, EndLabel, CondLabel);
+ this->fallthrough(CondLabel);
this->emitLabel(CondLabel);
if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
@@ -4174,12 +4192,14 @@ template <class Emitter> bool Compiler<Emitter>::visitDoStmt(const DoStmt *S) {
LoopScope<Emitter> LS(this, EndLabel, CondLabel);
LocalScope<Emitter> Scope(this);
+ this->fallthrough(StartLabel);
this->emitLabel(StartLabel);
{
DestructorScope<Emitter> DS(Scope);
if (!this->visitLoopBody(Body))
return false;
+ this->fallthrough(CondLabel);
this->emitLabel(CondLabel);
if (!this->visitBool(Cond))
return false;
@@ -4187,6 +4207,7 @@ template <class Emitter> bool Compiler<Emitter>::visitDoStmt(const DoStmt *S) {
if (!this->jumpTrue(StartLabel))
return false;
+ this->fallthrough(EndLabel);
this->emitLabel(EndLabel);
return true;
}
@@ -4207,6 +4228,7 @@ bool Compiler<Emitter>::visitForStmt(const ForStmt *S) {
if (Init && !this->visitStmt(Init))
return false;
+ this->fallthrough(CondLabel);
this->emitLabel(CondLabel);
if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
@@ -4225,6 +4247,7 @@ bool Compiler<Emitter>::visitForStmt(const ForStmt *S) {
if (Body && !this->visitLoopBody(Body))
return false;
+ this->fallthrough(IncLabel);
this->emitLabel(IncLabel);
if (Inc && !this->discard(Inc))
return false;
@@ -4232,6 +4255,7 @@ bool Compiler<Emitter>::visitForStmt(const ForStmt *S) {
if (!this->jump(CondLabel))
return false;
+ this->fallthrough(EndLabel);
this->emitLabel(EndLabel);
return true;
}
@@ -4263,6 +4287,7 @@ bool Compiler<Emitter>::visitCXXForRangeStmt(const CXXForRangeStmt *S) {
return false;
// Now the condition as well as the loop variable assignment.
+ this->fallthrough(CondLabel);
this->emitLabel(CondLabel);
if (!this->visitBool(Cond))
return false;
@@ -4279,13 +4304,16 @@ bool Compiler<Emitter>::visitCXXForRangeStmt(const CXXForRangeStmt *S) {
if (!this->visitLoopBody(Body))
return false;
+ this->fallthrough(IncLabel);
this->emitLabel(IncLabel);
if (!this->discard(Inc))
return false;
}
+
if (!this->jump(CondLabel))
return false;
+ this->fallthrough(EndLabel);
this->emitLabel(EndLabel);
return true;
}
@@ -4991,7 +5019,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
if ((VD->hasGlobalStorage() || VD->isLocalVarDecl() ||
VD->isStaticDataMember()) &&
typeShouldBeVisited(VD->getType())) {
- auto VarState = this->visitVarDecl(VD);
+ auto VarState = this->visitVarDecl(VD, true);
if (VarState.notCreated())
return true;
if (!VarState)
@@ -5004,7 +5032,7 @@ bool Compiler<Emitter>::visitDeclRef(const ValueDecl *D, const Expr *E) {
if (const auto *VD = dyn_cast<VarDecl>(D);
VD && VD->getAnyInitializer() &&
VD->getType().isConstant(Ctx.getASTContext()) && !VD->isWeak()) {
- auto VarState = this->visitVarDecl(VD);
+ auto VarState = this->visitVarDecl(VD, true);
if (VarState.notCreated())
return true;
if (!VarState)
diff --git a/clang/lib/AST/Interp/Compiler.h b/clang/lib/AST/Interp/Compiler.h
index d188ce2..d28526c 100644
--- a/clang/lib/AST/Interp/Compiler.h
+++ b/clang/lib/AST/Interp/Compiler.h
@@ -39,6 +39,7 @@ template <class Emitter> class SourceLocScope;
template <class Emitter> class LoopScope;
template <class Emitter> class LabelScope;
template <class Emitter> class SwitchScope;
+template <class Emitter> class StmtExprScope;
template <class Emitter> class Compiler;
struct InitLink {
@@ -260,7 +261,7 @@ protected:
/// intact.
bool delegate(const Expr *E);
/// Creates and initializes a variable from the given decl.
- VarCreationState visitVarDecl(const VarDecl *VD);
+ VarCreationState visitVarDecl(const VarDecl *VD, bool Toplevel = false);
/// Visit an APValue.
bool visitAPValue(const APValue &Val, PrimType ValType, const Expr *E);
bool visitAPValueInitializer(const APValue &Val, const Expr *E);
@@ -334,6 +335,7 @@ private:
friend class LoopScope<Emitter>;
friend class LabelScope<Emitter>;
friend class SwitchScope<Emitter>;
+ friend class StmtExprScope<Emitter>;
/// Emits a zero initializer.
bool visitZeroInitializer(PrimType T, QualType QT, const Expr *E);
@@ -398,6 +400,8 @@ protected:
/// Flag indicating if return value is to be discarded.
bool DiscardResult = false;
+ bool InStmtExpr = false;
+
/// Flag inidicating if we're initializing an already created
/// variable. This is set in visitInitializer().
bool Initializing = false;
diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h
index ff6d50a..328db21 100644
--- a/clang/lib/AST/Interp/Interp.h
+++ b/clang/lib/AST/Interp/Interp.h
@@ -2618,6 +2618,13 @@ inline bool Invalid(InterpState &S, CodePtr OpPC) {
return false;
}
+inline bool Unsupported(InterpState &S, CodePtr OpPC) {
+ const SourceLocation &Loc = S.Current->getLocation(OpPC);
+ S.FFDiag(Loc, diag::note_constexpr_stmt_expr_unsupported)
+ << S.Current->getRange(OpPC);
+ return false;
+}
+
/// Do nothing and just abort execution.
inline bool Error(InterpState &S, CodePtr OpPC) { return false; }
diff --git a/clang/lib/AST/Interp/Opcodes.td b/clang/lib/AST/Interp/Opcodes.td
index 81e7b81..8d01fe1 100644
--- a/clang/lib/AST/Interp/Opcodes.td
+++ b/clang/lib/AST/Interp/Opcodes.td
@@ -714,6 +714,7 @@ def Dup : Opcode {
// [] -> []
def Invalid : Opcode {}
+def Unsupported : Opcode {}
def Error : Opcode {}
def InvalidCast : Opcode {
let Args = [ArgCastKind];
diff --git a/clang/lib/Basic/LangOptions.cpp b/clang/lib/Basic/LangOptions.cpp
index 2b90646..61072b7 100644
--- a/clang/lib/Basic/LangOptions.cpp
+++ b/clang/lib/Basic/LangOptions.cpp
@@ -112,6 +112,7 @@ void LangOptions::setLangDefaults(LangOptions &Opts, Language Lang,
Opts.C11 = Std.isC11();
Opts.C17 = Std.isC17();
Opts.C23 = Std.isC23();
+ Opts.C2y = Std.isC2y();
Opts.CPlusPlus = Std.isCPlusPlus();
Opts.CPlusPlus11 = Std.isCPlusPlus11();
Opts.CPlusPlus14 = Std.isCPlusPlus14();
diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp
index df172dc..766d6a8 100644
--- a/clang/lib/Basic/OpenMPKinds.cpp
+++ b/clang/lib/Basic/OpenMPKinds.cpp
@@ -747,105 +747,85 @@ void clang::getOpenMPCaptureRegions(
assert(unsigned(DKind) < llvm::omp::Directive_enumSize);
assert(isOpenMPCapturingDirective(DKind) && "Expecting capturing directive");
- switch (DKind) {
- case OMPD_metadirective:
- CaptureRegions.push_back(OMPD_metadirective);
- break;
- case OMPD_parallel:
- case OMPD_parallel_for:
- case OMPD_parallel_for_simd:
- case OMPD_parallel_master:
- case OMPD_parallel_masked:
- case OMPD_parallel_sections:
- case OMPD_distribute_parallel_for:
- case OMPD_distribute_parallel_for_simd:
- case OMPD_parallel_loop:
- CaptureRegions.push_back(OMPD_parallel);
- break;
- case OMPD_target_teams:
- case OMPD_target_teams_distribute:
- case OMPD_target_teams_distribute_simd:
- CaptureRegions.push_back(OMPD_task);
- CaptureRegions.push_back(OMPD_target);
- CaptureRegions.push_back(OMPD_teams);
- break;
- case OMPD_teams:
- case OMPD_teams_distribute:
- case OMPD_teams_distribute_simd:
- CaptureRegions.push_back(OMPD_teams);
- break;
- case OMPD_target:
- case OMPD_target_simd:
- CaptureRegions.push_back(OMPD_task);
- CaptureRegions.push_back(OMPD_target);
- break;
- case OMPD_teams_loop:
- case OMPD_teams_distribute_parallel_for:
- case OMPD_teams_distribute_parallel_for_simd:
- CaptureRegions.push_back(OMPD_teams);
- CaptureRegions.push_back(OMPD_parallel);
- break;
- case OMPD_target_parallel:
- case OMPD_target_parallel_for:
- case OMPD_target_parallel_for_simd:
- case OMPD_target_parallel_loop:
- CaptureRegions.push_back(OMPD_task);
- CaptureRegions.push_back(OMPD_target);
- CaptureRegions.push_back(OMPD_parallel);
- break;
- case OMPD_task:
- case OMPD_target_enter_data:
- case OMPD_target_exit_data:
- case OMPD_target_update:
- CaptureRegions.push_back(OMPD_task);
- break;
- case OMPD_taskloop:
- case OMPD_taskloop_simd:
- case OMPD_master_taskloop:
- case OMPD_master_taskloop_simd:
- case OMPD_masked_taskloop:
- case OMPD_masked_taskloop_simd:
- CaptureRegions.push_back(OMPD_taskloop);
- break;
- case OMPD_parallel_masked_taskloop:
- case OMPD_parallel_masked_taskloop_simd:
- case OMPD_parallel_master_taskloop:
- case OMPD_parallel_master_taskloop_simd:
- CaptureRegions.push_back(OMPD_parallel);
- CaptureRegions.push_back(OMPD_taskloop);
- break;
- case OMPD_target_teams_loop:
- case OMPD_target_teams_distribute_parallel_for:
- case OMPD_target_teams_distribute_parallel_for_simd:
- CaptureRegions.push_back(OMPD_task);
- CaptureRegions.push_back(OMPD_target);
- CaptureRegions.push_back(OMPD_teams);
- CaptureRegions.push_back(OMPD_parallel);
- break;
- case OMPD_nothing:
- CaptureRegions.push_back(OMPD_nothing);
- break;
- case OMPD_loop:
- // TODO: 'loop' may require different capture regions depending on the bind
- // clause or the parent directive when there is no bind clause. Use
- // OMPD_unknown for now.
- case OMPD_simd:
- case OMPD_for:
- case OMPD_for_simd:
- case OMPD_sections:
- case OMPD_single:
- case OMPD_taskgroup:
- case OMPD_distribute:
- case OMPD_ordered:
- case OMPD_target_data:
- case OMPD_distribute_simd:
- case OMPD_scope:
- case OMPD_dispatch:
+ auto GetRegionsForLeaf = [&](OpenMPDirectiveKind LKind) {
+ assert(isLeafConstruct(LKind) && "Epecting leaf directive");
+ // Whether a leaf would require OMPD_unknown if it occured on its own.
+ switch (LKind) {
+ case OMPD_metadirective:
+ CaptureRegions.push_back(OMPD_metadirective);
+ break;
+ case OMPD_nothing:
+ CaptureRegions.push_back(OMPD_nothing);
+ break;
+ case OMPD_parallel:
+ CaptureRegions.push_back(OMPD_parallel);
+ break;
+ case OMPD_target:
+ CaptureRegions.push_back(OMPD_task);
+ CaptureRegions.push_back(OMPD_target);
+ break;
+ case OMPD_task:
+ case OMPD_target_enter_data:
+ case OMPD_target_exit_data:
+ case OMPD_target_update:
+ CaptureRegions.push_back(OMPD_task);
+ break;
+ case OMPD_teams:
+ CaptureRegions.push_back(OMPD_teams);
+ break;
+ case OMPD_taskloop:
+ CaptureRegions.push_back(OMPD_taskloop);
+ break;
+ case OMPD_loop:
+ // TODO: 'loop' may require different capture regions depending on the
+ // bind clause or the parent directive when there is no bind clause.
+ // If any of the directives that push regions here are parents of 'loop',
+ // assume 'parallel'. Otherwise do nothing.
+ if (!CaptureRegions.empty() &&
+ !llvm::is_contained(CaptureRegions, OMPD_parallel))
+ CaptureRegions.push_back(OMPD_parallel);
+ else
+ return true;
+ break;
+ case OMPD_dispatch:
+ case OMPD_distribute:
+ case OMPD_for:
+ case OMPD_masked:
+ case OMPD_master:
+ case OMPD_ordered:
+ case OMPD_scope:
+ case OMPD_sections:
+ case OMPD_simd:
+ case OMPD_single:
+ case OMPD_target_data:
+ case OMPD_taskgroup:
+ // These directives (when standalone) use OMPD_unknown as the region,
+ // but when they're constituents of a compound directive, and other
+ // leafs from that directive have specific regions, then these directives
+ // add no additional regions.
+ return true;
+ default:
+ llvm::errs() << getOpenMPDirectiveName(LKind) << '\n';
+ llvm_unreachable("Unexpected directive");
+ }
+ return false;
+ };
+
+ bool MayNeedUnknownRegion = false;
+ for (OpenMPDirectiveKind L : getLeafConstructsOrSelf(DKind))
+ MayNeedUnknownRegion |= GetRegionsForLeaf(L);
+
+ // We need OMPD_unknown when no regions were added, and specific leaf
+ // constructs were present. Push a single OMPD_unknown as the capture
+ /// region.
+ if (CaptureRegions.empty() && MayNeedUnknownRegion)
CaptureRegions.push_back(OMPD_unknown);
- break;
- default:
- llvm_unreachable("Unhandled OpenMP directive");
- }
+
+ // OMPD_unknown is only expected as the only region. If other regions
+ // are present OMPD_unknown should not be present.
+ assert((CaptureRegions[0] == OMPD_unknown ||
+ !llvm::is_contained(CaptureRegions, OMPD_unknown)) &&
+ "Misplaced OMPD_unknown");
}
bool clang::checkFailClauseParameter(OpenMPClauseKind FailClauseParameter) {
diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h
index a5daf36..9a985e4 100644
--- a/clang/lib/Basic/Targets/NVPTX.h
+++ b/clang/lib/Basic/Targets/NVPTX.h
@@ -105,6 +105,7 @@ public:
case 'l':
case 'f':
case 'd':
+ case 'q':
Info.setAllowsRegister();
return true;
}
diff --git a/clang/lib/CodeGen/CGDeclCXX.cpp b/clang/lib/CodeGen/CGDeclCXX.cpp
index e18b339..05dd7dd 100644
--- a/clang/lib/CodeGen/CGDeclCXX.cpp
+++ b/clang/lib/CodeGen/CGDeclCXX.cpp
@@ -840,6 +840,10 @@ CodeGenModule::EmitCXXGlobalInitFunc() {
// No Itanium initializer in header like modules.
if (M->isHeaderLikeModule())
continue;
+ // We're allowed to skip the initialization if we are sure it doesn't
+ // do any thing.
+ if (!M->isNamedModuleInterfaceHasInit())
+ continue;
llvm::FunctionType *FTy = llvm::FunctionType::get(VoidTy, false);
SmallString<256> FnName;
{
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 3e88cd7..10d972e 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -1079,33 +1079,38 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) {
if (!RD->isExternallyVisible())
return llvm::GlobalVariable::InternalLinkage;
- // V-tables for non-template classes with an owning module are always
- // uniquely emitted in that module.
- if (RD->isInNamedModule())
- return llvm::GlobalVariable::ExternalLinkage;
-
- // We're at the end of the translation unit, so the current key
- // function is fully correct.
- const CXXMethodDecl *keyFunction = Context.getCurrentKeyFunction(RD);
- if (keyFunction && !RD->hasAttr<DLLImportAttr>()) {
+ bool IsInNamedModule = RD->isInNamedModule();
+ // If the CXXRecordDecl are not in a module unit, we need to get
+ // its key function. We're at the end of the translation unit, so the current
+ // key function is fully correct.
+ const CXXMethodDecl *keyFunction =
+ IsInNamedModule ? nullptr : Context.getCurrentKeyFunction(RD);
+ if (IsInNamedModule || (keyFunction && !RD->hasAttr<DLLImportAttr>())) {
// If this class has a key function, use that to determine the
// linkage of the vtable.
const FunctionDecl *def = nullptr;
- if (keyFunction->hasBody(def))
+ if (keyFunction && keyFunction->hasBody(def))
keyFunction = cast<CXXMethodDecl>(def);
- switch (keyFunction->getTemplateSpecializationKind()) {
- case TSK_Undeclared:
- case TSK_ExplicitSpecialization:
+ bool IsExternalDefinition =
+ IsInNamedModule ? RD->shouldEmitInExternalSource() : !def;
+
+ TemplateSpecializationKind Kind =
+ IsInNamedModule ? RD->getTemplateSpecializationKind()
+ : keyFunction->getTemplateSpecializationKind();
+
+ switch (Kind) {
+ case TSK_Undeclared:
+ case TSK_ExplicitSpecialization:
assert(
- (def || CodeGenOpts.OptimizationLevel > 0 ||
+ (IsInNamedModule || def || CodeGenOpts.OptimizationLevel > 0 ||
CodeGenOpts.getDebugInfo() != llvm::codegenoptions::NoDebugInfo) &&
- "Shouldn't query vtable linkage without key function, "
- "optimizations, or debug info");
- if (!def && CodeGenOpts.OptimizationLevel > 0)
+ "Shouldn't query vtable linkage without the class in module units, "
+ "key function, optimizations, or debug info");
+ if (IsExternalDefinition && CodeGenOpts.OptimizationLevel > 0)
return llvm::GlobalVariable::AvailableExternallyLinkage;
- if (keyFunction->isInlined())
+ if (keyFunction && keyFunction->isInlined())
return !Context.getLangOpts().AppleKext
? llvm::GlobalVariable::LinkOnceODRLinkage
: llvm::Function::InternalLinkage;
@@ -1124,7 +1129,7 @@ CodeGenModule::getVTableLinkage(const CXXRecordDecl *RD) {
case TSK_ExplicitInstantiationDeclaration:
llvm_unreachable("Should not have been asked to emit this");
- }
+ }
}
// -fapple-kext mode does not support weak linkage, so we must use
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 8f4cc47..977e083 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -811,6 +811,12 @@ std::optional<std::string> ToolChain::getStdlibPath() const {
return getTargetSubDirPath(P);
}
+std::optional<std::string> ToolChain::getStdlibIncludePath() const {
+ SmallString<128> P(D.Dir);
+ llvm::sys::path::append(P, "..", "include");
+ return getTargetSubDirPath(P);
+}
+
ToolChain::path_list ToolChain::getArchSpecificLibPaths() const {
path_list Paths;
diff --git a/clang/lib/Driver/ToolChains/BareMetal.cpp b/clang/lib/Driver/ToolChains/BareMetal.cpp
index dd365e6..11f9487 100644
--- a/clang/lib/Driver/ToolChains/BareMetal.cpp
+++ b/clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -270,15 +270,19 @@ void BareMetal::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
addSystemInclude(DriverArgs, CC1Args, Dir.str());
}
- if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) {
- const SmallString<128> SysRoot(computeSysRoot());
- if (!SysRoot.empty()) {
- for (const Multilib &M : getOrderedMultilibs()) {
- SmallString<128> Dir(SysRoot);
- llvm::sys::path::append(Dir, M.includeSuffix());
- llvm::sys::path::append(Dir, "include");
- addSystemInclude(DriverArgs, CC1Args, Dir.str());
- }
+ if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+ return;
+
+ if (std::optional<std::string> Path = getStdlibIncludePath())
+ addSystemInclude(DriverArgs, CC1Args, *Path);
+
+ const SmallString<128> SysRoot(computeSysRoot());
+ if (!SysRoot.empty()) {
+ for (const Multilib &M : getOrderedMultilibs()) {
+ SmallString<128> Dir(SysRoot);
+ llvm::sys::path::append(Dir, M.includeSuffix());
+ llvm::sys::path::append(Dir, "include");
+ addSystemInclude(DriverArgs, CC1Args, Dir.str());
}
}
}
@@ -296,6 +300,40 @@ void BareMetal::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs,
return;
const Driver &D = getDriver();
+ std::string Target = getTripleString();
+
+ auto AddCXXIncludePath = [&](StringRef Path) {
+ std::string Version = detectLibcxxVersion(Path);
+ if (Version.empty())
+ return;
+
+ {
+ // First the per-target include dir: include/<target>/c++/v1.
+ SmallString<128> TargetDir(Path);
+ llvm::sys::path::append(TargetDir, Target, "c++", Version);
+ addSystemInclude(DriverArgs, CC1Args, TargetDir);
+ }
+
+ {
+ // Then the generic dir: include/c++/v1.
+ SmallString<128> Dir(Path);
+ llvm::sys::path::append(Dir, "c++", Version);
+ addSystemInclude(DriverArgs, CC1Args, Dir);
+ }
+ };
+
+ switch (GetCXXStdlibType(DriverArgs)) {
+ case ToolChain::CST_Libcxx: {
+ SmallString<128> P(D.Dir);
+ llvm::sys::path::append(P, "..", "include");
+ AddCXXIncludePath(P);
+ break;
+ }
+ case ToolChain::CST_Libstdcxx:
+ // We only support libc++ toolchain installation.
+ break;
+ }
+
std::string SysRoot(computeSysRoot());
if (SysRoot.empty())
return;
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 49e029e..98a878e 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -568,16 +568,12 @@ std::string Linux::getDynamicLinker(const ArgList &Args) const {
Loader =
(tools::ppc::hasPPCAbiArg(Args, "elfv1")) ? "ld64.so.1" : "ld64.so.2";
break;
- case llvm::Triple::riscv32: {
- StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
- LibDir = "lib";
- Loader = ("ld-linux-riscv32-" + ABIName + ".so.1").str();
- break;
- }
+ case llvm::Triple::riscv32:
case llvm::Triple::riscv64: {
+ StringRef ArchName = llvm::Triple::getArchTypeName(Arch);
StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
LibDir = "lib";
- Loader = ("ld-linux-riscv64-" + ABIName + ".so.1").str();
+ Loader = ("ld-linux-" + ArchName + "-" + ABIName + ".so.1").str();
break;
}
case llvm::Triple::sparc:
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 259ef1d..6a8883b 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -729,6 +729,7 @@ template <> struct MappingTraits<FormatStyle::SpacesInLineComment> {
template <> struct MappingTraits<FormatStyle::SpacesInParensCustom> {
static void mapping(IO &IO, FormatStyle::SpacesInParensCustom &Spaces) {
+ IO.mapOptional("ExceptDoubleParentheses", Spaces.ExceptDoubleParentheses);
IO.mapOptional("InCStyleCasts", Spaces.InCStyleCasts);
IO.mapOptional("InConditionalStatements", Spaces.InConditionalStatements);
IO.mapOptional("InEmptyParentheses", Spaces.InEmptyParentheses);
@@ -1184,8 +1185,8 @@ template <> struct MappingTraits<FormatStyle> {
(SpacesInParentheses || SpaceInEmptyParentheses ||
SpacesInConditionalStatement || SpacesInCStyleCastParentheses)) {
if (SpacesInParentheses) {
- // set all options except InCStyleCasts and InEmptyParentheses
- // to true for backward compatibility.
+ // For backward compatibility.
+ Style.SpacesInParensOptions.ExceptDoubleParentheses = false;
Style.SpacesInParensOptions.InConditionalStatements = true;
Style.SpacesInParensOptions.InCStyleCasts =
SpacesInCStyleCastParentheses;
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 03082cd..0fd0214 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -4361,6 +4361,15 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
Right.is(tok::r_brace) && Right.isNot(BK_Block))) {
return Style.SpacesInParensOptions.InEmptyParentheses;
}
+ if (Style.SpacesInParens == FormatStyle::SIPO_Custom &&
+ Style.SpacesInParensOptions.ExceptDoubleParentheses &&
+ Left.is(tok::r_paren) && Right.is(tok::r_paren)) {
+ auto *InnerLParen = Left.MatchingParen;
+ if (InnerLParen && InnerLParen->Previous == Right.MatchingParen) {
+ InnerLParen->SpacesRequiredBefore = 0;
+ return false;
+ }
+ }
if (Style.SpacesInParensOptions.InConditionalStatements) {
const FormatToken *LeftParen = nullptr;
if (Left.is(tok::l_paren))
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 55ec460..5e52555 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -448,7 +448,9 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
// value is, are implementation-defined.
// (Removed in C++20.)
if (!LangOpts.CPlusPlus) {
- if (LangOpts.C23)
+ if (LangOpts.C2y)
+ Builder.defineMacro("__STDC_VERSION__", "202400L");
+ else if (LangOpts.C23)
Builder.defineMacro("__STDC_VERSION__", "202311L");
else if (LangOpts.C17)
Builder.defineMacro("__STDC_VERSION__", "201710L");
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
index 6ae955a..764cdc6 100644
--- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp
@@ -465,15 +465,15 @@ namespace {
std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag);
std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
- StringRef funcName, std::string Tag);
- std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
- StringRef funcName, std::string Tag);
- std::string SynthesizeBlockImpl(BlockExpr *CE,
- std::string Tag, std::string Desc);
- std::string SynthesizeBlockDescriptor(std::string DescTag,
- std::string ImplTag,
- int i, StringRef funcName,
- unsigned hasCopy);
+ StringRef funcName,
+ const std::string &Tag);
+ std::string SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName,
+ const std::string &Tag);
+ std::string SynthesizeBlockImpl(BlockExpr *CE, const std::string &Tag,
+ const std::string &Desc);
+ std::string SynthesizeBlockDescriptor(const std::string &DescTag,
+ const std::string &ImplTag, int i,
+ StringRef funcName, unsigned hasCopy);
Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp);
void SynthesizeBlockLiterals(SourceLocation FunLocStart,
StringRef FunName);
@@ -4037,7 +4037,7 @@ static bool HasLocalVariableExternalStorage(ValueDecl *VD) {
std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
StringRef funcName,
- std::string Tag) {
+ const std::string &Tag) {
const FunctionType *AFT = CE->getFunctionType();
QualType RT = AFT->getReturnType();
std::string StructRef = "struct " + Tag;
@@ -4131,9 +4131,8 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
return S;
}
-std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
- StringRef funcName,
- std::string Tag) {
+std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(
+ BlockExpr *CE, int i, StringRef funcName, const std::string &Tag) {
std::string StructRef = "struct " + Tag;
std::string S = "static void __";
@@ -4175,8 +4174,9 @@ std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
return S;
}
-std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
- std::string Desc) {
+std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE,
+ const std::string &Tag,
+ const std::string &Desc) {
std::string S = "\nstruct " + Tag;
std::string Constructor = " " + Tag;
@@ -4290,10 +4290,9 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta
return S;
}
-std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag,
- std::string ImplTag, int i,
- StringRef FunName,
- unsigned hasCopy) {
+std::string RewriteModernObjC::SynthesizeBlockDescriptor(
+ const std::string &DescTag, const std::string &ImplTag, int i,
+ StringRef FunName, unsigned hasCopy) {
std::string S = "\nstatic struct " + DescTag;
S += " {\n size_t reserved;\n";
diff --git a/clang/lib/Interpreter/CMakeLists.txt b/clang/lib/Interpreter/CMakeLists.txt
index 9065f99..6a06965 100644
--- a/clang/lib/Interpreter/CMakeLists.txt
+++ b/clang/lib/Interpreter/CMakeLists.txt
@@ -12,6 +12,10 @@ set(LLVM_LINK_COMPONENTS
TargetParser
)
+if (EMSCRIPTEN AND "lld" IN_LIST LLVM_ENABLE_PROJECTS)
+ set(WASM_SRC Wasm.cpp)
+endif()
+
add_clang_library(clangInterpreter
DeviceOffload.cpp
CodeCompletion.cpp
@@ -20,6 +24,8 @@ add_clang_library(clangInterpreter
Interpreter.cpp
InterpreterUtils.cpp
Value.cpp
+ ${WASM_SRC}
+ PARTIAL_SOURCES_INTENDED
DEPENDS
intrinsics_gen
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 6f03610..1824a5b 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -36,6 +36,8 @@ LLVM_ATTRIBUTE_USED void linkComponents() {
}
namespace clang {
+IncrementalExecutor::IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC)
+ : TSCtx(TSC) {}
llvm::Expected<std::unique_ptr<llvm::orc::LLJITBuilder>>
IncrementalExecutor::createDefaultJITBuilder(
diff --git a/clang/lib/Interpreter/IncrementalExecutor.h b/clang/lib/Interpreter/IncrementalExecutor.h
index b434720..7954cde 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.h
+++ b/clang/lib/Interpreter/IncrementalExecutor.h
@@ -43,16 +43,19 @@ class IncrementalExecutor {
llvm::DenseMap<const PartialTranslationUnit *, llvm::orc::ResourceTrackerSP>
ResourceTrackers;
+protected:
+ IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);
+
public:
enum SymbolNameKind { IRName, LinkerName };
IncrementalExecutor(llvm::orc::ThreadSafeContext &TSC,
llvm::orc::LLJITBuilder &JITBuilder, llvm::Error &Err);
- ~IncrementalExecutor();
+ virtual ~IncrementalExecutor();
- llvm::Error addModule(PartialTranslationUnit &PTU);
- llvm::Error removeModule(PartialTranslationUnit &PTU);
- llvm::Error runCtors() const;
+ virtual llvm::Error addModule(PartialTranslationUnit &PTU);
+ virtual llvm::Error removeModule(PartialTranslationUnit &PTU);
+ virtual llvm::Error runCtors() const;
llvm::Error cleanUp();
llvm::Expected<llvm::orc::ExecutorAddr>
getSymbolAddress(llvm::StringRef Name, SymbolNameKind NameKind) const;
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp
index 7a95278..49dc92d 100644
--- a/clang/lib/Interpreter/Interpreter.cpp
+++ b/clang/lib/Interpreter/Interpreter.cpp
@@ -15,6 +15,9 @@
#include "IncrementalExecutor.h"
#include "IncrementalParser.h"
#include "InterpreterUtils.h"
+#ifdef __EMSCRIPTEN__
+#include "Wasm.h"
+#endif // __EMSCRIPTEN__
#include "clang/AST/ASTContext.h"
#include "clang/AST/Mangle.h"
@@ -186,6 +189,12 @@ IncrementalCompilerBuilder::CreateCpp() {
std::vector<const char *> Argv;
Argv.reserve(5 + 1 + UserArgs.size());
Argv.push_back("-xc++");
+#ifdef __EMSCRIPTEN__
+ Argv.push_back("-target");
+ Argv.push_back("wasm32-unknown-emscripten");
+ Argv.push_back("-pie");
+ Argv.push_back("-shared");
+#endif
Argv.insert(Argv.end(), UserArgs.begin(), UserArgs.end());
std::string TT = TargetTriple ? *TargetTriple : llvm::sys::getProcessTriple();
@@ -426,8 +435,12 @@ llvm::Error Interpreter::CreateExecutor() {
}
llvm::Error Err = llvm::Error::success();
+#ifdef __EMSCRIPTEN__
+ auto Executor = std::make_unique<WasmIncrementalExecutor>(*TSCtx);
+#else
auto Executor =
std::make_unique<IncrementalExecutor>(*TSCtx, *JITBuilder, Err);
+#endif
if (!Err)
IncrExecutor = std::move(Executor);
diff --git a/clang/lib/Interpreter/Wasm.cpp b/clang/lib/Interpreter/Wasm.cpp
new file mode 100644
index 0000000..1001410
--- /dev/null
+++ b/clang/lib/Interpreter/Wasm.cpp
@@ -0,0 +1,114 @@
+//===----------------- Wasm.cpp - Wasm Interpreter --------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements interpreter support for code execution in WebAssembly.
+//
+//===----------------------------------------------------------------------===//
+
+#include "Wasm.h"
+#include "IncrementalExecutor.h"
+
+#include <llvm/IR/LegacyPassManager.h>
+#include <llvm/IR/Module.h>
+#include <llvm/MC/TargetRegistry.h>
+#include <llvm/Target/TargetMachine.h>
+
+#include <clang/Interpreter/Interpreter.h>
+
+#include <string>
+
+namespace lld {
+namespace wasm {
+bool link(llvm::ArrayRef<const char *> args, llvm::raw_ostream &stdoutOS,
+ llvm::raw_ostream &stderrOS, bool exitEarly, bool disableOutput);
+} // namespace wasm
+} // namespace lld
+
+#include <dlfcn.h>
+
+namespace clang {
+
+WasmIncrementalExecutor::WasmIncrementalExecutor(
+ llvm::orc::ThreadSafeContext &TSC)
+ : IncrementalExecutor(TSC) {}
+
+llvm::Error WasmIncrementalExecutor::addModule(PartialTranslationUnit &PTU) {
+ std::string ErrorString;
+
+ const llvm::Target *Target = llvm::TargetRegistry::lookupTarget(
+ PTU.TheModule->getTargetTriple(), ErrorString);
+ if (!Target) {
+ return llvm::make_error<llvm::StringError>("Failed to create Wasm Target: ",
+ llvm::inconvertibleErrorCode());
+ }
+
+ llvm::TargetOptions TO = llvm::TargetOptions();
+ llvm::TargetMachine *TargetMachine = Target->createTargetMachine(
+ PTU.TheModule->getTargetTriple(), "", "", TO, llvm::Reloc::Model::PIC_);
+ PTU.TheModule->setDataLayout(TargetMachine->createDataLayout());
+ std::string OutputFileName = PTU.TheModule->getName().str() + ".wasm";
+
+ std::error_code Error;
+ llvm::raw_fd_ostream OutputFile(llvm::StringRef(OutputFileName), Error);
+
+ llvm::legacy::PassManager PM;
+ if (TargetMachine->addPassesToEmitFile(PM, OutputFile, nullptr,
+ llvm::CodeGenFileType::ObjectFile)) {
+ return llvm::make_error<llvm::StringError>(
+ "Wasm backend cannot produce object.", llvm::inconvertibleErrorCode());
+ }
+
+ if (!PM.run(*PTU.TheModule)) {
+
+ return llvm::make_error<llvm::StringError>("Failed to emit Wasm object.",
+ llvm::inconvertibleErrorCode());
+ }
+
+ OutputFile.close();
+
+ std::vector<const char *> LinkerArgs = {"wasm-ld",
+ "-pie",
+ "--import-memory",
+ "--no-entry",
+ "--export-all",
+ "--experimental-pic",
+ "--no-export-dynamic",
+ "--stack-first",
+ OutputFileName.c_str(),
+ "-o",
+ OutputFileName.c_str()};
+ int Result =
+ lld::wasm::link(LinkerArgs, llvm::outs(), llvm::errs(), false, false);
+ if (!Result)
+ return llvm::make_error<llvm::StringError>(
+ "Failed to link incremental module", llvm::inconvertibleErrorCode());
+
+ void *LoadedLibModule =
+ dlopen(OutputFileName.c_str(), RTLD_NOW | RTLD_GLOBAL);
+ if (LoadedLibModule == nullptr) {
+ llvm::errs() << dlerror() << '\n';
+ return llvm::make_error<llvm::StringError>(
+ "Failed to load incremental module", llvm::inconvertibleErrorCode());
+ }
+
+ return llvm::Error::success();
+}
+
+llvm::Error WasmIncrementalExecutor::removeModule(PartialTranslationUnit &PTU) {
+ return llvm::make_error<llvm::StringError>("Not implemented yet",
+ llvm::inconvertibleErrorCode());
+}
+
+llvm::Error WasmIncrementalExecutor::runCtors() const {
+ // This seems to be automatically done when using dlopen()
+ return llvm::Error::success();
+}
+
+WasmIncrementalExecutor::~WasmIncrementalExecutor() = default;
+
+} // namespace clang
diff --git a/clang/lib/Interpreter/Wasm.h b/clang/lib/Interpreter/Wasm.h
new file mode 100644
index 0000000..b1fd880
--- /dev/null
+++ b/clang/lib/Interpreter/Wasm.h
@@ -0,0 +1,37 @@
+//===------------------ Wasm.h - Wasm Interpreter ---------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements interpreter support for code execution in WebAssembly.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_LIB_INTERPRETER_WASM_H
+#define LLVM_CLANG_LIB_INTERPRETER_WASM_H
+
+#ifndef __EMSCRIPTEN__
+#error "This requires emscripten."
+#endif // __EMSCRIPTEN__
+
+#include "IncrementalExecutor.h"
+
+namespace clang {
+
+class WasmIncrementalExecutor : public IncrementalExecutor {
+public:
+ WasmIncrementalExecutor(llvm::orc::ThreadSafeContext &TSC);
+
+ llvm::Error addModule(PartialTranslationUnit &PTU) override;
+ llvm::Error removeModule(PartialTranslationUnit &PTU) override;
+ llvm::Error runCtors() const override;
+
+ ~WasmIncrementalExecutor() override;
+};
+
+} // namespace clang
+
+#endif // LLVM_CLANG_LIB_INTERPRETER_WASM_H
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index 9fc3cd7..2dd2e1b 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -3449,7 +3449,8 @@ ExprResult Parser::ParseGenericSelectionExpression() {
}
const auto *LIT = cast<LocInfoType>(ControllingType.get().get());
SourceLocation Loc = LIT->getTypeSourceInfo()->getTypeLoc().getBeginLoc();
- Diag(Loc, diag::ext_generic_with_type_arg);
+ Diag(Loc, getLangOpts().C2y ? diag::warn_c2y_compat_generic_with_type_arg
+ : diag::ext_c2y_generic_with_type_arg);
} else {
// C11 6.5.1.1p3 "The controlling expression of a generic selection is
// not evaluated."
diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp
index be77949..2f9ef28 100644
--- a/clang/lib/Sema/CheckExprLifetime.cpp
+++ b/clang/lib/Sema/CheckExprLifetime.cpp
@@ -966,27 +966,11 @@ static bool pathOnlyInitializesGslPointer(IndirectLocalPath &Path) {
return false;
}
-static void checkExprLifetimeImpl(
- Sema &SemaRef,
- llvm::PointerUnion<const InitializedEntity *, const AssignedEntity *>
- CEntity,
- Expr *Init) {
- LifetimeKind LK = LK_FullExpression;
-
- const AssignedEntity *AEntity = nullptr;
- // Local variables for initialized entity.
- const InitializedEntity *InitEntity = nullptr;
- const InitializedEntity *ExtendingEntity = nullptr;
- if (CEntity.is<const InitializedEntity *>()) {
- InitEntity = CEntity.get<const InitializedEntity *>();
- auto LTResult = getEntityLifetime(InitEntity);
- LK = LTResult.getInt();
- ExtendingEntity = LTResult.getPointer();
- } else {
- AEntity = CEntity.get<const AssignedEntity *>();
- if (AEntity->LHS->getType()->isPointerType()) // builtin pointer type
- LK = LK_Extended;
- }
+static void checkExprLifetimeImpl(Sema &SemaRef,
+ const InitializedEntity *InitEntity,
+ const InitializedEntity *ExtendingEntity,
+ LifetimeKind LK,
+ const AssignedEntity *AEntity, Expr *Init) {
// If this entity doesn't have an interesting lifetime, don't bother looking
// for temporaries within its initializer.
if (LK == LK_FullExpression)
@@ -1024,7 +1008,19 @@ static void checkExprLifetimeImpl(
return true;
}
}
+ if (AEntity) {
+ if (!MTE)
+ return false;
+ assert(shouldLifetimeExtendThroughPath(Path) ==
+ PathLifetimeKind::NoExtend &&
+ "No lifetime extension for assignments");
+ if (!pathContainsInit(Path))
+ SemaRef.Diag(DiagLoc, diag::warn_dangling_pointer_assignment)
+ << AEntity->LHS << DiagRange;
+ return false;
+ }
+ assert(InitEntity && "only for initialization");
switch (LK) {
case LK_FullExpression:
llvm_unreachable("already handled this");
@@ -1047,8 +1043,6 @@ static void checkExprLifetimeImpl(
switch (shouldLifetimeExtendThroughPath(Path)) {
case PathLifetimeKind::Extend:
- assert(InitEntity && "Lifetime extension should happen only for "
- "initialization and not assignment");
// Update the storage duration of the materialized temporary.
// FIXME: Rebuild the expression instead of mutating it.
MTE->setExtendingDecl(ExtendingEntity->getDecl(),
@@ -1057,8 +1051,6 @@ static void checkExprLifetimeImpl(
return true;
case PathLifetimeKind::ShouldExtend:
- assert(InitEntity && "Lifetime extension should happen only for "
- "initialization and not assignment");
// We're supposed to lifetime-extend the temporary along this path (per
// the resolution of DR1815), but we don't support that yet.
//
@@ -1076,23 +1068,16 @@ static void checkExprLifetimeImpl(
if (pathContainsInit(Path))
return false;
- if (InitEntity) {
- SemaRef.Diag(DiagLoc, diag::warn_dangling_variable)
- << RK << !InitEntity->getParent()
- << ExtendingEntity->getDecl()->isImplicit()
- << ExtendingEntity->getDecl() << Init->isGLValue() << DiagRange;
- } else {
- SemaRef.Diag(DiagLoc, diag::warn_dangling_pointer_assignment)
- << AEntity->LHS << DiagRange;
- }
+ SemaRef.Diag(DiagLoc, diag::warn_dangling_variable)
+ << RK << !InitEntity->getParent()
+ << ExtendingEntity->getDecl()->isImplicit()
+ << ExtendingEntity->getDecl() << Init->isGLValue() << DiagRange;
break;
}
break;
}
case LK_MemInitializer: {
- assert(InitEntity && "Expect only on initializing the entity");
-
if (MTE) {
// Under C++ DR1696, if a mem-initializer (or a default member
// initializer used by the absence of one) would lifetime-extend a
@@ -1167,7 +1152,6 @@ static void checkExprLifetimeImpl(
}
case LK_New:
- assert(InitEntity && "Expect only on initializing the entity");
if (isa<MaterializeTemporaryExpr>(L)) {
if (IsGslPtrInitWithGslTempOwner)
SemaRef.Diag(DiagLoc, diag::warn_dangling_lifetime_pointer)
@@ -1185,7 +1169,6 @@ static void checkExprLifetimeImpl(
case LK_Return:
case LK_StmtExprResult:
- assert(InitEntity && "Expect only on initializing the entity");
if (auto *DRE = dyn_cast<DeclRefExpr>(L)) {
// We can't determine if the local variable outlives the statement
// expression.
@@ -1292,12 +1275,18 @@ static void checkExprLifetimeImpl(
void checkExprLifetime(Sema &SemaRef, const InitializedEntity &Entity,
Expr *Init) {
- checkExprLifetimeImpl(SemaRef, &Entity, Init);
+ auto LTResult = getEntityLifetime(&Entity);
+ LifetimeKind LK = LTResult.getInt();
+ const InitializedEntity *ExtendingEntity = LTResult.getPointer();
+ checkExprLifetimeImpl(SemaRef, &Entity, ExtendingEntity, LK, nullptr, Init);
}
void checkExprLifetime(Sema &SemaRef, const AssignedEntity &Entity,
Expr *Init) {
- checkExprLifetimeImpl(SemaRef, &Entity, Init);
+ LifetimeKind LK = LK_FullExpression;
+ if (Entity.LHS->getType()->isPointerType()) // builtin pointer type
+ LK = LK_Extended;
+ checkExprLifetimeImpl(SemaRef, nullptr, nullptr, LK, &Entity, Init);
}
} // namespace clang::sema
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index cc811a4..852344d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4486,8 +4486,16 @@ bool Sema::CheckUnaryExprOrTypeTraitOperand(QualType ExprType,
// When alignof or _Alignof is applied to an array type, the result
// is the alignment of the element type.
if (ExprKind == UETT_AlignOf || ExprKind == UETT_PreferredAlignOf ||
- ExprKind == UETT_OpenMPRequiredSimdAlign)
+ ExprKind == UETT_OpenMPRequiredSimdAlign) {
+ // If the trait is 'alignof' in C before C2y, the ability to apply the
+ // trait to an incomplete array is an extension.
+ if (ExprKind == UETT_AlignOf && !getLangOpts().CPlusPlus &&
+ ExprType->isIncompleteArrayType())
+ Diag(OpLoc, getLangOpts().C2y
+ ? diag::warn_c2y_compat_alignof_incomplete_array
+ : diag::ext_c2y_alignof_incomplete_array);
ExprType = Context.getBaseElementType(ExprType);
+ }
if (ExprKind == UETT_VecStep)
return CheckVecStepTraitOperandType(*this, ExprType, OpLoc, ExprRange);
@@ -13764,8 +13772,9 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op,
return QualType();
} else if (ResType->isAnyComplexType()) {
// C99 does not support ++/-- on complex types, we allow as an extension.
- S.Diag(OpLoc, diag::ext_increment_complex)
- << IsInc << Op->getSourceRange();
+ S.Diag(OpLoc, S.getLangOpts().C2y ? diag::warn_c2y_compat_increment_complex
+ : diag::ext_c2y_increment_complex)
+ << IsInc << Op->getSourceRange();
} else if (ResType->isPlaceholderType()) {
ExprResult PR = S.CheckPlaceholderExpr(Op);
if (PR.isInvalid()) return QualType();
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 982cca6..5ea6b06 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -40,6 +40,7 @@
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLForwardCompat.h"
+#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
@@ -11884,6 +11885,46 @@ static void DiagnoseFailedExplicitSpec(Sema &S, OverloadCandidate *Cand) {
<< (ES.getExpr() ? ES.getExpr()->getSourceRange() : SourceRange());
}
+static void NoteImplicitDeductionGuide(Sema &S, FunctionDecl *Fn) {
+ auto *DG = dyn_cast<CXXDeductionGuideDecl>(Fn);
+ if (!DG)
+ return;
+ TemplateDecl *OriginTemplate =
+ DG->getDeclName().getCXXDeductionGuideTemplate();
+ // We want to always print synthesized deduction guides for type aliases.
+ // They would retain the explicit bit of the corresponding constructor.
+ if (!(DG->isImplicit() || (OriginTemplate && OriginTemplate->isTypeAlias())))
+ return;
+ std::string FunctionProto;
+ llvm::raw_string_ostream OS(FunctionProto);
+ FunctionTemplateDecl *Template = DG->getDescribedFunctionTemplate();
+ if (!Template) {
+ // This also could be an instantiation. Find out the primary template.
+ FunctionDecl *Pattern =
+ DG->getTemplateInstantiationPattern(/*ForDefinition=*/false);
+ if (!Pattern) {
+ // The implicit deduction guide is built on an explicit non-template
+ // deduction guide. Currently, this might be the case only for type
+ // aliases.
+ // FIXME: Add a test once https://github.com/llvm/llvm-project/pull/96686
+ // gets merged.
+ assert(OriginTemplate->isTypeAlias() &&
+ "Non-template implicit deduction guides are only possible for "
+ "type aliases");
+ DG->print(OS);
+ S.Diag(DG->getLocation(), diag::note_implicit_deduction_guide)
+ << FunctionProto;
+ return;
+ }
+ Template = Pattern->getDescribedFunctionTemplate();
+ assert(Template && "Cannot find the associated function template of "
+ "CXXDeductionGuideDecl?");
+ }
+ Template->print(OS);
+ S.Diag(DG->getLocation(), diag::note_implicit_deduction_guide)
+ << FunctionProto;
+}
+
/// Generates a 'note' diagnostic for an overload candidate. We've
/// already generated a primary error at the call site.
///
@@ -11941,6 +11982,17 @@ static void NoteFunctionCandidate(Sema &S, OverloadCandidate *Cand,
return;
}
+ // If this is a synthesized deduction guide we're deducing against, add a note
+ // for it. These deduction guides are not explicitly spelled in the source
+ // code, so simply printing a deduction failure note mentioning synthesized
+ // template parameters or pointing to the header of the surrounding RecordDecl
+ // would be confusing.
+ //
+ // We prefer adding such notes at the end of the deduction failure because
+ // duplicate code snippets appearing in the diagnostic would likely become
+ // noisy.
+ auto _ = llvm::make_scope_exit([&] { NoteImplicitDeductionGuide(S, Fn); });
+
switch (Cand->FailureKind) {
case ovl_fail_too_many_arguments:
case ovl_fail_too_few_arguments:
diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c
index 684658d..9ec305d 100644
--- a/clang/test/AST/Interp/c.c
+++ b/clang/test/AST/Interp/c.c
@@ -293,3 +293,11 @@ void SuperSpecialFunc(void) {
const int SuperSpecialCase = 10;
_Static_assert((sizeof(SuperSpecialCase) == 12 && SuperSpecialCase == 3) || SuperSpecialCase == 10, ""); // pedantic-warning {{GNU extension}}
}
+
+
+void T1(void) {
+ static int *y[1] = {({ static int _x = 20; (void*)0;})}; // all-error {{initializer element is not a compile-time constant}} \
+ // pedantic-warning {{use of GNU statement expression extension}}
+}
+
+
diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp
index a7a602e..f70ca79e 100644
--- a/clang/test/AST/Interp/literals.cpp
+++ b/clang/test/AST/Interp/literals.cpp
@@ -1243,3 +1243,26 @@ namespace Extern {
static_assert(&ExternNonLiteralVarDecl() == &nl, "");
#endif
}
+
+#if __cplusplus >= 201402L
+constexpr int StmtExprEval() {
+ if (({
+ while (0);
+ true;
+ })) {
+ return 2;
+ }
+ return 1;
+}
+static_assert(StmtExprEval() == 2, "");
+
+constexpr int ReturnInStmtExpr() { // both-error {{never produces a constant expression}}
+ return ({
+ return 1; // both-note 2{{this use of statement expressions is not supported in a constant expression}}
+ 2;
+ });
+}
+static_assert(ReturnInStmtExpr() == 1, ""); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
+
+#endif
diff --git a/clang/test/C/C2y/n3192.c b/clang/test/C/C2y/n3192.c
new file mode 100644
index 0000000..b6f61d5
--- /dev/null
+++ b/clang/test/C/C2y/n3192.c
@@ -0,0 +1,43 @@
+// RUN: %clang_cc1 -verify -Wno-c23-extensions %s
+
+/* WG14 N3192: Yes
+ * Sequential hexdigits
+ */
+
+// expected-no-diagnostics
+
+// Demonstrate that hex digits are already sequential in all targets Clang
+// supports.
+
+#define TEST_VAL(ch) ((ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f'))
+#define GET_VAL(ch) (((ch >= 'A' && ch <= 'F') ? (ch - 'A') : (ch - 'a')) + 10)
+
+_Static_assert(TEST_VAL('A'));
+_Static_assert(TEST_VAL('B'));
+_Static_assert(TEST_VAL('C'));
+_Static_assert(TEST_VAL('D'));
+_Static_assert(TEST_VAL('E'));
+_Static_assert(TEST_VAL('F'));
+_Static_assert(TEST_VAL('a'));
+_Static_assert(TEST_VAL('b'));
+_Static_assert(TEST_VAL('c'));
+_Static_assert(TEST_VAL('d'));
+_Static_assert(TEST_VAL('e'));
+_Static_assert(TEST_VAL('f'));
+
+_Static_assert(!TEST_VAL('G'));
+_Static_assert(!TEST_VAL('h'));
+
+_Static_assert(GET_VAL('A') == 0xA);
+_Static_assert(GET_VAL('B') == 0xB);
+_Static_assert(GET_VAL('C') == 0xC);
+_Static_assert(GET_VAL('D') == 0xD);
+_Static_assert(GET_VAL('E') == 0xE);
+_Static_assert(GET_VAL('F') == 0xF);
+_Static_assert(GET_VAL('a') == 0xA);
+_Static_assert(GET_VAL('b') == 0xB);
+_Static_assert(GET_VAL('c') == 0xC);
+_Static_assert(GET_VAL('d') == 0xD);
+_Static_assert(GET_VAL('e') == 0xE);
+_Static_assert(GET_VAL('f') == 0xF);
+
diff --git a/clang/test/C/C2y/n3259.c b/clang/test/C/C2y/n3259.c
new file mode 100644
index 0000000..42c6720
--- /dev/null
+++ b/clang/test/C/C2y/n3259.c
@@ -0,0 +1,66 @@
+// RUN: %clang_cc1 -triple=x86_64 -std=c2y -Wall -pedantic -Wno-unused -Wpre-c2y-compat -verify=pre-c2y %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple=x86_64 -std=c23 -Wall -pedantic -Wno-unused %s -verify -emit-llvm -o - | FileCheck %s
+
+/* WG14 N3259: Yes
+ * Support ++ and -- on complex values
+ */
+
+// CHECK-LABEL: define {{.*}} void @test()
+void test() {
+ // CHECK: %[[F:.+]] = alloca { float, float }
+ // CHECK: store float 1
+ // CHECK: store float 0
+ _Complex float f = __builtin_complex(1.0f, 0.0f);
+
+ // CHECK: %[[F_REALP1:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_REAL:.+]] = load float, ptr %[[F_REALP1]]
+ // CHECK-NEXT: %[[F_IMAGP2:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: %[[F_IMAG:.+]] = load float, ptr %[[F_IMAGP2]]
+ // CHECK-NEXT: %[[INC:.+]] = fadd float %[[F_REAL]], 1.000000e+00
+ // CHECK-NEXT: %[[F_REALP3:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_IMAGP4:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: store float %[[INC]], ptr %[[F_REALP3]]
+ // CHECK-NEXT: store float %[[F_IMAG]], ptr %[[F_IMAGP4]]
+ f++; /* expected-warning {{'++' on an object of complex type is a C2y extension}}
+ pre-c2y-warning {{'++' on an object of complex type is incompatible with C standards before C2y}}
+ */
+
+ // CHECK: %[[F_REALP5:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_REAL6:.+]] = load float, ptr %[[F_REALP5]]
+ // CHECK-NEXT: %[[F_IMAGP7:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: %[[F_IMAG8:.+]] = load float, ptr %[[F_IMAGP7]]
+ // CHECK-NEXT: %[[INC9:.+]] = fadd float %[[F_REAL6]], 1.000000e+00
+ // CHECK-NEXT: %[[F_REALP10:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_IMAGP11:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: store float %[[INC9]], ptr %[[F_REALP10]]
+ // CHECK-NEXT: store float %[[F_IMAG8]], ptr %[[F_IMAGP11]]
+ ++f; /* expected-warning {{'++' on an object of complex type is a C2y extension}}
+ pre-c2y-warning {{'++' on an object of complex type is incompatible with C standards before C2y}}
+ */
+
+ // CHECK: %[[F_REALP12:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_REAL13:.+]] = load float, ptr %[[F_REALP12]]
+ // CHECK-NEXT: %[[F_IMAGP14:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: %[[F_IMAG15:.+]] = load float, ptr %[[F_IMAGP14]]
+ // CHECK-NEXT: %[[DEC:.+]] = fadd float %[[F_REAL13]], -1.000000e+00
+ // CHECK-NEXT: %[[F_REALP16:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_IMAGP17:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: store float %[[DEC]], ptr %[[F_REALP16]]
+ // CHECK-NEXT: store float %[[F_IMAG15]], ptr %[[F_IMAGP17]]
+ f--; /* expected-warning {{'--' on an object of complex type is a C2y extension}}
+ pre-c2y-warning {{'--' on an object of complex type is incompatible with C standards before C2y}}
+ */
+
+ // CHECK: %[[F_REALP18:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_REAL19:.+]] = load float, ptr %[[F_REALP18]]
+ // CHECK-NEXT: %[[F_IMAGP20:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: %[[F_IMAG21:.+]] = load float, ptr %[[F_IMAGP20]]
+ // CHECK-NEXT: %[[DEC22:.+]] = fadd float %[[F_REAL19]], -1.000000e+00
+ // CHECK-NEXT: %[[F_REALP23:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 0
+ // CHECK-NEXT: %[[F_IMAGP24:.+]] = getelementptr inbounds { float, float }, ptr %[[F]], i32 0, i32 1
+ // CHECK-NEXT: store float %[[DEC22]], ptr %[[F_REALP23]]
+ // CHECK-NEXT: store float %[[F_IMAG21]], ptr %[[F_IMAGP24]]
+ --f; /* expected-warning {{'--' on an object of complex type is a C2y extension}}
+ pre-c2y-warning {{'--' on an object of complex type is incompatible with C standards before C2y}}
+ */
+}
diff --git a/clang/test/C/C2y/n3260.c b/clang/test/C/C2y/n3260.c
new file mode 100644
index 0000000..e7b0eef
--- /dev/null
+++ b/clang/test/C/C2y/n3260.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -Wpre-c2y-compat %s
+// RUN: %clang_cc1 -verify=pre-c2y -std=c23 -Wall -pedantic %s
+
+/* WG14 N3260: Clang 17
+ * Generic selection expression with a type operand
+ */
+
+static_assert(
+ _Generic(
+ const int, /* pre-c2y-warning {{passing a type argument as the first operand to '_Generic' is a C2y extension}}
+ expected-warning {{passing a type argument as the first operand to '_Generic' is incompatible with C standards before C2y}}
+ */
+ int : 0,
+ const int : 1
+ )
+);
diff --git a/clang/test/C/C2y/n3273.c b/clang/test/C/C2y/n3273.c
new file mode 100644
index 0000000..84eeadd
--- /dev/null
+++ b/clang/test/C/C2y/n3273.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -verify -std=c2y -Wall -pedantic -Wpre-c2y-compat %s
+// RUN: %clang_cc1 -verify=pre-c2y -std=c23 -Wall -pedantic %s
+
+/* WG14 N3273: Clang 3.5
+ * alignof of an incomplete array type
+ */
+
+static_assert(
+ alignof(int[]) == /* pre-c2y-warning {{'alignof' on an incomplete array type is a C2y extension}}
+ expected-warning {{'alignof' on an incomplete array type is incompatible with C standards before C2y}}
+ */
+ alignof(int)
+);
+
diff --git a/clang/test/C/C99/n809.c b/clang/test/C/C99/n809.c
index 7297443..48a72cc 100644
--- a/clang/test/C/C99/n809.c
+++ b/clang/test/C/C99/n809.c
@@ -108,11 +108,11 @@ void func(void) {
// a real type; Clang supports this as an extension on complex types as well.
_Complex float cf = 0.0f;
- cf++; // expected-warning {{'++' on an object of complex type is a Clang extension}}
- ++cf; // expected-warning {{'++' on an object of complex type is a Clang extension}}
+ cf++; // expected-warning {{'++' on an object of complex type is a C2y extension}}
+ ++cf; // expected-warning {{'++' on an object of complex type is a C2y extension}}
- cf--; // expected-warning {{'--' on an object of complex type is a Clang extension}}
- --cf; // expected-warning {{'--' on an object of complex type is a Clang extension}}
+ cf--; // expected-warning {{'--' on an object of complex type is a C2y extension}}
+ --cf; // expected-warning {{'--' on an object of complex type is a C2y extension}}
// However, unary + and - are fine, as is += 1.
(void)-cf;
diff --git a/clang/test/CXX/drs/cwg26xx.cpp b/clang/test/CXX/drs/cwg26xx.cpp
index e180c93..d843b09 100644
--- a/clang/test/CXX/drs/cwg26xx.cpp
+++ b/clang/test/CXX/drs/cwg26xx.cpp
@@ -193,8 +193,11 @@ static_assert(__is_same(decltype(i), I<char, 4>));
J j = { "ghi" };
// since-cxx20-error@-1 {{no viable constructor or deduction guide}}
// since-cxx20-note@#cwg2681-J {{candidate template ignored: could not match 'J<N>' against 'const char *'}}
+// since-cxx20-note@#cwg2681-J {{implicit deduction guide declared as 'template <size_t N> J(J<N>) -> J<N>'}}
// since-cxx20-note@#cwg2681-J {{candidate template ignored: could not match 'const unsigned char' against 'const char'}}
+// since-cxx20-note@#cwg2681-J {{implicit deduction guide declared as 'template <size_t N> J(const unsigned char (&)[N]) -> J<N>'}}
// since-cxx20-note@#cwg2681-J {{candidate function template not viable: requires 0 arguments, but 1 was provided}}
+// since-cxx20-note@#cwg2681-J {{implicit deduction guide declared as 'template <size_t N> J() -> J<N>'}}
#endif
}
diff --git a/clang/test/CXX/expr/expr.post/expr.type.conv/p1.cpp b/clang/test/CXX/expr/expr.post/expr.type.conv/p1.cpp
index f3608bc3..f8d88e1 100644
--- a/clang/test/CXX/expr/expr.post/expr.type.conv/p1.cpp
+++ b/clang/test/CXX/expr/expr.post/expr.type.conv/p1.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++1z -verify %s
-template<typename T> struct A { // expected-note 2{{candidate}}
+template<typename T> struct A { // expected-note 2{{candidate}} expected-note 2{{implicit deduction guide}}
T t, u;
};
template<typename T> A(T, T) -> A<T>; // expected-note {{deduced conflicting types for parameter 'T'}}
diff --git a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
index 49fde29..d192070 100644
--- a/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
+++ b/clang/test/CXX/over/over.match/over.match.funcs/over.match.class.deduct/p2.cpp
@@ -35,8 +35,9 @@ namespace std {
}
namespace p0702r1 {
- template<typename T> struct X { // expected-note {{candidate}}
- X(std::initializer_list<T>); // expected-note {{candidate template ignored: could not match 'std::initializer_list<T>' against 'Z'}}
+ template<typename T> struct X { // expected-note {{candidate}} expected-note {{implicit deduction guide}}
+ X(std::initializer_list<T>); // expected-note {{candidate template ignored: could not match 'std::initializer_list<T>' against 'Z'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T> X(std::initializer_list<T>) -> X<T>'}}
};
X xi = {0};
diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
index 8592626..ed44536 100644
--- a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
+++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
@@ -6,8 +6,8 @@
#if __cplusplus > 201402L
namespace ClassTemplateParamNotForwardingRef {
// This is not a forwarding reference.
- template<typename T> struct A { // expected-note {{candidate}}
- A(T&&); // expected-note {{expects an rvalue}}
+ template<typename T> struct A { // expected-note {{candidate}} expected-note {{implicit deduction guide}}
+ A(T&&); // expected-note {{expects an rvalue}} expected-note {{implicit deduction guide}}
};
int n;
A a = n; // expected-error {{no viable constructor or deduction guide}}
@@ -75,10 +75,12 @@ namespace std_example {
int n3 = g(i); // expected-error{{no matching function for call to 'g'}}
#if __cplusplus > 201402L
- template<class T> struct A { // expected-note {{candidate}}
+ template<class T> struct A { // expected-note {{candidate}} expected-note {{implicit deduction guide}}
template<class U>
- A(T &&, U &&, int *); // expected-note {{[with T = int, U = int] not viable: expects an rvalue}}
- A(T &&, int *); // expected-note {{requires 2}}
+ A(T &&, U &&, int *); // expected-note {{[with T = int, U = int] not viable: expects an rvalue}} \
+ // expected-note {{implicit deduction guide declared as 'template <class T, class U> A(T &&, type-parameter-0-1 &&, int *) -> A<T>'}}
+ A(T &&, int *); // expected-note {{requires 2}} \
+ // expected-note {{implicit deduction guide declared as 'template <class T> A(T &&, int *) -> A<T>'}}
};
template<class T> A(T &&, int *) -> A<T>; // expected-note {{requires 2}}
diff --git a/clang/test/Driver/Inputs/basic_baremetal_tree/bin/.keep b/clang/test/Driver/Inputs/basic_baremetal_tree/bin/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_baremetal_tree/bin/.keep
diff --git a/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/.keep b/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/.keep
diff --git a/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/c++/v1/.keep b/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/c++/v1/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_baremetal_tree/include/armv6m-unknown-none-eabi/c++/v1/.keep
diff --git a/clang/test/Driver/Inputs/basic_baremetal_tree/include/c++/v1/.keep b/clang/test/Driver/Inputs/basic_baremetal_tree/include/c++/v1/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_baremetal_tree/include/c++/v1/.keep
diff --git a/clang/test/Driver/Inputs/basic_baremetal_tree/lib/armv6m-unknown-none-eabi/.keep b/clang/test/Driver/Inputs/basic_baremetal_tree/lib/armv6m-unknown-none-eabi/.keep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/clang/test/Driver/Inputs/basic_baremetal_tree/lib/armv6m-unknown-none-eabi/.keep
diff --git a/clang/test/Driver/baremetal.cpp b/clang/test/Driver/baremetal.cpp
index cc14f04..de4e934 100644
--- a/clang/test/Driver/baremetal.cpp
+++ b/clang/test/Driver/baremetal.cpp
@@ -13,7 +13,7 @@
// CHECK-V6M-C-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
// CHECK-V6M-C-SAME: "-isysroot" "[[SYSROOT:[^"]*]]"
// CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
-// CHECk-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
+// CHECK-V6M-C-SAME: "-internal-isystem" "[[SYSROOT]]{{[/\\]+}}include"
// CHECK-V6M-C-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
// CHECK-V6M-C-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic" "-EL"
// CHECK-V6M-C-SAME: "-T" "semihosted.lds" "-Lsome{{[/\\]+}}directory{{[/\\]+}}user{{[/\\]+}}asked{{[/\\]+}}for"
@@ -26,6 +26,20 @@
// RUN: --sysroot=%S/Inputs/baremetal_arm | FileCheck --check-prefix=CHECK-V6M-LIBINC %s
// CHECK-V6M-LIBINC-NOT: "-internal-isystem"
+// RUN: %clang %s -### --target=armv6m-none-eabi -o %t.out 2>&1 \
+// RUN: -ccc-install-dir %S/Inputs/basic_baremetal_tree/bin \
+// RUN: | FileCheck --check-prefix=CHECK-V6M-TREE %s
+// CHECK-V6M-TREE: InstalledDir: [[INSTALLED_DIR:.+]]
+// CHECK-V6M-TREE: "-cc1" "-triple" "thumbv6m-unknown-none-eabi"
+// CHECK-V6M-TREE-SAME: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-V6M-TREE-SAME: "-internal-isystem" "[[INSTALLED_DIR]]{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}armv6m-unknown-none-eabi{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECK-V6M-TREE-SAME: {{^}} "-internal-isystem" "[[INSTALLED_DIR]]{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"
+// CHECK-V6M-TREE-SAME: "-internal-isystem" "[[INSTALLED_DIR]]{{[/\\]+}}..{{[/\\]+}}include{{[/\\]+}}armv6m-unknown-none-eabi"
+// CHECK-V6M-TREE-SAME: "-x" "c++" "{{.*}}baremetal.cpp"
+// CHECK-V6M-TREE-NEXT: ld{{(.exe)?}}" "{{.*}}.o" "-Bstatic" "-EL"
+// CHECK-V6M-TREE-SAME: "-L[[INSTALLED_DIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}armv6m-unknown-none-eabi"
+// CHECK-V6M-TREE-SAME: "-lc" "-lm" "{{[^"]*}}libclang_rt.builtins.a" "--target2=rel" "-o" "{{.*}}.tmp.out"
+
// RUN: %clang %s -### --target=armv7m-vendor-none-eabi -rtlib=compiler-rt 2>&1 \
// RUN: --sysroot=%S/Inputs/baremetal_arm \
// RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
diff --git a/clang/test/Driver/unknown-std.c b/clang/test/Driver/unknown-std.c
index 564c633..8f9047b 100644
--- a/clang/test/Driver/unknown-std.c
+++ b/clang/test/Driver/unknown-std.c
@@ -18,6 +18,8 @@
// CHECK-NEXT: note: use 'gnu17' or 'gnu18' for 'ISO C 2017 with GNU extensions' standard
// CHECK-NEXT: note: use 'c23' for 'Working Draft for ISO C23' standard
// CHECK-NEXT: note: use 'gnu23' for 'Working Draft for ISO C23 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c2y' for 'Working Draft for ISO C2y' standard
+// CHECK-NEXT: note: use 'gnu2y' for 'Working Draft for ISO C2y with GNU extensions' standard
// Make sure that no other output is present.
// CHECK-NOT: {{^.+$}}
diff --git a/clang/test/Misc/warning-flags.c b/clang/test/Misc/warning-flags.c
index ae14720..cdbe1e9 100644
--- a/clang/test/Misc/warning-flags.c
+++ b/clang/test/Misc/warning-flags.c
@@ -88,4 +88,4 @@ CHECK-NEXT: warn_weak_import
The list of warnings in -Wpedantic should NEVER grow.
-CHECK: Number in -Wpedantic (not covered by other -W flags): 26
+CHECK: Number in -Wpedantic (not covered by other -W flags): 25
diff --git a/clang/test/Modules/pr97244.cppm b/clang/test/Modules/pr97244.cppm
new file mode 100644
index 0000000..ad8b466
--- /dev/null
+++ b/clang/test/Modules/pr97244.cppm
@@ -0,0 +1,30 @@
+// REQUIRES: !system-windows
+//
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty.cppm \
+// RUN: -emit-module-interface -o %t/Empty.pcm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty2.cppm \
+// RUN: -fprebuilt-module-path=%t -emit-module-interface -o %t/Empty2.pcm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/main.cpp \
+// RUN: -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %t/main.cpp
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Empty2.pcm \
+// RUN: -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %t/Empty2.cppm
+
+//--- Empty.cppm
+export module Empty;
+
+//--- Empty2.cppm
+export module Empty2;
+import Empty;
+
+// CHECK-NOT: _ZGIW5Empty
+
+//--- main.cpp
+import Empty;
+import Empty2;
+
+// CHECK-NOT: _ZGIW5Empty
+// CHECK-NOT: _ZGIW6Empty2
diff --git a/clang/test/Modules/pr97313.cppm b/clang/test/Modules/pr97313.cppm
new file mode 100644
index 0000000..ebbd0ee
--- /dev/null
+++ b/clang/test/Modules/pr97313.cppm
@@ -0,0 +1,118 @@
+// REQUIRES: !system-windows
+//
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Base.cppm \
+// RUN: -emit-module-interface -o %t/Base.pcm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Sub.cppm \
+// RUN: -emit-module-interface -o %t/Sub.pcm -fprebuilt-module-path=%t
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Sub.pcm \
+// RUN: -emit-llvm -o %t/Sub.pcm -o - -fprebuilt-module-path=%t | \
+// RUN: FileCheck %t/Sub.cppm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/main.cpp \
+// RUN: -emit-llvm -fprebuilt-module-path=%t -o - | FileCheck %t/main.cpp
+//
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Mod.cppm \
+// RUN: -emit-module-interface -o %t/Mod.pcm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Mod.pcm \
+// RUN: -emit-llvm -o - | FileCheck %t/Mod.cppm
+// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/Use.cpp \
+// RUN: -emit-llvm -fprebuilt-module-path=%t -o - | \
+// RUN: FileCheck %t/Use.cpp
+
+//--- Base.cppm
+export module Base;
+
+export template <class>
+class Base
+{
+public:
+ constexpr Base();
+ constexpr virtual ~Base();
+};
+
+template <class X>
+constexpr Base<X>::Base() = default;
+
+template <class X>
+constexpr Base<X>::~Base() = default;
+
+//--- Sub.cppm
+export module Sub;
+export import Base;
+
+export class Sub : public Base<int>
+{
+};
+
+// CHECK: @_ZTIW4Base4BaseIiE = {{.*}}linkonce_odr
+
+//--- main.cpp
+import Sub;
+
+int main()
+{
+ Base<int> *b = new Sub();
+ delete b;
+}
+
+// CHECK: @_ZTIW4Base4BaseIiE = {{.*}}linkonce_odr
+
+//--- Mod.cppm
+export module Mod;
+
+export class NonTemplate {
+public:
+ virtual ~NonTemplate();
+};
+
+// CHECK: @_ZTIW3Mod11NonTemplate = {{.*}}constant
+
+export template <class C>
+class Template {
+public:
+ virtual ~Template();
+};
+
+export template<>
+class Template<char> {
+public:
+ virtual ~Template();
+};
+
+// CHECK: @_ZTIW3Mod8TemplateIcE = {{.*}}constant
+
+export template class Template<unsigned>;
+
+// CHECK: @_ZTIW3Mod8TemplateIjE = {{.*}}weak_odr
+
+export extern template class Template<double>;
+
+auto v = new Template<signed int>();
+
+// CHECK: @_ZTIW3Mod8TemplateIiE = {{.*}}linkonce_odr
+
+//--- Use.cpp
+import Mod;
+
+auto v1 = new NonTemplate();
+auto v2 = new Template<char>();
+auto v3 = new Template<unsigned>();
+auto v4 = new Template<double>();
+auto v5 = new Template<signed int>();
+auto v6 = new Template<NonTemplate>();
+
+// CHECK: @_ZTVW3Mod11NonTemplate = {{.*}}external
+// CHECK: @_ZTVW3Mod8TemplateIcE = {{.*}}external
+// CHECK: @_ZTVW3Mod8TemplateIjE = {{.*}}weak_odr
+// CHECK: @_ZTSW3Mod8TemplateIjE = {{.*}}weak_odr
+// CHECK: @_ZTIW3Mod8TemplateIjE = {{.*}}weak_odr
+// CHECK: @_ZTVW3Mod8TemplateIdE = {{.*}}external
+// CHECK: @_ZTVW3Mod8TemplateIiE = {{.*}}linkonce_odr
+// CHECK: @_ZTSW3Mod8TemplateIiE = {{.*}}linkonce_odr
+// CHECK: @_ZTIW3Mod8TemplateIiE = {{.*}}linkonce_odr
+// CHECK: @_ZTVW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr
+// CHECK: @_ZTSW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr
+// CHECK: @_ZTIW3Mod8TemplateIS_11NonTemplateE = {{.*}}linkonce_odr
diff --git a/clang/test/Modules/template_name_lookup.cpp b/clang/test/Modules/template_name_lookup.cpp
index 29375e5..82b06e8 100644
--- a/clang/test/Modules/template_name_lookup.cpp
+++ b/clang/test/Modules/template_name_lookup.cpp
@@ -7,5 +7,7 @@ import foo;
void use() {
X x; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'X'}}
// expected-note@Inputs/template_name_lookup/foo.cppm:3 {{candidate template ignored: couldn't infer template argument 'T'}}
+ // expected-note@Inputs/template_name_lookup/foo.cppm:3 {{implicit deduction guide declared as 'template <typename T> X(X<T>) -> X<T>'}}
// expected-note@Inputs/template_name_lookup/foo.cppm:3 {{candidate function template not viable: requires 1 argument, but 0 were provided}}
+ // expected-note@Inputs/template_name_lookup/foo.cppm:3 {{implicit deduction guide declared as 'template <typename T> X() -> X<T>'}}
}
diff --git a/clang/test/PCH/cxx-explicit-specifier.cpp b/clang/test/PCH/cxx-explicit-specifier.cpp
index 94ca9f7..84548fa 100644
--- a/clang/test/PCH/cxx-explicit-specifier.cpp
+++ b/clang/test/PCH/cxx-explicit-specifier.cpp
@@ -79,8 +79,8 @@ struct A {
B<true> b_true;
B<false> b_false;
#else
-//expected-note@-8 {{candidate template ignored}}
-//expected-note@-8 {{explicit constructor declared here}}
+//expected-note@-8 {{candidate template ignored}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> A(A<b>) -> A<b>'}}
+//expected-note@-8 {{explicit constructor declared here}} expected-note@-8 {{implicit deduction guide declared as 'template <bool b> explicit(b) A(B<b>) -> A<b>'}}
//expected-note@-15+ {{candidate constructor}}
//expected-note@-8+ {{explicit conversion function is not a candidate (explicit specifier}}
//expected-note@-11 {{explicit constructor is not a candidate (explicit specifier}}
diff --git a/clang/test/Parser/generic-selection-type-extension-pedantic.c b/clang/test/Parser/generic-selection-type-extension-pedantic.c
index d73e809..e611703 100644
--- a/clang/test/Parser/generic-selection-type-extension-pedantic.c
+++ b/clang/test/Parser/generic-selection-type-extension-pedantic.c
@@ -4,7 +4,7 @@
// in the right location.
void test(void) {
(void)_Generic(
- int, // expected-warning {{passing a type argument as the first operand to '_Generic' is a Clang extension}}
+ int, // expected-warning {{passing a type argument as the first operand to '_Generic' is a C2y extension}}
int : 0);
(void)_Generic(
12,
diff --git a/clang/test/Preprocessor/c2y.c b/clang/test/Preprocessor/c2y.c
new file mode 100644
index 0000000..1d659d2
--- /dev/null
+++ b/clang/test/Preprocessor/c2y.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c2y %s
+// expected-no-diagnostics
+
+// FIXME: Set this to test the correct value once that value is set by WG14.
+static_assert(__STDC_VERSION__ > 202311L, "Incorrect __STDC_VERSION__");
+
diff --git a/clang/test/Sema/complex-inc-dec.c b/clang/test/Sema/complex-inc-dec.c
index ebc23c3..4c780da 100644
--- a/clang/test/Sema/complex-inc-dec.c
+++ b/clang/test/Sema/complex-inc-dec.c
@@ -5,20 +5,20 @@ void func(void) {
_Complex double cd;
_Complex long double cld;
- ++cf; // expected-warning {{'++' on an object of complex type is a Clang extension}}
- ++cd; // expected-warning {{'++' on an object of complex type is a Clang extension}}
- ++cld; // expected-warning {{'++' on an object of complex type is a Clang extension}}
+ ++cf; // expected-warning {{'++' on an object of complex type is a C2y extension}}
+ ++cd; // expected-warning {{'++' on an object of complex type is a C2y extension}}
+ ++cld; // expected-warning {{'++' on an object of complex type is a C2y extension}}
- --cf; // expected-warning {{'--' on an object of complex type is a Clang extension}}
- --cd; // expected-warning {{'--' on an object of complex type is a Clang extension}}
- --cld; // expected-warning {{'--' on an object of complex type is a Clang extension}}
+ --cf; // expected-warning {{'--' on an object of complex type is a C2y extension}}
+ --cd; // expected-warning {{'--' on an object of complex type is a C2y extension}}
+ --cld; // expected-warning {{'--' on an object of complex type is a C2y extension}}
- cf++; // expected-warning {{'++' on an object of complex type is a Clang extension}}
- cd++; // expected-warning {{'++' on an object of complex type is a Clang extension}}
- cld++; // expected-warning {{'++' on an object of complex type is a Clang extension}}
+ cf++; // expected-warning {{'++' on an object of complex type is a C2y extension}}
+ cd++; // expected-warning {{'++' on an object of complex type is a C2y extension}}
+ cld++; // expected-warning {{'++' on an object of complex type is a C2y extension}}
- cf--; // expected-warning {{'--' on an object of complex type is a Clang extension}}
- cd--; // expected-warning {{'--' on an object of complex type is a Clang extension}}
- cld--; // expected-warning {{'--' on an object of complex type is a Clang extension}}
+ cf--; // expected-warning {{'--' on an object of complex type is a C2y extension}}
+ cd--; // expected-warning {{'--' on an object of complex type is a C2y extension}}
+ cld--; // expected-warning {{'--' on an object of complex type is a C2y extension}}
}
diff --git a/clang/test/Sema/tls_alignment.cpp b/clang/test/Sema/tls_alignment.cpp
index c5c79aa..65b6b03 100644
--- a/clang/test/Sema/tls_alignment.cpp
+++ b/clang/test/Sema/tls_alignment.cpp
@@ -22,7 +22,9 @@ struct struct_with_aligned_field {
template <typename>
struct templated_struct {};
// expected-note@-1{{candidate template ignored: couldn't infer template argument ''}}
-// expected-note@-2{{candidate function template not viable: requires 1 argument, but 0 were provided}}
+// expected-note@-2{{implicit deduction guide declared as 'template <typename> templated_struct() -> templated_struct<type-parameter-0-0>'}}
+// expected-note@-3{{candidate function template not viable: requires 1 argument, but 0 were provided}}
+// expected-note@-4{{implicit deduction guide declared as 'template <typename> templated_struct(templated_struct<type-parameter-0-0>) -> templated_struct<type-parameter-0-0>'}}
// A typedef of the aligned struct.
typedef aligned_struct another_aligned_struct;
diff --git a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 90404f1..9ef5303 100644
--- a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -139,11 +139,13 @@ namespace look_into_current_instantiation {
// templates, and members of the current instantiation
A<float> &r = a;
- template<typename T> struct B { // expected-note {{could not match 'B<T>' against 'int'}}
+ template<typename T> struct B { // expected-note {{could not match 'B<T>' against 'int'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T> B(B<T>) -> B<T>'}}
struct X {
typedef T type;
};
- B(typename X::type); // expected-note {{couldn't infer template argument 'T'}}
+ B(typename X::type); // expected-note {{couldn't infer template argument 'T'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T> B(typename X::type) -> B<T>'}}
};
B b = 0; // expected-error {{no viable}}
@@ -564,8 +566,10 @@ namespace PR47175 {
// Ensure we don't crash when CTAD fails.
template <typename T1, typename T2>
-struct Foo { // expected-note{{candidate function template not viable}}
- Foo(T1, T2); // expected-note{{candidate function template not viable}}
+struct Foo { // expected-note {{candidate function template not viable}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T1, typename T2> Foo(Foo<T1, T2>) -> Foo<T1, T2>'}}
+ Foo(T1, T2); // expected-note {{candidate function template not viable}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T1, typename T2> Foo(T1, T2) -> Foo<T1, T2>'}}
};
template <typename... Args>
diff --git a/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp b/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp
index b71dfc6..3dafe82 100644
--- a/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp
+++ b/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp
@@ -110,6 +110,8 @@ struct Foo {
template <typename X, int Y>
using Bar = Foo<X, sizeof(X)>; // expected-note {{candidate template ignored: couldn't infer template argument 'X'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename X> requires __is_deducible(test9::Bar, Foo<type-parameter-0-0, sizeof(type-parameter-0-0)>) Bar(Foo<type-parameter-0-0, sizeof(type-parameter-0-0)>) -> Foo<type-parameter-0-0, sizeof(type-parameter-0-0)>'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename X> requires __is_deducible(test9::Bar, Foo<type-parameter-0-0, sizeof(type-parameter-0-0)>) Bar(const type-parameter-0-0 (&)[sizeof(type-parameter-0-0)]) -> Foo<type-parameter-0-0, sizeof(type-parameter-0-0)>'}} \
// expected-note {{candidate template ignored: constraints not satisfied [with X = int]}} \
// expected-note {{cannot deduce template arguments for 'Bar' from 'Foo<int, 4UL>'}}
@@ -137,9 +139,12 @@ struct A {};
template<class T> struct Foo { T c; };
template<class X, class Y=A>
using AFoo = Foo<Y>; // expected-note {{candidate template ignored: could not match 'Foo<type-parameter-0-0>' against 'int'}} \
+ // expected-note {{implicit deduction guide declared as 'template <class Y = A> requires __is_deducible(test11::AFoo, Foo<type-parameter-0-0>) AFoo(Foo<type-parameter-0-0>) -> Foo<type-parameter-0-0>'}} \
// expected-note {{candidate template ignored: constraints not satisfied [with Y = int]}} \
// expected-note {{cannot deduce template arguments for 'AFoo' from 'Foo<int>'}} \
- // expected-note {{candidate function template not viable: requires 0 arguments, but 1 was provided}}
+ // expected-note {{implicit deduction guide declared as 'template <class Y = A> requires __is_deducible(test11::AFoo, Foo<type-parameter-0-0>) AFoo(type-parameter-0-0) -> Foo<type-parameter-0-0>'}} \
+ // expected-note {{candidate function template not viable: requires 0 arguments, but 1 was provided}} \
+ // expected-note {{implicit deduction guide declared as 'template <class Y = A> requires __is_deducible(test11::AFoo, Foo<type-parameter-0-0>) AFoo() -> Foo<type-parameter-0-0>'}}
AFoo s = {1}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'AFoo'}}
} // namespace test11
@@ -192,6 +197,8 @@ struct Foo {
template <int K>
using Bar = Foo<double, K>; // expected-note {{constraints not satisfied for class template 'Foo'}}
// expected-note@-1 {{candidate template ignored: could not match}}
+// expected-note@-2 {{implicit deduction guide declared as 'template <int K> requires __is_deducible(test14::Bar, Foo<double, K>) Bar(Foo<double, K>) -> Foo<double, K>'}}
+// expected-note@-3 {{implicit deduction guide declared as 'template <int K> requires __is_deducible(test14::Bar, Foo<double, K>) Bar(const double (&)[K]) -> Foo<double, K>'}}
double abc[3];
Bar s2 = {abc}; // expected-error {{no viable constructor or deduction guide for deduction }}
} // namespace test14
@@ -204,7 +211,9 @@ template<typename> concept False = false;
template<False W>
using BFoo = AFoo<W>; // expected-note {{candidate template ignored: constraints not satisfied [with V = int]}} \
// expected-note {{cannot deduce template arguments for 'BFoo' from 'Foo<int *>'}} \
- // expected-note {{candidate template ignored: could not match 'Foo<type-parameter-0-0 *>' against 'int *'}}
+ // expected-note {{implicit deduction guide declared as 'template <class V> requires __is_deducible(AFoo, Foo<type-parameter-0-0 *>) && __is_deducible(test15::BFoo, Foo<type-parameter-0-0 *>) BFoo(type-parameter-0-0 *) -> Foo<type-parameter-0-0 *>}} \
+ // expected-note {{candidate template ignored: could not match 'Foo<type-parameter-0-0 *>' against 'int *'}} \
+ // expected-note {{template <class V> requires __is_deducible(AFoo, Foo<type-parameter-0-0 *>) && __is_deducible(test15::BFoo, Foo<type-parameter-0-0 *>) BFoo(Foo<type-parameter-0-0 *>) -> Foo<type-parameter-0-0 *>}}
int i = 0;
AFoo a1(&i); // OK, deduce Foo<int *>
@@ -255,8 +264,11 @@ Foo(T) -> Foo<int>;
template <typename U>
using Bar = Foo<U>; // expected-note {{could not match 'Foo<type-parameter-0-0>' against 'int'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename U> requires __is_deducible(test18::Bar, Foo<type-parameter-0-0>) Bar(Foo<type-parameter-0-0>) -> Foo<type-parameter-0-0>'}} \
// expected-note {{candidate template ignored: constraints not satisfied}} \
- // expected-note {{candidate function template not viable}}
+ // expected-note {{implicit deduction guide declared as 'template <typename T> requires False<T> && __is_deducible(test18::Bar, Foo<int>) Bar(type-parameter-0-0) -> Foo<int>'}} \
+ // expected-note {{candidate function template not viable}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename U> requires __is_deducible(test18::Bar, Foo<type-parameter-0-0>) Bar() -> Foo<type-parameter-0-0>'}}
Bar s = {1}; // expected-error {{no viable constructor or deduction guide for deduction of template arguments}}
} // namespace test18
@@ -284,7 +296,8 @@ class Foo {};
// Verify that template template type parameter TTP is referenced/used in the
// template arguments of the RHS.
template <template<typename> typename TTP>
-using Bar = Foo<K<TTP>>; // expected-note {{candidate template ignored: could not match 'Foo<K<template-parameter-0-0>>' against 'int'}}
+using Bar = Foo<K<TTP>>; // expected-note {{candidate template ignored: could not match 'Foo<K<template-parameter-0-0>>' against 'int'}} \
+ // expected-note {{implicit deduction guide declared as 'template <template <typename> typename TTP> requires __is_deducible(test20::Bar, Foo<K<template-parameter-0-0>>) Bar(Foo<K<template-parameter-0-0>>) -> Foo<K<template-parameter-0-0>>'}}
template <class T>
class Container {};
diff --git a/clang/test/SemaCXX/cxx2a-explicit-bool.cpp b/clang/test/SemaCXX/cxx2a-explicit-bool.cpp
index 9fdc059..03799c5 100644
--- a/clang/test/SemaCXX/cxx2a-explicit-bool.cpp
+++ b/clang/test/SemaCXX/cxx2a-explicit-bool.cpp
@@ -394,9 +394,11 @@ using type = T;
template<typename T1, typename T2, bool b>
struct A {
// expected-note@-1+ {{candidate function}}
+ // expected-note@-2+ {{implicit deduction guide}}
explicit(false)
A(typename nondeduced<T1>::type, typename nondeduced<T2>::type, typename nondeduced<B<b>>::type) {}
// expected-note@-1+ {{candidate template ignored}}
+ // expected-note@-2+ {{implicit deduction guide}}
};
template<typename T1, typename T2, bool b>
@@ -678,10 +680,12 @@ namespace deduction_guide2 {
template<typename T1 = int, typename T2 = int>
struct A {
// expected-note@-1+ {{candidate template ignored}}
+ // expected-note@-2+ {{implicit deduction guide}}
explicit(!is_same<T1, T2>::value)
A(T1 = 0, T2 = 0) {}
// expected-note@-1 {{explicit constructor declared here}}
// expected-note@-2 2{{explicit constructor is not a candidate}}
+ // expected-note@-3 2{{implicit deduction guide declared}}
};
A a0 = 0;
diff --git a/clang/test/SemaCXX/gh65522.cpp b/clang/test/SemaCXX/gh65522.cpp
index 2d6331b..8028124 100644
--- a/clang/test/SemaCXX/gh65522.cpp
+++ b/clang/test/SemaCXX/gh65522.cpp
@@ -3,9 +3,11 @@
class X {};
template<typename T>
-class B3 { // expected-note {{candidate template ignored: could not match 'B3<T>' against 'int'}}
+class B3 { // expected-note {{candidate template ignored: could not match 'B3<T>' against 'int'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T> B3(B3<T>) -> B3<T>'}}
template<X x> B3(T); // expected-warning 2{{non-type template parameter of type 'X' is incompatible with C++ standards before C++20}} \
- // expected-note {{candidate template ignored: couldn't infer template argument 'x'}}
+ // expected-note {{candidate template ignored: couldn't infer template argument 'x'}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T, X x> B3(T) -> B3<T>'}}
};
B3 b3 = 0; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'B3'}} \
// expected-note {{while building implicit deduction guide first needed here}}
diff --git a/clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp b/clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp
index e9b362d..ad7441f 100644
--- a/clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp
+++ b/clang/test/SemaCXX/invalid-deduction-guide-as-template-candidates.cpp
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s
template <class T> class Foo {}; // expected-note {{candidate template ignored: couldn't infer template argument 'T'}} \
- // expected-note {{candidate function template not viable: requires 1 argument, but 0 were provided}}
+ // expected-note {{implicit deduction guide declared as 'template <class T> Foo(Foo<T>) -> Foo<T>'}} \
+ // expected-note {{candidate function template not viable: requires 1 argument, but 0 were provided}} \
+ // expected-note {{implicit deduction guide declared as 'template <class T> Foo() -> Foo<T>'}}
Foo(); // expected-error {{deduction guide declaration without trailing return type}}
Foo vs; // expected-error {{no viable constructor or deduction guide for deduction of template arguments of 'Foo'}}
diff --git a/clang/test/SemaCXX/lookup-template-name-extern-CXX.cpp b/clang/test/SemaCXX/lookup-template-name-extern-CXX.cpp
index 93e7fb6..f851af7 100644
--- a/clang/test/SemaCXX/lookup-template-name-extern-CXX.cpp
+++ b/clang/test/SemaCXX/lookup-template-name-extern-CXX.cpp
@@ -3,8 +3,10 @@
// RUN: %clang_cc1 -std=c++20 %s -fsyntax-only -verify
extern "C++" {
template <class T>
-class X {}; // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
- // expected-note@-1 {{candidate function template not viable: requires 1 argument, but 0 were provided}}
+class X {}; // expected-note {{candidate template ignored: couldn't infer template argument 'T'}} \
+ // expected-note {{implicit deduction guide declared as 'template <class T> X(X<T>) -> X<T>'}} \
+ // expected-note {{candidate function template not viable: requires 1 argument, but 0 were provided}} \
+ // expected-note {{implicit deduction guide declared as 'template <class T> X() -> X<T>'}}
}
void foo() {
diff --git a/clang/test/SemaCXX/warn-dangling-local.cpp b/clang/test/SemaCXX/warn-dangling-local.cpp
index a946b8a2..2808a4c 100644
--- a/clang/test/SemaCXX/warn-dangling-local.cpp
+++ b/clang/test/SemaCXX/warn-dangling-local.cpp
@@ -26,3 +26,14 @@ void g() {
const int a[] = {a[0]};
const int b[] = {a[0]};
}
+
+namespace std {
+// std::basic_string has a hard-coded gsl::owner attr.
+struct basic_string {
+ const char* c_str();
+};
+} // namespace std
+void test(const char* a) {
+ // verify we're emitting the `-Wdangling-assignment` warning.
+ a = std::basic_string().c_str(); // expected-warning {{object backing the pointer a will be destroyed at the end of the full-expression}}
+}
diff --git a/clang/test/SemaTemplate/aggregate-deduction-candidate.cpp b/clang/test/SemaTemplate/aggregate-deduction-candidate.cpp
index 5a50332..49afb6b 100644
--- a/clang/test/SemaTemplate/aggregate-deduction-candidate.cpp
+++ b/clang/test/SemaTemplate/aggregate-deduction-candidate.cpp
@@ -2,7 +2,7 @@
// RUN: %clang_cc1 -std=c++20 -verify=expected,cxx20 -ast-dump -ast-dump-decl-types -ast-dump-filter "deduction guide" %s | FileCheck %s --strict-whitespace
namespace Basic {
- template<class T> struct A { // cxx17-note 6 {{candidate}}
+ template<class T> struct A { // cxx17-note 6 {{candidate}} cxx17-note 6 {{implicit deduction guide}}
T x;
T y;
};
@@ -36,12 +36,14 @@ namespace Basic {
T y;
};
- template <typename T> struct C { // cxx20-note 10 {{candidate}} cxx17-note 12 {{candidate}}
+ template <typename T> struct C { // cxx20-note 10 {{candidate}} cxx17-note 12 {{candidate}} \
+ cxx20-note 10 {{implicit deduction guide}} cxx17-note 12 {{implicit deduction guide}}
S<T> s;
T t;
};
- template <typename T> struct D { // cxx20-note 6 {{candidate}} cxx17-note 8 {{candidate}}
+ template <typename T> struct D { // cxx20-note 6 {{candidate}} cxx17-note 8 {{candidate}} \
+ cxx20-note 6 {{implicit deduction guide}} cxx17-note 8 {{implicit deduction guide}}
S<int> s;
T t;
};
@@ -99,7 +101,7 @@ namespace Basic {
// CHECK: |-ClassTemplateSpecialization {{.*}} 'S'
// CHECK: `-BuiltinType {{.*}} 'int'
- template <typename T> struct E { // cxx17-note 4 {{candidate}}
+ template <typename T> struct E { // cxx17-note 4 {{candidate}} cxx17-note 4 {{implicit deduction guide}}
T t;
decltype(t) t2;
};
@@ -133,7 +135,7 @@ namespace Basic {
};
template <typename T>
- struct F { // cxx17-note 2 {{candidate}}
+ struct F { // cxx17-note 2 {{candidate}} cxx17-note 2 {{implicit deduction guide}}
typename I<T>::type i;
T t;
};
@@ -161,7 +163,8 @@ namespace Basic {
namespace Array {
typedef unsigned long size_t;
- template <typename T, size_t N> struct A { // cxx20-note 2 {{candidate}} cxx17-note 14 {{candidate}}
+ template <typename T, size_t N> struct A { // cxx20-note 2 {{candidate}} cxx17-note 14 {{candidate}} \
+ cxx20-note 2 {{implicit deduction guide}} cxx17-note 14 {{implicit deduction guide}}
T array[N];
};
@@ -217,7 +220,7 @@ namespace Array {
}
namespace BraceElision {
- template <typename T> struct A { // cxx17-note 4 {{candidate}}
+ template <typename T> struct A { // cxx17-note 4 {{candidate}} cxx17-note 4 {{implicit deduction guide}}
T array[2];
};
@@ -247,7 +250,7 @@ namespace BraceElision {
}
namespace TrailingPack {
- template<typename... T> struct A : T... { // cxx17-note 4 {{candidate}}
+ template<typename... T> struct A : T... { // cxx17-note 4 {{candidate}} cxx17-note 4 {{implicit deduction guide}}
};
A a1 = { // cxx17-error {{no viable}}
@@ -286,7 +289,7 @@ namespace TrailingPack {
}
namespace NonTrailingPack {
- template<typename... T> struct A : T... { // expected-note 4 {{candidate}}
+ template<typename... T> struct A : T... { // expected-note 4 {{candidate}} expected-note 4 {{implicit deduction guide}}
int a;
};
@@ -303,7 +306,8 @@ namespace NonTrailingPack {
namespace DeduceArity {
template <typename... T> struct Types {};
- template <typename... T> struct F : Types<T...>, T... {}; // cxx20-note 12 {{candidate}} cxx17-note 16 {{candidate}}
+ template <typename... T> struct F : Types<T...>, T... {}; // cxx20-note 12 {{candidate}} cxx17-note 16 {{candidate}} \
+ cxx20-note 12 {{implicit deduction guide}} cxx17-note 16 {{implicit deduction guide}}
struct X {};
struct Y {};
diff --git a/clang/test/SemaTemplate/class-template-id.cpp b/clang/test/SemaTemplate/class-template-id.cpp
index eade4f6..96696f6 100644
--- a/clang/test/SemaTemplate/class-template-id.cpp
+++ b/clang/test/SemaTemplate/class-template-id.cpp
@@ -45,6 +45,8 @@ typedef N::C<float> c2;
// PR5655
template<typename T> struct Foo { }; // precxx17-note {{template is declared here}} \
cxx17-note {{candidate template ignored: couldn't infer template argument 'T'}} \
+ cxx17-note {{implicit deduction guide declared as 'template <typename T> Foo() -> Foo<T>'}} \
+ cxx17-note {{implicit deduction guide declared as 'template <typename T> Foo(Foo<T>) -> Foo<T>'}} \
cxx17-note {{candidate function template not viable: requires 1 argument, but 0 were provided}}
void f(void) { Foo bar; } // precxx17-error {{use of class template 'Foo' requires template arguments}} \
diff --git a/clang/test/SemaTemplate/ctad.cpp b/clang/test/SemaTemplate/ctad.cpp
index e981ea8..1bf605f 100644
--- a/clang/test/SemaTemplate/ctad.cpp
+++ b/clang/test/SemaTemplate/ctad.cpp
@@ -20,8 +20,10 @@ namespace Access {
protected:
struct type {};
};
- template<typename T> struct D : B { // expected-note {{not viable}}
- D(T, typename T::type); // expected-note {{private member}}
+ template<typename T> struct D : B { // expected-note {{not viable}} \
+ expected-note {{implicit deduction guide declared as 'template <typename T> D(D<T>) -> D<T>'}}
+ D(T, typename T::type); // expected-note {{private member}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename T> D(T, typename T::type) -> D<T>'}}
};
D b = {B(), {}};
@@ -58,13 +60,15 @@ Y y(1);
namespace NoCrashOnGettingDefaultArgLoc {
template <typename>
class A {
- A(int = 1); // expected-note {{candidate template ignored: couldn't infer template argumen}}
+ A(int = 1); // expected-note {{candidate template ignored: couldn't infer template argumen}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename> D(int = <null expr>) -> D<type-parameter-0-0>'}}
};
class C : A<int> {
using A::A;
};
template <typename>
-class D : C { // expected-note {{candidate function template not viable: requires 1 argument}}
+class D : C { // expected-note {{candidate function template not viable: requires 1 argument}} \
+ expected-note {{implicit deduction guide declared as 'template <typename> D(D<type-parameter-0-0>) -> D<type-parameter-0-0>'}}
using C::C;
};
D abc; // expected-error {{no viable constructor or deduction guide}}
diff --git a/clang/test/SemaTemplate/deduction-crash.cpp b/clang/test/SemaTemplate/deduction-crash.cpp
index 86ec9f7..e3f97c5 100644
--- a/clang/test/SemaTemplate/deduction-crash.cpp
+++ b/clang/test/SemaTemplate/deduction-crash.cpp
@@ -166,8 +166,9 @@ namespace PR51872_part1 {
template<int> class T1 { template <struct U1> T1(); };
// expected-error@-1 {{non-type template parameter has incomplete type 'struct U1'}}
// expected-note@-2 {{forward declaration of 'PR51872_part1::U1'}}
+ // expected-note@-3 {{implicit deduction guide declared as 'template <int> T1(T1<>) -> T1<>'}}
T1 t1 = 0;
// expected-error@-1 {{no viable constructor or deduction guide for deduction of template arguments of 'T1'}}
- // expected-note@-6 {{candidate template ignored: could not match 'T1<>' against 'int'}}
+ // expected-note@-7 {{candidate template ignored: could not match 'T1<>' against 'int'}}
}
diff --git a/clang/test/SemaTemplate/deduction-guide.cpp b/clang/test/SemaTemplate/deduction-guide.cpp
index 163b365..7b9ca4d 100644
--- a/clang/test/SemaTemplate/deduction-guide.cpp
+++ b/clang/test/SemaTemplate/deduction-guide.cpp
@@ -123,9 +123,11 @@ using CT = C<int>;
// CHECK: | `-TemplateArgument template
// CHECK: `-TemplateTypeParmType {{.*}} 'type-parameter-0-2' dependent depth 0 index 2
-template<typename ...T> struct D { // expected-note {{candidate}}
+template<typename ...T> struct D { // expected-note {{candidate}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename ...T> D(D<T...>) -> D<T...>'}}
template<typename... U> using B = int(int (*...p)(T, U));
- template<typename U1, typename U2> D(B<U1, U2>*); // expected-note {{candidate}}
+ template<typename U1, typename U2> D(B<U1, U2>*); // expected-note {{candidate}} \
+ // expected-note {{implicit deduction guide declared as 'template <typename ...T, typename U1, typename U2> D(B<type-parameter-0-1, type-parameter-0-2> *) -> D<T...>'}}
};
int f(int(int, int), int(int, int));
// FIXME: We can't deduce this because we can't deduce through a
@@ -166,9 +168,11 @@ using DT = D<int, int>;
// CHECK-NOT: Subst
// CHECK: `-TemplateTypeParmType
-template<int ...N> struct E { // expected-note {{candidate}}
+template<int ...N> struct E { // expected-note {{candidate}} \
+ expected-note {{implicit deduction guide declared as 'template <int ...N> E(E<N...>) -> E<N...>'}}
template<int ...M> using B = Z<X<N, M>...>;
- template<int M1, int M2> E(B<M1, M2>); // expected-note {{candidate}}
+ template<int M1, int M2> E(B<M1, M2>); // expected-note {{candidate}} \
+ // expected-note {{implicit deduction guide declared as 'template <int ...N, int M1, int M2> E(B<M1, M2>) -> E<N...>'}}}}
};
// FIXME: We can't deduce this because we can't deduce through a
// SubstNonTypeTemplateParmPackExpr.
diff --git a/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp b/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp
index a4ae046..af3e335 100644
--- a/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp
+++ b/clang/test/SemaTemplate/nested-implicit-deduction-guides.cpp
@@ -82,8 +82,11 @@ using NIL = nested_init_list<int>::B<int>;
// expected-error@+1 {{no viable constructor or deduction guide for deduction of template arguments of 'nested_init_list<int>::concept_fail'}}
nested_init_list<int>::concept_fail nil_invalid{1, ""};
// expected-note@#INIT_LIST_INNER_INVALID {{candidate template ignored: substitution failure [with F = const char *]: constraints not satisfied for class template 'concept_fail' [with F = const char *]}}
+// expected-note@#INIT_LIST_INNER_INVALID {{implicit deduction guide declared as 'template <False F> concept_fail(int, F) -> concept_fail<F>'}}
// expected-note@#INIT_LIST_INNER_INVALID {{candidate function template not viable: requires 1 argument, but 2 were provided}}
+// expected-note@#INIT_LIST_INNER_INVALID {{implicit deduction guide declared as 'template <False F> concept_fail(concept_fail<F>) -> concept_fail<F>'}}
// expected-note@#INIT_LIST_INNER_INVALID {{candidate function template not viable: requires 0 arguments, but 2 were provided}}
+// expected-note@#INIT_LIST_INNER_INVALID {{implicit deduction guide declared as 'template <False F> concept_fail() -> concept_fail<F>'}}
namespace GH88142 {
diff --git a/clang/test/SemaTemplate/temp_arg.cpp b/clang/test/SemaTemplate/temp_arg.cpp
index 2db4a51..538056a 100644
--- a/clang/test/SemaTemplate/temp_arg.cpp
+++ b/clang/test/SemaTemplate/temp_arg.cpp
@@ -6,7 +6,9 @@ template<typename T,
class A; // precxx17-note 3 {{template is declared here}} \
cxx17-note 2 {{template is declared here}} \
cxx17-note {{candidate template ignored: couldn't infer template argument 'T'}} \
- cxx17-note {{candidate function template not viable: requires 1 argument, but 0 were provided}}
+ cxx17-note {{implicit deduction guide declared as 'template <typename T, int I, template <typename> class TT> A(A<T, I, TT>) -> A<T, I, TT>'}} \
+ cxx17-note {{candidate function template not viable: requires 1 argument, but 0 were provided}} \
+ cxx17-note {{implicit deduction guide declared as 'template <typename T, int I, template <typename> class TT> A() -> A<T, I, TT>'}} \
template<typename> class X;
diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp
index 2466677a..cc04415 100644
--- a/clang/unittests/Format/ConfigParseTest.cpp
+++ b/clang/unittests/Format/ConfigParseTest.cpp
@@ -240,6 +240,7 @@ TEST(ConfigParseTest, ParsesConfigurationBools) {
CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterOverloadedOperator);
CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, AfterPlacementOperator);
CHECK_PARSE_NESTED_BOOL(SpaceBeforeParensOptions, BeforeNonEmptyParentheses);
+ CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, ExceptDoubleParentheses);
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InCStyleCasts);
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InConditionalStatements);
CHECK_PARSE_NESTED_BOOL(SpacesInParensOptions, InEmptyParentheses);
@@ -626,20 +627,24 @@ TEST(ConfigParseTest, ParsesConfiguration) {
FormatStyle::SIPO_Custom);
Style.SpacesInParens = FormatStyle::SIPO_Never;
Style.SpacesInParensOptions = {};
- CHECK_PARSE("SpacesInParentheses: true", SpacesInParensOptions,
- FormatStyle::SpacesInParensCustom(true, false, false, true));
+ CHECK_PARSE(
+ "SpacesInParentheses: true", SpacesInParensOptions,
+ FormatStyle::SpacesInParensCustom(false, true, false, false, true));
Style.SpacesInParens = FormatStyle::SIPO_Never;
Style.SpacesInParensOptions = {};
- CHECK_PARSE("SpacesInConditionalStatement: true", SpacesInParensOptions,
- FormatStyle::SpacesInParensCustom(true, false, false, false));
+ CHECK_PARSE(
+ "SpacesInConditionalStatement: true", SpacesInParensOptions,
+ FormatStyle::SpacesInParensCustom(false, true, false, false, false));
Style.SpacesInParens = FormatStyle::SIPO_Never;
Style.SpacesInParensOptions = {};
- CHECK_PARSE("SpacesInCStyleCastParentheses: true", SpacesInParensOptions,
- FormatStyle::SpacesInParensCustom(false, true, false, false));
+ CHECK_PARSE(
+ "SpacesInCStyleCastParentheses: true", SpacesInParensOptions,
+ FormatStyle::SpacesInParensCustom(false, false, true, false, false));
Style.SpacesInParens = FormatStyle::SIPO_Never;
Style.SpacesInParensOptions = {};
- CHECK_PARSE("SpaceInEmptyParentheses: true", SpacesInParensOptions,
- FormatStyle::SpacesInParensCustom(false, false, true, false));
+ CHECK_PARSE(
+ "SpaceInEmptyParentheses: true", SpacesInParensOptions,
+ FormatStyle::SpacesInParensCustom(false, false, false, true, false));
Style.SpacesInParens = FormatStyle::SIPO_Never;
Style.SpacesInParensOptions = {};
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 5276e79..283843a 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -17129,6 +17129,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
verifyFormat("void f() __attribute__((asdf));", Spaces);
+ verifyFormat("x = (int32)y;", Spaces);
+ verifyFormat("y = ((int (*)(int))foo)(x);", Spaces);
+ verifyFormat("decltype(x) y = 42;", Spaces);
+ verifyFormat("decltype((x)) y = z;", Spaces);
+ verifyFormat("decltype((foo())) a = foo();", Spaces);
+ verifyFormat("decltype((bar(10))) a = bar(11);", Spaces);
+ verifyFormat("if ((x - y) && (a ^ b))\n"
+ " f();",
+ Spaces);
+ verifyFormat("for (int i = 0; i < 10; i = (i + 1))\n"
+ " foo(i);",
+ Spaces);
+ verifyFormat("switch (x / (y + z)) {\n"
+ "default:\n"
+ " break;\n"
+ "}",
+ Spaces);
Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
Spaces.SpacesInParensOptions = {};
@@ -17163,6 +17180,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__( ( attr ) ) *a = NULL;", Spaces);
verifyFormat("void __attribute__( ( naked ) ) foo( int bar )", Spaces);
verifyFormat("void f() __attribute__( ( asdf ) );", Spaces);
+ verifyFormat("x = (int32)y;", Spaces);
+ verifyFormat("y = ( (int ( * )( int ))foo )( x );", Spaces);
+ verifyFormat("decltype( x ) y = 42;", Spaces);
+ verifyFormat("decltype( ( x ) ) y = z;", Spaces);
+ verifyFormat("decltype( ( foo() ) ) a = foo();", Spaces);
+ verifyFormat("decltype( ( bar( 10 ) ) ) a = bar( 11 );", Spaces);
+ verifyFormat("if ( ( x - y ) && ( a ^ b ) )\n"
+ " f();",
+ Spaces);
+ verifyFormat("for ( int i = 0; i < 10; i = ( i + 1 ) )\n"
+ " foo( i );",
+ Spaces);
+ verifyFormat("switch ( x / ( y + z ) ) {\n"
+ "default:\n"
+ " break;\n"
+ "}",
+ Spaces);
Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
Spaces.SpacesInParensOptions = {};
@@ -17175,6 +17209,7 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("#define AA(X) sizeof((( X * )NULL)->a)", Spaces);
verifyFormat("my_int a = ( my_int )sizeof(int);", Spaces);
verifyFormat("#define x (( int )-1)", Spaces);
+ verifyFormat("y = (( int (*)(int) )foo)(x);", Spaces);
// Run the first set of tests again with:
Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
@@ -17207,6 +17242,23 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("SomeType *__attribute__((attr)) *a = NULL;", Spaces);
verifyFormat("void __attribute__((naked)) foo(int bar)", Spaces);
verifyFormat("void f( ) __attribute__((asdf));", Spaces);
+ verifyFormat("x = ( int32 )y;", Spaces);
+ verifyFormat("y = (( int (*)(int) )foo)(x);", Spaces);
+ verifyFormat("decltype(x) y = 42;", Spaces);
+ verifyFormat("decltype((x)) y = z;", Spaces);
+ verifyFormat("decltype((foo( ))) a = foo( );", Spaces);
+ verifyFormat("decltype((bar(10))) a = bar(11);", Spaces);
+ verifyFormat("if ((x - y) && (a ^ b))\n"
+ " f( );",
+ Spaces);
+ verifyFormat("for (int i = 0; i < 10; i = (i + 1))\n"
+ " foo(i);",
+ Spaces);
+ verifyFormat("switch (x / (y + z)) {\n"
+ "default:\n"
+ " break;\n"
+ "}",
+ Spaces);
// Run the first set of tests again with:
Spaces.SpaceAfterCStyleCast = true;
@@ -17314,6 +17366,63 @@ TEST_F(FormatTest, ConfigurableSpacesInParens) {
verifyFormat("size_t idx = (a->foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*foo)(a - 1);", Spaces);
verifyFormat("size_t idx = (*(foo))(a - 1);", Spaces);
+
+ // Check ExceptDoubleParentheses spaces
+ Spaces.IndentWidth = 2;
+ Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
+ Spaces.SpacesInParensOptions = {};
+ Spaces.SpacesInParensOptions.Other = true;
+ Spaces.SpacesInParensOptions.ExceptDoubleParentheses = true;
+ verifyFormat("SomeType *__attribute__(( attr )) *a = NULL;", Spaces);
+ verifyFormat("void __attribute__(( naked )) foo( int bar )", Spaces);
+ verifyFormat("void f() __attribute__(( asdf ));", Spaces);
+ verifyFormat("__attribute__(( __aligned__( x ) )) z;", Spaces);
+ verifyFormat("int x __attribute__(( aligned( 16 ) )) = 0;", Spaces);
+ verifyFormat("class __declspec( dllimport ) X {};", Spaces);
+ verifyFormat("class __declspec(( dllimport )) X {};", Spaces);
+ verifyFormat("int x = ( ( a - 1 ) * 3 );", Spaces);
+ verifyFormat("int x = ( 3 * ( a - 1 ) );", Spaces);
+ verifyFormat("decltype( x ) y = 42;", Spaces);
+ verifyFormat("decltype(( bar( 10 ) )) a = bar( 11 );", Spaces);
+ verifyFormat("if (( i = j ))\n"
+ " do_something( i );",
+ Spaces);
+
+ Spaces.SpacesInParens = FormatStyle::SIPO_Custom;
+ Spaces.SpacesInParensOptions = {};
+ Spaces.SpacesInParensOptions.InConditionalStatements = true;
+ Spaces.SpacesInParensOptions.ExceptDoubleParentheses = true;
+ verifyFormat("while ( (bool)1 )\n"
+ " continue;",
+ Spaces);
+ verifyFormat("while ((i = j))\n"
+ " continue;",
+ Spaces);
+ verifyFormat("do {\n"
+ " do_something((int)i);\n"
+ "} while ( something() );",
+ Spaces);
+ verifyFormat("do {\n"
+ " do_something((int)i);\n"
+ "} while ((i = i + 1));",
+ Spaces);
+ verifyFormat("if ( (x - y) && (a ^ b) )\n"
+ " f();",
+ Spaces);
+ verifyFormat("if ((i = j))\n"
+ " do_something(i);",
+ Spaces);
+ verifyFormat("for ( int i = 0; i < 10; i = (i + 1) )\n"
+ " foo(i);",
+ Spaces);
+ verifyFormat("switch ( x / (y + z) ) {\n"
+ "default:\n"
+ " break;\n"
+ "}",
+ Spaces);
+ verifyFormat("if constexpr ((a = b))\n"
+ " c;",
+ Spaces);
}
TEST_F(FormatTest, ConfigurableSpacesInSquareBrackets) {
diff --git a/clang/www/c_status.html b/clang/www/c_status.html
index 8e42b81..ccb39a1 100644
--- a/clang/www/c_status.html
+++ b/clang/www/c_status.html
@@ -71,7 +71,7 @@
</tr>
<tr>
<td><a href="#c2y">C2y</a></td>
- <td><tt>(Flag currently unavailable)</tt></td>
+ <td><tt>-std=c2y</tt></td>
<td class="partial" align="center">Partial</td>
</tr>
</table>
@@ -1229,8 +1229,7 @@ conforms by not defining the <code>__STDC_IEC_559_COMPLEX__</code> macro.
<p>Clang has support for some of the features of the C standard following C23, informally referred to as C2y.</p>
-<p>Clang currently does not expose a language standard mode flag for C2y.
-<!--You can use Clang in C2y mode with the <code>-std=c2y</code> option (available in Clang 19 and later).--></p>
+<p>You can use Clang in C2y mode with the <code>-std=c2y</code> option (available in Clang 19 and later).</p>
<details open>
<summary>List of features and minimum Clang version with support</summary>
diff --git a/compiler-rt/lib/asan/asan_suppressions.cpp b/compiler-rt/lib/asan/asan_suppressions.cpp
index e71d231..6cee674 100644
--- a/compiler-rt/lib/asan/asan_suppressions.cpp
+++ b/compiler-rt/lib/asan/asan_suppressions.cpp
@@ -39,8 +39,7 @@ void InitializeSuppressions() {
suppression_ctx = new (suppression_placeholder)
SuppressionContext(kSuppressionTypes, ARRAY_SIZE(kSuppressionTypes));
suppression_ctx->ParseFromFile(flags()->suppressions);
- if (&__asan_default_suppressions)
- suppression_ctx->Parse(__asan_default_suppressions());
+ suppression_ctx->Parse(__asan_default_suppressions());
}
bool IsInterceptorSuppressed(const char *interceptor_name) {
diff --git a/compiler-rt/lib/sanitizer_common/sancov_flags.cpp b/compiler-rt/lib/sanitizer_common/sancov_flags.cpp
index ed46e88..43b4bcc 100644
--- a/compiler-rt/lib/sanitizer_common/sancov_flags.cpp
+++ b/compiler-rt/lib/sanitizer_common/sancov_flags.cpp
@@ -37,10 +37,6 @@ static void RegisterSancovFlags(FlagParser *parser, SancovFlags *f) {
#undef SANCOV_FLAG
}
-static const char *MaybeCallSancovDefaultOptions() {
- return (&__sancov_default_options) ? __sancov_default_options() : "";
-}
-
void InitializeSancovFlags() {
SancovFlags *f = sancov_flags();
f->SetDefaults();
@@ -48,7 +44,7 @@ void InitializeSancovFlags() {
FlagParser parser;
RegisterSancovFlags(&parser, f);
- parser.ParseString(MaybeCallSancovDefaultOptions());
+ parser.ParseString(__sancov_default_options());
parser.ParseStringFromEnv("SANCOV_OPTIONS");
ReportUnrecognizedFlags();
diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h
index f9ef8b7..ea35b29 100644
--- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h
+++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h
@@ -286,6 +286,10 @@ public:
fir::StringLitOp createStringLitOp(mlir::Location loc,
llvm::StringRef string);
+ std::pair<fir::TypeInfoOp, mlir::OpBuilder::InsertPoint>
+ createTypeInfoOp(mlir::Location loc, fir::RecordType recordType,
+ fir::RecordType parentType);
+
//===--------------------------------------------------------------------===//
// Linkage helpers (inline). The default linkage is external.
//===--------------------------------------------------------------------===//
diff --git a/flang/include/flang/Optimizer/CodeGen/FIROpPatterns.h b/flang/include/flang/Optimizer/CodeGen/FIROpPatterns.h
index ac09566..91b20251 100644
--- a/flang/include/flang/Optimizer/CodeGen/FIROpPatterns.h
+++ b/flang/include/flang/Optimizer/CodeGen/FIROpPatterns.h
@@ -205,10 +205,10 @@ public:
rewrite(mlir::cast<SourceOp>(op),
OpAdaptor(operands, mlir::cast<SourceOp>(op)), rewriter);
}
- mlir::LogicalResult match(mlir::Operation *op) const final {
+ llvm::LogicalResult match(mlir::Operation *op) const final {
return match(mlir::cast<SourceOp>(op));
}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::Operation *op, mlir::ArrayRef<mlir::Value> operands,
mlir::ConversionPatternRewriter &rewriter) const final {
return matchAndRewrite(mlir::cast<SourceOp>(op),
@@ -218,14 +218,14 @@ public:
/// Rewrite and Match methods that operate on the SourceOp type. These must be
/// overridden by the derived pattern class.
- virtual mlir::LogicalResult match(SourceOp op) const {
+ virtual llvm::LogicalResult match(SourceOp op) const {
llvm_unreachable("must override match or matchAndRewrite");
}
virtual void rewrite(SourceOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const {
llvm_unreachable("must override rewrite or matchAndRewrite");
}
- virtual mlir::LogicalResult
+ virtual llvm::LogicalResult
matchAndRewrite(SourceOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const {
if (mlir::failed(match(op)))
@@ -246,14 +246,14 @@ public:
using FIROpConversion<FromOp>::FIROpConversion;
using OpAdaptor = typename FromOp::Adaptor;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(FromOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const final {
mlir::Type ty = this->convertType(op.getType());
return doRewrite(op, ty, adaptor, rewriter);
}
- virtual mlir::LogicalResult
+ virtual llvm::LogicalResult
doRewrite(FromOp addr, mlir::Type ty, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const = 0;
};
diff --git a/flang/include/flang/Optimizer/CodeGen/TypeConverter.h b/flang/include/flang/Optimizer/CodeGen/TypeConverter.h
index 58803a5..ece3e4e 100644
--- a/flang/include/flang/Optimizer/CodeGen/TypeConverter.h
+++ b/flang/include/flang/Optimizer/CodeGen/TypeConverter.h
@@ -60,7 +60,7 @@ public:
mlir::Type indexType() const;
// fir.type<name(p : TY'...){f : TY...}> --> llvm<"%name = { ty... }">
- std::optional<mlir::LogicalResult>
+ std::optional<llvm::LogicalResult>
convertRecordType(fir::RecordType derived,
llvm::SmallVectorImpl<mlir::Type> &results);
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index baf0952..5b03806 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -2956,7 +2956,10 @@ def fir_TypeInfoOp : fir_Op<"type_info",
let hasVerifier = 1;
- let regions = (region MaxSizedRegion<1>:$dispatch_table);
+ let regions = (region
+ MaxSizedRegion<1>:$dispatch_table,
+ MaxSizedRegion<1>:$component_info
+ );
let builders = [
OpBuilder<(ins "fir::RecordType":$type, "fir::RecordType":$parent_type,
@@ -2967,6 +2970,7 @@ def fir_TypeInfoOp : fir_Op<"type_info",
$sym_name (`noinit` $no_init^)? (`nodestroy` $no_destroy^)?
(`nofinal` $no_final^)? (`extends` $parent_type^)? attr-dict `:` $type
(`dispatch_table` $dispatch_table^)?
+ (`component_info` $component_info^)?
}];
let extraClassDeclaration = [{
@@ -3010,6 +3014,24 @@ def fir_DTEntryOp : fir_Op<"dt_entry", [HasParent<"TypeInfoOp">]> {
}];
}
+def fir_DTComponentOp : fir_Op<"dt_component", [HasParent<"TypeInfoOp">]> {
+ let summary = "define extra information about a component inside fir.type_info";
+
+ let description = [{
+ ```
+ fir.dt_component i lbs [-1,2] init @init_val
+ ```
+ }];
+
+ let arguments = (ins
+ StrAttr:$name,
+ OptionalAttr<DenseI64ArrayAttr>:$lower_bounds,
+ OptionalAttr<FlatSymbolRefAttr>:$init_val
+ );
+
+ let assemblyFormat = "$name (`lbs` $lower_bounds^)? (`init` $init_val^)? attr-dict";
+}
+
def fir_AbsentOp : fir_OneResultOp<"absent", [NoMemoryEffect]> {
let summary = "create value to be passed for absent optional function argument";
let description = [{
diff --git a/flang/include/flang/Optimizer/Dialect/FirAliasTagOpInterface.h b/flang/include/flang/Optimizer/Dialect/FirAliasTagOpInterface.h
index f2d5b39..1e3728e 100644
--- a/flang/include/flang/Optimizer/Dialect/FirAliasTagOpInterface.h
+++ b/flang/include/flang/Optimizer/Dialect/FirAliasTagOpInterface.h
@@ -16,10 +16,10 @@
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/Operation.h"
-#include "mlir/Support/LogicalResult.h"
+#include "llvm/Support/LogicalResult.h"
namespace fir::detail {
-mlir::LogicalResult verifyFirAliasTagOpInterface(mlir::Operation *op);
+llvm::LogicalResult verifyFirAliasTagOpInterface(mlir::Operation *op);
} // namespace fir::detail
#include "flang/Optimizer/Dialect/FirAliasTagOpInterface.h.inc"
diff --git a/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td b/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td
index 3f78a93..926e00c 100644
--- a/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td
+++ b/flang/include/flang/Optimizer/Dialect/FortranVariableInterface.td
@@ -192,7 +192,7 @@ def fir_FortranVariableOpInterface : OpInterface<"FortranVariableOpInterface"> {
}
/// Interface verifier imlementation for declare operations.
- mlir::LogicalResult verifyDeclareLikeOpImpl(mlir::Value memRef);
+ llvm::LogicalResult verifyDeclareLikeOpImpl(mlir::Value memRef);
}];
diff --git a/flang/include/flang/Optimizer/Dialect/Support/KindMapping.h b/flang/include/flang/Optimizer/Dialect/Support/KindMapping.h
index 138123b..083526f 100644
--- a/flang/include/flang/Optimizer/Dialect/Support/KindMapping.h
+++ b/flang/include/flang/Optimizer/Dialect/Support/KindMapping.h
@@ -124,7 +124,7 @@ public:
private:
MatchResult badMapString(const llvm::Twine &ptr);
MatchResult parse(llvm::StringRef kindMap);
- mlir::LogicalResult setDefaultKinds(llvm::ArrayRef<KindTy> defs);
+ llvm::LogicalResult setDefaultKinds(llvm::ArrayRef<KindTy> defs);
mlir::MLIRContext *context;
llvm::DenseMap<std::pair<char, KindTy>, Bitsize> intMap;
diff --git a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
index e9915e89..fdf0db9 100644
--- a/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
+++ b/flang/include/flang/Optimizer/HLFIR/HLFIROps.td
@@ -733,7 +733,7 @@ def hlfir_AssociateOp : hlfir_Op<"associate", [AttrSizedOperandSegments,
CArg<"mlir::Value", "{}">:$shape, CArg<"mlir::ValueRange", "{}">:$typeparams,
CArg<"fir::FortranVariableFlagsAttr", "{}">:$fortran_attrs)>,
OpBuilder<(ins "mlir::Value":$memref, CArg<"mlir::Value", "{}">:$shape,
- CArg<"mlir::ValueRange", "{}">:$typeparams,
+ CArg<"mlir::ValueRange", "{}">:$typeparams,
CArg<"fir::FortranVariableFlagsAttr", "{}">:$fortran_attrs,
CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes)>];
@@ -1258,7 +1258,7 @@ def hlfir_OrderedAssignmentTreeOpInterface : OpInterface<"OrderedAssignmentTreeO
let extraClassDeclaration = [{
/// Interface verifier imlementation.
- mlir::LogicalResult verifyImpl();
+ llvm::LogicalResult verifyImpl();
mlir::Block* getSubTreeBlock() {
mlir::Region* region = getSubTreeRegion();
@@ -1733,8 +1733,8 @@ def hlfir_CharExtremumOp : hlfir_Op<"char_extremum",
[DeclareOpInterfaceMethods<MemoryEffectsOpInterface>]> {
let summary = "Find max/min from given character strings";
let description = [{
- Find the lexicographical minimum or maximum of two or more character
- strings of the same character kind and return the string with the lexicographical
+ Find the lexicographical minimum or maximum of two or more character
+ strings of the same character kind and return the string with the lexicographical
minimum or maximum number of characters. Example:
%0 = hlfir.char_extremum min, %arg0, %arg1 : (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<1,20>>) -> !hlfir.expr<!fir.char<1,10>>
diff --git a/flang/include/flang/Optimizer/Support/InternalNames.h b/flang/include/flang/Optimizer/Support/InternalNames.h
index 23a0385..ff23510 100644
--- a/flang/include/flang/Optimizer/Support/InternalNames.h
+++ b/flang/include/flang/Optimizer/Support/InternalNames.h
@@ -15,6 +15,7 @@
#include <optional>
static constexpr llvm::StringRef typeDescriptorSeparator = ".dt.";
+static constexpr llvm::StringRef componentInitSeparator = ".di.";
static constexpr llvm::StringRef bindingTableSeparator = ".v.";
static constexpr llvm::StringRef boxprocSuffix = "UnboxProc";
@@ -156,6 +157,11 @@ struct NameUniquer {
static std::string
getTypeDescriptorBindingTableName(llvm::StringRef mangledTypeName);
+ /// Given a mangled derived type name and a component name, get the name of
+ /// the global object containing the component default initialization.
+ static std::string getComponentInitName(llvm::StringRef mangledTypeName,
+ llvm::StringRef componentName);
+
/// Remove markers that have been added when doing partial type
/// conversions. mlir::Type cannot be mutated in a pass, so new
/// fir::RecordType must be created when lowering member types.
diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h
index d8bcb5f..ae95a26 100644
--- a/flang/include/flang/Optimizer/Support/Utils.h
+++ b/flang/include/flang/Optimizer/Support/Utils.h
@@ -137,6 +137,29 @@ inline void intrinsicTypeTODO(fir::FirOpBuilder &builder, mlir::Type type,
" in " + intrinsicName);
}
+/// Find the fir.type_info that was created for this \p recordType in \p module,
+/// if any. \p symbolTable can be provided to speed-up the lookup. This tool
+/// will match record type even if they have been "altered" in type conversion
+/// passes.
+fir::TypeInfoOp
+lookupTypeInfoOp(fir::RecordType recordType, mlir::ModuleOp module,
+ const mlir::SymbolTable *symbolTable = nullptr);
+
+/// Find the fir.type_info named \p name in \p module, if any. \p symbolTable
+/// can be provided to speed-up the lookup. Prefer using the equivalent with a
+/// RecordType argument unless it is certain \p name has not been altered by a
+/// pass rewriting fir.type (see NameUniquer::dropTypeConversionMarkers).
+fir::TypeInfoOp
+lookupTypeInfoOp(llvm::StringRef name, mlir::ModuleOp module,
+ const mlir::SymbolTable *symbolTable = nullptr);
+
+/// Returns all lower bounds of \p component if it is an array component of \p
+/// recordType with non default lower bounds. Returns nullopt if this is not an
+/// array componnet of \p recordType or if its lower bounds are all ones.
+std::optional<llvm::ArrayRef<int64_t>> getComponentLowerBoundsIfNonDefault(
+ fir::RecordType recordType, llvm::StringRef component,
+ mlir::ModuleOp module, const mlir::SymbolTable *symbolTable = nullptr);
+
} // namespace fir
#endif // FORTRAN_OPTIMIZER_SUPPORT_UTILS_H
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index d4c5053..60422dd 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -148,6 +148,71 @@ struct ConstructContext {
bool pushedScope = false; // was a scoped pushed for this construct?
};
+/// Helper to gather the lower bounds of array components with non deferred
+/// shape when they are not all ones. Return an empty array attribute otherwise.
+static mlir::DenseI64ArrayAttr
+gatherComponentNonDefaultLowerBounds(mlir::Location loc,
+ mlir::MLIRContext *mlirContext,
+ const Fortran::semantics::Symbol &sym) {
+ if (Fortran::semantics::IsAllocatableOrObjectPointer(&sym))
+ return {};
+ mlir::DenseI64ArrayAttr lbs_attr;
+ if (const auto *objDetails =
+ sym.detailsIf<Fortran::semantics::ObjectEntityDetails>()) {
+ llvm::SmallVector<std::int64_t> lbs;
+ bool hasNonDefaultLbs = false;
+ for (const Fortran::semantics::ShapeSpec &bounds : objDetails->shape())
+ if (auto lb = bounds.lbound().GetExplicit()) {
+ if (auto constant = Fortran::evaluate::ToInt64(*lb)) {
+ hasNonDefaultLbs |= (*constant != 1);
+ lbs.push_back(*constant);
+ } else {
+ TODO(loc, "generate fir.dt_component for length parametrized derived "
+ "types");
+ }
+ }
+ if (hasNonDefaultLbs) {
+ assert(static_cast<int>(lbs.size()) == sym.Rank() &&
+ "expected component bounds to be constant or deferred");
+ lbs_attr = mlir::DenseI64ArrayAttr::get(mlirContext, lbs);
+ }
+ }
+ return lbs_attr;
+}
+
+// Helper class to generate name of fir.global containing component explicit
+// default value for objects, and initial procedure target for procedure pointer
+// components.
+static mlir::FlatSymbolRefAttr gatherComponentInit(
+ mlir::Location loc, Fortran::lower::AbstractConverter &converter,
+ const Fortran::semantics::Symbol &sym, fir::RecordType derivedType) {
+ mlir::MLIRContext *mlirContext = &converter.getMLIRContext();
+ // Return procedure target mangled name for procedure pointer components.
+ if (const auto *procPtr =
+ sym.detailsIf<Fortran::semantics::ProcEntityDetails>()) {
+ if (std::optional<const Fortran::semantics::Symbol *> maybeInitSym =
+ procPtr->init()) {
+ // So far, do not make distinction between p => NULL() and p without init,
+ // f18 always initialize pointers to NULL anyway.
+ if (!*maybeInitSym)
+ return {};
+ return mlir::FlatSymbolRefAttr::get(mlirContext,
+ converter.mangleName(**maybeInitSym));
+ }
+ }
+
+ const auto *objDetails =
+ sym.detailsIf<Fortran::semantics::ObjectEntityDetails>();
+ if (!objDetails || !objDetails->init().has_value())
+ return {};
+ // Object component initial value. Semantic package component object default
+ // value into compiler generated symbols that are lowered as read-only
+ // fir.global. Get the name of this global.
+ std::string name = fir::NameUniquer::getComponentInitName(
+ derivedType.getName(), toStringRef(sym.name()));
+ return mlir::FlatSymbolRefAttr::get(mlirContext, name);
+}
+
/// Helper class to generate the runtime type info global data and the
/// fir.type_info operations that contain the dipatch tables (if any).
/// The type info global data is required to describe the derived type to the
@@ -213,15 +278,14 @@ private:
parentType = mlir::cast<fir::RecordType>(converter.genType(*parent));
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
- mlir::ModuleOp module = builder.getModule();
- fir::TypeInfoOp dt =
- module.lookupSymbol<fir::TypeInfoOp>(info.type.getName());
- if (dt)
- return; // Already created.
- auto insertPt = builder.saveInsertionPoint();
- builder.setInsertionPoint(module.getBody(), module.getBody()->end());
- dt = builder.create<fir::TypeInfoOp>(info.loc, info.type, parentType);
-
+ fir::TypeInfoOp dt;
+ mlir::OpBuilder::InsertPoint insertPointIfCreated;
+ std::tie(dt, insertPointIfCreated) =
+ builder.createTypeInfoOp(info.loc, info.type, parentType);
+ if (!insertPointIfCreated.isSet())
+ return; // fir.type_info was already built in a previous call.
+
+ // Set init, destroy, and nofinal attributes.
if (!info.typeSpec.HasDefaultInitialization(/*ignoreAllocatable=*/false,
/*ignorePointer=*/false))
dt->setAttr(dt.getNoInitAttrName(), builder.getUnitAttr());
@@ -230,13 +294,12 @@ private:
if (!Fortran::semantics::MayRequireFinalization(info.typeSpec))
dt->setAttr(dt.getNoFinalAttrName(), builder.getUnitAttr());
- const Fortran::semantics::Scope *scope = info.typeSpec.scope();
- if (!scope)
- scope = info.typeSpec.typeSymbol().scope();
- assert(scope && "failed to find type scope");
+ const Fortran::semantics::Scope &derivedScope =
+ DEREF(info.typeSpec.GetScope());
+ // Fill binding table region if the derived type has bindings.
Fortran::semantics::SymbolVector bindings =
- Fortran::semantics::CollectBindings(*scope);
+ Fortran::semantics::CollectBindings(derivedScope);
if (!bindings.empty()) {
builder.createBlock(&dt.getDispatchTable());
for (const Fortran::semantics::SymbolRef &binding : bindings) {
@@ -252,7 +315,33 @@ private:
}
builder.create<fir::FirEndOp>(info.loc);
}
- builder.restoreInsertionPoint(insertPt);
+ // Gather info about components that is not reflected in fir.type and may be
+ // needed later: component initial values and array component non default
+ // lower bounds.
+ mlir::Block *componentInfo = nullptr;
+ for (const auto &componentName :
+ info.typeSpec.typeSymbol()
+ .get<Fortran::semantics::DerivedTypeDetails>()
+ .componentNames()) {
+ auto scopeIter = derivedScope.find(componentName);
+ assert(scopeIter != derivedScope.cend() &&
+ "failed to find derived type component symbol");
+ const Fortran::semantics::Symbol &component = scopeIter->second.get();
+ mlir::FlatSymbolRefAttr init_val =
+ gatherComponentInit(info.loc, converter, component, info.type);
+ mlir::DenseI64ArrayAttr lbs = gatherComponentNonDefaultLowerBounds(
+ info.loc, builder.getContext(), component);
+ if (init_val || lbs) {
+ if (!componentInfo)
+ componentInfo = builder.createBlock(&dt.getComponentInfo());
+ auto compName = mlir::StringAttr::get(builder.getContext(),
+ toStringRef(component.name()));
+ builder.create<fir::DTComponentOp>(info.loc, compName, lbs, init_val);
+ }
+ }
+ if (componentInfo)
+ builder.create<fir::FirEndOp>(info.loc);
+ builder.restoreInsertionPoint(insertPointIfCreated);
}
/// Store the front-end data that will be required to generate the type info
diff --git a/flang/lib/Lower/ConvertProcedureDesignator.cpp b/flang/lib/Lower/ConvertProcedureDesignator.cpp
index aa0d7ce..b528544 100644
--- a/flang/lib/Lower/ConvertProcedureDesignator.cpp
+++ b/flang/lib/Lower/ConvertProcedureDesignator.cpp
@@ -89,9 +89,15 @@ fir::ExtendedValue Fortran::lower::convertProcedureDesignator(
fir::factory::genMaxWithZero(builder, loc, rawLen);
}
}
+ // The caller of the function pointer will have to allocate
+ // the function result with the character length specified
+ // by the boxed value. If the result length cannot be
+ // computed statically, set it to zero (we used to use -1,
+ // but this could cause assertions in LLVM after inlining
+ // exposed alloca of size -1).
if (!funcPtrResultLength)
funcPtrResultLength = builder.createIntegerConstant(
- loc, builder.getCharacterLengthType(), -1);
+ loc, builder.getCharacterLengthType(), 0);
return fir::CharBoxValue{funcPtr, funcPtrResultLength};
}
return funcPtr;
diff --git a/flang/lib/Optimizer/Builder/FIRBuilder.cpp b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
index 4a1772a..2ea302d 100644
--- a/flang/lib/Optimizer/Builder/FIRBuilder.cpp
+++ b/flang/lib/Optimizer/Builder/FIRBuilder.cpp
@@ -19,6 +19,7 @@
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/FatalError.h"
#include "flang/Optimizer/Support/InternalNames.h"
+#include "flang/Optimizer/Support/Utils.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
@@ -364,6 +365,22 @@ fir::GlobalOp fir::FirOpBuilder::createGlobal(
return glob;
}
+std::pair<fir::TypeInfoOp, mlir::OpBuilder::InsertPoint>
+fir::FirOpBuilder::createTypeInfoOp(mlir::Location loc,
+ fir::RecordType recordType,
+ fir::RecordType parentType) {
+ mlir::ModuleOp module = getModule();
+ if (fir::TypeInfoOp typeInfo =
+ fir::lookupTypeInfoOp(recordType.getName(), module, symbolTable))
+ return {typeInfo, InsertPoint{}};
+ InsertPoint insertPoint = saveInsertionPoint();
+ setInsertionPoint(module.getBody(), module.getBody()->end());
+ auto typeInfo = create<fir::TypeInfoOp>(loc, recordType, parentType);
+ if (symbolTable)
+ symbolTable->insert(typeInfo);
+ return {typeInfo, insertPoint};
+}
+
mlir::Value fir::FirOpBuilder::convertWithSemantics(
mlir::Location loc, mlir::Type toTy, mlir::Value val,
bool allowCharacterConversion, bool allowRebox) {
diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
index 5f35825..7483acf 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp
@@ -113,7 +113,7 @@ namespace {
struct AddrOfOpConversion : public fir::FIROpConversion<fir::AddrOfOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AddrOfOp addr, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto ty = convertType(addr.getType());
@@ -174,7 +174,7 @@ namespace {
struct DeclareOpConversion : public fir::FIROpConversion<fir::cg::XDeclareOp> {
public:
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::cg::XDeclareOp declareOp, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto memRef = adaptor.getOperands()[0];
@@ -197,7 +197,7 @@ namespace {
struct AllocaOpConversion : public fir::FIROpConversion<fir::AllocaOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AllocaOp alloc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -294,7 +294,7 @@ namespace {
struct BoxAddrOpConversion : public fir::FIROpConversion<fir::BoxAddrOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxAddrOp boxaddr, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value a = adaptor.getOperands()[0];
@@ -316,7 +316,7 @@ struct BoxAddrOpConversion : public fir::FIROpConversion<fir::BoxAddrOp> {
struct BoxCharLenOpConversion : public fir::FIROpConversion<fir::BoxCharLenOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxCharLenOp boxCharLen, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value boxChar = adaptor.getOperands()[0];
@@ -339,7 +339,7 @@ struct BoxCharLenOpConversion : public fir::FIROpConversion<fir::BoxCharLenOp> {
struct BoxDimsOpConversion : public fir::FIROpConversion<fir::BoxDimsOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxDimsOp boxdims, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
llvm::SmallVector<mlir::Type, 3> resultTypes = {
@@ -361,7 +361,7 @@ struct BoxDimsOpConversion : public fir::FIROpConversion<fir::BoxDimsOp> {
struct BoxEleSizeOpConversion : public fir::FIROpConversion<fir::BoxEleSizeOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxEleSizeOp boxelesz, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value box = adaptor.getOperands()[0];
@@ -379,7 +379,7 @@ struct BoxEleSizeOpConversion : public fir::FIROpConversion<fir::BoxEleSizeOp> {
struct BoxIsAllocOpConversion : public fir::FIROpConversion<fir::BoxIsAllocOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxIsAllocOp boxisalloc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value box = adaptor.getOperands()[0];
@@ -397,7 +397,7 @@ struct BoxIsAllocOpConversion : public fir::FIROpConversion<fir::BoxIsAllocOp> {
struct BoxIsArrayOpConversion : public fir::FIROpConversion<fir::BoxIsArrayOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxIsArrayOp boxisarray, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value a = adaptor.getOperands()[0];
@@ -416,7 +416,7 @@ struct BoxIsArrayOpConversion : public fir::FIROpConversion<fir::BoxIsArrayOp> {
struct BoxIsPtrOpConversion : public fir::FIROpConversion<fir::BoxIsPtrOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxIsPtrOp boxisptr, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value box = adaptor.getOperands()[0];
@@ -434,7 +434,7 @@ struct BoxIsPtrOpConversion : public fir::FIROpConversion<fir::BoxIsPtrOp> {
struct BoxRankOpConversion : public fir::FIROpConversion<fir::BoxRankOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxRankOp boxrank, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value a = adaptor.getOperands()[0];
@@ -456,7 +456,7 @@ struct BoxProcHostOpConversion
: public fir::FIROpConversion<fir::BoxProcHostOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxProcHostOp boxprochost, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(boxprochost.getLoc(), "fir.boxproc_host codegen");
@@ -470,7 +470,7 @@ struct BoxTypeDescOpConversion
: public fir::FIROpConversion<fir::BoxTypeDescOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxTypeDescOp boxtypedesc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value box = adaptor.getOperands()[0];
@@ -488,7 +488,7 @@ struct BoxTypeCodeOpConversion
: public fir::FIROpConversion<fir::BoxTypeCodeOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxTypeCodeOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Value box = adaptor.getOperands()[0];
@@ -506,7 +506,7 @@ struct BoxTypeCodeOpConversion
struct StringLitOpConversion : public fir::FIROpConversion<fir::StringLitOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::StringLitOp constop, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto ty = convertType(constop.getType());
@@ -547,7 +547,7 @@ struct StringLitOpConversion : public fir::FIROpConversion<fir::StringLitOp> {
struct CallOpConversion : public fir::FIROpConversion<fir::CallOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::CallOp call, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
llvm::SmallVector<mlir::Type> resultTys;
@@ -578,7 +578,7 @@ namespace {
struct CmpcOpConversion : public fir::FIROpConversion<fir::CmpcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::CmpcOp cmp, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -616,7 +616,7 @@ struct CmpcOpConversion : public fir::FIROpConversion<fir::CmpcOp> {
struct ConstcOpConversion : public fir::FIROpConversion<fir::ConstcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ConstcOp conc, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = conc.getLoc();
@@ -647,7 +647,7 @@ struct ConvertOpConversion : public fir::FIROpConversion<fir::ConvertOp> {
return mlir::isa<mlir::FloatType>(ty);
}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ConvertOp convert, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto fromFirTy = convert.getValue().getType();
@@ -814,7 +814,7 @@ struct ConvertOpConversion : public fir::FIROpConversion<fir::ConvertOp> {
struct TypeInfoOpConversion : public fir::FIROpConversion<fir::TypeInfoOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::TypeInfoOp op, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.eraseOp(op);
@@ -827,7 +827,7 @@ struct TypeInfoOpConversion : public fir::FIROpConversion<fir::TypeInfoOp> {
struct DTEntryOpConversion : public fir::FIROpConversion<fir::DTEntryOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DTEntryOp op, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.eraseOp(op);
@@ -839,7 +839,7 @@ struct DTEntryOpConversion : public fir::FIROpConversion<fir::DTEntryOp> {
struct GlobalLenOpConversion : public fir::FIROpConversion<fir::GlobalLenOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::GlobalLenOp globalLen, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(globalLen.getLoc(), "fir.global_len codegen");
@@ -853,7 +853,7 @@ struct LenParamIndexOpConversion
using FIROpConversion::FIROpConversion;
// FIXME: this should be specialized by the runtime target
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::LenParamIndexOp lenp, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(lenp.getLoc(), "fir.len_param_index codegen");
@@ -867,7 +867,7 @@ struct LenParamIndexOpConversion
struct EmboxCharOpConversion : public fir::FIROpConversion<fir::EmboxCharOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::EmboxCharOp emboxChar, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -960,7 +960,7 @@ namespace {
struct AllocMemOpConversion : public fir::FIROpConversion<fir::AllocMemOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AllocMemOp heap, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type heapTy = heap.getType();
@@ -1030,7 +1030,7 @@ namespace {
struct FreeMemOpConversion : public fir::FIROpConversion<fir::FreeMemOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::FreeMemOp freemem, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = freemem.getLoc();
@@ -1481,7 +1481,7 @@ computeTripletExtent(mlir::ConversionPatternRewriter &rewriter,
struct EmboxOpConversion : public EmboxCommonConversion<fir::EmboxOp> {
using EmboxCommonConversion::EmboxCommonConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::EmboxOp embox, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -1513,7 +1513,7 @@ struct EmboxOpConversion : public EmboxCommonConversion<fir::EmboxOp> {
struct XEmboxOpConversion : public EmboxCommonConversion<fir::cg::XEmboxOp> {
using EmboxCommonConversion::EmboxCommonConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::cg::XEmboxOp xbox, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -1711,7 +1711,7 @@ struct XEmboxOpConversion : public EmboxCommonConversion<fir::cg::XEmboxOp> {
struct XReboxOpConversion : public EmboxCommonConversion<fir::cg::XReboxOp> {
using EmboxCommonConversion::EmboxCommonConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::cg::XReboxOp rebox, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = rebox.getLoc();
@@ -1794,7 +1794,7 @@ struct XReboxOpConversion : public EmboxCommonConversion<fir::cg::XReboxOp> {
private:
/// Write resulting shape and base address in descriptor, and replace rebox
/// op.
- mlir::LogicalResult
+ llvm::LogicalResult
finalizeRebox(fir::cg::XReboxOp rebox, mlir::Type destBoxTy, mlir::Value dest,
mlir::Value base, mlir::ValueRange lbounds,
mlir::ValueRange extents, mlir::ValueRange strides,
@@ -1825,7 +1825,7 @@ private:
}
// Apply slice given the base address, extents and strides of the input box.
- mlir::LogicalResult
+ llvm::LogicalResult
sliceBox(fir::cg::XReboxOp rebox, mlir::Type destBoxTy, mlir::Value dest,
mlir::Value base, mlir::ValueRange inputExtents,
mlir::ValueRange inputStrides, mlir::ValueRange operands,
@@ -1908,7 +1908,7 @@ private:
/// Apply a new shape to the data described by a box given the base address,
/// extents and strides of the box.
- mlir::LogicalResult
+ llvm::LogicalResult
reshapeBox(fir::cg::XReboxOp rebox, mlir::Type destBoxTy, mlir::Value dest,
mlir::Value base, mlir::ValueRange inputExtents,
mlir::ValueRange inputStrides, mlir::ValueRange operands,
@@ -1960,7 +1960,7 @@ private:
struct EmboxProcOpConversion : public fir::FIROpConversion<fir::EmboxProcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::EmboxProcOp emboxproc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(emboxproc.getLoc(), "fir.emboxproc codegen");
@@ -2027,7 +2027,7 @@ struct ExtractValueOpConversion
public ValueOpCommon {
using FIROpAndTypeConversion::FIROpAndTypeConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
doRewrite(fir::ExtractValueOp extractVal, mlir::Type ty, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -2046,7 +2046,7 @@ struct InsertValueOpConversion
public ValueOpCommon {
using FIROpAndTypeConversion::FIROpAndTypeConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
doRewrite(fir::InsertValueOp insertVal, mlir::Type ty, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -2074,7 +2074,7 @@ struct InsertOnRangeOpConversion
}
}
- mlir::LogicalResult
+ llvm::LogicalResult
doRewrite(fir::InsertOnRangeOp range, mlir::Type ty, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
@@ -2127,7 +2127,7 @@ struct XArrayCoorOpConversion
: public fir::FIROpAndTypeConversion<fir::cg::XArrayCoorOp> {
using FIROpAndTypeConversion::FIROpAndTypeConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
doRewrite(fir::cg::XArrayCoorOp coor, mlir::Type llvmPtrTy, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto loc = coor.getLoc();
@@ -2296,7 +2296,7 @@ struct CoordinateOpConversion
: public fir::FIROpAndTypeConversion<fir::CoordinateOp> {
using FIROpAndTypeConversion::FIROpAndTypeConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
doRewrite(fir::CoordinateOp coor, mlir::Type ty, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::ValueRange operands = adaptor.getOperands();
@@ -2396,7 +2396,7 @@ struct CoordinateOpConversion
}
private:
- mlir::LogicalResult
+ llvm::LogicalResult
doRewriteBox(fir::CoordinateOp coor, mlir::ValueRange operands,
mlir::Location loc,
mlir::ConversionPatternRewriter &rewriter) const {
@@ -2482,7 +2482,7 @@ private:
return mlir::success();
}
- mlir::LogicalResult
+ llvm::LogicalResult
doRewriteRefOrPtr(fir::CoordinateOp coor, mlir::Type llvmObjectTy,
mlir::ValueRange operands, mlir::Location loc,
mlir::ConversionPatternRewriter &rewriter) const {
@@ -2593,7 +2593,7 @@ struct FieldIndexOpConversion : public fir::FIROpConversion<fir::FieldIndexOp> {
using FIROpConversion::FIROpConversion;
// NB: most field references should be resolved by this point
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::FieldIndexOp field, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
auto recTy = mlir::cast<fir::RecordType>(field.getOnType());
@@ -2633,7 +2633,7 @@ struct FieldIndexOpConversion : public fir::FIROpConversion<fir::FieldIndexOp> {
struct FirEndOpConversion : public fir::FIROpConversion<fir::FirEndOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::FirEndOp firEnd, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(firEnd.getLoc(), "fir.end codegen");
@@ -2645,7 +2645,7 @@ struct FirEndOpConversion : public fir::FIROpConversion<fir::FirEndOp> {
struct TypeDescOpConversion : public fir::FIROpConversion<fir::TypeDescOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::TypeDescOp typeDescOp, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type inTy = typeDescOp.getInType();
@@ -2672,7 +2672,7 @@ struct TypeDescOpConversion : public fir::FIROpConversion<fir::TypeDescOp> {
struct HasValueOpConversion : public fir::FIROpConversion<fir::HasValueOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::HasValueOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<mlir::LLVM::ReturnOp>(op,
@@ -2725,7 +2725,7 @@ static inline bool attributeTypeIsCompatible(mlir::MLIRContext *ctx,
struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::GlobalOp global, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
@@ -2867,7 +2867,7 @@ private:
struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::LoadOp load, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type llvmLoadTy = convertObjectType(load.getType());
@@ -2925,7 +2925,7 @@ struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
struct NoReassocOpConversion : public fir::FIROpConversion<fir::NoReassocOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::NoReassocOp noreassoc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.replaceOp(noreassoc, adaptor.getOperands()[0]);
@@ -2986,7 +2986,7 @@ static void genCaseLadderStep(mlir::Location loc, mlir::Value cmp,
struct SelectCaseOpConversion : public fir::FIROpConversion<fir::SelectCaseOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SelectCaseOp caseOp, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
unsigned conds = caseOp.getNumConditions();
@@ -3101,7 +3101,7 @@ static void selectMatchAndRewrite(const fir::LLVMTypeConverter &lowering,
struct SelectOpConversion : public fir::FIROpConversion<fir::SelectOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SelectOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
selectMatchAndRewrite<fir::SelectOp>(lowerTy(), op, adaptor, rewriter);
@@ -3113,7 +3113,7 @@ struct SelectOpConversion : public fir::FIROpConversion<fir::SelectOp> {
struct SelectRankOpConversion : public fir::FIROpConversion<fir::SelectRankOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SelectRankOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
selectMatchAndRewrite<fir::SelectRankOp>(lowerTy(), op, adaptor, rewriter);
@@ -3125,7 +3125,7 @@ struct SelectRankOpConversion : public fir::FIROpConversion<fir::SelectRankOp> {
struct SelectTypeOpConversion : public fir::FIROpConversion<fir::SelectTypeOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SelectTypeOp select, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::emitError(select.getLoc(),
@@ -3138,7 +3138,7 @@ struct SelectTypeOpConversion : public fir::FIROpConversion<fir::SelectTypeOp> {
struct StoreOpConversion : public fir::FIROpConversion<fir::StoreOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::StoreOp store, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = store.getLoc();
@@ -3181,7 +3181,7 @@ namespace {
struct UnboxCharOpConversion : public fir::FIROpConversion<fir::UnboxCharOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::UnboxCharOp unboxchar, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type lenTy = convertType(unboxchar.getType(1));
@@ -3206,7 +3206,7 @@ struct UnboxCharOpConversion : public fir::FIROpConversion<fir::UnboxCharOp> {
struct UnboxProcOpConversion : public fir::FIROpConversion<fir::UnboxProcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::UnboxProcOp unboxproc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
TODO(unboxproc.getLoc(), "fir.unboxproc codegen");
@@ -3218,7 +3218,7 @@ struct UnboxProcOpConversion : public fir::FIROpConversion<fir::UnboxProcOp> {
struct UndefOpConversion : public fir::FIROpConversion<fir::UndefOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::UndefOp undef, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<mlir::LLVM::UndefOp>(
@@ -3230,7 +3230,7 @@ struct UndefOpConversion : public fir::FIROpConversion<fir::UndefOp> {
struct ZeroOpConversion : public fir::FIROpConversion<fir::ZeroOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ZeroOp zero, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type ty = convertType(zero.getType());
@@ -3244,7 +3244,7 @@ struct UnreachableOpConversion
: public fir::FIROpConversion<fir::UnreachableOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::UnreachableOp unreach, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<mlir::LLVM::UnreachableOp>(unreach);
@@ -3261,7 +3261,7 @@ struct UnreachableOpConversion
struct IsPresentOpConversion : public fir::FIROpConversion<fir::IsPresentOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::IsPresentOp isPresent, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type idxTy = lowerTy().indexType();
@@ -3290,7 +3290,7 @@ struct IsPresentOpConversion : public fir::FIROpConversion<fir::IsPresentOp> {
struct AbsentOpConversion : public fir::FIROpConversion<fir::AbsentOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AbsentOp absent, OpAdaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Type ty = convertType(absent.getType());
@@ -3350,7 +3350,7 @@ namespace {
struct AddcOpConversion : public fir::FIROpConversion<fir::AddcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AddcOp addc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// given: (x + iy) + (x' + iy')
@@ -3365,7 +3365,7 @@ struct AddcOpConversion : public fir::FIROpConversion<fir::AddcOp> {
struct SubcOpConversion : public fir::FIROpConversion<fir::SubcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SubcOp subc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// given: (x + iy) - (x' + iy')
@@ -3381,7 +3381,7 @@ struct SubcOpConversion : public fir::FIROpConversion<fir::SubcOp> {
struct MulcOpConversion : public fir::FIROpConversion<fir::MulcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::MulcOp mulc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// TODO: Can we use a call to __muldc3 ?
@@ -3415,7 +3415,7 @@ struct MulcOpConversion : public fir::FIROpConversion<fir::MulcOp> {
struct DivcOpConversion : public fir::FIROpConversion<fir::DivcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DivcOp divc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// TODO: Can we use a call to __divdc3 instead?
@@ -3455,7 +3455,7 @@ struct DivcOpConversion : public fir::FIROpConversion<fir::DivcOp> {
struct NegcOpConversion : public fir::FIROpConversion<fir::NegcOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::NegcOp neg, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// given: -(x + iy)
@@ -3476,7 +3476,7 @@ struct NegcOpConversion : public fir::FIROpConversion<fir::NegcOp> {
struct BoxOffsetOpConversion : public fir::FIROpConversion<fir::BoxOffsetOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::BoxOffsetOp boxOffset, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
@@ -3505,7 +3505,7 @@ struct MustBeDeadConversion : public fir::FIROpConversion<FromOp> {
: fir::FIROpConversion<FromOp>(lowering, options) {}
using OpAdaptor = typename FromOp::Adaptor;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(FromOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const final {
if (!op->getUses().empty())
@@ -3519,7 +3519,7 @@ struct UnrealizedConversionCastOpConversion
: public fir::FIROpConversion<mlir::UnrealizedConversionCastOp> {
using FIROpConversion::FIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::UnrealizedConversionCastOp op, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
assert(op.getOutputs().getTypes().size() == 1 && "expect a single type");
@@ -3562,7 +3562,7 @@ class RenameMSVCLibmCallees
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::LLVM::CallOp op,
mlir::PatternRewriter &rewriter) const override {
rewriter.startOpModification(op);
@@ -3581,7 +3581,7 @@ class RenameMSVCLibmFuncs
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::LLVM::LLVMFuncOp op,
mlir::PatternRewriter &rewriter) const override {
rewriter.startOpModification(op);
diff --git a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
index a6fa05f..48d6c000e 100644
--- a/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
+++ b/flang/lib/Optimizer/CodeGen/CodeGenOpenMP.cpp
@@ -59,7 +59,7 @@ struct MapInfoOpConversion
: public OpenMPFIROpConversion<mlir::omp::MapInfoOp> {
using OpenMPFIROpConversion::OpenMPFIROpConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::omp::MapInfoOp curOp, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
const mlir::TypeConverter *converter = getTypeConverter();
diff --git a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
index 6a0cd5e..c57f514 100644
--- a/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/PreCGRewrite.cpp
@@ -80,7 +80,7 @@ class EmboxConversion : public mlir::OpRewritePattern<fir::EmboxOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::EmboxOp embox,
mlir::PatternRewriter &rewriter) const override {
// If the embox does not include a shape, then do not convert it
@@ -95,7 +95,7 @@ public:
return mlir::failure();
}
- mlir::LogicalResult rewriteStaticShape(fir::EmboxOp embox,
+ llvm::LogicalResult rewriteStaticShape(fir::EmboxOp embox,
mlir::PatternRewriter &rewriter,
fir::SequenceType seqTy) const {
auto loc = embox.getLoc();
@@ -115,7 +115,7 @@ public:
return mlir::success();
}
- mlir::LogicalResult rewriteDynamicShape(fir::EmboxOp embox,
+ llvm::LogicalResult rewriteDynamicShape(fir::EmboxOp embox,
mlir::PatternRewriter &rewriter,
mlir::Value shapeVal) const {
auto loc = embox.getLoc();
@@ -168,7 +168,7 @@ class ReboxConversion : public mlir::OpRewritePattern<fir::ReboxOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ReboxOp rebox,
mlir::PatternRewriter &rewriter) const override {
auto loc = rebox.getLoc();
@@ -227,7 +227,7 @@ class ArrayCoorConversion : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ArrayCoorOp arrCoor,
mlir::PatternRewriter &rewriter) const override {
auto loc = arrCoor.getLoc();
@@ -277,7 +277,7 @@ public:
DeclareOpConversion(mlir::MLIRContext *ctx, bool preserveDecl)
: OpRewritePattern(ctx), preserveDeclare(preserveDecl) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DeclareOp declareOp,
mlir::PatternRewriter &rewriter) const override {
if (!preserveDeclare) {
@@ -316,7 +316,7 @@ class DummyScopeOpConversion
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DummyScopeOp dummyScopeOp,
mlir::PatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<fir::UndefOp>(dummyScopeOp,
diff --git a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
index 8199c5e..561d700 100644
--- a/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
+++ b/flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
@@ -667,7 +667,7 @@ public:
/// Convert the type signatures on all the functions present in the module.
/// As the type signature is being changed, this must also update the
/// function itself to use any new arguments, etc.
- mlir::LogicalResult convertTypes(mlir::ModuleOp mod) {
+ llvm::LogicalResult convertTypes(mlir::ModuleOp mod) {
mlir::MLIRContext *ctx = mod->getContext();
auto targetCPU = specifics->getTargetCPU();
mlir::StringAttr targetCPUAttr =
diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp
index 501a36f..ce86c62 100644
--- a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp
+++ b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp
@@ -170,7 +170,7 @@ mlir::Type LLVMTypeConverter::indexType() const {
}
// fir.type<name(p : TY'...){f : TY...}> --> llvm<"%name = { ty... }">
-std::optional<mlir::LogicalResult> LLVMTypeConverter::convertRecordType(
+std::optional<llvm::LogicalResult> LLVMTypeConverter::convertRecordType(
fir::RecordType derived, llvm::SmallVectorImpl<mlir::Type> &results) {
auto name = fir::NameUniquer::dropTypeConversionMarkers(derived.getName());
auto st = mlir::LLVM::LLVMStructType::getIdentified(&getContext(), name);
diff --git a/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp b/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp
index 4fa1d39..53092be 100644
--- a/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp
+++ b/flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp
@@ -51,7 +51,7 @@ void cuf::AllocOp::build(mlir::OpBuilder &builder, mlir::OperationState &result,
}
template <typename Op>
-static mlir::LogicalResult checkCudaAttr(Op op) {
+static llvm::LogicalResult checkCudaAttr(Op op) {
if (op.getDataAttr() == cuf::DataAttribute::Device ||
op.getDataAttr() == cuf::DataAttribute::Managed ||
op.getDataAttr() == cuf::DataAttribute::Unified)
@@ -59,19 +59,19 @@ static mlir::LogicalResult checkCudaAttr(Op op) {
return op.emitOpError("expect device, managed or unified cuda attribute");
}
-mlir::LogicalResult cuf::AllocOp::verify() { return checkCudaAttr(*this); }
+llvm::LogicalResult cuf::AllocOp::verify() { return checkCudaAttr(*this); }
//===----------------------------------------------------------------------===//
// FreeOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult cuf::FreeOp::verify() { return checkCudaAttr(*this); }
+llvm::LogicalResult cuf::FreeOp::verify() { return checkCudaAttr(*this); }
//===----------------------------------------------------------------------===//
// AllocateOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult cuf::AllocateOp::verify() {
+llvm::LogicalResult cuf::AllocateOp::verify() {
if (getPinned() && getStream())
return emitOpError("pinned and stream cannot appears at the same time");
if (!mlir::isa<fir::BaseBoxType>(fir::unwrapRefType(getBox().getType())))
@@ -94,7 +94,7 @@ mlir::LogicalResult cuf::AllocateOp::verify() {
// DataTransferOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult cuf::DataTransferOp::verify() {
+llvm::LogicalResult cuf::DataTransferOp::verify() {
mlir::Type srcTy = getSrc().getType();
mlir::Type dstTy = getDst().getType();
if ((fir::isa_ref_type(srcTy) && fir::isa_ref_type(dstTy)) ||
@@ -114,7 +114,7 @@ mlir::LogicalResult cuf::DataTransferOp::verify() {
// DeallocateOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult cuf::DeallocateOp::verify() {
+llvm::LogicalResult cuf::DeallocateOp::verify() {
if (!mlir::isa<fir::BaseBoxType>(fir::unwrapRefType(getBox().getType())))
return emitOpError(
"expect box to be a reference to class or box type value");
@@ -225,7 +225,7 @@ void printCUFKernelLoopControl(
p.printRegion(region, /*printEntryBlockArgs=*/false);
}
-mlir::LogicalResult cuf::KernelOp::verify() {
+llvm::LogicalResult cuf::KernelOp::verify() {
if (getLowerbound().size() != getUpperbound().size() ||
getLowerbound().size() != getStep().size())
return emitOpError(
diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp
index 84711c5..a499a6e4 100644
--- a/flang/lib/Optimizer/Dialect/FIROps.cpp
+++ b/flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -263,7 +263,7 @@ void fir::AllocaOp::print(mlir::OpAsmPrinter &p) {
printAllocatableOp(p, *this);
}
-mlir::LogicalResult fir::AllocaOp::verify() {
+llvm::LogicalResult fir::AllocaOp::verify() {
llvm::SmallVector<llvm::StringRef> visited;
if (verifyInType(getInType(), visited, numShapeOperands()))
return emitOpError("invalid type for allocation");
@@ -339,7 +339,7 @@ void fir::AllocMemOp::print(mlir::OpAsmPrinter &p) {
printAllocatableOp(p, *this);
}
-mlir::LogicalResult fir::AllocMemOp::verify() {
+llvm::LogicalResult fir::AllocMemOp::verify() {
llvm::SmallVector<llvm::StringRef> visited;
if (verifyInType(getInType(), visited, numShapeOperands()))
return emitOpError("invalid type for allocation");
@@ -375,7 +375,7 @@ static bool validTypeParams(mlir::Type dynTy, mlir::ValueRange typeParams) {
return typeParams.size() == 0;
}
-mlir::LogicalResult fir::ArrayCoorOp::verify() {
+llvm::LogicalResult fir::ArrayCoorOp::verify() {
auto eleTy = fir::dyn_cast_ptrOrBoxEleTy(getMemref().getType());
auto arrTy = mlir::dyn_cast<fir::SequenceType>(eleTy);
if (!arrTy)
@@ -424,7 +424,7 @@ mlir::LogicalResult fir::ArrayCoorOp::verify() {
// Pull in fir.embox and fir.rebox into fir.array_coor when possible.
struct SimplifyArrayCoorOp : public mlir::OpRewritePattern<fir::ArrayCoorOp> {
using mlir::OpRewritePattern<fir::ArrayCoorOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ArrayCoorOp op,
mlir::PatternRewriter &rewriter) const override {
mlir::Value memref = op.getMemref();
@@ -821,7 +821,7 @@ std::vector<mlir::Value> fir::ArrayLoadOp::getExtents() {
return {};
}
-mlir::LogicalResult fir::ArrayLoadOp::verify() {
+llvm::LogicalResult fir::ArrayLoadOp::verify() {
auto eleTy = fir::dyn_cast_ptrOrBoxEleTy(getMemref().getType());
auto arrTy = mlir::dyn_cast<fir::SequenceType>(eleTy);
if (!arrTy)
@@ -864,7 +864,7 @@ mlir::LogicalResult fir::ArrayLoadOp::verify() {
// ArrayMergeStoreOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ArrayMergeStoreOp::verify() {
+llvm::LogicalResult fir::ArrayMergeStoreOp::verify() {
if (!mlir::isa<fir::ArrayLoadOp>(getOriginal().getDefiningOp()))
return emitOpError("operand #0 must be result of a fir.array_load op");
if (auto sl = getSlice()) {
@@ -914,7 +914,7 @@ mlir::Type validArraySubobject(A op) {
return fir::applyPathToType(ty, op.getIndices());
}
-mlir::LogicalResult fir::ArrayFetchOp::verify() {
+llvm::LogicalResult fir::ArrayFetchOp::verify() {
auto arrTy = mlir::cast<fir::SequenceType>(getSequence().getType());
auto indSize = getIndices().size();
if (indSize < arrTy.getDimension())
@@ -936,7 +936,7 @@ mlir::LogicalResult fir::ArrayFetchOp::verify() {
// ArrayAccessOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ArrayAccessOp::verify() {
+llvm::LogicalResult fir::ArrayAccessOp::verify() {
auto arrTy = mlir::cast<fir::SequenceType>(getSequence().getType());
std::size_t indSize = getIndices().size();
if (indSize < arrTy.getDimension())
@@ -956,7 +956,7 @@ mlir::LogicalResult fir::ArrayAccessOp::verify() {
// ArrayUpdateOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ArrayUpdateOp::verify() {
+llvm::LogicalResult fir::ArrayUpdateOp::verify() {
if (fir::isa_ref_type(getMerge().getType()))
return emitOpError("does not support reference type for merge");
auto arrTy = mlir::cast<fir::SequenceType>(getSequence().getType());
@@ -978,7 +978,7 @@ mlir::LogicalResult fir::ArrayUpdateOp::verify() {
// ArrayModifyOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ArrayModifyOp::verify() {
+llvm::LogicalResult fir::ArrayModifyOp::verify() {
auto arrTy = mlir::cast<fir::SequenceType>(getSequence().getType());
auto indSize = getIndices().size();
if (indSize < arrTy.getDimension())
@@ -1171,7 +1171,7 @@ void fir::CallOp::build(mlir::OpBuilder &builder, mlir::OperationState &result,
// CharConvertOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::CharConvertOp::verify() {
+llvm::LogicalResult fir::CharConvertOp::verify() {
auto unwrap = [&](mlir::Type t) {
t = fir::unwrapSequenceType(fir::dyn_cast_ptrEleTy(t));
return mlir::dyn_cast<fir::CharacterType>(t);
@@ -1294,7 +1294,7 @@ void fir::ConstcOp::print(mlir::OpAsmPrinter &p) {
p.printType(getType());
}
-mlir::LogicalResult fir::ConstcOp::verify() {
+llvm::LogicalResult fir::ConstcOp::verify() {
if (!mlir::isa<fir::ComplexType>(getType()))
return emitOpError("must be a !fir.complex type");
return mlir::success();
@@ -1427,7 +1427,7 @@ bool fir::ConvertOp::canBeConverted(mlir::Type inType, mlir::Type outType) {
areVectorsCompatible(inType, outType);
}
-mlir::LogicalResult fir::ConvertOp::verify() {
+llvm::LogicalResult fir::ConvertOp::verify() {
if (canBeConverted(getValue().getType(), getType()))
return mlir::success();
return emitOpError("invalid type conversion")
@@ -1468,7 +1468,7 @@ mlir::ParseResult fir::CoordinateOp::parse(mlir::OpAsmParser &parser,
return mlir::success();
}
-mlir::LogicalResult fir::CoordinateOp::verify() {
+llvm::LogicalResult fir::CoordinateOp::verify() {
const mlir::Type refTy = getRef().getType();
if (fir::isa_ref_type(refTy)) {
auto eleTy = fir::dyn_cast_ptrEleTy(refTy);
@@ -1551,7 +1551,7 @@ mlir::LogicalResult fir::CoordinateOp::verify() {
// DispatchOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::DispatchOp::verify() {
+llvm::LogicalResult fir::DispatchOp::verify() {
// Check that pass_arg_pos is in range of actual operands. pass_arg_pos is
// unsigned so check for less than zero is not needed.
if (getPassArgPos() && *getPassArgPos() > (getArgOperands().size() - 1))
@@ -1579,6 +1579,7 @@ void fir::TypeInfoOp::build(mlir::OpBuilder &builder,
fir::RecordType parentType,
llvm::ArrayRef<mlir::NamedAttribute> attrs) {
result.addRegion();
+ result.addRegion();
result.addAttribute(mlir::SymbolTable::getSymbolAttrName(),
builder.getStringAttr(type.getName()));
result.addAttribute(getTypeAttrName(result.name), mlir::TypeAttr::get(type));
@@ -1588,7 +1589,7 @@ void fir::TypeInfoOp::build(mlir::OpBuilder &builder,
result.addAttributes(attrs);
}
-mlir::LogicalResult fir::TypeInfoOp::verify() {
+llvm::LogicalResult fir::TypeInfoOp::verify() {
if (!getDispatchTable().empty())
for (auto &op : getDispatchTable().front().without_terminator())
if (!mlir::isa<fir::DTEntryOp>(op))
@@ -1606,7 +1607,7 @@ mlir::LogicalResult fir::TypeInfoOp::verify() {
// EmboxOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::EmboxOp::verify() {
+llvm::LogicalResult fir::EmboxOp::verify() {
auto eleTy = fir::dyn_cast_ptrEleTy(getMemref().getType());
bool isArray = false;
if (auto seqTy = mlir::dyn_cast<fir::SequenceType>(eleTy)) {
@@ -1642,7 +1643,7 @@ mlir::LogicalResult fir::EmboxOp::verify() {
// EmboxCharOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::EmboxCharOp::verify() {
+llvm::LogicalResult fir::EmboxCharOp::verify() {
auto eleTy = fir::dyn_cast_ptrEleTy(getMemref().getType());
if (!mlir::dyn_cast_or_null<fir::CharacterType>(eleTy))
return mlir::failure();
@@ -1653,7 +1654,7 @@ mlir::LogicalResult fir::EmboxCharOp::verify() {
// EmboxProcOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::EmboxProcOp::verify() {
+llvm::LogicalResult fir::EmboxProcOp::verify() {
// host bindings (optional) must be a reference to a tuple
if (auto h = getHost()) {
if (auto r = mlir::dyn_cast<fir::ReferenceType>(h.getType()))
@@ -1691,7 +1692,7 @@ void fir::TypeDescOp::print(mlir::OpAsmPrinter &p) {
p.printOptionalAttrDict(getOperation()->getAttrs(), {"in_type"});
}
-mlir::LogicalResult fir::TypeDescOp::verify() {
+llvm::LogicalResult fir::TypeDescOp::verify() {
mlir::Type resultTy = getType();
if (auto tdesc = mlir::dyn_cast<fir::TypeDescType>(resultTy)) {
if (tdesc.getOfTy() != getInType())
@@ -2036,7 +2037,7 @@ static void printCustomRangeSubscript(mlir::OpAsmPrinter &printer,
}
/// Range bounds must be nonnegative, and the range must not be empty.
-mlir::LogicalResult fir::InsertOnRangeOp::verify() {
+llvm::LogicalResult fir::InsertOnRangeOp::verify() {
if (fir::hasDynamicSize(getSeq().getType()))
return emitOpError("must have constant shape and size");
mlir::DenseIntElementsAttr coorAttr = getCoor();
@@ -2079,7 +2080,7 @@ struct UndoComplexPattern : public mlir::RewritePattern {
UndoComplexPattern(mlir::MLIRContext *ctx)
: mlir::RewritePattern("fir.insert_value", 2, ctx) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::Operation *op,
mlir::PatternRewriter &rewriter) const override {
auto insval = mlir::dyn_cast_or_null<fir::InsertValueOp>(op);
@@ -2250,7 +2251,7 @@ mlir::ParseResult fir::IterWhileOp::parse(mlir::OpAsmParser &parser,
return mlir::success();
}
-mlir::LogicalResult fir::IterWhileOp::verify() {
+llvm::LogicalResult fir::IterWhileOp::verify() {
// Check that the body defines as single block argument for the induction
// variable.
auto *body = getBody();
@@ -2610,7 +2611,7 @@ fir::DoLoopOp fir::getForInductionVarOwner(mlir::Value val) {
}
// Lifted from loop.loop
-mlir::LogicalResult fir::DoLoopOp::verify() {
+llvm::LogicalResult fir::DoLoopOp::verify() {
// Check that the body defines as single block argument for the induction
// variable.
auto *body = getBody();
@@ -2785,7 +2786,7 @@ static bool areCompatibleCharacterTypes(mlir::Type t1, mlir::Type t2) {
return c1.getLen() == c2.getLen();
}
-mlir::LogicalResult fir::ReboxOp::verify() {
+llvm::LogicalResult fir::ReboxOp::verify() {
auto inputBoxTy = getBox().getType();
if (fir::isa_unknown_size_box(inputBoxTy))
return emitOpError("box operand must not have unknown rank or type");
@@ -2883,7 +2884,7 @@ static bool areCompatibleAssumedRankElementType(mlir::Type inputEleTy,
return false;
}
-mlir::LogicalResult fir::ReboxAssumedRankOp::verify() {
+llvm::LogicalResult fir::ReboxAssumedRankOp::verify() {
mlir::Type inputType = getBox().getType();
if (!mlir::isa<fir::BaseBoxType>(inputType) && !fir::isBoxAddress(inputType))
return emitOpError("input must be a box or box address");
@@ -2911,7 +2912,7 @@ void fir::ReboxAssumedRankOp::getEffects(
// ResultOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ResultOp::verify() {
+llvm::LogicalResult fir::ResultOp::verify() {
auto *parentOp = (*this)->getParentOp();
auto results = parentOp->getResults();
auto operands = (*this)->getOperands();
@@ -2928,7 +2929,7 @@ mlir::LogicalResult fir::ResultOp::verify() {
// SaveResultOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::SaveResultOp::verify() {
+llvm::LogicalResult fir::SaveResultOp::verify() {
auto resultType = getValue().getType();
if (resultType != fir::dyn_cast_ptrEleTy(getMemref().getType()))
return emitOpError("value type must match memory reference type");
@@ -2992,7 +2993,7 @@ static constexpr llvm::StringRef getTargetOffsetAttr() {
}
template <typename OpT>
-static mlir::LogicalResult verifyIntegralSwitchTerminator(OpT op) {
+static llvm::LogicalResult verifyIntegralSwitchTerminator(OpT op) {
if (!mlir::isa<mlir::IntegerType, mlir::IndexType, fir::IntegerType>(
op.getSelector().getType()))
return op.emitOpError("must be an integer");
@@ -3086,7 +3087,7 @@ static void printIntegralSwitchTerminator(OpT op, mlir::OpAsmPrinter &p) {
// SelectOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::SelectOp::verify() {
+llvm::LogicalResult fir::SelectOp::verify() {
return verifyIntegralSwitchTerminator(*this);
}
@@ -3412,7 +3413,7 @@ void fir::SelectCaseOp::build(mlir::OpBuilder &builder,
destOperands, attributes);
}
-mlir::LogicalResult fir::SelectCaseOp::verify() {
+llvm::LogicalResult fir::SelectCaseOp::verify() {
if (!mlir::isa<mlir::IntegerType, mlir::IndexType, fir::IntegerType,
fir::LogicalType, fir::CharacterType>(getSelector().getType()))
return emitOpError("must be an integer, character, or logical");
@@ -3443,7 +3444,7 @@ mlir::LogicalResult fir::SelectCaseOp::verify() {
// SelectRankOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::SelectRankOp::verify() {
+llvm::LogicalResult fir::SelectRankOp::verify() {
return verifyIntegralSwitchTerminator(*this);
}
@@ -3608,7 +3609,7 @@ void fir::SelectTypeOp::print(mlir::OpAsmPrinter &p) {
fir::SelectTypeOp::getOperandSegmentSizeAttr()});
}
-mlir::LogicalResult fir::SelectTypeOp::verify() {
+llvm::LogicalResult fir::SelectTypeOp::verify() {
if (!mlir::isa<fir::BaseBoxType>(getSelector().getType()))
return emitOpError("must be a fir.class or fir.box type");
if (auto boxType = mlir::dyn_cast<fir::BoxType>(getSelector().getType()))
@@ -3670,7 +3671,7 @@ void fir::SelectTypeOp::build(mlir::OpBuilder &builder,
// ShapeOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ShapeOp::verify() {
+llvm::LogicalResult fir::ShapeOp::verify() {
auto size = getExtents().size();
auto shapeTy = mlir::dyn_cast<fir::ShapeType>(getType());
assert(shapeTy && "must be a shape type");
@@ -3689,7 +3690,7 @@ void fir::ShapeOp::build(mlir::OpBuilder &builder, mlir::OperationState &result,
// ShapeShiftOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ShapeShiftOp::verify() {
+llvm::LogicalResult fir::ShapeShiftOp::verify() {
auto size = getPairs().size();
if (size < 2 || size > 16 * 2)
return emitOpError("incorrect number of args");
@@ -3706,7 +3707,7 @@ mlir::LogicalResult fir::ShapeShiftOp::verify() {
// ShiftOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::ShiftOp::verify() {
+llvm::LogicalResult fir::ShiftOp::verify() {
auto size = getOrigins().size();
auto shiftTy = mlir::dyn_cast<fir::ShiftType>(getType());
assert(shiftTy && "must be a shift type");
@@ -3742,7 +3743,7 @@ unsigned fir::SliceOp::getOutputRank(mlir::ValueRange triples) {
return rank;
}
-mlir::LogicalResult fir::SliceOp::verify() {
+llvm::LogicalResult fir::SliceOp::verify() {
auto size = getTriples().size();
if (size < 3 || size > 16 * 3)
return emitOpError("incorrect number of args for triple");
@@ -3788,7 +3789,7 @@ void fir::StoreOp::print(mlir::OpAsmPrinter &p) {
p << " : " << getMemref().getType();
}
-mlir::LogicalResult fir::StoreOp::verify() {
+llvm::LogicalResult fir::StoreOp::verify() {
if (getValue().getType() != fir::dyn_cast_ptrEleTy(getMemref().getType()))
return emitOpError("store value type must match memory reference type");
return mlir::success();
@@ -3920,7 +3921,7 @@ void fir::StringLitOp::print(mlir::OpAsmPrinter &p) {
p.printType(getType());
}
-mlir::LogicalResult fir::StringLitOp::verify() {
+llvm::LogicalResult fir::StringLitOp::verify() {
if (mlir::cast<mlir::IntegerAttr>(getSize()).getValue().isNegative())
return emitOpError("size must be non-negative");
if (auto xl = getOperation()->getAttr(fir::StringLitOp::xlist())) {
@@ -3941,7 +3942,7 @@ mlir::LogicalResult fir::StringLitOp::verify() {
// UnboxProcOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::UnboxProcOp::verify() {
+llvm::LogicalResult fir::UnboxProcOp::verify() {
if (auto eleTy = fir::dyn_cast_ptrEleTy(getRefTuple().getType()))
if (mlir::isa<mlir::TupleType>(eleTy))
return mlir::success();
@@ -4067,7 +4068,7 @@ mlir::ParseResult fir::IfOp::parse(mlir::OpAsmParser &parser,
return mlir::success();
}
-mlir::LogicalResult fir::IfOp::verify() {
+llvm::LogicalResult fir::IfOp::verify() {
if (getNumResults() != 0 && getElseRegion().empty())
return emitOpError("must have an else block if defining values");
@@ -4109,7 +4110,7 @@ void fir::IfOp::resultToSourceOps(llvm::SmallVectorImpl<mlir::Value> &results,
// BoxOffsetOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult fir::BoxOffsetOp::verify() {
+llvm::LogicalResult fir::BoxOffsetOp::verify() {
auto boxType = mlir::dyn_cast_or_null<fir::BaseBoxType>(
fir::dyn_cast_ptrEleTy(getBoxRef().getType()));
if (!boxType)
@@ -4402,7 +4403,7 @@ mlir::Type fir::applyPathToType(mlir::Type eleTy, mlir::ValueRange path) {
return eleTy;
}
-mlir::LogicalResult fir::DeclareOp::verify() {
+llvm::LogicalResult fir::DeclareOp::verify() {
auto fortranVar =
mlir::cast<fir::FortranVariableOpInterface>(this->getOperation());
return fortranVar.verifyDeclareLikeOpImpl(getMemref());
diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp
index b3f2ec8..dbccacf 100644
--- a/flang/lib/Optimizer/Dialect/FIRType.cpp
+++ b/flang/lib/Optimizer/Dialect/FIRType.cpp
@@ -683,7 +683,7 @@ void fir::BoxProcType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getEleTy() << '>';
}
-mlir::LogicalResult
+llvm::LogicalResult
BoxProcType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (mlir::isa<mlir::FunctionType>(eleTy))
@@ -704,7 +704,7 @@ static bool cannotBePointerOrHeapElementType(mlir::Type eleTy) {
// BoxType
//===----------------------------------------------------------------------===//
-mlir::LogicalResult
+llvm::LogicalResult
fir::BoxType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (mlir::isa<fir::BaseBoxType>(eleTy))
@@ -773,7 +773,7 @@ void fir::CharacterType::print(mlir::AsmPrinter &printer) const {
// ClassType
//===----------------------------------------------------------------------===//
-mlir::LogicalResult
+llvm::LogicalResult
fir::ClassType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (mlir::isa<fir::RecordType, fir::SequenceType, fir::HeapType,
@@ -820,7 +820,7 @@ void fir::HeapType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getEleTy() << '>';
}
-mlir::LogicalResult
+llvm::LogicalResult
fir::HeapType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (cannotBePointerOrHeapElementType(eleTy))
@@ -868,7 +868,7 @@ void fir::PointerType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getEleTy() << '>';
}
-mlir::LogicalResult fir::PointerType::verify(
+llvm::LogicalResult fir::PointerType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (cannotBePointerOrHeapElementType(eleTy))
@@ -889,7 +889,7 @@ void fir::RealType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getFKind() << '>';
}
-mlir::LogicalResult
+llvm::LogicalResult
fir::RealType::verify(llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
KindTy fKind) {
// TODO
@@ -1012,7 +1012,7 @@ detail::RecordTypeStorage const *fir::RecordType::uniqueKey() const {
return getImpl();
}
-mlir::LogicalResult fir::RecordType::verify(
+llvm::LogicalResult fir::RecordType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
llvm::StringRef name) {
if (name.size() == 0)
@@ -1047,7 +1047,7 @@ void fir::ReferenceType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getEleTy() << '>';
}
-mlir::LogicalResult fir::ReferenceType::verify(
+llvm::LogicalResult fir::ReferenceType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (mlir::isa<ShapeType, ShapeShiftType, SliceType, FieldType, LenType,
@@ -1121,7 +1121,7 @@ unsigned fir::SequenceType::getConstantRows() const {
return count;
}
-mlir::LogicalResult fir::SequenceType::verify(
+llvm::LogicalResult fir::SequenceType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
llvm::ArrayRef<int64_t> shape, mlir::Type eleTy,
mlir::AffineMapAttr layoutMap) {
@@ -1196,7 +1196,7 @@ void fir::TypeDescType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getOfTy() << '>';
}
-mlir::LogicalResult fir::TypeDescType::verify(
+llvm::LogicalResult fir::TypeDescType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError,
mlir::Type eleTy) {
if (mlir::isa<BoxType, BoxCharType, BoxProcType, ShapeType, ShapeShiftType,
@@ -1225,7 +1225,7 @@ void fir::VectorType::print(mlir::AsmPrinter &printer) const {
printer << "<" << getLen() << ':' << getEleTy() << '>';
}
-mlir::LogicalResult fir::VectorType::verify(
+llvm::LogicalResult fir::VectorType::verify(
llvm::function_ref<mlir::InFlightDiagnostic()> emitError, uint64_t len,
mlir::Type eleTy) {
if (!(fir::isa_real(eleTy) || fir::isa_integer(eleTy)))
diff --git a/flang/lib/Optimizer/Dialect/FirAliasTagOpInterface.cpp b/flang/lib/Optimizer/Dialect/FirAliasTagOpInterface.cpp
index 648f490..bf058c1 100644
--- a/flang/lib/Optimizer/Dialect/FirAliasTagOpInterface.cpp
+++ b/flang/lib/Optimizer/Dialect/FirAliasTagOpInterface.cpp
@@ -15,17 +15,17 @@
#include "flang/Optimizer/Dialect/FirAliasTagOpInterface.cpp.inc"
-mlir::LogicalResult
+llvm::LogicalResult
fir::detail::verifyFirAliasTagOpInterface(mlir::Operation *op) {
auto iface = mlir::cast<FirAliasTagOpInterface>(op);
mlir::ArrayAttr tags = iface.getTBAATagsOrNull();
if (!tags)
- return mlir::success();
+ return llvm::success();
for (mlir::Attribute iter : tags)
if (!mlir::isa<mlir::LLVM::TBAATagAttr>(iter))
return op->emitOpError("expected op to return array of ")
<< mlir::LLVM::TBAATagAttr::getMnemonic() << " attributes";
- return mlir::success();
+ return llvm::success();
}
diff --git a/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp b/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp
index 70b1a2f..034f8c7 100644
--- a/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp
+++ b/flang/lib/Optimizer/Dialect/FortranVariableInterface.cpp
@@ -14,7 +14,7 @@
#include "flang/Optimizer/Dialect/FortranVariableInterface.cpp.inc"
-mlir::LogicalResult
+llvm::LogicalResult
fir::FortranVariableOpInterface::verifyDeclareLikeOpImpl(mlir::Value memref) {
const unsigned numExplicitTypeParams = getExplicitTypeParams().size();
mlir::Type memType = memref.getType();
diff --git a/flang/lib/Optimizer/Dialect/Support/KindMapping.cpp b/flang/lib/Optimizer/Dialect/Support/KindMapping.cpp
index bcb1121..30c6030 100644
--- a/flang/lib/Optimizer/Dialect/Support/KindMapping.cpp
+++ b/flang/lib/Optimizer/Dialect/Support/KindMapping.cpp
@@ -177,7 +177,7 @@ static MatchResult parseInt(unsigned &result, const char *&ptr,
return mlir::success();
}
-static mlir::LogicalResult matchString(const char *&ptr, const char *endPtr,
+static llvm::LogicalResult matchString(const char *&ptr, const char *endPtr,
llvm::StringRef literal) {
llvm::StringRef s(ptr, endPtr - ptr);
if (s.starts_with(literal)) {
@@ -351,7 +351,7 @@ std::string fir::KindMapping::mapToString() const {
return result;
}
-mlir::LogicalResult
+llvm::LogicalResult
fir::KindMapping::setDefaultKinds(llvm::ArrayRef<KindTy> defs) {
if (defs.empty()) {
// generic front-end defaults
diff --git a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
index cbe789f..ae62aff 100644
--- a/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
+++ b/flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
@@ -78,7 +78,7 @@ static bool isAllocatableBoxRef(mlir::Type type) {
return boxType && mlir::isa<fir::HeapType>(boxType.getEleTy());
}
-mlir::LogicalResult hlfir::AssignOp::verify() {
+llvm::LogicalResult hlfir::AssignOp::verify() {
mlir::Type lhsType = getLhs().getType();
if (isAllocatableAssignment() && !isAllocatableBoxRef(lhsType))
return emitOpError("lhs must be an allocatable when `realloc` is set");
@@ -137,7 +137,7 @@ void hlfir::DeclareOp::build(mlir::OpBuilder &builder,
typeparams, dummy_scope, nameAttr, fortran_attrs, data_attr);
}
-mlir::LogicalResult hlfir::DeclareOp::verify() {
+llvm::LogicalResult hlfir::DeclareOp::verify() {
if (getMemref().getType() != getResult(1).getType())
return emitOpError("second result type must match input memref type");
mlir::Type hlfirVariableType = getHLFIRVariableType(
@@ -278,7 +278,7 @@ static void printDesignatorComplexPart(mlir::OpAsmPrinter &p,
}
}
-mlir::LogicalResult hlfir::DesignateOp::verify() {
+llvm::LogicalResult hlfir::DesignateOp::verify() {
mlir::Type memrefType = getMemref().getType();
mlir::Type baseType = getFortranElementOrSequenceType(memrefType);
mlir::Type baseElementType = fir::unwrapSequenceType(baseType);
@@ -433,7 +433,7 @@ mlir::LogicalResult hlfir::DesignateOp::verify() {
// ParentComponentOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::ParentComponentOp::verify() {
+llvm::LogicalResult hlfir::ParentComponentOp::verify() {
mlir::Type baseType =
hlfir::getFortranElementOrSequenceType(getMemref().getType());
auto maybeInputSeqType = mlir::dyn_cast<fir::SequenceType>(baseType);
@@ -488,7 +488,7 @@ mlir::LogicalResult hlfir::ParentComponentOp::verify() {
// LogicalReductionOp
//===----------------------------------------------------------------------===//
template <typename LogicalReductionOp>
-static mlir::LogicalResult
+static llvm::LogicalResult
verifyLogicalReductionOp(LogicalReductionOp reductionOp) {
mlir::Operation *op = reductionOp->getOperation();
@@ -539,7 +539,7 @@ verifyLogicalReductionOp(LogicalReductionOp reductionOp) {
// AllOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::AllOp::verify() {
+llvm::LogicalResult hlfir::AllOp::verify() {
return verifyLogicalReductionOp<hlfir::AllOp *>(this);
}
@@ -554,7 +554,7 @@ void hlfir::AllOp::getEffects(
// AnyOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::AnyOp::verify() {
+llvm::LogicalResult hlfir::AnyOp::verify() {
return verifyLogicalReductionOp<hlfir::AnyOp *>(this);
}
@@ -569,7 +569,7 @@ void hlfir::AnyOp::getEffects(
// CountOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::CountOp::verify() {
+llvm::LogicalResult hlfir::CountOp::verify() {
mlir::Operation *op = getOperation();
auto results = op->getResultTypes();
@@ -626,7 +626,7 @@ getCharacterLengthIfStatic(mlir::Type t) {
return std::nullopt;
}
-mlir::LogicalResult hlfir::ConcatOp::verify() {
+llvm::LogicalResult hlfir::ConcatOp::verify() {
if (getStrings().size() < 2)
return emitOpError("must be provided at least two string operands");
unsigned kind = getCharacterKind(getResult().getType());
@@ -668,7 +668,7 @@ void hlfir::ConcatOp::getEffects(
//===----------------------------------------------------------------------===//
template <typename NumericalReductionOp>
-static mlir::LogicalResult
+static llvm::LogicalResult
verifyArrayAndMaskForReductionOp(NumericalReductionOp reductionOp) {
mlir::Value array = reductionOp->getArray();
mlir::Value mask = reductionOp->getMask();
@@ -707,7 +707,7 @@ verifyArrayAndMaskForReductionOp(NumericalReductionOp reductionOp) {
}
template <typename NumericalReductionOp>
-static mlir::LogicalResult
+static llvm::LogicalResult
verifyNumericalReductionOp(NumericalReductionOp reductionOp) {
mlir::Operation *op = reductionOp->getOperation();
auto results = op->getResultTypes();
@@ -760,7 +760,7 @@ verifyNumericalReductionOp(NumericalReductionOp reductionOp) {
// ProductOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::ProductOp::verify() {
+llvm::LogicalResult hlfir::ProductOp::verify() {
return verifyNumericalReductionOp<hlfir::ProductOp *>(this);
}
@@ -776,7 +776,7 @@ void hlfir::ProductOp::getEffects(
//===----------------------------------------------------------------------===//
template <typename CharacterReductionOp>
-static mlir::LogicalResult
+static llvm::LogicalResult
verifyCharacterReductionOp(CharacterReductionOp reductionOp) {
mlir::Operation *op = reductionOp->getOperation();
auto results = op->getResultTypes();
@@ -821,7 +821,7 @@ verifyCharacterReductionOp(CharacterReductionOp reductionOp) {
// MaxvalOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::MaxvalOp::verify() {
+llvm::LogicalResult hlfir::MaxvalOp::verify() {
mlir::Operation *op = getOperation();
auto results = op->getResultTypes();
@@ -845,7 +845,7 @@ void hlfir::MaxvalOp::getEffects(
// MinvalOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::MinvalOp::verify() {
+llvm::LogicalResult hlfir::MinvalOp::verify() {
mlir::Operation *op = getOperation();
auto results = op->getResultTypes();
@@ -870,7 +870,7 @@ void hlfir::MinvalOp::getEffects(
//===----------------------------------------------------------------------===//
template <typename NumericalReductionOp>
-static mlir::LogicalResult
+static llvm::LogicalResult
verifyResultForMinMaxLoc(NumericalReductionOp reductionOp) {
mlir::Operation *op = reductionOp->getOperation();
auto results = op->getResultTypes();
@@ -908,7 +908,7 @@ verifyResultForMinMaxLoc(NumericalReductionOp reductionOp) {
return mlir::success();
}
-mlir::LogicalResult hlfir::MinlocOp::verify() {
+llvm::LogicalResult hlfir::MinlocOp::verify() {
auto res = verifyArrayAndMaskForReductionOp(this);
if (failed(res))
return res;
@@ -927,7 +927,7 @@ void hlfir::MinlocOp::getEffects(
// MaxlocOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::MaxlocOp::verify() {
+llvm::LogicalResult hlfir::MaxlocOp::verify() {
auto res = verifyArrayAndMaskForReductionOp(this);
if (failed(res))
return res;
@@ -971,7 +971,7 @@ void hlfir::SetLengthOp::getEffects(
// SumOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::SumOp::verify() {
+llvm::LogicalResult hlfir::SumOp::verify() {
return verifyNumericalReductionOp<hlfir::SumOp *>(this);
}
@@ -986,7 +986,7 @@ void hlfir::SumOp::getEffects(
// DotProductOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::DotProductOp::verify() {
+llvm::LogicalResult hlfir::DotProductOp::verify() {
mlir::Value lhs = getLhs();
mlir::Value rhs = getRhs();
fir::SequenceType lhsTy = mlir::cast<fir::SequenceType>(
@@ -1042,7 +1042,7 @@ void hlfir::DotProductOp::getEffects(
// MatmulOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::MatmulOp::verify() {
+llvm::LogicalResult hlfir::MatmulOp::verify() {
mlir::Value lhs = getLhs();
mlir::Value rhs = getRhs();
fir::SequenceType lhsTy = mlir::cast<fir::SequenceType>(
@@ -1111,7 +1111,7 @@ mlir::LogicalResult hlfir::MatmulOp::verify() {
return mlir::success();
}
-mlir::LogicalResult
+llvm::LogicalResult
hlfir::MatmulOp::canonicalize(MatmulOp matmulOp,
mlir::PatternRewriter &rewriter) {
// the only two uses of the transposed matrix should be for the hlfir.matmul
@@ -1170,7 +1170,7 @@ void hlfir::MatmulOp::getEffects(
// TransposeOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::TransposeOp::verify() {
+llvm::LogicalResult hlfir::TransposeOp::verify() {
mlir::Value array = getArray();
fir::SequenceType arrayTy = mlir::cast<fir::SequenceType>(
hlfir::getFortranElementOrSequenceType(array.getType()));
@@ -1212,7 +1212,7 @@ void hlfir::TransposeOp::getEffects(
// MatmulTransposeOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::MatmulTransposeOp::verify() {
+llvm::LogicalResult hlfir::MatmulTransposeOp::verify() {
mlir::Value lhs = getLhs();
mlir::Value rhs = getRhs();
fir::SequenceType lhsTy = mlir::cast<fir::SequenceType>(
@@ -1350,7 +1350,7 @@ void hlfir::EndAssociateOp::build(mlir::OpBuilder &builder,
associate.getMustFreeStrorageFlag());
}
-mlir::LogicalResult hlfir::EndAssociateOp::verify() {
+llvm::LogicalResult hlfir::EndAssociateOp::verify() {
mlir::Value var = getVar();
if (hlfir::mayHaveAllocatableComponent(var.getType()) &&
!hlfir::isFortranEntity(var))
@@ -1438,7 +1438,7 @@ mlir::Value hlfir::ElementalOp::getElementEntity() {
return mlir::cast<hlfir::YieldElementOp>(getBody()->back()).getElementValue();
}
-mlir::LogicalResult hlfir::ElementalOp::verify() {
+llvm::LogicalResult hlfir::ElementalOp::verify() {
mlir::Value mold = getMold();
hlfir::ExprType resultType = mlir::cast<hlfir::ExprType>(getType());
if (!!mold != resultType.isPolymorphic())
@@ -1476,7 +1476,7 @@ void hlfir::NullOp::build(mlir::OpBuilder &builder,
// DestroyOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::DestroyOp::verify() {
+llvm::LogicalResult hlfir::DestroyOp::verify() {
if (mustFinalizeExpr()) {
mlir::Value expr = getExpr();
hlfir::ExprType exprTy = mlir::cast<hlfir::ExprType>(expr.getType());
@@ -1517,7 +1517,7 @@ std::size_t hlfir::ShapeOfOp::getRank() {
return shape.getRank();
}
-mlir::LogicalResult hlfir::ShapeOfOp::verify() {
+llvm::LogicalResult hlfir::ShapeOfOp::verify() {
mlir::Value expr = getExpr();
hlfir::ExprType exprTy = mlir::cast<hlfir::ExprType>(expr.getType());
std::size_t exprRank = exprTy.getShape().size();
@@ -1532,7 +1532,7 @@ mlir::LogicalResult hlfir::ShapeOfOp::verify() {
return mlir::success();
}
-mlir::LogicalResult
+llvm::LogicalResult
hlfir::ShapeOfOp::canonicalize(ShapeOfOp shapeOf,
mlir::PatternRewriter &rewriter) {
// if extent information is available at compile time, immediately fold the
@@ -1544,11 +1544,11 @@ hlfir::ShapeOfOp::canonicalize(ShapeOfOp shapeOf,
mlir::Value shape = hlfir::genExprShape(rewriter, loc, expr);
if (!shape)
// shape information is not available at compile time
- return mlir::LogicalResult::failure();
+ return llvm::LogicalResult::failure();
rewriter.replaceAllUsesWith(shapeOf.getResult(), shape);
rewriter.eraseOp(shapeOf);
- return mlir::LogicalResult::success();
+ return llvm::LogicalResult::success();
}
//===----------------------------------------------------------------------===//
@@ -1563,7 +1563,7 @@ void hlfir::GetExtentOp::build(mlir::OpBuilder &builder,
build(builder, result, indexTy, shape, dimAttr);
}
-mlir::LogicalResult hlfir::GetExtentOp::verify() {
+llvm::LogicalResult hlfir::GetExtentOp::verify() {
fir::ShapeType shapeTy = mlir::cast<fir::ShapeType>(getShape().getType());
std::uint64_t rank = shapeTy.getRank();
llvm::APInt dim = getDim();
@@ -1640,7 +1640,7 @@ static mlir::Operation *getTerminator(mlir::Region &region) {
return &region.back().back();
}
-mlir::LogicalResult hlfir::RegionAssignOp::verify() {
+llvm::LogicalResult hlfir::RegionAssignOp::verify() {
if (!mlir::isa_and_nonnull<hlfir::YieldOp>(getTerminator(getRhsRegion())))
return emitOpError(
"right-hand side region must be terminated by an hlfir.yield");
@@ -1692,7 +1692,7 @@ void hlfir::ElementalAddrOp::build(mlir::OpBuilder &builder,
odsState.addRegion();
}
-mlir::LogicalResult hlfir::ElementalAddrOp::verify() {
+llvm::LogicalResult hlfir::ElementalAddrOp::verify() {
hlfir::YieldOp yieldOp =
mlir::dyn_cast_or_null<hlfir::YieldOp>(getTerminator(getBody()));
if (!yieldOp)
@@ -1729,7 +1729,7 @@ mlir::Region *hlfir::ElementalAddrOp::getElementCleanup() {
// OrderedAssignmentTreeOpInterface
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::OrderedAssignmentTreeOpInterface::verifyImpl() {
+llvm::LogicalResult hlfir::OrderedAssignmentTreeOpInterface::verifyImpl() {
if (mlir::Region *body = getSubTreeRegion())
if (!body->empty())
for (mlir::Operation &op : body->front())
@@ -1812,7 +1812,7 @@ static bool yieldsLogical(mlir::Region &region, bool mustBeScalarI1) {
hlfir::getFortranElementOrSequenceType(yieldType));
}
-mlir::LogicalResult hlfir::ForallMaskOp::verify() {
+llvm::LogicalResult hlfir::ForallMaskOp::verify() {
if (!yieldsLogical(getMaskRegion(), /*mustBeScalarI1=*/true))
return emitOpError("mask region must yield a scalar i1");
mlir::Operation *op = getOperation();
@@ -1828,7 +1828,7 @@ mlir::LogicalResult hlfir::ForallMaskOp::verify() {
//===----------------------------------------------------------------------===//
template <typename ConcreteOp>
-static mlir::LogicalResult verifyWhereAndElseWhereBody(ConcreteOp &concreteOp) {
+static llvm::LogicalResult verifyWhereAndElseWhereBody(ConcreteOp &concreteOp) {
for (mlir::Operation &op : concreteOp.getBody().front())
if (mlir::isa<hlfir::ForallOp>(op))
return concreteOp.emitOpError(
@@ -1836,13 +1836,13 @@ static mlir::LogicalResult verifyWhereAndElseWhereBody(ConcreteOp &concreteOp) {
return mlir::success();
}
-mlir::LogicalResult hlfir::WhereOp::verify() {
+llvm::LogicalResult hlfir::WhereOp::verify() {
if (!yieldsLogical(getMaskRegion(), /*mustBeScalarI1=*/false))
return emitOpError("mask region must yield a logical array");
return verifyWhereAndElseWhereBody(*this);
}
-mlir::LogicalResult hlfir::ElseWhereOp::verify() {
+llvm::LogicalResult hlfir::ElseWhereOp::verify() {
if (!getMaskRegion().empty())
if (!yieldsLogical(getMaskRegion(), /*mustBeScalarI1=*/false))
return emitOpError(
@@ -1854,7 +1854,7 @@ mlir::LogicalResult hlfir::ElseWhereOp::verify() {
// ForallIndexOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult
+llvm::LogicalResult
hlfir::ForallIndexOp::canonicalize(hlfir::ForallIndexOp indexOp,
mlir::PatternRewriter &rewriter) {
for (mlir::Operation *user : indexOp->getResult(0).getUsers())
@@ -1878,7 +1878,7 @@ hlfir::ForallIndexOp::canonicalize(hlfir::ForallIndexOp indexOp,
// CharExtremumOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult hlfir::CharExtremumOp::verify() {
+llvm::LogicalResult hlfir::CharExtremumOp::verify() {
if (getStrings().size() < 2)
return emitOpError("must be provided at least two string operands");
unsigned kind = getCharacterKind(getResult().getType());
@@ -1922,7 +1922,7 @@ void hlfir::CharExtremumOp::getEffects(
// GetLength
//===----------------------------------------------------------------------===//
-mlir::LogicalResult
+llvm::LogicalResult
hlfir::GetLengthOp::canonicalize(GetLengthOp getLength,
mlir::PatternRewriter &rewriter) {
mlir::Location loc = getLength.getLoc();
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp b/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
index e292b56..a70a6b3 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/BufferizeHLFIR.cpp
@@ -30,7 +30,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/TypeSwitch.h"
@@ -180,7 +179,7 @@ struct AsExprOpConversion : public mlir::OpConversionPattern<hlfir::AsExprOp> {
using mlir::OpConversionPattern<hlfir::AsExprOp>::OpConversionPattern;
explicit AsExprOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::AsExprOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AsExprOp asExpr, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = asExpr->getLoc();
@@ -205,7 +204,7 @@ struct ShapeOfOpConversion
: public mlir::OpConversionPattern<hlfir::ShapeOfOp> {
using mlir::OpConversionPattern<hlfir::ShapeOfOp>::OpConversionPattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ShapeOfOp shapeOf, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = shapeOf.getLoc();
@@ -237,7 +236,7 @@ struct ApplyOpConversion : public mlir::OpConversionPattern<hlfir::ApplyOp> {
using mlir::OpConversionPattern<hlfir::ApplyOp>::OpConversionPattern;
explicit ApplyOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::ApplyOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ApplyOp apply, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = apply->getLoc();
@@ -262,7 +261,7 @@ struct AssignOpConversion : public mlir::OpConversionPattern<hlfir::AssignOp> {
using mlir::OpConversionPattern<hlfir::AssignOp>::OpConversionPattern;
explicit AssignOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::AssignOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AssignOp assign, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
llvm::SmallVector<mlir::Value> newOperands;
@@ -279,7 +278,7 @@ struct ConcatOpConversion : public mlir::OpConversionPattern<hlfir::ConcatOp> {
using mlir::OpConversionPattern<hlfir::ConcatOp>::OpConversionPattern;
explicit ConcatOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::ConcatOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ConcatOp concat, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = concat->getLoc();
@@ -318,7 +317,7 @@ struct SetLengthOpConversion
using mlir::OpConversionPattern<hlfir::SetLengthOp>::OpConversionPattern;
explicit SetLengthOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::SetLengthOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::SetLengthOp setLength, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = setLength->getLoc();
@@ -351,7 +350,7 @@ struct GetLengthOpConversion
using mlir::OpConversionPattern<hlfir::GetLengthOp>::OpConversionPattern;
explicit GetLengthOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::GetLengthOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::GetLengthOp getLength, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = getLength->getLoc();
@@ -441,7 +440,7 @@ struct AssociateOpConversion
using mlir::OpConversionPattern<hlfir::AssociateOp>::OpConversionPattern;
explicit AssociateOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::AssociateOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AssociateOp associate, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = associate->getLoc();
@@ -660,7 +659,7 @@ struct EndAssociateOpConversion
using mlir::OpConversionPattern<hlfir::EndAssociateOp>::OpConversionPattern;
explicit EndAssociateOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::EndAssociateOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::EndAssociateOp endAssociate, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = endAssociate->getLoc();
@@ -677,7 +676,7 @@ struct DestroyOpConversion
using mlir::OpConversionPattern<hlfir::DestroyOp>::OpConversionPattern;
explicit DestroyOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::DestroyOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::DestroyOp destroy, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
// If expr was bufferized on the heap, now is time to deallocate the buffer.
@@ -706,7 +705,7 @@ struct NoReassocOpConversion
using mlir::OpConversionPattern<hlfir::NoReassocOp>::OpConversionPattern;
explicit NoReassocOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::NoReassocOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::NoReassocOp noreassoc, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = noreassoc->getLoc();
@@ -767,7 +766,7 @@ struct ElementalOpConversion
// by the nesting level of ElementalOp's.
setHasBoundedRewriteRecursion();
}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ElementalOp elemental, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = elemental->getLoc();
@@ -860,7 +859,7 @@ struct CharExtremumOpConversion
using mlir::OpConversionPattern<hlfir::CharExtremumOp>::OpConversionPattern;
explicit CharExtremumOpConversion(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<hlfir::CharExtremumOp>{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::CharExtremumOp char_extremum, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = char_extremum->getLoc();
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
index 74bbab0..9820595 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/ConvertToFIR.cpp
@@ -38,7 +38,7 @@ class AssignOpConversion : public mlir::OpRewritePattern<hlfir::AssignOp> {
public:
explicit AssignOpConversion(mlir::MLIRContext *ctx) : OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AssignOp assignOp,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = assignOp->getLoc();
@@ -231,7 +231,7 @@ public:
return {res[0], res[1]};
}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::CopyInOp copyInOp,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = copyInOp.getLoc();
@@ -249,7 +249,7 @@ public:
explicit CopyOutOpConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::CopyOutOp copyOutOp,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = copyOutOp.getLoc();
@@ -290,7 +290,7 @@ public:
explicit DeclareOpConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::DeclareOp declareOp,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = declareOp->getLoc();
@@ -428,7 +428,7 @@ public:
explicit DesignateOpConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::DesignateOp designate,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = designate.getLoc();
@@ -648,7 +648,7 @@ public:
explicit ParentComponentOpConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ParentComponentOp parentComponent,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = parentComponent.getLoc();
@@ -696,7 +696,7 @@ public:
explicit NoReassocOpConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::NoReassocOp noreassoc,
mlir::PatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<fir::NoReassocOp>(noreassoc,
@@ -709,7 +709,7 @@ class NullOpConversion : public mlir::OpRewritePattern<hlfir::NullOp> {
public:
explicit NullOpConversion(mlir::MLIRContext *ctx) : OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::NullOp nullop,
mlir::PatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<fir::ZeroOp>(nullop, nullop.getType());
@@ -722,7 +722,7 @@ class GetExtentOpConversion
public:
using mlir::OpRewritePattern<hlfir::GetExtentOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::GetExtentOp getExtentOp,
mlir::PatternRewriter &rewriter) const override {
mlir::Value shape = getExtentOp.getShape();
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp b/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp
index 4b0b859..769e14b1 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/InlineElementals.cpp
@@ -73,7 +73,7 @@ class InlineElementalConversion
public:
using mlir::OpRewritePattern<hlfir::ElementalOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ElementalOp elemental,
mlir::PatternRewriter &rewriter) const override {
std::optional<std::pair<hlfir::ApplyOp, hlfir::DestroyOp>> maybeTuple =
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
index 0347bec..bfb4148 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
@@ -22,7 +22,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include <optional>
@@ -235,7 +234,7 @@ protected:
};
public:
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(OP operation,
mlir::PatternRewriter &rewriter) const override {
std::string opName;
@@ -311,7 +310,7 @@ using AllOpConversion = HlfirReductionIntrinsicConversion<hlfir::AllOp>;
struct CountOpConversion : public HlfirIntrinsicConversion<hlfir::CountOp> {
using HlfirIntrinsicConversion<hlfir::CountOp>::HlfirIntrinsicConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::CountOp count,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, count.getOperation()};
@@ -345,7 +344,7 @@ struct CountOpConversion : public HlfirIntrinsicConversion<hlfir::CountOp> {
struct MatmulOpConversion : public HlfirIntrinsicConversion<hlfir::MatmulOp> {
using HlfirIntrinsicConversion<hlfir::MatmulOp>::HlfirIntrinsicConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::MatmulOp matmul,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, matmul.getOperation()};
@@ -376,7 +375,7 @@ struct DotProductOpConversion
: public HlfirIntrinsicConversion<hlfir::DotProductOp> {
using HlfirIntrinsicConversion<hlfir::DotProductOp>::HlfirIntrinsicConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::DotProductOp dotProduct,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, dotProduct.getOperation()};
@@ -407,7 +406,7 @@ class TransposeOpConversion
: public HlfirIntrinsicConversion<hlfir::TransposeOp> {
using HlfirIntrinsicConversion<hlfir::TransposeOp>::HlfirIntrinsicConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::TransposeOp transpose,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, transpose.getOperation()};
@@ -437,7 +436,7 @@ struct MatmulTransposeOpConversion
using HlfirIntrinsicConversion<
hlfir::MatmulTransposeOp>::HlfirIntrinsicConversion;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::MatmulTransposeOp multranspose,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, multranspose.getOperation()};
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
index a1a89bb..85dd517 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIROrderedAssignments.cpp
@@ -1309,7 +1309,7 @@ static void lower(hlfir::OrderedAssignmentTreeOpInterface root,
/// Shared rewrite entry point for all the ordered assignment tree root
/// operations. It calls the scheduler and then apply the schedule.
-static mlir::LogicalResult rewrite(hlfir::OrderedAssignmentTreeOpInterface root,
+static llvm::LogicalResult rewrite(hlfir::OrderedAssignmentTreeOpInterface root,
bool tryFusingAssignments,
mlir::PatternRewriter &rewriter) {
hlfir::Schedule schedule =
@@ -1337,7 +1337,7 @@ public:
explicit ForallOpConversion(mlir::MLIRContext *ctx, bool tryFusingAssignments)
: OpRewritePattern{ctx}, tryFusingAssignments{tryFusingAssignments} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ForallOp forallOp,
mlir::PatternRewriter &rewriter) const override {
auto root = mlir::cast<hlfir::OrderedAssignmentTreeOpInterface>(
@@ -1354,7 +1354,7 @@ public:
explicit WhereOpConversion(mlir::MLIRContext *ctx, bool tryFusingAssignments)
: OpRewritePattern{ctx}, tryFusingAssignments{tryFusingAssignments} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::WhereOp whereOp,
mlir::PatternRewriter &rewriter) const override {
auto root = mlir::cast<hlfir::OrderedAssignmentTreeOpInterface>(
@@ -1370,7 +1370,7 @@ public:
explicit RegionAssignConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::RegionAssignOp regionAssignOp,
mlir::PatternRewriter &rewriter) const override {
auto root = mlir::cast<hlfir::OrderedAssignmentTreeOpInterface>(
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
index 1dfa2f9..c5b8095 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/OptimizedBufferization.cpp
@@ -89,7 +89,7 @@ private:
public:
using mlir::OpRewritePattern<hlfir::ElementalOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::ElementalOp elemental,
mlir::PatternRewriter &rewriter) const override;
};
@@ -465,7 +465,7 @@ ElementalAssignBufferization::findMatch(hlfir::ElementalOp elemental) {
return match;
}
-mlir::LogicalResult ElementalAssignBufferization::matchAndRewrite(
+llvm::LogicalResult ElementalAssignBufferization::matchAndRewrite(
hlfir::ElementalOp elemental, mlir::PatternRewriter &rewriter) const {
std::optional<MatchInfo> match = findMatch(elemental);
if (!match)
@@ -519,12 +519,12 @@ private:
public:
using mlir::OpRewritePattern<hlfir::AssignOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AssignOp assign,
mlir::PatternRewriter &rewriter) const override;
};
-mlir::LogicalResult BroadcastAssignBufferization::matchAndRewrite(
+llvm::LogicalResult BroadcastAssignBufferization::matchAndRewrite(
hlfir::AssignOp assign, mlir::PatternRewriter &rewriter) const {
// Since RHS is a scalar and LHS is an array, LHS must be allocated
// in a conforming Fortran program, and LHS cannot be reallocated
@@ -587,12 +587,12 @@ private:
public:
using mlir::OpRewritePattern<hlfir::AssignOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::AssignOp assign,
mlir::PatternRewriter &rewriter) const override;
};
-mlir::LogicalResult VariableAssignBufferization::matchAndRewrite(
+llvm::LogicalResult VariableAssignBufferization::matchAndRewrite(
hlfir::AssignOp assign, mlir::PatternRewriter &rewriter) const {
if (assign.isAllocatableAssignment())
return rewriter.notifyMatchFailure(assign, "AssignOp may imply allocation");
@@ -716,7 +716,7 @@ class ReductionElementalConversion : public mlir::OpRewritePattern<Op> {
public:
using mlir::OpRewritePattern<Op>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(Op op, mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = op.getLoc();
hlfir::ElementalOp elemental =
@@ -817,7 +817,7 @@ class MinMaxlocElementalConversion : public mlir::OpRewritePattern<Op> {
public:
using mlir::OpRewritePattern<Op>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(Op mloc, mlir::PatternRewriter &rewriter) const override {
if (!mloc.getMask() || mloc.getDim() || mloc.getBack())
return rewriter.notifyMatchFailure(mloc,
diff --git a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
index 6153c82..60b06437 100644
--- a/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
+++ b/flang/lib/Optimizer/HLFIR/Transforms/SimplifyHLFIRIntrinsics.cpp
@@ -35,7 +35,7 @@ class TransposeAsElementalConversion
public:
using mlir::OpRewritePattern<hlfir::TransposeOp>::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(hlfir::TransposeOp transpose,
mlir::PatternRewriter &rewriter) const override {
mlir::Location loc = transpose.getLoc();
diff --git a/flang/lib/Optimizer/Support/CMakeLists.txt b/flang/lib/Optimizer/Support/CMakeLists.txt
index 55f5718..8794c24 100644
--- a/flang/lib/Optimizer/Support/CMakeLists.txt
+++ b/flang/lib/Optimizer/Support/CMakeLists.txt
@@ -5,6 +5,7 @@ add_flang_library(FIRSupport
DataLayout.cpp
InitFIR.cpp
InternalNames.cpp
+ Utils.cpp
DEPENDS
FIROpsIncGen
@@ -14,6 +15,7 @@ add_flang_library(FIRSupport
${extension_libs}
LINK_LIBS
+ FIRDialect
${dialect_libs}
${extension_libs}
MLIRBuiltinToLLVMIRTranslation
diff --git a/flang/lib/Optimizer/Support/InternalNames.cpp b/flang/lib/Optimizer/Support/InternalNames.cpp
index 65046ea..b2e2cd3 100644
--- a/flang/lib/Optimizer/Support/InternalNames.cpp
+++ b/flang/lib/Optimizer/Support/InternalNames.cpp
@@ -381,6 +381,15 @@ std::string fir::NameUniquer::getTypeDescriptorBindingTableName(
return getDerivedTypeObjectName(mangledTypeName, bindingTableSeparator);
}
+std::string
+fir::NameUniquer::getComponentInitName(llvm::StringRef mangledTypeName,
+ llvm::StringRef componentName) {
+
+ std::string prefix =
+ getDerivedTypeObjectName(mangledTypeName, componentInitSeparator);
+ return prefix + "." + componentName.str();
+}
+
llvm::StringRef
fir::NameUniquer::dropTypeConversionMarkers(llvm::StringRef mangledTypeName) {
if (mangledTypeName.ends_with(boxprocSuffix))
diff --git a/flang/lib/Optimizer/Support/Utils.cpp b/flang/lib/Optimizer/Support/Utils.cpp
new file mode 100644
index 0000000..5d663e2
--- /dev/null
+++ b/flang/lib/Optimizer/Support/Utils.cpp
@@ -0,0 +1,52 @@
+//===-- Utils.cpp ---------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
+//
+//===----------------------------------------------------------------------===//
+
+#include "flang/Optimizer/Support/Utils.h"
+#include "flang/Optimizer/Dialect/FIROps.h"
+#include "flang/Optimizer/Dialect/FIRType.h"
+#include "flang/Optimizer/Support/InternalNames.h"
+
+fir::TypeInfoOp fir::lookupTypeInfoOp(fir::RecordType recordType,
+ mlir::ModuleOp module,
+ const mlir::SymbolTable *symbolTable) {
+ // fir.type_info was created with the mangled name of the derived type.
+ // It is the same as the name in the related fir.type, except when a pass
+ // lowered the fir.type (e.g., when lowering fir.boxproc type if the type has
+ // pointer procedure components), in which case suffix may have been added to
+ // the fir.type name. Get rid of them when looking up for the fir.type_info.
+ llvm::StringRef originalMangledTypeName =
+ fir::NameUniquer::dropTypeConversionMarkers(recordType.getName());
+ return fir::lookupTypeInfoOp(originalMangledTypeName, module, symbolTable);
+}
+
+fir::TypeInfoOp fir::lookupTypeInfoOp(llvm::StringRef name,
+ mlir::ModuleOp module,
+ const mlir::SymbolTable *symbolTable) {
+ if (symbolTable)
+ if (auto typeInfo = symbolTable->lookup<fir::TypeInfoOp>(name))
+ return typeInfo;
+ return module.lookupSymbol<fir::TypeInfoOp>(name);
+}
+
+std::optional<llvm::ArrayRef<int64_t>> fir::getComponentLowerBoundsIfNonDefault(
+ fir::RecordType recordType, llvm::StringRef component,
+ mlir::ModuleOp module, const mlir::SymbolTable *symbolTable) {
+ fir::TypeInfoOp typeInfo =
+ fir::lookupTypeInfoOp(recordType, module, symbolTable);
+ if (!typeInfo || typeInfo.getComponentInfo().empty())
+ return std::nullopt;
+ for (auto componentInfo :
+ typeInfo.getComponentInfo().getOps<fir::DTComponentOp>())
+ if (componentInfo.getName() == component)
+ return componentInfo.getLowerBounds();
+ return std::nullopt;
+}
diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
index 85472cd..3906aa5 100644
--- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp
+++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
@@ -84,7 +84,7 @@ public:
CallConversion(mlir::MLIRContext *context, bool shouldBoxResult)
: OpRewritePattern<Op>(context, 1), shouldBoxResult{shouldBoxResult} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(Op op, mlir::PatternRewriter &rewriter) const override {
auto loc = op.getLoc();
auto result = op->getResult(0);
@@ -192,7 +192,7 @@ public:
using OpRewritePattern::OpRewritePattern;
SaveResultOpConversion(mlir::MLIRContext *context)
: OpRewritePattern(context) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SaveResultOp op,
mlir::PatternRewriter &rewriter) const override {
rewriter.eraseOp(op);
@@ -205,7 +205,7 @@ public:
using OpRewritePattern::OpRewritePattern;
ReturnOpConversion(mlir::MLIRContext *context, mlir::Value newArg)
: OpRewritePattern(context), newArg{newArg} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::func::ReturnOp ret,
mlir::PatternRewriter &rewriter) const override {
auto loc = ret.getLoc();
@@ -258,7 +258,7 @@ public:
using OpRewritePattern::OpRewritePattern;
AddrOfOpConversion(mlir::MLIRContext *context, bool shouldBoxResult)
: OpRewritePattern(context), shouldBoxResult{shouldBoxResult} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AddrOfOp addrOf,
mlir::PatternRewriter &rewriter) const override {
auto oldFuncTy = mlir::cast<mlir::FunctionType>(addrOf.getType());
@@ -432,4 +432,4 @@ public:
};
} // end anonymous namespace
-} // namespace fir \ No newline at end of file
+} // namespace fir
diff --git a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
index b4523a0..c416302d 100644
--- a/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffineDemotion.cpp
@@ -95,7 +95,7 @@ public:
class ConvertConversion : public mlir::OpRewritePattern<fir::ConvertOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ConvertOp op,
mlir::PatternRewriter &rewriter) const override {
if (mlir::isa<mlir::MemRefType>(op.getRes().getType())) {
@@ -133,7 +133,7 @@ mlir::Type convertMemRef(mlir::MemRefType type) {
class StdAllocConversion : public mlir::OpRewritePattern<memref::AllocOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(memref::AllocOp op,
mlir::PatternRewriter &rewriter) const override {
rewriter.replaceOpWithNewOp<fir::AllocaOp>(op, convertMemRef(op.getType()),
diff --git a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
index 7d0131a..43fccf5 100644
--- a/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
+++ b/flang/lib/Optimizer/Transforms/AffinePromotion.cpp
@@ -453,7 +453,7 @@ public:
AffineLoopConversion(mlir::MLIRContext *context, AffineFunctionAnalysis &afa)
: OpRewritePattern(context), functionAnalysis(afa) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DoLoopOp loop,
mlir::PatternRewriter &rewriter) const override {
LLVM_DEBUG(llvm::dbgs() << "AffineLoopConversion: rewriting loop:\n";
@@ -546,7 +546,7 @@ public:
using OpRewritePattern::OpRewritePattern;
AffineIfConversion(mlir::MLIRContext *context, AffineFunctionAnalysis &afa)
: OpRewritePattern(context) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::IfOp op,
mlir::PatternRewriter &rewriter) const override {
LLVM_DEBUG(llvm::dbgs() << "AffineIfConversion: rewriting if:\n";
diff --git a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
index ebc1862..8544d17 100644
--- a/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
+++ b/flang/lib/Optimizer/Transforms/ArrayValueCopy.cpp
@@ -796,7 +796,7 @@ class ArrayLoadConversion : public mlir::OpRewritePattern<ArrayLoadOp> {
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayLoadOp load,
mlir::PatternRewriter &rewriter) const override {
LLVM_DEBUG(llvm::dbgs() << "replace load " << load << " with undef.\n");
@@ -810,7 +810,7 @@ class ArrayMergeStoreConversion
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayMergeStoreOp store,
mlir::PatternRewriter &rewriter) const override {
LLVM_DEBUG(llvm::dbgs() << "marking store " << store << " as dead.\n");
@@ -1248,7 +1248,7 @@ public:
const OperationUseMapT &m)
: ArrayUpdateConversionBase{ctx, a, m} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayUpdateOp update,
mlir::PatternRewriter &rewriter) const override {
auto loc = update.getLoc();
@@ -1276,7 +1276,7 @@ public:
const OperationUseMapT &m)
: ArrayUpdateConversionBase{ctx, a, m} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayModifyOp modify,
mlir::PatternRewriter &rewriter) const override {
auto loc = modify.getLoc();
@@ -1298,7 +1298,7 @@ public:
const OperationUseMapT &m)
: OpRewritePattern{ctx}, useMap{m} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayFetchOp fetch,
mlir::PatternRewriter &rewriter) const override {
auto *op = fetch.getOperation();
@@ -1329,7 +1329,7 @@ public:
const OperationUseMapT &m)
: ArrayUpdateConversionBase{ctx, a, m} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayAccessOp access,
mlir::PatternRewriter &rewriter) const override {
auto *op = access.getOperation();
@@ -1362,7 +1362,7 @@ public:
explicit ArrayAmendConversion(mlir::MLIRContext *ctx)
: OpRewritePattern{ctx} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ArrayAmendOp amend,
mlir::PatternRewriter &rewriter) const override {
auto *op = amend.getOperation();
diff --git a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp
index 5dfc5009..2c9c73e 100644
--- a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp
@@ -63,7 +63,7 @@ public:
: mlir::OpRewritePattern<fir::ReboxAssumedRankOp>(context),
symbolTable{symbolTable}, kindMap{kindMap} {};
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::ReboxAssumedRankOp rebox,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, kindMap, symbolTable};
@@ -123,7 +123,7 @@ public:
: mlir::OpRewritePattern<fir::IsAssumedSizeOp>(context),
symbolTable{symbolTable}, kindMap{kindMap} {};
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::IsAssumedSizeOp isAssumedSizeOp,
mlir::PatternRewriter &rewriter) const override {
fir::FirOpBuilder builder{rewriter, kindMap, symbolTable};
diff --git a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
index 44baad7..aee7e8c 100644
--- a/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CharacterConversion.cpp
@@ -38,7 +38,7 @@ class CharacterConvertConversion
public:
using OpRewritePattern::OpRewritePattern;
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::CharConvertOp conv,
mlir::PatternRewriter &rewriter) const override {
auto kindMap = fir::getKindMapping(conv->getParentOfType<mlir::ModuleOp>());
diff --git a/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp b/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp
index f7074a7..7d0b8b3 100644
--- a/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp
+++ b/flang/lib/Optimizer/Transforms/ConstantArgumentGlobalisation.cpp
@@ -37,7 +37,7 @@ public:
CallOpRewriter(mlir::MLIRContext *ctx, const mlir::DominanceInfo &_di)
: OpRewritePattern(ctx), di(_di) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::CallOp callOp,
mlir::PatternRewriter &rewriter) const override {
LLVM_DEBUG(llvm::dbgs() << "Processing call op: " << callOp << "\n");
diff --git a/flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp b/flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp
index 1af5a68..3b79d6d 100644
--- a/flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp
+++ b/flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp
@@ -47,7 +47,7 @@ public:
: mlir::OpRewritePattern<fir::DoLoopOp>(ctx),
forceLoopToExecuteOnce(forceLoopToExecuteOnce), setNSW(setNSW) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(DoLoopOp loop,
mlir::PatternRewriter &rewriter) const override {
auto loc = loop.getLoc();
@@ -162,7 +162,7 @@ public:
CfgIfConv(mlir::MLIRContext *ctx, bool forceLoopToExecuteOnce, bool setNSW)
: mlir::OpRewritePattern<fir::IfOp>(ctx) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(IfOp ifOp, mlir::PatternRewriter &rewriter) const override {
auto loc = ifOp.getLoc();
@@ -228,7 +228,7 @@ public:
bool setNSW)
: mlir::OpRewritePattern<fir::IterWhileOp>(ctx), setNSW(setNSW) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::IterWhileOp whileOp,
mlir::PatternRewriter &rewriter) const override {
auto loc = whileOp.getLoc();
diff --git a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
index ada67b4..03b1ae8 100644
--- a/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
+++ b/flang/lib/Optimizer/Transforms/MemoryAllocation.cpp
@@ -100,7 +100,7 @@ public:
llvm::ArrayRef<mlir::Operation *> rets)
: OpRewritePattern(ctx), returnOps(rets) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AllocaOp alloca,
mlir::PatternRewriter &rewriter) const override {
auto loc = alloca.getLoc();
diff --git a/flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp b/flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp
index 76c12d2..57f19f2 100644
--- a/flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/PolymorphicOpConversion.cpp
@@ -50,7 +50,7 @@ public:
SelectTypeConv(mlir::MLIRContext *ctx)
: mlir::OpConversionPattern<fir::SelectTypeOp>(ctx) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::SelectTypeOp selectType, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override;
@@ -60,7 +60,7 @@ private:
mlir::Type ty, mlir::ModuleOp mod,
mlir::PatternRewriter &rewriter) const;
- mlir::LogicalResult genTypeLadderStep(mlir::Location loc,
+ llvm::LogicalResult genTypeLadderStep(mlir::Location loc,
mlir::Value selector,
mlir::Attribute attr, mlir::Block *dest,
std::optional<mlir::ValueRange> destOps,
@@ -81,7 +81,7 @@ struct DispatchOpConv : public OpConversionPattern<fir::DispatchOp> {
: mlir::OpConversionPattern<fir::DispatchOp>(ctx),
bindingTables(bindingTables) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::DispatchOp dispatch, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const override {
mlir::Location loc = dispatch.getLoc();
@@ -135,7 +135,7 @@ struct DispatchOpConv : public OpConversionPattern<fir::DispatchOp> {
// %18 = fir.field_index proc, !fir.type<_QM__fortran_type_infoTbinding>
// %19 = fir.coordinate_of %17, %18 : (!fir.ref<!fir.type<_QM__fortran_type_infoTbinding>>, !fir.field) -> !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_funptr>>
// %20 = fir.field_index __address, !fir.type<_QM__fortran_builtinsT__builtin_c_funptr>
- // %21 = fir.coordinate_of %19, %20 : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_funptr>>, !fir.field) -> !fir.ref<i64>
+ // %21 = fir.coordinate_of %19, %20 : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_funptr>>, !fir.field) -> !fir.ref<i64>
// %22 = fir.load %21 : !fir.ref<i64>
// %23 = fir.convert %22 : (i64) -> (() -> ())
// fir.call %23() : () -> ()
@@ -217,7 +217,7 @@ private:
class PolymorphicOpConversion
: public fir::impl::PolymorphicOpConversionBase<PolymorphicOpConversion> {
public:
- mlir::LogicalResult initialize(mlir::MLIRContext *ctx) override {
+ llvm::LogicalResult initialize(mlir::MLIRContext *ctx) override {
return mlir::success();
}
@@ -250,7 +250,7 @@ public:
};
} // namespace
-mlir::LogicalResult SelectTypeConv::matchAndRewrite(
+llvm::LogicalResult SelectTypeConv::matchAndRewrite(
fir::SelectTypeOp selectType, OpAdaptor adaptor,
mlir::ConversionPatternRewriter &rewriter) const {
auto operands = adaptor.getOperands();
@@ -341,7 +341,7 @@ mlir::LogicalResult SelectTypeConv::matchAndRewrite(
return mlir::success();
}
-mlir::LogicalResult SelectTypeConv::genTypeLadderStep(
+llvm::LogicalResult SelectTypeConv::genTypeLadderStep(
mlir::Location loc, mlir::Value selector, mlir::Attribute attr,
mlir::Block *dest, std::optional<mlir::ValueRange> destOps,
mlir::ModuleOp mod, mlir::PatternRewriter &rewriter,
diff --git a/flang/lib/Optimizer/Transforms/StackArrays.cpp b/flang/lib/Optimizer/Transforms/StackArrays.cpp
index 7157b55..e8fa70eb 100644
--- a/flang/lib/Optimizer/Transforms/StackArrays.cpp
+++ b/flang/lib/Optimizer/Transforms/StackArrays.cpp
@@ -25,7 +25,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/DenseMap.h"
@@ -180,7 +179,7 @@ public:
private:
llvm::DenseMap<mlir::Operation *, AllocMemMap> funcMaps;
- mlir::LogicalResult analyseFunction(mlir::Operation *func);
+ llvm::LogicalResult analyseFunction(mlir::Operation *func);
};
/// Converts a fir.allocmem to a fir.alloca
@@ -191,7 +190,7 @@ public:
const StackArraysAnalysisWrapper::AllocMemMap &candidateOps)
: OpRewritePattern(ctx), candidateOps{candidateOps} {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(fir::AllocMemOp allocmem,
mlir::PatternRewriter &rewriter) const override;
@@ -415,7 +414,7 @@ void AllocationAnalysis::processOperation(mlir::Operation *op) {
visitOperationImpl(op, *before, after);
}
-mlir::LogicalResult
+llvm::LogicalResult
StackArraysAnalysisWrapper::analyseFunction(mlir::Operation *func) {
assert(mlir::isa<mlir::func::FuncOp>(func));
size_t nAllocs = 0;
@@ -507,7 +506,7 @@ static mlir::Value convertAllocationType(mlir::PatternRewriter &rewriter,
return conv;
}
-mlir::LogicalResult
+llvm::LogicalResult
AllocMemConversion::matchAndRewrite(fir::AllocMemOp allocmem,
mlir::PatternRewriter &rewriter) const {
auto oldInsertionPt = rewriter.saveInsertionPoint();
diff --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 0bf63a0..16658d5 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -1708,26 +1708,46 @@ void OmpAttributeVisitor::ResolveSeqLoopIndexInParallelOrTaskConstruct(
// Use of DO CONCURRENT inside OpenMP construct is unspecified behavior
// till OpenMP-5.0 standard.
// In above both cases we skip the privatization of iteration variables.
+// [OpenMP 5.1] DO CONCURRENT indices are private
bool OmpAttributeVisitor::Pre(const parser::DoConstruct &x) {
- // TODO:[OpenMP 5.1] DO CONCURRENT indices are private
- if (x.IsDoNormal()) {
- if (!dirContext_.empty() && GetContext().withinConstruct) {
+ if (!dirContext_.empty() && GetContext().withinConstruct) {
+ llvm::SmallVector<const parser::Name *> ivs;
+ if (x.IsDoNormal()) {
const parser::Name *iv{GetLoopIndex(x)};
- if (iv && iv->symbol) {
- if (!iv->symbol->test(Symbol::Flag::OmpPreDetermined)) {
- ResolveSeqLoopIndexInParallelOrTaskConstruct(*iv);
- } else {
- // TODO: conflict checks with explicitly determined DSA
- }
- ordCollapseLevel--;
- if (ordCollapseLevel) {
- if (const auto *details{iv->symbol->detailsIf<HostAssocDetails>()}) {
- const Symbol *tpSymbol = &details->symbol();
- if (tpSymbol->test(Symbol::Flag::OmpThreadprivate)) {
- context_.Say(iv->source,
- "Loop iteration variable %s is not allowed in THREADPRIVATE."_err_en_US,
- iv->ToString());
- }
+ if (iv && iv->symbol)
+ ivs.push_back(iv);
+ } else if (x.IsDoConcurrent()) {
+ const Fortran::parser::LoopControl *loopControl = &*x.GetLoopControl();
+ const Fortran::parser::LoopControl::Concurrent &concurrent =
+ std::get<Fortran::parser::LoopControl::Concurrent>(loopControl->u);
+ const Fortran::parser::ConcurrentHeader &concurrentHeader =
+ std::get<Fortran::parser::ConcurrentHeader>(concurrent.t);
+ const std::list<Fortran::parser::ConcurrentControl> &controls =
+ std::get<std::list<Fortran::parser::ConcurrentControl>>(
+ concurrentHeader.t);
+ for (const auto &control : controls) {
+ const parser::Name *iv{&std::get<0>(control.t)};
+ if (iv && iv->symbol)
+ ivs.push_back(iv);
+ }
+ }
+ ordCollapseLevel--;
+ for (auto iv : ivs) {
+ if (!iv->symbol->test(Symbol::Flag::OmpPreDetermined)) {
+ ResolveSeqLoopIndexInParallelOrTaskConstruct(*iv);
+ } else {
+ // TODO: conflict checks with explicitly determined DSA
+ }
+ if (ordCollapseLevel) {
+ if (const auto *details{iv->symbol->detailsIf<HostAssocDetails>()}) {
+ const Symbol *tpSymbol = &details->symbol();
+ // TODO: DoConcurrent won't capture the following check because a new
+ // symbol is declared in ResolveIndexName(), which will not have the
+ // OmpThreadprivate flag.
+ if (tpSymbol->test(Symbol::Flag::OmpThreadprivate)) {
+ context_.Say(iv->source,
+ "Loop iteration variable %s is not allowed in THREADPRIVATE."_err_en_US,
+ iv->ToString());
}
}
}
diff --git a/flang/test/Fir/fir-ops.fir b/flang/test/Fir/fir-ops.fir
index ecc5c4ec..b8ae566 100644
--- a/flang/test/Fir/fir-ops.fir
+++ b/flang/test/Fir/fir-ops.fir
@@ -460,6 +460,13 @@ fir.type_info @dispatch_tbl : !fir.type<dispatch_tbl{i:i32}> dispatch_table {
// CHECK-LABEL: fir.type_info @test_type_info noinit nodestroy nofinal extends !fir.type<parent{i:i32}> : !fir.type<test_type_info{i:i32,j:f32}>
fir.type_info @test_type_info noinit nodestroy nofinal extends !fir.type<parent{i:i32}> : !fir.type<test_type_info{i:i32,j:f32}>
+// CHECK-LABEL: fir.type_info @cpinfo : !fir.type<cpinfo{comp_i:!fir.array<10x20xi32>}> component_info {
+// CHECK: fir.dt_component "component_info" lbs [2, 3]
+// CHECK: }
+fir.type_info @cpinfo : !fir.type<cpinfo{comp_i:!fir.array<10x20xi32>}> component_info {
+ fir.dt_component "component_info" lbs [2, 3]
+}
+
// CHECK-LABEL: func @compare_complex(
// CHECK-SAME: [[VAL_151:%.*]]: !fir.complex<16>, [[VAL_152:%.*]]: !fir.complex<16>) {
func.func @compare_complex(%a : !fir.complex<16>, %b : !fir.complex<16>) {
diff --git a/flang/test/Lower/HLFIR/procedure-pointer.f90 b/flang/test/Lower/HLFIR/procedure-pointer.f90
index ce20f19..69b215e 100644
--- a/flang/test/Lower/HLFIR/procedure-pointer.f90
+++ b/flang/test/Lower/HLFIR/procedure-pointer.f90
@@ -128,7 +128,7 @@ use m
! CHECK: fir.store %[[VAL_2]] to %[[VAL_0]] : !fir.ref<!fir.boxproc<(!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>>>
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare %[[VAL_0]] {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QFsub4Ep2"} : (!fir.ref<!fir.boxproc<(!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>>>) -> (!fir.ref<!fir.boxproc<(!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>>>, !fir.ref<!fir.boxproc<(!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>>>)
! CHECK: %[[VAL_4:.*]] = fir.address_of(@_QPchar_func) : (!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>
-! CHECK: %[[VAL_12:.*]] = arith.constant -1 : index
+! CHECK: %[[VAL_12:.*]] = arith.constant 0 : index
! CHECK: %[[VAL_5:.*]] = fir.emboxproc %[[VAL_4]] : ((!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>) -> !fir.boxproc<() -> ()>
! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_12]] : (index) -> i64
! CHECK: %[[VAL_7:.*]] = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
@@ -375,7 +375,7 @@ end subroutine
! CHECK-LABEL: fir.global internal @_QFsub1Ep7 : !fir.boxproc<(!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>> {
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QPchar_func) : (!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>
-! CHECK: %[[VAL_11:.*]] = arith.constant -1 : index
+! CHECK: %[[VAL_11:.*]] = arith.constant 0 : index
! CHECK: %[[VAL_1:.*]] = fir.emboxproc %[[VAL_0]] : ((!fir.ref<i32>) -> !fir.box<!fir.ptr<!fir.char<1,?>>>) -> !fir.boxproc<() -> ()>
! CHECK: %[[VAL_2:.*]] = fir.convert %[[VAL_11]] : (index) -> i64
! CHECK: %[[VAL_3:.*]] = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
diff --git a/flang/test/Lower/HLFIR/type-info-components.f90 b/flang/test/Lower/HLFIR/type-info-components.f90
new file mode 100644
index 0000000..ee36f9c
--- /dev/null
+++ b/flang/test/Lower/HLFIR/type-info-components.f90
@@ -0,0 +1,55 @@
+! Test generation of fir.dt_component
+! RUN: bbc -emit-hlfir %s -o - | FileCheck %s
+subroutine test_1(x)
+ integer, save, target :: my_target
+ procedure() :: my_proc
+ type :: sometype
+ integer :: i(-1:8) = 42
+ integer :: j(1:8)
+ integer, allocatable :: alloc(:)
+ integer, pointer :: p => my_target
+ integer, pointer :: p2 => NULL()
+ integer, pointer :: p3
+ procedure(), pointer, nopass :: proc_p => my_proc
+ procedure(), pointer, nopass :: proc_p2 => NULL()
+ procedure(), pointer, nopass :: proc_p3
+ end type
+ type(sometype) :: x
+end subroutine
+! CHECK-LABEL: fir.type_info @_QFtest_1Tsometype
+! CHECK-SAME component_info {
+! CHECK: fir.dt_component "i" lbs [-1] init @_QFtest_1E.di.sometype.i
+! CHECK-NOT: fir.dt_component "j"
+! CHECK: fir.dt_component "p" init @_QFtest_1E.di.sometype.p
+! CHECK: fir.dt_component "p2" init @_QFtest_1E.di.sometype.p2
+! CHECK: fir.dt_component "proc_p" init @_QPmy_proc
+! CHECK: }
+
+subroutine test_nesting(x)
+ type some_sub_type
+ integer :: i = 42
+ end type
+ type sometype2
+ type(some_sub_type) :: nested
+ end type
+ type(sometype2) :: x
+end subroutine
+! CHECK-LABEL: fir.type_info @_QFtest_nestingTsome_sub_type
+! CHECK-SAME component_info {
+! CHECK: fir.dt_component "i" init @_QFtest_nestingE.di.some_sub_type.i
+! CHECK: }
+
+! CHECK: fir.type_info @_QFtest_nestingTsometype2
+! CHECK-NOT: fir.dt_component
+
+
+subroutine data_like(x)
+ type sometype3
+ integer :: i/42/
+ end type
+ type(sometype3) :: x
+end subroutine
+! CHECK-LABEL: fir.type_info @_QFdata_likeTsometype3
+! CHECK-SAME component_info {
+! CHECK: fir.dt_component "i" init @_QFdata_likeE.di.sometype3.i
+! CHECK: }
diff --git a/flang/test/Lower/dummy-procedure-character.f90 b/flang/test/Lower/dummy-procedure-character.f90
index 72d5485..9a2710f 100644
--- a/flang/test/Lower/dummy-procedure-character.f90
+++ b/flang/test/Lower/dummy-procedure-character.f90
@@ -82,7 +82,7 @@ subroutine cannot_compute_len_yet()
end function
end interface
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QPbar4) : (!fir.ref<!fir.char<1,?>>, index, !fir.ref<i32>) -> !fir.boxchar<1>
-! CHECK: %[[VAL_1:.*]] = arith.constant -1 : index
+! CHECK: %[[VAL_1:.*]] = arith.constant 0 : index
! CHECK: %[[VAL_2:.*]] = fir.emboxproc %[[VAL_0]] : ((!fir.ref<!fir.char<1,?>>, index, !fir.ref<i32>) -> !fir.boxchar<1>) -> !fir.boxproc<() -> ()>
! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_1]] : (index) -> i64
! CHECK: %[[VAL_4:.*]] = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
@@ -97,7 +97,7 @@ subroutine cannot_compute_len_yet_2()
character(*) :: bar5
external :: bar5
! CHECK: %[[VAL_0:.*]] = fir.address_of(@_QPbar5) : (!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>
-! CHECK: %[[VAL_1:.*]] = arith.constant -1 : index
+! CHECK: %[[VAL_1:.*]] = arith.constant 0 : index
! CHECK: %[[VAL_2:.*]] = fir.emboxproc %[[VAL_0]] : ((!fir.ref<!fir.char<1,?>>, index) -> !fir.boxchar<1>) -> !fir.boxproc<() -> ()>
! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_1]] : (index) -> i64
! CHECK: %[[VAL_4:.*]] = fir.undefined tuple<!fir.boxproc<() -> ()>, i64>
diff --git a/flang/test/Semantics/OpenMP/doconcurrent01.f90 b/flang/test/Semantics/OpenMP/doconcurrent01.f90
new file mode 100644
index 0000000..7e3bdce8
--- /dev/null
+++ b/flang/test/Semantics/OpenMP/doconcurrent01.f90
@@ -0,0 +1,17 @@
+! RUN: %python %S/../test_symbols.py %s %flang_fc1 -fopenmp
+
+! OpenMP 5.1.1
+! DO Concurrent indices are private
+
+!DEF: /private_iv (Subroutine)Subprogram
+subroutine private_iv
+ !DEF: /private_iv/i ObjectEntity INTEGER(4)
+ integer i
+ !$omp parallel default(private)
+ !$omp single
+ !DEF: /private_iv/OtherConstruct1/i (OmpPrivate, OmpPreDetermined) HostAssoc INTEGER(4)
+ do concurrent(i=1:2)
+ end do
+ !$omp end single
+ !$omp end parallel
+end subroutine
diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp
index 3485c14..e5e41ad 100644
--- a/flang/tools/bbc/bbc.cpp
+++ b/flang/tools/bbc/bbc.cpp
@@ -269,7 +269,7 @@ createTargetMachine(llvm::StringRef targetTriple, std::string &error) {
/// of the pass manager, allowing it to be invoked as soon as it's
/// required without impacting the main pass pipeline that may be invoked
/// more than once for verification.
-static mlir::LogicalResult runOpenMPPasses(mlir::ModuleOp mlirModule) {
+static llvm::LogicalResult runOpenMPPasses(mlir::ModuleOp mlirModule) {
mlir::PassManager pm(mlirModule->getName(),
mlir::OpPassManager::Nesting::Implicit);
fir::createOpenMPFIRPassPipeline(pm, enableOpenMPDevice);
@@ -285,7 +285,7 @@ static mlir::LogicalResult runOpenMPPasses(mlir::ModuleOp mlirModule) {
// Translate Fortran input to FIR, a dialect of MLIR.
//===----------------------------------------------------------------------===//
-static mlir::LogicalResult convertFortranSourceToMLIR(
+static llvm::LogicalResult convertFortranSourceToMLIR(
std::string path, Fortran::parser::Options options,
const ProgramName &programPrefix,
Fortran::semantics::SemanticsContext &semanticsContext,
diff --git a/flang/tools/tco/tco.cpp b/flang/tools/tco/tco.cpp
index 399ea13..34ac0e1 100644
--- a/flang/tools/tco/tco.cpp
+++ b/flang/tools/tco/tco.cpp
@@ -74,7 +74,7 @@ static void printModule(mlir::ModuleOp mod, raw_ostream &output) {
}
// compile a .fir file
-static mlir::LogicalResult
+static llvm::LogicalResult
compileFIR(const mlir::PassPipelineCLParser &passPipeline) {
// check that there is a file to load
ErrorOr<std::unique_ptr<MemoryBuffer>> fileOrErr =
diff --git a/libc/config/linux/aarch64/entrypoints.txt b/libc/config/linux/aarch64/entrypoints.txt
index 07fdbfd..ff35e8f 100644
--- a/libc/config/linux/aarch64/entrypoints.txt
+++ b/libc/config/linux/aarch64/entrypoints.txt
@@ -508,11 +508,13 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.canonicalizef16
libc.src.math.ceilf16
libc.src.math.copysignf16
+ libc.src.math.f16addf
libc.src.math.f16div
libc.src.math.f16divf
libc.src.math.f16fmaf
libc.src.math.f16sqrt
libc.src.math.f16sqrtf
+ libc.src.math.f16subf
libc.src.math.fabsf16
libc.src.math.fdimf16
libc.src.math.floorf16
diff --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 89f9011..3eefa12 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -538,6 +538,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.canonicalizef16
libc.src.math.ceilf16
libc.src.math.copysignf16
+ libc.src.math.f16addf
libc.src.math.f16div
libc.src.math.f16divf
libc.src.math.f16divl
@@ -547,6 +548,7 @@ if(LIBC_TYPES_HAS_FLOAT16)
libc.src.math.f16sqrt
libc.src.math.f16sqrtf
libc.src.math.f16sqrtl
+ libc.src.math.f16subf
libc.src.math.fabsf16
libc.src.math.fdimf16
libc.src.math.floorf16
diff --git a/libc/docs/math/index.rst b/libc/docs/math/index.rst
index ccafb1f..e4da3d4 100644
--- a/libc/docs/math/index.rst
+++ b/libc/docs/math/index.rst
@@ -124,10 +124,14 @@ Basic Operations
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| dsub | N/A | N/A | | N/A | | 7.12.14.2 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
+| f16add | |check|\* | | | N/A | | 7.12.14.1 | F.10.11 |
++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| f16div | |check|\* | |check|\* | |check|\* | N/A | |check| | 7.12.14.4 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| f16fma | |check| | |check| | |check| | N/A | |check| | 7.12.14.5 | F.10.11 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
+| f16sub | |check|\* | | | N/A | | 7.12.14.2 | F.10.11 |
++------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| fabs | |check| | |check| | |check| | |check| | |check| | 7.12.7.3 | F.10.4.3 |
+------------------+------------------+-----------------+------------------------+----------------------+------------------------+------------------------+----------------------------+
| fadd | N/A | | | N/A | | 7.12.14.1 | F.10.11 |
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 7159dd9..9b52c9c 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -10,7 +10,6 @@
import yaml
-import re
import argparse
from pathlib import Path
@@ -54,10 +53,10 @@ def yaml_to_classes(yaml_data):
standards = (function_data.get("standards", None),)
header.add_function(
Function(
- standards,
function_data["return_type"],
function_data["name"],
arguments,
+ standards,
guard,
attributes,
)
@@ -103,7 +102,79 @@ def fill_public_api(header_str, h_def_content):
return h_def_content.replace("%%public_api()", header_str, 1)
-def main(yaml_file, h_def_file, output_dir):
+def parse_function_details(details):
+ """
+ Parse function details from a list of strings and return a Function object.
+
+ Args:
+ details: A list containing function details
+
+ Returns:
+ Function: An instance of Function initialized with the details.
+ """
+ return_type, name, arguments, standards, guard, attributes = details
+ standards = standards.split(",") if standards != "null" else []
+ arguments = [arg.strip() for arg in arguments.split(",")]
+ attributes = attributes.split(",") if attributes != "null" else []
+
+ return Function(
+ return_type=return_type,
+ name=name,
+ arguments=arguments,
+ standards=standards,
+ guard=guard if guard != "null" else None,
+ attributes=attributes if attributes else [],
+ )
+
+
+def add_function_to_yaml(yaml_file, function_details):
+ """
+ Add a function to the YAML file.
+
+ Args:
+ yaml_file: The path to the YAML file.
+ function_details: A list containing function details (return_type, name, arguments, standards, guard, attributes).
+ """
+ new_function = parse_function_details(function_details)
+
+ with open(yaml_file, "r") as f:
+ yaml_data = yaml.safe_load(f)
+
+ if "functions" not in yaml_data:
+ yaml_data["functions"] = []
+
+ function_dict = {
+ "name": new_function.name,
+ "standards": new_function.standards,
+ "return_type": new_function.return_type,
+ "arguments": [{"type": arg} for arg in new_function.arguments],
+ }
+
+ if new_function.guard:
+ function_dict["guard"] = new_function.guard
+
+ if new_function.attributes:
+ function_dict["attributes"] = new_function.attributes
+
+ yaml_data["functions"].append(function_dict)
+
+ class IndentYamlListDumper(yaml.Dumper):
+ def increase_indent(self, flow=False, indentless=False):
+ return super(IndentYamlListDumper, self).increase_indent(flow, False)
+
+ with open(yaml_file, "w") as f:
+ yaml.dump(
+ yaml_data,
+ f,
+ Dumper=IndentYamlListDumper,
+ default_flow_style=False,
+ sort_keys=False,
+ )
+
+ print(f"Added function {new_function.name} to {yaml_file}")
+
+
+def main(yaml_file, h_def_file, output_dir, add_function=None):
"""
Main function to generate header files from YAML and .h.def templates.
@@ -111,8 +182,12 @@ def main(yaml_file, h_def_file, output_dir):
yaml_file: Path to the YAML file containing header specification.
h_def_file: Path to the .h.def template file.
output_dir: Directory to output the generated header file.
+ add_function: Details of the function to be added to the YAML file (if any).
"""
+ if add_function:
+ add_function_to_yaml(yaml_file, add_function)
+
header = load_yaml_file(yaml_file)
with open(h_def_file, "r") as f:
@@ -143,6 +218,19 @@ if __name__ == "__main__":
default=".",
help="Directory to output the generated header file",
)
+ parser.add_argument(
+ "--add_function",
+ nargs=6,
+ metavar=(
+ "RETURN_TYPE",
+ "NAME",
+ "ARGUMENTS",
+ "STANDARDS",
+ "GUARD",
+ "ATTRIBUTES",
+ ),
+ help="Add a function to the YAML file",
+ )
args = parser.parse_args()
- main(args.yaml_file, args.h_def_file, args.output_dir)
+ main(args.yaml_file, args.h_def_file, args.output_dir, args.add_function)
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
index 74a90a4..ff7831f 100644
--- a/libc/spec/llvm_libc_ext.td
+++ b/libc/spec/llvm_libc_ext.td
@@ -57,6 +57,10 @@ def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
[], // Types
[], // Enumerations
[
+ GuardedFunctionSpec<"f16addf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
+
+ GuardedFunctionSpec<"f16subf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
+
GuardedFunctionSpec<"f16div", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
GuardedFunctionSpec<"f16divf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
GuardedFunctionSpec<"f16divl", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
diff --git a/libc/src/__support/FPUtil/generic/CMakeLists.txt b/libc/src/__support/FPUtil/generic/CMakeLists.txt
index fb49fd0..c73f687 100644
--- a/libc/src/__support/FPUtil/generic/CMakeLists.txt
+++ b/libc/src/__support/FPUtil/generic/CMakeLists.txt
@@ -50,6 +50,25 @@ add_header_library(
)
add_header_library(
+ add_sub
+ HDRS
+ add_sub.h
+ DEPENDS
+ libc.hdr.errno_macros
+ libc.hdr.fenv_macros
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.CPP.bit
+ libc.src.__support.CPP.type_traits
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.__support.FPUtil.fenv_impl
+ libc.src.__support.FPUtil.fp_bits
+ libc.src.__support.FPUtil.dyadic_float
+ libc.src.__support.FPUtil.rounding_mode
+ libc.src.__support.macros.attributes
+ libc.src.__support.macros.optimization
+)
+
+add_header_library(
div
HDRS
div.h
diff --git a/libc/src/__support/FPUtil/generic/add_sub.h b/libc/src/__support/FPUtil/generic/add_sub.h
new file mode 100644
index 0000000..a522dea
--- /dev/null
+++ b/libc/src/__support/FPUtil/generic/add_sub.h
@@ -0,0 +1,206 @@
+//===-- Add and subtract IEEE 754 floating-point numbers --------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_ADD_SUB_H
+#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_ADD_SUB_H
+
+#include "hdr/errno_macros.h"
+#include "hdr/fenv_macros.h"
+#include "src/__support/CPP/algorithm.h"
+#include "src/__support/CPP/bit.h"
+#include "src/__support/CPP/type_traits.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "src/__support/FPUtil/FEnvImpl.h"
+#include "src/__support/FPUtil/FPBits.h"
+#include "src/__support/FPUtil/dyadic_float.h"
+#include "src/__support/FPUtil/rounding_mode.h"
+#include "src/__support/macros/attributes.h"
+#include "src/__support/macros/optimization.h"
+
+namespace LIBC_NAMESPACE::fputil::generic {
+
+template <bool IsSub, typename OutType, typename InType>
+LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<OutType> &&
+ cpp::is_floating_point_v<InType> &&
+ sizeof(OutType) <= sizeof(InType),
+ OutType>
+add_or_sub(InType x, InType y) {
+ using OutFPBits = FPBits<OutType>;
+ using OutStorageType = typename OutFPBits::StorageType;
+ using InFPBits = FPBits<InType>;
+ using InStorageType = typename InFPBits::StorageType;
+
+ constexpr int GUARD_BITS_LEN = 3;
+ constexpr int RESULT_FRACTION_LEN = InFPBits::FRACTION_LEN + GUARD_BITS_LEN;
+ constexpr int RESULT_MANTISSA_LEN = RESULT_FRACTION_LEN + 1;
+
+ using DyadicFloat =
+ DyadicFloat<cpp::bit_ceil(static_cast<size_t>(RESULT_MANTISSA_LEN))>;
+
+ InFPBits x_bits(x);
+ InFPBits y_bits(y);
+
+ bool is_effectively_add = (x_bits.sign() == y_bits.sign()) != IsSub;
+
+ if (LIBC_UNLIKELY(x_bits.is_inf_or_nan() || y_bits.is_inf_or_nan() ||
+ x_bits.is_zero() || y_bits.is_zero())) {
+ if (x_bits.is_nan() || y_bits.is_nan()) {
+ if (x_bits.is_signaling_nan() || y_bits.is_signaling_nan())
+ raise_except_if_required(FE_INVALID);
+
+ if (x_bits.is_quiet_nan()) {
+ InStorageType x_payload = static_cast<InStorageType>(getpayload(x));
+ if ((x_payload & ~(OutFPBits::FRACTION_MASK >> 1)) == 0)
+ return OutFPBits::quiet_nan(x_bits.sign(),
+ static_cast<OutStorageType>(x_payload))
+ .get_val();
+ }
+
+ if (y_bits.is_quiet_nan()) {
+ InStorageType y_payload = static_cast<InStorageType>(getpayload(y));
+ if ((y_payload & ~(OutFPBits::FRACTION_MASK >> 1)) == 0)
+ return OutFPBits::quiet_nan(y_bits.sign(),
+ static_cast<OutStorageType>(y_payload))
+ .get_val();
+ }
+
+ return OutFPBits::quiet_nan().get_val();
+ }
+
+ if (x_bits.is_inf()) {
+ if (y_bits.is_inf()) {
+ if (!is_effectively_add) {
+ raise_except_if_required(FE_INVALID);
+ return OutFPBits::quiet_nan().get_val();
+ }
+
+ return OutFPBits::inf(x_bits.sign()).get_val();
+ }
+
+ return OutFPBits::inf(x_bits.sign()).get_val();
+ }
+
+ if (y_bits.is_inf())
+ return OutFPBits::inf(y_bits.sign()).get_val();
+
+ if (x_bits.is_zero()) {
+ if (y_bits.is_zero()) {
+ switch (quick_get_round()) {
+ case FE_DOWNWARD:
+ return OutFPBits::zero(Sign::NEG).get_val();
+ default:
+ return OutFPBits::zero(Sign::POS).get_val();
+ }
+ }
+
+ // volatile prevents Clang from converting tmp to OutType and then
+ // immediately back to InType before negating it, resulting in double
+ // rounding.
+ volatile InType tmp = y;
+ if constexpr (IsSub)
+ tmp = -tmp;
+ return static_cast<OutType>(tmp);
+ }
+
+ if (y_bits.is_zero()) {
+ volatile InType tmp = y;
+ if constexpr (IsSub)
+ tmp = -tmp;
+ return static_cast<OutType>(tmp);
+ }
+ }
+
+ InType x_abs = x_bits.abs().get_val();
+ InType y_abs = y_bits.abs().get_val();
+
+ if (x_abs == y_abs && !is_effectively_add) {
+ switch (quick_get_round()) {
+ case FE_DOWNWARD:
+ return OutFPBits::zero(Sign::NEG).get_val();
+ default:
+ return OutFPBits::zero(Sign::POS).get_val();
+ }
+ }
+
+ Sign result_sign = Sign::POS;
+
+ if (x_abs > y_abs) {
+ result_sign = x_bits.sign();
+ } else if (x_abs < y_abs) {
+ if (is_effectively_add)
+ result_sign = y_bits.sign();
+ else if (y_bits.is_pos())
+ result_sign = Sign::NEG;
+ } else if (is_effectively_add) {
+ result_sign = x_bits.sign();
+ }
+
+ InFPBits max_bits(cpp::max(x_abs, y_abs));
+ InFPBits min_bits(cpp::min(x_abs, y_abs));
+
+ InStorageType result_mant;
+
+ if (max_bits.is_subnormal()) {
+ // min_bits must be subnormal too.
+
+ if (is_effectively_add)
+ result_mant = max_bits.get_mantissa() + min_bits.get_mantissa();
+ else
+ result_mant = max_bits.get_mantissa() - min_bits.get_mantissa();
+
+ result_mant <<= GUARD_BITS_LEN;
+ } else {
+ InStorageType max_mant = max_bits.get_explicit_mantissa() << GUARD_BITS_LEN;
+ InStorageType min_mant = min_bits.get_explicit_mantissa() << GUARD_BITS_LEN;
+ int alignment =
+ max_bits.get_biased_exponent() - min_bits.get_biased_exponent();
+
+ InStorageType aligned_min_mant =
+ min_mant >> cpp::min(alignment, RESULT_MANTISSA_LEN);
+ bool aligned_min_mant_sticky;
+
+ if (alignment <= 3)
+ aligned_min_mant_sticky = false;
+ else if (alignment <= InFPBits::FRACTION_LEN + 3)
+ aligned_min_mant_sticky =
+ (min_mant << (InFPBits::STORAGE_LEN - alignment)) != 0;
+ else
+ aligned_min_mant_sticky = true;
+
+ if (is_effectively_add)
+ result_mant = max_mant + (aligned_min_mant | aligned_min_mant_sticky);
+ else
+ result_mant = max_mant - (aligned_min_mant | aligned_min_mant_sticky);
+ }
+
+ int result_exp = max_bits.get_exponent() - RESULT_FRACTION_LEN;
+ DyadicFloat result(result_sign, result_exp, result_mant);
+ return result.template as<OutType, /*ShouldSignalExceptions=*/true>();
+}
+
+template <typename OutType, typename InType>
+LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<OutType> &&
+ cpp::is_floating_point_v<InType> &&
+ sizeof(OutType) <= sizeof(InType),
+ OutType>
+add(InType x, InType y) {
+ return add_or_sub</*IsSub=*/false, OutType>(x, y);
+}
+
+template <typename OutType, typename InType>
+LIBC_INLINE cpp::enable_if_t<cpp::is_floating_point_v<OutType> &&
+ cpp::is_floating_point_v<InType> &&
+ sizeof(OutType) <= sizeof(InType),
+ OutType>
+sub(InType x, InType y) {
+ return add_or_sub</*IsSub=*/true, OutType>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE::fputil::generic
+
+#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_GENERIC_ADD_SUB_H
diff --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 607051a..5b20913 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -99,6 +99,8 @@ add_math_entrypoint_object(exp10f)
add_math_entrypoint_object(expm1)
add_math_entrypoint_object(expm1f)
+add_math_entrypoint_object(f16addf)
+
add_math_entrypoint_object(f16div)
add_math_entrypoint_object(f16divf)
add_math_entrypoint_object(f16divl)
@@ -114,6 +116,8 @@ add_math_entrypoint_object(f16sqrtf)
add_math_entrypoint_object(f16sqrtl)
add_math_entrypoint_object(f16sqrtf128)
+add_math_entrypoint_object(f16subf)
+
add_math_entrypoint_object(fabs)
add_math_entrypoint_object(fabsf)
add_math_entrypoint_object(fabsl)
diff --git a/libc/src/math/f16addf.h b/libc/src/math/f16addf.h
new file mode 100644
index 0000000..31d0e78
--- /dev/null
+++ b/libc/src/math/f16addf.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for f16addf -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_F16ADDF_H
+#define LLVM_LIBC_SRC_MATH_F16ADDF_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float16 f16addf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_F16ADDF_H
diff --git a/libc/src/math/f16subf.h b/libc/src/math/f16subf.h
new file mode 100644
index 0000000..1d04a4c
--- /dev/null
+++ b/libc/src/math/f16subf.h
@@ -0,0 +1,20 @@
+//===-- Implementation header for f16subf -----------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_F16SUBF_H
+#define LLVM_LIBC_SRC_MATH_F16SUBF_H
+
+#include "src/__support/macros/properties/types.h"
+
+namespace LIBC_NAMESPACE {
+
+float16 f16subf(float x, float y);
+
+} // namespace LIBC_NAMESPACE
+
+#endif // LLVM_LIBC_SRC_MATH_F16SUBF_H
diff --git a/libc/src/math/generic/CMakeLists.txt b/libc/src/math/generic/CMakeLists.txt
index 395d4f8..d6ea8c5 100644
--- a/libc/src/math/generic/CMakeLists.txt
+++ b/libc/src/math/generic/CMakeLists.txt
@@ -3796,6 +3796,32 @@ add_entrypoint_object(
)
add_entrypoint_object(
+ f16addf
+ SRCS
+ f16addf.cpp
+ HDRS
+ ../f16addf.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.add_sub
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
+ f16subf
+ SRCS
+ f16subf.cpp
+ HDRS
+ ../f16subf.h
+ DEPENDS
+ libc.src.__support.macros.properties.types
+ libc.src.__support.FPUtil.generic.add_sub
+ COMPILE_OPTIONS
+ -O3
+)
+
+add_entrypoint_object(
f16div
SRCS
f16div.cpp
diff --git a/libc/src/math/generic/f16addf.cpp b/libc/src/math/generic/f16addf.cpp
new file mode 100644
index 0000000..f1761a1
--- /dev/null
+++ b/libc/src/math/generic/f16addf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of f16addf function --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/f16addf.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float16, f16addf, (float x, float y)) {
+ return fputil::generic::add<float16>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/src/math/generic/f16subf.cpp b/libc/src/math/generic/f16subf.cpp
new file mode 100644
index 0000000..e4532a4
--- /dev/null
+++ b/libc/src/math/generic/f16subf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of f16subf function --------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/f16subf.h"
+#include "src/__support/FPUtil/generic/add_sub.h"
+#include "src/__support/common.h"
+
+namespace LIBC_NAMESPACE {
+
+LLVM_LIBC_FUNCTION(float16, f16subf, (float x, float y)) {
+ return fputil::generic::sub<float16>(x, y);
+}
+
+} // namespace LIBC_NAMESPACE
diff --git a/libc/test/src/math/AddTest.h b/libc/test/src/math/AddTest.h
new file mode 100644
index 0000000..df0ef66
--- /dev/null
+++ b/libc/test/src/math/AddTest.h
@@ -0,0 +1,74 @@
+//===-- Utility class to test different flavors of float add ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_ADDTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_ADDTEST_H
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+template <typename OutType, typename InType>
+class AddTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ struct InConstants {
+ DECLARE_SPECIAL_CONSTANTS(InType)
+ };
+
+ using InFPBits = typename InConstants::FPBits;
+ using InStorageType = typename InConstants::StorageType;
+
+ static constexpr InStorageType IN_MAX_NORMAL_U =
+ InFPBits::max_normal().uintval();
+ static constexpr InStorageType IN_MIN_NORMAL_U =
+ InFPBits::min_normal().uintval();
+ static constexpr InStorageType IN_MAX_SUBNORMAL_U =
+ InFPBits::max_subnormal().uintval();
+ static constexpr InStorageType IN_MIN_SUBNORMAL_U =
+ InFPBits::min_subnormal().uintval();
+
+public:
+ typedef OutType (*AddFunc)(InType, InType);
+
+ void test_subnormal_range(AddFunc func) {
+ constexpr InStorageType COUNT = 100'001;
+ constexpr InStorageType STEP =
+ (IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
+ for (InStorageType i = 0, v = 0, w = IN_MAX_SUBNORMAL_U; i <= COUNT;
+ ++i, v += STEP, w -= STEP) {
+ InType x = InFPBits(v).get_val();
+ InType y = InFPBits(w).get_val();
+ mpfr::BinaryInput<InType> input{x, y};
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Add, input, func(x, y),
+ 0.5);
+ }
+ }
+
+ void test_normal_range(AddFunc func) {
+ constexpr InStorageType COUNT = 100'001;
+ constexpr InStorageType STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
+ for (InStorageType i = 0, v = 0, w = IN_MAX_NORMAL_U; i <= COUNT;
+ ++i, v += STEP, w -= STEP) {
+ InType x = InFPBits(v).get_val();
+ InType y = InFPBits(w).get_val();
+ mpfr::BinaryInput<InType> input{x, y};
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Add, input, func(x, y),
+ 0.5);
+ }
+ }
+};
+
+#define LIST_ADD_TESTS(OutType, InType, func) \
+ using LlvmLibcAddTest = AddTest<OutType, InType>; \
+ TEST_F(LlvmLibcAddTest, SubnormalRange) { test_subnormal_range(&func); } \
+ TEST_F(LlvmLibcAddTest, NormalRange) { test_normal_range(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_ADDTEST_H
diff --git a/libc/test/src/math/CMakeLists.txt b/libc/test/src/math/CMakeLists.txt
index c07c6d7..637e672 100644
--- a/libc/test/src/math/CMakeLists.txt
+++ b/libc/test/src/math/CMakeLists.txt
@@ -1824,6 +1824,18 @@ add_fp_unittest(
)
add_fp_unittest(
+ fmul_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ fmul_test.cpp
+ HDRS
+ FMulTest.h
+ DEPENDS
+ libc.src.math.fmul
+)
+add_fp_unittest(
asinhf_test
NEED_MPFR
SUITE
@@ -1985,6 +1997,32 @@ add_fp_unittest(
)
add_fp_unittest(
+ f16addf_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ f16addf_test.cpp
+ HDRS
+ AddTest.h
+ DEPENDS
+ libc.src.math.f16addf
+)
+
+add_fp_unittest(
+ f16subf_test
+ NEED_MPFR
+ SUITE
+ libc-math-unittests
+ SRCS
+ f16subf_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.src.math.f16subf
+)
+
+add_fp_unittest(
f16div_test
NEED_MPFR
SUITE
diff --git a/libc/test/src/math/FMulTest.h b/libc/test/src/math/FMulTest.h
new file mode 100644
index 0000000..8ca33ea
--- /dev/null
+++ b/libc/test/src/math/FMulTest.h
@@ -0,0 +1,121 @@
+//===-- Utility class to test fmul[f|l] -------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_FMULTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_FMULTEST_H
+
+#include "src/__support/FPUtil/FPBits.h"
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+template <typename OutType, typename InType>
+class FmulMPFRTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ DECLARE_SPECIAL_CONSTANTS(InType)
+
+public:
+ typedef OutType (*FMulFunc)(InType, InType);
+
+ void testFMulMPFR(FMulFunc func) {
+ constexpr int N = 10;
+ mpfr::BinaryInput<InType> INPUTS[N] = {
+ {3.0, 5.0},
+ {0x1.0p1, 0x1.0p-131},
+ {0x1.0p2, 0x1.0p-129},
+ {1.0, 1.0},
+ {-0.0, -0.0},
+ {-0.0, 0.0},
+ {0.0, -0.0},
+ {0x1.0p100, 0x1.0p100},
+ {1.0, 1.0 + 0x1.0p-128 + 0x1.0p-149 + 0x1.0p-150},
+ {1.0, 0x1.0p-128 + 0x1.0p-149 + 0x1.0p-150}};
+
+ for (int i = 0; i < N; ++i) {
+ InType x = INPUTS[i].x;
+ InType y = INPUTS[i].y;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fmul, INPUTS[i],
+ func(x, y), 0.5);
+ }
+ }
+
+ void testSpecialInputsMPFR(FMulFunc func) {
+ constexpr int N = 27;
+ mpfr::BinaryInput<InType> INPUTS[N] = {{inf, 0x1.0p-129},
+ {0x1.0p-129, inf},
+ {inf, 2.0},
+ {3.0, inf},
+ {0.0, 0.0},
+ {neg_inf, aNaN},
+ {aNaN, neg_inf},
+ {neg_inf, neg_inf},
+ {0.0, neg_inf},
+ {neg_inf, 0.0},
+ {neg_inf, 1.0},
+ {1.0, neg_inf},
+ {neg_inf, 0x1.0p-129},
+ {0x1.0p-129, neg_inf},
+ {0.0, 0x1.0p-129},
+ {inf, 0.0},
+ {0.0, inf},
+ {0.0, aNaN},
+ {2.0, aNaN},
+ {0x1.0p-129, aNaN},
+ {inf, aNaN},
+ {aNaN, aNaN},
+ {0.0, sNaN},
+ {2.0, sNaN},
+ {0x1.0p-129, sNaN},
+ {inf, sNaN},
+ {sNaN, sNaN}};
+
+ for (int i = 0; i < N; ++i) {
+ InType x = INPUTS[i].x;
+ InType y = INPUTS[i].y;
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fmul, INPUTS[i],
+ func(x, y), 0.5);
+ }
+ }
+
+ void testNormalRange(FMulFunc func) {
+ using FPBits = LIBC_NAMESPACE::fputil::FPBits<InType>;
+ using StorageType = typename FPBits::StorageType;
+ static constexpr StorageType MAX_NORMAL = FPBits::max_normal().uintval();
+ static constexpr StorageType MIN_NORMAL = FPBits::min_normal().uintval();
+
+ constexpr StorageType COUNT = 10'001;
+ constexpr StorageType STEP = (MAX_NORMAL - MIN_NORMAL) / COUNT;
+ for (int signs = 0; signs < 4; ++signs) {
+ for (StorageType v = MIN_NORMAL, w = MAX_NORMAL;
+ v <= MAX_NORMAL && w >= MIN_NORMAL; v += STEP, w -= STEP) {
+ InType x = FPBits(v).get_val(), y = FPBits(w).get_val();
+ if (signs % 2 == 1) {
+ x = -x;
+ }
+ if (signs >= 2) {
+ y = -y;
+ }
+
+ mpfr::BinaryInput<InType> input{x, y};
+ ASSERT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Fmul, input, func(x, y),
+ 0.5);
+ }
+ }
+ }
+};
+
+#define LIST_FMUL_MPFR_TESTS(OutType, InType, func) \
+ using LlvmLibcFmulTest = FmulMPFRTest<OutType, InType>; \
+ TEST_F(LlvmLibcFmulTest, MulMpfr) { testFMulMPFR(&func); } \
+ TEST_F(LlvmLibcFmulTest, NanInfMpfr) { testSpecialInputsMPFR(&func); } \
+ TEST_F(LlvmLibcFmulTest, NormalRange) { testNormalRange(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_FMULTEST_H
diff --git a/libc/test/src/math/SubTest.h b/libc/test/src/math/SubTest.h
new file mode 100644
index 0000000..9b40353
--- /dev/null
+++ b/libc/test/src/math/SubTest.h
@@ -0,0 +1,74 @@
+//===-- Utility class to test different flavors of float sub ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_SUBTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SUBTEST_H
+
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+#include "utils/MPFRWrapper/MPFRUtils.h"
+
+namespace mpfr = LIBC_NAMESPACE::testing::mpfr;
+
+template <typename OutType, typename InType>
+class SubTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ struct InConstants {
+ DECLARE_SPECIAL_CONSTANTS(InType)
+ };
+
+ using InFPBits = typename InConstants::FPBits;
+ using InStorageType = typename InConstants::StorageType;
+
+ static constexpr InStorageType IN_MAX_NORMAL_U =
+ InFPBits::max_normal().uintval();
+ static constexpr InStorageType IN_MIN_NORMAL_U =
+ InFPBits::min_normal().uintval();
+ static constexpr InStorageType IN_MAX_SUBNORMAL_U =
+ InFPBits::max_subnormal().uintval();
+ static constexpr InStorageType IN_MIN_SUBNORMAL_U =
+ InFPBits::min_subnormal().uintval();
+
+public:
+ using SubFunc = OutType (*)(InType, InType);
+
+ void test_subnormal_range(SubFunc func) {
+ constexpr InStorageType COUNT = 100'001;
+ constexpr InStorageType STEP =
+ (IN_MAX_SUBNORMAL_U - IN_MIN_SUBNORMAL_U) / COUNT;
+ for (InStorageType i = 0, v = 0, w = IN_MAX_SUBNORMAL_U; i <= COUNT;
+ ++i, v += STEP, w -= STEP) {
+ InType x = InFPBits(v).get_val();
+ InType y = InFPBits(w).get_val();
+ mpfr::BinaryInput<InType> input{x, y};
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sub, input, func(x, y),
+ 0.5);
+ }
+ }
+
+ void test_normal_range(SubFunc func) {
+ constexpr InStorageType COUNT = 100'001;
+ constexpr InStorageType STEP = (IN_MAX_NORMAL_U - IN_MIN_NORMAL_U) / COUNT;
+ for (InStorageType i = 0, v = 0, w = IN_MAX_NORMAL_U; i <= COUNT;
+ ++i, v += STEP, w -= STEP) {
+ InType x = InFPBits(v).get_val();
+ InType y = InFPBits(w).get_val();
+ mpfr::BinaryInput<InType> input{x, y};
+ EXPECT_MPFR_MATCH_ALL_ROUNDING(mpfr::Operation::Sub, input, func(x, y),
+ 0.5);
+ }
+ }
+};
+
+#define LIST_SUB_TESTS(OutType, InType, func) \
+ using LlvmLibcSubTest = SubTest<OutType, InType>; \
+ TEST_F(LlvmLibcSubTest, SubnormalRange) { test_subnormal_range(&func); } \
+ TEST_F(LlvmLibcSubTest, NormalRange) { test_normal_range(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SUBTEST_H
diff --git a/libc/test/src/math/f16addf_test.cpp b/libc/test/src/math/f16addf_test.cpp
new file mode 100644
index 0000000..1e8b432
--- /dev/null
+++ b/libc/test/src/math/f16addf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for f16addf ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "AddTest.h"
+
+#include "src/math/f16addf.h"
+
+LIST_ADD_TESTS(float16, float, LIBC_NAMESPACE::f16addf)
diff --git a/libc/test/src/math/f16subf_test.cpp b/libc/test/src/math/f16subf_test.cpp
new file mode 100644
index 0000000..68ad948
--- /dev/null
+++ b/libc/test/src/math/f16subf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for f16subf ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/f16subf.h"
+
+LIST_SUB_TESTS(float16, float, LIBC_NAMESPACE::f16subf)
diff --git a/libc/test/src/math/fmul_test.cpp b/libc/test/src/math/fmul_test.cpp
new file mode 100644
index 0000000..16eaa1a
--- /dev/null
+++ b/libc/test/src/math/fmul_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for fmul-------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===---------------------------------------------------------------------===//
+
+#include "FMulTest.h"
+
+#include "src/math/fmul.h"
+
+LIST_FMUL_MPFR_TESTS(float, double, LIBC_NAMESPACE::fmul)
diff --git a/libc/test/src/math/smoke/AddTest.h b/libc/test/src/math/smoke/AddTest.h
new file mode 100644
index 0000000..c713c5a
--- /dev/null
+++ b/libc/test/src/math/smoke/AddTest.h
@@ -0,0 +1,156 @@
+//===-- Utility class to test different flavors of float add ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_ADDTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_ADDTEST_H
+
+#include "hdr/errno_macros.h"
+#include "hdr/fenv_macros.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename OutType, typename InType>
+class AddTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ DECLARE_SPECIAL_CONSTANTS(OutType)
+
+ struct InConstants {
+ DECLARE_SPECIAL_CONSTANTS(InType)
+ };
+
+ using InFPBits = typename InConstants::FPBits;
+ using InStorageType = typename InConstants::StorageType;
+
+ InConstants in;
+
+public:
+ using AddFunc = OutType (*)(InType, InType);
+
+ void test_special_numbers(AddFunc func) {
+ EXPECT_FP_IS_NAN(func(aNaN, aNaN));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(sNaN, sNaN), FE_INVALID);
+
+ InType qnan_42 = InFPBits::quiet_nan(Sign::POS, 0x42).get_val();
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, zero)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_42)));
+
+ if constexpr (sizeof(OutType) < sizeof(InType)) {
+ InStorageType max_payload = InFPBits::FRACTION_MASK >> 1;
+ InType qnan_max = InFPBits::quiet_nan(Sign::POS, max_payload).get_val();
+ EXPECT_FP_EQ(zero,
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, zero)));
+ EXPECT_FP_EQ(zero,
+ LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_max)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, qnan_42)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, qnan_max)));
+ }
+
+ EXPECT_FP_EQ(inf, func(inf, zero));
+ EXPECT_FP_EQ(neg_inf, func(neg_inf, zero));
+ EXPECT_FP_EQ(inf, func(inf, neg_zero));
+ EXPECT_FP_EQ(neg_inf, func(neg_inf, neg_zero));
+ }
+
+ void test_invalid_operations(AddFunc func) {
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(inf, neg_inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(neg_inf, inf), FE_INVALID);
+ }
+
+ void test_range_errors(AddFunc func) {
+ using namespace LIBC_NAMESPACE::fputil::testing;
+
+ if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, func(max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(-inf, func(neg_max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, func(in.min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(
+ neg_zero, func(in.neg_min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(max_normal, func(max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_max_normal,
+ func(neg_max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, func(in.min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(
+ neg_zero, func(in.neg_min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(max_normal, func(max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_FP_EQ_WITH_EXCEPTION(-inf, func(neg_max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero, func(in.min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(
+ neg_min_denormal, func(in.neg_min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, func(max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_max_normal,
+ func(neg_max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(min_denormal,
+ func(in.min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(
+ neg_zero, func(in.neg_min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+ }
+
+ void test_inexact_results(AddFunc func) {
+ func(InType(1.0), min_denormal);
+ EXPECT_FP_EXCEPTION(FE_INEXACT);
+ }
+};
+
+#define LIST_ADD_TESTS(OutType, InType, func) \
+ using LlvmLibcAddTest = AddTest<OutType, InType>; \
+ TEST_F(LlvmLibcAddTest, SpecialNumbers) { test_special_numbers(&func); } \
+ TEST_F(LlvmLibcAddTest, InvalidOperations) { \
+ test_invalid_operations(&func); \
+ } \
+ TEST_F(LlvmLibcAddTest, RangeErrors) { test_range_errors(&func); } \
+ TEST_F(LlvmLibcAddTest, InexactResults) { test_inexact_results(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_ADDTEST_H
diff --git a/libc/test/src/math/smoke/CMakeLists.txt b/libc/test/src/math/smoke/CMakeLists.txt
index a363644..1b269ed 100644
--- a/libc/test/src/math/smoke/CMakeLists.txt
+++ b/libc/test/src/math/smoke/CMakeLists.txt
@@ -3644,6 +3644,35 @@ add_fp_unittest(
)
add_fp_unittest(
+ f16addf_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ f16addf_test.cpp
+ HDRS
+ AddTest.h
+ DEPENDS
+ libc.hdr.errno_macros
+ libc.hdr.fenv_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.math.f16addf
+)
+
+add_fp_unittest(
+ f16subf_test
+ SUITE
+ libc-math-smoke-tests
+ SRCS
+ f16subf_test.cpp
+ HDRS
+ SubTest.h
+ DEPENDS
+ libc.hdr.fenv_macros
+ libc.src.__support.FPUtil.basic_operations
+ libc.src.math.f16subf
+)
+
+add_fp_unittest(
f16div_test
SUITE
libc-math-smoke-tests
diff --git a/libc/test/src/math/smoke/SubTest.h b/libc/test/src/math/smoke/SubTest.h
new file mode 100644
index 0000000..a4b3822
--- /dev/null
+++ b/libc/test/src/math/smoke/SubTest.h
@@ -0,0 +1,158 @@
+//===-- Utility class to test different flavors of float sub ----*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
+#define LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
+
+#include "hdr/fenv_macros.h"
+#include "src/__support/FPUtil/BasicOperations.h"
+#include "test/UnitTest/FEnvSafeTest.h"
+#include "test/UnitTest/FPMatcher.h"
+#include "test/UnitTest/Test.h"
+
+template <typename OutType, typename InType>
+class SubTest : public LIBC_NAMESPACE::testing::FEnvSafeTest {
+
+ DECLARE_SPECIAL_CONSTANTS(OutType)
+
+ struct InConstants {
+ DECLARE_SPECIAL_CONSTANTS(InType)
+ };
+
+ using InFPBits = typename InConstants::FPBits;
+ using InStorageType = typename InConstants::StorageType;
+
+ InConstants in;
+
+public:
+ using SubFunc = OutType (*)(InType, InType);
+
+ void test_special_numbers(SubFunc func) {
+ EXPECT_FP_IS_NAN(func(aNaN, aNaN));
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(sNaN, sNaN), FE_INVALID);
+
+ InType qnan_42 = InFPBits::quiet_nan(Sign::POS, 0x42).get_val();
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, zero)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_42)));
+
+ if constexpr (sizeof(OutType) < sizeof(InType)) {
+ InStorageType max_payload = InFPBits::FRACTION_MASK >> 1;
+ InType qnan_max = InFPBits::quiet_nan(Sign::POS, max_payload).get_val();
+ EXPECT_FP_EQ(zero,
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, zero)));
+ EXPECT_FP_EQ(zero,
+ LIBC_NAMESPACE::fputil::getpayload(func(zero, qnan_max)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_max, qnan_42)));
+ EXPECT_FP_EQ(InType(0x42.0p+0),
+ LIBC_NAMESPACE::fputil::getpayload(func(qnan_42, qnan_max)));
+ }
+
+ EXPECT_FP_EQ(inf, func(inf, zero));
+ EXPECT_FP_EQ(neg_inf, func(neg_inf, zero));
+ EXPECT_FP_EQ(inf, func(inf, neg_zero));
+ EXPECT_FP_EQ(neg_inf, func(neg_inf, neg_zero));
+ }
+
+ void test_invalid_operations(SubFunc func) {
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(inf, inf), FE_INVALID);
+ EXPECT_FP_IS_NAN_WITH_EXCEPTION(func(neg_inf, neg_inf), FE_INVALID);
+ }
+
+ void test_range_errors(SubFunc func) {
+ using namespace LIBC_NAMESPACE::fputil::testing;
+
+ if (ForceRoundingMode r(RoundingMode::Nearest); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, func(max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(-inf, func(neg_max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero,
+ func(in.min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_zero,
+ func(in.neg_min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::TowardZero); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(max_normal, func(max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_max_normal,
+ func(neg_max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero,
+ func(in.min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_zero,
+ func(in.neg_min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::Downward); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(max_normal, func(max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_FP_EQ_WITH_EXCEPTION(-inf, func(neg_max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(zero,
+ func(in.min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_min_denormal,
+ func(in.neg_min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+
+ if (ForceRoundingMode r(RoundingMode::Upward); r.success) {
+ EXPECT_FP_EQ_WITH_EXCEPTION(inf, func(max_normal, neg_max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_max_normal,
+ func(neg_max_normal, max_normal),
+ FE_OVERFLOW | FE_INEXACT);
+
+ EXPECT_FP_EQ_WITH_EXCEPTION(min_denormal,
+ func(in.min_denormal, in.neg_min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ EXPECT_FP_EQ_WITH_EXCEPTION(neg_zero,
+ func(in.neg_min_denormal, in.min_denormal),
+ FE_UNDERFLOW | FE_INEXACT);
+ EXPECT_MATH_ERRNO(ERANGE);
+ }
+ }
+
+ void test_inexact_results(SubFunc func) {
+ func(InType(1.0), min_denormal);
+ EXPECT_FP_EXCEPTION(FE_INEXACT);
+ }
+};
+
+#define LIST_SUB_TESTS(OutType, InType, func) \
+ using LlvmLibcSubTest = SubTest<OutType, InType>; \
+ TEST_F(LlvmLibcSubTest, SpecialNumbers) { test_special_numbers(&func); } \
+ TEST_F(LlvmLibcSubTest, InvalidOperations) { \
+ test_invalid_operations(&func); \
+ } \
+ TEST_F(LlvmLibcSubTest, RangeErrors) { test_range_errors(&func); } \
+ TEST_F(LlvmLibcSubTest, InexactResults) { test_inexact_results(&func); }
+
+#endif // LLVM_LIBC_TEST_SRC_MATH_SMOKE_SUBTEST_H
diff --git a/libc/test/src/math/smoke/f16addf_test.cpp b/libc/test/src/math/smoke/f16addf_test.cpp
new file mode 100644
index 0000000..1e8b432
--- /dev/null
+++ b/libc/test/src/math/smoke/f16addf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for f16addf ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "AddTest.h"
+
+#include "src/math/f16addf.h"
+
+LIST_ADD_TESTS(float16, float, LIBC_NAMESPACE::f16addf)
diff --git a/libc/test/src/math/smoke/f16subf_test.cpp b/libc/test/src/math/smoke/f16subf_test.cpp
new file mode 100644
index 0000000..68ad948
--- /dev/null
+++ b/libc/test/src/math/smoke/f16subf_test.cpp
@@ -0,0 +1,13 @@
+//===-- Unittests for f16subf ---------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "SubTest.h"
+
+#include "src/math/f16subf.h"
+
+LIST_SUB_TESTS(float16, float, LIBC_NAMESPACE::f16subf)
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 379a631..f0a6538 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -185,6 +185,12 @@ public:
return result;
}
+ MPFRNumber add(const MPFRNumber &b) const {
+ MPFRNumber result(*this);
+ mpfr_add(result.value, value, b.value, mpfr_rounding);
+ return result;
+ }
+
MPFRNumber asin() const {
MPFRNumber result(*this);
mpfr_asin(result.value, value, mpfr_rounding);
@@ -463,6 +469,12 @@ public:
return result;
}
+ MPFRNumber sub(const MPFRNumber &b) const {
+ MPFRNumber result(*this);
+ mpfr_sub(result.value, value, b.value, mpfr_rounding);
+ return result;
+ }
+
MPFRNumber tan() const {
MPFRNumber result(*this);
mpfr_tan(result.value, value, mpfr_rounding);
@@ -487,6 +499,12 @@ public:
return result;
}
+ MPFRNumber fmul(const MPFRNumber &b) {
+ MPFRNumber result(*this);
+ mpfr_mul(result.value, value, b.value, mpfr_rounding);
+ return result;
+ }
+
cpp::string str() const {
// 200 bytes should be more than sufficient to hold a 100-digit number
// plus additional bytes for the decimal point, '-' sign etc.
@@ -728,6 +746,8 @@ binary_operation_one_output(Operation op, InputType x, InputType y,
MPFRNumber inputX(x, precision, rounding);
MPFRNumber inputY(y, precision, rounding);
switch (op) {
+ case Operation::Add:
+ return inputX.add(inputY);
case Operation::Atan2:
return inputX.atan2(inputY);
case Operation::Div:
@@ -738,6 +758,10 @@ binary_operation_one_output(Operation op, InputType x, InputType y,
return inputX.hypot(inputY);
case Operation::Pow:
return inputX.pow(inputY);
+ case Operation::Sub:
+ return inputX.sub(inputY);
+ case Operation::Fmul:
+ return inputX.fmul(inputY);
default:
__builtin_unreachable();
}
@@ -951,6 +975,9 @@ template void
explain_binary_operation_one_output_error(Operation,
const BinaryInput<long double> &,
long double, double, RoundingMode);
+
+template void explain_binary_operation_one_output_error(
+ Operation, const BinaryInput<double> &, float, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template void explain_binary_operation_one_output_error(
Operation, const BinaryInput<float16> &, float16, double, RoundingMode);
@@ -1126,6 +1153,10 @@ template bool compare_binary_operation_one_output(Operation,
template bool
compare_binary_operation_one_output(Operation, const BinaryInput<long double> &,
long double, double, RoundingMode);
+
+template bool compare_binary_operation_one_output(Operation,
+ const BinaryInput<double> &,
+ float, double, RoundingMode);
#ifdef LIBC_TYPES_HAS_FLOAT16
template bool compare_binary_operation_one_output(Operation,
const BinaryInput<float16> &,
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.h b/libc/utils/MPFRWrapper/MPFRUtils.h
index 11e323b..213dc7a 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.h
+++ b/libc/utils/MPFRWrapper/MPFRUtils.h
@@ -71,11 +71,14 @@ enum class Operation : int {
// input and produce a single floating point number of the same type as
// output.
BeginBinaryOperationsSingleOutput,
+ Add,
Atan2,
Div,
Fmod,
Hypot,
Pow,
+ Sub,
+ Fmul,
EndBinaryOperationsSingleOutput,
// Operations which take two floating point numbers of the same type as
@@ -237,7 +240,8 @@ public:
bool is_silent() const override { return silent; }
private:
- template <typename T, typename U> bool match(T in, U out) {
+ template <typename InType, typename OutType>
+ bool match(InType in, OutType out) {
return compare_unary_operation_single_output(op, in, out, ulp_tolerance,
rounding);
}
@@ -259,13 +263,14 @@ private:
rounding);
}
- template <typename T, typename U>
- bool match(const TernaryInput<T> &in, U out) {
+ template <typename InType, typename OutType>
+ bool match(const TernaryInput<InType> &in, OutType out) {
return compare_ternary_operation_one_output(op, in, out, ulp_tolerance,
rounding);
}
- template <typename T, typename U> void explain_error(T in, U out) {
+ template <typename InType, typename OutType>
+ void explain_error(InType in, OutType out) {
explain_unary_operation_single_output_error(op, in, out, ulp_tolerance,
rounding);
}
@@ -287,8 +292,8 @@ private:
rounding);
}
- template <typename T, typename U>
- void explain_error(const TernaryInput<T> &in, U out) {
+ template <typename InType, typename OutType>
+ void explain_error(const TernaryInput<InType> &in, OutType out) {
explain_ternary_operation_one_output_error(op, in, out, ulp_tolerance,
rounding);
}
@@ -304,7 +309,9 @@ constexpr bool is_valid_operation() {
(op == Operation::Sqrt && cpp::is_floating_point_v<InputType> &&
cpp::is_floating_point_v<OutputType> &&
sizeof(OutputType) <= sizeof(InputType)) ||
- (op == Operation::Div && internal::IsBinaryInput<InputType>::VALUE &&
+ (Operation::BeginBinaryOperationsSingleOutput < op &&
+ op < Operation::EndBinaryOperationsSingleOutput &&
+ internal::IsBinaryInput<InputType>::VALUE &&
cpp::is_floating_point_v<
typename internal::MakeScalarInput<InputType>::type> &&
cpp::is_floating_point_v<OutputType>) ||
diff --git a/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
new file mode 100644
index 0000000..16ee000
--- /dev/null
+++ b/libcxx/test/libcxx/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// Check that instantiating pair doesn't look up type traits "too early", before
+// the contained types have been completed.
+//
+// This is a regression test, to prevent a reoccurrance of the issue introduced
+// in 5e1de27f680591a870d78e9952b23f76aed7f456.
+
+#include <utility>
+#include <vector>
+
+struct Test {
+ std::vector<std::pair<int, Test> > v;
+};
+
+std::pair<int, Test> p;
diff --git a/lldb/source/Commands/CMakeLists.txt b/lldb/source/Commands/CMakeLists.txt
index 6a36c53..7639722 100644
--- a/lldb/source/Commands/CMakeLists.txt
+++ b/lldb/source/Commands/CMakeLists.txt
@@ -26,7 +26,7 @@ add_lldb_library(lldbCommands NO_PLUGIN_DEPENDENCIES
CommandObjectQuit.cpp
CommandObjectRegexCommand.cpp
CommandObjectRegister.cpp
- CommandObjectScript.cpp
+ CommandObjectScripting.cpp
CommandObjectSession.cpp
CommandObjectSettings.cpp
CommandObjectSource.cpp
diff --git a/lldb/source/Commands/CommandObjectScript.cpp b/lldb/source/Commands/CommandObjectScript.cpp
deleted file mode 100644
index 25f25b8..0000000
--- a/lldb/source/Commands/CommandObjectScript.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-//===-- CommandObjectScript.cpp -------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "CommandObjectScript.h"
-#include "lldb/Core/Debugger.h"
-#include "lldb/DataFormatters/DataVisualization.h"
-#include "lldb/Host/Config.h"
-#include "lldb/Host/OptionParser.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandOptionArgumentTable.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/OptionArgParser.h"
-#include "lldb/Interpreter/ScriptInterpreter.h"
-#include "lldb/Utility/Args.h"
-
-using namespace lldb;
-using namespace lldb_private;
-
-#define LLDB_OPTIONS_script
-#include "CommandOptions.inc"
-
-Status CommandObjectScript::CommandOptions::SetOptionValue(
- uint32_t option_idx, llvm::StringRef option_arg,
- ExecutionContext *execution_context) {
- Status error;
- const int short_option = m_getopt_table[option_idx].val;
-
- switch (short_option) {
- case 'l':
- language = (lldb::ScriptLanguage)OptionArgParser::ToOptionEnum(
- option_arg, GetDefinitions()[option_idx].enum_values,
- eScriptLanguageNone, error);
- if (!error.Success())
- error.SetErrorStringWithFormat("unrecognized value for language '%s'",
- option_arg.str().c_str());
- break;
- default:
- llvm_unreachable("Unimplemented option");
- }
-
- return error;
-}
-
-void CommandObjectScript::CommandOptions::OptionParsingStarting(
- ExecutionContext *execution_context) {
- language = lldb::eScriptLanguageNone;
-}
-
-llvm::ArrayRef<OptionDefinition>
-CommandObjectScript::CommandOptions::GetDefinitions() {
- return llvm::ArrayRef(g_script_options);
-}
-
-CommandObjectScript::CommandObjectScript(CommandInterpreter &interpreter)
- : CommandObjectRaw(
- interpreter, "script",
- "Invoke the script interpreter with provided code and display any "
- "results. Start the interactive interpreter if no code is supplied.",
- "script [--language <scripting-language> --] [<script-code>]") {}
-
-CommandObjectScript::~CommandObjectScript() = default;
-
-void CommandObjectScript::DoExecute(llvm::StringRef command,
- CommandReturnObject &result) {
- // Try parsing the language option but when the command contains a raw part
- // separated by the -- delimiter.
- OptionsWithRaw raw_args(command);
- if (raw_args.HasArgs()) {
- if (!ParseOptions(raw_args.GetArgs(), result))
- return;
- command = raw_args.GetRawPart();
- }
-
- lldb::ScriptLanguage language =
- (m_options.language == lldb::eScriptLanguageNone)
- ? m_interpreter.GetDebugger().GetScriptLanguage()
- : m_options.language;
-
- if (language == lldb::eScriptLanguageNone) {
- result.AppendError(
- "the script-lang setting is set to none - scripting not available");
- return;
- }
-
- ScriptInterpreter *script_interpreter =
- GetDebugger().GetScriptInterpreter(true, language);
-
- if (script_interpreter == nullptr) {
- result.AppendError("no script interpreter");
- return;
- }
-
- // Script might change Python code we use for formatting. Make sure we keep
- // up to date with it.
- DataVisualization::ForceUpdate();
-
- if (command.empty()) {
- script_interpreter->ExecuteInterpreterLoop();
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- return;
- }
-
- // We can do better when reporting the status of one-liner script execution.
- if (script_interpreter->ExecuteOneLine(command, &result))
- result.SetStatus(eReturnStatusSuccessFinishNoResult);
- else
- result.SetStatus(eReturnStatusFailed);
-}
diff --git a/lldb/source/Commands/CommandObjectScript.h b/lldb/source/Commands/CommandObjectScript.h
deleted file mode 100644
index 3a8c4a8..0000000
--- a/lldb/source/Commands/CommandObjectScript.h
+++ /dev/null
@@ -1,42 +0,0 @@
-//===-- CommandObjectScript.h -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPT_H
-#define LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPT_H
-
-#include "lldb/Interpreter/CommandObject.h"
-
-namespace lldb_private {
-
-class CommandObjectScript : public CommandObjectRaw {
-public:
- CommandObjectScript(CommandInterpreter &interpreter);
- ~CommandObjectScript() override;
- Options *GetOptions() override { return &m_options; }
-
- class CommandOptions : public Options {
- public:
- CommandOptions() = default;
- ~CommandOptions() override = default;
- Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
- ExecutionContext *execution_context) override;
- void OptionParsingStarting(ExecutionContext *execution_context) override;
- llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
- lldb::ScriptLanguage language = lldb::eScriptLanguageNone;
- };
-
-protected:
- void DoExecute(llvm::StringRef command, CommandReturnObject &result) override;
-
-private:
- CommandOptions m_options;
-};
-
-} // namespace lldb_private
-
-#endif // LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPT_H
diff --git a/lldb/source/Commands/CommandObjectScripting.cpp b/lldb/source/Commands/CommandObjectScripting.cpp
new file mode 100644
index 0000000..fee0565
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectScripting.cpp
@@ -0,0 +1,144 @@
+//===-- CommandObjectScripting.cpp ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "CommandObjectScripting.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/DataFormatters/DataVisualization.h"
+#include "lldb/Host/Config.h"
+#include "lldb/Host/OptionParser.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandOptionArgumentTable.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionArgParser.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Utility/Args.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+#define LLDB_OPTIONS_scripting_run
+#include "CommandOptions.inc"
+
+class CommandObjectScriptingRun : public CommandObjectRaw {
+public:
+ CommandObjectScriptingRun(CommandInterpreter &interpreter)
+ : CommandObjectRaw(
+ interpreter, "scripting run",
+ "Invoke the script interpreter with provided code and display any "
+ "results. Start the interactive interpreter if no code is "
+ "supplied.",
+ "scripting run [--language <scripting-language> --] "
+ "[<script-code>]") {}
+
+ ~CommandObjectScriptingRun() override = default;
+
+ Options *GetOptions() override { return &m_options; }
+
+ class CommandOptions : public Options {
+ public:
+ CommandOptions() = default;
+ ~CommandOptions() override = default;
+ Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+ ExecutionContext *execution_context) override {
+ Status error;
+ const int short_option = m_getopt_table[option_idx].val;
+
+ switch (short_option) {
+ case 'l':
+ language = (lldb::ScriptLanguage)OptionArgParser::ToOptionEnum(
+ option_arg, GetDefinitions()[option_idx].enum_values,
+ eScriptLanguageNone, error);
+ if (!error.Success())
+ error.SetErrorStringWithFormat("unrecognized value for language '%s'",
+ option_arg.str().c_str());
+ break;
+ default:
+ llvm_unreachable("Unimplemented option");
+ }
+
+ return error;
+ }
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override {
+ language = lldb::eScriptLanguageNone;
+ }
+
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return llvm::ArrayRef(g_scripting_run_options);
+ }
+
+ lldb::ScriptLanguage language = lldb::eScriptLanguageNone;
+ };
+
+protected:
+ void DoExecute(llvm::StringRef command,
+ CommandReturnObject &result) override {
+ // Try parsing the language option but when the command contains a raw part
+ // separated by the -- delimiter.
+ OptionsWithRaw raw_args(command);
+ if (raw_args.HasArgs()) {
+ if (!ParseOptions(raw_args.GetArgs(), result))
+ return;
+ command = raw_args.GetRawPart();
+ }
+
+ lldb::ScriptLanguage language =
+ (m_options.language == lldb::eScriptLanguageNone)
+ ? m_interpreter.GetDebugger().GetScriptLanguage()
+ : m_options.language;
+
+ if (language == lldb::eScriptLanguageNone) {
+ result.AppendError(
+ "the script-lang setting is set to none - scripting not available");
+ return;
+ }
+
+ ScriptInterpreter *script_interpreter =
+ GetDebugger().GetScriptInterpreter(true, language);
+
+ if (script_interpreter == nullptr) {
+ result.AppendError("no script interpreter");
+ return;
+ }
+
+ // Script might change Python code we use for formatting. Make sure we keep
+ // up to date with it.
+ DataVisualization::ForceUpdate();
+
+ if (command.empty()) {
+ script_interpreter->ExecuteInterpreterLoop();
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ return;
+ }
+
+ // We can do better when reporting the status of one-liner script execution.
+ if (script_interpreter->ExecuteOneLine(command, &result))
+ result.SetStatus(eReturnStatusSuccessFinishNoResult);
+ else
+ result.SetStatus(eReturnStatusFailed);
+ }
+
+private:
+ CommandOptions m_options;
+};
+
+#pragma mark CommandObjectMultiwordScripting
+
+// CommandObjectMultiwordScripting
+
+CommandObjectMultiwordScripting::CommandObjectMultiwordScripting(
+ CommandInterpreter &interpreter)
+ : CommandObjectMultiword(
+ interpreter, "scripting",
+ "Commands for operating on the scripting functionnalities.",
+ "scripting <subcommand> [<subcommand-options>]") {
+ LoadSubCommand("run",
+ CommandObjectSP(new CommandObjectScriptingRun(interpreter)));
+}
+
+CommandObjectMultiwordScripting::~CommandObjectMultiwordScripting() = default;
diff --git a/lldb/source/Commands/CommandObjectScripting.h b/lldb/source/Commands/CommandObjectScripting.h
new file mode 100644
index 0000000..0ccd579
--- /dev/null
+++ b/lldb/source/Commands/CommandObjectScripting.h
@@ -0,0 +1,25 @@
+//===-- CommandObjectScripting.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPTING_H
+#define LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPTING_H
+
+#include "lldb/Interpreter/CommandObjectMultiword.h"
+
+namespace lldb_private {
+
+class CommandObjectMultiwordScripting : public CommandObjectMultiword {
+public:
+ CommandObjectMultiwordScripting(CommandInterpreter &interpreter);
+
+ ~CommandObjectMultiwordScripting() override;
+};
+
+} // namespace lldb_private
+
+#endif // LLDB_SOURCE_INTERPRETER_COMMANDOBJECTSCRIPTING_H
diff --git a/lldb/source/Commands/Options.td b/lldb/source/Commands/Options.td
index fa8af7c..24e97f3 100644
--- a/lldb/source/Commands/Options.td
+++ b/lldb/source/Commands/Options.td
@@ -835,7 +835,7 @@ let Command = "container add" in {
Desc<"Overwrite an existing command at this node.">;
}
-let Command = "script" in {
+let Command = "scripting run" in {
def script_language : Option<"language", "l">,
EnumArg<"ScriptLang">, Desc<"Specify the scripting "
" language. If none is specific the default scripting language is used.">;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 40c915b..fc07168 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -33,7 +33,7 @@
#include "Commands/CommandObjectQuit.h"
#include "Commands/CommandObjectRegexCommand.h"
#include "Commands/CommandObjectRegister.h"
-#include "Commands/CommandObjectScript.h"
+#include "Commands/CommandObjectScripting.h"
#include "Commands/CommandObjectSession.h"
#include "Commands/CommandObjectSettings.h"
#include "Commands/CommandObjectSource.h"
@@ -518,6 +518,15 @@ void CommandInterpreter::Initialize() {
AddAlias("re", cmd_obj_sp);
}
+ cmd_obj_sp = GetCommandSPExact("scripting run");
+ if (cmd_obj_sp) {
+ AddAlias("sc", cmd_obj_sp);
+ AddAlias("scr", cmd_obj_sp);
+ AddAlias("scri", cmd_obj_sp);
+ AddAlias("scrip", cmd_obj_sp);
+ AddAlias("script", cmd_obj_sp);
+ }
+
cmd_obj_sp = GetCommandSPExact("session history");
if (cmd_obj_sp) {
AddAlias("history", cmd_obj_sp);
@@ -569,7 +578,7 @@ void CommandInterpreter::LoadCommandDictionary() {
REGISTER_COMMAND_OBJECT("process", CommandObjectMultiwordProcess);
REGISTER_COMMAND_OBJECT("quit", CommandObjectQuit);
REGISTER_COMMAND_OBJECT("register", CommandObjectRegister);
- REGISTER_COMMAND_OBJECT("script", CommandObjectScript);
+ REGISTER_COMMAND_OBJECT("scripting", CommandObjectMultiwordScripting);
REGISTER_COMMAND_OBJECT("settings", CommandObjectMultiwordSettings);
REGISTER_COMMAND_OBJECT("session", CommandObjectSession);
REGISTER_COMMAND_OBJECT("source", CommandObjectMultiwordSource);
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 2979bf69..0dcb1be 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6159,10 +6159,6 @@ Section *ObjectFileMachO::GetMachHeaderSection() {
bool ObjectFileMachO::SectionIsLoadable(const Section *section) {
if (!section)
return false;
- const bool is_dsym = (m_header.filetype == MH_DSYM);
- if (section->GetFileSize() == 0 && !is_dsym &&
- section->GetName() != GetSegmentNameDATA())
- return false;
if (section->IsThreadSpecific())
return false;
if (GetModule().get() != section->GetModule().get())
@@ -6202,6 +6198,7 @@ lldb::addr_t ObjectFileMachO::CalculateSectionLoadAddressForMemoryImage(
bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
bool value_is_offset) {
+ Log *log(GetLog(LLDBLog::DynamicLoader));
ModuleSP module_sp = GetModule();
if (!module_sp)
return false;
@@ -6217,17 +6214,33 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
// malformed.
const bool warn_multiple = true;
+ if (log) {
+ StreamString logmsg;
+ logmsg << "ObjectFileMachO::SetLoadAddress ";
+ if (GetFileSpec())
+ logmsg << "path='" << GetFileSpec().GetPath() << "' ";
+ if (GetUUID()) {
+ logmsg << "uuid=" << GetUUID().GetAsString();
+ }
+ LLDB_LOGF(log, "%s", logmsg.GetData());
+ }
if (value_is_offset) {
// "value" is an offset to apply to each top level segment
for (size_t sect_idx = 0; sect_idx < num_sections; ++sect_idx) {
// Iterate through the object file sections to find all of the
// sections that size on disk (to avoid __PAGEZERO) and load them
SectionSP section_sp(section_list->GetSectionAtIndex(sect_idx));
- if (SectionIsLoadable(section_sp.get()))
+ if (SectionIsLoadable(section_sp.get())) {
+ LLDB_LOGF(log,
+ "ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
+ "0x%" PRIx64,
+ section_sp->GetName().AsCString(),
+ section_sp->GetFileAddress() + value);
if (target.GetSectionLoadList().SetSectionLoadAddress(
section_sp, section_sp->GetFileAddress() + value,
warn_multiple))
++num_loaded_sections;
+ }
}
} else {
// "value" is the new base address of the mach_header, adjust each
@@ -6242,6 +6255,10 @@ bool ObjectFileMachO::SetLoadAddress(Target &target, lldb::addr_t value,
CalculateSectionLoadAddressForMemoryImage(
value, mach_header_section, section_sp.get());
if (section_load_addr != LLDB_INVALID_ADDRESS) {
+ LLDB_LOGF(log,
+ "ObjectFileMachO::SetLoadAddress segment '%s' load addr is "
+ "0x%" PRIx64,
+ section_sp->GetName().AsCString(), section_load_addr);
if (target.GetSectionLoadList().SetSectionLoadAddress(
section_sp, section_load_addr, warn_multiple))
++num_loaded_sections;
diff --git a/lldb/source/Utility/Listener.cpp b/lldb/source/Utility/Listener.cpp
index 6a74c53..5aacb41 100644
--- a/lldb/source/Utility/Listener.cpp
+++ b/lldb/source/Utility/Listener.cpp
@@ -30,7 +30,7 @@ Listener::Listener(const char *name)
Listener::~Listener() {
Log *log = GetLog(LLDBLog::Object);
- Clear();
+ // Don't call Clear() from here as that can cause races. See #96750.
LLDB_LOGF(log, "%p Listener::%s('%s')", static_cast<void *>(this),
__FUNCTION__, m_name.c_str());
diff --git a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
index c54345a..4215990 100644
--- a/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
+++ b/lldb/test/API/commands/settings/use_source_cache/TestUseSourceCache.py
@@ -18,7 +18,7 @@ class SettingsUseSourceCacheTestCase(TestBase):
self.set_use_source_cache_and_test(False)
@skipIf(hostoslist=no_match(["windows"]))
- @skipIf(oslist=["windows"], archs=["aarch64"]) # Fails on windows 11
+ @skipIf(oslist=["windows"]) # Fails on windows 11
def test_set_use_source_cache_true(self):
"""Test that after 'set use-source-cache false', files are locked."""
self.set_use_source_cache_and_test(True)
diff --git a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
index 10431e4..02ee581 100644
--- a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
@@ -80,7 +80,13 @@ class AbbreviationsTestCase(TestBase):
# Check a command that wants the raw input.
command_interpreter.ResolveCommand(r"""sc print("\n\n\tHello!\n")""", result)
self.assertTrue(result.Succeeded())
- self.assertEqual(r"""script print("\n\n\tHello!\n")""", result.GetOutput())
+ self.assertEqual(
+ r"""scripting run print("\n\n\tHello!\n")""", result.GetOutput()
+ )
+
+ command_interpreter.ResolveCommand("script 1+1", result)
+ self.assertTrue(result.Succeeded())
+ self.assertEqual("scripting run 1+1", result.GetOutput())
# Prompt changing stuff should be tested, but this doesn't seem like the
# right test to do it in. It has nothing to do with aliases or abbreviations.
diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
index 4df1b33..ef15d41 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp
@@ -1,4 +1,6 @@
// REQUIRES: lld
+// Is flaky on Windows.
+// UNSUPPORTED: system-windows
// This test will make a type that will be compiled differently into two
// different .dwo files in a type unit with the same type hash, but with
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index 91a2b61..1261896 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -1135,25 +1135,6 @@ configure_file(
${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/abi-breaking.h.cmake
${LLVM_INCLUDE_DIR}/llvm/Config/abi-breaking.h)
-# Add target for generating source rpm package.
-set(LLVM_SRPM_USER_BINARY_SPECFILE ${CMAKE_CURRENT_SOURCE_DIR}/llvm.spec.in
- CACHE FILEPATH ".spec file to use for srpm generation")
-set(LLVM_SRPM_BINARY_SPECFILE ${CMAKE_CURRENT_BINARY_DIR}/llvm.spec)
-set(LLVM_SRPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/srpm")
-
-get_source_info(${CMAKE_CURRENT_SOURCE_DIR} revision repository)
-string(LENGTH "${revision}" revision_length)
-set(LLVM_RPM_SPEC_REVISION "${revision}")
-
-configure_file(
- ${LLVM_SRPM_USER_BINARY_SPECFILE}
- ${LLVM_SRPM_BINARY_SPECFILE} @ONLY)
-
-add_custom_target(srpm
- COMMAND cpack -G TGZ --config CPackSourceConfig.cmake -B ${LLVM_SRPM_DIR}/SOURCES
- COMMAND rpmbuild -bs --define '_topdir ${LLVM_SRPM_DIR}' ${LLVM_SRPM_BINARY_SPECFILE})
-set_target_properties(srpm PROPERTIES FOLDER "LLVM/Misc")
-
if(APPLE AND DARWIN_LTO_LIBRARY)
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
diff --git a/llvm/docs/CommandGuide/FileCheck.rst b/llvm/docs/CommandGuide/FileCheck.rst
index 432dafa..af49304 100644
--- a/llvm/docs/CommandGuide/FileCheck.rst
+++ b/llvm/docs/CommandGuide/FileCheck.rst
@@ -731,7 +731,7 @@ The first check line matches a regex ``%[a-z]+`` and captures it into the
string variable ``REGISTER``. The second line verifies that whatever is in
``REGISTER`` occurs later in the file after an "``andw``". :program:`FileCheck`
string substitution blocks are always contained in ``[[ ]]`` pairs, and string
-variable names can be formed with the regex ``[a-zA-Z_][a-zA-Z0-9_]*``. If a
+variable names can be formed with the regex ``\$[a-zA-Z_][a-zA-Z0-9_]*``. If a
colon follows the name, then it is a definition of the variable; otherwise, it
is a substitution.
diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 211fee5..e2c4720 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -5381,6 +5381,7 @@ NVPTX:
- ``c`` or ``h``: A 16-bit integer register.
- ``r``: A 32-bit integer register.
- ``l`` or ``N``: A 64-bit integer register.
+- ``q``: A 128-bit integer register.
- ``f``: A 32-bit float register.
- ``d``: A 64-bit float register.
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index f81cfc0..31a1fef 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1023,6 +1023,14 @@ public:
Name);
}
+ /// Create call to the ldexp intrinsic.
+ Value *CreateLdexp(Value *Src, Value *Exp, Instruction *FMFSource = nullptr,
+ const Twine &Name = "") {
+ assert(!IsFPConstrained && "TODO: Support strictfp");
+ return CreateIntrinsic(Intrinsic::ldexp, {Src->getType(), Exp->getType()},
+ {Src, Exp}, FMFSource, Name);
+ }
+
/// Create a call to the arithmetic_fence intrinsic.
CallInst *CreateArithmeticFence(Value *Val, Type *DstType,
const Twine &Name = "") {
diff --git a/llvm/include/llvm/IR/PassManagerImpl.h b/llvm/include/llvm/IR/PassManagerImpl.h
index 7887719..67e3fbe 100644
--- a/llvm/include/llvm/IR/PassManagerImpl.h
+++ b/llvm/include/llvm/IR/PassManagerImpl.h
@@ -30,20 +30,24 @@ PreservedAnalyses PassManager<IRUnitT, AnalysisManagerT, ExtraArgTs...>::run(
IRUnitT &IR, AnalysisManagerT &AM, ExtraArgTs... ExtraArgs) {
class StackTraceEntry : public PrettyStackTraceEntry {
const PassInstrumentation &PI;
- PassConceptT &Pass;
IRUnitT &IR;
+ PassConceptT *Pass = nullptr;
public:
- explicit StackTraceEntry(const PassInstrumentation &PI, PassConceptT &Pass,
- IRUnitT &IR)
- : PI(PI), Pass(Pass), IR(IR) {}
+ explicit StackTraceEntry(const PassInstrumentation &PI, IRUnitT &IR)
+ : PI(PI), IR(IR) {}
+
+ void setPass(PassConceptT *P) { Pass = P; }
void print(raw_ostream &OS) const override {
OS << "Running pass \"";
- Pass.printPipeline(OS, [this](StringRef ClassName) {
- auto PassName = PI.getPassNameForClassName(ClassName);
- return PassName.empty() ? ClassName : PassName;
- });
+ if (Pass)
+ Pass->printPipeline(OS, [this](StringRef ClassName) {
+ auto PassName = PI.getPassNameForClassName(ClassName);
+ return PassName.empty() ? ClassName : PassName;
+ });
+ else
+ OS << "unknown";
OS << "\" on ";
printIRUnitNameForStackTrace(OS, IR);
OS << "\n";
@@ -64,14 +68,16 @@ PreservedAnalyses PassManager<IRUnitT, AnalysisManagerT, ExtraArgTs...>::run(
// for duration of these passes.
ScopedDbgInfoFormatSetter FormatSetter(IR, UseNewDbgInfoFormat);
+ StackTraceEntry Entry(PI, IR);
for (auto &Pass : Passes) {
+ Entry.setPass(&*Pass);
+
// Check the PassInstrumentation's BeforePass callbacks before running the
// pass, skip its execution completely if asked to (callback returns
// false).
if (!PI.runBeforePass<IRUnitT>(*Pass, IR))
continue;
- StackTraceEntry Entry(PI, *Pass, IR);
PreservedAnalyses PassPA = Pass->run(IR, AM, ExtraArgs...);
// Update the analysis manager as each pass runs and potentially
diff --git a/llvm/include/llvm/MC/MCAsmBackend.h b/llvm/include/llvm/MC/MCAsmBackend.h
index 7841e8a..f91c8e1 100644
--- a/llvm/include/llvm/MC/MCAsmBackend.h
+++ b/llvm/include/llvm/MC/MCAsmBackend.h
@@ -24,7 +24,6 @@ class MCFragment;
class MCLEBFragment;
class MCRelaxableFragment;
class MCSymbol;
-class MCAsmLayout;
class MCAssembler;
class MCContext;
struct MCDwarfFrameInfo;
@@ -219,8 +218,7 @@ public:
const MCSubtargetInfo *STI) const = 0;
/// Give backend an opportunity to finish layout after relaxation
- virtual void finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const {}
+ virtual void finishLayout(MCAssembler const &Asm) const {}
/// Handle any target-specific assembler flags. By default, do nothing.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {}
diff --git a/llvm/include/llvm/MC/MCAsmLayout.h b/llvm/include/llvm/MC/MCAsmLayout.h
deleted file mode 100644
index 765cc1e..0000000
--- a/llvm/include/llvm/MC/MCAsmLayout.h
+++ /dev/null
@@ -1,31 +0,0 @@
-//===- MCAsmLayout.h - Assembly Layout Object -------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_MC_MCASMLAYOUT_H
-#define LLVM_MC_MCASMLAYOUT_H
-
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
-
-namespace llvm {
-class MCAssembler;
-class MCSection;
-
-class MCAsmLayout {
- MCAssembler &Assembler;
-
-public:
- MCAsmLayout(MCAssembler &Assembler);
-
- /// Get the assembler object this is a layout for.
- MCAssembler &getAssembler() const { return Assembler; }
-};
-
-} // end namespace llvm
-
-#endif
diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h
index cc0267e..9cd65d3 100644
--- a/llvm/include/llvm/MC/MCAssembler.h
+++ b/llvm/include/llvm/MC/MCAssembler.h
@@ -46,7 +46,6 @@ class MCRelaxableFragment;
class MCSymbolRefExpr;
class raw_ostream;
class MCAsmBackend;
-class MCAsmLayout;
class MCContext;
class MCCodeEmitter;
class MCFragment;
@@ -71,8 +70,6 @@ struct DataRegionData {
};
class MCAssembler {
- friend class MCAsmLayout;
-
public:
using SectionListType = std::vector<MCSection *>;
using SymbolDataListType = std::vector<const MCSymbol *>;
@@ -118,7 +115,7 @@ private:
std::unique_ptr<MCCodeEmitter> Emitter;
std::unique_ptr<MCObjectWriter> Writer;
- MCAsmLayout *Layout = nullptr;
+ bool HasLayout = false;
bool RelaxAll = false;
bool SubsectionsViaSymbols = false;
bool IncrementalLinkerCompatible = false;
@@ -210,9 +207,6 @@ private:
bool relaxCVDefRange(MCCVDefRangeFragment &DF);
bool relaxPseudoProbeAddr(MCPseudoProbeAddrFragment &DF);
- /// finishLayout - Finalize a layout, including fragment lowering.
- void finishLayout(MCAsmLayout &Layout);
-
std::tuple<MCValue, uint64_t, bool>
handleFixup(MCFragment &F, const MCFixup &Fixup, const MCSubtargetInfo *STI);
@@ -346,7 +340,7 @@ public:
void Finish();
// Layout all section and prepare them for emission.
- void layout(MCAsmLayout &Layout);
+ void layout();
// FIXME: This does not belong here.
bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }
@@ -359,8 +353,7 @@ public:
IncrementalLinkerCompatible = Value;
}
- MCAsmLayout *getLayout() const { return Layout; }
- bool hasLayout() const { return Layout; }
+ bool hasLayout() const { return HasLayout; }
bool getRelaxAll() const { return RelaxAll; }
void setRelaxAll(bool Value) { RelaxAll = Value; }
diff --git a/llvm/include/llvm/MC/MCCodeView.h b/llvm/include/llvm/MC/MCCodeView.h
index b1d8fe3..3092327 100644
--- a/llvm/include/llvm/MC/MCCodeView.h
+++ b/llvm/include/llvm/MC/MCCodeView.h
@@ -22,7 +22,7 @@
#include <vector>
namespace llvm {
-class MCAsmLayout;
+class MCAssembler;
class MCCVDefRangeFragment;
class MCCVInlineLineTableFragment;
class MCDataFragment;
@@ -199,7 +199,7 @@ public:
const MCSymbol *FnEndSym);
/// Encodes the binary annotations once we have a layout.
- void encodeInlineLineTable(MCAsmLayout &Layout,
+ void encodeInlineLineTable(const MCAssembler &Asm,
MCCVInlineLineTableFragment &F);
MCFragment *
@@ -207,7 +207,7 @@ public:
ArrayRef<std::pair<const MCSymbol *, const MCSymbol *>> Ranges,
StringRef FixedSizePortion);
- void encodeDefRange(MCAsmLayout &Layout, MCCVDefRangeFragment &F);
+ void encodeDefRange(const MCAssembler &Asm, MCCVDefRangeFragment &F);
/// Emits the string table substream.
void emitStringTable(MCObjectStreamer &OS);
diff --git a/llvm/include/llvm/MC/MCExpr.h b/llvm/include/llvm/MC/MCExpr.h
index 40319dc..118b1dd 100644
--- a/llvm/include/llvm/MC/MCExpr.h
+++ b/llvm/include/llvm/MC/MCExpr.h
@@ -16,7 +16,6 @@
namespace llvm {
class MCAsmInfo;
-class MCAsmLayout;
class MCAssembler;
class MCContext;
class MCFixup;
@@ -54,7 +53,6 @@ private:
SMLoc Loc;
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
- const MCAsmLayout *Layout,
const SectionAddrMap *Addrs, bool InSet) const;
protected:
@@ -101,18 +99,20 @@ public:
bool evaluateAsAbsolute(int64_t &Res) const;
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const;
bool evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const;
- bool evaluateAsAbsolute(int64_t &Res, const MCAsmLayout &Layout) const;
- bool evaluateKnownAbsolute(int64_t &Res, const MCAsmLayout &Layout) const;
+ /// Aggressive variant of evaluateAsRelocatable when relocations are
+ /// unavailable (e.g. .fill). Expects callers to handle errors when true is
+ /// returned.
+ bool evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const;
/// Try to evaluate the expression to a relocatable value, i.e. an
/// expression of the fixed form (a - b + constant).
///
/// \param Res - The relocatable value, if evaluation succeeds.
- /// \param Layout - The assembler layout object to use for evaluating values.
+ /// \param Asm - The assembler object to use for evaluating values.
/// \param Fixup - The Fixup object if available.
/// \return - True on success.
- bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const;
/// Try to evaluate the expression to the form (a - b + constant) where
@@ -658,8 +658,7 @@ protected:
public:
virtual void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const = 0;
- virtual bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ virtual bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const = 0;
// allow Target Expressions to be checked for equality
virtual bool isEqualTo(const MCExpr *x) const { return false; }
diff --git a/llvm/include/llvm/MC/MCFragment.h b/llvm/include/llvm/MC/MCFragment.h
index c8832e6..ee93cb9 100644
--- a/llvm/include/llvm/MC/MCFragment.h
+++ b/llvm/include/llvm/MC/MCFragment.h
@@ -30,7 +30,6 @@ class MCSubtargetInfo;
class MCSymbol;
class MCFragment {
- friend class MCAsmLayout;
friend class MCAssembler;
friend class MCObjectStreamer;
friend class MCSection;
diff --git a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
index b91fbc6..530f288 100644
--- a/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
+++ b/llvm/include/llvm/MC/MCLinkerOptimizationHint.h
@@ -25,7 +25,7 @@
namespace llvm {
class MachObjectWriter;
-class MCAsmLayout;
+class MCAssembler;
class MCSymbol;
class raw_ostream;
@@ -108,8 +108,8 @@ class MCLOHDirective {
/// Emit this directive in \p OutStream using the information available
/// in the given \p ObjWriter and \p Layout to get the address of the
/// arguments within the object file.
- void emit_impl(raw_ostream &OutStream, const MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const;
+ void emit_impl(const MCAssembler &Asm, raw_ostream &OutStream,
+ const MachObjectWriter &ObjWriter) const;
public:
using LOHArgs = SmallVectorImpl<MCSymbol *>;
@@ -125,12 +125,12 @@ public:
/// Emit this directive as:
/// <kind, numArgs, addr1, ..., addrN>
- void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const;
+ void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const;
/// Get the size in bytes of this directive if emitted in \p ObjWriter with
/// the given \p Layout.
- uint64_t getEmitSize(const MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const;
+ uint64_t getEmitSize(const MCAssembler &Asm,
+ const MachObjectWriter &ObjWriter) const;
};
class MCLOHContainer {
@@ -157,20 +157,20 @@ public:
}
/// Get the size of the directives if emitted.
- uint64_t getEmitSize(const MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const {
+ uint64_t getEmitSize(const MCAssembler &Asm,
+ const MachObjectWriter &ObjWriter) const {
if (!EmitSize) {
for (const MCLOHDirective &D : Directives)
- EmitSize += D.getEmitSize(ObjWriter, Layout);
+ EmitSize += D.getEmitSize(Asm, ObjWriter);
}
return EmitSize;
}
/// Emit all Linker Optimization Hint in one big table.
/// Each line of the table is emitted by LOHDirective::emit.
- void emit(MachObjectWriter &ObjWriter, const MCAsmLayout &Layout) const {
+ void emit(const MCAssembler &Asm, MachObjectWriter &ObjWriter) const {
for (const MCLOHDirective &D : Directives)
- D.emit(ObjWriter, Layout);
+ D.emit(Asm, ObjWriter);
}
void reset() {
diff --git a/llvm/include/llvm/MC/MCMachObjectWriter.h b/llvm/include/llvm/MC/MCMachObjectWriter.h
index c685e27..172dadb 100644
--- a/llvm/include/llvm/MC/MCMachObjectWriter.h
+++ b/llvm/include/llvm/MC/MCMachObjectWriter.h
@@ -161,7 +161,7 @@ public:
uint64_t getSectionAddress(const MCSection *Sec) const {
return SectionAddress.lookup(Sec);
}
- uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const;
+ uint64_t getSymbolAddress(const MCSymbol &S, const MCAssembler &Asm) const;
uint64_t getFragmentAddress(const MCAssembler &Asm,
const MCFragment *Fragment) const;
@@ -212,7 +212,7 @@ public:
uint32_t FirstUndefinedSymbol, uint32_t NumUndefinedSymbols,
uint32_t IndirectSymbolOffset, uint32_t NumIndirectSymbols);
- void writeNlist(MachSymbolData &MSD, const MCAsmLayout &Layout);
+ void writeNlist(MachSymbolData &MSD, const MCAssembler &Asm);
void writeLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset,
uint32_t DataSize);
diff --git a/llvm/include/llvm/MC/MCObjectWriter.h b/llvm/include/llvm/MC/MCObjectWriter.h
index 4184c4f..0111446 100644
--- a/llvm/include/llvm/MC/MCObjectWriter.h
+++ b/llvm/include/llvm/MC/MCObjectWriter.h
@@ -15,7 +15,6 @@
namespace llvm {
-class MCAsmLayout;
class MCAssembler;
class MCFixup;
class MCFragment;
diff --git a/llvm/include/llvm/Support/LogicalResult.h b/llvm/include/llvm/Support/LogicalResult.h
new file mode 100644
index 0000000..2cfd866b
--- /dev/null
+++ b/llvm/include/llvm/Support/LogicalResult.h
@@ -0,0 +1,128 @@
+//===- LogicalResult.h - Utilities for handling success/failure -*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_LOGICALRESULT_H
+#define LLVM_SUPPORT_LOGICALRESULT_H
+
+#include <cassert>
+#include <optional>
+
+namespace llvm {
+/// This class represents an efficient way to signal success or failure. It
+/// should be preferred over the use of `bool` when appropriate, as it avoids
+/// all of the ambiguity that arises in interpreting a boolean result. This
+/// class is marked as NODISCARD to ensure that the result is processed. Users
+/// may explicitly discard a result by using `(void)`, e.g.
+/// `(void)functionThatReturnsALogicalResult();`. Given the intended nature of
+/// this class, it generally shouldn't be used as the result of functions that
+/// very frequently have the result ignored. This class is intended to be used
+/// in conjunction with the utility functions below.
+struct [[nodiscard]] LogicalResult {
+public:
+ /// If isSuccess is true a `success` result is generated, otherwise a
+ /// 'failure' result is generated.
+ static LogicalResult success(bool IsSuccess = true) {
+ return LogicalResult(IsSuccess);
+ }
+
+ /// If isFailure is true a `failure` result is generated, otherwise a
+ /// 'success' result is generated.
+ static LogicalResult failure(bool IsFailure = true) {
+ return LogicalResult(!IsFailure);
+ }
+
+ /// Returns true if the provided LogicalResult corresponds to a success value.
+ constexpr bool succeeded() const { return IsSuccess; }
+
+ /// Returns true if the provided LogicalResult corresponds to a failure value.
+ constexpr bool failed() const { return !IsSuccess; }
+
+private:
+ LogicalResult(bool IsSuccess) : IsSuccess(IsSuccess) {}
+
+ /// Boolean indicating if this is a success result, if false this is a
+ /// failure result.
+ bool IsSuccess;
+};
+
+/// Utility function to generate a LogicalResult. If isSuccess is true a
+/// `success` result is generated, otherwise a 'failure' result is generated.
+inline LogicalResult success(bool IsSuccess = true) {
+ return LogicalResult::success(IsSuccess);
+}
+
+/// Utility function to generate a LogicalResult. If isFailure is true a
+/// `failure` result is generated, otherwise a 'success' result is generated.
+inline LogicalResult failure(bool IsFailure = true) {
+ return LogicalResult::failure(IsFailure);
+}
+
+/// Utility function that returns true if the provided LogicalResult corresponds
+/// to a success value.
+inline bool succeeded(LogicalResult Result) { return Result.succeeded(); }
+
+/// Utility function that returns true if the provided LogicalResult corresponds
+/// to a failure value.
+inline bool failed(LogicalResult Result) { return Result.failed(); }
+
+/// This class provides support for representing a failure result, or a valid
+/// value of type `T`. This allows for integrating with LogicalResult, while
+/// also providing a value on the success path.
+template <typename T> class [[nodiscard]] FailureOr : public std::optional<T> {
+public:
+ /// Allow constructing from a LogicalResult. The result *must* be a failure.
+ /// Success results should use a proper instance of type `T`.
+ FailureOr(LogicalResult Result) {
+ assert(failed(Result) &&
+ "success should be constructed with an instance of 'T'");
+ }
+ FailureOr() : FailureOr(failure()) {}
+ FailureOr(T &&Y) : std::optional<T>(std::forward<T>(Y)) {}
+ FailureOr(const T &Y) : std::optional<T>(Y) {}
+ template <typename U,
+ std::enable_if_t<std::is_constructible<T, U>::value> * = nullptr>
+ FailureOr(const FailureOr<U> &Other)
+ : std::optional<T>(failed(Other) ? std::optional<T>()
+ : std::optional<T>(*Other)) {}
+
+ operator LogicalResult() const { return success(has_value()); }
+
+private:
+ /// Hide the bool conversion as it easily creates confusion.
+ using std::optional<T>::operator bool;
+ using std::optional<T>::has_value;
+};
+
+/// Wrap a value on the success path in a FailureOr of the same value type.
+template <typename T,
+ typename = std::enable_if_t<!std::is_convertible_v<T, bool>>>
+inline auto success(T &&Y) {
+ return FailureOr<std::decay_t<T>>(std::forward<T>(Y));
+}
+
+/// This class represents success/failure for parsing-like operations that find
+/// it important to chain together failable operations with `||`. This is an
+/// extended version of `LogicalResult` that allows for explicit conversion to
+/// bool.
+///
+/// This class should not be used for general error handling cases - we prefer
+/// to keep the logic explicit with the `succeeded`/`failed` predicates.
+/// However, traditional monadic-style parsing logic can sometimes get
+/// swallowed up in boilerplate without this, so we provide this for narrow
+/// cases where it is important.
+///
+class [[nodiscard]] ParseResult : public LogicalResult {
+public:
+ ParseResult(LogicalResult Result = success()) : LogicalResult(Result) {}
+
+ /// Failure is true in a boolean context.
+ constexpr explicit operator bool() const { return failed(); }
+};
+} // namespace llvm
+
+#endif // LLVM_SUPPORT_LOGICALRESULT_H
diff --git a/llvm/include/llvm/TargetParser/RISCVISAInfo.h b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
index 12f6b46..5e9cf67 100644
--- a/llvm/include/llvm/TargetParser/RISCVISAInfo.h
+++ b/llvm/include/llvm/TargetParser/RISCVISAInfo.h
@@ -87,8 +87,6 @@ private:
RISCVISAUtils::OrderedExtensionMap Exts;
- bool addExtension(StringRef ExtName, RISCVISAUtils::ExtensionVersion Version);
-
Error checkDependency();
void updateImplication();
diff --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
index 37842b1..4074b67 100644
--- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
+++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
@@ -30,7 +30,6 @@ AnalysisKey InlineSizeEstimatorAnalysis::Key;
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include <algorithm>
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 0033f0a..c52cbff 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1128,7 +1128,7 @@ static void emitKill(const MachineInstr *MI, AsmPrinter &AP) {
OS << ' ' << (Op.isDef() ? "def " : "killed ")
<< printReg(Op.getReg(), AP.MF->getSubtarget().getRegisterInfo());
}
- AP.OutStreamer->AddComment(OS.str());
+ AP.OutStreamer->AddComment(Str);
AP.OutStreamer->addBlankLine();
}
@@ -1235,7 +1235,7 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
}
// NOTE: Want this comment at start of line, don't emit with AddComment.
- AP.OutStreamer->emitRawComment(OS.str());
+ AP.OutStreamer->emitRawComment(Str);
return true;
}
@@ -2274,7 +2274,7 @@ void AsmPrinter::emitRemarksSection(remarks::RemarkStreamer &RS) {
OutContext.getObjectFileInfo()->getRemarksSection();
OutStreamer->switchSection(RemarksSection);
- OutStreamer->emitBinaryData(OS.str());
+ OutStreamer->emitBinaryData(Buf);
}
bool AsmPrinter::doFinalization(Module &M) {
@@ -3282,7 +3282,7 @@ const MCExpr *AsmPrinter::lowerConstant(const Constant *CV) {
OS << "Unsupported expression in static initializer: ";
CE->printAsOperand(OS, /*PrintType=*/false,
!MF ? nullptr : MF->getFunction().getParent());
- report_fatal_error(Twine(OS.str()));
+ report_fatal_error(Twine(S));
}
static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *C,
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
index 08e3c20..5a7013c 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp
@@ -311,7 +311,7 @@ static void EmitInlineAsmStr(const char *AsmStr, const MachineInstr *MI,
std::string msg;
raw_string_ostream Msg(msg);
Msg << "invalid operand in inline asm: '" << AsmStr << "'";
- MMI->getModule()->getContext().emitError(LocCookie, Msg.str());
+ MMI->getModule()->getContext().emitError(LocCookie, msg);
}
}
break;
@@ -411,7 +411,7 @@ void AsmPrinter::emitInlineAsm(const MachineInstr *MI) const {
}
}
- emitInlineAsm(OS.str(), getSubtargetInfo(), TM.Options.MCOptions, LocMD,
+ emitInlineAsm(StringData, getSubtargetInfo(), TM.Options.MCOptions, LocMD,
MI->getInlineAsmDialect());
// Emit the #NOAPP end marker. This has to happen even if verbose-asm isn't
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 14e6b79..552d4c9 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -3984,7 +3984,7 @@ bool IRTranslator::runOnMachineFunction(MachineFunction &CurMF) {
raw_string_ostream InstStr(InstStrStorage);
InstStr << Inst;
- R << ": '" << InstStr.str() << "'";
+ R << ": '" << InstStrStorage << "'";
}
reportTranslationError(*MF, *TPC, *ORE, R);
diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp
index 49993f7..48c3e0d 100644
--- a/llvm/lib/CodeGen/MIRPrinter.cpp
+++ b/llvm/lib/CodeGen/MIRPrinter.cpp
@@ -570,7 +570,7 @@ void MIRPrinter::convertMachineMetadataNodes(yaml::MachineFunction &YMF,
std::string NS;
raw_string_ostream StrOS(NS);
MD.second->print(StrOS, MST, MF.getFunction().getParent());
- YMF.MachineMetadataNodes.push_back(StrOS.str());
+ YMF.MachineMetadataNodes.push_back(NS);
}
}
@@ -588,7 +588,7 @@ void MIRPrinter::convert(yaml::MachineFunction &MF,
yaml::MachineConstantPoolValue YamlConstant;
YamlConstant.ID = ID++;
- YamlConstant.Value = StrOS.str();
+ YamlConstant.Value = Str;
YamlConstant.Alignment = Constant.getAlign();
YamlConstant.IsTargetSpecific = Constant.isMachineConstantPoolEntry();
@@ -608,7 +608,7 @@ void MIRPrinter::convert(ModuleSlotTracker &MST,
for (const auto *MBB : Table.MBBs) {
raw_string_ostream StrOS(Str);
StrOS << printMBBReference(*MBB);
- Entry.Blocks.push_back(StrOS.str());
+ Entry.Blocks.push_back(Str);
Str.clear();
}
YamlJTI.Entries.push_back(Entry);
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 76e5952..c7ccf10 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -804,8 +804,7 @@ MachineFunction *MachineOutliner::createOutlinedFunction(
Mg.getNameWithPrefix(MangledNameStream, F, false);
DISubprogram *OutlinedSP = DB.createFunction(
- Unit /* Context */, F->getName(), StringRef(MangledNameStream.str()),
- Unit /* File */,
+ Unit /* Context */, F->getName(), StringRef(Dummy), Unit /* File */,
0 /* Line 0 is reserved for compiler-generated code. */,
DB.createSubroutineType(
DB.getOrCreateTypeArray(std::nullopt)), /* void type */
diff --git a/llvm/lib/CodeGen/MachineSSAUpdater.cpp b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
index ffe1df4..4cbb6ad 100644
--- a/llvm/lib/CodeGen/MachineSSAUpdater.cpp
+++ b/llvm/lib/CodeGen/MachineSSAUpdater.cpp
@@ -89,8 +89,8 @@ Register LookForIdenticalPHI(MachineBasicBlock *BB,
return Register();
AvailableValsTy AVals;
- for (unsigned i = 0, e = PredValues.size(); i != e; ++i)
- AVals[PredValues[i].first] = PredValues[i].second;
+ for (const auto &[SrcBB, SrcReg] : PredValues)
+ AVals[SrcBB] = SrcReg;
while (I != BB->end() && I->isPHI()) {
bool Same = true;
for (unsigned i = 1, e = I->getNumOperands(); i != e; i += 2) {
@@ -196,8 +196,8 @@ Register MachineSSAUpdater::GetValueInMiddleOfBlock(MachineBasicBlock *BB,
InsertNewDef(TargetOpcode::PHI, BB, Loc, RegAttrs, MRI, TII);
// Fill in all the predecessors of the PHI.
- for (unsigned i = 0, e = PredValues.size(); i != e; ++i)
- InsertedPHI.addReg(PredValues[i].second).addMBB(PredValues[i].first);
+ for (const auto &[SrcBB, SrcReg] : PredValues)
+ InsertedPHI.addReg(SrcReg).addMBB(SrcBB);
// See if the PHI node can be merged to a single value. This can happen in
// loop cases when we get a PHI of itself and one other value.
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index cf72f74..4a6d5ed 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -4413,7 +4413,7 @@ struct DOTGraphTraits<ScheduleDAGMI*> : public DefaultDOTGraphTraits {
SS << "SU:" << SU->NodeNum;
if (DFS)
SS << " I:" << DFS->getNumInstrs(SU);
- return SS.str();
+ return Str;
}
static std::string getNodeDescription(const SUnit *SU, const ScheduleDAG *G) {
diff --git a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
index c848ce4..68dece6 100644
--- a/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
+++ b/llvm/lib/CodeGen/ScheduleDAGInstrs.cpp
@@ -1206,7 +1206,7 @@ std::string ScheduleDAGInstrs::getGraphNodeLabel(const SUnit *SU) const {
oss << "<exit>";
else
SU->getInstr()->print(oss, /*IsStandalone=*/true);
- return oss.str();
+ return s;
}
/// Return the basic block label. It is not necessarilly unique because a block
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 7429763..bc16f88 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -11749,7 +11749,7 @@ SDValue SelectionDAG::getSymbolFunctionGlobalAddress(SDValue Op,
raw_string_ostream ErrorFormatter(ErrorStr);
ErrorFormatter << "Undefined external symbol ";
ErrorFormatter << '"' << Symbol << '"';
- report_fatal_error(Twine(ErrorFormatter.str()));
+ report_fatal_error(Twine(ErrorStr));
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 8ce6dfc..ecdbf3e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1778,7 +1778,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
raw_string_ostream InstStr(InstStrStorage);
InstStr << *Inst;
- R << ": " << InstStr.str();
+ R << ": " << InstStrStorage;
}
reportFastISelFailure(*MF, *ORE, R, EnableFastISelAbort > 2);
@@ -1827,7 +1827,7 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
std::string InstStrStorage;
raw_string_ostream InstStr(InstStrStorage);
InstStr << *Inst;
- R << ": " << InstStr.str();
+ R << ": " << InstStrStorage;
}
reportFastISelFailure(*MF, *ORE, R, ShouldAbort);
@@ -4370,5 +4370,5 @@ void SelectionDAGISel::CannotYetSelect(SDNode *N) {
else
Msg << "unknown intrinsic #" << iid;
}
- report_fatal_error(Twine(Msg.str()));
+ report_fatal_error(Twine(msg));
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
index b66eeb6..ac28f62 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -299,7 +299,7 @@ std::string ScheduleDAGSDNodes::getGraphNodeLabel(const SUnit *SU) const {
} else {
O << "CROSS RC COPY";
}
- return O.str();
+ return s;
}
void ScheduleDAGSDNodes::getCustomGraphFeatures(GraphWriter<ScheduleDAG*> &GW) const {
diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp
index e01e7b3..3cd1bb2 100644
--- a/llvm/lib/CodeGen/TargetInstrInfo.cpp
+++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp
@@ -1750,7 +1750,7 @@ std::string TargetInstrInfo::createMIROperandComment(
OS << Info;
}
- return OS.str();
+ return Flags;
}
int FlagIdx = MI.findInlineAsmFlagIdx(OpIdx);
@@ -1784,7 +1784,7 @@ std::string TargetInstrInfo::createMIROperandComment(
F.getRegMayBeFolded())
OS << " foldable";
- return OS.str();
+ return Flags;
}
TargetInstrInfo::PipelinerLoopInfo::~PipelinerLoopInfo() = default;
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index e7e729f..bcc6dfe 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -21,7 +21,6 @@
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
@@ -567,7 +566,7 @@ void ELFWriter::writeSymbol(const MCAssembler &Asm, SymbolTableWriter &Writer,
if (ESize) {
int64_t Res;
- if (!ESize->evaluateKnownAbsolute(Res, *Asm.getLayout()))
+ if (!ESize->evaluateKnownAbsolute(Res, Asm))
report_fatal_error("Size expression must be absolute.");
Size = Res;
}
diff --git a/llvm/lib/MC/GOFFObjectWriter.cpp b/llvm/lib/MC/GOFFObjectWriter.cpp
index 9c43ef1a..76f3735 100644
--- a/llvm/lib/MC/GOFFObjectWriter.cpp
+++ b/llvm/lib/MC/GOFFObjectWriter.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/BinaryFormat/GOFF.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCGOFFObjectWriter.h"
#include "llvm/MC/MCValue.h"
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index 53bebdc..14790f5 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -15,7 +15,6 @@
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCContext.h"
@@ -187,7 +186,7 @@ bool MCAssembler::evaluateFixup(const MCFixup &Fixup, const MCFragment *DF,
MCContext &Ctx = getContext();
Value = 0;
WasForced = false;
- if (!Expr->evaluateAsRelocatable(Target, Layout, &Fixup)) {
+ if (!Expr->evaluateAsRelocatable(Target, this, &Fixup)) {
Ctx.reportError(Fixup.getLoc(), "expected relocatable expression");
return true;
}
@@ -288,7 +287,7 @@ uint64_t MCAssembler::computeFragmentSize(const MCFragment &F) const {
case MCFragment::FT_Fill: {
auto &FF = cast<MCFillFragment>(F);
int64_t NumValues = 0;
- if (!FF.getNumValues().evaluateKnownAbsolute(NumValues, *Layout)) {
+ if (!FF.getNumValues().evaluateKnownAbsolute(NumValues, *this)) {
getContext().reportError(FF.getLoc(),
"expected assembly-time absolute expression");
return 0;
@@ -381,8 +380,6 @@ uint64_t MCAssembler::computeFragmentSize(const MCFragment &F) const {
llvm_unreachable("invalid fragment kind");
}
-MCAsmLayout::MCAsmLayout(MCAssembler &Asm) : Assembler(Asm) {}
-
// Compute the amount of padding required before the fragment \p F to
// obey bundling restrictions, where \p FOffset is the fragment's offset in
// its section and \p FSize is the fragment's size.
@@ -547,7 +544,7 @@ uint64_t MCAssembler::getSymbolOffset(const MCSymbol &S) const {
}
const MCSymbol *MCAssembler::getBaseSymbol(const MCSymbol &Symbol) const {
- assert(Layout);
+ assert(HasLayout);
if (!Symbol.isVariable())
return &Symbol;
@@ -584,6 +581,7 @@ const MCSymbol *MCAssembler::getBaseSymbol(const MCSymbol &Symbol) const {
}
uint64_t MCAssembler::getSectionAddressSize(const MCSection &Sec) const {
+ assert(HasLayout);
// The size is the last fragment's end offset.
const MCFragment &F = *Sec.curFragList()->Tail;
return getFragmentOffset(F) + computeFragmentSize(F);
@@ -937,7 +935,7 @@ MCAssembler::handleFixup(MCFragment &F, const MCFixup &Fixup,
return std::make_tuple(Target, FixedValue, IsResolved);
}
-void MCAssembler::layout(MCAsmLayout &Layout) {
+void MCAssembler::layout() {
assert(getBackendPtr() && "Expected assembler backend");
DEBUG_WITH_TYPE("mc-dump", {
errs() << "assembler backend - pre-layout\n--\n";
@@ -968,7 +966,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
}
// Layout until everything fits.
- this->Layout = &Layout;
+ this->HasLayout = true;
while (layoutOnce()) {
if (getContext().hadError())
return;
@@ -984,7 +982,7 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
dump(); });
// Finalize the layout, including fragment lowering.
- finishLayout(Layout);
+ getBackend().finishLayout(*this);
DEBUG_WITH_TYPE("mc-dump", {
errs() << "assembler backend - final-layout\n--\n";
@@ -1074,14 +1072,12 @@ void MCAssembler::layout(MCAsmLayout &Layout) {
}
void MCAssembler::Finish() {
- // Create the layout object.
- MCAsmLayout Layout(*this);
- layout(Layout);
+ layout();
// Write the object file.
stats::ObjectBytes += getWriter().writeObject(*this);
- this->Layout = nullptr;
+ HasLayout = false;
}
bool MCAssembler::fixupNeedsRelaxation(const MCFixup &Fixup,
@@ -1150,8 +1146,8 @@ bool MCAssembler::relaxLEB(MCLEBFragment &LF) {
// requires that .uleb128 A-B is foldable where A and B reside in different
// fragments. This is used by __gcc_except_table.
bool Abs = getSubsectionsViaSymbols()
- ? LF.getValue().evaluateKnownAbsolute(Value, *Layout)
- : LF.getValue().evaluateAsAbsolute(Value, *Layout);
+ ? LF.getValue().evaluateKnownAbsolute(Value, *this)
+ : LF.getValue().evaluateAsAbsolute(Value, *this);
if (!Abs) {
bool Relaxed, UseZeroPad;
std::tie(Relaxed, UseZeroPad) = getBackend().relaxLEB128(*this, LF, Value);
@@ -1248,7 +1244,7 @@ bool MCAssembler::relaxDwarfLineAddr(MCDwarfLineAddrFragment &DF) {
MCContext &Context = getContext();
uint64_t OldSize = DF.getContents().size();
int64_t AddrDelta;
- bool Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, *Layout);
+ bool Abs = DF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, *this);
assert(Abs && "We created a line delta with an invalid expression");
(void)Abs;
int64_t LineDelta;
@@ -1269,7 +1265,7 @@ bool MCAssembler::relaxDwarfCallFrameFragment(MCDwarfCallFrameFragment &DF) {
MCContext &Context = getContext();
int64_t Value;
- bool Abs = DF.getAddrDelta().evaluateAsAbsolute(Value, *Layout);
+ bool Abs = DF.getAddrDelta().evaluateAsAbsolute(Value, *this);
if (!Abs) {
getContext().reportError(DF.getAddrDelta().getLoc(),
"invalid CFI advance_loc expression");
@@ -1288,20 +1284,20 @@ bool MCAssembler::relaxDwarfCallFrameFragment(MCDwarfCallFrameFragment &DF) {
bool MCAssembler::relaxCVInlineLineTable(MCCVInlineLineTableFragment &F) {
unsigned OldSize = F.getContents().size();
- getContext().getCVContext().encodeInlineLineTable(*Layout, F);
+ getContext().getCVContext().encodeInlineLineTable(*this, F);
return OldSize != F.getContents().size();
}
bool MCAssembler::relaxCVDefRange(MCCVDefRangeFragment &F) {
unsigned OldSize = F.getContents().size();
- getContext().getCVContext().encodeDefRange(*Layout, F);
+ getContext().getCVContext().encodeDefRange(*this, F);
return OldSize != F.getContents().size();
}
bool MCAssembler::relaxPseudoProbeAddr(MCPseudoProbeAddrFragment &PF) {
uint64_t OldSize = PF.getContents().size();
int64_t AddrDelta;
- bool Abs = PF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, *Layout);
+ bool Abs = PF.getAddrDelta().evaluateKnownAbsolute(AddrDelta, *this);
assert(Abs && "We created a pseudo probe with an invalid expression");
(void)Abs;
SmallVectorImpl<char> &Data = PF.getContents();
@@ -1350,11 +1346,6 @@ bool MCAssembler::layoutOnce() {
return Changed;
}
-void MCAssembler::finishLayout(MCAsmLayout &Layout) {
- assert(getBackendPtr() && "Expected assembler backend");
- getBackend().finishLayout(*this, Layout);
-}
-
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void MCAssembler::dump() const{
raw_ostream &OS = errs();
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index 89b28b4..792a132 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -16,7 +16,6 @@
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectStreamer.h"
@@ -465,16 +464,16 @@ MCFragment *CodeViewContext::emitDefRange(
return F;
}
-static unsigned computeLabelDiff(MCAsmLayout &Layout, const MCSymbol *Begin,
+static unsigned computeLabelDiff(const MCAssembler &Asm, const MCSymbol *Begin,
const MCSymbol *End) {
- MCContext &Ctx = Layout.getAssembler().getContext();
+ MCContext &Ctx = Asm.getContext();
MCSymbolRefExpr::VariantKind Variant = MCSymbolRefExpr::VK_None;
const MCExpr *BeginRef = MCSymbolRefExpr::create(Begin, Variant, Ctx),
*EndRef = MCSymbolRefExpr::create(End, Variant, Ctx);
const MCExpr *AddrDelta =
MCBinaryExpr::create(MCBinaryExpr::Sub, EndRef, BeginRef, Ctx);
int64_t Result;
- bool Success = AddrDelta->evaluateKnownAbsolute(Result, Layout);
+ bool Success = AddrDelta->evaluateKnownAbsolute(Result, Asm);
assert(Success && "failed to evaluate label difference as absolute");
(void)Success;
assert(Result >= 0 && "negative label difference requested");
@@ -482,7 +481,7 @@ static unsigned computeLabelDiff(MCAsmLayout &Layout, const MCSymbol *Begin,
return unsigned(Result);
}
-void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
+void CodeViewContext::encodeInlineLineTable(const MCAssembler &Asm,
MCCVInlineLineTableFragment &Frag) {
size_t LocBegin;
size_t LocEnd;
@@ -549,7 +548,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
// We've hit a cv_loc not attributed to this inline call site. Use this
// label to end the PC range.
if (HaveOpenRange) {
- unsigned Length = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
+ unsigned Length = computeLabelDiff(Asm, LastLabel, Loc.getLabel());
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(Length, Buffer);
LastLabel = Loc.getLabel();
@@ -579,7 +578,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
int LineDelta = CurSourceLoc.Line - LastSourceLoc.Line;
unsigned EncodedLineDelta = encodeSignedNumber(LineDelta);
- unsigned CodeDelta = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
+ unsigned CodeDelta = computeLabelDiff(Asm, LastLabel, Loc.getLabel());
if (EncodedLineDelta < 0x8 && CodeDelta <= 0xf) {
// The ChangeCodeOffsetAndLineOffset combination opcode is used when the
// encoded line delta uses 3 or fewer set bits and the code offset fits
@@ -605,23 +604,23 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
assert(HaveOpenRange);
unsigned EndSymLength =
- computeLabelDiff(Layout, LastLabel, Frag.getFnEndSym());
+ computeLabelDiff(Asm, LastLabel, Frag.getFnEndSym());
unsigned LocAfterLength = ~0U;
ArrayRef<MCCVLoc> LocAfter = getLinesForExtent(LocEnd, LocEnd + 1);
if (!LocAfter.empty()) {
// Only try to compute this difference if we're in the same section.
const MCCVLoc &Loc = LocAfter[0];
if (&Loc.getLabel()->getSection() == &LastLabel->getSection())
- LocAfterLength = computeLabelDiff(Layout, LastLabel, Loc.getLabel());
+ LocAfterLength = computeLabelDiff(Asm, LastLabel, Loc.getLabel());
}
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(std::min(EndSymLength, LocAfterLength), Buffer);
}
-void CodeViewContext::encodeDefRange(MCAsmLayout &Layout,
+void CodeViewContext::encodeDefRange(const MCAssembler &Asm,
MCCVDefRangeFragment &Frag) {
- MCContext &Ctx = Layout.getAssembler().getContext();
+ MCContext &Ctx = Asm.getContext();
SmallVectorImpl<char> &Contents = Frag.getContents();
Contents.clear();
SmallVectorImpl<MCFixup> &Fixups = Frag.getFixups();
@@ -633,8 +632,8 @@ void CodeViewContext::encodeDefRange(MCAsmLayout &Layout,
const MCSymbol *LastLabel = nullptr;
for (std::pair<const MCSymbol *, const MCSymbol *> Range : Frag.getRanges()) {
unsigned GapSize =
- LastLabel ? computeLabelDiff(Layout, LastLabel, Range.first) : 0;
- unsigned RangeSize = computeLabelDiff(Layout, Range.first, Range.second);
+ LastLabel ? computeLabelDiff(Asm, LastLabel, Range.first) : 0;
+ unsigned RangeSize = computeLabelDiff(Asm, Range.first, Range.second);
GapAndRangeSizes.push_back({GapSize, RangeSize});
LastLabel = Range.second;
}
diff --git a/llvm/lib/MC/MCDXContainerWriter.cpp b/llvm/lib/MC/MCDXContainerWriter.cpp
index 002fe2f..6b42d38 100644
--- a/llvm/lib/MC/MCDXContainerWriter.cpp
+++ b/llvm/lib/MC/MCDXContainerWriter.cpp
@@ -8,7 +8,6 @@
#include "llvm/MC/MCDXContainerWriter.h"
#include "llvm/BinaryFormat/DXContainer.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSection.h"
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index af9dcff..b42a668 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -12,7 +12,6 @@
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectWriter.h"
@@ -545,37 +544,29 @@ void MCTargetExpr::anchor() {}
/* *** */
bool MCExpr::evaluateAsAbsolute(int64_t &Res) const {
- return evaluateAsAbsolute(Res, nullptr, nullptr, nullptr, false);
-}
-
-bool MCExpr::evaluateAsAbsolute(int64_t &Res,
- const MCAsmLayout &Layout) const {
- return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr, false);
+ return evaluateAsAbsolute(Res, nullptr, nullptr, false);
}
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm,
const SectionAddrMap &Addrs) const {
// Setting InSet causes us to absolutize differences across sections and that
// is what the MachO writer uses Addrs for.
- return evaluateAsAbsolute(Res, &Asm, Asm.getLayout(), &Addrs, true);
+ return evaluateAsAbsolute(Res, &Asm, &Addrs, true);
}
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler &Asm) const {
- return evaluateAsAbsolute(Res, &Asm, nullptr, nullptr, false);
+ return evaluateAsAbsolute(Res, &Asm, nullptr, false);
}
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm) const {
- return evaluateAsAbsolute(Res, Asm, nullptr, nullptr, false);
+ return evaluateAsAbsolute(Res, Asm, nullptr, false);
}
-bool MCExpr::evaluateKnownAbsolute(int64_t &Res,
- const MCAsmLayout &Layout) const {
- return evaluateAsAbsolute(Res, &Layout.getAssembler(), &Layout, nullptr,
- true);
+bool MCExpr::evaluateKnownAbsolute(int64_t &Res, const MCAssembler &Asm) const {
+ return evaluateAsAbsolute(Res, &Asm, nullptr, true);
}
bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
- const MCAsmLayout *Layout,
const SectionAddrMap *Addrs, bool InSet) const {
MCValue Value;
@@ -634,7 +625,7 @@ static void AttemptToFoldSymbolOffsetDifference(
// separated by a linker-relaxable instruction. If the section contains
// instructions and InSet is false (not expressions in directive like
// .size/.fill), disable the fast path.
- const MCAsmLayout *Layout = Asm->getLayout();
+ bool Layout = Asm->hasLayout();
if (Layout && (InSet || !SecA.hasInstructions() ||
!(Asm->getContext().getTargetTriple().isRISCV() ||
Asm->getContext().getTargetTriple().isLoongArch()))) {
@@ -795,11 +786,9 @@ static bool evaluateSymbolicAdd(const MCAssembler *Asm,
return true;
}
-bool MCExpr::evaluateAsRelocatable(MCValue &Res,
- const MCAsmLayout *Layout,
+bool MCExpr::evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
- MCAssembler *Assembler = Layout ? &Layout->getAssembler() : nullptr;
- return evaluateAsRelocatableImpl(Res, Assembler, Fixup, nullptr, false);
+ return evaluateAsRelocatableImpl(Res, Asm, Fixup, nullptr, false);
}
bool MCExpr::evaluateAsValue(MCValue &Res, const MCAssembler &Asm) const {
@@ -827,11 +816,9 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const SectionAddrMap *Addrs,
bool InSet) const {
++stats::MCExprEvaluate;
- MCAsmLayout *Layout = Asm ? Asm->getLayout() : nullptr;
switch (getKind()) {
case Target:
- return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Layout,
- Fixup);
+ return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Asm, Fixup);
case Constant:
Res = MCValue::get(cast<MCConstantExpr>(this)->getValue());
@@ -841,6 +828,7 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCSymbolRefExpr *SRE = cast<MCSymbolRefExpr>(this);
const MCSymbol &Sym = SRE->getSymbol();
const auto Kind = SRE->getKind();
+ bool Layout = Asm && Asm->hasLayout();
// Evaluate recursively if this is a variable.
if (Sym.isVariable() && (Kind == MCSymbolRefExpr::VK_None || Layout) &&
diff --git a/llvm/lib/MC/MCLinkerOptimizationHint.cpp b/llvm/lib/MC/MCLinkerOptimizationHint.cpp
index 9ab3218..a0901af 100644
--- a/llvm/lib/MC/MCLinkerOptimizationHint.cpp
+++ b/llvm/lib/MC/MCLinkerOptimizationHint.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCLinkerOptimizationHint.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/raw_ostream.h"
@@ -24,23 +23,24 @@ using namespace llvm;
// - Its argN.
// <arg1> to <argN> are absolute addresses in the object file, i.e.,
// relative addresses from the beginning of the object file.
-void MCLOHDirective::emit_impl(raw_ostream &OutStream,
- const MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const {
+void MCLOHDirective::emit_impl(const MCAssembler &Asm, raw_ostream &OutStream,
+ const MachObjectWriter &ObjWriter
+
+) const {
encodeULEB128(Kind, OutStream);
encodeULEB128(Args.size(), OutStream);
for (const MCSymbol *Arg : Args)
- encodeULEB128(ObjWriter.getSymbolAddress(*Arg, Layout), OutStream);
+ encodeULEB128(ObjWriter.getSymbolAddress(*Arg, Asm), OutStream);
}
-void MCLOHDirective::emit(MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const {
+void MCLOHDirective::emit(const MCAssembler &Asm,
+ MachObjectWriter &ObjWriter) const {
raw_ostream &OutStream = ObjWriter.W.OS;
- emit_impl(OutStream, ObjWriter, Layout);
+ emit_impl(Asm, OutStream, ObjWriter);
}
-uint64_t MCLOHDirective::getEmitSize(const MachObjectWriter &ObjWriter,
- const MCAsmLayout &Layout) const {
+uint64_t MCLOHDirective::getEmitSize(const MCAssembler &Asm,
+ const MachObjectWriter &ObjWriter) const {
class raw_counting_ostream : public raw_ostream {
uint64_t Count = 0;
@@ -54,6 +54,6 @@ uint64_t MCLOHDirective::getEmitSize(const MachObjectWriter &ObjWriter,
};
raw_counting_ostream OutStream;
- emit_impl(OutStream, ObjWriter, Layout);
+ emit_impl(Asm, OutStream, ObjWriter);
return OutStream.tell();
}
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 258dd69..3f5bdd8 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -11,7 +11,6 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAsmInfoDarwin.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -91,7 +90,7 @@ MachObjectWriter::getFragmentAddress(const MCAssembler &Asm,
}
uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
- const MCAsmLayout &Layout) const {
+ const MCAssembler &Asm) const {
// If this is a variable, then recursively evaluate now.
if (S.isVariable()) {
if (const MCConstantExpr *C =
@@ -99,7 +98,7 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
return C->getValue();
MCValue Target;
- if (!S.getVariableValue()->evaluateAsRelocatable(Target, &Layout, nullptr))
+ if (!S.getVariableValue()->evaluateAsRelocatable(Target, &Asm, nullptr))
report_fatal_error("unable to evaluate offset for variable '" +
S.getName() + "'");
@@ -113,14 +112,14 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
uint64_t Address = Target.getConstant();
if (Target.getSymA())
- Address += getSymbolAddress(Target.getSymA()->getSymbol(), Layout);
+ Address += getSymbolAddress(Target.getSymA()->getSymbol(), Asm);
if (Target.getSymB())
- Address += getSymbolAddress(Target.getSymB()->getSymbol(), Layout);
+ Address += getSymbolAddress(Target.getSymB()->getSymbol(), Asm);
return Address;
}
return getSectionAddress(S.getFragment()->getParent()) +
- Layout.getAssembler().getSymbolOffset(S);
+ Asm.getSymbolOffset(S);
}
uint64_t MachObjectWriter::getPaddingSize(const MCAssembler &Asm,
@@ -370,8 +369,7 @@ const MCSymbol &MachObjectWriter::findAliasedSymbol(const MCSymbol &Sym) const {
return *S;
}
-void MachObjectWriter::writeNlist(MachSymbolData &MSD,
- const MCAsmLayout &Layout) {
+void MachObjectWriter::writeNlist(MachSymbolData &MSD, const MCAssembler &Asm) {
const MCSymbol *Symbol = MSD.Symbol;
const MCSymbol &Data = *Symbol;
const MCSymbol *AliasedSymbol = &findAliasedSymbol(*Symbol);
@@ -415,7 +413,7 @@ void MachObjectWriter::writeNlist(MachSymbolData &MSD,
if (IsAlias && Symbol->isUndefined())
Address = AliaseeInfo->StringIndex;
else if (Symbol->isDefined())
- Address = getSymbolAddress(OrigSymbol, Layout);
+ Address = getSymbolAddress(OrigSymbol, Asm);
else if (Symbol->isCommon()) {
// Common symbols are encoded with the size in the address
// field, and their alignment in the flags.
@@ -780,7 +778,6 @@ void MachObjectWriter::populateAddrSigSection(MCAssembler &Asm) {
}
uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
- auto &Layout = *Asm.getLayout();
uint64_t StartOffset = W.OS.tell();
populateAddrSigSection(Asm);
@@ -842,7 +839,7 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
}
// Add the loh load command size, if used.
- uint64_t LOHRawSize = Asm.getLOHContainer().getEmitSize(*this, Layout);
+ uint64_t LOHRawSize = Asm.getLOHContainer().getEmitSize(Asm, *this);
uint64_t LOHSize = alignTo(LOHRawSize, is64Bit() ? 8 : 4);
if (LOHSize) {
++NumLoadCommands;
@@ -1036,10 +1033,10 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
it = Asm.data_region_begin(), ie = Asm.data_region_end();
it != ie; ++it) {
const DataRegionData *Data = &(*it);
- uint64_t Start = getSymbolAddress(*Data->Start, Layout);
+ uint64_t Start = getSymbolAddress(*Data->Start, Asm);
uint64_t End;
if (Data->End)
- End = getSymbolAddress(*Data->End, Layout);
+ End = getSymbolAddress(*Data->End, Asm);
else
report_fatal_error("Data region not terminated");
@@ -1058,7 +1055,7 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
#ifndef NDEBUG
unsigned Start = W.OS.tell();
#endif
- Asm.getLOHContainer().emit(*this, Layout);
+ Asm.getLOHContainer().emit(Asm, *this);
// Pad to a multiple of the pointer size.
W.OS.write_zeros(
offsetToAlignment(LOHRawSize, is64Bit() ? Align(8) : Align(4)));
@@ -1095,7 +1092,7 @@ uint64_t MachObjectWriter::writeObject(MCAssembler &Asm) {
for (auto *SymbolData :
{&LocalSymbolData, &ExternalSymbolData, &UndefinedSymbolData})
for (MachSymbolData &Entry : *SymbolData)
- writeNlist(Entry, Layout);
+ writeNlist(Entry, Asm);
// Write the string table.
StringTable.write(W.OS);
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 5602c9b..f25dc92 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -15,7 +15,6 @@
#include "llvm/BinaryFormat/WasmTraits.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@@ -299,11 +298,10 @@ private:
void executePostLayoutBinding(MCAssembler &Asm) override;
void prepareImports(SmallVectorImpl<wasm::WasmImport> &Imports,
- MCAssembler &Asm, const MCAsmLayout &Layout);
+ MCAssembler &Asm);
uint64_t writeObject(MCAssembler &Asm) override;
- uint64_t writeOneObject(MCAssembler &Asm, const MCAsmLayout &Layout,
- DwoMode Mode);
+ uint64_t writeOneObject(MCAssembler &Asm, DwoMode Mode);
void writeString(const StringRef Str) {
encodeULEB128(Str.size(), W->OS);
@@ -334,9 +332,9 @@ private:
void writeElemSection(const MCSymbolWasm *IndirectFunctionTable,
ArrayRef<uint32_t> TableElems);
void writeDataCountSection();
- uint32_t writeCodeSection(const MCAssembler &Asm, const MCAsmLayout &Layout,
+ uint32_t writeCodeSection(const MCAssembler &Asm,
ArrayRef<WasmFunction> Functions);
- uint32_t writeDataSection(const MCAsmLayout &Layout);
+ uint32_t writeDataSection(const MCAssembler &Asm);
void writeTagSection(ArrayRef<uint32_t> TagTypes);
void writeGlobalSection(ArrayRef<wasm::WasmGlobal> Globals);
void writeTableSection(ArrayRef<wasm::WasmTable> Tables);
@@ -347,13 +345,13 @@ private:
ArrayRef<std::pair<uint16_t, uint32_t>> InitFuncs,
const std::map<StringRef, std::vector<WasmComdatEntry>> &Comdats);
void writeCustomSection(WasmCustomSection &CustomSection,
- const MCAssembler &Asm, const MCAsmLayout &Layout);
+ const MCAssembler &Asm);
void writeCustomRelocSections();
uint64_t getProvisionalValue(const MCAssembler &Asm,
const WasmRelocationEntry &RelEntry);
void applyRelocations(ArrayRef<WasmRelocationEntry> Relocations,
- uint64_t ContentsOffset, const MCAsmLayout &Layout);
+ uint64_t ContentsOffset, const MCAssembler &Asm);
uint32_t getRelocationIndexValue(const WasmRelocationEntry &RelEntry);
uint32_t getFunctionType(const MCSymbolWasm &Symbol);
@@ -764,7 +762,7 @@ WasmObjectWriter::getRelocationIndexValue(const WasmRelocationEntry &RelEntry) {
// directly.
void WasmObjectWriter::applyRelocations(
ArrayRef<WasmRelocationEntry> Relocations, uint64_t ContentsOffset,
- const MCAsmLayout &Layout) {
+ const MCAssembler &Asm) {
auto &Stream = static_cast<raw_pwrite_stream &>(W->OS);
for (const WasmRelocationEntry &RelEntry : Relocations) {
uint64_t Offset = ContentsOffset +
@@ -772,7 +770,7 @@ void WasmObjectWriter::applyRelocations(
RelEntry.Offset;
LLVM_DEBUG(dbgs() << "applyRelocation: " << RelEntry << "\n");
- uint64_t Value = getProvisionalValue(Layout.getAssembler(), RelEntry);
+ uint64_t Value = getProvisionalValue(Asm, RelEntry);
switch (RelEntry.Type) {
case wasm::R_WASM_FUNCTION_INDEX_LEB:
@@ -1049,7 +1047,6 @@ void WasmObjectWriter::writeDataCountSection() {
}
uint32_t WasmObjectWriter::writeCodeSection(const MCAssembler &Asm,
- const MCAsmLayout &Layout,
ArrayRef<WasmFunction> Functions) {
if (Functions.empty())
return 0;
@@ -1069,13 +1066,13 @@ uint32_t WasmObjectWriter::writeCodeSection(const MCAssembler &Asm,
}
// Apply fixups.
- applyRelocations(CodeRelocations, Section.ContentsOffset, Layout);
+ applyRelocations(CodeRelocations, Section.ContentsOffset, Asm);
endSection(Section);
return Section.Index;
}
-uint32_t WasmObjectWriter::writeDataSection(const MCAsmLayout &Layout) {
+uint32_t WasmObjectWriter::writeDataSection(const MCAssembler &Asm) {
if (DataSegments.empty())
return 0;
@@ -1100,7 +1097,7 @@ uint32_t WasmObjectWriter::writeDataSection(const MCAsmLayout &Layout) {
}
// Apply fixups.
- applyRelocations(DataRelocations, Section.ContentsOffset, Layout);
+ applyRelocations(DataRelocations, Section.ContentsOffset, Asm);
endSection(Section);
return Section.Index;
@@ -1239,8 +1236,7 @@ void WasmObjectWriter::writeLinkingMetaDataSection(
}
void WasmObjectWriter::writeCustomSection(WasmCustomSection &CustomSection,
- const MCAssembler &Asm,
- const MCAsmLayout &Layout) {
+ const MCAssembler &Asm) {
SectionBookkeeping Section;
auto *Sec = CustomSection.Section;
startCustomSection(Section, CustomSection.Name);
@@ -1255,7 +1251,7 @@ void WasmObjectWriter::writeCustomSection(WasmCustomSection &CustomSection,
// Apply fixups.
auto &Relocations = CustomSectionsRelocations[CustomSection.Section];
- applyRelocations(Relocations, CustomSection.OutputContentsOffset, Layout);
+ applyRelocations(Relocations, CustomSection.OutputContentsOffset, Asm);
}
uint32_t WasmObjectWriter::getFunctionType(const MCSymbolWasm &Symbol) {
@@ -1331,8 +1327,7 @@ static bool isInSymtab(const MCSymbolWasm &Sym) {
}
void WasmObjectWriter::prepareImports(
- SmallVectorImpl<wasm::WasmImport> &Imports, MCAssembler &Asm,
- const MCAsmLayout &Layout) {
+ SmallVectorImpl<wasm::WasmImport> &Imports, MCAssembler &Asm) {
// For now, always emit the memory import, since loads and stores are not
// valid without it. In the future, we could perhaps be more clever and omit
// it if there are no loads or stores.
@@ -1437,22 +1432,20 @@ void WasmObjectWriter::prepareImports(
}
uint64_t WasmObjectWriter::writeObject(MCAssembler &Asm) {
- auto &Layout = *Asm.getLayout();
support::endian::Writer MainWriter(*OS, llvm::endianness::little);
W = &MainWriter;
if (IsSplitDwarf) {
- uint64_t TotalSize = writeOneObject(Asm, Layout, DwoMode::NonDwoOnly);
+ uint64_t TotalSize = writeOneObject(Asm, DwoMode::NonDwoOnly);
assert(DwoOS);
support::endian::Writer DwoWriter(*DwoOS, llvm::endianness::little);
W = &DwoWriter;
- return TotalSize + writeOneObject(Asm, Layout, DwoMode::DwoOnly);
+ return TotalSize + writeOneObject(Asm, DwoMode::DwoOnly);
} else {
- return writeOneObject(Asm, Layout, DwoMode::AllSections);
+ return writeOneObject(Asm, DwoMode::AllSections);
}
}
uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
- const MCAsmLayout &Layout,
DwoMode Mode) {
uint64_t StartOffset = W->OS.tell();
SectionCount = 0;
@@ -1472,9 +1465,8 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
SmallVector<std::pair<uint16_t, uint32_t>, 2> InitFuncs;
std::map<StringRef, std::vector<WasmComdatEntry>> Comdats;
uint64_t DataSize = 0;
- if (Mode != DwoMode::DwoOnly) {
- prepareImports(Imports, Asm, Layout);
- }
+ if (Mode != DwoMode::DwoOnly)
+ prepareImports(Imports, Asm);
// Populate DataSegments and CustomSections, which must be done before
// populating DataLocations.
@@ -1633,7 +1625,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
WS.getName());
int64_t Size = 0;
- if (!WS.getSize()->evaluateAsAbsolute(Size, Layout))
+ if (!WS.getSize()->evaluateAsAbsolute(Size, Asm))
report_fatal_error(".size expression must be evaluatable");
auto &DataSection = static_cast<MCSectionWasm &>(WS.getSection());
@@ -1752,7 +1744,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
// size of the alias. When an offset from the base is involved this
// can result in a offset + size goes past the end of the data section
// which out object format doesn't support. So we must clamp it.
- if (!Base->getSize()->evaluateAsAbsolute(Size, Layout))
+ if (!Base->getSize()->evaluateAsAbsolute(Size, Asm))
report_fatal_error(".size expression must be evaluatable");
const WasmDataSegment &Segment =
DataSegments[DataSection.getSegmentIndex()];
@@ -1926,8 +1918,8 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
TableElems);
writeDataCountSection();
- CodeSectionIndex = writeCodeSection(Asm, Layout, Functions);
- DataSectionIndex = writeDataSection(Layout);
+ CodeSectionIndex = writeCodeSection(Asm, Functions);
+ DataSectionIndex = writeDataSection(Asm);
}
// The Sections in the COMDAT list have placeholder indices (their index among
@@ -1940,7 +1932,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
}
}
for (auto &CustomSection : CustomSections)
- writeCustomSection(CustomSection, Asm, Layout);
+ writeCustomSection(CustomSection, Asm);
if (Mode != DwoMode::DwoOnly) {
writeLinkingMetaDataSection(SymbolInfos, InitFuncs, Comdats);
@@ -1950,9 +1942,9 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
}
writeCustomRelocSections();
if (ProducersSection)
- writeCustomSection(*ProducersSection, Asm, Layout);
+ writeCustomSection(*ProducersSection, Asm);
if (TargetFeaturesSection)
- writeCustomSection(*TargetFeaturesSection, Asm, Layout);
+ writeCustomSection(*TargetFeaturesSection, Asm);
// TODO: Translate the .comment section to the output.
return W->OS.tell() - StartOffset;
diff --git a/llvm/lib/MC/WinCOFFObjectWriter.cpp b/llvm/lib/MC/WinCOFFObjectWriter.cpp
index cd20985..c0bad19 100644
--- a/llvm/lib/MC/WinCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/WinCOFFObjectWriter.cpp
@@ -18,7 +18,6 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/COFF.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@@ -188,15 +187,13 @@ private:
void WriteAuxiliarySymbols(const COFFSymbol::AuxiliarySymbols &S);
void writeSectionHeaders();
void WriteRelocation(const COFF::relocation &R);
- uint32_t writeSectionContents(MCAssembler &Asm, const MCAsmLayout &Layout,
- const MCSection &MCSec);
- void writeSection(MCAssembler &Asm, const MCAsmLayout &Layout,
- const COFFSection &Sec);
+ uint32_t writeSectionContents(MCAssembler &Asm, const MCSection &MCSec);
+ void writeSection(MCAssembler &Asm, const COFFSection &Sec);
void createFileSymbols(MCAssembler &Asm);
void setWeakDefaultNames();
void assignSectionNumbers();
- void assignFileOffsets(MCAssembler &Asm, const MCAsmLayout &Layout);
+ void assignFileOffsets(MCAssembler &Asm);
};
class WinCOFFObjectWriter : public MCObjectWriter {
@@ -601,7 +598,6 @@ void WinCOFFWriter::WriteRelocation(const COFF::relocation &R) {
// "Asm.writeSectionData(&MCSec)", but it's a bit complicated
// because it needs to compute a CRC.
uint32_t WinCOFFWriter::writeSectionContents(MCAssembler &Asm,
- const MCAsmLayout &Layout,
const MCSection &MCSec) {
// Save the contents of the section to a temporary buffer, we need this
// to CRC the data before we dump it into the object file.
@@ -619,8 +615,7 @@ uint32_t WinCOFFWriter::writeSectionContents(MCAssembler &Asm,
return JC.getCRC();
}
-void WinCOFFWriter::writeSection(MCAssembler &Asm, const MCAsmLayout &Layout,
- const COFFSection &Sec) {
+void WinCOFFWriter::writeSection(MCAssembler &Asm, const COFFSection &Sec) {
if (Sec.Number == -1)
return;
@@ -629,7 +624,7 @@ void WinCOFFWriter::writeSection(MCAssembler &Asm, const MCAsmLayout &Layout,
assert(W.OS.tell() == Sec.Header.PointerToRawData &&
"Section::PointerToRawData is insane!");
- uint32_t CRC = writeSectionContents(Asm, Layout, *Sec.MCSection);
+ uint32_t CRC = writeSectionContents(Asm, *Sec.MCSection);
// Update the section definition auxiliary symbol to record the CRC.
COFFSymbol::AuxiliarySymbols &AuxSyms = Sec.Symbol->Aux;
@@ -761,8 +756,7 @@ void WinCOFFWriter::assignSectionNumbers() {
}
// Assign file offsets to COFF object file structures.
-void WinCOFFWriter::assignFileOffsets(MCAssembler &Asm,
- const MCAsmLayout &Layout) {
+void WinCOFFWriter::assignFileOffsets(MCAssembler &Asm) {
unsigned Offset = W.OS.tell();
Offset += UseBigObj ? COFF::Header32Size : COFF::Header16Size;
@@ -1127,7 +1121,7 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
}
}
- assignFileOffsets(Asm, *Asm.getLayout());
+ assignFileOffsets(Asm);
// MS LINK expects to be able to use this timestamp to implement their
// /INCREMENTAL feature.
@@ -1157,7 +1151,7 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
// Write section contents.
for (std::unique_ptr<COFFSection> &Sec : Sections)
- writeSection(Asm, *Asm.getLayout(), *Sec);
+ writeSection(Asm, *Sec);
assert(W.OS.tell() == Header.PointerToSymbolTable &&
"Header::PointerToSymbolTable is insane!");
diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp
index bce9ebd..03a4ee8 100644
--- a/llvm/lib/MC/XCOFFObjectWriter.cpp
+++ b/llvm/lib/MC/XCOFFObjectWriter.cpp
@@ -12,7 +12,6 @@
#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFixupKindInfo.h"
@@ -379,18 +378,16 @@ class XCOFFObjectWriter : public MCObjectWriter {
void writeSectionHeaderTable();
void writeSections(const MCAssembler &Asm);
void writeSectionForControlSectionEntry(const MCAssembler &Asm,
- const MCAsmLayout &Layout,
const CsectSectionEntry &CsectEntry,
uint64_t &CurrentAddressLocation);
void writeSectionForDwarfSectionEntry(const MCAssembler &Asm,
- const MCAsmLayout &Layout,
const DwarfSectionEntry &DwarfEntry,
uint64_t &CurrentAddressLocation);
- void writeSectionForExceptionSectionEntry(
- const MCAssembler &Asm, const MCAsmLayout &Layout,
- ExceptionSectionEntry &ExceptionEntry, uint64_t &CurrentAddressLocation);
+ void
+ writeSectionForExceptionSectionEntry(const MCAssembler &Asm,
+ ExceptionSectionEntry &ExceptionEntry,
+ uint64_t &CurrentAddressLocation);
void writeSectionForCInfoSymSectionEntry(const MCAssembler &Asm,
- const MCAsmLayout &Layout,
CInfoSymSectionEntry &CInfoSymEntry,
uint64_t &CurrentAddressLocation);
void writeSymbolTable(MCAssembler &Asm);
@@ -419,7 +416,7 @@ class XCOFFObjectWriter : public MCObjectWriter {
// *) Assigns symbol table indices.
// *) Builds up the section header table by adding any non-empty sections to
// `Sections`.
- void assignAddressesAndIndices(MCAssembler &Asm, const MCAsmLayout &);
+ void assignAddressesAndIndices(MCAssembler &Asm);
// Called after relocations are recorded.
void finalizeSectionInfo();
void finalizeRelocationInfo(SectionEntry *Sec, uint64_t RelCount);
@@ -655,7 +652,7 @@ void XCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm) {
Strings.add(Vers);
Strings.finalize();
- assignAddressesAndIndices(Asm, *Asm.getLayout());
+ assignAddressesAndIndices(Asm);
}
void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
@@ -813,17 +810,14 @@ void XCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
}
void XCOFFObjectWriter::writeSections(const MCAssembler &Asm) {
- auto &Layout = *Asm.getLayout();
uint64_t CurrentAddressLocation = 0;
for (const auto *Section : Sections)
- writeSectionForControlSectionEntry(Asm, Layout, *Section,
- CurrentAddressLocation);
+ writeSectionForControlSectionEntry(Asm, *Section, CurrentAddressLocation);
for (const auto &DwarfSection : DwarfSections)
- writeSectionForDwarfSectionEntry(Asm, Layout, DwarfSection,
- CurrentAddressLocation);
- writeSectionForExceptionSectionEntry(Asm, Layout, ExceptionSection,
+ writeSectionForDwarfSectionEntry(Asm, DwarfSection, CurrentAddressLocation);
+ writeSectionForExceptionSectionEntry(Asm, ExceptionSection,
CurrentAddressLocation);
- writeSectionForCInfoSymSectionEntry(Asm, Layout, CInfoSymSection,
+ writeSectionForCInfoSymSectionEntry(Asm, CInfoSymSection,
CurrentAddressLocation);
}
@@ -1419,8 +1413,7 @@ void XCOFFObjectWriter::addCInfoSymEntry(StringRef Name, StringRef Metadata) {
std::make_unique<CInfoSymInfo>(Name.str(), Metadata.str()));
}
-void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
- const MCAsmLayout &Layout) {
+void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm) {
// The symbol table starts with all the C_FILE symbols. Each C_FILE symbol
// requires 1 or 2 auxiliary entries.
uint32_t SymbolTableIndex =
@@ -1597,8 +1590,8 @@ void XCOFFObjectWriter::assignAddressesAndIndices(MCAssembler &Asm,
}
void XCOFFObjectWriter::writeSectionForControlSectionEntry(
- const MCAssembler &Asm, const MCAsmLayout &Layout,
- const CsectSectionEntry &CsectEntry, uint64_t &CurrentAddressLocation) {
+ const MCAssembler &Asm, const CsectSectionEntry &CsectEntry,
+ uint64_t &CurrentAddressLocation) {
// Nothing to write for this Section.
if (CsectEntry.Index == SectionEntry::UninitializedIndex)
return;
@@ -1644,8 +1637,8 @@ void XCOFFObjectWriter::writeSectionForControlSectionEntry(
}
void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
- const MCAssembler &Asm, const MCAsmLayout &Layout,
- const DwarfSectionEntry &DwarfEntry, uint64_t &CurrentAddressLocation) {
+ const MCAssembler &Asm, const DwarfSectionEntry &DwarfEntry,
+ uint64_t &CurrentAddressLocation) {
// There could be a gap (without corresponding zero padding) between
// sections. For example DWARF section alignment is bigger than
// DefaultSectionAlign.
@@ -1672,8 +1665,8 @@ void XCOFFObjectWriter::writeSectionForDwarfSectionEntry(
}
void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
- const MCAssembler &Asm, const MCAsmLayout &Layout,
- ExceptionSectionEntry &ExceptionEntry, uint64_t &CurrentAddressLocation) {
+ const MCAssembler &Asm, ExceptionSectionEntry &ExceptionEntry,
+ uint64_t &CurrentAddressLocation) {
for (auto it = ExceptionEntry.ExceptionTable.begin();
it != ExceptionEntry.ExceptionTable.end(); it++) {
// For every symbol that has exception entries, you must start the entries
@@ -1695,8 +1688,8 @@ void XCOFFObjectWriter::writeSectionForExceptionSectionEntry(
}
void XCOFFObjectWriter::writeSectionForCInfoSymSectionEntry(
- const MCAssembler &Asm, const MCAsmLayout &Layout,
- CInfoSymSectionEntry &CInfoSymEntry, uint64_t &CurrentAddressLocation) {
+ const MCAssembler &Asm, CInfoSymSectionEntry &CInfoSymEntry,
+ uint64_t &CurrentAddressLocation) {
if (!CInfoSymSection.Entry)
return;
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 130d1e96..e0c3cc5 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -9972,6 +9972,26 @@ SDValue AArch64TargetLowering::LowerCTPOP_PARITY(SDValue Op,
Val = DAG.getBitcast(VT8Bit, Val);
Val = DAG.getNode(ISD::CTPOP, DL, VT8Bit, Val);
+ if (Subtarget->hasDotProd() && VT.getScalarSizeInBits() != 16 &&
+ VT.getVectorNumElements() >= 2) {
+ EVT DT = VT == MVT::v2i64 ? MVT::v4i32 : VT;
+ SDValue Zeros = DAG.getConstant(0, DL, DT);
+ SDValue Ones = DAG.getConstant(1, DL, VT8Bit);
+
+ if (VT == MVT::v2i64) {
+ Val = DAG.getNode(AArch64ISD::UDOT, DL, DT, Zeros, Ones, Val);
+ Val = DAG.getNode(AArch64ISD::UADDLP, DL, VT, Val);
+ } else if (VT == MVT::v2i32) {
+ Val = DAG.getNode(AArch64ISD::UDOT, DL, DT, Zeros, Ones, Val);
+ } else if (VT == MVT::v4i32) {
+ Val = DAG.getNode(AArch64ISD::UDOT, DL, DT, Zeros, Ones, Val);
+ } else {
+ llvm_unreachable("Unexpected type for custom ctpop lowering");
+ }
+
+ return Val;
+ }
+
// Widen v8i8/v16i8 CTPOP result to VT by repeatedly widening pairwise adds.
unsigned EltSize = 8;
unsigned NumElts = VT.is64BitVector() ? 8 : 16;
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index c0abbd3..eb60b96 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -985,6 +985,16 @@ static bool isAllActivePredicate(Value *Pred) {
m_ConstantInt<AArch64SVEPredPattern::all>()));
}
+// Erase unary operation where predicate has all inactive lanes
+static std::optional<Instruction *>
+instCombineSVENoActiveUnaryErase(InstCombiner &IC, IntrinsicInst &II,
+ int PredPos) {
+ if (match(II.getOperand(PredPos), m_ZeroInt())) {
+ return IC.eraseInstFromFunction(II);
+ }
+ return std::nullopt;
+}
+
// Simplify unary operation where predicate has all inactive lanes by replacing
// instruction with zeroed object
static std::optional<Instruction *>
@@ -2007,6 +2017,32 @@ AArch64TTIImpl::instCombineIntrinsic(InstCombiner &IC,
default:
break;
+ case Intrinsic::aarch64_sve_st1_scatter:
+ case Intrinsic::aarch64_sve_st1_scatter_scalar_offset:
+ case Intrinsic::aarch64_sve_st1_scatter_sxtw:
+ case Intrinsic::aarch64_sve_st1_scatter_sxtw_index:
+ case Intrinsic::aarch64_sve_st1_scatter_uxtw:
+ case Intrinsic::aarch64_sve_st1_scatter_uxtw_index:
+ case Intrinsic::aarch64_sve_st1dq:
+ case Intrinsic::aarch64_sve_st1q_scatter_index:
+ case Intrinsic::aarch64_sve_st1q_scatter_scalar_offset:
+ case Intrinsic::aarch64_sve_st1q_scatter_vector_offset:
+ case Intrinsic::aarch64_sve_st1wq:
+ case Intrinsic::aarch64_sve_stnt1:
+ case Intrinsic::aarch64_sve_stnt1_scatter:
+ case Intrinsic::aarch64_sve_stnt1_scatter_index:
+ case Intrinsic::aarch64_sve_stnt1_scatter_scalar_offset:
+ case Intrinsic::aarch64_sve_stnt1_scatter_uxtw:
+ return instCombineSVENoActiveUnaryErase(IC, II, 1);
+ case Intrinsic::aarch64_sve_st2:
+ case Intrinsic::aarch64_sve_st2q:
+ return instCombineSVENoActiveUnaryErase(IC, II, 2);
+ case Intrinsic::aarch64_sve_st3:
+ case Intrinsic::aarch64_sve_st3q:
+ return instCombineSVENoActiveUnaryErase(IC, II, 3);
+ case Intrinsic::aarch64_sve_st4:
+ case Intrinsic::aarch64_sve_st4q:
+ return instCombineSVENoActiveUnaryErase(IC, II, 4);
case Intrinsic::aarch64_sve_ld1_gather:
case Intrinsic::aarch64_sve_ld1_gather_scalar_offset:
case Intrinsic::aarch64_sve_ld1_gather_sxtw:
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
index 0c5a9d7..fb8eb9f 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp
@@ -101,9 +101,9 @@ MCFragment *AArch64MCExpr::findAssociatedFragment() const {
}
bool AArch64MCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
Res =
@@ -187,9 +187,9 @@ MCFragment *AArch64AuthMCExpr::findAssociatedFragment() const {
}
bool AArch64AuthMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
if (Res.getSymB())
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
index 4823598..cf3a90f 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h
@@ -167,7 +167,7 @@ public:
MCFragment *findAssociatedFragment() const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void fixELFSymbolsInTLSFixups(MCAssembler &Asm) const override;
@@ -201,7 +201,7 @@ public:
MCFragment *findAssociatedFragment() const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
static bool classof(const MCExpr *E) {
diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
index d5177aa..33f0ca2 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
@@ -12,7 +12,6 @@
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoDarwin.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@@ -278,18 +277,14 @@ void AArch64MachObjectWriter::recordRelocation(
return;
}
- Value +=
- (!A->getFragment() ? 0
- : Writer->getSymbolAddress(*A, *Asm.getLayout())) -
- (!A_Base || !A_Base->getFragment()
- ? 0
- : Writer->getSymbolAddress(*A_Base, *Asm.getLayout()));
- Value -=
- (!B->getFragment() ? 0
- : Writer->getSymbolAddress(*B, *Asm.getLayout())) -
- (!B_Base || !B_Base->getFragment()
- ? 0
- : Writer->getSymbolAddress(*B_Base, *Asm.getLayout()));
+ Value += (!A->getFragment() ? 0 : Writer->getSymbolAddress(*A, Asm)) -
+ (!A_Base || !A_Base->getFragment()
+ ? 0
+ : Writer->getSymbolAddress(*A_Base, Asm));
+ Value -= (!B->getFragment() ? 0 : Writer->getSymbolAddress(*B, Asm)) -
+ (!B_Base || !B_Base->getFragment()
+ ? 0
+ : Writer->getSymbolAddress(*B_Base, Asm));
Type = MachO::ARM64_RELOC_UNSIGNED;
@@ -358,7 +353,7 @@ void AArch64MachObjectWriter::recordRelocation(
// The index is the section ordinal (1-based).
const MCSection &Sec = Symbol->getSection();
Index = Sec.getOrdinal() + 1;
- Value += Writer->getSymbolAddress(*Symbol, *Asm.getLayout());
+ Value += Writer->getSymbolAddress(*Symbol, Asm);
if (IsPCRel)
Value -= Writer->getFragmentAddress(Asm, Fragment) + Fixup.getOffset() +
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 63d8334..2f3890e 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -2013,6 +2013,7 @@ def HasVOP3PInsts : Predicate<"Subtarget->hasVOP3PInsts()">,
AssemblerPredicate<(all_of FeatureVOP3P)>;
def NotHasMed3_16 : Predicate<"!Subtarget->hasMed3_16()">;
+def HasMed3_16 : Predicate<"Subtarget->hasMed3_16()">;
def HasMinMaxDenormModes : Predicate<"Subtarget->supportsMinMaxDenormModes()">;
def NotHasMinMaxDenormModes : Predicate<"!Subtarget->supportsMinMaxDenormModes()">;
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
index 8062bc1..08c1cd5 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp
@@ -651,9 +651,12 @@ static Constant *getIdentityValueForAtomicOp(Type *const Ty,
case AtomicRMWInst::FSub:
return ConstantFP::get(C, APFloat::getZero(Ty->getFltSemantics(), false));
case AtomicRMWInst::FMin:
- return ConstantFP::get(C, APFloat::getInf(Ty->getFltSemantics(), false));
case AtomicRMWInst::FMax:
- return ConstantFP::get(C, APFloat::getInf(Ty->getFltSemantics(), true));
+ // FIXME: atomicrmw fmax/fmin behave like llvm.maxnum/minnum so NaN is the
+ // closest thing they have to an identity, but it still does not preserve
+ // the difference between quiet and signaling NaNs or NaNs with different
+ // payloads.
+ return ConstantFP::get(C, APFloat::getNaN(Ty->getFltSemantics()));
}
}
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.cpp
index 83fbf4a..b2a9667 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.cpp
@@ -10,6 +10,7 @@
#include "GCNSubtarget.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/IR/Function.h"
+#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
@@ -93,12 +94,11 @@ static int64_t op(AMDGPUMCExpr::VariantKind Kind, int64_t Arg1, int64_t Arg2) {
}
}
-bool AMDGPUMCExpr::evaluateExtraSGPRs(MCValue &Res, const MCAsmLayout *Layout,
+bool AMDGPUMCExpr::evaluateExtraSGPRs(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
auto TryGetMCExprValue = [&](const MCExpr *Arg, uint64_t &ConstantValue) {
MCValue MCVal;
- if (!Arg->evaluateAsRelocatable(MCVal, Layout, Fixup) ||
- !MCVal.isAbsolute())
+ if (!Arg->evaluateAsRelocatable(MCVal, Asm, Fixup) || !MCVal.isAbsolute())
return false;
ConstantValue = MCVal.getConstant();
@@ -123,12 +123,11 @@ bool AMDGPUMCExpr::evaluateExtraSGPRs(MCValue &Res, const MCAsmLayout *Layout,
return true;
}
-bool AMDGPUMCExpr::evaluateTotalNumVGPR(MCValue &Res, const MCAsmLayout *Layout,
+bool AMDGPUMCExpr::evaluateTotalNumVGPR(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
auto TryGetMCExprValue = [&](const MCExpr *Arg, uint64_t &ConstantValue) {
MCValue MCVal;
- if (!Arg->evaluateAsRelocatable(MCVal, Layout, Fixup) ||
- !MCVal.isAbsolute())
+ if (!Arg->evaluateAsRelocatable(MCVal, Asm, Fixup) || !MCVal.isAbsolute())
return false;
ConstantValue = MCVal.getConstant();
@@ -151,12 +150,11 @@ bool AMDGPUMCExpr::evaluateTotalNumVGPR(MCValue &Res, const MCAsmLayout *Layout,
return true;
}
-bool AMDGPUMCExpr::evaluateAlignTo(MCValue &Res, const MCAsmLayout *Layout,
+bool AMDGPUMCExpr::evaluateAlignTo(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
auto TryGetMCExprValue = [&](const MCExpr *Arg, uint64_t &ConstantValue) {
MCValue MCVal;
- if (!Arg->evaluateAsRelocatable(MCVal, Layout, Fixup) ||
- !MCVal.isAbsolute())
+ if (!Arg->evaluateAsRelocatable(MCVal, Asm, Fixup) || !MCVal.isAbsolute())
return false;
ConstantValue = MCVal.getConstant();
@@ -173,12 +171,11 @@ bool AMDGPUMCExpr::evaluateAlignTo(MCValue &Res, const MCAsmLayout *Layout,
return true;
}
-bool AMDGPUMCExpr::evaluateOccupancy(MCValue &Res, const MCAsmLayout *Layout,
+bool AMDGPUMCExpr::evaluateOccupancy(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
auto TryGetMCExprValue = [&](const MCExpr *Arg, uint64_t &ConstantValue) {
MCValue MCVal;
- if (!Arg->evaluateAsRelocatable(MCVal, Layout, Fixup) ||
- !MCVal.isAbsolute())
+ if (!Arg->evaluateAsRelocatable(MCVal, Asm, Fixup) || !MCVal.isAbsolute())
return false;
ConstantValue = MCVal.getConstant();
@@ -218,27 +215,25 @@ bool AMDGPUMCExpr::evaluateOccupancy(MCValue &Res, const MCAsmLayout *Layout,
}
bool AMDGPUMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
std::optional<int64_t> Total;
-
switch (Kind) {
default:
break;
case AGVK_ExtraSGPRs:
- return evaluateExtraSGPRs(Res, Layout, Fixup);
+ return evaluateExtraSGPRs(Res, Asm, Fixup);
case AGVK_AlignTo:
- return evaluateAlignTo(Res, Layout, Fixup);
+ return evaluateAlignTo(Res, Asm, Fixup);
case AGVK_TotalNumVGPRs:
- return evaluateTotalNumVGPR(Res, Layout, Fixup);
+ return evaluateTotalNumVGPR(Res, Asm, Fixup);
case AGVK_Occupancy:
- return evaluateOccupancy(Res, Layout, Fixup);
+ return evaluateOccupancy(Res, Asm, Fixup);
}
for (const MCExpr *Arg : Args) {
MCValue ArgRes;
- if (!Arg->evaluateAsRelocatable(ArgRes, Layout, Fixup) ||
- !ArgRes.isAbsolute())
+ if (!Arg->evaluateAsRelocatable(ArgRes, Asm, Fixup) || !ArgRes.isAbsolute())
return false;
if (!Total.has_value())
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h
index 207a619..970802d 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCExpr.h
@@ -48,13 +48,13 @@ private:
AMDGPUMCExpr(VariantKind Kind, ArrayRef<const MCExpr *> Args, MCContext &Ctx);
~AMDGPUMCExpr();
- bool evaluateExtraSGPRs(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateExtraSGPRs(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const;
- bool evaluateTotalNumVGPR(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateTotalNumVGPR(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const;
- bool evaluateAlignTo(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAlignTo(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const;
- bool evaluateOccupancy(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateOccupancy(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const;
public:
@@ -94,7 +94,7 @@ public:
const MCExpr *getSubExpr(size_t Index) const;
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override;
diff --git a/llvm/lib/Target/AMDGPU/SIInstructions.td b/llvm/lib/Target/AMDGPU/SIInstructions.td
index 835f44f..77b17a0 100644
--- a/llvm/lib/Target/AMDGPU/SIInstructions.td
+++ b/llvm/lib/Target/AMDGPU/SIInstructions.td
@@ -3534,16 +3534,6 @@ multiclass FPMed3Pat<ValueType vt,
DSTCLAMP.NONE, DSTOMOD.NONE)>;
}
-class FP16Med3Pat<ValueType vt,
- Instruction med3Inst> : GCNPat<
- (fmaxnum_like_nnan (fminnum_like (VOP3Mods vt:$src0, i32:$src0_mods),
- (VOP3Mods vt:$src1, i32:$src1_mods)),
- (fminnum_like (fmaxnum_like (VOP3Mods vt:$src0, i32:$src0_mods),
- (VOP3Mods vt:$src1, i32:$src1_mods)),
- (vt (VOP3Mods vt:$src2, i32:$src2_mods)))),
- (med3Inst $src0_mods, $src0, $src1_mods, $src1, $src2_mods, $src2, DSTCLAMP.NONE)
->;
-
multiclass Int16Med3Pat<Instruction med3Inst,
SDPatternOperator min,
SDPatternOperator max> {
@@ -3566,6 +3556,10 @@ multiclass Int16Med3Pat<Instruction med3Inst,
defm : FPMed3Pat<f32, V_MED3_F32_e64>;
+let SubtargetPredicate = HasMed3_16 in {
+defm : FPMed3Pat<f16, V_MED3_F16_e64>;
+}
+
class
IntMinMaxPat<Instruction minmaxInst, SDPatternOperator min_or_max,
SDPatternOperator max_or_min_oneuse> : AMDGPUPat <
@@ -3611,7 +3605,6 @@ def : FPMinCanonMaxPat<V_MAXMIN_F16_e64, f16, fminnum_like, fmaxnum_like_oneuse>
}
let OtherPredicates = [isGFX9Plus] in {
-def : FP16Med3Pat<f16, V_MED3_F16_e64>;
defm : Int16Med3Pat<V_MED3_I16_e64, smin, smax>;
defm : Int16Med3Pat<V_MED3_U16_e64, umin, umax>;
} // End Predicates = [isGFX9Plus]
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
index 48b4b69..33eb1cf 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
@@ -17,7 +17,6 @@
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
index edeff9c..5f32b37 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCExpr.h
@@ -81,8 +81,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override {
return false;
}
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
index 2a2372d..e4a2cce 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
@@ -12,7 +12,6 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
#include "llvm/BinaryFormat/MachO.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@@ -158,7 +157,7 @@ void ARMMachObjectWriter::recordARMScatteredHalfRelocation(
return;
}
- uint32_t Value = Writer->getSymbolAddress(*A, *Asm.getLayout());
+ uint32_t Value = Writer->getSymbolAddress(*A, Asm);
uint32_t Value2 = 0;
uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());
FixedValue += SecAddr;
@@ -175,7 +174,7 @@ void ARMMachObjectWriter::recordARMScatteredHalfRelocation(
// Select the appropriate difference relocation type.
Type = MachO::ARM_RELOC_HALF_SECTDIFF;
- Value2 = Writer->getSymbolAddress(B->getSymbol(), *Asm.getLayout());
+ Value2 = Writer->getSymbolAddress(B->getSymbol(), Asm);
FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
}
@@ -267,7 +266,7 @@ void ARMMachObjectWriter::recordARMScatteredRelocation(
return;
}
- uint32_t Value = Writer->getSymbolAddress(*A, *Asm.getLayout());
+ uint32_t Value = Writer->getSymbolAddress(*A, Asm);
uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());
FixedValue += SecAddr;
uint32_t Value2 = 0;
@@ -285,7 +284,7 @@ void ARMMachObjectWriter::recordARMScatteredRelocation(
// Select the appropriate difference relocation type.
Type = MachO::ARM_RELOC_SECTDIFF;
- Value2 = Writer->getSymbolAddress(B->getSymbol(), *Asm.getLayout());
+ Value2 = Writer->getSymbolAddress(B->getSymbol(), Asm);
FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
}
diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
index d6b6546..5386df7 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
@@ -8,7 +8,6 @@
#include "AVRMCExpr.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCStreamer.h"
@@ -69,10 +68,10 @@ bool AVRMCExpr::evaluateAsConstant(int64_t &Result) const {
}
bool AVRMCExpr::evaluateAsRelocatableImpl(MCValue &Result,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
MCValue Value;
- bool isRelocatable = SubExpr->evaluateAsRelocatable(Value, Layout, Fixup);
+ bool isRelocatable = SubExpr->evaluateAsRelocatable(Value, Asm, Fixup);
if (!isRelocatable)
return false;
@@ -80,10 +79,10 @@ bool AVRMCExpr::evaluateAsRelocatableImpl(MCValue &Result,
if (Value.isAbsolute()) {
Result = MCValue::get(evaluateAsInt64(Value.getConstant()));
} else {
- if (!Layout)
+ if (!Asm || !Asm->hasLayout())
return false;
- MCContext &Context = Layout->getAssembler().getContext();
+ MCContext &Context = Asm->getContext();
const MCSymbolRefExpr *Sym = Value.getSymA();
MCSymbolRefExpr::VariantKind Modifier = Sym->getKind();
if (Modifier != MCSymbolRefExpr::VK_None)
diff --git a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.h b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.h
index 5bf6c1a..03d3363 100644
--- a/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.h
+++ b/llvm/lib/Target/AVR/MCTargetDesc/AVRMCExpr.h
@@ -56,7 +56,7 @@ public:
void setNegated(bool negated = true) { Negated = negated; }
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &streamer) const override;
diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
index 222dc2c..dd06971 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp
@@ -9,7 +9,6 @@
#include "CSKYAsmBackend.h"
#include "MCTargetDesc/CSKYMCTargetDesc.h"
#include "llvm/ADT/DenseMap.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCFixupKindInfo.h"
diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
index b998982..d96b700 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.cpp
@@ -109,10 +109,9 @@ void CSKYMCExpr::fixELFSymbolsInTLSFixups(MCAssembler &Asm) const {
fixELFSymbolsInTLSFixupsImpl(getSubExpr(), Asm);
}
-bool CSKYMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+bool CSKYMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
// Some custom fixup types are not valid with symbol difference expressions
diff --git a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h
index 9e5b4ca..73aebc7 100644
--- a/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h
+++ b/llvm/lib/Target/CSKY/MCTargetDesc/CSKYMCExpr.h
@@ -55,7 +55,7 @@ public:
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
index 2ce91bd..6acc37e 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
@@ -14,7 +14,6 @@
#include "MCTargetDesc/HexagonMCShuffler.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
@@ -703,8 +702,7 @@ public:
return true;
}
- void finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const override {
+ void finishLayout(MCAssembler const &Asm) const override {
SmallVector<MCFragment *> Frags;
for (MCSection &Sec : Asm) {
Frags.clear();
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp
index 0cfea77..598d1e8 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.cpp
@@ -25,9 +25,9 @@ HexagonMCExpr *HexagonMCExpr::create(MCExpr const *Expr, MCContext &Ctx) {
}
bool HexagonMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- MCAsmLayout const *Layout,
+ const MCAssembler *Asm,
MCFixup const *Fixup) const {
- return Expr->evaluateAsRelocatable(Res, Layout, Fixup);
+ return Expr->evaluateAsRelocatable(Res, Asm, Fixup);
}
void HexagonMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
index 6438ac9..eda96e2 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCExpr.h
@@ -16,7 +16,7 @@ class HexagonMCExpr : public MCTargetExpr {
public:
static HexagonMCExpr *create(MCExpr const *Expr, MCContext &Ctx);
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override;
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
index 56d5fbf..285e938 100644
--- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
+++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.cpp
@@ -47,9 +47,9 @@ void LanaiMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
}
bool LanaiMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
Res =
diff --git a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h
index c99af32..1829165 100644
--- a/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h
+++ b/llvm/lib/Target/Lanai/MCTargetDesc/LanaiMCExpr.h
@@ -36,7 +36,7 @@ public:
const MCExpr *getSubExpr() const { return Expr; }
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
index e3200b0..0c24008 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
@@ -13,7 +13,6 @@
#include "LoongArchAsmBackend.h"
#include "LoongArchFixupKinds.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
@@ -303,7 +302,7 @@ std::pair<bool, bool> LoongArchAsmBackend::relaxLEB128(const MCAssembler &Asm,
MCLEBFragment &LF,
int64_t &Value) const {
const MCExpr &Expr = LF.getValue();
- if (LF.isSigned() || !Expr.evaluateKnownAbsolute(Value, *Asm.getLayout()))
+ if (LF.isSigned() || !Expr.evaluateKnownAbsolute(Value, Asm))
return std::make_pair(false, false);
LF.getFixups().push_back(
MCFixup::create(0, &Expr, FK_Data_leb128, Expr.getLoc()));
@@ -313,7 +312,6 @@ std::pair<bool, bool> LoongArchAsmBackend::relaxLEB128(const MCAssembler &Asm,
bool LoongArchAsmBackend::relaxDwarfLineAddr(const MCAssembler &Asm,
MCDwarfLineAddrFragment &DF,
bool &WasRelaxed) const {
- auto &Layout = *Asm.getLayout();
MCContext &C = Asm.getContext();
int64_t LineDelta = DF.getLineDelta();
@@ -323,9 +321,9 @@ bool LoongArchAsmBackend::relaxDwarfLineAddr(const MCAssembler &Asm,
size_t OldSize = Data.size();
int64_t Value;
- if (AddrDelta.evaluateAsAbsolute(Value, Layout))
+ if (AddrDelta.evaluateAsAbsolute(Value, Asm))
return false;
- bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Layout);
+ bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Asm);
assert(IsAbsolute && "CFA with invalid expression");
(void)IsAbsolute;
@@ -387,11 +385,10 @@ bool LoongArchAsmBackend::relaxDwarfCFA(const MCAssembler &Asm,
SmallVectorImpl<MCFixup> &Fixups = DF.getFixups();
size_t OldSize = Data.size();
- auto &Layout = *Asm.getLayout();
int64_t Value;
- if (AddrDelta.evaluateAsAbsolute(Value, Layout))
+ if (AddrDelta.evaluateAsAbsolute(Value, Asm))
return false;
- bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Layout);
+ bool IsAbsolute = AddrDelta.evaluateKnownAbsolute(Value, Asm);
assert(IsAbsolute && "CFA with invalid expression");
(void)IsAbsolute;
@@ -399,10 +396,8 @@ bool LoongArchAsmBackend::relaxDwarfCFA(const MCAssembler &Asm,
Fixups.clear();
raw_svector_ostream OS(Data);
- assert(
- Layout.getAssembler().getContext().getAsmInfo()->getMinInstAlignment() ==
- 1 &&
- "expected 1-byte alignment");
+ assert(Asm.getContext().getAsmInfo()->getMinInstAlignment() == 1 &&
+ "expected 1-byte alignment");
if (Value == 0) {
WasRelaxed = OldSize != Data.size();
return true;
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp
index 34f9bc6..9b53779 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.cpp
@@ -44,7 +44,7 @@ void LoongArchMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
}
bool LoongArchMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
// Explicitly drop the layout and assembler to prevent any symbolic folding in
// the expression handling. This is required to preserve symbolic difference
diff --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h
index 71dd5bd..148fea3 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCExpr.h
@@ -92,7 +92,7 @@ public:
bool getRelaxHint() const { return RelaxHint; }
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
index a25783b..c856aa8 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
@@ -129,16 +129,14 @@ void MipsMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
OS << ')';
}
-bool
-MipsMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
- const MCFixup *Fixup) const {
+bool MipsMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
+ const MCFixup *Fixup) const {
// Look for the %hi(%neg(%gp_rel(X))) and %lo(%neg(%gp_rel(X))) special cases.
if (isGpOff()) {
const MCExpr *SubExpr =
cast<MipsMCExpr>(cast<MipsMCExpr>(getSubExpr())->getSubExpr())
->getSubExpr();
- if (!SubExpr->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!SubExpr->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
Res = MCValue::get(Res.getSymA(), Res.getSymB(), Res.getConstant(),
@@ -146,7 +144,7 @@ MipsMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
return true;
}
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
if (Res.getRefKind() != MCSymbolRefExpr::VK_None)
@@ -164,7 +162,7 @@ MipsMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
case MEK_DTPREL:
// MEK_DTPREL is used for marking TLS DIEExpr only
// and contains a regular sub-expression.
- return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
+ return getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup);
case MEK_DTPREL_HI:
case MEK_DTPREL_LO:
case MEK_GOT:
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
index edc12e8..fc97200 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
+++ b/llvm/lib/Target/Mips/MCTargetDesc/MipsMCExpr.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
#define LLVM_LIB_TARGET_MIPS_MCTARGETDESC_MIPSMCEXPR_H
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCValue.h"
@@ -67,7 +66,7 @@ public:
const MCExpr *getSubExpr() const { return Expr; }
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
index b7a20c3..380d878 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
@@ -60,6 +60,9 @@ void NVPTXInstPrinter::printRegName(raw_ostream &OS, MCRegister Reg) const {
case 6:
OS << "%fd";
break;
+ case 7:
+ OS << "%rq";
+ break;
}
unsigned VReg = Reg.id() & 0x0FFFFFFF;
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index ca077d4..1645261 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -315,6 +315,8 @@ unsigned NVPTXAsmPrinter::encodeVirtualRegister(unsigned Reg) {
Ret = (5 << 28);
} else if (RC == &NVPTX::Float64RegsRegClass) {
Ret = (6 << 28);
+ } else if (RC == &NVPTX::Int128RegsRegClass) {
+ Ret = (7 << 28);
} else {
report_fatal_error("Bad register class");
}
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
index 1e1cbb1..11193c1 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp
@@ -519,6 +519,20 @@ void NVPTXDAGToDAGISel::Select(SDNode *N) {
if (tryConstantFP(N))
return;
break;
+ case ISD::CopyToReg: {
+ if (N->getOperand(1).getValueType() == MVT::i128) {
+ SelectV2I64toI128(N);
+ return;
+ }
+ break;
+ }
+ case ISD::CopyFromReg: {
+ if (N->getOperand(1).getValueType() == MVT::i128) {
+ SelectI128toV2I64(N);
+ return;
+ }
+ break;
+ }
default:
break;
}
@@ -3798,6 +3812,60 @@ bool NVPTXDAGToDAGISel::SelectInlineAsmMemoryOperand(
return true;
}
+void NVPTXDAGToDAGISel::SelectV2I64toI128(SDNode *N) {
+ // Lower a CopyToReg with two 64-bit inputs
+ // Dst:i128, lo:i64, hi:i64
+ //
+ // CopyToReg Dst, lo, hi;
+ //
+ // ==>
+ //
+ // tmp = V2I64toI128 {lo, hi};
+ // CopyToReg Dst, tmp;
+ SDValue Dst = N->getOperand(1);
+ SDValue Lo = N->getOperand(2);
+ SDValue Hi = N->getOperand(3);
+
+ SDLoc DL(N);
+ SDNode *Mov =
+ CurDAG->getMachineNode(NVPTX::V2I64toI128, DL, MVT::i128, {Lo, Hi});
+
+ SmallVector<SDValue, 4> NewOps(N->getNumOperands() - 1);
+ NewOps[0] = N->getOperand(0);
+ NewOps[1] = Dst;
+ NewOps[2] = SDValue(Mov, 0);
+ if (N->getNumOperands() == 5)
+ NewOps[3] = N->getOperand(4);
+ SDValue NewValue = CurDAG->getNode(ISD::CopyToReg, DL, SmallVector<EVT>(N->values()), NewOps);
+
+ ReplaceNode(N, NewValue.getNode());
+}
+
+void NVPTXDAGToDAGISel::SelectI128toV2I64(SDNode *N) {
+ // Lower CopyFromReg from a 128-bit regs to two 64-bit regs
+ // Dst:i128, Src:i128
+ //
+ // {lo, hi} = CopyFromReg Src
+ //
+ // ==>
+ //
+ // {lo, hi} = I128toV2I64 Src
+ //
+ SDValue Ch = N->getOperand(0);
+ SDValue Src = N->getOperand(1);
+ SDValue Glue = N->getOperand(2);
+ SDLoc DL(N);
+
+ // Add Glue and Ch to the operands and results to avoid break the execution
+ // order
+ SDNode *Mov = CurDAG->getMachineNode(
+ NVPTX::I128toV2I64, DL,
+ {MVT::i64, MVT::i64, Ch.getValueType(), Glue.getValueType()},
+ {Src, Ch, Glue});
+
+ ReplaceNode(N, Mov);
+}
+
/// GetConvertOpcode - Returns the CVT_ instruction opcode that implements a
/// conversion from \p SrcTy to \p DestTy.
unsigned NVPTXDAGToDAGISel::GetConvertOpcode(MVT DestTy, MVT SrcTy,
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h
index c552435..49626d4 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h
+++ b/llvm/lib/Target/NVPTX/NVPTXISelDAGToDAG.h
@@ -74,7 +74,8 @@ private:
bool SelectSETP_F16X2(SDNode *N);
bool SelectSETP_BF16X2(SDNode *N);
bool tryEXTRACT_VECTOR_ELEMENT(SDNode *N);
-
+ void SelectV2I64toI128(SDNode *N);
+ void SelectI128toV2I64(SDNode *N);
inline SDValue getI32Imm(unsigned Imm, const SDLoc &DL) {
return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
}
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 476a532..26c16ee 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -859,6 +859,10 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
setBF16OperationAction(Op, MVT::v2bf16, Legal, Expand);
}
+ // Custom lowering for inline asm with 128-bit operands
+ setOperationAction(ISD::CopyToReg, MVT::i128, Custom);
+ setOperationAction(ISD::CopyFromReg, MVT::i128, Custom);
+
// No FEXP2, FLOG2. The PTX ex2 and log2 functions are always approximate.
// No FPOW or FREM in PTX.
@@ -2804,6 +2808,8 @@ NVPTXTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
return LowerVectorArith(Op, DAG);
case ISD::DYNAMIC_STACKALLOC:
return LowerDYNAMIC_STACKALLOC(Op, DAG);
+ case ISD::CopyToReg:
+ return LowerCopyToReg_128(Op, DAG);
default:
llvm_unreachable("Custom lowering not defined for operation");
}
@@ -3094,6 +3100,54 @@ SDValue NVPTXTargetLowering::LowerSTOREi1(SDValue Op, SelectionDAG &DAG) const {
return Result;
}
+SDValue NVPTXTargetLowering::LowerCopyToReg_128(SDValue Op,
+ SelectionDAG &DAG) const {
+ // Change the CopyToReg to take in two 64-bit operands instead of a 128-bit
+ // operand so that it can pass the legalization.
+
+ assert(Op.getOperand(1).getValueType() == MVT::i128 &&
+ "Custom lowering for 128-bit CopyToReg only");
+
+ SDNode *Node = Op.getNode();
+ SDLoc DL(Node);
+
+ SDValue Cast = DAG.getBitcast(MVT::v2i64, Op->getOperand(2));
+ SDValue Lo = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, MVT::i64, Cast,
+ DAG.getIntPtrConstant(0, DL));
+ SDValue Hi = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL, MVT::i64, Cast,
+ DAG.getIntPtrConstant(1, DL));
+
+ SmallVector<SDValue, 5> NewOps(Op->getNumOperands() + 1);
+ SmallVector<EVT, 3> ResultsType(Node->values());
+
+ NewOps[0] = Op->getOperand(0); // Chain
+ NewOps[1] = Op->getOperand(1); // Dst Reg
+ NewOps[2] = Lo; // Lower 64-bit
+ NewOps[3] = Hi; // Higher 64-bit
+ if (Op.getNumOperands() == 4)
+ NewOps[4] = Op->getOperand(3); // Glue if exists
+
+ return DAG.getNode(ISD::CopyToReg, DL, ResultsType, NewOps);
+}
+
+unsigned NVPTXTargetLowering::getNumRegisters(
+ LLVMContext &Context, EVT VT,
+ std::optional<MVT> RegisterVT = std::nullopt) const {
+ if (VT == MVT::i128 && RegisterVT == MVT::i128)
+ return 1;
+ return TargetLoweringBase::getNumRegisters(Context, VT, RegisterVT);
+}
+
+bool NVPTXTargetLowering::splitValueIntoRegisterParts(
+ SelectionDAG &DAG, const SDLoc &DL, SDValue Val, SDValue *Parts,
+ unsigned NumParts, MVT PartVT, std::optional<CallingConv::ID> CC) const {
+ if (Val.getValueType() == MVT::i128 && NumParts == 1) {
+ Parts[0] = Val;
+ return true;
+ }
+ return false;
+}
+
// This creates target external symbol for a function parameter.
// Name of the symbol is composed from its index and the function name.
// Negative index corresponds to special parameter (unsized array) used for
@@ -5150,6 +5204,7 @@ NVPTXTargetLowering::getConstraintType(StringRef Constraint) const {
case 'l':
case 'f':
case 'd':
+ case 'q':
case '0':
case 'N':
return C_RegisterClass;
@@ -5175,6 +5230,12 @@ NVPTXTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
case 'l':
case 'N':
return std::make_pair(0U, &NVPTX::Int64RegsRegClass);
+ case 'q': {
+ if (STI.getSmVersion() < 70)
+ report_fatal_error("Inline asm with 128 bit operands is only "
+ "supported for sm_70 and higher!");
+ return std::make_pair(0U, &NVPTX::Int128RegsRegClass);
+ }
case 'f':
return std::make_pair(0U, &NVPTX::Float32RegsRegClass);
case 'd':
@@ -6261,6 +6322,30 @@ static void ReplaceINTRINSIC_W_CHAIN(SDNode *N, SelectionDAG &DAG,
}
}
+static void ReplaceCopyFromReg_128(SDNode *N, SelectionDAG &DAG,
+ SmallVectorImpl<SDValue> &Results) {
+ // Change the CopyFromReg to output 2 64-bit results instead of a 128-bit
+ // result so that it can pass the legalization
+ SDLoc DL(N);
+ SDValue Chain = N->getOperand(0);
+ SDValue Reg = N->getOperand(1);
+ SDValue Glue = N->getOperand(2);
+
+ assert(Reg.getValueType() == MVT::i128 &&
+ "Custom lowering for CopyFromReg with 128-bit reg only");
+ SmallVector<EVT, 4> ResultsType = {MVT::i64, MVT::i64, N->getValueType(1),
+ N->getValueType(2)};
+ SmallVector<SDValue, 3> NewOps = {Chain, Reg, Glue};
+
+ SDValue NewValue = DAG.getNode(ISD::CopyFromReg, DL, ResultsType, NewOps);
+ SDValue Pair = DAG.getNode(ISD::BUILD_PAIR, DL, MVT::i128,
+ {NewValue.getValue(0), NewValue.getValue(1)});
+
+ Results.push_back(Pair);
+ Results.push_back(NewValue.getValue(2));
+ Results.push_back(NewValue.getValue(3));
+}
+
void NVPTXTargetLowering::ReplaceNodeResults(
SDNode *N, SmallVectorImpl<SDValue> &Results, SelectionDAG &DAG) const {
switch (N->getOpcode()) {
@@ -6272,6 +6357,9 @@ void NVPTXTargetLowering::ReplaceNodeResults(
case ISD::INTRINSIC_W_CHAIN:
ReplaceINTRINSIC_W_CHAIN(N, DAG, Results);
return;
+ case ISD::CopyFromReg:
+ ReplaceCopyFromReg_128(N, DAG, Results);
+ return;
}
}
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.h b/llvm/lib/Target/NVPTX/NVPTXISelLowering.h
index e211286..6326296 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.h
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.h
@@ -640,6 +640,14 @@ private:
SDValue LowerVAARG(SDValue Op, SelectionDAG &DAG) const;
SDValue LowerVASTART(SDValue Op, SelectionDAG &DAG) const;
+ SDValue LowerCopyToReg_128(SDValue Op, SelectionDAG &DAG) const;
+ unsigned getNumRegisters(LLVMContext &Context, EVT VT,
+ std::optional<MVT> RegisterVT) const override;
+ bool
+ splitValueIntoRegisterParts(SelectionDAG &DAG, const SDLoc &DL, SDValue Val,
+ SDValue *Parts, unsigned NumParts, MVT PartVT,
+ std::optional<CallingConv::ID> CC) const override;
+
void ReplaceNodeResults(SDNode *N, SmallVectorImpl<SDValue> &Results,
SelectionDAG &DAG) const override;
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
index b0d792b..673858f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.cpp
@@ -51,6 +51,8 @@ void NVPTXInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
} else if (DestRC == &NVPTX::Int64RegsRegClass) {
Op = (SrcRC == &NVPTX::Int64RegsRegClass ? NVPTX::IMOV64rr
: NVPTX::BITCONVERT_64_F2I);
+ } else if (DestRC == &NVPTX::Int128RegsRegClass) {
+ Op = NVPTX::IMOV128rr;
} else if (DestRC == &NVPTX::Float32RegsRegClass) {
Op = (SrcRC == &NVPTX::Float32RegsRegClass ? NVPTX::FMOV32rr
: NVPTX::BITCONVERT_32_I2F);
diff --git a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
index c4c35a1..827febe 100644
--- a/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
+++ b/llvm/lib/Target/NVPTX/NVPTXInstrInfo.td
@@ -2097,6 +2097,8 @@ let IsSimpleMove=1, hasSideEffects=0 in {
"mov.u32 \t$dst, $sss;", []>;
def IMOV64rr : NVPTXInst<(outs Int64Regs:$dst), (ins Int64Regs:$sss),
"mov.u64 \t$dst, $sss;", []>;
+ def IMOV128rr : NVPTXInst<(outs Int128Regs:$dst), (ins Int128Regs:$sss),
+ "mov.b128 \t$dst, $sss;", []>;
def IMOVB16rr : NVPTXInst<(outs Int16Regs:$dst), (ins Int16Regs:$sss),
"mov.b16 \t$dst, $sss;", []>;
@@ -3545,6 +3547,9 @@ let hasSideEffects = false in {
def V2I32toI64 : NVPTXInst<(outs Int64Regs:$d),
(ins Int32Regs:$s1, Int32Regs:$s2),
"mov.b64 \t$d, {{$s1, $s2}};", []>;
+ def V2I64toI128 : NVPTXInst<(outs Int128Regs:$d),
+ (ins Int64Regs:$s1, Int64Regs:$s2),
+ "mov.b128 \t$d, {{$s1, $s2}};", []>;
def V2F32toF64 : NVPTXInst<(outs Float64Regs:$d),
(ins Float32Regs:$s1, Float32Regs:$s2),
"mov.b64 \t$d, {{$s1, $s2}};", []>;
@@ -3560,6 +3565,9 @@ let hasSideEffects = false in {
def I64toV2I32 : NVPTXInst<(outs Int32Regs:$d1, Int32Regs:$d2),
(ins Int64Regs:$s),
"mov.b64 \t{{$d1, $d2}}, $s;", []>;
+ def I128toV2I64: NVPTXInst<(outs Int64Regs:$d1, Int64Regs:$d2),
+ (ins Int128Regs:$s),
+ "mov.b128 \t{{$d1, $d2}}, $s;", []>;
def F64toV2F32 : NVPTXInst<(outs Float32Regs:$d1, Float32Regs:$d2),
(ins Float64Regs:$s),
"mov.b64 \t{{$d1, $d2}}, $s;", []>;
@@ -3629,7 +3637,7 @@ def : Pat<(i32 (ctlz (i32 Int32Regs:$a))), (CLZr32 Int32Regs:$a)>;
// ptx value to 64 bits to match the ISD node's semantics, unless we know we're
// truncating back down to 32 bits.
def : Pat<(i64 (ctlz Int64Regs:$a)), (CVT_u64_u32 (CLZr64 Int64Regs:$a), CvtNONE)>;
-def : Pat<(i32 (trunc (ctlz Int64Regs:$a))), (CLZr64 Int64Regs:$a)>;
+def : Pat<(i32 (trunc (i64 (ctlz Int64Regs:$a)))), (CLZr64 Int64Regs:$a)>;
// For 16-bit ctlz, we zero-extend to 32-bit, perform the count, then trunc the
// result back to 16-bits if necessary. We also need to subtract 16 because
@@ -3667,7 +3675,7 @@ def : Pat<(i32 (ctpop (i32 Int32Regs:$a))), (POPCr32 Int32Regs:$a)>;
// pattern that avoids the type conversion if we're truncating the result to
// i32 anyway.
def : Pat<(ctpop Int64Regs:$a), (CVT_u64_u32 (POPCr64 Int64Regs:$a), CvtNONE)>;
-def : Pat<(i32 (trunc (ctpop Int64Regs:$a))), (POPCr64 Int64Regs:$a)>;
+def : Pat<(i32 (trunc (i64 (ctpop Int64Regs:$a)))), (POPCr64 Int64Regs:$a)>;
// For 16-bit, we zero-extend to 32-bit, then trunc the result back to 16-bits.
// If we know that we're storing into an i32, we can avoid the final trunc.
diff --git a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
index ef99def..d95b61c 100644
--- a/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
+++ b/llvm/lib/Target/NVPTX/NVPTXMCExpr.h
@@ -74,8 +74,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override {
return false;
}
@@ -116,8 +115,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override {
return false;
}
diff --git a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
index f1213f0..a8a23f0 100644
--- a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp
@@ -31,6 +31,8 @@ std::string getNVPTXRegClassName(TargetRegisterClass const *RC) {
return ".f32";
if (RC == &NVPTX::Float64RegsRegClass)
return ".f64";
+ if (RC == &NVPTX::Int128RegsRegClass)
+ return ".b128";
if (RC == &NVPTX::Int64RegsRegClass)
// We use untyped (.b) integer registers here as NVCC does.
// Correctness of generated code does not depend on register type,
@@ -67,6 +69,8 @@ std::string getNVPTXRegClassStr(TargetRegisterClass const *RC) {
return "%f";
if (RC == &NVPTX::Float64RegsRegClass)
return "%fd";
+ if (RC == &NVPTX::Int128RegsRegClass)
+ return "%rq";
if (RC == &NVPTX::Int64RegsRegClass)
return "%rd";
if (RC == &NVPTX::Int32RegsRegClass)
diff --git a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td
index b5231a9..2011f0f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td
+++ b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.td
@@ -37,6 +37,7 @@ foreach i = 0...4 in {
def RS#i : NVPTXReg<"%rs"#i>; // 16-bit
def R#i : NVPTXReg<"%r"#i>; // 32-bit
def RL#i : NVPTXReg<"%rd"#i>; // 64-bit
+ def RQ#i : NVPTXReg<"%rq"#i>; // 128-bit
def H#i : NVPTXReg<"%h"#i>; // 16-bit float
def HH#i : NVPTXReg<"%hh"#i>; // 2x16-bit float
def F#i : NVPTXReg<"%f"#i>; // 32-bit float
@@ -62,6 +63,8 @@ def Int32Regs : NVPTXRegClass<[i32, v2f16, v2bf16, v2i16, v4i8], 32,
(add (sequence "R%u", 0, 4),
VRFrame32, VRFrameLocal32)>;
def Int64Regs : NVPTXRegClass<[i64], 64, (add (sequence "RL%u", 0, 4), VRFrame64, VRFrameLocal64)>;
+// 128-bit regs are not defined as general regs in NVPTX. They are used for inlineASM only.
+def Int128Regs : NVPTXRegClass<[i128], 128, (add (sequence "RQ%u", 0, 4))>;
def Float32Regs : NVPTXRegClass<[f32], 32, (add (sequence "F%u", 0, 4))>;
def Float64Regs : NVPTXRegClass<[f64], 64, (add (sequence "FL%u", 0, 4))>;
def Int32ArgRegs : NVPTXRegClass<[i32], 32, (add (sequence "ia%u", 0, 4))>;
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp
index 6cd04ee..cc1d981 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp
@@ -99,13 +99,11 @@ PPCMCExpr::evaluateAsInt64(int64_t Value) const {
llvm_unreachable("Invalid kind!");
}
-bool
-PPCMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
- const MCFixup *Fixup) const {
+bool PPCMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
+ const MCFixup *Fixup) const {
MCValue Value;
- if (!getSubExpr()->evaluateAsRelocatable(Value, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Value, Asm, Fixup))
return false;
if (Value.isAbsolute()) {
@@ -124,10 +122,10 @@ PPCMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
Res = MCValue::get(Result);
} else {
- if (!Layout)
+ if (!Asm || !Asm->hasLayout())
return false;
- MCContext &Context = Layout->getAssembler().getContext();
+ MCContext &Context = Asm->getContext();
const MCSymbolRefExpr *Sym = Value.getSymA();
MCSymbolRefExpr::VariantKind Modifier = Sym->getKind();
if (Modifier != MCSymbolRefExpr::VK_None)
diff --git a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
index 1dbc7ea..59ca514 100644
--- a/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
+++ b/llvm/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h
@@ -9,7 +9,6 @@
#ifndef LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
#define LLVM_LIB_TARGET_POWERPC_MCTARGETDESC_PPCMCEXPR_H
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCValue.h"
@@ -71,8 +70,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
index 445e589..cb64b64 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp
@@ -10,7 +10,6 @@
#include "RISCVMCExpr.h"
#include "llvm/ADT/APInt.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
@@ -215,7 +214,7 @@ bool RISCVAsmBackend::relaxDwarfLineAddr(const MCAssembler &Asm,
int64_t Value;
[[maybe_unused]] bool IsAbsolute =
- AddrDelta.evaluateKnownAbsolute(Value, *Asm.getLayout());
+ AddrDelta.evaluateKnownAbsolute(Value, Asm);
assert(IsAbsolute && "CFA with invalid expression");
Data.clear();
@@ -271,17 +270,16 @@ bool RISCVAsmBackend::relaxDwarfLineAddr(const MCAssembler &Asm,
bool RISCVAsmBackend::relaxDwarfCFA(const MCAssembler &Asm,
MCDwarfCallFrameFragment &DF,
bool &WasRelaxed) const {
- auto &Layout = *Asm.getLayout();
const MCExpr &AddrDelta = DF.getAddrDelta();
SmallVectorImpl<char> &Data = DF.getContents();
SmallVectorImpl<MCFixup> &Fixups = DF.getFixups();
size_t OldSize = Data.size();
int64_t Value;
- if (AddrDelta.evaluateAsAbsolute(Value, Layout))
+ if (AddrDelta.evaluateAsAbsolute(Value, Asm))
return false;
[[maybe_unused]] bool IsAbsolute =
- AddrDelta.evaluateKnownAbsolute(Value, Layout);
+ AddrDelta.evaluateKnownAbsolute(Value, Asm);
assert(IsAbsolute && "CFA with invalid expression");
Data.clear();
@@ -341,8 +339,7 @@ std::pair<bool, bool> RISCVAsmBackend::relaxLEB128(const MCAssembler &Asm,
LF.getFixups().push_back(
MCFixup::create(0, &Expr, FK_Data_leb128, Expr.getLoc()));
}
- return std::make_pair(Expr.evaluateKnownAbsolute(Value, *Asm.getLayout()),
- false);
+ return std::make_pair(Expr.evaluateKnownAbsolute(Value, Asm), false);
}
// Given a compressed control flow instruction this function returns
@@ -549,8 +546,7 @@ bool RISCVAsmBackend::evaluateTargetFixup(const MCAssembler &Asm,
// MCAssembler::evaluateFixup will emit an error for this case when it sees
// the %pcrel_hi, so don't duplicate it when also seeing the %pcrel_lo.
const MCExpr *AUIPCExpr = AUIPCFixup->getValue();
- if (!AUIPCExpr->evaluateAsRelocatable(AUIPCTarget, Asm.getLayout(),
- AUIPCFixup))
+ if (!AUIPCExpr->evaluateAsRelocatable(AUIPCTarget, &Asm, AUIPCFixup))
return true;
break;
}
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
index d83dadd..16d0796 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
@@ -15,7 +15,6 @@
#include "MCTargetDesc/RISCVAsmBackend.h"
#include "RISCVFixupKinds.h"
#include "llvm/BinaryFormat/ELF.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCStreamer.h"
@@ -90,7 +89,7 @@ const MCFixup *RISCVMCExpr::getPCRelHiFixup(const MCFragment **DFOut) const {
}
bool RISCVMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
// Explicitly drop the layout and assembler to prevent any symbolic folding in
// the expression handling. This is required to preserve symbolic difference
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
index fcc4c5c..d144548 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h
@@ -69,7 +69,7 @@ public:
const MCFixup *getPCRelHiFixup(const MCFragment **DFOut) const;
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
index bf69334..7e6eef4 100644
--- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -586,13 +586,14 @@ public:
}
// Most AVLIsReg infos will have a single defining MachineInstr, unless it was
// a PHI node. In that case getAVLVNInfo()->def will point to the block
- // boundary slot. If LiveIntervals isn't available, then nullptr is returned.
+ // boundary slot and this will return nullptr. If LiveIntervals isn't
+ // available, nullptr is also returned.
const MachineInstr *getAVLDefMI(const LiveIntervals *LIS) const {
assert(hasAVLReg());
- if (!LIS)
+ if (!LIS || getAVLVNInfo()->isPHIDef())
return nullptr;
auto *MI = LIS->getInstructionFromIndex(getAVLVNInfo()->def);
- assert(!(getAVLVNInfo()->isPHIDef() && MI));
+ assert(MI);
return MI;
}
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 35d0b34..f76aef7 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -497,9 +497,6 @@ void RISCVPassConfig::addPreSched2() {
}
void RISCVPassConfig::addPreEmitPass() {
- addPass(&BranchRelaxationPassID);
- addPass(createRISCVMakeCompressibleOptPass());
-
// TODO: It would potentially be better to schedule copy propagation after
// expanding pseudos (in addPreEmitPass2). However, performing copy
// propagation after the machine outliner (which runs after addPreEmitPass)
@@ -508,6 +505,8 @@ void RISCVPassConfig::addPreEmitPass() {
if (TM->getOptLevel() >= CodeGenOptLevel::Default &&
EnableRISCVCopyPropagation)
addPass(createMachineCopyPropagationPass(true));
+ addPass(&BranchRelaxationPassID);
+ addPass(createRISCVMakeCompressibleOptPass());
}
void RISCVPassConfig::addPreEmitPass2() {
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
index 4688837..3da19a8 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.cpp
@@ -180,11 +180,10 @@ Sparc::Fixups SparcMCExpr::getFixupKind(SparcMCExpr::VariantKind Kind) {
}
}
-bool
-SparcMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
- const MCFixup *Fixup) const {
- return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
+bool SparcMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
+ const MCAssembler *Asm,
+ const MCFixup *Fixup) const {
+ return getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup);
}
static void fixELFSymbolsInTLSFixupsImpl(const MCExpr *Expr, MCAssembler &Asm) {
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
index d26a748..74f90ae 100644
--- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
+++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCExpr.h
@@ -94,8 +94,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp
index 647cf76..4fa2028 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.cpp
@@ -37,9 +37,9 @@ void SystemZMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
}
bool SystemZMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
Res =
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h
index 62e6109..98f3a23 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h
@@ -45,7 +45,7 @@ public:
StringRef getVariantKindName() const;
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override {
Streamer.visitUsedExpr(*getSubExpr());
diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
index a104510..45c768e 100644
--- a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
+++ b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.cpp
@@ -173,10 +173,9 @@ VE::Fixups VEMCExpr::getFixupKind(VEMCExpr::VariantKind Kind) {
}
}
-bool VEMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+bool VEMCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const {
- if (!getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup))
+ if (!getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup))
return false;
Res =
diff --git a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
index 2da956d..ec71f9d 100644
--- a/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
+++ b/llvm/lib/Target/VE/MCTargetDesc/VEMCExpr.h
@@ -69,7 +69,7 @@ public:
/// @}
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/Target/WebAssembly/WebAssembly.td b/llvm/lib/Target/WebAssembly/WebAssembly.td
index 0dd6744..9761861 100644
--- a/llvm/lib/Target/WebAssembly/WebAssembly.td
+++ b/llvm/lib/Target/WebAssembly/WebAssembly.td
@@ -110,13 +110,17 @@ def : ProcessorModel<"mvp", NoSchedModel, []>;
// consideration given to available support in relevant engines and tools, and
// the importance of the features.
def : ProcessorModel<"generic", NoSchedModel,
- [FeatureSignExt, FeatureMutableGlobals]>;
+ [FeatureMultivalue, FeatureMutableGlobals,
+ FeatureReferenceTypes, FeatureSignExt]>;
// Latest and greatest experimental version of WebAssembly. Bugs included!
def : ProcessorModel<"bleeding-edge", NoSchedModel,
- [FeatureSIMD128, FeatureAtomics,
- FeatureNontrappingFPToInt, FeatureSignExt,
- FeatureMutableGlobals, FeatureBulkMemory,
+ [FeatureAtomics, FeatureBulkMemory,
+ FeatureExceptionHandling, FeatureExtendedConst,
+ FeatureHalfPrecision, FeatureMultiMemory,
+ FeatureMultivalue, FeatureMutableGlobals,
+ FeatureNontrappingFPToInt, FeatureRelaxedSIMD,
+ FeatureReferenceTypes, FeatureSIMD128, FeatureSignExt,
FeatureTailCall]>;
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
index 670ff35..09a6d57 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -13,7 +13,6 @@
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
@@ -202,7 +201,7 @@ public:
bool padInstructionEncoding(MCRelaxableFragment &RF, MCCodeEmitter &Emitter,
unsigned &RemainingSize) const;
- void finishLayout(MCAssembler const &Asm, MCAsmLayout &Layout) const override;
+ void finishLayout(const MCAssembler &Asm) const override;
unsigned getMaximumNopSize(const MCSubtargetInfo &STI) const override;
@@ -857,8 +856,7 @@ bool X86AsmBackend::padInstructionEncoding(MCRelaxableFragment &RF,
return Changed;
}
-void X86AsmBackend::finishLayout(MCAssembler const &Asm,
- MCAsmLayout &Layout) const {
+void X86AsmBackend::finishLayout(MCAssembler const &Asm) const {
// See if we can further relax some instructions to cut down on the number of
// nop bytes required for code alignment. The actual win is in reducing
// instruction count, not number of bytes. Modern X86-64 can easily end up
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h b/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h
index db91d38..c159d30 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCExpr.h
@@ -53,7 +53,7 @@ public:
OS << X86ATTInstPrinter::getRegisterName(RegNo);
}
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override {
return false;
}
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
index d28195f..ec95b1f 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
@@ -12,7 +12,6 @@
#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmInfoDarwin.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCMachObjectWriter.h"
@@ -185,12 +184,10 @@ void X86MachObjectWriter::RecordX86_64Relocation(
return;
}
- Value +=
- Writer->getSymbolAddress(*A, *Asm.getLayout()) -
- (!A_Base ? 0 : Writer->getSymbolAddress(*A_Base, *Asm.getLayout()));
- Value -=
- Writer->getSymbolAddress(*B, *Asm.getLayout()) -
- (!B_Base ? 0 : Writer->getSymbolAddress(*B_Base, *Asm.getLayout()));
+ Value += Writer->getSymbolAddress(*A, Asm) -
+ (!A_Base ? 0 : Writer->getSymbolAddress(*A_Base, Asm));
+ Value -= Writer->getSymbolAddress(*B, Asm) -
+ (!B_Base ? 0 : Writer->getSymbolAddress(*B_Base, Asm));
if (!A_Base)
Index = A->getFragment()->getParent()->getOrdinal() + 1;
@@ -237,7 +234,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
} else if (Symbol->isInSection() && !Symbol->isVariable()) {
// The index is the section ordinal (1-based).
Index = Symbol->getFragment()->getParent()->getOrdinal() + 1;
- Value += Writer->getSymbolAddress(*Symbol, *Asm.getLayout());
+ Value += Writer->getSymbolAddress(*Symbol, Asm);
if (IsPCRel)
Value -= FixupAddress + (1 << Log2Size);
@@ -376,7 +373,7 @@ bool X86MachObjectWriter::recordScatteredRelocation(MachObjectWriter *Writer,
return false;
}
- uint32_t Value = Writer->getSymbolAddress(*A, *Asm.getLayout());
+ uint32_t Value = Writer->getSymbolAddress(*A, Asm);
uint64_t SecAddr = Writer->getSectionAddress(A->getFragment()->getParent());
FixedValue += SecAddr;
uint32_t Value2 = 0;
@@ -399,7 +396,7 @@ bool X86MachObjectWriter::recordScatteredRelocation(MachObjectWriter *Writer,
// pedantic compatibility with 'as'.
Type = A->isExternal() ? (unsigned)MachO::GENERIC_RELOC_SECTDIFF
: (unsigned)MachO::GENERIC_RELOC_LOCAL_SECTDIFF;
- Value2 = Writer->getSymbolAddress(*SB, *Asm.getLayout());
+ Value2 = Writer->getSymbolAddress(*SB, Asm);
FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
}
@@ -476,7 +473,7 @@ void X86MachObjectWriter::recordTLVPRelocation(MachObjectWriter *Writer,
Writer->getFragmentAddress(Asm, Fragment) + Fixup.getOffset();
IsPCRel = 1;
FixedValue = FixupAddress -
- Writer->getSymbolAddress(SymB->getSymbol(), *Asm.getLayout()) +
+ Writer->getSymbolAddress(SymB->getSymbol(), Asm) +
Target.getConstant();
FixedValue += 1ULL << Log2Size;
} else {
diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp
index cafd8b7..900ce3c 100644
--- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp
+++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.cpp
@@ -41,9 +41,9 @@ void XtensaMCExpr::printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const {
}
bool XtensaMCExpr::evaluateAsRelocatableImpl(MCValue &Res,
- const MCAsmLayout *Layout,
+ const MCAssembler *Asm,
const MCFixup *Fixup) const {
- return getSubExpr()->evaluateAsRelocatable(Res, Layout, Fixup);
+ return getSubExpr()->evaluateAsRelocatable(Res, Asm, Fixup);
}
void XtensaMCExpr::visitUsedExpr(MCStreamer &Streamer) const {
diff --git a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h
index 4cc78fe..92ffb5c 100644
--- a/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h
+++ b/llvm/lib/Target/Xtensa/MCTargetDesc/XtensaMCExpr.h
@@ -40,7 +40,7 @@ public:
const MCExpr *getSubExpr() const { return Expr; }
void printImpl(raw_ostream &OS, const MCAsmInfo *MAI) const override;
- bool evaluateAsRelocatableImpl(MCValue &Res, const MCAsmLayout *Layout,
+ bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
const MCFixup *Fixup) const override;
void visitUsedExpr(MCStreamer &Streamer) const override;
MCFragment *findAssociatedFragment() const override {
diff --git a/llvm/lib/TargetParser/RISCVISAInfo.cpp b/llvm/lib/TargetParser/RISCVISAInfo.cpp
index 2a6ecee..869be57 100644
--- a/llvm/lib/TargetParser/RISCVISAInfo.cpp
+++ b/llvm/lib/TargetParser/RISCVISAInfo.cpp
@@ -171,11 +171,6 @@ findDefaultVersion(StringRef ExtName) {
return std::nullopt;
}
-bool RISCVISAInfo::addExtension(StringRef ExtName,
- RISCVISAUtils::ExtensionVersion Version) {
- return Exts.emplace(ExtName, Version).second;
-}
-
static StringRef getExtensionTypeDesc(StringRef Ext) {
if (Ext.starts_with('s'))
return "standard supervisor-level extension";
@@ -431,7 +426,7 @@ RISCVISAInfo::parseFeatures(unsigned XLen,
continue;
if (Add)
- ISAInfo->addExtension(ExtName, ExtensionInfoIterator->Version);
+ ISAInfo->Exts[ExtName.str()] = ExtensionInfoIterator->Version;
else
ISAInfo->Exts.erase(ExtName.str());
}
@@ -513,7 +508,11 @@ RISCVISAInfo::parseNormalizedArchString(StringRef Arch) {
"'" + Twine(ExtName[0]) +
"' must be followed by a letter");
- if (!ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion}))
+ if (!ISAInfo->Exts
+ .emplace(
+ ExtName.str(),
+ RISCVISAUtils::ExtensionVersion{MajorVersion, MinorVersion})
+ .second)
return createStringError(errc::invalid_argument,
"duplicate extension '" + ExtName + "'");
}
@@ -586,6 +585,10 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
// The canonical order specified in ISA manual.
// Ref: Table 22.1 in RISC-V User-Level ISA V2.2
char Baseline = Arch.front();
+ // Skip the baseline.
+ StringRef Exts = Arch.drop_front();
+
+ unsigned Major, Minor, ConsumeLength;
// First letter should be 'e', 'i' or 'g'.
switch (Baseline) {
@@ -595,20 +598,29 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
"\' should be 'e', 'i' or 'g'");
case 'e':
case 'i':
+ // Baseline is `i` or `e`
+ if (auto E = getExtensionVersion(
+ StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
+ EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
+ if (!IgnoreUnknown)
+ return std::move(E);
+ // If IgnoreUnknown, then ignore an unrecognised version of the baseline
+ // ISA and just use the default supported version.
+ consumeError(std::move(E));
+ auto Version = findDefaultVersion(StringRef(&Baseline, 1));
+ Major = Version->Major;
+ Minor = Version->Minor;
+ }
+
+ // Postpone AddExtension until end of this function
+ SeenExtMap[StringRef(&Baseline, 1).str()] = {Major, Minor};
break;
case 'g':
// g expands to extensions in RISCVGImplications.
if (Arch.size() > 1 && isDigit(Arch[1]))
return createStringError(errc::invalid_argument,
"version not supported for 'g'");
- break;
- }
- // Skip baseline.
- StringRef Exts = Arch.drop_front(1);
-
- unsigned Major, Minor, ConsumeLength;
- if (Baseline == 'g') {
// Versions for g are disallowed, and this was checked for previously.
ConsumeLength = 0;
@@ -621,23 +633,7 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
// Postpone AddExtension until end of this function
SeenExtMap[Ext] = {Version->Major, Version->Minor};
}
- } else {
- // Baseline is `i` or `e`
- if (auto E = getExtensionVersion(
- StringRef(&Baseline, 1), Exts, Major, Minor, ConsumeLength,
- EnableExperimentalExtension, ExperimentalExtensionVersionCheck)) {
- if (!IgnoreUnknown)
- return std::move(E);
- // If IgnoreUnknown, then ignore an unrecognised version of the baseline
- // ISA and just use the default supported version.
- consumeError(std::move(E));
- auto Version = findDefaultVersion(StringRef(&Baseline, 1));
- Major = Version->Major;
- Minor = Version->Minor;
- }
-
- // Postpone AddExtension until end of this function
- SeenExtMap[StringRef(&Baseline, 1).str()] = {Major, Minor};
+ break;
}
// Consume the base ISA version number and any '_' between rvxxx and the
@@ -695,13 +691,13 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
if (auto E = getExtensionVersion(Name, Vers, Major, Minor, ConsumeLength,
EnableExperimentalExtension,
ExperimentalExtensionVersionCheck)) {
- if (IgnoreUnknown) {
- consumeError(std::move(E));
- if (Name.size() == 1)
- Ext = Ext.substr(ConsumeLength);
- continue;
- }
- return E;
+ if (!IgnoreUnknown)
+ return E;
+
+ consumeError(std::move(E));
+ if (Name.size() == 1)
+ Ext = Ext.substr(ConsumeLength);
+ continue;
}
if (Name.size() == 1)
@@ -722,11 +718,10 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
// Check all Extensions are supported.
for (auto &SeenExtAndVers : SeenExtMap) {
const std::string &ExtName = SeenExtAndVers.first;
- RISCVISAUtils::ExtensionVersion ExtVers = SeenExtAndVers.second;
if (!RISCVISAInfo::isSupportedExtension(ExtName))
return getStringErrorForInvalidExt(ExtName);
- ISAInfo->addExtension(ExtName, ExtVers);
+ ISAInfo->Exts[ExtName] = SeenExtAndVers.second;
}
return RISCVISAInfo::postProcessAndChecking(std::move(ISAInfo));
@@ -830,7 +825,7 @@ void RISCVISAInfo::updateImplication() {
// implied
if (!HasE && !HasI) {
auto Version = findDefaultVersion("i");
- addExtension("i", *Version);
+ Exts["i"] = *Version;
}
if (HasE && HasI)
@@ -854,7 +849,7 @@ void RISCVISAInfo::updateImplication() {
if (Exts.count(ImpliedExt))
return;
auto Version = findDefaultVersion(ImpliedExt);
- addExtension(ImpliedExt, *Version);
+ Exts[ImpliedExt] = *Version;
WorkList.push_back(ImpliedExt);
});
}
@@ -863,7 +858,7 @@ void RISCVISAInfo::updateImplication() {
if (XLen == 32 && Exts.count("zce") && Exts.count("f") &&
!Exts.count("zcf")) {
auto Version = findDefaultVersion("zcf");
- addExtension("zcf", *Version);
+ Exts["zcf"] = *Version;
}
}
@@ -890,7 +885,7 @@ void RISCVISAInfo::updateCombination() {
});
if (HasAllRequiredFeatures) {
auto Version = findDefaultVersion(CombineExt);
- addExtension(CombineExt, *Version);
+ Exts[CombineExt.str()] = *Version;
MadeChange = true;
}
}
diff --git a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
index cc375f9..1f787c7 100644
--- a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -15,12 +15,12 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionCache.h"
+#include "llvm/Analysis/InlineAdvisor.h"
#include "llvm/Analysis/InlineCost.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ProfileSummaryInfo.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
-#include "llvm/Transforms/IPO/Inliner.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"
@@ -37,86 +37,73 @@ bool AlwaysInlineImpl(
function_ref<BlockFrequencyInfo &(Function &)> GetBFI) {
SmallSetVector<CallBase *, 16> Calls;
bool Changed = false;
- SmallVector<Function *, 16> InlinedFunctions;
- for (Function &F : M) {
- // When callee coroutine function is inlined into caller coroutine function
- // before coro-split pass,
- // coro-early pass can not handle this quiet well.
- // So we won't inline the coroutine function if it have not been unsplited
+ SmallVector<Function *, 16> InlinedComdatFunctions;
+
+ for (Function &F : make_early_inc_range(M)) {
if (F.isPresplitCoroutine())
continue;
- if (!F.isDeclaration() && isInlineViable(F).isSuccess()) {
- Calls.clear();
-
- for (User *U : F.users())
- if (auto *CB = dyn_cast<CallBase>(U))
- if (CB->getCalledFunction() == &F &&
- CB->hasFnAttr(Attribute::AlwaysInline) &&
- !CB->getAttributes().hasFnAttr(Attribute::NoInline))
- Calls.insert(CB);
-
- for (CallBase *CB : Calls) {
- Function *Caller = CB->getCaller();
- OptimizationRemarkEmitter ORE(Caller);
- DebugLoc DLoc = CB->getDebugLoc();
- BasicBlock *Block = CB->getParent();
-
- InlineFunctionInfo IFI(GetAssumptionCache, &PSI,
- GetBFI ? &GetBFI(*Caller) : nullptr,
- GetBFI ? &GetBFI(F) : nullptr);
-
- InlineResult Res = InlineFunction(*CB, IFI, /*MergeAttributes=*/true,
- &GetAAR(F), InsertLifetime);
- if (!Res.isSuccess()) {
- ORE.emit([&]() {
- return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc,
- Block)
- << "'" << ore::NV("Callee", &F) << "' is not inlined into '"
- << ore::NV("Caller", Caller)
- << "': " << ore::NV("Reason", Res.getFailureReason());
- });
- continue;
- }
-
- emitInlinedIntoBasedOnCost(
- ORE, DLoc, Block, F, *Caller,
- InlineCost::getAlways("always inline attribute"),
- /*ForProfileContext=*/false, DEBUG_TYPE);
+ if (F.isDeclaration() || !isInlineViable(F).isSuccess())
+ continue;
- Changed = true;
+ Calls.clear();
+
+ for (User *U : F.users())
+ if (auto *CB = dyn_cast<CallBase>(U))
+ if (CB->getCalledFunction() == &F &&
+ CB->hasFnAttr(Attribute::AlwaysInline) &&
+ !CB->getAttributes().hasFnAttr(Attribute::NoInline))
+ Calls.insert(CB);
+
+ for (CallBase *CB : Calls) {
+ Function *Caller = CB->getCaller();
+ OptimizationRemarkEmitter ORE(Caller);
+ DebugLoc DLoc = CB->getDebugLoc();
+ BasicBlock *Block = CB->getParent();
+
+ InlineFunctionInfo IFI(GetAssumptionCache, &PSI,
+ GetBFI ? &GetBFI(*Caller) : nullptr,
+ GetBFI ? &GetBFI(F) : nullptr);
+
+ InlineResult Res = InlineFunction(*CB, IFI, /*MergeAttributes=*/true,
+ &GetAAR(F), InsertLifetime);
+ if (!Res.isSuccess()) {
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+ << "'" << ore::NV("Callee", &F) << "' is not inlined into '"
+ << ore::NV("Caller", Caller)
+ << "': " << ore::NV("Reason", Res.getFailureReason());
+ });
+ continue;
}
- if (F.hasFnAttribute(Attribute::AlwaysInline)) {
- // Remember to try and delete this function afterward. This both avoids
- // re-walking the rest of the module and avoids dealing with any
- // iterator invalidation issues while deleting functions.
- InlinedFunctions.push_back(&F);
- }
+ emitInlinedIntoBasedOnCost(
+ ORE, DLoc, Block, F, *Caller,
+ InlineCost::getAlways("always inline attribute"),
+ /*ForProfileContext=*/false, DEBUG_TYPE);
+
+ Changed = true;
}
- }
- // Remove any live functions.
- erase_if(InlinedFunctions, [&](Function *F) {
- F->removeDeadConstantUsers();
- return !F->isDefTriviallyDead();
- });
-
- // Delete the non-comdat ones from the module and also from our vector.
- auto NonComdatBegin = partition(
- InlinedFunctions, [&](Function *F) { return F->hasComdat(); });
- for (Function *F : make_range(NonComdatBegin, InlinedFunctions.end())) {
- M.getFunctionList().erase(F);
- Changed = true;
+ F.removeDeadConstantUsers();
+ if (F.hasFnAttribute(Attribute::AlwaysInline) && F.isDefTriviallyDead()) {
+ // Remember to try and delete this function afterward. This allows to call
+ // filterDeadComdatFunctions() only once.
+ if (F.hasComdat()) {
+ InlinedComdatFunctions.push_back(&F);
+ } else {
+ M.getFunctionList().erase(F);
+ Changed = true;
+ }
+ }
}
- InlinedFunctions.erase(NonComdatBegin, InlinedFunctions.end());
- if (!InlinedFunctions.empty()) {
+ if (!InlinedComdatFunctions.empty()) {
// Now we just have the comdat functions. Filter out the ones whose comdats
// are not actually dead.
- filterDeadComdatFunctions(InlinedFunctions);
+ filterDeadComdatFunctions(InlinedComdatFunctions);
// The remaining functions are actually dead.
- for (Function *F : InlinedFunctions) {
+ for (Function *F : InlinedComdatFunctions) {
M.getFunctionList().erase(F);
Changed = true;
}
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index a47f976..2816a85 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -1621,13 +1621,6 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
return true;
};
- const auto *F = getAnchorScope();
- const auto *CI =
- F ? A.getInfoCache().getAnalysisResultForFunction<CycleAnalysis>(*F)
- : nullptr;
- const auto *TLI =
- F ? A.getInfoCache().getTargetLibraryInfoForFunction(*F) : nullptr;
-
auto UsePred = [&](const Use &U, bool &Follow) -> bool {
Value *CurPtr = U.get();
User *Usr = U.getUser();
@@ -1671,18 +1664,18 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
// For PHIs we need to take care of the recurrence explicitly as the value
// might change while we iterate through a loop. For now, we give up if
// the PHI is not invariant.
- if (isa<PHINode>(Usr)) {
+ if (auto *PHI = dyn_cast<PHINode>(Usr)) {
// Note the order here, the Usr access might change the map, CurPtr is
// already in it though.
- bool IsFirstPHIUser = !OffsetInfoMap.count(Usr);
- auto &UsrOI = OffsetInfoMap[Usr];
+ bool IsFirstPHIUser = !OffsetInfoMap.count(PHI);
+ auto &UsrOI = OffsetInfoMap[PHI];
auto &PtrOI = OffsetInfoMap[CurPtr];
// Check if the PHI operand has already an unknown offset as we can't
// improve on that anymore.
if (PtrOI.isUnknown()) {
LLVM_DEBUG(dbgs() << "[AAPointerInfo] PHI operand offset unknown "
- << *CurPtr << " in " << *Usr << "\n");
+ << *CurPtr << " in " << *PHI << "\n");
Follow = !UsrOI.isUnknown();
UsrOI.setUnknown();
return true;
@@ -1705,7 +1698,8 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
auto It = OffsetInfoMap.find(CurPtrBase);
if (It == OffsetInfoMap.end()) {
LLVM_DEBUG(dbgs() << "[AAPointerInfo] PHI operand is too complex "
- << *CurPtr << " in " << *Usr << "\n");
+ << *CurPtr << " in " << *PHI
+ << " (base: " << *CurPtrBase << ")\n");
UsrOI.setUnknown();
Follow = true;
return true;
@@ -1718,6 +1712,9 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
// Cycles reported by CycleInfo. It is sufficient to check the PHIs in
// every Cycle header; if such a node is marked unknown, this will
// eventually propagate through the whole net of PHIs in the recurrence.
+ const auto *CI =
+ A.getInfoCache().getAnalysisResultForFunction<CycleAnalysis>(
+ *PHI->getFunction());
if (mayBeInCycle(CI, cast<Instruction>(Usr), /* HeaderOnly */ true)) {
auto BaseOI = It->getSecond();
BaseOI.addToAll(Offset.getZExtValue());
@@ -1729,7 +1726,7 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
LLVM_DEBUG(
dbgs() << "[AAPointerInfo] PHI operand pointer offset mismatch "
- << *CurPtr << " in " << *Usr << "\n");
+ << *CurPtr << " in " << *PHI << "\n");
UsrOI.setUnknown();
Follow = true;
return true;
@@ -1882,6 +1879,8 @@ ChangeStatus AAPointerInfoFloating::updateImpl(Attributor &A) {
if (auto *CB = dyn_cast<CallBase>(Usr)) {
if (CB->isLifetimeStartOrEnd())
return true;
+ const auto *TLI =
+ A.getInfoCache().getTargetLibraryInfoForFunction(*CB->getFunction());
if (getFreedOperand(CB, TLI) == U)
return true;
if (CB->isArgOperand(&U)) {
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 9291e6e..0ca56f0 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -2641,6 +2641,31 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
return BinaryOperator::CreateFMulFMF(Src, Select, II);
}
+ // ldexp(x, c ? exp : 0) -> c ? ldexp(x, exp) : x
+ // ldexp(x, c ? 0 : exp) -> c ? x : ldexp(x, exp)
+ ///
+ // TODO: If we cared, should insert a canonicalize for x
+ Value *SelectCond, *SelectLHS, *SelectRHS;
+ if (match(II->getArgOperand(1),
+ m_OneUse(m_Select(m_Value(SelectCond), m_Value(SelectLHS),
+ m_Value(SelectRHS))))) {
+ Value *NewLdexp = nullptr;
+ Value *Select = nullptr;
+ if (match(SelectRHS, m_ZeroInt())) {
+ NewLdexp = Builder.CreateLdexp(Src, SelectLHS);
+ Select = Builder.CreateSelect(SelectCond, NewLdexp, Src);
+ } else if (match(SelectLHS, m_ZeroInt())) {
+ NewLdexp = Builder.CreateLdexp(Src, SelectRHS);
+ Select = Builder.CreateSelect(SelectCond, Src, NewLdexp);
+ }
+
+ if (NewLdexp) {
+ Select->takeName(II);
+ cast<Instruction>(NewLdexp)->copyFastMathFlags(II);
+ return replaceInstUsesWith(*II, Select);
+ }
+ }
+
break;
}
case Intrinsic::ptrauth_auth:
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 318c455..64fbcc8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -545,10 +545,11 @@ public:
ConstantInt *&Less, ConstantInt *&Equal,
ConstantInt *&Greater);
- /// Attempts to replace V with a simpler value based on the demanded
+ /// Attempts to replace I with a simpler value based on the demanded
/// bits.
- Value *SimplifyDemandedUseBits(Value *V, APInt DemandedMask, KnownBits &Known,
- unsigned Depth, const SimplifyQuery &Q);
+ Value *SimplifyDemandedUseBits(Instruction *I, const APInt &DemandedMask,
+ KnownBits &Known, unsigned Depth,
+ const SimplifyQuery &Q);
using InstCombiner::SimplifyDemandedBits;
bool SimplifyDemandedBits(Instruction *I, unsigned Op,
const APInt &DemandedMask, KnownBits &Known,
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index 6cf2e71..98f085a 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -91,8 +91,38 @@ bool InstCombinerImpl::SimplifyDemandedBits(Instruction *I, unsigned OpNo,
KnownBits &Known, unsigned Depth,
const SimplifyQuery &Q) {
Use &U = I->getOperandUse(OpNo);
- Value *NewVal = SimplifyDemandedUseBits(U.get(), DemandedMask, Known,
- Depth, Q);
+ Value *V = U.get();
+ if (isa<Constant>(V)) {
+ llvm::computeKnownBits(V, Known, Depth, Q);
+ return false;
+ }
+
+ Known.resetAll();
+ if (DemandedMask.isZero()) {
+ // Not demanding any bits from V.
+ replaceUse(U, UndefValue::get(V->getType()));
+ return true;
+ }
+
+ if (Depth == MaxAnalysisRecursionDepth)
+ return false;
+
+ Instruction *VInst = dyn_cast<Instruction>(V);
+ if (!VInst) {
+ llvm::computeKnownBits(V, Known, Depth, Q);
+ return false;
+ }
+
+ Value *NewVal;
+ if (VInst->hasOneUse()) {
+ // If the instruction has one use, we can directly simplify it.
+ NewVal = SimplifyDemandedUseBits(VInst, DemandedMask, Known, Depth, Q);
+ } else {
+ // If there are multiple uses of this instruction, then we can simplify
+ // VInst to some other value, but not modify the instruction.
+ NewVal =
+ SimplifyMultipleUseDemandedBits(VInst, DemandedMask, Known, Depth, Q);
+ }
if (!NewVal) return false;
if (Instruction* OpInst = dyn_cast<Instruction>(U))
salvageDebugInfo(*OpInst);
@@ -124,50 +154,21 @@ bool InstCombinerImpl::SimplifyDemandedBits(Instruction *I, unsigned OpNo,
/// operands based on the information about what bits are demanded. This returns
/// some other non-null value if it found out that V is equal to another value
/// in the context where the specified bits are demanded, but not for all users.
-Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
+Value *InstCombinerImpl::SimplifyDemandedUseBits(Instruction *I,
+ const APInt &DemandedMask,
KnownBits &Known,
unsigned Depth,
const SimplifyQuery &Q) {
- assert(V != nullptr && "Null pointer of Value???");
+ assert(I != nullptr && "Null pointer of Value???");
assert(Depth <= MaxAnalysisRecursionDepth && "Limit Search Depth");
uint32_t BitWidth = DemandedMask.getBitWidth();
- Type *VTy = V->getType();
+ Type *VTy = I->getType();
assert(
(!VTy->isIntOrIntVectorTy() || VTy->getScalarSizeInBits() == BitWidth) &&
Known.getBitWidth() == BitWidth &&
"Value *V, DemandedMask and Known must have same BitWidth");
- if (isa<Constant>(V)) {
- llvm::computeKnownBits(V, Known, Depth, Q);
- return nullptr;
- }
-
- Known.resetAll();
- if (DemandedMask.isZero()) // Not demanding any bits from V.
- return UndefValue::get(VTy);
-
- if (Depth == MaxAnalysisRecursionDepth)
- return nullptr;
-
- Instruction *I = dyn_cast<Instruction>(V);
- if (!I) {
- llvm::computeKnownBits(V, Known, Depth, Q);
- return nullptr; // Only analyze instructions.
- }
-
- // If there are multiple uses of this value and we aren't at the root, then
- // we can't do any simplifications of the operands, because DemandedMask
- // only reflects the bits demanded by *one* of the users.
- if (Depth != 0 && !I->hasOneUse())
- return SimplifyMultipleUseDemandedBits(I, DemandedMask, Known, Depth, Q);
-
KnownBits LHSKnown(BitWidth), RHSKnown(BitWidth);
- // If this is the root being simplified, allow it to have multiple uses,
- // just set the DemandedMask to all bits so that we can try to simplify the
- // operands. This allows visitTruncInst (for example) to simplify the
- // operand of a trunc without duplicating all the logic below.
- if (Depth == 0 && !V->hasOneUse())
- DemandedMask.setAllBits();
// Update flags after simplifying an operand based on the fact that some high
// order bits are not demanded.
@@ -1105,13 +1106,13 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
}
if (!KnownBitsComputed)
- llvm::computeKnownBits(V, Known, Depth, Q);
+ llvm::computeKnownBits(I, Known, Depth, Q);
break;
}
}
- if (V->getType()->isPointerTy()) {
- Align Alignment = V->getPointerAlignment(DL);
+ if (I->getType()->isPointerTy()) {
+ Align Alignment = I->getPointerAlignment(DL);
Known.Zero.setLowBits(Log2(Alignment));
}
@@ -1119,13 +1120,14 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
// constant. We can't directly simplify pointers as a constant because of
// pointer provenance.
// TODO: We could return `(inttoptr const)` for pointers.
- if (!V->getType()->isPointerTy() && DemandedMask.isSubsetOf(Known.Zero | Known.One))
+ if (!I->getType()->isPointerTy() &&
+ DemandedMask.isSubsetOf(Known.Zero | Known.One))
return Constant::getIntegerValue(VTy, Known.One);
if (VerifyKnownBits) {
- KnownBits ReferenceKnown = llvm::computeKnownBits(V, Depth, Q);
+ KnownBits ReferenceKnown = llvm::computeKnownBits(I, Depth, Q);
if (Known != ReferenceKnown) {
- errs() << "Mismatched known bits for " << *V << " in "
+ errs() << "Mismatched known bits for " << *I << " in "
<< I->getFunction()->getName() << "\n";
errs() << "computeKnownBits(): " << ReferenceKnown << "\n";
errs() << "SimplifyDemandedBits(): " << Known << "\n";
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index 6a5aeeb..0d1f506 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -547,18 +547,17 @@ Instruction *IndirectCallPromoter::computeVTableInfos(
for (size_t I = 0; I < Candidates.size(); I++)
CalleeIndexMap[Candidates[I].TargetFunction] = I;
- uint32_t ActualNumValueData = 0;
uint64_t TotalVTableCount = 0;
- auto VTableValueDataArray = getValueProfDataFromInst(
- *VirtualCallInfo.VPtr, IPVK_VTableTarget, MaxNumVTableAnnotations,
- ActualNumValueData, TotalVTableCount);
- if (VTableValueDataArray.get() == nullptr)
+ auto VTableValueDataArray =
+ getValueProfDataFromInst(*VirtualCallInfo.VPtr, IPVK_VTableTarget,
+ MaxNumVTableAnnotations, TotalVTableCount);
+ if (VTableValueDataArray.empty())
return VPtr;
// Compute the functions and counts from by each vtable.
- for (size_t j = 0; j < ActualNumValueData; j++) {
- uint64_t VTableVal = VTableValueDataArray[j].Value;
- GUIDCountsMap[VTableVal] = VTableValueDataArray[j].Count;
+ for (const auto &V : VTableValueDataArray) {
+ uint64_t VTableVal = V.Value;
+ GUIDCountsMap[VTableVal] = V.Count;
GlobalVariable *VTableVar = Symtab->getGlobalVariable(VTableVal);
if (!VTableVar) {
LLVM_DEBUG(dbgs() << " Cannot find vtable definition for " << VTableVal
@@ -586,7 +585,7 @@ Instruction *IndirectCallPromoter::computeVTableInfos(
// There shouldn't be duplicate GUIDs in one !prof metadata (except
// duplicated zeros), so assign counters directly won't cause overwrite or
// counter loss.
- Candidate.VTableGUIDAndCounts[VTableVal] = VTableValueDataArray[j].Count;
+ Candidate.VTableGUIDAndCounts[VTableVal] = V.Count;
Candidate.AddressPoints.push_back(
getOrCreateVTableAddressPointVar(VTableVar, AddressPointOffset));
}
diff --git a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
index 88adeb5..875d3ea 100644
--- a/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
+++ b/llvm/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
@@ -85,6 +85,7 @@ STATISTIC(NumOverflows, "Number of overflow checks removed");
STATISTIC(NumSaturating,
"Number of saturating arithmetics converted to normal arithmetics");
STATISTIC(NumNonNull, "Number of function pointer arguments marked non-null");
+STATISTIC(NumCmpIntr, "Number of llvm.[us]cmp intrinsics removed");
STATISTIC(NumMinMax, "Number of llvm.[us]{min,max} intrinsics removed");
STATISTIC(NumSMinMax,
"Number of llvm.s{min,max} intrinsics simplified to unsigned");
@@ -548,6 +549,35 @@ static bool processAbsIntrinsic(IntrinsicInst *II, LazyValueInfo *LVI) {
return false;
}
+static bool processCmpIntrinsic(IntrinsicInst *II, LazyValueInfo *LVI) {
+ bool IsSigned = II->getIntrinsicID() == Intrinsic::scmp;
+ ConstantRange LHS_CR = LVI->getConstantRangeAtUse(II->getOperandUse(0),
+ /*UndefAllowed*/ false);
+ ConstantRange RHS_CR = LVI->getConstantRangeAtUse(II->getOperandUse(1),
+ /*UndefAllowed*/ false);
+
+ if (LHS_CR.icmp(IsSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT, RHS_CR)) {
+ ++NumCmpIntr;
+ II->replaceAllUsesWith(ConstantInt::get(II->getType(), 1));
+ II->eraseFromParent();
+ return true;
+ }
+ if (LHS_CR.icmp(IsSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, RHS_CR)) {
+ ++NumCmpIntr;
+ II->replaceAllUsesWith(ConstantInt::getSigned(II->getType(), -1));
+ II->eraseFromParent();
+ return true;
+ }
+ if (LHS_CR.icmp(ICmpInst::ICMP_EQ, RHS_CR)) {
+ ++NumCmpIntr;
+ II->replaceAllUsesWith(ConstantInt::get(II->getType(), 0));
+ II->eraseFromParent();
+ return true;
+ }
+
+ return false;
+}
+
// See if this min/max intrinsic always picks it's one specific operand.
// If not, check whether we can canonicalize signed minmax into unsigned version
static bool processMinMaxIntrinsic(MinMaxIntrinsic *MM, LazyValueInfo *LVI) {
@@ -639,6 +669,11 @@ static bool processCallSite(CallBase &CB, LazyValueInfo *LVI) {
return processAbsIntrinsic(&cast<IntrinsicInst>(CB), LVI);
}
+ if (CB.getIntrinsicID() == Intrinsic::scmp ||
+ CB.getIntrinsicID() == Intrinsic::ucmp) {
+ return processCmpIntrinsic(&cast<IntrinsicInst>(CB), LVI);
+ }
+
if (auto *MM = dyn_cast<MinMaxIntrinsic>(&CB)) {
return processMinMaxIntrinsic(MM, LVI);
}
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 6f62545..6e021a5 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -41,6 +41,7 @@
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/User.h"
#include "llvm/Support/Casting.h"
@@ -392,6 +393,9 @@ struct PromoteMem2Reg {
/// Lazily compute the number of predecessors a block has.
DenseMap<const BasicBlock *, unsigned> BBNumPreds;
+ /// Whether the function has the no-signed-zeros-fp-math attribute set.
+ bool NoSignedZeros = false;
+
public:
PromoteMem2Reg(ArrayRef<AllocaInst *> Allocas, DominatorTree &DT,
AssumptionCache *AC)
@@ -739,6 +743,8 @@ void PromoteMem2Reg::run() {
LargeBlockInfo LBI;
ForwardIDFCalculator IDF(DT);
+ NoSignedZeros = F.getFnAttribute("no-signed-zeros-fp-math").getValueAsBool();
+
for (unsigned AllocaNum = 0; AllocaNum != Allocas.size(); ++AllocaNum) {
AllocaInst *AI = Allocas[AllocaNum];
@@ -1122,6 +1128,14 @@ NextIteration:
for (unsigned i = 0; i != NumEdges; ++i)
APN->addIncoming(IncomingVals[AllocaNo], Pred);
+ // For the sequence `return X > 0.0 ? X : -X`, it is expected that this
+ // results in fabs intrinsic. However, without no-signed-zeros(nsz) flag
+ // on the phi node generated at this stage, fabs folding does not
+ // happen. So, we try to infer nsz flag from the function attributes to
+ // enable this fabs folding.
+ if (isa<FPMathOperator>(APN) && NoSignedZeros)
+ APN->setHasNoSignedZeros(true);
+
// The currently active variable for this block is now the PHI.
IncomingVals[AllocaNo] = APN;
AllocaATInfo[AllocaNo].updateForNewPhi(APN, DIB);
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
index 74af0ef..e38505c 100644
--- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
@@ -312,6 +312,7 @@ bool SimplifyIndvar::eliminateSDiv(BinaryOperator *SDiv) {
SDiv->getName() + ".udiv", SDiv->getIterator());
UDiv->setIsExact(SDiv->isExact());
SDiv->replaceAllUsesWith(UDiv);
+ UDiv->setDebugLoc(SDiv->getDebugLoc());
LLVM_DEBUG(dbgs() << "INDVARS: Simplified sdiv: " << *SDiv << '\n');
++NumSimplifiedSDiv;
Changed = true;
@@ -328,6 +329,7 @@ void SimplifyIndvar::replaceSRemWithURem(BinaryOperator *Rem) {
auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
Rem->getName() + ".urem", Rem->getIterator());
Rem->replaceAllUsesWith(URem);
+ URem->setDebugLoc(Rem->getDebugLoc());
LLVM_DEBUG(dbgs() << "INDVARS: Simplified srem: " << *Rem << '\n');
++NumSimplifiedSRem;
Changed = true;
@@ -351,6 +353,7 @@ void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) {
SelectInst *Sel =
SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator());
Rem->replaceAllUsesWith(Sel);
+ Sel->setDebugLoc(Rem->getDebugLoc());
LLVM_DEBUG(dbgs() << "INDVARS: Simplified rem: " << *Rem << '\n');
++NumElimRem;
Changed = true;
diff --git a/llvm/lib/Transforms/Utils/SplitModule.cpp b/llvm/lib/Transforms/Utils/SplitModule.cpp
index 9c39c26d..55db373 100644
--- a/llvm/lib/Transforms/Utils/SplitModule.cpp
+++ b/llvm/lib/Transforms/Utils/SplitModule.cpp
@@ -105,7 +105,8 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
// At this point module should have the proper mix of globals and locals.
// As we attempt to partition this module, we must not change any
// locals to globals.
- LLVM_DEBUG(dbgs() << "Partition module with (" << M.size() << ")functions\n");
+ LLVM_DEBUG(dbgs() << "Partition module with (" << M.size()
+ << ") functions\n");
ClusterMapType GVtoClusterMap;
ComdatMembersType ComdatMembers;
@@ -164,10 +165,10 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
std::priority_queue<std::pair<unsigned, unsigned>,
std::vector<std::pair<unsigned, unsigned>>,
decltype(CompareClusters)>
- BalancinQueue(CompareClusters);
+ BalancingQueue(CompareClusters);
// Pre-populate priority queue with N slot blanks.
for (unsigned i = 0; i < N; ++i)
- BalancinQueue.push(std::make_pair(i, 0));
+ BalancingQueue.push(std::make_pair(i, 0));
using SortType = std::pair<unsigned, ClusterMapType::iterator>;
@@ -177,11 +178,13 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
// To guarantee determinism, we have to sort SCC according to size.
// When size is the same, use leader's name.
for (ClusterMapType::iterator I = GVtoClusterMap.begin(),
- E = GVtoClusterMap.end(); I != E; ++I)
+ E = GVtoClusterMap.end();
+ I != E; ++I)
if (I->isLeader())
Sets.push_back(
std::make_pair(std::distance(GVtoClusterMap.member_begin(I),
- GVtoClusterMap.member_end()), I));
+ GVtoClusterMap.member_end()),
+ I));
llvm::sort(Sets, [](const SortType &a, const SortType &b) {
if (a.first == b.first)
@@ -191,9 +194,9 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
});
for (auto &I : Sets) {
- unsigned CurrentClusterID = BalancinQueue.top().first;
- unsigned CurrentClusterSize = BalancinQueue.top().second;
- BalancinQueue.pop();
+ unsigned CurrentClusterID = BalancingQueue.top().first;
+ unsigned CurrentClusterSize = BalancingQueue.top().second;
+ BalancingQueue.pop();
LLVM_DEBUG(dbgs() << "Root[" << CurrentClusterID << "] cluster_size("
<< I.first << ") ----> " << I.second->getData()->getName()
@@ -211,7 +214,7 @@ static void findPartitions(Module &M, ClusterIDMapType &ClusterIDMap,
CurrentClusterSize++;
}
// Add this set size to the number of entries in this cluster.
- BalancinQueue.push(std::make_pair(CurrentClusterID, CurrentClusterSize));
+ BalancingQueue.push(std::make_pair(CurrentClusterID, CurrentClusterSize));
}
}
@@ -275,8 +278,8 @@ void llvm::SplitModule(
ValueToValueMapTy VMap;
std::unique_ptr<Module> MPart(
CloneModule(M, VMap, [&](const GlobalValue *GV) {
- if (ClusterIDMap.count(GV))
- return (ClusterIDMap[GV] == I);
+ if (auto It = ClusterIDMap.find(GV); It != ClusterIDMap.end())
+ return It->second == I;
else
return isInPartition(GV, I, N);
}));
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index c4876bb..868e9e2 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -835,11 +835,11 @@ static InstructionsState getSameOpcode(ArrayRef<Value *> VL,
auto *CallBase = cast<CallInst>(IBase);
if (Call->getCalledFunction() != CallBase->getCalledFunction())
return InstructionsState(VL[BaseIndex], nullptr, nullptr);
- if (Call->hasOperandBundles() &&
+ if (Call->hasOperandBundles() && (!CallBase->hasOperandBundles() ||
!std::equal(Call->op_begin() + Call->getBundleOperandsStartIndex(),
Call->op_begin() + Call->getBundleOperandsEndIndex(),
CallBase->op_begin() +
- CallBase->getBundleOperandsStartIndex()))
+ CallBase->getBundleOperandsStartIndex())))
return InstructionsState(VL[BaseIndex], nullptr, nullptr);
Intrinsic::ID ID = getVectorIntrinsicIDForCall(Call, &TLI);
if (ID != BaseID)
diff --git a/llvm/llvm.spec.in b/llvm/llvm.spec.in
deleted file mode 100644
index 8d6ae75..0000000
--- a/llvm/llvm.spec.in
+++ /dev/null
@@ -1,68 +0,0 @@
-Name: @PACKAGE_NAME@
-Version: @PACKAGE_VERSION@
-Release: 0
-Summary: LLVM (An Optimizing Compiler Infrastructure)
-License: Apache-2.0 with LLVM exception
-Vendor: None (open source)
-Group: Development/Compilers
-URL: http://llvm..org/
-Source: http://llvm.org/releases/@PACKAGE_VERSION@/@PACKAGE_NAME@-@PACKAGE_VERSION@.tar.gz
-BuildRoot: %{_tmppath}/%{name}-root
-Requires: /sbin/ldconfig
-BuildRequires: gcc >= 3.4
-
-%description
-LLVM is a compiler infrastructure designed for compile-time, link-time, runtime,
-and idle-time optimization of programs from arbitrary programming languages.
-LLVM is written in C++ and has been developed since 2000 at the University of
-Illinois and Apple. It currently supports compilation of C and C++ programs,
-using front-ends derived from GCC 4.0.1. A new front-end for the C family of
-languages is in development. The compiler infrastructure
-includes mirror sets of programming tools as well as libraries with equivalent
-functionality.
-
-%prep
-%setup -q -n @PACKAGE_NAME@-@PACKAGE_VERSION@
-
-%build
-./configure \
---prefix=%{_prefix} \
---bindir=%{_bindir} \
---datadir=%{_datadir} \
---includedir=%{_includedir} \
---libdir=%{_libdir} \
---enable-optimized \
---enable-assertions
-make tools-only
-
-%install
-rm -rf %{buildroot}
-make install DESTDIR=%{buildroot}
-
-%clean
-rm -rf %{buildroot}
-
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
-%files
-%defattr(-, root, root)
-%doc CREDITS.TXT LICENSE.TXT README.txt docs/*.{html,css,gif,jpg} docs/CommandGuide
-%{_bindir}/*
-%{_libdir}/*.o
-%{_libdir}/*.a
-%{_libdir}/*.so
-%{_includedir}/llvm
-
-%changelog
-* Fri Aug 04 2006 Reid Spencer
-- Updates for release 1.8
-* Fri Apr 07 2006 Reid Spencer
-- Make the build be optimized+assertions
-* Fri May 13 2005 Reid Spencer
-- Minor adjustments for the 1.5 release
-* Mon Feb 09 2003 Brian R. Gaeke
-- Initial working version of RPM spec file.
-
-
diff --git a/llvm/test/Analysis/ValueTracking/phi-known-bits.ll b/llvm/test/Analysis/ValueTracking/phi-known-bits.ll
index 7b5e143..3728e41 100644
--- a/llvm/test/Analysis/ValueTracking/phi-known-bits.ll
+++ b/llvm/test/Analysis/ValueTracking/phi-known-bits.ll
@@ -375,10 +375,13 @@ F:
define i8 @phi_ugt_high_bits_and_known(i8 %xx) {
; CHECK-LABEL: @phi_ugt_high_bits_and_known(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[XX:%.*]], -65
+; CHECK-NEXT: [[X:%.*]] = or i8 [[XX:%.*]], 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ugt i8 [[XX]], -65
; CHECK-NEXT: br i1 [[CMP]], label [[T:%.*]], label [[F:%.*]]
; CHECK: T:
-; CHECK-NEXT: ret i8 65
+; CHECK-NEXT: [[V:%.*]] = phi i8 [ [[X]], [[ENTRY:%.*]] ], [ -1, [[F]] ]
+; CHECK-NEXT: [[R:%.*]] = and i8 [[V]], 65
+; CHECK-NEXT: ret i8 [[R]]
; CHECK: F:
; CHECK-NEXT: br label [[T]]
;
diff --git a/llvm/test/CodeGen/AArch64/popcount.ll b/llvm/test/CodeGen/AArch64/popcount.ll
index b1231ee..f60d0db 100644
--- a/llvm/test/CodeGen/AArch64/popcount.ll
+++ b/llvm/test/CodeGen/AArch64/popcount.ll
@@ -1,15 +1,28 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -O0 -mtriple=aarch64-unknown-unknown | FileCheck %s
+; RUN: llc < %s -O0 -mtriple=aarch64-unknown-unknown | FileCheck %s --check-prefix=CHECKO0
+; RUN: llc < %s -mtriple=aarch64-unknown-unknown -mattr=+neon | FileCheck %s --check-prefixes=CHECK,NEON
+; RUN: llc < %s -mtriple=aarch64-unknown-unknown -mattr=+neon,+dotprod | FileCheck %s --check-prefixes=CHECK,DOT
+; RUN: llc < %s -mtriple=aarch64-unknown-unknown -mattr=+sve | FileCheck %s --check-prefixes=CHECK,SVE
; Function Attrs: nobuiltin nounwind readonly
define i8 @popcount128(ptr nocapture nonnull readonly %0) {
+; CHECKO0-LABEL: popcount128:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: ldr q0, [x0]
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlv h0, v0.16b
+; CHECKO0-NEXT: // kill: def $q0 killed $h0
+; CHECKO0-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECKO0-NEXT: fmov w0, s0
+; CHECKO0-NEXT: ret
+;
; CHECK-LABEL: popcount128:
; CHECK: // %bb.0: // %Entry
-; CHECK-NEXT: ldr q0, [x0]
+; CHECK-NEXT: ldr d0, [x0]
+; CHECK-NEXT: add x8, x0, #8
+; CHECK-NEXT: ld1 { v0.d }[1], [x8]
; CHECK-NEXT: cnt v0.16b, v0.16b
; CHECK-NEXT: uaddlv h0, v0.16b
-; CHECK-NEXT: // kill: def $q0 killed $h0
-; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
; CHECK-NEXT: fmov w0, s0
; CHECK-NEXT: ret
Entry:
@@ -24,37 +37,54 @@ declare i128 @llvm.ctpop.i128(i128)
; Function Attrs: nobuiltin nounwind readonly
define i16 @popcount256(ptr nocapture nonnull readonly %0) {
+; CHECKO0-LABEL: popcount256:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: ldr x11, [x0]
+; CHECKO0-NEXT: ldr x10, [x0, #8]
+; CHECKO0-NEXT: ldr x9, [x0, #16]
+; CHECKO0-NEXT: ldr x8, [x0, #24]
+; CHECKO0-NEXT: // implicit-def: $q1
+; CHECKO0-NEXT: mov v1.d[0], x11
+; CHECKO0-NEXT: mov v1.d[1], x10
+; CHECKO0-NEXT: // implicit-def: $q0
+; CHECKO0-NEXT: mov v0.d[0], x9
+; CHECKO0-NEXT: mov v0.d[1], x8
+; CHECKO0-NEXT: cnt v1.16b, v1.16b
+; CHECKO0-NEXT: uaddlv h1, v1.16b
+; CHECKO0-NEXT: // kill: def $q1 killed $h1
+; CHECKO0-NEXT: // kill: def $s1 killed $s1 killed $q1
+; CHECKO0-NEXT: fmov w0, s1
+; CHECKO0-NEXT: mov w10, wzr
+; CHECKO0-NEXT: mov w9, w0
+; CHECKO0-NEXT: mov w8, w10
+; CHECKO0-NEXT: bfi x9, x8, #32, #32
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlv h0, v0.16b
+; CHECKO0-NEXT: // kill: def $q0 killed $h0
+; CHECKO0-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECKO0-NEXT: fmov w0, s0
+; CHECKO0-NEXT: mov w8, w0
+; CHECKO0-NEXT: // kill: def $x10 killed $w10
+; CHECKO0-NEXT: bfi x8, x10, #32, #32
+; CHECKO0-NEXT: adds x8, x8, x9
+; CHECKO0-NEXT: mov w0, w8
+; CHECKO0-NEXT: ret
+;
; CHECK-LABEL: popcount256:
; CHECK: // %bb.0: // %Entry
-; CHECK-NEXT: ldr x11, [x0]
-; CHECK-NEXT: ldr x10, [x0, #8]
-; CHECK-NEXT: ldr x9, [x0, #16]
-; CHECK-NEXT: ldr x8, [x0, #24]
-; CHECK-NEXT: // implicit-def: $q1
-; CHECK-NEXT: mov v1.d[0], x11
-; CHECK-NEXT: mov v1.d[1], x10
-; CHECK-NEXT: // implicit-def: $q0
-; CHECK-NEXT: mov v0.d[0], x9
-; CHECK-NEXT: mov v0.d[1], x8
-; CHECK-NEXT: cnt v1.16b, v1.16b
-; CHECK-NEXT: uaddlv h1, v1.16b
-; CHECK-NEXT: // kill: def $q1 killed $h1
-; CHECK-NEXT: // kill: def $s1 killed $s1 killed $q1
-; CHECK-NEXT: fmov w0, s1
-; CHECK-NEXT: mov w10, wzr
-; CHECK-NEXT: mov w9, w0
-; CHECK-NEXT: mov w8, w10
-; CHECK-NEXT: bfi x9, x8, #32, #32
+; CHECK-NEXT: ldr d0, [x0, #16]
+; CHECK-NEXT: ldr d1, [x0]
+; CHECK-NEXT: add x8, x0, #8
+; CHECK-NEXT: add x9, x0, #24
+; CHECK-NEXT: ld1 { v0.d }[1], [x9]
+; CHECK-NEXT: ld1 { v1.d }[1], [x8]
; CHECK-NEXT: cnt v0.16b, v0.16b
+; CHECK-NEXT: cnt v1.16b, v1.16b
; CHECK-NEXT: uaddlv h0, v0.16b
-; CHECK-NEXT: // kill: def $q0 killed $h0
-; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
-; CHECK-NEXT: fmov w0, s0
-; CHECK-NEXT: mov w8, w0
-; CHECK-NEXT: // kill: def $x10 killed $w10
-; CHECK-NEXT: bfi x8, x10, #32, #32
-; CHECK-NEXT: adds x8, x8, x9
-; CHECK-NEXT: mov w0, w8
+; CHECK-NEXT: uaddlv h1, v1.16b
+; CHECK-NEXT: fmov w8, s0
+; CHECK-NEXT: fmov w9, s1
+; CHECK-NEXT: add w0, w9, w8
; CHECK-NEXT: ret
Entry:
%1 = load i256, ptr %0, align 16
@@ -67,25 +97,215 @@ Entry:
declare i256 @llvm.ctpop.i256(i256)
define <1 x i128> @popcount1x128(<1 x i128> %0) {
+; CHECKO0-LABEL: popcount1x128:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: // implicit-def: $q0
+; CHECKO0-NEXT: mov v0.d[0], x0
+; CHECKO0-NEXT: mov v0.d[1], x1
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlv h0, v0.16b
+; CHECKO0-NEXT: // kill: def $q0 killed $h0
+; CHECKO0-NEXT: mov x1, xzr
+; CHECKO0-NEXT: // kill: def $s0 killed $s0 killed $q0
+; CHECKO0-NEXT: fmov w0, s0
+; CHECKO0-NEXT: mov w8, wzr
+; CHECKO0-NEXT: // kill: def $x0 killed $w0
+; CHECKO0-NEXT: // kill: def $x8 killed $w8
+; CHECKO0-NEXT: bfi x0, x8, #32, #32
+; CHECKO0-NEXT: ret
+;
; CHECK-LABEL: popcount1x128:
; CHECK: // %bb.0: // %Entry
-; CHECK-NEXT: // implicit-def: $q0
-; CHECK-NEXT: mov v0.d[0], x0
-; CHECK-NEXT: mov v0.d[1], x1
-; CHECK-NEXT: cnt v0.16b, v0.16b
-; CHECK-NEXT: uaddlv h0, v0.16b
-; CHECK-NEXT: // kill: def $q0 killed $h0
-; CHECK-NEXT: mov x1, xzr
-; CHECK-NEXT: // kill: def $s0 killed $s0 killed $q0
-; CHECK-NEXT: fmov w0, s0
-; CHECK-NEXT: mov w8, wzr
-; CHECK-NEXT: // kill: def $x0 killed $w0
-; CHECK-NEXT: // kill: def $x8 killed $w8
-; CHECK-NEXT: bfi x0, x8, #32, #32
+; CHECK-NEXT: fmov d1, x0
+; CHECK-NEXT: movi v0.2d, #0000000000000000
+; CHECK-NEXT: mov v1.d[1], x1
+; CHECK-NEXT: cnt v1.16b, v1.16b
+; CHECK-NEXT: uaddlv h1, v1.16b
+; CHECK-NEXT: mov v0.s[0], v1.s[0]
+; CHECK-NEXT: mov x1, v0.d[1]
+; CHECK-NEXT: fmov x0, d0
; CHECK-NEXT: ret
Entry:
- %1 = tail call <1 x i128> @llvm.ctpop.v1.i128(<1 x i128> %0)
+ %1 = tail call <1 x i128> @llvm.ctpop.v1i128(<1 x i128> %0)
ret <1 x i128> %1
}
-declare <1 x i128> @llvm.ctpop.v1.i128(<1 x i128>)
+declare <1 x i128> @llvm.ctpop.v1i128(<1 x i128>)
+
+define <2 x i64> @popcount2x64(<2 x i64> %0) {
+; CHECKO0-LABEL: popcount2x64:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlp v0.8h, v0.16b
+; CHECKO0-NEXT: uaddlp v0.4s, v0.8h
+; CHECKO0-NEXT: uaddlp v0.2d, v0.4s
+; CHECKO0-NEXT: ret
+;
+; NEON-LABEL: popcount2x64:
+; NEON: // %bb.0: // %Entry
+; NEON-NEXT: cnt v0.16b, v0.16b
+; NEON-NEXT: uaddlp v0.8h, v0.16b
+; NEON-NEXT: uaddlp v0.4s, v0.8h
+; NEON-NEXT: uaddlp v0.2d, v0.4s
+; NEON-NEXT: ret
+;
+; DOT-LABEL: popcount2x64:
+; DOT: // %bb.0: // %Entry
+; DOT-NEXT: movi v1.16b, #1
+; DOT-NEXT: cnt v0.16b, v0.16b
+; DOT-NEXT: movi v2.2d, #0000000000000000
+; DOT-NEXT: udot v2.4s, v1.16b, v0.16b
+; DOT-NEXT: uaddlp v0.2d, v2.4s
+; DOT-NEXT: ret
+;
+; SVE-LABEL: popcount2x64:
+; SVE: // %bb.0: // %Entry
+; SVE-NEXT: cnt v0.16b, v0.16b
+; SVE-NEXT: uaddlp v0.8h, v0.16b
+; SVE-NEXT: uaddlp v0.4s, v0.8h
+; SVE-NEXT: uaddlp v0.2d, v0.4s
+; SVE-NEXT: ret
+Entry:
+ %1 = tail call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %0)
+ ret <2 x i64> %1
+}
+
+declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>)
+
+define <1 x i64> @popcount1x64(<1 x i64> %0) {
+; CHECKO0-LABEL: popcount1x64:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: fmov x0, d0
+; CHECKO0-NEXT: fmov d0, x0
+; CHECKO0-NEXT: cnt v0.8b, v0.8b
+; CHECKO0-NEXT: uaddlv h0, v0.8b
+; CHECKO0-NEXT: // kill: def $q0 killed $h0
+; CHECKO0-NEXT: mov w8, v0.s[0]
+; CHECKO0-NEXT: // kill: def $x8 killed $w8
+; CHECKO0-NEXT: fmov d0, x8
+; CHECKO0-NEXT: ret
+;
+; CHECK-LABEL: popcount1x64:
+; CHECK: // %bb.0: // %Entry
+; CHECK-NEXT: cnt v0.8b, v0.8b
+; CHECK-NEXT: uaddlp v0.4h, v0.8b
+; CHECK-NEXT: uaddlp v0.2s, v0.4h
+; CHECK-NEXT: uaddlp v0.1d, v0.2s
+; CHECK-NEXT: ret
+Entry:
+ %1 = tail call <1 x i64> @llvm.ctpop.v1i64(<1 x i64> %0)
+ ret <1 x i64> %1
+}
+
+declare <1 x i64> @llvm.ctpop.v1i64(<1 x i64>)
+
+define <4 x i32> @popcount4x32(<4 x i32> %0) {
+; CHECKO0-LABEL: popcount4x32:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlp v0.8h, v0.16b
+; CHECKO0-NEXT: uaddlp v0.4s, v0.8h
+; CHECKO0-NEXT: ret
+;
+; NEON-LABEL: popcount4x32:
+; NEON: // %bb.0: // %Entry
+; NEON-NEXT: cnt v0.16b, v0.16b
+; NEON-NEXT: uaddlp v0.8h, v0.16b
+; NEON-NEXT: uaddlp v0.4s, v0.8h
+; NEON-NEXT: ret
+;
+; DOT-LABEL: popcount4x32:
+; DOT: // %bb.0: // %Entry
+; DOT-NEXT: movi v1.16b, #1
+; DOT-NEXT: cnt v2.16b, v0.16b
+; DOT-NEXT: movi v0.2d, #0000000000000000
+; DOT-NEXT: udot v0.4s, v1.16b, v2.16b
+; DOT-NEXT: ret
+;
+; SVE-LABEL: popcount4x32:
+; SVE: // %bb.0: // %Entry
+; SVE-NEXT: cnt v0.16b, v0.16b
+; SVE-NEXT: uaddlp v0.8h, v0.16b
+; SVE-NEXT: uaddlp v0.4s, v0.8h
+; SVE-NEXT: ret
+Entry:
+ %1 = tail call <4 x i32> @llvm.ctpop.v4i32(<4 x i32> %0)
+ ret <4 x i32> %1
+}
+
+declare <4 x i32> @llvm.ctpop.v4i32(<4 x i32>)
+
+define <2 x i32> @popcount2x32(<2 x i32> %0) {
+; CHECKO0-LABEL: popcount2x32:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: cnt v0.8b, v0.8b
+; CHECKO0-NEXT: uaddlp v0.4h, v0.8b
+; CHECKO0-NEXT: uaddlp v0.2s, v0.4h
+; CHECKO0-NEXT: ret
+;
+; NEON-LABEL: popcount2x32:
+; NEON: // %bb.0: // %Entry
+; NEON-NEXT: cnt v0.8b, v0.8b
+; NEON-NEXT: uaddlp v0.4h, v0.8b
+; NEON-NEXT: uaddlp v0.2s, v0.4h
+; NEON-NEXT: ret
+;
+; DOT-LABEL: popcount2x32:
+; DOT: // %bb.0: // %Entry
+; DOT-NEXT: movi v1.2d, #0000000000000000
+; DOT-NEXT: cnt v0.8b, v0.8b
+; DOT-NEXT: movi v2.8b, #1
+; DOT-NEXT: udot v1.2s, v2.8b, v0.8b
+; DOT-NEXT: fmov d0, d1
+; DOT-NEXT: ret
+;
+; SVE-LABEL: popcount2x32:
+; SVE: // %bb.0: // %Entry
+; SVE-NEXT: cnt v0.8b, v0.8b
+; SVE-NEXT: uaddlp v0.4h, v0.8b
+; SVE-NEXT: uaddlp v0.2s, v0.4h
+; SVE-NEXT: ret
+Entry:
+ %1 = tail call <2 x i32> @llvm.ctpop.v2i32(<2 x i32> %0)
+ ret <2 x i32> %1
+}
+
+declare <2 x i32> @llvm.ctpop.v2i32(<2 x i32>)
+
+define <8 x i16> @popcount8x16(<8 x i16> %0) {
+; CHECKO0-LABEL: popcount8x16:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: cnt v0.16b, v0.16b
+; CHECKO0-NEXT: uaddlp v0.8h, v0.16b
+; CHECKO0-NEXT: ret
+;
+; CHECK-LABEL: popcount8x16:
+; CHECK: // %bb.0: // %Entry
+; CHECK-NEXT: cnt v0.16b, v0.16b
+; CHECK-NEXT: uaddlp v0.8h, v0.16b
+; CHECK-NEXT: ret
+Entry:
+ %1 = tail call <8 x i16> @llvm.ctpop.v8i16(<8 x i16> %0)
+ ret <8 x i16> %1
+}
+
+declare <8 x i16> @llvm.ctpop.v8i16(<8 x i16>)
+
+define <4 x i16> @popcount4x16(<4 x i16> %0) {
+; CHECKO0-LABEL: popcount4x16:
+; CHECKO0: // %bb.0: // %Entry
+; CHECKO0-NEXT: cnt v0.8b, v0.8b
+; CHECKO0-NEXT: uaddlp v0.4h, v0.8b
+; CHECKO0-NEXT: ret
+;
+; CHECK-LABEL: popcount4x16:
+; CHECK: // %bb.0: // %Entry
+; CHECK-NEXT: cnt v0.8b, v0.8b
+; CHECK-NEXT: uaddlp v0.4h, v0.8b
+; CHECK-NEXT: ret
+Entry:
+ %1 = tail call <4 x i16> @llvm.ctpop.v4i16(<4 x i16> %0)
+ ret <4 x i16> %1
+}
+
+declare <4 x i16> @llvm.ctpop.v4i16(<4 x i16>)
diff --git a/llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll b/llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll
index 722c069..fca86a91 100644
--- a/llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll
+++ b/llvm/test/CodeGen/AMDGPU/global_atomic_optimizer_fp_rtn.ll
@@ -506,7 +506,7 @@ define amdgpu_ps float @global_atomic_fmin_uni_address_uni_value_agent_scope_uns
; IR-NEXT: [[TMP15:%.*]] = call i32 @llvm.amdgcn.readfirstlane.i32(i32 [[TMP14]])
; IR-NEXT: [[TMP16:%.*]] = bitcast i32 [[TMP15]] to float
; IR-NEXT: [[TMP17:%.*]] = uitofp i32 [[TMP8]] to float
-; IR-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0x7FF0000000000000, float [[VAL]]
+; IR-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0x7FF8000000000000, float [[VAL]]
; IR-NEXT: [[TMP19:%.*]] = call float @llvm.minnum.f32(float [[TMP16]], float [[TMP18]])
; IR-NEXT: br label [[TMP20]]
; IR: 20:
@@ -544,7 +544,7 @@ define amdgpu_ps float @global_atomic_fmin_uni_address_div_value_agent_scope_uns
; IR-ITERATIVE-NEXT: [[TMP19:%.*]] = phi float [ poison, [[TMP0:%.*]] ], [ [[TMP17]], [[TMP12]] ]
; IR-ITERATIVE-NEXT: ret float [[TMP19]]
; IR-ITERATIVE: ComputeLoop:
-; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF0000000000000, [[TMP2]] ], [ [[TMP29]], [[COMPUTELOOP]] ]
+; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF8000000000000, [[TMP2]] ], [ [[TMP29]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[OLDVALUEPHI:%.*]] = phi float [ poison, [[TMP2]] ], [ [[TMP28]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[ACTIVEBITS:%.*]] = phi i64 [ [[TMP9]], [[TMP2]] ], [ [[TMP32:%.*]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[TMP20:%.*]] = call i64 @llvm.cttz.i64(i64 [[ACTIVEBITS]], i1 true)
@@ -577,22 +577,22 @@ define amdgpu_ps float @global_atomic_fmin_uni_address_div_value_agent_scope_uns
; IR-DPP-NEXT: [[TMP7:%.*]] = call i32 @llvm.amdgcn.mbcnt.lo(i32 [[TMP4]], i32 0)
; IR-DPP-NEXT: [[TMP8:%.*]] = call i32 @llvm.amdgcn.mbcnt.hi(i32 [[TMP6]], i32 [[TMP7]])
; IR-DPP-NEXT: [[TMP9:%.*]] = bitcast float [[VAL:%.*]] to i32
-; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2139095040)
+; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2143289344)
; IR-DPP-NEXT: [[TMP11:%.*]] = bitcast i32 [[TMP10]] to float
; IR-DPP-NEXT: [[TMP12:%.*]] = bitcast i32 [[TMP9]] to float
-; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP14:%.*]] = call float @llvm.minnum.f32(float [[TMP11]], float [[TMP13]])
-; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP16:%.*]] = call float @llvm.minnum.f32(float [[TMP14]], float [[TMP15]])
-; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP18:%.*]] = call float @llvm.minnum.f32(float [[TMP16]], float [[TMP17]])
-; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP20:%.*]] = call float @llvm.minnum.f32(float [[TMP18]], float [[TMP19]])
-; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP22:%.*]] = call float @llvm.minnum.f32(float [[TMP20]], float [[TMP21]])
-; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP24:%.*]] = call float @llvm.minnum.f32(float [[TMP22]], float [[TMP23]])
-; IR-DPP-NEXT: [[TMP25:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP24]], i32 312, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP25:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP24]], i32 312, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP26:%.*]] = bitcast float [[TMP24]] to i32
; IR-DPP-NEXT: [[TMP27:%.*]] = call i32 @llvm.amdgcn.readlane.i32(i32 [[TMP26]], i32 63)
; IR-DPP-NEXT: [[TMP28:%.*]] = bitcast i32 [[TMP27]] to float
@@ -640,7 +640,7 @@ define amdgpu_ps float @global_atomic_fmax_uni_address_uni_value_agent_scope_uns
; IR-ITERATIVE-NEXT: [[TMP15:%.*]] = call i32 @llvm.amdgcn.readfirstlane.i32(i32 [[TMP14]]) #[[ATTR7]]
; IR-ITERATIVE-NEXT: [[TMP16:%.*]] = bitcast i32 [[TMP15]] to float
; IR-ITERATIVE-NEXT: [[TMP17:%.*]] = call float @llvm.experimental.constrained.uitofp.f32.i32(i32 [[TMP8]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR7]]
-; IR-ITERATIVE-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0xFFF0000000000000, float [[VAL]]
+; IR-ITERATIVE-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0x7FF8000000000000, float [[VAL]]
; IR-ITERATIVE-NEXT: [[TMP19:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP16]], float [[TMP18]], metadata !"fpexcept.strict") #[[ATTR7]]
; IR-ITERATIVE-NEXT: br label [[TMP20]]
; IR-ITERATIVE: 20:
@@ -668,7 +668,7 @@ define amdgpu_ps float @global_atomic_fmax_uni_address_uni_value_agent_scope_uns
; IR-DPP-NEXT: [[TMP15:%.*]] = call i32 @llvm.amdgcn.readfirstlane.i32(i32 [[TMP14]]) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP16:%.*]] = bitcast i32 [[TMP15]] to float
; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.experimental.constrained.uitofp.f32.i32(i32 [[TMP8]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0xFFF0000000000000, float [[VAL]]
+; IR-DPP-NEXT: [[TMP18:%.*]] = select i1 [[TMP9]], float 0x7FF8000000000000, float [[VAL]]
; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP16]], float [[TMP18]], metadata !"fpexcept.strict") #[[ATTR8]]
; IR-DPP-NEXT: br label [[TMP20]]
; IR-DPP: 20:
@@ -706,7 +706,7 @@ define amdgpu_ps float @global_atomic_fmax_uni_address_div_value_agent_scope_uns
; IR-ITERATIVE-NEXT: [[TMP19:%.*]] = phi float [ poison, [[TMP0:%.*]] ], [ [[TMP17]], [[TMP12]] ]
; IR-ITERATIVE-NEXT: ret float [[TMP19]]
; IR-ITERATIVE: ComputeLoop:
-; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0xFFF0000000000000, [[TMP2]] ], [ [[TMP29]], [[COMPUTELOOP]] ]
+; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF8000000000000, [[TMP2]] ], [ [[TMP29]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[OLDVALUEPHI:%.*]] = phi float [ poison, [[TMP2]] ], [ [[TMP28]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[ACTIVEBITS:%.*]] = phi i64 [ [[TMP9]], [[TMP2]] ], [ [[TMP32:%.*]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[TMP20:%.*]] = call i64 @llvm.cttz.i64(i64 [[ACTIVEBITS]], i1 true) #[[ATTR7]]
@@ -739,22 +739,22 @@ define amdgpu_ps float @global_atomic_fmax_uni_address_div_value_agent_scope_uns
; IR-DPP-NEXT: [[TMP7:%.*]] = call i32 @llvm.amdgcn.mbcnt.lo(i32 [[TMP4]], i32 0) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP8:%.*]] = call i32 @llvm.amdgcn.mbcnt.hi(i32 [[TMP6]], i32 [[TMP7]]) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP9:%.*]] = bitcast float [[VAL:%.*]] to i32
-; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 -8388608) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2143289344) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP11:%.*]] = bitcast i32 [[TMP10]] to float
; IR-DPP-NEXT: [[TMP12:%.*]] = bitcast i32 [[TMP9]] to float
-; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP14:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP11]], float [[TMP13]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP16:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP14]], float [[TMP15]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP18:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP16]], float [[TMP17]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP20:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP18]], float [[TMP19]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP22:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP20]], float [[TMP21]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP24:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP22]], float [[TMP23]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP25:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP24]], i32 312, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP25:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP24]], i32 312, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP26:%.*]] = bitcast float [[TMP24]] to i32
; IR-DPP-NEXT: [[TMP27:%.*]] = call i32 @llvm.amdgcn.readlane.i32(i32 [[TMP26]], i32 63) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP28:%.*]] = bitcast i32 [[TMP27]] to float
@@ -1318,7 +1318,7 @@ define amdgpu_ps double @global_atomic_fmin_double_uni_address_uni_value_agent_s
; IR-NEXT: [[TMP21:%.*]] = insertelement <2 x i32> [[TMP20]], i32 [[TMP19]], i32 1
; IR-NEXT: [[TMP22:%.*]] = bitcast <2 x i32> [[TMP21]] to double
; IR-NEXT: [[TMP23:%.*]] = uitofp i32 [[TMP8]] to double
-; IR-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0x7FF0000000000000, double [[VAL]]
+; IR-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0x7FF8000000000000, double [[VAL]]
; IR-NEXT: [[TMP25:%.*]] = call double @llvm.minnum.f64(double [[TMP22]], double [[TMP24]])
; IR-NEXT: br label [[TMP26]]
; IR: 26:
@@ -1366,7 +1366,7 @@ define amdgpu_ps double @global_atomic__fmax_double_uni_address_uni_value_agent_
; IR-ITERATIVE-NEXT: [[TMP21:%.*]] = insertelement <2 x i32> [[TMP20]], i32 [[TMP19]], i32 1
; IR-ITERATIVE-NEXT: [[TMP22:%.*]] = bitcast <2 x i32> [[TMP21]] to double
; IR-ITERATIVE-NEXT: [[TMP23:%.*]] = call double @llvm.experimental.constrained.uitofp.f64.i32(i32 [[TMP8]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR7]]
-; IR-ITERATIVE-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0xFFF0000000000000, double [[VAL]]
+; IR-ITERATIVE-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0x7FF8000000000000, double [[VAL]]
; IR-ITERATIVE-NEXT: [[TMP25:%.*]] = call double @llvm.experimental.constrained.maxnum.f64(double [[TMP22]], double [[TMP24]], metadata !"fpexcept.strict") #[[ATTR7]]
; IR-ITERATIVE-NEXT: br label [[TMP26]]
; IR-ITERATIVE: 26:
@@ -1400,7 +1400,7 @@ define amdgpu_ps double @global_atomic__fmax_double_uni_address_uni_value_agent_
; IR-DPP-NEXT: [[TMP21:%.*]] = insertelement <2 x i32> [[TMP20]], i32 [[TMP19]], i32 1
; IR-DPP-NEXT: [[TMP22:%.*]] = bitcast <2 x i32> [[TMP21]] to double
; IR-DPP-NEXT: [[TMP23:%.*]] = call double @llvm.experimental.constrained.uitofp.f64.i32(i32 [[TMP8]], metadata !"round.dynamic", metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0xFFF0000000000000, double [[VAL]]
+; IR-DPP-NEXT: [[TMP24:%.*]] = select i1 [[TMP9]], double 0x7FF8000000000000, double [[VAL]]
; IR-DPP-NEXT: [[TMP25:%.*]] = call double @llvm.experimental.constrained.maxnum.f64(double [[TMP22]], double [[TMP24]], metadata !"fpexcept.strict") #[[ATTR8]]
; IR-DPP-NEXT: br label [[TMP26]]
; IR-DPP: 26:
diff --git a/llvm/test/CodeGen/AMDGPU/global_atomics_optimizer_fp_no_rtn.ll b/llvm/test/CodeGen/AMDGPU/global_atomics_optimizer_fp_no_rtn.ll
index fa66a0f..3cf2a85b 100644
--- a/llvm/test/CodeGen/AMDGPU/global_atomics_optimizer_fp_no_rtn.ll
+++ b/llvm/test/CodeGen/AMDGPU/global_atomics_optimizer_fp_no_rtn.ll
@@ -433,7 +433,7 @@ define amdgpu_ps void @global_atomic_fmin_uni_address_div_value_agent_scope_unsa
; IR-ITERATIVE: 13:
; IR-ITERATIVE-NEXT: ret void
; IR-ITERATIVE: ComputeLoop:
-; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF0000000000000, [[TMP2]] ], [ [[TMP19]], [[COMPUTELOOP]] ]
+; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF8000000000000, [[TMP2]] ], [ [[TMP19]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[ACTIVEBITS:%.*]] = phi i64 [ [[TMP9]], [[TMP2]] ], [ [[TMP22:%.*]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[TMP14:%.*]] = call i64 @llvm.cttz.i64(i64 [[ACTIVEBITS]], i1 true)
; IR-ITERATIVE-NEXT: [[TMP15:%.*]] = trunc i64 [[TMP14]] to i32
@@ -461,20 +461,20 @@ define amdgpu_ps void @global_atomic_fmin_uni_address_div_value_agent_scope_unsa
; IR-DPP-NEXT: [[TMP7:%.*]] = call i32 @llvm.amdgcn.mbcnt.lo(i32 [[TMP4]], i32 0)
; IR-DPP-NEXT: [[TMP8:%.*]] = call i32 @llvm.amdgcn.mbcnt.hi(i32 [[TMP6]], i32 [[TMP7]])
; IR-DPP-NEXT: [[TMP9:%.*]] = bitcast float [[VAL:%.*]] to i32
-; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2139095040)
+; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2143289344)
; IR-DPP-NEXT: [[TMP11:%.*]] = bitcast i32 [[TMP10]] to float
; IR-DPP-NEXT: [[TMP12:%.*]] = bitcast i32 [[TMP9]] to float
-; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP14:%.*]] = call float @llvm.minnum.f32(float [[TMP11]], float [[TMP13]])
-; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP16:%.*]] = call float @llvm.minnum.f32(float [[TMP14]], float [[TMP15]])
-; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP18:%.*]] = call float @llvm.minnum.f32(float [[TMP16]], float [[TMP17]])
-; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP20:%.*]] = call float @llvm.minnum.f32(float [[TMP18]], float [[TMP19]])
-; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP22:%.*]] = call float @llvm.minnum.f32(float [[TMP20]], float [[TMP21]])
-; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF0000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false)
+; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false)
; IR-DPP-NEXT: [[TMP24:%.*]] = call float @llvm.minnum.f32(float [[TMP22]], float [[TMP23]])
; IR-DPP-NEXT: [[TMP25:%.*]] = bitcast float [[TMP24]] to i32
; IR-DPP-NEXT: [[TMP26:%.*]] = call i32 @llvm.amdgcn.readlane.i32(i32 [[TMP25]], i32 63)
@@ -560,7 +560,7 @@ define amdgpu_ps void @global_atomic_fmax_uni_address_div_value_agent_scope_unsa
; IR-ITERATIVE: 13:
; IR-ITERATIVE-NEXT: ret void
; IR-ITERATIVE: ComputeLoop:
-; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0xFFF0000000000000, [[TMP2]] ], [ [[TMP19]], [[COMPUTELOOP]] ]
+; IR-ITERATIVE-NEXT: [[ACCUMULATOR:%.*]] = phi float [ 0x7FF8000000000000, [[TMP2]] ], [ [[TMP19]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[ACTIVEBITS:%.*]] = phi i64 [ [[TMP9]], [[TMP2]] ], [ [[TMP22:%.*]], [[COMPUTELOOP]] ]
; IR-ITERATIVE-NEXT: [[TMP14:%.*]] = call i64 @llvm.cttz.i64(i64 [[ACTIVEBITS]], i1 true) #[[ATTR7]]
; IR-ITERATIVE-NEXT: [[TMP15:%.*]] = trunc i64 [[TMP14]] to i32
@@ -588,20 +588,20 @@ define amdgpu_ps void @global_atomic_fmax_uni_address_div_value_agent_scope_unsa
; IR-DPP-NEXT: [[TMP7:%.*]] = call i32 @llvm.amdgcn.mbcnt.lo(i32 [[TMP4]], i32 0) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP8:%.*]] = call i32 @llvm.amdgcn.mbcnt.hi(i32 [[TMP6]], i32 [[TMP7]]) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP9:%.*]] = bitcast float [[VAL:%.*]] to i32
-; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 -8388608) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP10:%.*]] = call i32 @llvm.amdgcn.set.inactive.i32(i32 [[TMP9]], i32 2143289344) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP11:%.*]] = bitcast i32 [[TMP10]] to float
; IR-DPP-NEXT: [[TMP12:%.*]] = bitcast i32 [[TMP9]] to float
-; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP13:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP11]], i32 273, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP14:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP11]], float [[TMP13]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP15:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP14]], i32 274, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP16:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP14]], float [[TMP15]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP17:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP16]], i32 276, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP18:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP16]], float [[TMP17]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP19:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP18]], i32 280, i32 15, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP20:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP18]], float [[TMP19]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP21:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP20]], i32 322, i32 10, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP22:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP20]], float [[TMP21]], metadata !"fpexcept.strict") #[[ATTR8]]
-; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0xFFF0000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false) #[[ATTR8]]
+; IR-DPP-NEXT: [[TMP23:%.*]] = call float @llvm.amdgcn.update.dpp.f32(float 0x7FF8000000000000, float [[TMP22]], i32 323, i32 12, i32 15, i1 false) #[[ATTR8]]
; IR-DPP-NEXT: [[TMP24:%.*]] = call float @llvm.experimental.constrained.maxnum.f32(float [[TMP22]], float [[TMP23]], metadata !"fpexcept.strict") #[[ATTR8]]
; IR-DPP-NEXT: [[TMP25:%.*]] = bitcast float [[TMP24]] to i32
; IR-DPP-NEXT: [[TMP26:%.*]] = call i32 @llvm.amdgcn.readlane.i32(i32 [[TMP25]], i32 63) #[[ATTR8]]
diff --git a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmax.ll b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmax.ll
index 7f052e1..e02d749 100644
--- a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmax.ll
+++ b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmax.ll
@@ -326,7 +326,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB1_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -395,7 +395,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1064-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -451,7 +451,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1032-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -496,7 +496,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1164-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -546,7 +546,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1132-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -609,32 +609,32 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -699,25 +699,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -777,25 +777,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -837,30 +837,30 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -916,26 +916,26 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_agent_scope_
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -1386,7 +1386,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB3_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -1455,7 +1455,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1525,7 +1525,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1584,7 +1584,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1650,7 +1650,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1728,32 +1728,32 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -1818,25 +1818,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -1910,25 +1910,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -1984,30 +1984,30 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -2079,26 +2079,26 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_one_as_scope
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -2565,7 +2565,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB5_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -2634,7 +2634,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2704,7 +2704,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2763,7 +2763,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2829,7 +2829,7 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2907,32 +2907,32 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -2997,25 +2997,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -3089,25 +3089,25 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0xff800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -3163,30 +3163,30 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0xff800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -3258,26 +3258,26 @@ define amdgpu_kernel void @global_atomic_fmax_uni_address_div_value_default_scop
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0xff800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0xff800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
diff --git a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmin.ll b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmin.ll
index a9f49ad..60195ca 100644
--- a/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmin.ll
+++ b/llvm/test/CodeGen/AMDGPU/global_atomics_scan_fmin.ll
@@ -326,7 +326,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB1_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -395,7 +395,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1064-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -451,7 +451,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1032-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -496,7 +496,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1164-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -546,7 +546,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1132-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB1_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -609,32 +609,32 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -699,25 +699,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -777,25 +777,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -837,30 +837,30 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -916,26 +916,26 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_agent_scope_
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -1386,7 +1386,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB3_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -1455,7 +1455,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1525,7 +1525,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1584,7 +1584,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1650,7 +1650,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB3_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -1728,32 +1728,32 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -1818,25 +1818,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -1910,25 +1910,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -1984,30 +1984,30 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -2079,26 +2079,26 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_one_as_scope
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -2565,7 +2565,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX9-NEXT: s_waitcnt lgkmcnt(0)
; GFX9-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX9-NEXT: s_mov_b64 s[0:1], exec
-; GFX9-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX9-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX9-NEXT: .LBB5_1: ; %ComputeLoop
; GFX9-NEXT: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT: s_ff1_i32_b64 s2, s[0:1]
@@ -2634,7 +2634,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1064-NEXT: s_mov_b32 s32, 0
; GFX1064-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1064-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1064-NEXT: s_mov_b64 s[0:1], exec
; GFX1064-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1064-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2704,7 +2704,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1032-NEXT: s_mov_b32 s32, 0
; GFX1032-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-NEXT: s_swappc_b64 s[30:31], s[16:17]
-; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1032-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1032-NEXT: s_mov_b32 s0, exec_lo
; GFX1032-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1032-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2763,7 +2763,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1164-NEXT: s_mov_b32 s32, 0
; GFX1164-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1164-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-NEXT: s_mov_b64 s[0:1], exec
; GFX1164-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1164-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2829,7 +2829,7 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1132-NEXT: s_mov_b32 s32, 0
; GFX1132-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-NEXT: s_swappc_b64 s[30:31], s[2:3]
-; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1132-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-NEXT: s_mov_b32 s0, exec_lo
; GFX1132-NEXT: .LBB5_1: ; %ComputeLoop
; GFX1132-NEXT: ; =>This Inner Loop Header: Depth=1
@@ -2907,32 +2907,32 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX9-DPP-NEXT: v_mbcnt_hi_u32_b32 v1, exec_hi, v1
; GFX9-DPP-NEXT: v_mov_b32_e32 v3, v0
; GFX9-DPP-NEXT: s_not_b64 exec, exec
-; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX9-DPP-NEXT: s_not_b64 exec, exec
; GFX9-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
-; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 0
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:1 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:2 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:4 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_shr:8 row_mask:0xf bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
; GFX9-DPP-NEXT: v_min_f32_e32 v3, v3, v5
-; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX9-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX9-DPP-NEXT: s_nop 1
; GFX9-DPP-NEXT: v_mov_b32_dpp v5, v3 row_bcast:15 row_mask:0xa bank_mask:0xf
; GFX9-DPP-NEXT: v_max_f32_e32 v5, v5, v5
@@ -2997,25 +2997,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1064-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1064-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1064-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1064-DPP-NEXT: s_not_b64 exec, exec
; GFX1064-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1064-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1064-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1064-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1064-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1064-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -3089,25 +3089,25 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1032-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1032-DPP-NEXT: s_swappc_b64 s[30:31], s[16:17]
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1032-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, v0
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v4, 0x7fc00000
; GFX1032-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1032-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1032-DPP-NEXT: v_mov_b32_dpp v3, v4 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v4, v4
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_max_f32_e32 v3, v3, v3
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v4, v3
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
-; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7f800000
+; GFX1032-DPP-NEXT: v_mov_b32_e32 v5, 0x7fc00000
; GFX1032-DPP-NEXT: v_min_f32_e32 v3, v3, v4
; GFX1032-DPP-NEXT: v_mov_b32_dpp v5, v3 row_xmask:8 row_mask:0xf bank_mask:0xf
; GFX1032-DPP-NEXT: v_max_f32_e32 v4, v5, v5
@@ -3163,30 +3163,30 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1164-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1164-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1164-DPP-NEXT: s_mov_b64 exec, s[0:1]
; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1164-DPP-NEXT: s_not_b64 exec, exec
; GFX1164-DPP-NEXT: s_or_saveexec_b64 s[0:1], -1
; GFX1164-DPP-NEXT: s_waitcnt_depctr 0xfff
; GFX1164-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v2, v2
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_2) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1164-DPP-NEXT: v_max_f32_e32 v2, v3, v3
-; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7f800000
+; GFX1164-DPP-NEXT: v_mov_b32_e32 v3, 0x7fc00000
; GFX1164-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1164-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1164-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
@@ -3258,26 +3258,26 @@ define amdgpu_kernel void @global_atomic_fmin_uni_address_div_value_default_scop
; GFX1132-DPP-NEXT: s_waitcnt lgkmcnt(0)
; GFX1132-DPP-NEXT: s_swappc_b64 s[30:31], s[2:3]
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v1, 0x7fc00000
; GFX1132-DPP-NEXT: s_mov_b32 exec_lo, s0
; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, v0
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
-; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7f800000
+; GFX1132-DPP-NEXT: v_mov_b32_e32 v2, 0x7fc00000
; GFX1132-DPP-NEXT: s_not_b32 exec_lo, exec_lo
; GFX1132-DPP-NEXT: s_or_saveexec_b32 s0, -1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(SKIP_1) | instid1(VALU_DEP_2)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v1, v2 row_xmask:1 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v2, v2 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_max_f32_e32 v1, v1, v1
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v2, v1
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:2 row_mask:0xf bank_mask:0xf
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:4 row_mask:0xf bank_mask:0xf
-; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7f800000
+; GFX1132-DPP-NEXT: v_dual_max_f32 v2, v3, v3 :: v_dual_mov_b32 v3, 0x7fc00000
; GFX1132-DPP-NEXT: s_delay_alu instid0(VALU_DEP_1) | instskip(NEXT) | instid1(VALU_DEP_1)
; GFX1132-DPP-NEXT: v_min_f32_e32 v1, v1, v2
; GFX1132-DPP-NEXT: v_mov_b32_dpp v3, v1 row_xmask:8 row_mask:0xf bank_mask:0xf
diff --git a/llvm/test/CodeGen/AMDGPU/trunc-store.ll b/llvm/test/CodeGen/AMDGPU/trunc-store.ll
index e642a70..931953e 100644
--- a/llvm/test/CodeGen/AMDGPU/trunc-store.ll
+++ b/llvm/test/CodeGen/AMDGPU/trunc-store.ll
@@ -1,18 +1,422 @@
-; RUN: llc -mtriple=amdgcn -mcpu=verde -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
-; RUN: llc -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
+; RUN: llc -mtriple=amdgcn -mcpu=verde < %s | FileCheck -check-prefixes=GCN,SI %s
+; RUN: llc -mtriple=amdgcn -mcpu=tonga < %s | FileCheck -check-prefixes=GCN,VI %s
-; FUNC-LABEL: {{^}}truncstore_arg_v16i32_to_v16i8:
-; SI: buffer_store_dwordx4
define amdgpu_kernel void @truncstore_arg_v16i32_to_v16i8(ptr addrspace(1) %out, <16 x i32> %in) {
+; SI-LABEL: truncstore_arg_v16i32_to_v16i8:
+; SI: ; %bb.0:
+; SI-NEXT: s_load_dwordx16 s[4:19], s[0:1], 0x19
+; SI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x9
+; SI-NEXT: s_mov_b32 s3, 0xf000
+; SI-NEXT: s_mov_b32 s2, -1
+; SI-NEXT: s_waitcnt lgkmcnt(0)
+; SI-NEXT: s_and_b32 s18, s18, 0xff
+; SI-NEXT: s_lshl_b32 s17, s17, 8
+; SI-NEXT: s_and_b32 s16, s16, 0xff
+; SI-NEXT: s_and_b32 s14, s14, 0xff
+; SI-NEXT: s_lshl_b32 s13, s13, 8
+; SI-NEXT: s_and_b32 s12, s12, 0xff
+; SI-NEXT: s_and_b32 s10, s10, 0xff
+; SI-NEXT: s_lshl_b32 s9, s9, 8
+; SI-NEXT: s_and_b32 s8, s8, 0xff
+; SI-NEXT: s_and_b32 s6, s6, 0xff
+; SI-NEXT: s_lshl_b32 s5, s5, 8
+; SI-NEXT: s_and_b32 s4, s4, 0xff
+; SI-NEXT: s_lshl_b32 s19, s19, 24
+; SI-NEXT: s_lshl_b32 s18, s18, 16
+; SI-NEXT: s_or_b32 s16, s16, s17
+; SI-NEXT: s_lshl_b32 s15, s15, 24
+; SI-NEXT: s_lshl_b32 s14, s14, 16
+; SI-NEXT: s_or_b32 s12, s12, s13
+; SI-NEXT: s_lshl_b32 s11, s11, 24
+; SI-NEXT: s_lshl_b32 s10, s10, 16
+; SI-NEXT: s_or_b32 s8, s8, s9
+; SI-NEXT: s_lshl_b32 s7, s7, 24
+; SI-NEXT: s_lshl_b32 s6, s6, 16
+; SI-NEXT: s_or_b32 s4, s4, s5
+; SI-NEXT: s_or_b32 s18, s19, s18
+; SI-NEXT: s_and_b32 s16, s16, 0xffff
+; SI-NEXT: s_or_b32 s14, s15, s14
+; SI-NEXT: s_and_b32 s12, s12, 0xffff
+; SI-NEXT: s_or_b32 s10, s11, s10
+; SI-NEXT: s_and_b32 s8, s8, 0xffff
+; SI-NEXT: s_or_b32 s6, s7, s6
+; SI-NEXT: s_and_b32 s4, s4, 0xffff
+; SI-NEXT: s_or_b32 s16, s16, s18
+; SI-NEXT: s_or_b32 s12, s12, s14
+; SI-NEXT: s_or_b32 s8, s8, s10
+; SI-NEXT: s_or_b32 s4, s4, s6
+; SI-NEXT: v_mov_b32_e32 v0, s4
+; SI-NEXT: v_mov_b32_e32 v1, s8
+; SI-NEXT: v_mov_b32_e32 v2, s12
+; SI-NEXT: v_mov_b32_e32 v3, s16
+; SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[0:3], 0
+; SI-NEXT: s_endpgm
+;
+; VI-LABEL: truncstore_arg_v16i32_to_v16i8:
+; VI: ; %bb.0:
+; VI-NEXT: s_load_dwordx16 s[4:19], s[0:1], 0x64
+; VI-NEXT: s_load_dwordx2 s[0:1], s[0:1], 0x24
+; VI-NEXT: s_waitcnt lgkmcnt(0)
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s17
+; VI-NEXT: v_mov_b32_e32 v1, s16
+; VI-NEXT: v_lshlrev_b16_e64 v2, 8, s19
+; VI-NEXT: v_mov_b32_e32 v3, s18
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v1, v3, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v3, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s13
+; VI-NEXT: v_mov_b32_e32 v1, s12
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v1, 8, s15
+; VI-NEXT: v_mov_b32_e32 v2, s14
+; VI-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v2, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s9
+; VI-NEXT: v_mov_b32_e32 v1, s8
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v1, 8, s11
+; VI-NEXT: v_mov_b32_e32 v4, s10
+; VI-NEXT: v_or_b32_sdwa v1, v4, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v1, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s5
+; VI-NEXT: v_mov_b32_e32 v4, s4
+; VI-NEXT: v_or_b32_sdwa v0, v4, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v4, 8, s7
+; VI-NEXT: v_mov_b32_e32 v5, s6
+; VI-NEXT: v_or_b32_sdwa v4, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v0, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_mov_b32_e32 v5, s1
+; VI-NEXT: v_mov_b32_e32 v4, s0
+; VI-NEXT: flat_store_dwordx4 v[4:5], v[0:3]
+; VI-NEXT: s_endpgm
%trunc = trunc <16 x i32> %in to <16 x i8>
store <16 x i8> %trunc, ptr addrspace(1) %out
ret void
}
-; FUNC-LABEL: {{^}}truncstore_arg_v16i64_to_v16i8:
-; SI: buffer_store_dwordx4
define amdgpu_kernel void @truncstore_arg_v16i64_to_v16i8(ptr addrspace(1) %out, <16 x i64> %in) {
+; SI-LABEL: truncstore_arg_v16i64_to_v16i8:
+; SI: ; %bb.0:
+; SI-NEXT: s_load_dwordx16 s[16:31], s[0:1], 0x39
+; SI-NEXT: s_load_dwordx2 s[36:37], s[0:1], 0x9
+; SI-NEXT: s_load_dwordx16 s[0:15], s[0:1], 0x29
+; SI-NEXT: s_mov_b32 s39, 0xf000
+; SI-NEXT: s_mov_b32 s38, -1
+; SI-NEXT: s_waitcnt lgkmcnt(0)
+; SI-NEXT: s_and_b32 s3, s28, 0xff
+; SI-NEXT: s_lshl_b32 s1, s30, 24
+; SI-NEXT: s_lshl_b32 s3, s3, 16
+; SI-NEXT: s_or_b32 s1, s1, s3
+; SI-NEXT: s_lshl_b32 s3, s26, 8
+; SI-NEXT: s_and_b32 s5, s24, 0xff
+; SI-NEXT: s_or_b32 s3, s5, s3
+; SI-NEXT: s_and_b32 s3, s3, 0xffff
+; SI-NEXT: s_and_b32 s5, s20, 0xff
+; SI-NEXT: s_or_b32 s1, s3, s1
+; SI-NEXT: s_lshl_b32 s3, s22, 24
+; SI-NEXT: s_lshl_b32 s5, s5, 16
+; SI-NEXT: s_or_b32 s3, s3, s5
+; SI-NEXT: s_lshl_b32 s5, s18, 8
+; SI-NEXT: s_and_b32 s7, s16, 0xff
+; SI-NEXT: s_or_b32 s5, s7, s5
+; SI-NEXT: s_and_b32 s5, s5, 0xffff
+; SI-NEXT: s_and_b32 s7, s12, 0xff
+; SI-NEXT: s_or_b32 s3, s5, s3
+; SI-NEXT: s_lshl_b32 s5, s14, 24
+; SI-NEXT: s_lshl_b32 s7, s7, 16
+; SI-NEXT: s_or_b32 s5, s5, s7
+; SI-NEXT: s_lshl_b32 s7, s10, 8
+; SI-NEXT: s_and_b32 s8, s8, 0xff
+; SI-NEXT: s_and_b32 s4, s4, 0xff
+; SI-NEXT: s_lshl_b32 s2, s2, 8
+; SI-NEXT: s_and_b32 s0, s0, 0xff
+; SI-NEXT: s_or_b32 s7, s8, s7
+; SI-NEXT: s_lshl_b32 s6, s6, 24
+; SI-NEXT: s_lshl_b32 s4, s4, 16
+; SI-NEXT: s_or_b32 s0, s0, s2
+; SI-NEXT: s_and_b32 s7, s7, 0xffff
+; SI-NEXT: s_or_b32 s4, s6, s4
+; SI-NEXT: s_and_b32 s0, s0, 0xffff
+; SI-NEXT: s_or_b32 s5, s7, s5
+; SI-NEXT: s_or_b32 s0, s0, s4
+; SI-NEXT: v_mov_b32_e32 v0, s0
+; SI-NEXT: v_mov_b32_e32 v1, s5
+; SI-NEXT: v_mov_b32_e32 v2, s3
+; SI-NEXT: v_mov_b32_e32 v3, s1
+; SI-NEXT: buffer_store_dwordx4 v[0:3], off, s[36:39], 0
+; SI-NEXT: s_endpgm
+;
+; VI-LABEL: truncstore_arg_v16i64_to_v16i8:
+; VI: ; %bb.0:
+; VI-NEXT: s_load_dwordx16 s[16:31], s[0:1], 0xe4
+; VI-NEXT: s_load_dwordx2 s[34:35], s[0:1], 0x24
+; VI-NEXT: s_load_dwordx16 s[0:15], s[0:1], 0xa4
+; VI-NEXT: s_waitcnt lgkmcnt(0)
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s26
+; VI-NEXT: v_mov_b32_e32 v1, s24
+; VI-NEXT: v_lshlrev_b16_e64 v2, 8, s30
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_mov_b32_e32 v1, s28
+; VI-NEXT: v_or_b32_sdwa v1, v1, v2 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v3, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s18
+; VI-NEXT: v_mov_b32_e32 v1, s16
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v1, 8, s22
+; VI-NEXT: v_mov_b32_e32 v2, s20
+; VI-NEXT: v_or_b32_sdwa v1, v2, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v2, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s10
+; VI-NEXT: v_mov_b32_e32 v1, s8
+; VI-NEXT: v_or_b32_sdwa v0, v1, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v1, 8, s14
+; VI-NEXT: v_mov_b32_e32 v4, s12
+; VI-NEXT: v_or_b32_sdwa v1, v4, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v1, v0, v1 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v0, 8, s2
+; VI-NEXT: v_mov_b32_e32 v4, s0
+; VI-NEXT: v_or_b32_sdwa v0, v4, v0 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e64 v4, 8, s6
+; VI-NEXT: v_mov_b32_e32 v5, s4
+; VI-NEXT: v_or_b32_sdwa v4, v5, v4 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v0, v0, v4 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_mov_b32_e32 v4, s34
+; VI-NEXT: v_mov_b32_e32 v5, s35
+; VI-NEXT: flat_store_dwordx4 v[4:5], v[0:3]
+; VI-NEXT: s_endpgm
%trunc = trunc <16 x i64> %in to <16 x i8>
store <16 x i8> %trunc, ptr addrspace(1) %out
ret void
}
+
+define void @truncstore_v5i32_to_v5i1(ptr addrspace(1) %out, <5 x i32> %val) {
+; SI-LABEL: truncstore_v5i32_to_v5i1:
+; SI: ; %bb.0:
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; SI-NEXT: v_and_b32_e32 v3, 1, v3
+; SI-NEXT: v_and_b32_e32 v2, 1, v2
+; SI-NEXT: v_lshlrev_b32_e32 v3, 1, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_and_b32_e32 v3, 1, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 2, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_and_b32_e32 v3, 1, v5
+; SI-NEXT: v_lshlrev_b32_e32 v3, 3, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_lshlrev_b32_e32 v3, 4, v6
+; SI-NEXT: s_mov_b32 s6, 0
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: s_mov_b32 s7, 0xf000
+; SI-NEXT: s_mov_b32 s4, s6
+; SI-NEXT: s_mov_b32 s5, s6
+; SI-NEXT: v_and_b32_e32 v2, 31, v2
+; SI-NEXT: buffer_store_byte v2, v[0:1], s[4:7], 0 addr64
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0)
+; SI-NEXT: s_setpc_b64 s[30:31]
+;
+; VI-LABEL: truncstore_v5i32_to_v5i1:
+; VI: ; %bb.0:
+; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; VI-NEXT: v_and_b32_e32 v3, 1, v3
+; VI-NEXT: v_and_b32_e32 v2, 1, v2
+; VI-NEXT: v_lshlrev_b16_e32 v3, 1, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v3, 1, v4
+; VI-NEXT: v_lshlrev_b16_e32 v3, 2, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v3, 1, v5
+; VI-NEXT: v_lshlrev_b16_e32 v3, 3, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_lshlrev_b16_e32 v3, 4, v6
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v2, 31, v2
+; VI-NEXT: flat_store_byte v[0:1], v2
+; VI-NEXT: s_waitcnt vmcnt(0)
+; VI-NEXT: s_setpc_b64 s[30:31]
+ %trunc = trunc <5 x i32> %val to <5 x i1>
+ store <5 x i1> %trunc, ptr addrspace(1) %out
+ ret void
+}
+
+define void @truncstore_v5i32_to_v5i8(ptr addrspace(1) %out, <5 x i32> %val) {
+; SI-LABEL: truncstore_v5i32_to_v5i8:
+; SI: ; %bb.0:
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; SI-NEXT: v_and_b32_e32 v4, 0xff, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 8, v3
+; SI-NEXT: v_and_b32_e32 v2, 0xff, v2
+; SI-NEXT: s_mov_b32 s6, 0
+; SI-NEXT: v_lshlrev_b32_e32 v5, 24, v5
+; SI-NEXT: v_lshlrev_b32_e32 v4, 16, v4
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: s_mov_b32 s7, 0xf000
+; SI-NEXT: s_mov_b32 s4, s6
+; SI-NEXT: s_mov_b32 s5, s6
+; SI-NEXT: v_or_b32_e32 v4, v5, v4
+; SI-NEXT: v_and_b32_e32 v2, 0xffff, v2
+; SI-NEXT: v_or_b32_e32 v2, v2, v4
+; SI-NEXT: buffer_store_byte v6, v[0:1], s[4:7], 0 addr64 offset:4
+; SI-NEXT: buffer_store_dword v2, v[0:1], s[4:7], 0 addr64
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0)
+; SI-NEXT: s_setpc_b64 s[30:31]
+;
+; VI-LABEL: truncstore_v5i32_to_v5i8:
+; VI: ; %bb.0:
+; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; VI-NEXT: v_lshlrev_b16_e32 v3, 8, v3
+; VI-NEXT: v_or_b32_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e32 v3, 8, v5
+; VI-NEXT: v_or_b32_sdwa v3, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v4, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_add_u32_e32 v2, vcc, 4, v0
+; VI-NEXT: v_addc_u32_e32 v3, vcc, 0, v1, vcc
+; VI-NEXT: flat_store_byte v[2:3], v6
+; VI-NEXT: flat_store_dword v[0:1], v4
+; VI-NEXT: s_waitcnt vmcnt(0)
+; VI-NEXT: s_setpc_b64 s[30:31]
+ %trunc = trunc <5 x i32> %val to <5 x i8>
+ store <5 x i8> %trunc, ptr addrspace(1) %out
+ ret void
+}
+
+define void @truncstore_v6i32_to_v6i1(ptr addrspace(1) %out, <6 x i32> %val) {
+; SI-LABEL: truncstore_v6i32_to_v6i1:
+; SI: ; %bb.0:
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; SI-NEXT: v_and_b32_e32 v3, 1, v3
+; SI-NEXT: v_and_b32_e32 v2, 1, v2
+; SI-NEXT: v_lshlrev_b32_e32 v3, 1, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_and_b32_e32 v3, 1, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 2, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_and_b32_e32 v3, 1, v5
+; SI-NEXT: v_lshlrev_b32_e32 v3, 3, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_and_b32_e32 v3, 1, v6
+; SI-NEXT: v_lshlrev_b32_e32 v3, 4, v3
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_lshlrev_b32_e32 v3, 5, v7
+; SI-NEXT: s_mov_b32 s6, 0
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: s_mov_b32 s7, 0xf000
+; SI-NEXT: s_mov_b32 s4, s6
+; SI-NEXT: s_mov_b32 s5, s6
+; SI-NEXT: v_and_b32_e32 v2, 63, v2
+; SI-NEXT: buffer_store_byte v2, v[0:1], s[4:7], 0 addr64
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0)
+; SI-NEXT: s_setpc_b64 s[30:31]
+;
+; VI-LABEL: truncstore_v6i32_to_v6i1:
+; VI: ; %bb.0:
+; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; VI-NEXT: v_and_b32_e32 v3, 1, v3
+; VI-NEXT: v_and_b32_e32 v2, 1, v2
+; VI-NEXT: v_lshlrev_b16_e32 v3, 1, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v3, 1, v4
+; VI-NEXT: v_lshlrev_b16_e32 v3, 2, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v3, 1, v5
+; VI-NEXT: v_lshlrev_b16_e32 v3, 3, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v3, 1, v6
+; VI-NEXT: v_lshlrev_b16_e32 v3, 4, v3
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_lshlrev_b16_e32 v3, 5, v7
+; VI-NEXT: v_or_b32_e32 v2, v2, v3
+; VI-NEXT: v_and_b32_e32 v2, 63, v2
+; VI-NEXT: flat_store_byte v[0:1], v2
+; VI-NEXT: s_waitcnt vmcnt(0)
+; VI-NEXT: s_setpc_b64 s[30:31]
+ %trunc = trunc <6 x i32> %val to <6 x i1>
+ store <6 x i1> %trunc, ptr addrspace(1) %out
+ ret void
+}
+
+define void @truncstore_v6i32_to_v6i8(ptr addrspace(1) %out, <6 x i32> %val) {
+; SI-LABEL: truncstore_v6i32_to_v6i8:
+; SI: ; %bb.0:
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; SI-NEXT: v_and_b32_e32 v4, 0xff, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 8, v3
+; SI-NEXT: v_and_b32_e32 v2, 0xff, v2
+; SI-NEXT: v_lshlrev_b32_e32 v5, 24, v5
+; SI-NEXT: v_lshlrev_b32_e32 v4, 16, v4
+; SI-NEXT: v_or_b32_e32 v2, v2, v3
+; SI-NEXT: v_or_b32_e32 v4, v5, v4
+; SI-NEXT: v_and_b32_e32 v2, 0xffff, v2
+; SI-NEXT: s_mov_b32 s6, 0
+; SI-NEXT: v_or_b32_e32 v2, v2, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 8, v7
+; SI-NEXT: v_and_b32_e32 v4, 0xff, v6
+; SI-NEXT: s_mov_b32 s7, 0xf000
+; SI-NEXT: s_mov_b32 s4, s6
+; SI-NEXT: s_mov_b32 s5, s6
+; SI-NEXT: v_or_b32_e32 v3, v4, v3
+; SI-NEXT: buffer_store_short v3, v[0:1], s[4:7], 0 addr64 offset:4
+; SI-NEXT: buffer_store_dword v2, v[0:1], s[4:7], 0 addr64
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0)
+; SI-NEXT: s_setpc_b64 s[30:31]
+;
+; VI-LABEL: truncstore_v6i32_to_v6i8:
+; VI: ; %bb.0:
+; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; VI-NEXT: v_lshlrev_b16_e32 v3, 8, v3
+; VI-NEXT: v_or_b32_sdwa v2, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e32 v3, 8, v5
+; VI-NEXT: v_or_b32_sdwa v3, v4, v3 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_or_b32_sdwa v4, v2, v3 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:WORD_0 src1_sel:DWORD
+; VI-NEXT: v_lshlrev_b16_e32 v2, 8, v7
+; VI-NEXT: v_or_b32_sdwa v5, v6, v2 dst_sel:DWORD dst_unused:UNUSED_PAD src0_sel:BYTE_0 src1_sel:DWORD
+; VI-NEXT: v_add_u32_e32 v2, vcc, 4, v0
+; VI-NEXT: v_addc_u32_e32 v3, vcc, 0, v1, vcc
+; VI-NEXT: flat_store_short v[2:3], v5
+; VI-NEXT: flat_store_dword v[0:1], v4
+; VI-NEXT: s_waitcnt vmcnt(0)
+; VI-NEXT: s_setpc_b64 s[30:31]
+ %trunc = trunc <6 x i32> %val to <6 x i8>
+ store <6 x i8> %trunc, ptr addrspace(1) %out
+ ret void
+}
+
+define void @truncstore_v6i32_to_v6i16(ptr addrspace(1) %out, <6 x i32> %val) {
+; SI-LABEL: truncstore_v6i32_to_v6i16:
+; SI: ; %bb.0:
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; SI-NEXT: v_lshlrev_b32_e32 v5, 16, v5
+; SI-NEXT: v_and_b32_e32 v4, 0xffff, v4
+; SI-NEXT: v_lshlrev_b32_e32 v3, 16, v3
+; SI-NEXT: v_and_b32_e32 v2, 0xffff, v2
+; SI-NEXT: s_mov_b32 s6, 0
+; SI-NEXT: v_or_b32_e32 v4, v4, v5
+; SI-NEXT: v_or_b32_e32 v3, v2, v3
+; SI-NEXT: v_lshlrev_b32_e32 v2, 16, v7
+; SI-NEXT: v_and_b32_e32 v5, 0xffff, v6
+; SI-NEXT: s_mov_b32 s7, 0xf000
+; SI-NEXT: s_mov_b32 s4, s6
+; SI-NEXT: s_mov_b32 s5, s6
+; SI-NEXT: v_or_b32_e32 v2, v5, v2
+; SI-NEXT: buffer_store_dword v2, v[0:1], s[4:7], 0 addr64 offset:8
+; SI-NEXT: buffer_store_dwordx2 v[3:4], v[0:1], s[4:7], 0 addr64
+; SI-NEXT: s_waitcnt vmcnt(0) expcnt(0)
+; SI-NEXT: s_setpc_b64 s[30:31]
+;
+; VI-LABEL: truncstore_v6i32_to_v6i16:
+; VI: ; %bb.0:
+; VI-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
+; VI-NEXT: s_mov_b32 s4, 0x1000504
+; VI-NEXT: v_perm_b32 v6, v6, v7, s4
+; VI-NEXT: v_perm_b32 v5, v4, v5, s4
+; VI-NEXT: v_perm_b32 v4, v2, v3, s4
+; VI-NEXT: flat_store_dwordx3 v[0:1], v[4:6]
+; VI-NEXT: s_waitcnt vmcnt(0)
+; VI-NEXT: s_setpc_b64 s[30:31]
+ %trunc = trunc <6 x i32> %val to <6 x i16>
+ store <6 x i16> %trunc, ptr addrspace(1) %out
+ ret void
+}
+
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; GCN: {{.*}}
diff --git a/llvm/test/CodeGen/NVPTX/inline-asm-b128-test1.ll b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test1.ll
new file mode 100644
index 0000000..3232f40
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test1.ll
@@ -0,0 +1,148 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --extra_scrub --version 5
+; RUN: llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | %ptxas-verify -arch=sm_70 %}
+
+target triple = "nvptx64-nvidia-cuda"
+
+@value = internal addrspace(1) global i128 0, align 16
+
+define void @test_b128_input_from_const() {
+; CHECK-LABEL: test_b128_input_from_const(
+; CHECK: {
+; CHECK-NEXT: .reg .b32 %r<3>;
+; CHECK-NEXT: .reg .b64 %rd<4>;
+; CHECK-NEXT: .reg .b128 %rq<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: mov.u64 %rd2, 0;
+; CHECK-NEXT: mov.u64 %rd3, 42;
+; CHECK-NEXT: mov.b128 %rq1, {%rd3, %rd2};
+; CHECK-NEXT: mov.u32 %r1, value;
+; CHECK-NEXT: cvta.global.u32 %r2, %r1;
+; CHECK-NEXT: cvt.u64.u32 %rd1, %r2;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: { st.b128 [%rd1], %rq1; }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ret;
+
+ tail call void asm sideeffect "{ st.b128 [$0], $1; }", "l,q"(ptr nonnull addrspacecast (ptr addrspace(1) @value to ptr), i128 42)
+ ret void
+}
+
+define void @test_b128_input_from_load(ptr nocapture readonly %data) {
+; CHECK-LABEL: test_b128_input_from_load(
+; CHECK: {
+; CHECK-NEXT: .reg .b32 %r<5>;
+; CHECK-NEXT: .reg .b64 %rd<4>;
+; CHECK-NEXT: .reg .b128 %rq<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: ld.param.u32 %r1, [test_b128_input_from_load_param_0];
+; CHECK-NEXT: cvta.to.global.u32 %r2, %r1;
+; CHECK-NEXT: ld.global.u64 %rd2, [%r2+8];
+; CHECK-NEXT: ld.global.u64 %rd3, [%r2];
+; CHECK-NEXT: mov.b128 %rq1, {%rd3, %rd2};
+; CHECK-NEXT: mov.u32 %r3, value;
+; CHECK-NEXT: cvta.global.u32 %r4, %r3;
+; CHECK-NEXT: cvt.u64.u32 %rd1, %r4;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: { st.b128 [%rd1], %rq1; }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ret;
+
+ %1 = addrspacecast ptr %data to ptr addrspace(1)
+ %2 = load <2 x i64>, ptr addrspace(1) %1, align 16
+ %3 = bitcast <2 x i64> %2 to i128
+ tail call void asm sideeffect "{ st.b128 [$0], $1; }", "l,q"(ptr nonnull addrspacecast (ptr addrspace(1) @value to ptr), i128 %3)
+ ret void
+}
+
+define void @test_b128_input_from_select(ptr nocapture readonly %flag) {
+; CHECK-LABEL: test_b128_input_from_select(
+; CHECK: {
+; CHECK-NEXT: .reg .pred %p<2>;
+; CHECK-NEXT: .reg .b16 %rs<2>;
+; CHECK-NEXT: .reg .b32 %r<5>;
+; CHECK-NEXT: .reg .b64 %rd<4>;
+; CHECK-NEXT: .reg .b128 %rq<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: ld.param.u32 %r1, [test_b128_input_from_select_param_0];
+; CHECK-NEXT: cvta.to.global.u32 %r2, %r1;
+; CHECK-NEXT: ld.global.u8 %rs1, [%r2];
+; CHECK-NEXT: setp.eq.s16 %p1, %rs1, 0;
+; CHECK-NEXT: selp.b64 %rd2, 24, 42, %p1;
+; CHECK-NEXT: mov.u64 %rd3, 0;
+; CHECK-NEXT: mov.b128 %rq1, {%rd2, %rd3};
+; CHECK-NEXT: mov.u32 %r3, value;
+; CHECK-NEXT: cvta.global.u32 %r4, %r3;
+; CHECK-NEXT: cvt.u64.u32 %rd1, %r4;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: { st.b128 [%rd1], %rq1; }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ret;
+
+ %1 = addrspacecast ptr %flag to ptr addrspace(1)
+ %2 = load i8, ptr addrspace(1) %1, align 1
+ %3 = icmp eq i8 %2, 0
+ %4 = select i1 %3, i128 24, i128 42
+ tail call void asm sideeffect "{ st.b128 [$0], $1; }", "l,q"(ptr nonnull addrspacecast (ptr addrspace(1) @value to ptr), i128 %4)
+ ret void
+}
+
+define void @test_store_b128_output() {
+; CHECK-LABEL: test_store_b128_output(
+; CHECK: {
+; CHECK-NEXT: .reg .b64 %rd<5>;
+; CHECK-NEXT: .reg .b128 %rq<2>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: { mov.b128 %rq1, 41; }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: mov.b128 {%rd1, %rd2}, %rq1;
+; CHECK-NEXT: add.cc.s64 %rd3, %rd1, 1;
+; CHECK-NEXT: addc.cc.s64 %rd4, %rd2, 0;
+; CHECK-NEXT: st.global.u64 [value+8], %rd4;
+; CHECK-NEXT: st.global.u64 [value], %rd3;
+; CHECK-NEXT: ret;
+
+ %1 = tail call i128 asm "{ mov.b128 $0, 41; }", "=q"()
+ %add = add nsw i128 %1, 1
+ %2 = bitcast i128 %add to <2 x i64>
+ store <2 x i64> %2, ptr addrspace(1) @value, align 16
+ ret void
+}
+
+define void @test_use_of_b128_output(ptr nocapture readonly %data) {
+; CHECK-LABEL: test_use_of_b128_output(
+; CHECK: {
+; CHECK-NEXT: .reg .b32 %r<3>;
+; CHECK-NEXT: .reg .b64 %rd<7>;
+; CHECK-NEXT: .reg .b128 %rq<3>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: ld.param.u32 %r1, [test_use_of_b128_output_param_0];
+; CHECK-NEXT: cvta.to.global.u32 %r2, %r1;
+; CHECK-NEXT: ld.global.u64 %rd1, [%r2+8];
+; CHECK-NEXT: ld.global.u64 %rd2, [%r2];
+; CHECK-NEXT: mov.b128 %rq2, {%rd2, %rd1};
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: { mov.b128 %rq1, %rq2; }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: mov.b128 {%rd3, %rd4}, %rq1;
+; CHECK-NEXT: add.cc.s64 %rd5, %rd3, 1;
+; CHECK-NEXT: addc.cc.s64 %rd6, %rd4, 0;
+; CHECK-NEXT: st.global.u64 [value], %rd5;
+; CHECK-NEXT: st.global.u64 [value+8], %rd6;
+; CHECK-NEXT: ret;
+
+ %1 = addrspacecast ptr %data to ptr addrspace(1)
+ %2 = load <2 x i64>, ptr addrspace(1) %1, align 16
+ %3 = bitcast <2 x i64> %2 to i128
+ %4 = tail call i128 asm "{ mov.b128 $0, $1; }", "=q,q"(i128 %3)
+ %add = add nsw i128 %4, 1
+ %5 = bitcast i128 %add to <2 x i64>
+ store <2 x i64> %5, ptr addrspace(1) @value, align 16
+ ret void
+}
diff --git a/llvm/test/CodeGen/NVPTX/inline-asm-b128-test2.ll b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test2.ll
new file mode 100644
index 0000000..3d1d7fb
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test2.ll
@@ -0,0 +1,122 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --extra_scrub --version 5
+; RUN: llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | %ptxas-verify -arch=sm_70 %}
+
+target triple = "nvptx64-nvidia-cuda"
+
+@u128_max = internal addrspace(1) global i128 0, align 16
+@u128_zero = internal addrspace(1) global i128 0, align 16
+@i128_max = internal addrspace(1) global i128 0, align 16
+@i128_min = internal addrspace(1) global i128 0, align 16
+@v_u128_max = internal addrspace(1) global i128 0, align 16
+@v_u128_zero = internal addrspace(1) global i128 0, align 16
+@v_i128_max = internal addrspace(1) global i128 0, align 16
+@v_i128_min = internal addrspace(1) global i128 0, align 16
+@v64 = internal addrspace(1) global ptr null, align 8
+
+define void @test_corner_values() {
+; CHECK-LABEL: test_corner_values(
+; CHECK: {
+; CHECK-NEXT: .reg .b32 %r<20>;
+; CHECK-NEXT: .reg .b64 %rd<17>;
+; CHECK-NEXT: .reg .b128 %rq<5>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: ld.global.u32 %r1, [v64];
+; CHECK-NEXT: add.s32 %r2, %r1, 8;
+; CHECK-NEXT: mov.u64 %rd13, -1;
+; CHECK-NEXT: mov.b128 %rq1, {%rd13, %rd13};
+; CHECK-NEXT: cvt.u64.u32 %rd1, %r1;
+; CHECK-NEXT: cvt.u64.u32 %rd2, %r2;
+; CHECK-NEXT: mov.u32 %r3, v_u128_max;
+; CHECK-NEXT: cvta.global.u32 %r4, %r3;
+; CHECK-NEXT: cvt.u64.u32 %rd3, %r4;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: {
+; CHECK-NEXT: .reg .b64 hi;
+; CHECK-NEXT: .reg .b64 lo;
+; CHECK-NEXT: mov.b128 {lo, hi}, %rq1;
+; CHECK-NEXT: st.b64 [%rd1], lo;
+; CHECK-NEXT: st.b64 [%rd2], hi;
+; CHECK-NEXT: st.b128 [%rd3], %rq1;
+; CHECK-NEXT: }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ld.global.u32 %r5, [v64];
+; CHECK-NEXT: add.s32 %r6, %r5, 16;
+; CHECK-NEXT: add.s32 %r7, %r5, 24;
+; CHECK-NEXT: mov.u64 %rd14, 9223372036854775807;
+; CHECK-NEXT: mov.b128 %rq2, {%rd13, %rd14};
+; CHECK-NEXT: mov.u32 %r8, v_i128_max;
+; CHECK-NEXT: cvta.global.u32 %r9, %r8;
+; CHECK-NEXT: cvt.u64.u32 %rd6, %r9;
+; CHECK-NEXT: cvt.u64.u32 %rd4, %r6;
+; CHECK-NEXT: cvt.u64.u32 %rd5, %r7;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: {
+; CHECK-NEXT: .reg .b64 hi;
+; CHECK-NEXT: .reg .b64 lo;
+; CHECK-NEXT: mov.b128 {lo, hi}, %rq2;
+; CHECK-NEXT: st.b64 [%rd4], lo;
+; CHECK-NEXT: st.b64 [%rd5], hi;
+; CHECK-NEXT: st.b128 [%rd6], %rq2;
+; CHECK-NEXT: }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ld.global.u32 %r10, [v64];
+; CHECK-NEXT: add.s32 %r11, %r10, 32;
+; CHECK-NEXT: add.s32 %r12, %r10, 40;
+; CHECK-NEXT: mov.u64 %rd15, -9223372036854775808;
+; CHECK-NEXT: mov.u64 %rd16, 0;
+; CHECK-NEXT: mov.b128 %rq3, {%rd16, %rd15};
+; CHECK-NEXT: mov.u32 %r13, v_i128_min;
+; CHECK-NEXT: cvta.global.u32 %r14, %r13;
+; CHECK-NEXT: cvt.u64.u32 %rd9, %r14;
+; CHECK-NEXT: cvt.u64.u32 %rd7, %r11;
+; CHECK-NEXT: cvt.u64.u32 %rd8, %r12;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: {
+; CHECK-NEXT: .reg .b64 hi;
+; CHECK-NEXT: .reg .b64 lo;
+; CHECK-NEXT: mov.b128 {lo, hi}, %rq3;
+; CHECK-NEXT: st.b64 [%rd7], lo;
+; CHECK-NEXT: st.b64 [%rd8], hi;
+; CHECK-NEXT: st.b128 [%rd9], %rq3;
+; CHECK-NEXT: }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ld.global.u32 %r15, [v64];
+; CHECK-NEXT: add.s32 %r16, %r15, 48;
+; CHECK-NEXT: add.s32 %r17, %r15, 56;
+; CHECK-NEXT: mov.b128 %rq4, {%rd16, %rd16};
+; CHECK-NEXT: mov.u32 %r18, v_u128_zero;
+; CHECK-NEXT: cvta.global.u32 %r19, %r18;
+; CHECK-NEXT: cvt.u64.u32 %rd12, %r19;
+; CHECK-NEXT: cvt.u64.u32 %rd10, %r16;
+; CHECK-NEXT: cvt.u64.u32 %rd11, %r17;
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: {
+; CHECK-NEXT: .reg .b64 hi;
+; CHECK-NEXT: .reg .b64 lo;
+; CHECK-NEXT: mov.b128 {lo, hi}, %rq4;
+; CHECK-NEXT: st.b64 [%rd10], lo;
+; CHECK-NEXT: st.b64 [%rd11], hi;
+; CHECK-NEXT: st.b128 [%rd12], %rq4;
+; CHECK-NEXT: }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: ret;
+
+ %1 = load ptr, ptr addrspace(1) @v64, align 8
+ %2 = getelementptr inbounds i64, ptr %1, i64 1
+ tail call void asm sideeffect "{\0A\09.reg .b64 hi;\0A\09.reg .b64 lo;\0A\09mov.b128 {lo, hi}, $0;\0A\09st.b64 [$1], lo;\0A\09st.b64 [$2], hi;\0A\09st.b128 [$3], $0;\0A\09}", "q,l,l,l"(i128 -1, ptr %1, ptr nonnull %2, ptr nonnull addrspacecast (ptr addrspace(1) @v_u128_max to ptr))
+ %3 = load ptr, ptr addrspace(1) @v64, align 8
+ %4 = getelementptr inbounds i64, ptr %3, i64 2
+ %5 = getelementptr inbounds i64, ptr %3, i64 3
+ tail call void asm sideeffect "{\0A\09.reg .b64 hi;\0A\09.reg .b64 lo;\0A\09mov.b128 {lo, hi}, $0;\0A\09st.b64 [$1], lo;\0A\09st.b64 [$2], hi;\0A\09st.b128 [$3], $0;\0A\09}", "q,l,l,l"(i128 170141183460469231731687303715884105727, ptr nonnull %4, ptr nonnull %5, ptr nonnull addrspacecast (ptr addrspace(1) @v_i128_max to ptr))
+ %6 = load ptr, ptr addrspace(1) @v64, align 8
+ %7 = getelementptr inbounds i64, ptr %6, i64 4
+ %8 = getelementptr inbounds i64, ptr %6, i64 5
+ tail call void asm sideeffect "{\0A\09.reg .b64 hi;\0A\09.reg .b64 lo;\0A\09mov.b128 {lo, hi}, $0;\0A\09st.b64 [$1], lo;\0A\09st.b64 [$2], hi;\0A\09st.b128 [$3], $0;\0A\09}", "q,l,l,l"(i128 -170141183460469231731687303715884105728, ptr nonnull %7, ptr nonnull %8, ptr nonnull addrspacecast (ptr addrspace(1) @v_i128_min to ptr))
+ %9 = load ptr, ptr addrspace(1) @v64, align 8
+ %10 = getelementptr inbounds i64, ptr %9, i64 6
+ %11 = getelementptr inbounds i64, ptr %9, i64 7
+ tail call void asm sideeffect "{\0A\09.reg .b64 hi;\0A\09.reg .b64 lo;\0A\09mov.b128 {lo, hi}, $0;\0A\09st.b64 [$1], lo;\0A\09st.b64 [$2], hi;\0A\09st.b128 [$3], $0;\0A\09}", "q,l,l,l"(i128 0, ptr nonnull %10, ptr nonnull %11, ptr nonnull addrspacecast (ptr addrspace(1) @v_u128_zero to ptr))
+ ret void
+}
diff --git a/llvm/test/CodeGen/NVPTX/inline-asm-b128-test3.ll b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test3.ll
new file mode 100644
index 0000000..ae45397
--- /dev/null
+++ b/llvm/test/CodeGen/NVPTX/inline-asm-b128-test3.ll
@@ -0,0 +1,67 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --extra_scrub --version 5
+; RUN: llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | FileCheck %s
+; RUN: %if ptxas %{ llc < %s -march=nvptx -mcpu=sm_70 -mattr=+ptx83 | %ptxas-verify -arch=sm_70 %}
+
+target triple = "nvptx64-nvidia-cuda"
+
+@size = internal addrspace(1) global i32 0, align 4
+@x = internal addrspace(1) global i128 0, align 16
+
+define void @test_b128_in_loop() {
+; CHECK-LABEL: test_b128_in_loop(
+; CHECK: {
+; CHECK-NEXT: .reg .pred %p<3>;
+; CHECK-NEXT: .reg .b64 %rd<15>;
+; CHECK-NEXT: .reg .b128 %rq<3>;
+; CHECK-EMPTY:
+; CHECK-NEXT: // %bb.0:
+; CHECK-NEXT: ld.global.s32 %rd1, [size];
+; CHECK-NEXT: setp.eq.s64 %p1, %rd1, 0;
+; CHECK-NEXT: @%p1 bra $L__BB0_3;
+; CHECK-NEXT: // %bb.1: // %BB1
+; CHECK-NEXT: ld.global.u64 %rd13, [x+8];
+; CHECK-NEXT: ld.global.u64 %rd12, [x];
+; CHECK-NEXT: mov.u64 %rd14, 0;
+; CHECK-NEXT: $L__BB0_2: // %BB2
+; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
+; CHECK-NEXT: mov.b128 %rq1, {%rd12, %rd13};
+; CHECK-NEXT: // begin inline asm
+; CHECK-NEXT: {
+; CHECK-NEXT: .reg .b64 lo;
+; CHECK-NEXT: .reg .b64 hi;
+; CHECK-NEXT: mov.b128 {lo, hi}, %rq1;
+; CHECK-NEXT: add.cc.u64 lo, lo, %rd14;
+; CHECK-NEXT: mov.b128 %rq1, {lo, hi};
+; CHECK-NEXT: }
+; CHECK-NEXT: // end inline asm
+; CHECK-NEXT: mov.b128 {%rd12, %rd13}, %rq1;
+; CHECK-NEXT: st.global.u64 [x+8], %rd13;
+; CHECK-NEXT: st.global.u64 [x], %rd12;
+; CHECK-NEXT: add.s64 %rd14, %rd14, 1;
+; CHECK-NEXT: setp.ne.s64 %p2, %rd1, %rd14;
+; CHECK-NEXT: @%p2 bra $L__BB0_2;
+; CHECK-NEXT: $L__BB0_3: // %BB3
+; CHECK-NEXT: ret;
+
+ %1 = load i32, ptr addrspace(1) @size, align 4
+ %2 = icmp eq i32 %1, 0
+ br i1 %2, label %BB3, label %BB1
+
+BB1: ; preds = %0
+ %3 = load i128, ptr addrspace(1) @x, align 16
+ %4 = sext i32 %1 to i64
+ br label %BB2
+
+BB2: ; preds = %BB2, %BB1
+ %5 = phi i128 [ %7, %BB2 ], [ %3, %BB1 ]
+ %6 = phi i64 [ %9, %BB2 ], [ 0, %BB1 ]
+ %7 = tail call i128 asm "{\0A\09.reg .b64 lo;\0A\09.reg .b64 hi;\0A\09mov.b128 {lo, hi}, $0;\0A\09add.cc.u64 lo, lo, $1;\0A\09mov.b128 $0, {lo, hi};\0A\09}", "=q,l,0"(i64 %6, i128 %5)
+ %8 = bitcast i128 %7 to <2 x i64>
+ store <2 x i64> %8, ptr addrspace(1) @x, align 16
+ %9 = add nuw i64 %6, 1
+ %10 = icmp eq i64 %9, %4
+ br i1 %10, label %BB3, label %BB2
+
+BB3: ; preds = %BB2, %0
+ ret void
+}
diff --git a/llvm/test/CodeGen/RISCV/O3-pipeline.ll b/llvm/test/CodeGen/RISCV/O3-pipeline.ll
index 1eee62e..3611d92 100644
--- a/llvm/test/CodeGen/RISCV/O3-pipeline.ll
+++ b/llvm/test/CodeGen/RISCV/O3-pipeline.ll
@@ -182,9 +182,9 @@
; CHECK-NEXT: Insert fentry calls
; CHECK-NEXT: Insert XRay ops
; CHECK-NEXT: Implement the 'patchable-function' attribute
+; CHECK-NEXT: Machine Copy Propagation Pass
; CHECK-NEXT: Branch relaxation pass
; CHECK-NEXT: RISC-V Make Compressible
-; CHECK-NEXT: Machine Copy Propagation Pass
; CHECK-NEXT: Contiguously Lay Out Funclets
; CHECK-NEXT: StackMap Liveness Analysis
; CHECK-NEXT: Live DEBUG_VALUE analysis
diff --git a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
index 68e8f5d..884c756 100644
--- a/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
+++ b/llvm/test/CodeGen/RISCV/rvv/vsetvli-insert-crossbb.ll
@@ -1062,3 +1062,36 @@ exit:
%c = call <vscale x 2 x i32> @llvm.riscv.vadd.nxv2i32(<vscale x 2 x i32> undef, <vscale x 2 x i32> %a, <vscale x 2 x i32> %d, i64 %vl)
ret <vscale x 2 x i32> %c
}
+
+define void @vlmax_avl_phi(i1 %cmp, ptr %p, i64 %a, i64 %b) {
+; CHECK-LABEL: vlmax_avl_phi:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: andi a0, a0, 1
+; CHECK-NEXT: beqz a0, .LBB25_2
+; CHECK-NEXT: # %bb.1: # %foo
+; CHECK-NEXT: vsetvli zero, a2, e8, m1, ta, ma
+; CHECK-NEXT: j .LBB25_3
+; CHECK-NEXT: .LBB25_2: # %bar
+; CHECK-NEXT: vsetvli zero, a3, e8, m1, ta, ma
+; CHECK-NEXT: .LBB25_3: # %exit
+; CHECK-NEXT: vmv.v.i v8, 0
+; CHECK-NEXT: vsetivli zero, 1, e8, m1, ta, ma
+; CHECK-NEXT: vse8.v v8, (a1)
+; CHECK-NEXT: ret
+entry:
+ br i1 %cmp, label %foo, label %bar
+
+foo:
+ %vl.foo = tail call i64 @llvm.riscv.vsetvli.i64(i64 %a, i64 0, i64 0)
+ br label %exit
+
+bar:
+ %vl.bar = tail call i64 @llvm.riscv.vsetvli.i64(i64 %b, i64 0, i64 0)
+ br label %exit
+
+exit:
+ %phivl = phi i64 [ %vl.foo, %foo ], [ %vl.bar, %bar ]
+ %1 = tail call <vscale x 8 x i8> @llvm.riscv.vmv.v.x.nxv8i8.i64(<vscale x 8 x i8> poison, i8 0, i64 %phivl)
+ call void @llvm.riscv.vse.nxv8i8(<vscale x 8 x i8> %1, ptr %p, i64 1)
+ ret void
+}
diff --git a/llvm/test/CodeGen/WebAssembly/call-indirect.ll b/llvm/test/CodeGen/WebAssembly/call-indirect.ll
index b88d096..55a654f 100644
--- a/llvm/test/CodeGen/WebAssembly/call-indirect.ll
+++ b/llvm/test/CodeGen/WebAssembly/call-indirect.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -asm-verbose=false -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
+; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck --check-prefixes=CHECK,NOREF %s
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefixes=CHECK,REF %s
; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=OBJ %s
diff --git a/llvm/test/CodeGen/WebAssembly/function-pointer64.ll b/llvm/test/CodeGen/WebAssembly/function-pointer64.ll
index 7f98d3e..d5d10b0 100644
--- a/llvm/test/CodeGen/WebAssembly/function-pointer64.ll
+++ b/llvm/test/CodeGen/WebAssembly/function-pointer64.ll
@@ -1,6 +1,6 @@
-; RUN: llc < %s -asm-verbose=false -O2 | FileCheck %s
+; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 | FileCheck %s
; RUN: llc < %s -asm-verbose=false -mattr=+reference-types -O2 | FileCheck --check-prefix=REF %s
-; RUN: llc < %s -asm-verbose=false -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s
+; RUN: llc < %s -asm-verbose=false -mattr=-reference-types -O2 --filetype=obj | obj2yaml | FileCheck --check-prefix=YAML %s
; This tests pointer features that may codegen differently in wasm64.
diff --git a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
index f9845d4..f1466a4 100644
--- a/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
+++ b/llvm/test/CodeGen/WebAssembly/reg-stackify.ll
@@ -649,7 +649,7 @@ define i32 @stackpointer_dependency(ptr readnone) {
; NOREGS-NEXT: local.tee 0
; NOREGS: i32.load 0
; NOREGS-NEXT: i32.load 0
-; NOREGS-NEXT: call_indirect (i32, i32) -> (i32)
+; NOREGS-NEXT: call_indirect __indirect_function_table, (i32, i32) -> (i32)
%class.call_indirect = type { ptr }
define i32 @call_indirect_stackify(ptr %objptr, i32 %arg) {
%obj = load ptr, ptr %objptr
diff --git a/llvm/test/CodeGen/WebAssembly/swiftcc.ll b/llvm/test/CodeGen/WebAssembly/swiftcc.ll
index e0f67b0..0c5c3d8 100644
--- a/llvm/test/CodeGen/WebAssembly/swiftcc.ll
+++ b/llvm/test/CodeGen/WebAssembly/swiftcc.ll
@@ -19,21 +19,21 @@ define swiftcc void @bar() {
call swiftcc void @foo(i32 1, i32 2)
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
-; CHECK: call_indirect (i32, i32, i32, i32) -> ()
+; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
call swiftcc void %1(i32 1, i32 2)
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
-; CHECK: call_indirect (i32, i32, i32, i32) -> ()
+; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
call swiftcc void %1(i32 1, i32 2, i32 swiftself 3)
%err = alloca swifterror ptr, align 4
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
-; CHECK: call_indirect (i32, i32, i32, i32) -> ()
+; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
call swiftcc void %1(i32 1, i32 2, ptr swifterror %err)
; REG: call_indirect $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}, $pop{{[0-9]+}}
-; CHECK: call_indirect (i32, i32, i32, i32) -> ()
+; CHECK: call_indirect __indirect_function_table, (i32, i32, i32, i32) -> ()
call swiftcc void %1(i32 1, i32 2, i32 swiftself 3, ptr swifterror %err)
ret void
diff --git a/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll b/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
index d368271..d931475 100644
--- a/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
+++ b/llvm/test/CodeGen/WebAssembly/target-features-cpus.ll
@@ -11,20 +11,28 @@ target triple = "wasm32-unknown-unknown"
; mvp: should not contain the target features section
; MVP-NOT: .custom_section.target_features,"",@
-; generic: +mutable-globals, +sign-ext
+; generic: +multivalue, +mutable-globals, +reference-types, +sign-ext
; GENERIC-LABEL: .custom_section.target_features,"",@
-; GENERIC-NEXT: .int8 2
+; GENERIC-NEXT: .int8 4
+; GENERIC-NEXT: .int8 43
+; GENERIC-NEXT: .int8 10
+; GENERIC-NEXT: .ascii "multivalue"
; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 15
; GENERIC-NEXT: .ascii "mutable-globals"
; GENERIC-NEXT: .int8 43
+; GENERIC-NEXT: .int8 15
+; GENERIC-NEXT: .ascii "reference-types"
+; GENERIC-NEXT: .int8 43
; GENERIC-NEXT: .int8 8
; GENERIC-NEXT: .ascii "sign-ext"
-; bleeding-edge: +atomics, +bulk-memory, +mutable-globals, +nontrapping-fptoint,
-; +sign-ext, +simd128, +tail-call
+; bleeding-edge: +atomics, +bulk-memory, +exception-handling, +extended-const,
+; +half-precision, +multimemory, +multivalue, +mutable-globals,
+; +nontrapping-fptoint, +relaxed-simd, +reference-types,
+; +simd128, +sign-ext, +tail-call
; BLEEDING-EDGE-LABEL: .section .custom_section.target_features,"",@
-; BLEEDING-EDGE-NEXT: .int8 7
+; BLEEDING-EDGE-NEXT: .int8 14
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 7
; BLEEDING-EDGE-NEXT: .ascii "atomics"
@@ -32,12 +40,33 @@ target triple = "wasm32-unknown-unknown"
; BLEEDING-EDGE-NEXT: .int8 11
; BLEEDING-EDGE-NEXT: .ascii "bulk-memory"
; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 18
+; BLEEDING-EDGE-NEXT: .ascii "exception-handling"
+; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 14
+; BLEEDING-EDGE-NEXT: .ascii "extended-const"
+; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 14
+; BLEEDING-EDGE-NEXT: .ascii "half-precision"
+; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 11
+; BLEEDING-EDGE-NEXT: .ascii "multimemory"
+; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 10
+; BLEEDING-EDGE-NEXT: .ascii "multivalue"
+; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 15
; BLEEDING-EDGE-NEXT: .ascii "mutable-globals"
; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 19
; BLEEDING-EDGE-NEXT: .ascii "nontrapping-fptoint"
; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 15
+; BLEEDING-EDGE-NEXT: .ascii "reference-types"
+; BLEEDING-EDGE-NEXT: .int8 43
+; BLEEDING-EDGE-NEXT: .int8 12
+; BLEEDING-EDGE-NEXT: .ascii "relaxed-simd"
+; BLEEDING-EDGE-NEXT: .int8 43
; BLEEDING-EDGE-NEXT: .int8 8
; BLEEDING-EDGE-NEXT: .ascii "sign-ext"
; BLEEDING-EDGE-NEXT: .int8 43
diff --git a/llvm/test/MC/WebAssembly/function-alias.ll b/llvm/test/MC/WebAssembly/function-alias.ll
index 6722d18..036cd7d 100644
--- a/llvm/test/MC/WebAssembly/function-alias.ll
+++ b/llvm/test/MC/WebAssembly/function-alias.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %s -o - | llvm-readobj --symbols - | FileCheck %s
+; RUN: llc -filetype=obj %s -mattr=-reference-types -o - | llvm-readobj --symbols - | FileCheck %s
; RUN: llc -filetype=obj %s -mattr=+reference-types -o - | llvm-readobj --symbols - | FileCheck --check-prefix=REF %s
target triple = "wasm32-unknown-unknown-wasm"
diff --git a/llvm/test/MC/WebAssembly/no-dead-strip.ll b/llvm/test/MC/WebAssembly/no-dead-strip.ll
index 6b3f090..3125dcf 100644
--- a/llvm/test/MC/WebAssembly/no-dead-strip.ll
+++ b/llvm/test/MC/WebAssembly/no-dead-strip.ll
@@ -50,6 +50,11 @@ entry:
; CHECK-NEXT: Segment: 3
; CHECK-NEXT: Offset: 8
; CHECK-NEXT: Size: 8
+; CHECK-NEXT: - Index: 5
+; CHECK-NEXT: Kind: TABLE
+; CHECK-NEXT: Name: __indirect_function_table
+; CHECK-NEXT: Flags: [ UNDEFINED, NO_STRIP ]
+; CHECK-NEXT: Table: 0
; CHECK-NEXT: SegmentInfo:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: .data.gv0
diff --git a/llvm/test/Transforms/Attributor/phi_bug_pointer_info.ll b/llvm/test/Transforms/Attributor/phi_bug_pointer_info.ll
new file mode 100644
index 0000000..bb423e1
--- /dev/null
+++ b/llvm/test/Transforms/Attributor/phi_bug_pointer_info.ll
@@ -0,0 +1,41 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes --check-globals --version 2
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor -debug-only=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s 2>&1 | FileCheck %s
+; RUN: opt -aa-pipeline=basic-aa -passes=attributor-cgscc -debug-only=attributor -attributor-manifest-internal -attributor-annotate-decl-cs -S < %s 2>&1 | FileCheck %s
+; REQUIRES: asserts
+
+
+@globalBytes = internal global [1024 x i8] zeroinitializer
+
+; CHECK: Accesses by bin after update:
+; CHECK: [8-12] : 2
+; CHECK: - 9 - store i32 %0, ptr %field2, align 4
+; CHECK: - c: %0 = load i32, ptr %val, align 4
+; CHECK: - 6 - %ret = load i32, ptr %x, align 4
+; CHECK: - c: <unknown>
+; CHECK: [32-36] : 2
+; CHECK: - 9 - store i32 %1, ptr %field8, align 4
+; CHECK: - c: %1 = load i32, ptr %val2, align 4
+; CHECK: - 6 - %ret = load i32, ptr %x, align 4
+; CHECK: - c: <unknown>
+define dso_local i32 @phi_different_offsets(ptr nocapture %val, ptr nocapture %val2, i1 %cmp) {
+entry:
+ br i1 %cmp, label %then, label %else
+
+then:
+ %field2 = getelementptr i32, ptr @globalBytes, i32 2
+ %1 = load i32, ptr %val
+ store i32 %1, ptr %field2
+ br label %end
+
+else:
+ %field8 = getelementptr i32, ptr @globalBytes, i32 8
+ %2 = load i32, ptr %val2
+ store i32 %2, ptr %field8
+ br label %end
+
+end:
+ %x = phi ptr [ %field2, %then ], [ %field8, %else ]
+ %ret = load i32, ptr %x
+ ret i32 %ret
+
+}
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/uscmp.ll b/llvm/test/Transforms/CorrelatedValuePropagation/uscmp.ll
new file mode 100644
index 0000000..efe4235
--- /dev/null
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/uscmp.ll
@@ -0,0 +1,258 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
+
+; If nothing is known we can't change anything
+define i8 @ucmp_0(i32 %x, i32 %y) {
+; CHECK-LABEL: @ucmp_0(
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.ucmp.i8.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_0(i32 %x, i32 %y) {
+; CHECK-LABEL: @scmp_0(
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.scmp.i8.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; If we know that range of LHS < range of RHS then return -1
+define i8 @ucmp_1(i32 %x, i32 %y) {
+ ; X is within [4, 8)
+; CHECK-LABEL: @ucmp_1(
+; CHECK-NEXT: [[COND1:%.*]] = icmp uge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp ult i32 [[X]], 8
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[COND3:%.*]] = icmp uge i32 [[Y:%.*]], 8
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND3]])
+; CHECK-NEXT: ret i8 -1
+;
+ %cond1 = icmp uge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ %cond2 = icmp ult i32 %x, 8
+ call void @llvm.assume(i1 %cond2)
+ ; Y is within [8, UNSIGNED_MAX)
+ %cond3 = icmp uge i32 %y, 8
+ call void @llvm.assume(i1 %cond3)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_1(i32 %x, i32 %y) {
+ ; X is within [-5, 3)
+; CHECK-LABEL: @scmp_1(
+; CHECK-NEXT: [[COND1:%.*]] = icmp sge i32 [[X:%.*]], -5
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp slt i32 [[X]], 3
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[COND3:%.*]] = icmp sge i32 [[Y:%.*]], 3
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND3]])
+; CHECK-NEXT: ret i8 -1
+;
+ %cond1 = icmp sge i32 %x, -5
+ call void @llvm.assume(i1 %cond1)
+ %cond2 = icmp slt i32 %x, 3
+ call void @llvm.assume(i1 %cond2)
+ ; Y is within [3, SIGNED_MAX)
+ %cond3 = icmp sge i32 %y, 3
+ call void @llvm.assume(i1 %cond3)
+
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; If we know that range of LHS > range of RHS then return 1
+define i8 @ucmp_2(i32 %x, i32 %y) {
+ ; X is within [4, UNSIGNED_MAX)
+; CHECK-LABEL: @ucmp_2(
+; CHECK-NEXT: [[COND1:%.*]] = icmp uge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp ult i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: ret i8 1
+;
+ %cond1 = icmp uge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [0, 4)
+ %cond2 = icmp ult i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_2(i32 %x, i32 %y) {
+ ; X is within [4, SIGNED_MAX)
+; CHECK-LABEL: @scmp_2(
+; CHECK-NEXT: [[COND1:%.*]] = icmp sge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp slt i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: ret i8 1
+;
+ %cond1 = icmp sge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [SIGNED_MIN, 4)
+ %cond2 = icmp slt i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; If we know that LHS and RHS are both constants then return 0
+define i8 @ucmp_5(i32 %x, i32 %y) {
+; CHECK-LABEL: @ucmp_5(
+; CHECK-NEXT: [[COND1:%.*]] = icmp eq i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp eq i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: ret i8 0
+;
+ %cond1 = icmp eq i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ %cond2 = icmp eq i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_5(i32 %x, i32 %y) {
+; CHECK-LABEL: @scmp_5(
+; CHECK-NEXT: [[COND1:%.*]] = icmp eq i32 [[X:%.*]], -5
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp eq i32 [[Y:%.*]], -5
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: ret i8 0
+;
+ %cond1 = icmp eq i32 %x, -5
+ call void @llvm.assume(i1 %cond1)
+ %cond2 = icmp eq i32 %y, -5
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; We can infer ranges based on the location where a UCMP/SCMP result is used
+define i8 @scmp_6(i32 noundef %x) {
+; CHECK-LABEL: @scmp_6(
+; CHECK-NEXT: [[TMP1:%.*]] = icmp slt i32 [[X:%.*]], 10
+; CHECK-NEXT: [[TMP2:%.*]] = select i1 [[TMP1]], i8 -1, i8 5
+; CHECK-NEXT: ret i8 [[TMP2]]
+;
+ %1 = icmp slt i32 %x, 10
+ %2 = call i8 @llvm.scmp(i32 %x, i32 10)
+ %3 = select i1 %1, i8 %2, i8 5
+ ret i8 %3
+}
+
+; Negative test: ranges overlap
+define i8 @ucmp_3(i32 %x, i32 %y) {
+ ; X is within [4, UNSIGNED_MAX)
+; CHECK-LABEL: @ucmp_3(
+; CHECK-NEXT: [[COND1:%.*]] = icmp uge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp ult i32 [[Y:%.*]], 6
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.ucmp.i8.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %cond1 = icmp uge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [0, 6)
+ %cond2 = icmp ult i32 %y, 6
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_3(i32 %x, i32 %y) {
+ ; X is within [2, SIGNED_MAX)
+; CHECK-LABEL: @scmp_3(
+; CHECK-NEXT: [[COND1:%.*]] = icmp sge i32 [[X:%.*]], 2
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp slt i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.scmp.i8.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %cond1 = icmp sge i32 %x, 2
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [SIGNED_MIN, 4)
+ %cond2 = icmp slt i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; Negative test: mismatched signedness of range-establishing comparisons and
+; of the intrinsic
+define i8 @ucmp_4(i32 %x, i32 %y) {
+ ; X is within [4, SIGNED_MAX)
+; CHECK-LABEL: @ucmp_4(
+; CHECK-NEXT: [[COND1:%.*]] = icmp sge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp slt i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.ucmp.i8.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %cond1 = icmp sge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [0, 4)
+ %cond2 = icmp slt i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+define i8 @scmp_4(i32 %x, i32 %y) {
+ ; X is within [4, UNSIGNED_MAX)
+; CHECK-LABEL: @scmp_4(
+; CHECK-NEXT: [[COND1:%.*]] = icmp uge i32 [[X:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp ult i32 [[Y:%.*]], 4
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.scmp.i8.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %cond1 = icmp uge i32 %x, 4
+ call void @llvm.assume(i1 %cond1)
+ ; Y is within [0, 4)
+ %cond2 = icmp ult i32 %y, 4
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.scmp(i32 %x, i32 %y)
+ ret i8 %1
+}
+
+; Negative test: ranges are the same, but we can't be sure the values are equal
+define i8 @ucmp_6(i32 %x, i32 %y) {
+ ; Both X and Y are within [0, 10]
+; CHECK-LABEL: @ucmp_6(
+; CHECK-NEXT: [[COND1:%.*]] = icmp ule i32 [[X:%.*]], 10
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND1]])
+; CHECK-NEXT: [[COND2:%.*]] = icmp ule i32 [[Y:%.*]], 10
+; CHECK-NEXT: call void @llvm.assume(i1 [[COND2]])
+; CHECK-NEXT: [[TMP1:%.*]] = call i8 @llvm.ucmp.i8.i32(i32 [[X]], i32 [[Y]])
+; CHECK-NEXT: ret i8 [[TMP1]]
+;
+ %cond1 = icmp ule i32 %x, 10
+ call void @llvm.assume(i1 %cond1)
+ %cond2 = icmp ule i32 %y, 10
+ call void @llvm.assume(i1 %cond2)
+
+ %1 = call i8 @llvm.ucmp(i32 %x, i32 %y)
+ ret i8 %1
+}
diff --git a/llvm/test/Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll b/llvm/test/Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll
new file mode 100644
index 0000000..0cb8764
--- /dev/null
+++ b/llvm/test/Transforms/IndVarSimplify/preserving-debugloc-rem-div.ll
@@ -0,0 +1,182 @@
+; Test that the debug information is propagated correctly to the new instructions
+; RUN: opt < %s -passes=indvars -S | FileCheck %s
+
+define void @test_srem_urem(ptr %a) !dbg !5 {
+; CHECK-LABEL: define void @test_srem_urem(
+; CHECK: [[REM_UREM:%.*]] = urem i32 [[I_01:%.*]], 2, !dbg [[DBG10:![0-9]+]]
+;
+entry:
+ br label %for.body, !dbg !8
+
+for.body: ; preds = %for.body, %entry
+ %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ], !dbg !9
+ %rem = srem i32 %i.01, 2, !dbg !10
+ %idxprom = sext i32 %rem to i64, !dbg !11
+ %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom, !dbg !12
+ store i32 %i.01, ptr %arrayidx, align 4, !dbg !13
+ %inc = add nsw i32 %i.01, 1, !dbg !14
+ %cmp = icmp slt i32 %inc, 64, !dbg !15
+ br i1 %cmp, label %for.body, label %for.end, !dbg !16
+
+for.end: ; preds = %for.body
+ ret void, !dbg !17
+}
+
+define void @test_sdiv_udiv(ptr %a) !dbg !18 {
+; CHECK-LABEL: define void @test_sdiv_udiv(
+; CHECK: [[DIV_UDIV:%.*]] = udiv i32 [[I_01:%.*]], 2, !dbg [[DBG21:![0-9]+]]
+;
+entry:
+ br label %for.body, !dbg !19
+
+for.body: ; preds = %for.body, %entry
+ %i.01 = phi i32 [ 0, %entry ], [ %inc, %for.body ], !dbg !20
+ %div = sdiv i32 %i.01, 2, !dbg !21
+ %idxprom = sext i32 %div to i64, !dbg !22
+ %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom, !dbg !23
+ store i32 %i.01, ptr %arrayidx, align 4, !dbg !24
+ %inc = add nsw i32 %i.01, 1, !dbg !25
+ %cmp = icmp slt i32 %inc, 64, !dbg !26
+ br i1 %cmp, label %for.body, label %for.end, !dbg !27
+
+for.end: ; preds = %for.body
+ ret void, !dbg !28
+}
+
+; Function Attrs: nounwind
+define i32 @test_rem_num_zero(i64 %arg1) #0 !dbg !29 {
+; CHECK-LABEL: define i32 @test_rem_num_zero(
+; CHECK: [[TMP0:%.*]] = icmp eq i64 [[T12:%.*]], %arg1
+; CHECK: [[IV_REM:%.*]] = select i1 [[TMP0]], i64 0, i64 [[T12]], !dbg [[DBG36:![0-9]+]]
+;
+bb:
+ %t = icmp sgt i64 %arg1, 0, !dbg !30
+ br i1 %t, label %bb4, label %bb54, !dbg !31
+
+bb4: ; preds = %bb
+ br label %bb5, !dbg !32
+
+bb5: ; preds = %bb49, %bb4
+ %t6 = phi i64 [ %t51, %bb49 ], [ 0, %bb4 ], !dbg !33
+ %t7 = phi i32 [ %t50, %bb49 ], [ 0, %bb4 ], !dbg !34
+ %t12 = add nsw i64 %t6, 1, !dbg !35
+ %t13 = srem i64 %t12, %arg1, !dbg !36
+ %t14 = icmp sgt i64 %arg1, 0, !dbg !37
+ br i1 %t14, label %bb15, label %bb49, !dbg !38
+
+bb15: ; preds = %bb5
+ br label %bb16, !dbg !39
+
+bb16: ; preds = %bb44, %bb15
+ %t17 = phi i64 [ %t46, %bb44 ], [ 0, %bb15 ], !dbg !40
+ %t18 = phi i32 [ %t45, %bb44 ], [ %t7, %bb15 ], !dbg !41
+ %t19 = icmp sgt i64 %arg1, 0, !dbg !42
+ br i1 %t19, label %bb20, label %bb44, !dbg !43
+
+bb20: ; preds = %bb16
+ br label %bb21, !dbg !44
+
+bb21: ; preds = %bb21, %bb20
+ %t25 = mul i64 %t13, %arg1, !dbg !45
+ %t42 = icmp slt i64 %t25, %arg1, !dbg !46
+ br i1 %t42, label %bb21, label %bb43, !dbg !47
+
+bb43: ; preds = %bb21
+ br label %bb44, !dbg !48
+
+bb44: ; preds = %bb43, %bb16
+ %t45 = phi i32 [ %t18, %bb16 ], [ 0, %bb43 ], !dbg !49
+ %t46 = add nsw i64 %t17, 1, !dbg !50
+ %t47 = icmp slt i64 %t46, %arg1, !dbg !51
+ br i1 %t47, label %bb16, label %bb48, !dbg !52
+
+bb48: ; preds = %bb44
+ br label %bb49, !dbg !53
+
+bb49: ; preds = %bb48, %bb5
+ %t50 = phi i32 [ %t7, %bb5 ], [ %t45, %bb48 ], !dbg !54
+ %t51 = add nsw i64 %t6, 1, !dbg !55
+ %t52 = icmp slt i64 %t51, %arg1, !dbg !56
+ br i1 %t52, label %bb5, label %bb53, !dbg !57
+
+bb53: ; preds = %bb49
+ br label %bb54, !dbg !58
+
+bb54: ; preds = %bb53, %bb
+ %t55 = phi i32 [ 0, %bb ], [ %t50, %bb53 ], !dbg !59
+ ret i32 %t55, !dbg !60
+}
+
+attributes #0 = { nounwind }
+
+!llvm.dbg.cu = !{!0}
+!llvm.debugify = !{!2, !3}
+!llvm.module.flags = !{!4}
+
+;.
+; CHECK: [[DBG10]] = !DILocation(line: 3,
+; CHECK: [[DBG21]] = !DILocation(line: 13,
+; CHECK: [[DBG36]] = !DILocation(line: 27,
+;.
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
+!1 = !DIFile(filename: "indvars.ll", directory: "/")
+!2 = !{i32 51}
+!3 = !{i32 0}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = distinct !DISubprogram(name: "test_srem_urem", linkageName: "test_srem_urem", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
+!6 = !DISubroutineType(types: !7)
+!7 = !{}
+!8 = !DILocation(line: 1, column: 1, scope: !5)
+!9 = !DILocation(line: 2, column: 1, scope: !5)
+!10 = !DILocation(line: 3, column: 1, scope: !5)
+!11 = !DILocation(line: 4, column: 1, scope: !5)
+!12 = !DILocation(line: 5, column: 1, scope: !5)
+!13 = !DILocation(line: 6, column: 1, scope: !5)
+!14 = !DILocation(line: 7, column: 1, scope: !5)
+!15 = !DILocation(line: 8, column: 1, scope: !5)
+!16 = !DILocation(line: 9, column: 1, scope: !5)
+!17 = !DILocation(line: 10, column: 1, scope: !5)
+!18 = distinct !DISubprogram(name: "test_sdiv_udiv", linkageName: "test_sdiv_udiv", scope: null, file: !1, line: 11, type: !6, scopeLine: 11, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
+!19 = !DILocation(line: 11, column: 1, scope: !18)
+!20 = !DILocation(line: 12, column: 1, scope: !18)
+!21 = !DILocation(line: 13, column: 1, scope: !18)
+!22 = !DILocation(line: 14, column: 1, scope: !18)
+!23 = !DILocation(line: 15, column: 1, scope: !18)
+!24 = !DILocation(line: 16, column: 1, scope: !18)
+!25 = !DILocation(line: 17, column: 1, scope: !18)
+!26 = !DILocation(line: 18, column: 1, scope: !18)
+!27 = !DILocation(line: 19, column: 1, scope: !18)
+!28 = !DILocation(line: 20, column: 1, scope: !18)
+!29 = distinct !DISubprogram(name: "test_rem_num_zero", linkageName: "test_rem_num_zero", scope: null, file: !1, line: 21, type: !6, scopeLine: 21, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
+!30 = !DILocation(line: 21, column: 1, scope: !29)
+!31 = !DILocation(line: 22, column: 1, scope: !29)
+!32 = !DILocation(line: 23, column: 1, scope: !29)
+!33 = !DILocation(line: 24, column: 1, scope: !29)
+!34 = !DILocation(line: 25, column: 1, scope: !29)
+!35 = !DILocation(line: 26, column: 1, scope: !29)
+!36 = !DILocation(line: 27, column: 1, scope: !29)
+!37 = !DILocation(line: 28, column: 1, scope: !29)
+!38 = !DILocation(line: 29, column: 1, scope: !29)
+!39 = !DILocation(line: 30, column: 1, scope: !29)
+!40 = !DILocation(line: 31, column: 1, scope: !29)
+!41 = !DILocation(line: 32, column: 1, scope: !29)
+!42 = !DILocation(line: 33, column: 1, scope: !29)
+!43 = !DILocation(line: 34, column: 1, scope: !29)
+!44 = !DILocation(line: 35, column: 1, scope: !29)
+!45 = !DILocation(line: 36, column: 1, scope: !29)
+!46 = !DILocation(line: 37, column: 1, scope: !29)
+!47 = !DILocation(line: 38, column: 1, scope: !29)
+!48 = !DILocation(line: 39, column: 1, scope: !29)
+!49 = !DILocation(line: 40, column: 1, scope: !29)
+!50 = !DILocation(line: 41, column: 1, scope: !29)
+!51 = !DILocation(line: 42, column: 1, scope: !29)
+!52 = !DILocation(line: 43, column: 1, scope: !29)
+!53 = !DILocation(line: 44, column: 1, scope: !29)
+!54 = !DILocation(line: 45, column: 1, scope: !29)
+!55 = !DILocation(line: 46, column: 1, scope: !29)
+!56 = !DILocation(line: 47, column: 1, scope: !29)
+!57 = !DILocation(line: 48, column: 1, scope: !29)
+!58 = !DILocation(line: 49, column: 1, scope: !29)
+!59 = !DILocation(line: 50, column: 1, scope: !29)
+!60 = !DILocation(line: 51, column: 1, scope: !29)
diff --git a/llvm/test/Transforms/Inline/always-inline-phase-ordering.ll b/llvm/test/Transforms/Inline/always-inline-phase-ordering.ll
index e69ca48..defd1f4 100644
--- a/llvm/test/Transforms/Inline/always-inline-phase-ordering.ll
+++ b/llvm/test/Transforms/Inline/always-inline-phase-ordering.ll
@@ -6,7 +6,6 @@ target triple = "arm64e-apple-macosx13"
; CHECK: remark: <unknown>:0:0: 'wibble' inlined into 'pluto' with (cost=always): always inline attribute
; CHECK: remark: <unknown>:0:0: 'snork' inlined into 'blam' with (cost=always): always inline attribute
; CHECK: remark: <unknown>:0:0: 'wobble' inlined into 'blam' with (cost=always): always inline attribute
-; CHECK: remark: <unknown>:0:0: 'wobble' inlined into 'snork' with (cost=always): always inline attribute
; CHECK: remark: <unknown>:0:0: 'spam' inlined into 'blam' with (cost=65, threshold=75)
; CHECK: remark: <unknown>:0:0: 'wibble.1' inlined into 'widget' with (cost=30, threshold=75)
; CHECK: remark: <unknown>:0:0: 'widget' inlined into 'bar.8' with (cost=30, threshold=75)
diff --git a/llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-comb-no-active-lanes-stores.ll b/llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-comb-no-active-lanes-stores.ll
new file mode 100644
index 0000000..5908dd1
--- /dev/null
+++ b/llvm/test/Transforms/InstCombine/AArch64/sve-intrinsic-comb-no-active-lanes-stores.ll
@@ -0,0 +1,310 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+;RUN: opt -S -passes=instcombine < %s | FileCheck %s
+target triple = "aarch64-unknown-linux-gnu"
+
+define void @test_st1(ptr %a, <vscale x 16 x i8> %b) {
+; CHECK-LABEL: define void @test_st1(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 16 x i8> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1.nxv16i8(<vscale x 16 x i8> %b, <vscale x 16 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st1_scatter(<vscale x 2 x i16> %data_trunc, ptr %base, <vscale x 2 x i64> %b) {
+; CHECK-LABEL: define void @test_st1_scatter(
+; CHECK-SAME: <vscale x 2 x i16> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1.scatter.nxv2i16(<vscale x 2 x i16> %data_trunc,
+ <vscale x 2 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 2 x i64> %b)
+ ret void
+}
+
+define void @test_st1_scatter_index(<vscale x 2 x i32> %data_trunc, ptr %base, <vscale x 2 x i64> %offsets) {
+; CHECK-LABEL: define void @test_st1_scatter_index(
+; CHECK-SAME: <vscale x 2 x i32> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[OFFSETS:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: call void @llvm.aarch64.sve.st1.scatter.index.nxv2i32(<vscale x 2 x i32> [[DATA_TRUNC]], <vscale x 2 x i1> zeroinitializer, ptr [[BASE]], <vscale x 2 x i64> [[OFFSETS]])
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1.scatter.index.nxv2i32(<vscale x 2 x i32> %data_trunc,
+ <vscale x 2 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 2 x i64> %offsets)
+ ret void
+}
+
+define void @test_st1_scatter_scalar_offset(<vscale x 4 x i8> %data_trunc, <vscale x 4 x i32> %base) {
+; CHECK-LABEL: define void @test_st1_scatter_scalar_offset(
+; CHECK-SAME: <vscale x 4 x i8> [[DATA_TRUNC:%.*]], <vscale x 4 x i32> [[BASE:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1.scatter.scalar.offset.nxv4i8.nxv4i32(<vscale x 4 x i8> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ <vscale x 4 x i32> %base,
+ i64 16)
+ ret void
+}
+
+define void @test_st1_scatter_sxtw(<vscale x 4 x i8> %data_trunc, ptr %base, <vscale x 4 x i32> %offsets) {
+; CHECK-LABEL: define void @test_st1_scatter_sxtw(
+; CHECK-SAME: <vscale x 4 x i8> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 4 x i32> [[OFFSETS:%.*]]) {
+; CHECK-NEXT: ret void
+;
+ call void @llvm.aarch64.sve.st1.scatter.sxtw.nxv4i8(<vscale x 4 x i8> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 4 x i32> %offsets)
+ ret void
+}
+
+define void @test_st1_scatter_sxtw_index(<vscale x 4 x i16> %data_trunc, ptr %base, <vscale x 4 x i32> %indices) {
+; CHECK-LABEL: define void @test_st1_scatter_sxtw_index(
+; CHECK-SAME: <vscale x 4 x i16> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 4 x i32> [[INDICES:%.*]]) {
+; CHECK-NEXT: ret void
+;
+ call void @llvm.aarch64.sve.st1.scatter.sxtw.index.nxv4i16(<vscale x 4 x i16> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 4 x i32> %indices)
+ ret void
+}
+
+define void @test_st1_scatter_uxtw(<vscale x 4 x i8> %data_trunc, ptr %base, <vscale x 4 x i32> %offsets) {
+; CHECK-LABEL: define void @test_st1_scatter_uxtw(
+; CHECK-SAME: <vscale x 4 x i8> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 4 x i32> [[OFFSETS:%.*]]) {
+; CHECK-NEXT: ret void
+;
+ call void @llvm.aarch64.sve.st1.scatter.uxtw.nxv4i8(<vscale x 4 x i8> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 4 x i32> %offsets)
+ ret void
+}
+
+define void @test_st1_scatter_uxtw_index(<vscale x 4 x i16> %data_trunc, ptr %base, <vscale x 4 x i32> %indices) {
+; CHECK-LABEL: define void @test_st1_scatter_uxtw_index(
+; CHECK-SAME: <vscale x 4 x i16> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 4 x i32> [[INDICES:%.*]]) {
+; CHECK-NEXT: ret void
+;
+ call void @llvm.aarch64.sve.st1.scatter.uxtw.index.nxv4i16(<vscale x 4 x i16> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 4 x i32> %indices)
+ ret void
+}
+
+define void @test_st1dq(<vscale x 2 x i64> %zt, ptr %gep1) {
+; CHECK-LABEL: define void @test_st1dq(
+; CHECK-SAME: <vscale x 2 x i64> [[ZT:%.*]], ptr [[GEP1:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1dq.nxv2i64(<vscale x 2 x i64> %zt, <vscale x 1 x i1> zeroinitializer, ptr %gep1)
+ ret void
+}
+
+define void @test_st1q_scatter_index(<vscale x 8 x i16> %data, <vscale x 1 x i1> %pg, ptr %base, <vscale x 2 x i64> %idx) {
+; CHECK-LABEL: define void @test_st1q_scatter_index(
+; CHECK-SAME: <vscale x 8 x i16> [[DATA:%.*]], <vscale x 1 x i1> [[PG:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[IDX:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1q.scatter.index.nxv8i16(<vscale x 8 x i16> %data, <vscale x 1 x i1> zeroinitializer, ptr %base, <vscale x 2 x i64> %idx)
+ ret void
+}
+
+define void @test_st1q_scatter_scalar_offset(<vscale x 2 x i64> %data, <vscale x 2 x i64> %base) {
+; CHECK-LABEL: define void @test_st1q_scatter_scalar_offset(
+; CHECK-SAME: <vscale x 2 x i64> [[DATA:%.*]], <vscale x 2 x i64> [[BASE:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1q.scatter.scalar.offset.nxv2i64.nxv2i64(<vscale x 2 x i64> %data, <vscale x 1 x i1> zeroinitializer, <vscale x 2 x i64> %base, i64 0)
+ ret void
+}
+
+define void @test_st1q_scatter_vector_offset(<vscale x 8 x i16> %data, ptr %base, <vscale x 2 x i64> %off) {
+; CHECK-LABEL: define void @test_st1q_scatter_vector_offset(
+; CHECK-SAME: <vscale x 8 x i16> [[DATA:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[OFF:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1q.scatter.vector.offset.nxv8i16(<vscale x 8 x i16> %data, <vscale x 1 x i1> zeroinitializer, ptr %base, <vscale x 2 x i64> %off)
+ ret void
+}
+
+define void @test_st1wq(ptr %a, <vscale x 4 x i32> %b) {
+; CHECK-LABEL: define void @test_st1wq(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 4 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.st1wq.nxv4i32(<vscale x 4 x i32> %b, <vscale x 1 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+
+define void @test_st2(ptr %a, <vscale x 8 x i32> %b) {
+; CHECK-LABEL: define void @test_st2(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 8 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %b, i64 4)
+ tail call void @llvm.aarch64.sve.st2.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st2q(ptr %a, <vscale x 8 x i32> %b) {
+; CHECK-LABEL: define void @test_st2q(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 8 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %b, i64 4)
+ tail call void @llvm.aarch64.sve.st2q.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st3(ptr %a, <vscale x 12 x i32> %b) {
+; CHECK-LABEL: define void @test_st3(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 12 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 4)
+ %2 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 8)
+ tail call void @llvm.aarch64.sve.st3.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i32> %2, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st3q(ptr %a, <vscale x 12 x i32> %b) {
+; CHECK-LABEL: define void @test_st3q(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 12 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 4)
+ %2 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv12i32(<vscale x 12 x i32> %b, i64 8)
+ tail call void @llvm.aarch64.sve.st3q.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i32> %2, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st4(ptr %a, <vscale x 16 x i32> %b) {
+; CHECK-LABEL: define void @test_st4(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 16 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 4)
+ %2 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 8)
+ %3 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 12)
+ tail call void @llvm.aarch64.sve.st4.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i32> %2, <vscale x 4 x i32> %3, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_st4q(ptr %a, <vscale x 16 x i32> %b) {
+; CHECK-LABEL: define void @test_st4q(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 16 x i32> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ %0 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 0)
+ %1 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 4)
+ %2 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 8)
+ %3 = tail call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %b, i64 12)
+ tail call void @llvm.aarch64.sve.st4q.nxv4i32(<vscale x 4 x i32> %0, <vscale x 4 x i32> %1, <vscale x 4 x i32> %2, <vscale x 4 x i32> %3, <vscale x 4 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_stnt1(ptr %a, <vscale x 16 x i8> %b) {
+; CHECK-LABEL: define void @test_stnt1(
+; CHECK-SAME: ptr [[A:%.*]], <vscale x 16 x i8> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.stnt1.nxv16i8(<vscale x 16 x i8> %b, <vscale x 16 x i1> zeroinitializer, ptr %a)
+ ret void
+}
+
+define void @test_stnt1_scatter(<vscale x 2 x i16> %data_trunc, ptr %base, <vscale x 2 x i64> %b) {
+; CHECK-LABEL: define void @test_stnt1_scatter(
+; CHECK-SAME: <vscale x 2 x i16> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[B:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.stnt1.scatter.nxv2i16(<vscale x 2 x i16> %data_trunc,
+ <vscale x 2 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 2 x i64> %b)
+ ret void
+}
+
+define void @test_stnt1_scatter_index(<vscale x 2 x i32> %data_trunc, ptr %base, <vscale x 2 x i64> %offsets) {
+; CHECK-LABEL: define void @test_stnt1_scatter_index(
+; CHECK-SAME: <vscale x 2 x i32> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 2 x i64> [[OFFSETS:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.stnt1.scatter.index.nxv2i32(<vscale x 2 x i32> %data_trunc,
+ <vscale x 2 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 2 x i64> %offsets)
+ ret void
+}
+
+define void @test_stnt1_scatter_scalar_offset(<vscale x 4 x i8> %data_trunc, <vscale x 4 x i32> %base) {
+; CHECK-LABEL: define void @test_stnt1_scatter_scalar_offset(
+; CHECK-SAME: <vscale x 4 x i8> [[DATA_TRUNC:%.*]], <vscale x 4 x i32> [[BASE:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: ret void
+;
+entry:
+ call void @llvm.aarch64.sve.stnt1.scatter.scalar.offset.nxv4i8.nxv4i32(<vscale x 4 x i8> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ <vscale x 4 x i32> %base,
+ i64 16)
+ ret void
+}
+
+define void @test_stnt1_scatter_uxtw(<vscale x 4 x i8> %data_trunc, ptr %base, <vscale x 4 x i32> %offsets) {
+; CHECK-LABEL: define void @test_stnt1_scatter_uxtw(
+; CHECK-SAME: <vscale x 4 x i8> [[DATA_TRUNC:%.*]], ptr [[BASE:%.*]], <vscale x 4 x i32> [[OFFSETS:%.*]]) {
+; CHECK-NEXT: ret void
+;
+ call void @llvm.aarch64.sve.stnt1.scatter.uxtw.nxv4i8(<vscale x 4 x i8> %data_trunc,
+ <vscale x 4 x i1> zeroinitializer,
+ ptr %base,
+ <vscale x 4 x i32> %offsets)
+ ret void
+}
diff --git a/llvm/test/Transforms/InstCombine/known-bits.ll b/llvm/test/Transforms/InstCombine/known-bits.ll
index d7a8386..c7445a6 100644
--- a/llvm/test/Transforms/InstCombine/known-bits.ll
+++ b/llvm/test/Transforms/InstCombine/known-bits.ll
@@ -2025,6 +2025,34 @@ define i8 @simplifydemanded_context(i8 %x, i8 %y) {
ret i8 %and2
}
+define i16 @pr97330(i1 %c, ptr %p1, ptr %p2) {
+; CHECK-LABEL: @pr97330(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[EXIT:%.*]], label [[IF:%.*]]
+; CHECK: if:
+; CHECK-NEXT: unreachable
+; CHECK: exit:
+; CHECK-NEXT: [[V:%.*]] = load i64, ptr [[P1:%.*]], align 8
+; CHECK-NEXT: [[CONV:%.*]] = trunc i64 [[V]] to i16
+; CHECK-NEXT: ret i16 [[CONV]]
+;
+entry:
+ %v = load i64, ptr %p1, align 8
+ %conv = trunc i64 %v to i16
+ br i1 %c, label %exit, label %if
+
+if:
+ %cmp = icmp ne i16 %conv, 1
+ %conv2 = zext i1 %cmp to i32
+ store i32 %conv2, ptr %p2, align 4
+ %cmp2 = icmp eq i64 %v, 1
+ call void @llvm.assume(i1 %cmp2)
+ unreachable
+
+exit:
+ ret i16 %conv
+}
+
declare void @dummy()
declare void @use(i1)
declare void @sink(i8)
diff --git a/llvm/test/Transforms/InstCombine/ldexp.ll b/llvm/test/Transforms/InstCombine/ldexp.ll
index 3ede7d9..7ae483c 100644
--- a/llvm/test/Transforms/InstCombine/ldexp.ll
+++ b/llvm/test/Transforms/InstCombine/ldexp.ll
@@ -870,7 +870,7 @@ define float @ldexp_2_flags(float %x) {
define float @ldexp_metadata(float %x) {
; CHECK-LABEL: define float @ldexp_metadata
; CHECK-SAME: (float [[X:%.*]]) {
-; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 2), !foo !2
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 2), !foo [[META2:![0-9]+]]
; CHECK-NEXT: ret float [[LDEXP]]
;
%ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 2), !foo !2
@@ -889,6 +889,132 @@ define float @ldexp_8_contractable(float %x, float %y) {
ret float %fadd
}
+define float @ldexp_f32_mask_select_0(i1 %cond, float %x, i32 %y) {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_0
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select i1 [[COND]], float [[TMP1]], float [[X]]
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 0
+ %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_nnan_f32_mask_select_0(i1 %cond, float %x, i32 %y) {
+; CHECK-LABEL: define float @ldexp_nnan_f32_mask_select_0
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call nnan float @llvm.ldexp.f32.i32(float [[X]], i32 [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select i1 [[COND]], float [[TMP1]], float [[X]]
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 0
+ %ldexp = call nnan float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_flags_f32_mask_select_0(i1 %cond, float %x, i32 %y) {
+; CHECK-LABEL: define float @ldexp_flags_f32_mask_select_0
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call ninf nsz float @llvm.ldexp.f32.i32(float [[X]], i32 [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select i1 [[COND]], float [[TMP1]], float [[X]]
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 0
+ %ldexp = call nsz ninf float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_f32_mask_select_0_swap(i1 %cond, float %x, i32 %y) {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_0_swap
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select i1 [[COND]], float [[X]], float [[TMP1]]
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 0, i32 %y
+ %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_f32_mask_select_1(i1 %cond, float %x, i32 %y) {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_1
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) {
+; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], i32 [[Y]], i32 1
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[SELECT]])
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 1
+ %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_f32_mask_select_0_multi_use(i1 %cond, float %x, i32 %y, ptr %ptr) {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_0_multi_use
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], i32 [[Y]], i32 0
+; CHECK-NEXT: store i32 [[SELECT]], ptr [[PTR]], align 4
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[SELECT]])
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 0
+ store i32 %select, ptr %ptr
+ %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_f32_mask_select_0_swap_multi_use(i1 %cond, float %x, i32 %y, ptr %ptr) {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_0_swap_multi_use
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]], ptr [[PTR:%.*]]) {
+; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], i32 0, i32 [[Y]]
+; CHECK-NEXT: store i32 [[SELECT]], ptr [[PTR]], align 4
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.ldexp.f32.i32(float [[X]], i32 [[SELECT]])
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 0, i32 %y
+ store i32 %select, ptr %ptr
+ %ldexp = call float @llvm.ldexp.f32.i32(float %x, i32 %select)
+ ret float %ldexp
+}
+
+define float @ldexp_f32_mask_select_0_strictfp(i1 %cond, float %x, i32 %y) #0 {
+; CHECK-LABEL: define float @ldexp_f32_mask_select_0_strictfp
+; CHECK-SAME: (i1 [[COND:%.*]], float [[X:%.*]], i32 [[Y:%.*]]) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: [[SELECT:%.*]] = select i1 [[COND]], i32 [[Y]], i32 0
+; CHECK-NEXT: [[LDEXP:%.*]] = call float @llvm.experimental.constrained.ldexp.f32.i32(float [[X]], i32 [[SELECT]], metadata !"round.dynamic", metadata !"fpexcept.strict")
+; CHECK-NEXT: ret float [[LDEXP]]
+;
+ %select = select i1 %cond, i32 %y, i32 0
+ %ldexp = call float @llvm.experimental.constrained.ldexp.f32.i32(float %x, i32 %select, metadata !"round.dynamic", metadata !"fpexcept.strict")
+ ret float %ldexp
+}
+
+define <2 x float> @ldexp_v2f32_mask_select_0(<2 x i1> %cond, <2 x float> %x, <2 x i32> %y) {
+; CHECK-LABEL: define <2 x float> @ldexp_v2f32_mask_select_0
+; CHECK-SAME: (<2 x i1> [[COND:%.*]], <2 x float> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call nnan nsz <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> [[X]], <2 x i32> [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select <2 x i1> [[COND]], <2 x float> [[TMP1]], <2 x float> [[X]]
+; CHECK-NEXT: ret <2 x float> [[LDEXP]]
+;
+ %select = select <2 x i1> %cond, <2 x i32> %y, <2 x i32> zeroinitializer
+ %ldexp = call nsz nnan <2 x float> @llvm.ldexp.f32.v2i32(<2 x float> %x, <2 x i32> %select)
+ ret <2 x float> %ldexp
+}
+
+define <2 x float> @ldexp_v2f32_mask_select_0_swap(<2 x i1> %cond, <2 x float> %x, <2 x i32> %y) {
+; CHECK-LABEL: define <2 x float> @ldexp_v2f32_mask_select_0_swap
+; CHECK-SAME: (<2 x i1> [[COND:%.*]], <2 x float> [[X:%.*]], <2 x i32> [[Y:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = call nnan nsz <2 x float> @llvm.ldexp.v2f32.v2i32(<2 x float> [[X]], <2 x i32> [[Y]])
+; CHECK-NEXT: [[LDEXP:%.*]] = select <2 x i1> [[COND]], <2 x float> [[X]], <2 x float> [[TMP1]]
+; CHECK-NEXT: ret <2 x float> [[LDEXP]]
+;
+ %select = select <2 x i1> %cond, <2 x i32> zeroinitializer, <2 x i32> %y
+ %ldexp = call nsz nnan <2 x float> @llvm.ldexp.f32.v2i32(<2 x float> %x, <2 x i32> %select)
+ ret <2 x float> %ldexp
+}
+
+attributes #0 = { strictfp }
+
!0 = !{i32 -127, i32 0}
!1 = !{i32 0, i32 127}
!2 = !{}
diff --git a/llvm/test/Transforms/PhaseOrdering/generate-fabs.ll b/llvm/test/Transforms/PhaseOrdering/generate-fabs.ll
new file mode 100644
index 0000000..25ac510
--- /dev/null
+++ b/llvm/test/Transforms/PhaseOrdering/generate-fabs.ll
@@ -0,0 +1,29 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -passes='default<O1>' -S < %s | FileCheck %s
+
+; Following test must generate fabs intrinsic. It goes through following stages
+; 1. SROA propagates the nsz function attribute on the phi node.
+; 2. SimplifyCFG pass converts phi node to select.
+; 3. InstCombine converts select with nsz flag into fabs intrinsic.
+
+define double @fabs_fcmp_olt_nsz_func_attr(double %0, double %1) "no-signed-zeros-fp-math"="true" {
+; CHECK-LABEL: define double @fabs_fcmp_olt_nsz_func_attr(
+; CHECK-SAME: double [[TMP0:%.*]], double [[TMP1:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[X_0:%.*]] = tail call nnan nsz double @llvm.fabs.f64(double [[TMP0]])
+; CHECK-NEXT: ret double [[X_0]]
+entry:
+ %x = alloca double
+ store double %0, ptr %x
+ %cmp = fcmp nnan nsz olt double %0, 0.000000e+00
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %fneg = fneg nnan nsz double %0
+ store double %fneg, ptr %x
+ br label %return
+
+return: ; preds = %entry, %if.then
+ %ret = load double, ptr %x
+ ret double %ret
+}
diff --git a/llvm/test/Transforms/SLPVectorizer/AArch64/uselistorder.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/uselistorder.ll
new file mode 100644
index 0000000..3a68a37
--- /dev/null
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/uselistorder.ll
@@ -0,0 +1,43 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=slp-vectorizer -S -pass-remarks-missed=slp-vectorizer 2>&1 | FileCheck %s
+
+target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
+target triple = "aarch64-unknown-linux-gnu"
+
+; This test has UB but the crash in #95016 only happens with it
+define void @uselistorder_test() {
+; CHECK-LABEL: @uselistorder_test(
+; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x double> poison, double 0.000000e+00, i32 0
+; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x double> [[TMP1]], double 0.000000e+00, i32 1
+; CHECK-NEXT: [[TMP3:%.*]] = fadd <2 x double> [[TMP2]], zeroinitializer
+; CHECK-NEXT: [[TMP4:%.*]] = fmul <2 x double> zeroinitializer, [[TMP3]]
+; CHECK-NEXT: [[TMP5:%.*]] = fmul <2 x double> [[TMP4]], zeroinitializer
+; CHECK-NEXT: [[TMP6:%.*]] = select <2 x i1> zeroinitializer, <2 x double> zeroinitializer, <2 x double> [[TMP5]]
+; CHECK-NEXT: [[TMP7:%.*]] = fmul <2 x double> [[TMP6]], zeroinitializer
+; CHECK-NEXT: [[TMP8:%.*]] = fadd <2 x double> [[TMP7]], zeroinitializer
+; CHECK-NEXT: store <2 x double> [[TMP8]], ptr null, align 8
+; CHECK-NEXT: ret void
+;
+ %max1 = call double @llvm.maximum.f64(double 0.000000e+00, double 0.000000e+00) [ "a_list"(ptr null) ]
+ %add1 = fadd double %max1, 0.000000e+00
+ %mul1 = fmul double 0.000000e+00, %add1
+ %mul2 = fmul double %mul1, 0.000000e+00
+ %sel1 = select i1 false, double 0.000000e+00, double %mul2
+ %max2 = call double @llvm.maximum.f64(double 0.000000e+00, double 0.000000e+00)
+ %add2 = fadd double %max2, 0.000000e+00
+ %mul3 = fmul double 0.000000e+00, %add2
+ %mul4 = fmul double %mul3, 0.000000e+00
+ %sel2 = select i1 false, double 0.000000e+00, double %mul4
+ %mul5 = fmul double %sel2, 0.000000e+00
+ %add3 = fadd double 0.000000e+00, %mul5
+ %gep1 = getelementptr { double, [1 x [2 x double]] }, ptr null, i64 0, i32 1
+ store double %add3, ptr %gep1, align 8
+ %mul6 = fmul double %sel1, 0.000000e+00
+ %add4 = fadd double %mul6, 0.000000e+00
+ store double %add4, ptr null, align 8
+ ret void
+}
+
+declare double @llvm.maximum.f64(double, double) #0
+
+attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
diff --git a/llvm/test/Transforms/SROA/propagate-fast-math-flags-on-phi.ll b/llvm/test/Transforms/SROA/propagate-fast-math-flags-on-phi.ll
new file mode 100644
index 0000000..2cc2636
--- /dev/null
+++ b/llvm/test/Transforms/SROA/propagate-fast-math-flags-on-phi.ll
@@ -0,0 +1,79 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt < %s -passes='sroa' -S | FileCheck %s
+define double @phi_with_nsz(double %x) "no-signed-zeros-fp-math"="true" {
+; CHECK-LABEL: define double @phi_with_nsz(
+; CHECK-SAME: double [[X:%.*]]) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt double [[X]], 0.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: [[FNEG:%.*]] = fneg double [[X]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi nsz double [ [[FNEG]], [[IF_THEN]] ], [ undef, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[X_ADDR_0]]
+entry:
+ %x.addr = alloca double
+ %cmp = fcmp olt double %x, 0.0
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %fneg = fneg double %x
+ store double %fneg, ptr %x.addr
+ br label %return
+
+return: ; preds = %entry,%if.then
+ %retval = load double, ptr %x.addr
+ ret double %retval
+}
+
+define <2 x double> @vector_phi_with_nsz(<2 x double> %x, i1 %cmp, <2 x double> %a, <2 x double> %b) "no-signed-zeros-fp-math"="true" {
+; CHECK-LABEL: define <2 x double> @vector_phi_with_nsz(
+; CHECK-SAME: <2 x double> [[X:%.*]], i1 [[CMP:%.*]], <2 x double> [[A:%.*]], <2 x double> [[B:%.*]]) #[[ATTR0]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi nsz <2 x double> [ [[B]], [[IF_THEN]] ], [ [[A]], [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret <2 x double> [[X_ADDR_0]]
+entry:
+ %x.addr = alloca <2 x double>
+ store <2 x double> %a, ptr %x.addr
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ store <2 x double> %b, ptr %x.addr
+ br label %return
+
+return: ; preds = %entry,%if.then
+ %retval = load <2 x double>, ptr %x.addr
+ ret <2 x double> %retval
+}
+
+define double @phi_without_nsz(double %x) "no-signed-zeros-fp-math"="false" {
+; CHECK-LABEL: define double @phi_without_nsz(
+; CHECK-SAME: double [[X:%.*]]) #[[ATTR1:[0-9]+]] {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt double [[X]], 0.000000e+00
+; CHECK-NEXT: br i1 [[CMP]], label [[IF_THEN:%.*]], label [[RETURN:%.*]]
+; CHECK: if.then:
+; CHECK-NEXT: [[FNEG:%.*]] = fneg double [[X]]
+; CHECK-NEXT: br label [[RETURN]]
+; CHECK: return:
+; CHECK-NEXT: [[X_ADDR_0:%.*]] = phi double [ [[FNEG]], [[IF_THEN]] ], [ undef, [[ENTRY:%.*]] ]
+; CHECK-NEXT: ret double [[X_ADDR_0]]
+entry:
+ %x.addr = alloca double
+ %cmp = fcmp olt double %x, 0.0
+ br i1 %cmp, label %if.then, label %return
+
+if.then: ; preds = %entry
+ %fneg = fneg double %x
+ store double %fneg, ptr %x.addr
+ br label %return
+
+return: ; preds = %entry,%if.then
+ %retval = load double, ptr %x.addr
+ ret double %retval
+}
diff --git a/llvm/tools/dsymutil/MachOUtils.cpp b/llvm/tools/dsymutil/MachOUtils.cpp
index fba6630..d2bdcf8 100644
--- a/llvm/tools/dsymutil/MachOUtils.cpp
+++ b/llvm/tools/dsymutil/MachOUtils.cpp
@@ -12,7 +12,6 @@
#include "LinkUtils.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/CodeGen/NonRelocatableStringpool.h"
-#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCMachObjectWriter.h"
#include "llvm/MC/MCObjectStreamer.h"
@@ -381,8 +380,7 @@ bool generateDsymCompanion(
auto &Writer = static_cast<MachObjectWriter &>(MCAsm.getWriter());
// Layout but don't emit.
- MCAsmLayout Layout(MCAsm);
- MCAsm.layout(Layout);
+ MCAsm.layout();
BinaryHolder InputBinaryHolder(VFS, false);
diff --git a/llvm/utils/gn/secondary/lldb/source/Commands/BUILD.gn b/llvm/utils/gn/secondary/lldb/source/Commands/BUILD.gn
index f19f948..164ee90 100644
--- a/llvm/utils/gn/secondary/lldb/source/Commands/BUILD.gn
+++ b/llvm/utils/gn/secondary/lldb/source/Commands/BUILD.gn
@@ -52,7 +52,7 @@ static_library("Commands") {
"CommandObjectQuit.cpp",
"CommandObjectRegexCommand.cpp",
"CommandObjectRegister.cpp",
- "CommandObjectScript.cpp",
+ "CommandObjectScripting.cpp",
"CommandObjectSession.cpp",
"CommandObjectSettings.cpp",
"CommandObjectSource.cpp",
diff --git a/llvm/utils/gn/secondary/llvm/lib/SandboxIR/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/SandboxIR/BUILD.gn
new file mode 100644
index 0000000..4650741
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/lib/SandboxIR/BUILD.gn
@@ -0,0 +1,8 @@
+static_library("SandboxIR") {
+ output_name = "LLVMSandboxIR"
+ deps = [
+ "//llvm/lib/IR",
+ "//llvm/lib/Support",
+ ]
+ sources = [ "SandboxIR.cpp" ]
+}
diff --git a/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
index 30e49ff..92c6329 100644
--- a/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/unittests/BUILD.gn
@@ -43,6 +43,7 @@ group("unittests") {
"Passes/Plugins:PluginsTests",
"ProfileData:ProfileDataTests",
"Remarks:RemarksTests",
+ "SandboxIR:SandboxIRTests",
"Support:SupportTests",
"Support/DynamicLibrary:DynamicLibraryTests",
"TableGen:TableGenTests",
diff --git a/llvm/utils/gn/secondary/llvm/unittests/SandboxIR/BUILD.gn b/llvm/utils/gn/secondary/llvm/unittests/SandboxIR/BUILD.gn
new file mode 100644
index 0000000..d7164f2
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/unittests/SandboxIR/BUILD.gn
@@ -0,0 +1,10 @@
+import("//third-party/unittest/unittest.gni")
+
+unittest("SandboxIRTests") {
+ deps = [
+ "//llvm/lib/AsmParser",
+ "//llvm/lib/IR",
+ "//llvm/lib/SandboxIR",
+ ]
+ sources = [ "SandboxIRTest.cpp" ]
+}
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index f030798..7b91f43 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -565,8 +565,6 @@ function(add_mlir_python_sources_target name)
message(FATAL_ERROR "Unhandled arguments to add_mlir_python_sources_target(${name}, ... : ${ARG_UNPARSED_ARGUMENTS}")
endif()
- add_custom_target(${name})
-
# On Windows create_symlink requires special permissions. Use copy_if_different instead.
if(CMAKE_HOST_WIN32)
set(_link_or_copy copy_if_different)
@@ -575,8 +573,6 @@ function(add_mlir_python_sources_target name)
endif()
foreach(_sources_target ${ARG_SOURCES_TARGETS})
- add_dependencies(${name} ${_sources_target})
-
get_target_property(_src_paths ${_sources_target} SOURCES)
if(NOT _src_paths)
get_target_property(_src_paths ${_sources_target} INTERFACE_SOURCES)
@@ -590,6 +586,8 @@ function(add_mlir_python_sources_target name)
get_target_property(_root_dir ${_sources_target} INTERFACE_INCLUDE_DIRECTORIES)
endif()
+ # Initialize an empty list of all Python source destination paths.
+ set(all_dest_paths "")
foreach(_src_path ${_src_paths})
file(RELATIVE_PATH _source_relative_path "${_root_dir}" "${_src_path}")
set(_dest_path "${ARG_OUTPUT_DIRECTORY}/${_source_relative_path}")
@@ -598,13 +596,17 @@ function(add_mlir_python_sources_target name)
file(MAKE_DIRECTORY "${_dest_dir}")
add_custom_command(
- TARGET ${name} PRE_BUILD
+ OUTPUT "${_dest_path}"
+ PRE_BUILD
COMMENT "Copying python source ${_src_path} -> ${_dest_path}"
DEPENDS "${_src_path}"
- BYPRODUCTS "${_dest_path}"
COMMAND "${CMAKE_COMMAND}" -E ${_link_or_copy}
"${_src_path}" "${_dest_path}"
)
+
+ # Track the symlink or copy command output.
+ list(APPEND all_dest_paths "${_dest_path}")
+
if(ARG_INSTALL_DIR)
# We have to install each file individually because we need to preserve
# the relative directory structure in the install destination.
@@ -621,6 +623,9 @@ function(add_mlir_python_sources_target name)
endif()
endforeach()
endforeach()
+
+ # Create a new custom target that depends on all symlinked or copied sources.
+ add_custom_target("${name}" DEPENDS ${all_dest_paths})
endfunction()
################################################################################
diff --git a/mlir/docs/PDLL.md b/mlir/docs/PDLL.md
index 340940f..f565115 100644
--- a/mlir/docs/PDLL.md
+++ b/mlir/docs/PDLL.md
@@ -277,7 +277,7 @@ Pattern {
// * Match Section
// - Describes the input IR.
let root = op<toy.reshape>(op<toy.reshape>(arg: Value));
-
+
// * Rewrite Section
// - Describes how to transform the IR.
// - Last statement starts the rewrite.
@@ -1009,7 +1009,7 @@ Pattern {
// Return a tuple of values.
let result = ExtractMultipleResults(op: op<my_dialect.foo>);
- // Index the tuple elements by index, or by name.
+ // Index the tuple elements by index, or by name.
replace op<my_dialect.foo> with (result.0, result.1, result.result1);
}
```
@@ -1150,7 +1150,7 @@ same name. See the ["type translation"](#native-constraint-type-translations) be
detailed information on how PDLL types are converted to native types. In addition to the
PDLL arguments, the code block may also access the current `PatternRewriter` using
`rewriter`. The result type of the native constraint function is implicitly defined
-as a `::mlir::LogicalResult`.
+as a `::llvm::LogicalResult`.
Taking the constraints defined above as an example, these function would roughly be
translated into:
@@ -1220,7 +1220,7 @@ was imported:
* `Attr` constraints
- Imported `Attr` constraints utilize the `storageType` field for native type translation.
-
+
* `Type` constraints
- Imported `Type` constraints utilize the `cppClassName` field for native type translation.
@@ -1310,7 +1310,7 @@ Pattern {
// A pattern that replaces the root operation with another operation.
// Note that when an operation is used as the replacement, we can infer its
// result types from the input operation. In these cases, the result
-// types of replacement operation may be elided.
+// types of replacement operation may be elided.
Pattern {
// Note: In this pattern we also inlined the `root` expression.
replace op<my_dialect.foo> with op<my_dialect.bar>;
@@ -1385,7 +1385,7 @@ Pattern {
// Invoke the rewrite, which returns a tuple of values.
let result = CreateRewriteOps();
- // Index the tuple elements by index, or by name.
+ // Index the tuple elements by index, or by name.
replace root with (result.0, result.1, result.result1);
}
}
@@ -1466,7 +1466,7 @@ the C++ PDL API. For example, the rewrite above may be registered as:
```c++
static Operation *buildOpImpl(PDLResultList &results, Value value) {
// insert special rewrite logic here.
- Operation *resultOp = ...;
+ Operation *resultOp = ...;
return resultOp;
}
diff --git a/mlir/docs/Tutorials/Toy/Ch-2.md b/mlir/docs/Tutorials/Toy/Ch-2.md
index 6801369..b807ee3 100644
--- a/mlir/docs/Tutorials/Toy/Ch-2.md
+++ b/mlir/docs/Tutorials/Toy/Ch-2.md
@@ -243,7 +243,7 @@ operation. This operation will represent a constant value in the Toy language.
This operation takes zero operands, a
[dense elements](../../Dialects/Builtin.md/#denseintorfpelementsattr) attribute named
`value` to represent the constant value, and returns a single result of
-[RankedTensorType](../../Dialects/Builtin.md/#rankedtensortype). An operation class
+[RankedTensorType](../../Dialects/Builtin.md/#rankedtensortype). An operation class
inherits from the [CRTP](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)
`mlir::Op` class which also takes some optional [*traits*](../../Traits) to
customize its behavior. `Traits` are a mechanism with which we can inject
@@ -497,10 +497,10 @@ def ConstantOp : Toy_Op<"constant"> {
let results = (outs F64Tensor);
// Add additional verification logic to the constant operation. Setting this bit
- // to `1` will generate a `::mlir::LogicalResult verify()` declaration on the
+ // to `1` will generate a `::llvm::LogicalResult verify()` declaration on the
// operation class that is called after ODS constructs have been verified, for
// example the types of arguments and results. We implement additional verification
- // in the definition of this `verify` method in the C++ source file.
+ // in the definition of this `verify` method in the C++ source file.
let hasVerifier = 1;
}
```
diff --git a/mlir/docs/Tutorials/Toy/Ch-3.md b/mlir/docs/Tutorials/Toy/Ch-3.md
index ac38cbe..4cde64d 100644
--- a/mlir/docs/Tutorials/Toy/Ch-3.md
+++ b/mlir/docs/Tutorials/Toy/Ch-3.md
@@ -86,7 +86,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method is attempting to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. It is expected
/// to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
@@ -128,7 +128,7 @@ similar way to LLVM:
pm.addNestedPass<mlir::toy::FuncOp>(mlir::createCanonicalizerPass());
```
-Finally, we can run `toyc-ch3 test/Examples/Toy/Ch3/transpose_transpose.toy
+Finally, we can run `toyc-ch3 test/Examples/Toy/Ch3/transpose_transpose.toy
-emit=mlir -opt` and observe our pattern in action:
```mlir
@@ -239,7 +239,7 @@ module {
}
```
-We can try to run `toyc-ch3 test/Examples/Toy/Ch3/trivial_reshape.toy -emit=mlir
+We can try to run `toyc-ch3 test/Examples/Toy/Ch3/trivial_reshape.toy -emit=mlir
-opt` and observe our pattern in action:
```mlir
diff --git a/mlir/docs/Tutorials/Toy/Ch-5.md b/mlir/docs/Tutorials/Toy/Ch-5.md
index 6fe0080..7d4f95e 100644
--- a/mlir/docs/Tutorials/Toy/Ch-5.md
+++ b/mlir/docs/Tutorials/Toy/Ch-5.md
@@ -113,7 +113,7 @@ struct TransposeOpLowering : public mlir::ConversionPattern {
/// Match and rewrite the given `toy.transpose` operation, with the given
/// operands that have been remapped from `tensor<...>` to `memref<...>`.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(mlir::Operation *op, ArrayRef<mlir::Value> operands,
mlir::ConversionPatternRewriter &rewriter) const final {
auto loc = op->getLoc();
diff --git a/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp b/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp
index a23d042..8166aa2 100644
--- a/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp
+++ b/mlir/examples/standalone/lib/Standalone/StandalonePasses.cpp
@@ -8,7 +8,6 @@
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "Standalone/StandalonePasses.h"
diff --git a/mlir/examples/standalone/standalone-translate/standalone-translate.cpp b/mlir/examples/standalone/standalone-translate/standalone-translate.cpp
index a4da328..46b9c77 100644
--- a/mlir/examples/standalone/standalone-translate/standalone-translate.cpp
+++ b/mlir/examples/standalone/standalone-translate/standalone-translate.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/DialectRegistry.h"
#include "mlir/IR/Operation.h"
#include "mlir/InitAllTranslations.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
#include "mlir/Tools/mlir-translate/Translation.h"
#include "llvm/Support/raw_ostream.h"
@@ -27,7 +26,7 @@ int main(int argc, char **argv) {
mlir::TranslateFromMLIRRegistration withdescription(
"option", "different from option",
[](mlir::Operation *op, llvm::raw_ostream &output) {
- return mlir::LogicalResult::success();
+ return llvm::LogicalResult::success();
},
[](mlir::DialectRegistry &a) {});
diff --git a/mlir/examples/toy/Ch2/mlir/Dialect.cpp b/mlir/examples/toy/Ch2/mlir/Dialect.cpp
index d35bd9f..489f348 100644
--- a/mlir/examples/toy/Ch2/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch2/mlir/Dialect.cpp
@@ -22,7 +22,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -142,7 +141,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
/// Verifier for the constant operation. This corresponds to the
/// `let hasVerifier = 1` in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
// If the return type of the constant is not an unranked tensor, the shape
// must match the shape of the attribute holding the data.
auto resultType = llvm::dyn_cast<mlir::RankedTensorType>(getResult().getType());
@@ -257,7 +256,7 @@ void MulOp::print(mlir::OpAsmPrinter &p) { printBinaryOp(p, *this); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -300,7 +299,7 @@ void TransposeOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
state.addOperands(value);
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
index 2f0a88f..bf4c099 100644
--- a/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch2/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -105,7 +104,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
+ llvm::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
if (symbolTable.count(var))
return mlir::failure();
symbolTable.insert(var, value);
@@ -225,7 +224,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -337,7 +336,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -403,7 +402,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
ScopedHashTableScope<StringRef, mlir::Value> varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch3/mlir/Dialect.cpp b/mlir/examples/toy/Ch3/mlir/Dialect.cpp
index 79d82e5..708855f 100644
--- a/mlir/examples/toy/Ch3/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch3/mlir/Dialect.cpp
@@ -22,7 +22,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
@@ -142,7 +141,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
/// Verifier for the constant operation. This corresponds to the
/// `let hasVerifier = 1` in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
// If the return type of the constant is not an unranked tensor, the shape
// must match the shape of the attribute holding the data.
auto resultType = llvm::dyn_cast<mlir::RankedTensorType>(getResult().getType());
@@ -257,7 +256,7 @@ void MulOp::print(mlir::OpAsmPrinter &p) { printBinaryOp(p, *this); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -300,7 +299,7 @@ void TransposeOp::build(mlir::OpBuilder &builder, mlir::OperationState &state,
state.addOperands(value);
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
index 2f0a88f..bf4c099 100644
--- a/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch3/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -105,7 +104,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
+ llvm::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
if (symbolTable.count(var))
return mlir::failure();
symbolTable.insert(var, value);
@@ -225,7 +224,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -337,7 +336,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -403,7 +402,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
ScopedHashTableScope<StringRef, mlir::Value> varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp
index 3ce35c8..f8397c2 100644
--- a/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch3/mlir/ToyCombine.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/Dialect.h"
using namespace mlir;
using namespace toy;
@@ -36,7 +35,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method attempts to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. The pattern is
/// expected to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
diff --git a/mlir/examples/toy/Ch3/toyc.cpp b/mlir/examples/toy/Ch3/toyc.cpp
index c2c5f1f..f8aa846 100644
--- a/mlir/examples/toy/Ch3/toyc.cpp
+++ b/mlir/examples/toy/Ch3/toyc.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/IR/Diagnostics.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
#include "toy/Lexer.h"
diff --git a/mlir/examples/toy/Ch4/mlir/Dialect.cpp b/mlir/examples/toy/Ch4/mlir/Dialect.cpp
index 86a0e1d..6c6cdd9 100644
--- a/mlir/examples/toy/Ch4/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch4/mlir/Dialect.cpp
@@ -23,7 +23,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -204,7 +203,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
/// Verifier for the constant operation. This corresponds to the
/// `let hasVerifier = 1` in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
// If the return type of the constant is not an unranked tensor, the shape
// must match the shape of the attribute holding the data.
auto resultType = llvm::dyn_cast<mlir::RankedTensorType>(getResult().getType());
@@ -372,7 +371,7 @@ void MulOp::inferShapes() { getResult().setType(getLhs().getType()); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -421,7 +420,7 @@ void TransposeOp::inferShapes() {
getResult().setType(RankedTensorType::get(dims, arrayTy.getElementType()));
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
index 6c5474a..b56e2f7c 100644
--- a/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch4/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -105,7 +104,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
+ llvm::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
if (symbolTable.count(var))
return mlir::failure();
symbolTable.insert(var, value);
@@ -229,7 +228,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -341,7 +340,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -407,7 +406,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
ScopedHashTableScope<StringRef, mlir::Value> varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp
index 3ce35c8..f8397c2 100644
--- a/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch4/mlir/ToyCombine.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/Dialect.h"
using namespace mlir;
using namespace toy;
@@ -36,7 +35,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method attempts to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. The pattern is
/// expected to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
diff --git a/mlir/examples/toy/Ch4/toyc.cpp b/mlir/examples/toy/Ch4/toyc.cpp
index a1534ed..ae02bc4 100644
--- a/mlir/examples/toy/Ch4/toyc.cpp
+++ b/mlir/examples/toy/Ch4/toyc.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/IR/Diagnostics.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
#include "toy/Lexer.h"
diff --git a/mlir/examples/toy/Ch5/mlir/Dialect.cpp b/mlir/examples/toy/Ch5/mlir/Dialect.cpp
index c587dd2..72072f9 100644
--- a/mlir/examples/toy/Ch5/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch5/mlir/Dialect.cpp
@@ -23,7 +23,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -204,7 +203,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
/// Verifier for the constant operation. This corresponds to the
/// `let hasVerifier = 1` in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
// If the return type of the constant is not an unranked tensor, the shape
// must match the shape of the attribute holding the data.
auto resultType = llvm::dyn_cast<mlir::RankedTensorType>(getResult().getType());
@@ -372,7 +371,7 @@ void MulOp::inferShapes() { getResult().setType(getLhs().getType()); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -421,7 +420,7 @@ void TransposeOp::inferShapes() {
getResult().setType(RankedTensorType::get(dims, arrayTy.getElementType()));
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
index bded615..7413214 100644
--- a/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch5/mlir/LowerToAffineLoops.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "toy/Dialect.h"
#include "toy/Passes.h"
diff --git a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
index 6c5474a..b56e2f7c 100644
--- a/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch5/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -105,7 +104,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
+ llvm::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
if (symbolTable.count(var))
return mlir::failure();
symbolTable.insert(var, value);
@@ -229,7 +228,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -341,7 +340,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -407,7 +406,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
ScopedHashTableScope<StringRef, mlir::Value> varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp
index 3ce35c8..f8397c2 100644
--- a/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch5/mlir/ToyCombine.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/Dialect.h"
using namespace mlir;
using namespace toy;
@@ -36,7 +35,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method attempts to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. The pattern is
/// expected to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
diff --git a/mlir/examples/toy/Ch5/toyc.cpp b/mlir/examples/toy/Ch5/toyc.cpp
index 4eb6fde..6a0c631 100644
--- a/mlir/examples/toy/Ch5/toyc.cpp
+++ b/mlir/examples/toy/Ch5/toyc.cpp
@@ -12,7 +12,6 @@
#include "mlir/Dialect/Func/Extensions/AllExtensions.h"
#include "mlir/IR/Diagnostics.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
#include "toy/Lexer.h"
diff --git a/mlir/examples/toy/Ch6/mlir/Dialect.cpp b/mlir/examples/toy/Ch6/mlir/Dialect.cpp
index c587dd2..72072f9 100644
--- a/mlir/examples/toy/Ch6/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch6/mlir/Dialect.cpp
@@ -23,7 +23,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
@@ -204,7 +203,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
/// Verifier for the constant operation. This corresponds to the
/// `let hasVerifier = 1` in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
// If the return type of the constant is not an unranked tensor, the shape
// must match the shape of the attribute holding the data.
auto resultType = llvm::dyn_cast<mlir::RankedTensorType>(getResult().getType());
@@ -372,7 +371,7 @@ void MulOp::inferShapes() { getResult().setType(getLhs().getType()); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -421,7 +420,7 @@ void TransposeOp::inferShapes() {
getResult().setType(RankedTensorType::get(dims, arrayTy.getElementType()));
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
index bded615..7413214 100644
--- a/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch6/mlir/LowerToAffineLoops.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "toy/Dialect.h"
#include "toy/Passes.h"
diff --git a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
index f91d880..3ad70e7 100644
--- a/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
+++ b/mlir/examples/toy/Ch6/mlir/LowerToLLVM.cpp
@@ -28,7 +28,6 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "toy/Dialect.h"
#include "toy/Passes.h"
diff --git a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
index 6c5474a..b56e2f7c 100644
--- a/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch6/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -105,7 +104,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
+ llvm::LogicalResult declare(llvm::StringRef var, mlir::Value value) {
if (symbolTable.count(var))
return mlir::failure();
symbolTable.insert(var, value);
@@ -229,7 +228,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -341,7 +340,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -407,7 +406,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
ScopedHashTableScope<StringRef, mlir::Value> varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp
index 3ce35c8..f8397c2 100644
--- a/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch6/mlir/ToyCombine.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/Dialect.h"
using namespace mlir;
using namespace toy;
@@ -36,7 +35,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method attempts to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. The pattern is
/// expected to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
diff --git a/mlir/examples/toy/Ch6/toyc.cpp b/mlir/examples/toy/Ch6/toyc.cpp
index ddc0c25..c244b31 100644
--- a/mlir/examples/toy/Ch6/toyc.cpp
+++ b/mlir/examples/toy/Ch6/toyc.cpp
@@ -12,7 +12,6 @@
#include "mlir/Dialect/Func/Extensions/AllExtensions.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
#include "toy/Lexer.h"
diff --git a/mlir/examples/toy/Ch7/mlir/Dialect.cpp b/mlir/examples/toy/Ch7/mlir/Dialect.cpp
index b268b1e..7e030ff 100644
--- a/mlir/examples/toy/Ch7/mlir/Dialect.cpp
+++ b/mlir/examples/toy/Ch7/mlir/Dialect.cpp
@@ -27,7 +27,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Hashing.h"
@@ -195,7 +194,7 @@ void ConstantOp::print(mlir::OpAsmPrinter &printer) {
}
/// Verify that the given attribute value is valid for the given type.
-static mlir::LogicalResult verifyConstantForType(mlir::Type type,
+static llvm::LogicalResult verifyConstantForType(mlir::Type type,
mlir::Attribute opaqueValue,
mlir::Operation *op) {
if (llvm::isa<mlir::TensorType>(type)) {
@@ -252,11 +251,11 @@ static mlir::LogicalResult verifyConstantForType(mlir::Type type,
/// Verifier for the constant operation. This corresponds to the `::verify(...)`
/// in the op definition.
-mlir::LogicalResult ConstantOp::verify() {
+llvm::LogicalResult ConstantOp::verify() {
return verifyConstantForType(getResult().getType(), getValue(), *this);
}
-mlir::LogicalResult StructConstantOp::verify() {
+llvm::LogicalResult StructConstantOp::verify() {
return verifyConstantForType(getResult().getType(), getValue(), *this);
}
@@ -406,7 +405,7 @@ void MulOp::inferShapes() { getResult().setType(getLhs().getType()); }
// ReturnOp
//===----------------------------------------------------------------------===//
-mlir::LogicalResult ReturnOp::verify() {
+llvm::LogicalResult ReturnOp::verify() {
// We know that the parent operation is a function, because of the 'HasParent'
// trait attached to the operation definition.
auto function = cast<FuncOp>((*this)->getParentOp());
@@ -454,7 +453,7 @@ void StructAccessOp::build(mlir::OpBuilder &b, mlir::OperationState &state,
build(b, state, resultType, input, b.getI64IntegerAttr(index));
}
-mlir::LogicalResult StructAccessOp::verify() {
+llvm::LogicalResult StructAccessOp::verify() {
StructType structTy = llvm::cast<StructType>(getInput().getType());
size_t indexValue = getIndex();
if (indexValue >= structTy.getNumElementTypes())
@@ -483,7 +482,7 @@ void TransposeOp::inferShapes() {
getResult().setType(RankedTensorType::get(dims, arrayTy.getElementType()));
}
-mlir::LogicalResult TransposeOp::verify() {
+llvm::LogicalResult TransposeOp::verify() {
auto inputType = llvm::dyn_cast<RankedTensorType>(getOperand().getType());
auto resultType = llvm::dyn_cast<RankedTensorType>(getType());
if (!inputType || !resultType)
diff --git a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
index bded615..7413214 100644
--- a/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
+++ b/mlir/examples/toy/Ch7/mlir/LowerToAffineLoops.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "toy/Dialect.h"
#include "toy/Passes.h"
diff --git a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
index f91d880..3ad70e7 100644
--- a/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
+++ b/mlir/examples/toy/Ch7/mlir/LowerToLLVM.cpp
@@ -28,7 +28,6 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "toy/Dialect.h"
#include "toy/Passes.h"
diff --git a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
index 0f8e8df..090e5ff 100644
--- a/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
+++ b/mlir/examples/toy/Ch7/mlir/MLIRGen.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Block.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
@@ -133,7 +132,7 @@ private:
/// Declare a variable in the current scope, return success if the variable
/// wasn't declared yet.
- mlir::LogicalResult declare(VarDeclExprAST &var, mlir::Value value) {
+ llvm::LogicalResult declare(VarDeclExprAST &var, mlir::Value value) {
if (symbolTable.count(var.getName()))
return mlir::failure();
symbolTable.insert(var.getName(), {value, &var});
@@ -141,7 +140,7 @@ private:
}
/// Create an MLIR type for the given struct.
- mlir::LogicalResult mlirGen(StructAST &str) {
+ llvm::LogicalResult mlirGen(StructAST &str) {
if (structMap.count(str.getName()))
return emitError(loc(str.loc())) << "error: struct type with name `"
<< str.getName() << "' already exists";
@@ -368,7 +367,7 @@ private:
}
/// Emit a return operation. This will return failure if any generation fails.
- mlir::LogicalResult mlirGen(ReturnExprAST &ret) {
+ llvm::LogicalResult mlirGen(ReturnExprAST &ret) {
auto location = loc(ret.loc());
// 'return' takes an optional expression, handle that case here.
@@ -542,7 +541,7 @@ private:
/// Emit a print expression. It emits specific operations for two builtins:
/// transpose(x) and print(x).
- mlir::LogicalResult mlirGen(PrintExprAST &call) {
+ llvm::LogicalResult mlirGen(PrintExprAST &call) {
auto arg = mlirGen(*call.getArg());
if (!arg)
return mlir::failure();
@@ -626,7 +625,7 @@ private:
}
/// Codegen a list of expression, return failure if one of them hit an error.
- mlir::LogicalResult mlirGen(ExprASTList &blockAST) {
+ llvm::LogicalResult mlirGen(ExprASTList &blockAST) {
SymbolTableScopeT varScope(symbolTable);
for (auto &expr : blockAST) {
// Specific handling for variable declarations, return statement, and
diff --git a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
index 72f5e4b..1d8cf74 100644
--- a/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
+++ b/mlir/examples/toy/Ch7/mlir/ToyCombine.cpp
@@ -16,7 +16,6 @@
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/Dialect.h"
#include "llvm/Support/Casting.h"
#include <cstddef>
@@ -57,7 +56,7 @@ struct SimplifyRedundantTranspose : public mlir::OpRewritePattern<TransposeOp> {
/// This method attempts to match a pattern and rewrite it. The rewriter
/// argument is the orchestrator of the sequence of rewrites. The pattern is
/// expected to interact with it to perform any changes to the IR from here.
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(TransposeOp op,
mlir::PatternRewriter &rewriter) const override {
// Look through the input of the current transpose.
diff --git a/mlir/examples/toy/Ch7/toyc.cpp b/mlir/examples/toy/Ch7/toyc.cpp
index 5eb40b7..fea5679 100644
--- a/mlir/examples/toy/Ch7/toyc.cpp
+++ b/mlir/examples/toy/Ch7/toyc.cpp
@@ -12,7 +12,6 @@
#include "mlir/Dialect/Func/Extensions/AllExtensions.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
-#include "mlir/Support/LogicalResult.h"
#include "toy/AST.h"
#include "toy/Dialect.h"
#include "toy/Lexer.h"
diff --git a/mlir/examples/transform-opt/mlir-transform-opt.cpp b/mlir/examples/transform-opt/mlir-transform-opt.cpp
index 41a17f1..65615fb 100644
--- a/mlir/examples/transform-opt/mlir-transform-opt.cpp
+++ b/mlir/examples/transform-opt/mlir-transform-opt.cpp
@@ -118,7 +118,7 @@ public:
DiagnosticHandlerWrapper &operator=(DiagnosticHandlerWrapper &&) = default;
/// Verifies the captured "expected-*" diagnostics if required.
- mlir::LogicalResult verify() const {
+ llvm::LogicalResult verify() const {
if (auto *ptr =
handler.dyn_cast<mlir::SourceMgrDiagnosticVerifierHandler *>()) {
return ptr->verify();
@@ -192,7 +192,7 @@ public:
/// If diagnostic message verification has been requested upon construction of
/// this source manager, performs the verification, reports errors and returns
/// the result of the verification. Otherwise passes through the given value.
- mlir::LogicalResult checkResult(mlir::LogicalResult result) {
+ llvm::LogicalResult checkResult(llvm::LogicalResult result) {
resultChecked = true;
if (!verifyDiagnostics)
return result;
@@ -222,7 +222,7 @@ private:
/// Trivial wrapper around `applyTransforms` that doesn't support extra mapping
/// and doesn't enforce the entry point transform ops being top-level.
-static mlir::LogicalResult
+static llvm::LogicalResult
applyTransforms(mlir::Operation *payloadRoot,
mlir::transform::TransformOpInterface transformRoot,
const mlir::transform::TransformOptions &options) {
@@ -237,7 +237,7 @@ applyTransforms(mlir::Operation *payloadRoot,
/// application is successful, prints the transformed input buffer into the
/// given output stream. Additional configuration options are derived from
/// command-line options.
-static mlir::LogicalResult processPayloadBuffer(
+static llvm::LogicalResult processPayloadBuffer(
raw_ostream &os, std::unique_ptr<MemoryBuffer> inputBuffer,
std::unique_ptr<llvm::MemoryBuffer> transformBuffer,
MutableArrayRef<std::unique_ptr<MemoryBuffer>> transformLibraries,
@@ -309,7 +309,7 @@ static mlir::LogicalResult processPayloadBuffer(
}
/// Tool entry point.
-static mlir::LogicalResult runMain(int argc, char **argv) {
+static llvm::LogicalResult runMain(int argc, char **argv) {
// Register all upstream dialects and extensions. Specific uses are advised
// not to register all dialects indiscriminately but rather hand-pick what is
// necessary for their use case.
diff --git a/mlir/examples/transform/Ch4/lib/MyExtension.cpp b/mlir/examples/transform/Ch4/lib/MyExtension.cpp
index 0790736..38c8ca1 100644
--- a/mlir/examples/transform/Ch4/lib/MyExtension.cpp
+++ b/mlir/examples/transform/Ch4/lib/MyExtension.cpp
@@ -166,7 +166,7 @@ void mlir::transform::HasOperandSatisfyingOp::getEffects(
// Verify well-formedness of the operation and emit diagnostics if it is
// ill-formed.
-mlir::LogicalResult mlir::transform::HasOperandSatisfyingOp::verify() {
+llvm::LogicalResult mlir::transform::HasOperandSatisfyingOp::verify() {
mlir::Block &bodyBlock = getBody().front();
if (bodyBlock.getNumArguments() != 1 ||
!isa<TransformValueHandleTypeInterface>(
diff --git a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
index cc6ab64..63305e0 100644
--- a/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
+++ b/mlir/include/mlir/Analysis/FlatLinearValueConstraints.h
@@ -13,7 +13,6 @@
#include "mlir/Analysis/Presburger/Matrix.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Support/LogicalResult.h"
#include <optional>
namespace mlir {
diff --git a/mlir/include/mlir/Bytecode/BytecodeImplementation.h b/mlir/include/mlir/Bytecode/BytecodeImplementation.h
index bc91318c..0ddc531 100644
--- a/mlir/include/mlir/Bytecode/BytecodeImplementation.h
+++ b/mlir/include/mlir/Bytecode/BytecodeImplementation.h
@@ -19,7 +19,6 @@
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectInterface.h"
#include "mlir/IR/OpImplementation.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Twine.h"
diff --git a/mlir/include/mlir/Bytecode/BytecodeOpInterface.h b/mlir/include/mlir/Bytecode/BytecodeOpInterface.h
index 10f5be0..c9c6060 100644
--- a/mlir/include/mlir/Bytecode/BytecodeOpInterface.h
+++ b/mlir/include/mlir/Bytecode/BytecodeOpInterface.h
@@ -18,7 +18,6 @@
#include "mlir/Bytecode/BytecodeReader.h"
#include "mlir/Bytecode/BytecodeWriter.h"
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Support/LogicalResult.h"
/// Include the generated interface declarations.
#include "mlir/Bytecode/BytecodeOpInterface.h.inc"
diff --git a/mlir/include/mlir/Bytecode/BytecodeReader.h b/mlir/include/mlir/Bytecode/BytecodeReader.h
index 9f26506..19f74a0 100644
--- a/mlir/include/mlir/Bytecode/BytecodeReader.h
+++ b/mlir/include/mlir/Bytecode/BytecodeReader.h
@@ -15,7 +15,6 @@
#include "mlir/IR/AsmState.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include <functional>
#include <memory>
diff --git a/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h b/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h
index d623d0d..47be732 100644
--- a/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h
+++ b/mlir/include/mlir/Bytecode/BytecodeReaderConfig.h
@@ -14,7 +14,6 @@
#define MLIR_BYTECODE_BYTECODEREADERCONFIG_H
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
diff --git a/mlir/include/mlir/CAPI/Support.h b/mlir/include/mlir/CAPI/Support.h
index 6227452..89a4603 100644
--- a/mlir/include/mlir/CAPI/Support.h
+++ b/mlir/include/mlir/CAPI/Support.h
@@ -17,9 +17,9 @@
#include "mlir-c/Support.h"
#include "mlir/CAPI/Wrap.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/LogicalResult.h"
namespace llvm {
class ThreadPoolInterface;
@@ -35,13 +35,13 @@ inline llvm::StringRef unwrap(MlirStringRef ref) {
return llvm::StringRef(ref.data, ref.length);
}
-inline MlirLogicalResult wrap(mlir::LogicalResult res) {
+inline MlirLogicalResult wrap(llvm::LogicalResult res) {
if (mlir::succeeded(res))
return mlirLogicalResultSuccess();
return mlirLogicalResultFailure();
}
-inline mlir::LogicalResult unwrap(MlirLogicalResult res) {
+inline llvm::LogicalResult unwrap(MlirLogicalResult res) {
return mlir::success(mlirLogicalResultIsSuccess(res));
}
diff --git a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
index 3850a00..96ee4f0 100644
--- a/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
+++ b/mlir/include/mlir/Conversion/AffineToStandard/AffineToStandard.h
@@ -13,7 +13,6 @@
namespace mlir {
class Location;
-struct LogicalResult;
class OpBuilder;
class Pass;
class RewritePattern;
diff --git a/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h b/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h
index 424ab38..00aeed9 100644
--- a/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h
+++ b/mlir/include/mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h
@@ -11,7 +11,6 @@
#include "mlir/IR/DialectInterface.h"
#include "mlir/IR/MLIRContext.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
class ConversionTarget;
diff --git a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
index 107718e..76eb3b5 100644
--- a/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
+++ b/mlir/include/mlir/Conversion/FuncToLLVM/ConvertFuncToLLVM.h
@@ -15,7 +15,6 @@
#define MLIR_CONVERSION_FUNCTOLLVM_CONVERTFUNCTOLLVM_H
#include "mlir/Interfaces/FunctionInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
diff --git a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
index 2d5e9d2..5f40315 100644
--- a/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
+++ b/mlir/include/mlir/Conversion/GPUCommon/GPUCommonPass.h
@@ -26,7 +26,6 @@ namespace mlir {
class LLVMTypeConverter;
class Location;
-struct LogicalResult;
class ModuleOp;
class Operation;
class RewritePatternSet;
diff --git a/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h
index a180a12..69e3f70 100644
--- a/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h
+++ b/mlir/include/mlir/Conversion/SCFToGPU/SCFToGPU.h
@@ -12,7 +12,6 @@
namespace mlir {
class ConversionTarget;
-struct LogicalResult;
class MLIRContext;
class Value;
class Operation;
diff --git a/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h b/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
index 3530eb5..10467e6 100644
--- a/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
+++ b/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h
@@ -12,7 +12,6 @@
#include "mlir/IR/PatternMatch.h"
namespace mlir {
-struct LogicalResult;
class MLIRContext;
class Pass;
class RewritePatternSet;
diff --git a/mlir/include/mlir/Debug/CLOptionsSetup.h b/mlir/include/mlir/Debug/CLOptionsSetup.h
index a30ffe0..e7e9727 100644
--- a/mlir/include/mlir/Debug/CLOptionsSetup.h
+++ b/mlir/include/mlir/Debug/CLOptionsSetup.h
@@ -10,7 +10,6 @@
#define MLIR_DEBUG_CLOPTIONSSETUP_H
#include "mlir/Debug/BreakpointManagers/FileLineColLocBreakpointManager.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
diff --git a/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h b/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h
index 5031dc4..38e0ebe 100644
--- a/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h
+++ b/mlir/include/mlir/Dialect/AMDGPU/Utils/Chipset.h
@@ -8,7 +8,7 @@
#ifndef MLIR_DIALECT_AMDGPU_UTILS_CHIPSET_H_
#define MLIR_DIALECT_AMDGPU_UTILS_CHIPSET_H_
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
namespace mlir {
namespace amdgpu {
diff --git a/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
index c9d3dc1..707eec7 100644
--- a/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
+++ b/mlir/include/mlir/Dialect/Affine/Analysis/AffineStructures.h
@@ -18,7 +18,6 @@
#include "mlir/Analysis/Presburger/Matrix.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Support/LogicalResult.h"
#include <optional>
namespace mlir {
diff --git a/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h b/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h
index 6e617ef4..451c466 100644
--- a/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h
+++ b/mlir/include/mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h
@@ -9,7 +9,7 @@
#ifndef MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H
#define MLIR_DIALECT_AFFINE_IR_VALUEBOUNDSOPINTERFACEIMPL_H
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
namespace mlir {
class DialectRegistry;
diff --git a/mlir/include/mlir/Dialect/Affine/LoopUtils.h b/mlir/include/mlir/Dialect/Affine/LoopUtils.h
index d143954..99c500c 100644
--- a/mlir/include/mlir/Dialect/Affine/LoopUtils.h
+++ b/mlir/include/mlir/Dialect/Affine/LoopUtils.h
@@ -17,7 +17,6 @@
#include "mlir/IR/Block.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/RegionUtils.h"
#include <optional>
diff --git a/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h
index 1ea7375..b244d37 100644
--- a/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Affine/Transforms/Transforms.h
@@ -16,7 +16,6 @@
#include "mlir/Interfaces/ValueBoundsOpInterface.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
class AffineMap;
diff --git a/mlir/include/mlir/Dialect/Affine/Utils.h b/mlir/include/mlir/Dialect/Affine/Utils.h
index 7f25db0..9a2767e 100644
--- a/mlir/include/mlir/Dialect/Affine/Utils.h
+++ b/mlir/include/mlir/Dialect/Affine/Utils.h
@@ -33,8 +33,6 @@ namespace memref {
class AllocOp;
} // namespace memref
-struct LogicalResult;
-
namespace affine {
class AffineForOp;
class AffineIfOp;
diff --git a/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h
index bbc7e5d..8d6c68c 100644
--- a/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Arith/Transforms/Transforms.h
@@ -10,7 +10,6 @@
#define MLIR_DIALECT_ARITH_TRANSFORMS_TRANSFORMS_H
#include "mlir/Interfaces/ValueBoundsOpInterface.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
class Location;
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
index 007c05a..80cd13d 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/BufferizableOpInterface.td
@@ -378,7 +378,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
This method can query analysis information from the given analysis
state.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"resolveConflicts",
/*args=*/(ins "::mlir::RewriterBase &":$rewriter,
"const ::mlir::bufferization::AnalysisState &":$state),
@@ -423,7 +423,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
suggestion to make sure IR is valid at every point in time and could
be done differently).
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"bufferize",
/*args=*/(ins "::mlir::RewriterBase &":$rewriter,
"const ::mlir::bufferization::BufferizationOptions &":$options),
@@ -490,7 +490,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
This method can be used to check expected invariants and limitations
of the current bufferization implementation.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"verifyAnalysis",
/*args=*/(ins "const ::mlir::bufferization::AnalysisState &":$state),
/*methodBody=*/"",
@@ -613,7 +613,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
let extraClassDeclaration = [{
/// Resolve out-of-place tensor OpOperands with explicit allocations in the
/// form of `bufferization.alloc_tensor` ops.
- ::mlir::LogicalResult resolveTensorOpOperandConflicts(
+ ::llvm::LogicalResult resolveTensorOpOperandConflicts(
::mlir::RewriterBase &rewriter,
const ::mlir::bufferization::AnalysisState &state);
diff --git a/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h b/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h
index cd4c009..4e5f5e9 100644
--- a/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h
+++ b/mlir/include/mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h
@@ -9,9 +9,11 @@
#ifndef MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
#define MLIR_DIALECT_BUFFERIZATION_TRANSFORMS_ONESHOTMODULEBUFFERIZE_H
-namespace mlir {
-
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+
+namespace mlir {
class ModuleOp;
namespace bufferization {
@@ -21,8 +23,9 @@ struct OneShotBufferizationOptions;
/// Analyze `moduleOp` and its nested ops. Bufferization decisions are stored in
/// `state`.
-LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state,
- BufferizationStatistics *statistics = nullptr);
+llvm::LogicalResult
+analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state,
+ BufferizationStatistics *statistics = nullptr);
/// Bufferize `op` and its nested ops that implement `BufferizableOpInterface`.
///
@@ -33,9 +36,9 @@ LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state,
/// - `options.copyBeforeWrite` is not set and `options.noAnalysisFuncFilter`
/// is not empty. The FuncOps it contains were not analyzed. Buffer copies
/// will be inserted only to these FuncOps.
-LogicalResult bufferizeModuleOp(ModuleOp moduleOp,
- const OneShotBufferizationOptions &options,
- BufferizationStatistics *statistics = nullptr);
+llvm::LogicalResult
+bufferizeModuleOp(ModuleOp moduleOp, const OneShotBufferizationOptions &options,
+ BufferizationStatistics *statistics = nullptr);
/// Remove bufferization attributes on every FuncOp arguments in the ModuleOp.
void removeBufferizationAttributesInModule(ModuleOp moduleOp);
@@ -44,7 +47,7 @@ void removeBufferizationAttributesInModule(ModuleOp moduleOp);
/// function call analysis to determine which function arguments are
/// inplaceable. Then analyzes and bufferizes FuncOps one-by-one with One-Shot
/// Bufferize.
-LogicalResult runOneShotModuleBufferize(
+llvm::LogicalResult runOneShotModuleBufferize(
ModuleOp moduleOp,
const bufferization::OneShotBufferizationOptions &options,
BufferizationStatistics *statistics = nullptr);
diff --git a/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td b/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td
index 582ab91..43ca533 100644
--- a/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td
+++ b/mlir/include/mlir/Dialect/GPU/IR/CompilationAttrInterfaces.td
@@ -113,7 +113,7 @@ def OffloadingLLVMTranslationAttrInterface :
The first argument has to be a GPU binary operation.
If the function fails at any point, it must return `failure`.
}],
- "::mlir::LogicalResult", "embedBinary",
+ "::llvm::LogicalResult", "embedBinary",
(ins "::mlir::Operation*":$binaryOp,
"::llvm::IRBuilderBase&":$hostBuilder,
"::mlir::LLVM::ModuleTranslation&":$hostModuleTranslation)
@@ -130,7 +130,7 @@ def OffloadingLLVMTranslationAttrInterface :
respectively. If the function fails at any point, it must return
`failure`.
}],
- "::mlir::LogicalResult", "launchKernel",
+ "::llvm::LogicalResult", "launchKernel",
(ins "::mlir::Operation*":$launchFunc, "::mlir::Operation*":$binaryOp,
"::llvm::IRBuilderBase&":$hostBuilder,
"::mlir::LLVM::ModuleTranslation&":$hostModuleTranslation)
diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h b/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h
index 74b78f9..30511e7 100644
--- a/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h
+++ b/mlir/include/mlir/Dialect/GPU/Transforms/ParallelLoopMapper.h
@@ -21,7 +21,6 @@
namespace mlir {
class AffineMap;
-struct LogicalResult;
class Operation;
class Region;
diff --git a/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h b/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h
index f8c018e..0734939 100644
--- a/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h
+++ b/mlir/include/mlir/Dialect/GPU/Transforms/Utils.h
@@ -20,7 +20,6 @@
#include <string>
namespace mlir {
-struct LogicalResult;
class Operation;
class Value;
diff --git a/mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h b/mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h
index 6455385..554fccec 100644
--- a/mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h
+++ b/mlir/include/mlir/Dialect/IRDL/IR/IRDLInterfaces.h
@@ -19,7 +19,6 @@
#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/Types.h"
-#include "mlir/Support/LogicalResult.h"
#include <optional>
namespace mlir {
diff --git a/mlir/include/mlir/Dialect/IRDL/IR/IRDLTraits.h b/mlir/include/mlir/Dialect/IRDL/IR/IRDLTraits.h
index 1755341..98bedbf 100644
--- a/mlir/include/mlir/Dialect/IRDL/IR/IRDLTraits.h
+++ b/mlir/include/mlir/Dialect/IRDL/IR/IRDLTraits.h
@@ -15,7 +15,6 @@
#define MLIR_DIALECT_IRDL_IR_IRDLTRAITS_H_
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Casting.h"
namespace mlir {
diff --git a/mlir/include/mlir/Dialect/IRDL/IRDLLoading.h b/mlir/include/mlir/Dialect/IRDL/IRDLLoading.h
index 64ad72b..13c2799 100644
--- a/mlir/include/mlir/Dialect/IRDL/IRDLLoading.h
+++ b/mlir/include/mlir/Dialect/IRDL/IRDLLoading.h
@@ -13,8 +13,11 @@
#ifndef MLIR_DIALECT_IRDL_IRDLREGISTRATION_H
#define MLIR_DIALECT_IRDL_IRDLREGISTRATION_H
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+
+namespace mlir {
class ModuleOp;
} // namespace mlir
@@ -22,7 +25,7 @@ namespace mlir {
namespace irdl {
/// Load all the dialects defined in the module.
-LogicalResult loadDialects(ModuleOp op);
+llvm::LogicalResult loadDialects(ModuleOp op);
} // namespace irdl
} // namespace mlir
diff --git a/mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h b/mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h
index 89e99a6..bad52bb 100644
--- a/mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h
+++ b/mlir/include/mlir/Dialect/IRDL/IRDLVerifiers.h
@@ -21,7 +21,6 @@
#include <optional>
namespace mlir {
-struct LogicalResult;
class InFlightDiagnostic;
class DynamicAttrDefinition;
class DynamicTypeDefinition;
diff --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h b/mlir/include/mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h
index f9fd32c..5430fd9 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/GPUHeuristics.h
@@ -11,7 +11,6 @@
#include "mlir/IR/Attributes.h"
#include "mlir/IR/MLIRContext.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
namespace transform {
diff --git a/mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h b/mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h
index 13b0dc0..50e55e7 100644
--- a/mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h
+++ b/mlir/include/mlir/Dialect/Linalg/TransformOps/Syntax.h
@@ -12,7 +12,6 @@
#include "mlir/Support/LLVM.h"
namespace mlir {
-class ParseResult;
class OpAsmParser;
class OpAsmPrinter;
class Type;
diff --git a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
index 3812eb5..2a58d02 100644
--- a/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h
@@ -22,7 +22,6 @@
#include "mlir/Dialect/X86Vector/Transforms.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/TilingInterface.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallSet.h"
diff --git a/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h b/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h
index a918f62..4444a76 100644
--- a/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/MemRef/Transforms/Transforms.h
@@ -14,7 +14,7 @@
#ifndef MLIR_DIALECT_MEMREF_TRANSFORMS_TRANSFORMS_H
#define MLIR_DIALECT_MEMREF_TRANSFORMS_TRANSFORMS_H
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "llvm/ADT/STLFunctionalExtras.h"
namespace mlir {
diff --git a/mlir/include/mlir/Dialect/Mesh/Transforms/Spmdization.h b/mlir/include/mlir/Dialect/Mesh/Transforms/Spmdization.h
index f847ce3..2f6de3e 100644
--- a/mlir/include/mlir/Dialect/Mesh/Transforms/Spmdization.h
+++ b/mlir/include/mlir/Dialect/Mesh/Transforms/Spmdization.h
@@ -11,7 +11,6 @@
#include "mlir/Dialect/Mesh/IR/MeshOps.h"
#include "mlir/IR/DialectRegistry.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
namespace mesh {
diff --git a/mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h b/mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h
index 4bac898..2ff9ac4 100644
--- a/mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/NVGPU/Transforms/Transforms.h
@@ -14,7 +14,6 @@
#define MLIR_DIALECT_NVGPU_TRANSFORMS_TRANSFORMS_H_
#include "mlir/IR/Operation.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
class RewriterBase;
@@ -44,7 +43,7 @@ namespace nvgpu {
/// function that depends on the row Index. The permutation function is chosen
/// to ensure that sequential distributed+vectorized reads/writes down a single
/// dimension of the memref have minimal conflicts.
-mlir::LogicalResult optimizeSharedMemoryReadsAndWrites(Operation *parentOp,
+llvm::LogicalResult optimizeSharedMemoryReadsAndWrites(Operation *parentOp,
Value memrefValue);
///
diff --git a/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td b/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td
index 57063ca..223bee9 100644
--- a/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td
+++ b/mlir/include/mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.td
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
//
-// Defines the operation interface for atomic operations used in OpenACC and
+// Defines the operation interface for atomic operations used in OpenACC and
// OpenMP.
//
//===----------------------------------------------------------------------===//
@@ -34,7 +34,7 @@ def AtomicReadOpInterface : OpInterface<"AtomicReadOpInterface"> {
InterfaceMethod<[{
Common verifier for operation that implements atomic read interface.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyCommon",
/*args=*/(ins),
/*methodBody=*/"",
@@ -81,7 +81,7 @@ def AtomicWriteOpInterface : OpInterface<"AtomicWriteOpInterface"> {
InterfaceMethod<[{
Common verifier for operation that implements atomic write interface.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyCommon",
/*args=*/(ins),
/*methodBody=*/"",
@@ -118,7 +118,7 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
The interface terminology uses `x` to specify the address where a value
is atomically written/read.
-
+
Since atomic update expression comes in many forms, this interface requires
that the operation uses a region with a single argument to capture the
expression.
@@ -162,9 +162,9 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
/*defaultImplementation=*/[{
// The atomic update is a no-op if the terminator is the first and only
// operation in its region.
- mlir::Operation* terminator =
+ mlir::Operation* terminator =
llvm::dyn_cast<mlir::RegionBranchTerminatorOpInterface>($_op.getFirstOp());
- return terminator && terminator->getOperands().front() ==
+ return terminator && terminator->getOperands().front() ==
$_op.getRegion().front().getArgument(0);
}]
>,
@@ -177,9 +177,9 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
/*args=*/(ins),
/*methodBody=*/"",
/*defaultImplementation=*/[{
- mlir::Operation* terminator =
+ mlir::Operation* terminator =
llvm::dyn_cast<mlir::RegionBranchTerminatorOpInterface>($_op.getFirstOp());
- if (terminator && terminator->getOperands().front() !=
+ if (terminator && terminator->getOperands().front() !=
$_op.getRegion().front().getArgument(0)) {
return terminator->getOperands().front();
}
@@ -189,7 +189,7 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
InterfaceMethod<[{
Common verifier for operation that implements atomic update interface.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyCommon",
/*args=*/(ins),
/*methodBody=*/"",
@@ -210,7 +210,7 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
Common verifier of the required region for operation that implements
atomic update interface.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyRegionsCommon",
/*args=*/(ins),
/*methodBody=*/"",
@@ -219,7 +219,7 @@ def AtomicUpdateOpInterface : OpInterface<"AtomicUpdateOpInterface"> {
if (terminator->getOperands().size() != 1)
return $_op.emitError("only updated value must be returned");
-
+
if (terminator->getOperands().front().getType() !=
$_op.getRegion().getArgument(0).getType())
return $_op.emitError("input and yielded value must have the same type");
@@ -272,7 +272,7 @@ def AtomicCaptureOpInterface : OpInterface<"AtomicCaptureOpInterface"> {
Common verifier of the required region for operation that implements
atomic capture interface.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyRegionsCommon",
/*args=*/(ins),
/*methodBody=*/"",
diff --git a/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h b/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h
index e14cef5..3f206cd 100644
--- a/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h
+++ b/mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h
@@ -10,7 +10,6 @@
#define MLIR_DIALECT_POLYNOMIAL_IR_POLYNOMIAL_H_
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
diff --git a/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h b/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h
index 1863317..71835cd 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/Transforms.h
@@ -18,8 +18,6 @@
#include "llvm/ADT/ArrayRef.h"
namespace mlir {
-
-struct LogicalResult;
class Region;
class RewriterBase;
class Operation;
diff --git a/mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h b/mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h
index 5022cbf..2913a74 100644
--- a/mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h
+++ b/mlir/include/mlir/Dialect/SCF/Utils/AffineCanonicalizationUtils.h
@@ -15,11 +15,9 @@
#define MLIR_DIALECT_SCF_UTILS_AFFINECANONICALIZATIONUTILS_H_
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
namespace mlir {
class AffineMap;
-struct LogicalResult;
class Operation;
class OpFoldResult;
class RewriterBase;
diff --git a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
index fea151b..de807c3 100644
--- a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
@@ -16,7 +16,6 @@
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include <optional>
diff --git a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td
index 05eed04..5c07e81 100644
--- a/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td
+++ b/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorInterfaces.td
@@ -32,7 +32,7 @@ def StageWithSortSparseOpInterface : OpInterface<"StageWithSortSparseOp"> {
/*methodBody=*/"">,
InterfaceMethod<
/*desc=*/"Stage the operation, return the final result value after staging.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"stageWithSort",
/*args=*/(ins "::mlir::PatternRewriter &":$rewriter,
"Value &":$tmpBuf),
diff --git a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h
index b835304..842e244 100644
--- a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h
+++ b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.h
@@ -14,7 +14,6 @@
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Dialect/Transform/Interfaces/TransformTypeInterfaces.h.inc"
@@ -1595,7 +1594,7 @@ mlir::transform::TransformEachOpTrait<OpTy>::apply(
}
template <typename OpTy>
-mlir::LogicalResult
+llvm::LogicalResult
mlir::transform::TransformEachOpTrait<OpTy>::verifyTrait(Operation *op) {
static_assert(OpTy::template hasTrait<OpTrait::OneOperand>(),
"expected single-operand op");
diff --git a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td
index c5c4c61..9439104 100644
--- a/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td
+++ b/mlir/include/mlir/Dialect/Transform/Interfaces/TransformInterfaces.td
@@ -401,7 +401,7 @@ def ConversionPatternDescriptorOpInterface
Verify the default type converter that is provided by the enclosing
"apply_conversion_patterns" op.
}],
- /*returnType=*/"::mlir::LogicalResult",
+ /*returnType=*/"::llvm::LogicalResult",
/*name=*/"verifyTypeConverter",
/*arguments=*/(ins "TypeConverterBuilderOpInterface":$builder),
/*methodBody=*/"",
diff --git a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
index 4c16d40..e78cf77 100644
--- a/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
+++ b/mlir/include/mlir/Dialect/Transform/Transforms/TransformInterpreterUtils.h
@@ -16,7 +16,6 @@
#include <memory>
namespace mlir {
-struct LogicalResult;
class MLIRContext;
class ModuleOp;
class Operation;
diff --git a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
index fa2912a..8e6d36f 100644
--- a/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
+++ b/mlir/include/mlir/Dialect/Vector/Transforms/VectorRewritePatterns.h
@@ -15,7 +15,6 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Dialect/Vector/Transforms/VectorTransformsEnums.h.inc"
diff --git a/mlir/include/mlir/ExecutionEngine/JitRunner.h b/mlir/include/mlir/ExecutionEngine/JitRunner.h
index 2dde094..b4210f6 100644
--- a/mlir/include/mlir/ExecutionEngine/JitRunner.h
+++ b/mlir/include/mlir/ExecutionEngine/JitRunner.h
@@ -24,6 +24,7 @@
namespace llvm {
class Module;
class LLVMContext;
+struct LogicalResult;
namespace orc {
class MangleAndInterner;
@@ -34,7 +35,6 @@ namespace mlir {
class DialectRegistry;
class Operation;
-struct LogicalResult;
/// JitRunner command line options used by JitRunnerConfig methods
struct JitRunnerOptions {
@@ -48,8 +48,8 @@ struct JitRunnerOptions {
struct JitRunnerConfig {
/// MLIR transformer applied after parsing the input into MLIR IR and before
/// passing the MLIR IR to the ExecutionEngine.
- llvm::function_ref<LogicalResult(mlir::Operation *,
- JitRunnerOptions &options)>
+ llvm::function_ref<llvm::LogicalResult(mlir::Operation *,
+ JitRunnerOptions &options)>
mlirTransformer = nullptr;
/// A custom function that is passed to ExecutionEngine. It processes MLIR and
diff --git a/mlir/include/mlir/IR/Action.h b/mlir/include/mlir/IR/Action.h
index 9359324d..2fad477 100644
--- a/mlir/include/mlir/IR/Action.h
+++ b/mlir/include/mlir/IR/Action.h
@@ -16,7 +16,6 @@
#define MLIR_IR_ACTION_H
#include "mlir/IR/Unit.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/Sequence.h"
diff --git a/mlir/include/mlir/IR/AffineExpr.h b/mlir/include/mlir/IR/AffineExpr.h
index 63314cc..a93e74b 100644
--- a/mlir/include/mlir/IR/AffineExpr.h
+++ b/mlir/include/mlir/IR/AffineExpr.h
@@ -20,7 +20,6 @@
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
-#include <functional>
#include <type_traits>
namespace mlir {
diff --git a/mlir/include/mlir/IR/AffineExprVisitor.h b/mlir/include/mlir/IR/AffineExprVisitor.h
index fc4cd915..1826f5f 100644
--- a/mlir/include/mlir/IR/AffineExprVisitor.h
+++ b/mlir/include/mlir/IR/AffineExprVisitor.h
@@ -14,7 +14,7 @@
#define MLIR_IR_AFFINEEXPRVISITOR_H
#include "mlir/IR/AffineExpr.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "llvm/ADT/ArrayRef.h"
namespace mlir {
diff --git a/mlir/include/mlir/IR/AffineMap.h b/mlir/include/mlir/IR/AffineMap.h
index cce1412..264c1c8 100644
--- a/mlir/include/mlir/IR/AffineMap.h
+++ b/mlir/include/mlir/IR/AffineMap.h
@@ -35,7 +35,6 @@ struct AffineMapStorage;
class Attribute;
class Builder;
-struct LogicalResult;
class OpFoldResult;
class MLIRContext;
diff --git a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
index b0b9493..c4a4202 100644
--- a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
+++ b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.h
@@ -13,7 +13,6 @@
#include "mlir/IR/Attributes.h"
#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/Types.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/raw_ostream.h"
#include <complex>
#include <optional>
diff --git a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
index c741db9..954429c 100644
--- a/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
+++ b/mlir/include/mlir/IR/BuiltinAttributeInterfaces.td
@@ -483,7 +483,7 @@ def MemRefLayoutAttrInterface : AttrInterface<"MemRefLayoutAttrInterface"> {
InterfaceMethod<
"Check if the current layout is applicable to the provided shape",
- "::mlir::LogicalResult", "verifyLayout",
+ "::llvm::LogicalResult", "verifyLayout",
(ins "::llvm::ArrayRef<int64_t>":$shape,
"::llvm::function_ref<::mlir::InFlightDiagnostic()>":$emitError),
[{}],
diff --git a/mlir/include/mlir/IR/Diagnostics.h b/mlir/include/mlir/IR/Diagnostics.h
index 205c5d9..bb2e1bb 100644
--- a/mlir/include/mlir/IR/Diagnostics.h
+++ b/mlir/include/mlir/IR/Diagnostics.h
@@ -25,7 +25,6 @@ class SourceMgr;
namespace mlir {
class DiagnosticEngine;
-struct LogicalResult;
class MLIRContext;
class Operation;
class OperationName;
diff --git a/mlir/include/mlir/IR/Dialect.h b/mlir/include/mlir/IR/Dialect.h
index f7c1f4d..f3e5f6d 100644
--- a/mlir/include/mlir/IR/Dialect.h
+++ b/mlir/include/mlir/IR/Dialect.h
@@ -17,9 +17,6 @@
#include "mlir/IR/OperationSupport.h"
#include "mlir/Support/TypeID.h"
-#include <map>
-#include <tuple>
-
namespace mlir {
class DialectAsmParser;
class DialectAsmPrinter;
diff --git a/mlir/include/mlir/IR/EnumAttr.td b/mlir/include/mlir/IR/EnumAttr.td
index f4dc480..9fec28f 100644
--- a/mlir/include/mlir/IR/EnumAttr.td
+++ b/mlir/include/mlir/IR/EnumAttr.td
@@ -227,7 +227,7 @@ class IntEnumAttr<I intType, string name, string summary,
stringToSymbolFnName # [{(enumKeyword);
if (maybeEnum)
return *maybeEnum;
- return {(::mlir::LogicalResult)($_parser.emitError(loc) << "expected " }] #
+ return {(::llvm::LogicalResult)($_parser.emitError(loc) << "expected " }] #
[{<< "}] # cppType # [{" << " to be one of: " << }] #
!interleave(!foreach(enum, enumerants, "\"" # enum.str # "\""),
[{ << ", " << }]) # [{)};
@@ -300,7 +300,7 @@ class BitEnumAttr<I intType, string name, string summary,
auto maybeEnum = }] # cppNamespace # "::" #
stringToSymbolFnName # [{(enumKeyword);
if (!maybeEnum) {
- return {(::mlir::LogicalResult)($_parser.emitError(loc) << }] #
+ return {(::llvm::LogicalResult)($_parser.emitError(loc) << }] #
[{"expected " << "}] # cppType # [{" << " to be one of: " << }] #
!interleave(!foreach(enum, enumerants, "\"" # enum.str # "\""),
[{ << ", " << }]) # [{)};
diff --git a/mlir/include/mlir/IR/ExtensibleDialect.h b/mlir/include/mlir/IR/ExtensibleDialect.h
index 5ae1e9a..494f3df 100644
--- a/mlir/include/mlir/IR/ExtensibleDialect.h
+++ b/mlir/include/mlir/IR/ExtensibleDialect.h
@@ -38,7 +38,6 @@ class DynamicType;
class ExtensibleDialect;
class MLIRContext;
class OptionalParseResult;
-class ParseResult;
namespace detail {
struct DynamicAttrStorage;
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index f8ab533..1b93f3d 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -51,7 +51,6 @@ class OpAsmPrinter;
class OperandRange;
class OperandRangeRange;
class OpFoldResult;
-class ParseResult;
class Pattern;
class Region;
class ResultRange;
diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h
index 982d522..fb64f15 100644
--- a/mlir/include/mlir/IR/StorageUniquerSupport.h
+++ b/mlir/include/mlir/IR/StorageUniquerSupport.h
@@ -16,7 +16,6 @@
#include "mlir/IR/AttrTypeSubElements.h"
#include "mlir/IR/DialectRegistry.h"
#include "mlir/Support/InterfaceSupport.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/StorageUniquer.h"
#include "mlir/Support/TypeID.h"
#include "llvm/ADT/FunctionExtras.h"
diff --git a/mlir/include/mlir/IR/SymbolInterfaces.td b/mlir/include/mlir/IR/SymbolInterfaces.td
index 60b3818..a8b04d0 100644
--- a/mlir/include/mlir/IR/SymbolInterfaces.td
+++ b/mlir/include/mlir/IR/SymbolInterfaces.td
@@ -121,7 +121,7 @@ def Symbol : OpInterface<"SymbolOpInterface"> {
symbol 'newSymbol' that are nested within the given operation 'from'.
Note: See mlir::SymbolTable::replaceAllSymbolUses for more details.
}],
- "::mlir::LogicalResult", "replaceAllSymbolUses",
+ "::llvm::LogicalResult", "replaceAllSymbolUses",
(ins "::mlir::StringAttr":$newSymbol, "::mlir::Operation *":$from), [{}],
/*defaultImplementation=*/[{
return ::mlir::SymbolTable::replaceAllSymbolUses(this->getOperation(),
@@ -214,7 +214,7 @@ def SymbolUserOpInterface : OpInterface<"SymbolUserOpInterface"> {
let methods = [
InterfaceMethod<"Verify the symbol uses held by this operation.",
- "::mlir::LogicalResult", "verifySymbolUses",
+ "::llvm::LogicalResult", "verifySymbolUses",
(ins "::mlir::SymbolTableCollection &":$symbolTable)
>,
];
diff --git a/mlir/include/mlir/IR/TensorEncoding.td b/mlir/include/mlir/IR/TensorEncoding.td
index 4907dcb..d8ccd1f 100644
--- a/mlir/include/mlir/IR/TensorEncoding.td
+++ b/mlir/include/mlir/IR/TensorEncoding.td
@@ -31,7 +31,7 @@ def VerifiableTensorEncoding : AttrInterface<"VerifiableTensorEncoding"> {
given shape and element type. Generates a diagnostic using
the supplied callback on failure.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyEncoding",
/*args=*/(ins
"::mlir::ArrayRef<int64_t>":$shape,
diff --git a/mlir/include/mlir/IR/Verifier.h b/mlir/include/mlir/IR/Verifier.h
index 1fcc99e..eb96d11 100644
--- a/mlir/include/mlir/IR/Verifier.h
+++ b/mlir/include/mlir/IR/Verifier.h
@@ -9,8 +9,9 @@
#ifndef MLIR_IR_VERIFIER_H
#define MLIR_IR_VERIFIER_H
+#include "mlir/Support/LLVM.h"
+
namespace mlir {
-struct LogicalResult;
class Operation;
/// Perform (potentially expensive) checks of invariants, used to detect
diff --git a/mlir/include/mlir/IR/Visitors.h b/mlir/include/mlir/IR/Visitors.h
index fe98774..15abf25 100644
--- a/mlir/include/mlir/IR/Visitors.h
+++ b/mlir/include/mlir/IR/Visitors.h
@@ -14,7 +14,6 @@
#define MLIR_IR_VISITORS_H
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
namespace mlir {
diff --git a/mlir/include/mlir/InitAllPasses.h b/mlir/include/mlir/InitAllPasses.h
index fedd773..1b9c1b1 100644
--- a/mlir/include/mlir/InitAllPasses.h
+++ b/mlir/include/mlir/InitAllPasses.h
@@ -98,9 +98,7 @@ inline void registerAllPasses() {
bufferization::registerBufferizationPipelines();
sparse_tensor::registerSparseTensorPipelines();
tosa::registerTosaToLinalgPipelines();
-#if LLVM_HAS_NVPTX_TARGET
gpu::registerGPUToNVVMPipeline();
-#endif
}
} // namespace mlir
diff --git a/mlir/include/mlir/Interfaces/DataLayoutInterfaces.td b/mlir/include/mlir/Interfaces/DataLayoutInterfaces.td
index d4b8999..bc5080c 100644
--- a/mlir/include/mlir/Interfaces/DataLayoutInterfaces.td
+++ b/mlir/include/mlir/Interfaces/DataLayoutInterfaces.td
@@ -52,7 +52,7 @@ def DataLayoutEntryInterface : AttrInterface<"DataLayoutEntryInterface"> {
InterfaceMethod<
/*description=*/"Checks that the entry is well-formed, reports errors "
"at the provided location.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyEntry",
/*args=*/(ins "::mlir::Location":$loc),
/*methodBody=*/"",
@@ -166,7 +166,7 @@ def DataLayoutSpecInterface : AttrInterface<"DataLayoutSpecInterface"> {
InterfaceMethod<
/*description=*/"Verifies the validity of the specification and reports "
"any errors at the given location.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifySpec",
/*args=*/(ins "::mlir::Location":$loc),
/*methodBody=*/"",
@@ -232,7 +232,7 @@ def TargetDeviceSpecInterface : AttrInterface<"TargetDeviceSpecInterface"> {
InterfaceMethod<
/*description=*/"Checks that the entry is well-formed, reports errors "
"at the provided location.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyEntry",
/*args=*/(ins "::mlir::Location":$loc),
/*methodBody=*/"",
@@ -275,7 +275,7 @@ def TargetSystemSpecInterface : AttrInterface<"TargetSystemSpecInterface"> {
InterfaceMethod<
/*description=*/"Verifies the validity of the specification and "
"reports any errors at the given location.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifySpec",
/*args=*/(ins "::mlir::Location":$loc),
/*methodBody=*/"",
@@ -574,7 +574,7 @@ def DataLayoutTypeInterface : TypeInterface<"DataLayoutTypeInterface"> {
InterfaceMethod<
/*description=*/"Verifies that the given list of entries is valid for "
"this type.",
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"verifyEntries",
/*args=*/(ins "::mlir::DataLayoutEntryListRef":$entries,
"::mlir::Location":$loc),
diff --git a/mlir/include/mlir/Interfaces/FoldInterfaces.h b/mlir/include/mlir/Interfaces/FoldInterfaces.h
index 6278e31..b3d1161 100644
--- a/mlir/include/mlir/Interfaces/FoldInterfaces.h
+++ b/mlir/include/mlir/Interfaces/FoldInterfaces.h
@@ -9,7 +9,6 @@
#define MLIR_INTERFACES_FOLDINTERFACES_H_
#include "mlir/IR/DialectInterface.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/include/mlir/Interfaces/FunctionInterfaces.td b/mlir/include/mlir/Interfaces/FunctionInterfaces.td
index 873853e..697f951 100644
--- a/mlir/include/mlir/Interfaces/FunctionInterfaces.td
+++ b/mlir/include/mlir/Interfaces/FunctionInterfaces.td
@@ -83,7 +83,7 @@ def FunctionOpInterface : OpInterface<"FunctionOpInterface", [
Note: The default implementation merely checks that if the entry block
exists, it has the same number and type of arguments as the function type.
}],
- "::mlir::LogicalResult", "verifyBody", (ins),
+ "::llvm::LogicalResult", "verifyBody", (ins),
/*methodBody=*/[{}], /*defaultImplementation=*/[{
if ($_op.isExternal())
return success();
@@ -114,7 +114,7 @@ def FunctionOpInterface : OpInterface<"FunctionOpInterface", [
Verify the type attribute of the function for derived op-specific
invariants.
}],
- "::mlir::LogicalResult", "verifyType", (ins),
+ "::llvm::LogicalResult", "verifyType", (ins),
/*methodBody=*/[{}], /*defaultImplementation=*/[{
return success();
}]>,
diff --git a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
index a009e21..92d4a99 100644
--- a/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
+++ b/mlir/include/mlir/Interfaces/InferTypeOpInterface.td
@@ -38,7 +38,7 @@ def InferTypeOpInterface : OpInterface<"InferTypeOpInterface"> {
called with valid arguments, e.g., operands are verified, or it may result
in an undefined behavior.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"inferReturnTypes",
/*args=*/(ins "::mlir::MLIRContext *":$context,
"::std::optional<::mlir::Location>":$location,
@@ -72,7 +72,7 @@ def InferTypeOpInterface : OpInterface<"InferTypeOpInterface"> {
represent fully valid IR and are responsible for checking inputs for
validity to the degree necessary to perform the return type inference.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"refineReturnTypes",
/*args=*/(ins "::mlir::MLIRContext *":$context,
"::std::optional<::mlir::Location>":$location,
@@ -150,7 +150,7 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
represent fully valid IR and are responsible for checking inputs for
validity to the degree necessary to perform the return type inference.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"inferReturnTypeComponents",
/*args=*/(ins "::mlir::MLIRContext*":$context,
"::std::optional<::mlir::Location>":$location,
@@ -180,7 +180,7 @@ def InferShapedTypeOpInterface : OpInterface<"InferShapedTypeOpInterface"> {
operands to avoid calling `getOperand` directly inside the interface
implementation.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"reifyReturnTypeShapes",
/*args=*/(ins "::mlir::OpBuilder&":$builder,
"::mlir::ValueRange":$operands,
@@ -201,14 +201,14 @@ class InferTypeOpAdaptorBase<code additionalDecls = [{}]> : TraitList<
/*name=*/"InferTypeOpAdaptor",
/*traits=*/[],
/*extraOpDeclaration=*/[{
- static ::mlir::LogicalResult
+ static ::llvm::LogicalResult
inferReturnTypes(::mlir::MLIRContext *context,
std::optional<::mlir::Location> location,
Adaptor adaptor,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes);
}] # additionalDecls,
/*extraOpDefinition=*/[{
- ::mlir::LogicalResult
+ ::llvm::LogicalResult
$cppClass::inferReturnTypes(::mlir::MLIRContext *context,
std::optional<::mlir::Location> location,
::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
@@ -239,14 +239,14 @@ class InferShapedTypeOpAdaptorBase<list<string> overridenMethods = []> : TraitLi
/*name=*/"InferShapedTypeOpAdaptor",
/*traits=*/[],
/*extraOpDeclaration=*/[{
- static ::mlir::LogicalResult
+ static ::llvm::LogicalResult
inferReturnTypeComponents(::mlir::MLIRContext *context,
std::optional<::mlir::Location> location,
Adaptor adaptor,
::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents> &inferredReturnShapes);
}],
/*extraOpDefinition=*/[{
- ::mlir::LogicalResult
+ ::llvm::LogicalResult
$cppClass::inferReturnTypeComponents(::mlir::MLIRContext *context,
std::optional<::mlir::Location> location,
::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes,
@@ -281,7 +281,7 @@ class InferTensorTypeBase<list<string> overridenMethods = []> : TraitList<
/*traits=*/[],
/*extraOpDeclaration=*/[{}],
/*extraOpDefinition=*/[{
- ::mlir::LogicalResult
+ ::llvm::LogicalResult
$cppClass::inferReturnTypes(::mlir::MLIRContext *context,
std::optional<::mlir::Location> location,
::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
@@ -364,7 +364,7 @@ def ReifyRankedShapedTypeOpInterface :
If the shape of a particular result cannot be computed it must be empty.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"reifyResultShapes",
/*args=*/(ins "::mlir::OpBuilder &":$builder,
"::mlir::ReifiedRankedShapedTypeDims &":$reifiedReturnShapes)
diff --git a/mlir/include/mlir/Interfaces/LoopLikeInterface.td b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
index 7db624b..c6bffe3 100644
--- a/mlir/include/mlir/Interfaces/LoopLikeInterface.td
+++ b/mlir/include/mlir/Interfaces/LoopLikeInterface.td
@@ -84,7 +84,7 @@ def LoopLikeOpInterface : OpInterface<"LoopLikeOpInterface"> {
have a single iteration. Returns "success" if the promotion was
successful.
}],
- /*retTy=*/"::mlir::LogicalResult",
+ /*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"promoteIfSingleIteration",
/*args=*/(ins "::mlir::RewriterBase &":$rewriter),
/*methodBody=*/"",
diff --git a/mlir/include/mlir/Interfaces/MemorySlotInterfaces.td b/mlir/include/mlir/Interfaces/MemorySlotInterfaces.td
index 6f023f0..fbce2fa 100644
--- a/mlir/include/mlir/Interfaces/MemorySlotInterfaces.td
+++ b/mlir/include/mlir/Interfaces/MemorySlotInterfaces.td
@@ -75,7 +75,7 @@ def PromotableAllocationOpInterface
"::std::optional<::mlir::PromotableAllocationOpInterface>",
"handlePromotionComplete",
(ins
- "const ::mlir::MemorySlot &":$slot,
+ "const ::mlir::MemorySlot &":$slot,
"::mlir::Value":$defaultValue,
"::mlir::OpBuilder &":$builder)
>,
@@ -308,7 +308,7 @@ def DestructurableAllocationOpInterface
This will only be called for slots declared by this operation.
Must return a new destructurable allocation op if this hook creates
- a new destructurable op, nullopt otherwise.
+ a new destructurable op, nullopt otherwise.
}],
"::std::optional<::mlir::DestructurableAllocationOpInterface>",
"handleDestructuringComplete",
@@ -338,7 +338,7 @@ def SafeMemorySlotAccessOpInterface
No IR mutation is allowed in this method.
}],
- "::mlir::LogicalResult",
+ "::llvm::LogicalResult",
"ensureOnlySafeAccesses",
(ins "const ::mlir::MemorySlot &":$slot,
"::mlir::SmallVectorImpl<::mlir::MemorySlot> &":$mustBeSafelyUsed,
diff --git a/mlir/include/mlir/Interfaces/TilingInterface.td b/mlir/include/mlir/Interfaces/TilingInterface.td
index ad0af0a..4868dad 100644
--- a/mlir/include/mlir/Interfaces/TilingInterface.td
+++ b/mlir/include/mlir/Interfaces/TilingInterface.td
@@ -26,7 +26,7 @@ def TilingInterface : OpInterface<"TilingInterface"> {
the tiling algorithm (like `scf::tileUsingSCF`) can generate the inter-tile
loop structure, and call into the methods of the interface to be able to
tile any operation that implements the interface.
-
+
This interface is also meant to help with "tile and fuse", i.e. the process
of fusing a producer with a consumer by
a) Tiling the consumer
@@ -50,7 +50,7 @@ def TilingInterface : OpInterface<"TilingInterface"> {
For an operation to be "tiled and fused" with its (already tiled) consumer,
an operation has to implement the following additional method (see
- description below):
+ description below):
- `generateResultTileValue`
- `getIterationDomainTileFromResultTile`
@@ -146,7 +146,7 @@ def TilingInterface : OpInterface<"TilingInterface"> {
Note: It is undefined behaviour if there is overlap between the
tiles of the result generated by the tiled implementation.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"getResultTilePosition",
/*args=*/(ins
"OpBuilder &":$b,
@@ -289,7 +289,7 @@ def TilingInterface : OpInterface<"TilingInterface"> {
implemented using `getIterationDomainTileFromOperandTile` +
`getTiledImplementation` methods.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"getIterationDomainTileFromOperandTile",
/*args=*/(ins
"OpBuilder &":$b,
@@ -317,14 +317,14 @@ def TilingInterface : OpInterface<"TilingInterface"> {
- `sizes` is the size of the slice of the producer result used by the
consumer.
If fusion of the producer with the consumer is not legal for the
- result, or if this mapping cannot be computed, the implementation
+ result, or if this mapping cannot be computed, the implementation
should return a failure.
-
- For most cases `generateResultTileValue` could be a implemented using
- `getIterationDomainTileFromResultTile` + `getTiledImplementation`
+
+ For most cases `generateResultTileValue` could be a implemented using
+ `getIterationDomainTileFromResultTile` + `getTiledImplementation`
methods.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"getIterationDomainTileFromResultTile",
/*args=*/(ins
"OpBuilder &":$b,
@@ -349,7 +349,7 @@ def TilingInterface : OpInterface<"TilingInterface"> {
transformations are done, this method can be used to lower to scalar
code that can then be lowered to LLVM or SPIR-V dialects.
}],
- /*retType=*/"::mlir::LogicalResult",
+ /*retType=*/"::llvm::LogicalResult",
/*methodName=*/"generateScalarImplementation",
/*args=*/(ins
"OpBuilder &":$b,
diff --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index e71c49a..7725a3a 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -12,7 +12,6 @@
#include "mlir/IR/Action.h"
#include "mlir/Pass/AnalysisManager.h"
#include "mlir/Pass/PassRegistry.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/Statistic.h"
#include <optional>
diff --git a/mlir/include/mlir/Pass/PassManager.h b/mlir/include/mlir/Pass/PassManager.h
index b3e4275..d9bab43 100644
--- a/mlir/include/mlir/Pass/PassManager.h
+++ b/mlir/include/mlir/Pass/PassManager.h
@@ -11,7 +11,6 @@
#include "mlir/IR/Dialect.h"
#include "mlir/IR/OperationSupport.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/Timing.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator.h"
diff --git a/mlir/include/mlir/Pass/PassOptions.h b/mlir/include/mlir/Pass/PassOptions.h
index 3a5e322..b99d91f 100644
--- a/mlir/include/mlir/Pass/PassOptions.h
+++ b/mlir/include/mlir/Pass/PassOptions.h
@@ -15,7 +15,6 @@
#define MLIR_PASS_PASSOPTIONS_H_
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
diff --git a/mlir/include/mlir/Query/Query.h b/mlir/include/mlir/Query/Query.h
index 447fc7c..18f2172 100644
--- a/mlir/include/mlir/Query/Query.h
+++ b/mlir/include/mlir/Query/Query.h
@@ -10,7 +10,6 @@
#define MLIR_TOOLS_MLIRQUERY_QUERY_H
#include "Matcher/VariantValue.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/LineEditor/LineEditor.h"
@@ -27,7 +26,7 @@ struct Query : llvm::RefCountedBase<Query> {
virtual ~Query();
// Perform the query on qs and print output to os.
- virtual mlir::LogicalResult run(llvm::raw_ostream &os,
+ virtual llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const = 0;
llvm::StringRef remainingContent;
@@ -45,7 +44,7 @@ complete(llvm::StringRef line, size_t pos, const QuerySession &qs);
struct InvalidQuery : Query {
InvalidQuery(const llvm::Twine &errStr)
: Query(QueryKind::Invalid), errStr(errStr.str()) {}
- mlir::LogicalResult run(llvm::raw_ostream &os,
+ llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const override;
std::string errStr;
@@ -58,7 +57,7 @@ struct InvalidQuery : Query {
// No-op query (i.e. a blank line).
struct NoOpQuery : Query {
NoOpQuery() : Query(QueryKind::NoOp) {}
- mlir::LogicalResult run(llvm::raw_ostream &os,
+ llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const override;
static bool classof(const Query *query) {
@@ -69,7 +68,7 @@ struct NoOpQuery : Query {
// Query for "help".
struct HelpQuery : Query {
HelpQuery() : Query(QueryKind::Help) {}
- mlir::LogicalResult run(llvm::raw_ostream &os,
+ llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const override;
static bool classof(const Query *query) {
@@ -80,7 +79,7 @@ struct HelpQuery : Query {
// Query for "quit".
struct QuitQuery : Query {
QuitQuery() : Query(QueryKind::Quit) {}
- mlir::LogicalResult run(llvm::raw_ostream &os,
+ llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const override;
static bool classof(const Query *query) {
@@ -92,7 +91,7 @@ struct QuitQuery : Query {
struct MatchQuery : Query {
MatchQuery(llvm::StringRef source, const matcher::DynMatcher &matcher)
: Query(QueryKind::Match), matcher(matcher), source(source) {}
- mlir::LogicalResult run(llvm::raw_ostream &os,
+ llvm::LogicalResult run(llvm::raw_ostream &os,
QuerySession &qs) const override;
const matcher::DynMatcher matcher;
diff --git a/mlir/include/mlir/Reducer/ReductionNode.h b/mlir/include/mlir/Reducer/ReductionNode.h
index 814c885..6ca4e13 100644
--- a/mlir/include/mlir/Reducer/ReductionNode.h
+++ b/mlir/include/mlir/Reducer/ReductionNode.h
@@ -22,7 +22,6 @@
#include "mlir/IR/OwningOpRef.h"
#include "mlir/Reducer/Tester.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/ToolOutputFile.h"
diff --git a/mlir/include/mlir/Support/LLVM.h b/mlir/include/mlir/Support/LLVM.h
index 7baca03..020c0fb 100644
--- a/mlir/include/mlir/Support/LLVM.h
+++ b/mlir/include/mlir/Support/LLVM.h
@@ -21,7 +21,10 @@
// We include this header because it cannot be practically forward
// declared, and are effectively language features.
#include "llvm/Support/Casting.h"
-#include <vector>
+
+// We include this header because large portions of mlir would have to include
+// it anyway.
+#include "llvm/Support/LogicalResult.h"
// Workaround for clang-5 (PR41549)
#if defined(__clang_major__)
@@ -151,6 +154,15 @@ using llvm::iterator_range;
using llvm::raw_ostream;
using llvm::SMLoc;
using llvm::SMRange;
+
+// LogicalResult.
+using llvm::failed;
+using llvm::failure;
+using llvm::FailureOr;
+using llvm::LogicalResult;
+using llvm::ParseResult;
+using llvm::succeeded;
+using llvm::success;
} // namespace mlir
#endif // MLIR_SUPPORT_LLVM_H
diff --git a/mlir/include/mlir/Support/LogicalResult.h b/mlir/include/mlir/Support/LogicalResult.h
index 7ee7046..c7da8de 100644
--- a/mlir/include/mlir/Support/LogicalResult.h
+++ b/mlir/include/mlir/Support/LogicalResult.h
@@ -1,4 +1,4 @@
-//===- LogicalResult.h - Utilities for handling success/failure -*- C++ -*-===//
+//===- LogicalResult.h - Stub aliasing to llvm/LogicalResult ----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -9,123 +9,18 @@
#ifndef MLIR_SUPPORT_LOGICALRESULT_H
#define MLIR_SUPPORT_LOGICALRESULT_H
-#include "mlir/Support/LLVM.h"
-#include <optional>
+#include "llvm/Support/LogicalResult.h"
+// TODO: This header is a stop-gap to avoid breaking downstream, and is to be
+// removed eventually.
namespace mlir {
-
-/// This class represents an efficient way to signal success or failure. It
-/// should be preferred over the use of `bool` when appropriate, as it avoids
-/// all of the ambiguity that arises in interpreting a boolean result. This
-/// class is marked as NODISCARD to ensure that the result is processed. Users
-/// may explicitly discard a result by using `(void)`, e.g.
-/// `(void)functionThatReturnsALogicalResult();`. Given the intended nature of
-/// this class, it generally shouldn't be used as the result of functions that
-/// very frequently have the result ignored. This class is intended to be used
-/// in conjunction with the utility functions below.
-struct [[nodiscard]] LogicalResult {
-public:
- /// If isSuccess is true a `success` result is generated, otherwise a
- /// 'failure' result is generated.
- static LogicalResult success(bool isSuccess = true) {
- return LogicalResult(isSuccess);
- }
-
- /// If isFailure is true a `failure` result is generated, otherwise a
- /// 'success' result is generated.
- static LogicalResult failure(bool isFailure = true) {
- return LogicalResult(!isFailure);
- }
-
- /// Returns true if the provided LogicalResult corresponds to a success value.
- bool succeeded() const { return isSuccess; }
-
- /// Returns true if the provided LogicalResult corresponds to a failure value.
- bool failed() const { return !isSuccess; }
-
-private:
- LogicalResult(bool isSuccess) : isSuccess(isSuccess) {}
-
- /// Boolean indicating if this is a success result, if false this is a
- /// failure result.
- bool isSuccess;
-};
-
-/// Utility function to generate a LogicalResult. If isSuccess is true a
-/// `success` result is generated, otherwise a 'failure' result is generated.
-inline LogicalResult success(bool isSuccess = true) {
- return LogicalResult::success(isSuccess);
-}
-
-/// Utility function to generate a LogicalResult. If isFailure is true a
-/// `failure` result is generated, otherwise a 'success' result is generated.
-inline LogicalResult failure(bool isFailure = true) {
- return LogicalResult::failure(isFailure);
-}
-
-/// Utility function that returns true if the provided LogicalResult corresponds
-/// to a success value.
-inline bool succeeded(LogicalResult result) { return result.succeeded(); }
-
-/// Utility function that returns true if the provided LogicalResult corresponds
-/// to a failure value.
-inline bool failed(LogicalResult result) { return result.failed(); }
-
-/// This class provides support for representing a failure result, or a valid
-/// value of type `T`. This allows for integrating with LogicalResult, while
-/// also providing a value on the success path.
-template <typename T>
-class [[nodiscard]] FailureOr : public std::optional<T> {
-public:
- /// Allow constructing from a LogicalResult. The result *must* be a failure.
- /// Success results should use a proper instance of type `T`.
- FailureOr(LogicalResult result) {
- assert(failed(result) &&
- "success should be constructed with an instance of 'T'");
- }
- FailureOr() : FailureOr(failure()) {}
- FailureOr(T &&y) : std::optional<T>(std::forward<T>(y)) {}
- FailureOr(const T &y) : std::optional<T>(y) {}
- template <typename U,
- std::enable_if_t<std::is_constructible<T, U>::value> * = nullptr>
- FailureOr(const FailureOr<U> &other)
- : std::optional<T>(failed(other) ? std::optional<T>()
- : std::optional<T>(*other)) {}
-
- operator LogicalResult() const { return success(this->has_value()); }
-
-private:
- /// Hide the bool conversion as it easily creates confusion.
- using std::optional<T>::operator bool;
- using std::optional<T>::has_value;
-};
-
-/// Wrap a value on the success path in a FailureOr of the same value type.
-template <typename T,
- typename = std::enable_if_t<!std::is_convertible_v<T, bool>>>
-inline auto success(T &&t) {
- return FailureOr<std::decay_t<T>>(std::forward<T>(t));
-}
-
-/// This class represents success/failure for parsing-like operations that find
-/// it important to chain together failable operations with `||`. This is an
-/// extended version of `LogicalResult` that allows for explicit conversion to
-/// bool.
-///
-/// This class should not be used for general error handling cases - we prefer
-/// to keep the logic explicit with the `succeeded`/`failed` predicates.
-/// However, traditional monadic-style parsing logic can sometimes get
-/// swallowed up in boilerplate without this, so we provide this for narrow
-/// cases where it is important.
-///
-class [[nodiscard]] ParseResult : public LogicalResult {
-public:
- ParseResult(LogicalResult result = success()) : LogicalResult(result) {}
-
- /// Failure is true in a boolean context.
- explicit operator bool() const { return failed(); }
-};
-
+using llvm::failed;
+using llvm::failure;
+using llvm::FailureOr;
+using llvm::LogicalResult;
+using llvm::ParseResult;
+using llvm::succeeded;
+using llvm::success;
} // namespace mlir
#endif // MLIR_SUPPORT_LOGICALRESULT_H
diff --git a/mlir/include/mlir/Support/StorageUniquer.h b/mlir/include/mlir/Support/StorageUniquer.h
index 2369d9c..26bdf09 100644
--- a/mlir/include/mlir/Support/StorageUniquer.h
+++ b/mlir/include/mlir/Support/StorageUniquer.h
@@ -10,7 +10,6 @@
#define MLIR_SUPPORT_STORAGEUNIQUER_H
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseSet.h"
diff --git a/mlir/include/mlir/Support/ToolUtilities.h b/mlir/include/mlir/Support/ToolUtilities.h
index 511cb11..cb6ba29 100644
--- a/mlir/include/mlir/Support/ToolUtilities.h
+++ b/mlir/include/mlir/Support/ToolUtilities.h
@@ -24,8 +24,6 @@ class MemoryBuffer;
} // namespace llvm
namespace mlir {
-struct LogicalResult;
-
using ChunkBufferHandler = function_ref<LogicalResult(
std::unique_ptr<llvm::MemoryBuffer> chunkBuffer, raw_ostream &os)>;
diff --git a/mlir/include/mlir/Target/Cpp/CppEmitter.h b/mlir/include/mlir/Target/Cpp/CppEmitter.h
index d3c0810..99d8696 100644
--- a/mlir/include/mlir/Target/Cpp/CppEmitter.h
+++ b/mlir/include/mlir/Target/Cpp/CppEmitter.h
@@ -16,7 +16,6 @@
#include "mlir/Support/LLVM.h"
namespace mlir {
-struct LogicalResult;
class Operation;
namespace emitc {
diff --git a/mlir/include/mlir/Target/LLVM/ROCDL/Utils.h b/mlir/include/mlir/Target/LLVM/ROCDL/Utils.h
index 44c9ded..3c637a0 100644
--- a/mlir/include/mlir/Target/LLVM/ROCDL/Utils.h
+++ b/mlir/include/mlir/Target/LLVM/ROCDL/Utils.h
@@ -15,6 +15,7 @@
#include "mlir/Dialect/GPU/IR/CompilationInterfaces.h"
#include "mlir/Dialect/LLVMIR/ROCDLDialect.h"
+#include "mlir/Support/LLVM.h"
#include "mlir/Target/LLVM/ModuleToObject.h"
namespace mlir {
diff --git a/mlir/include/mlir/Target/LLVMIR/LLVMImportInterface.h b/mlir/include/mlir/Target/LLVMIR/LLVMImportInterface.h
index 86bcd58..74b5454 100644
--- a/mlir/include/mlir/Target/LLVMIR/LLVMImportInterface.h
+++ b/mlir/include/mlir/Target/LLVMIR/LLVMImportInterface.h
@@ -19,7 +19,6 @@
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/DialectInterface.h"
#include "mlir/IR/Location.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h b/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h
index 4a8ee06..11cb836 100644
--- a/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h
+++ b/mlir/include/mlir/Target/LLVMIR/LLVMTranslationInterface.h
@@ -16,7 +16,6 @@
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/DialectInterface.h"
-#include "mlir/Support/LogicalResult.h"
namespace llvm {
class Instruction;
diff --git a/mlir/include/mlir/Target/SPIRV/Serialization.h b/mlir/include/mlir/Target/SPIRV/Serialization.h
index 498f390..613f0a4 100644
--- a/mlir/include/mlir/Target/SPIRV/Serialization.h
+++ b/mlir/include/mlir/Target/SPIRV/Serialization.h
@@ -16,7 +16,6 @@
#include "mlir/Support/LLVM.h"
namespace mlir {
-struct LogicalResult;
class MLIRContext;
namespace spirv {
diff --git a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
index a8bae32..aaba810 100644
--- a/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
+++ b/mlir/include/mlir/Tools/PDLL/AST/Diagnostic.h
@@ -13,7 +13,6 @@
#include <optional>
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/Support/SourceMgr.h"
diff --git a/mlir/include/mlir/Tools/PDLL/CodeGen/MLIRGen.h b/mlir/include/mlir/Tools/PDLL/CodeGen/MLIRGen.h
index c691c39..c106f6d 100644
--- a/mlir/include/mlir/Tools/PDLL/CodeGen/MLIRGen.h
+++ b/mlir/include/mlir/Tools/PDLL/CodeGen/MLIRGen.h
@@ -11,8 +11,6 @@
#include <memory>
-#include "mlir/Support/LogicalResult.h"
-
namespace llvm {
class SourceMgr;
} // namespace llvm
diff --git a/mlir/include/mlir/Tools/PDLL/Parser/Parser.h b/mlir/include/mlir/Tools/PDLL/Parser/Parser.h
index 1a43a3b..6f62aaf 100644
--- a/mlir/include/mlir/Tools/PDLL/Parser/Parser.h
+++ b/mlir/include/mlir/Tools/PDLL/Parser/Parser.h
@@ -11,7 +11,7 @@
#include <memory>
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
namespace llvm {
class SourceMgr;
diff --git a/mlir/include/mlir/Tools/lsp-server-support/CompilationDatabase.h b/mlir/include/mlir/Tools/lsp-server-support/CompilationDatabase.h
index 84807ec..588c136 100644
--- a/mlir/include/mlir/Tools/lsp-server-support/CompilationDatabase.h
+++ b/mlir/include/mlir/Tools/lsp-server-support/CompilationDatabase.h
@@ -20,6 +20,7 @@
#include "llvm/ADT/StringMap.h"
#include <memory>
#include <string>
+#include <vector>
namespace mlir {
namespace lsp {
diff --git a/mlir/include/mlir/Tools/lsp-server-support/Protocol.h b/mlir/include/mlir/Tools/lsp-server-support/Protocol.h
index 1d22b8a..5d2eb01 100644
--- a/mlir/include/mlir/Tools/lsp-server-support/Protocol.h
+++ b/mlir/include/mlir/Tools/lsp-server-support/Protocol.h
@@ -28,15 +28,12 @@
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
#include <bitset>
-#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
namespace mlir {
-struct LogicalResult;
-
namespace lsp {
enum class ErrorCode {
diff --git a/mlir/include/mlir/Tools/lsp-server-support/Transport.h b/mlir/include/mlir/Tools/lsp-server-support/Transport.h
index 83fff92..6843bc7 100644
--- a/mlir/include/mlir/Tools/lsp-server-support/Transport.h
+++ b/mlir/include/mlir/Tools/lsp-server-support/Transport.h
@@ -17,7 +17,6 @@
#include "mlir/Support/DebugStringHelper.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/lsp-server-support/Logging.h"
#include "mlir/Tools/lsp-server-support/Protocol.h"
#include "llvm/ADT/FunctionExtras.h"
diff --git a/mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h b/mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h
index 5207106..66d5d40 100644
--- a/mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h
+++ b/mlir/include/mlir/Tools/mlir-lsp-server/MlirLspServerMain.h
@@ -13,15 +13,18 @@
#ifndef MLIR_TOOLS_MLIR_LSP_SERVER_MLIRLSPSERVERMAIN_H
#define MLIR_TOOLS_MLIR_LSP_SERVER_MLIRLSPSERVERMAIN_H
+namespace llvm {
+struct LogicalResult;
+} // namespace llvm
+
namespace mlir {
class DialectRegistry;
-struct LogicalResult;
/// Implementation for tools like `mlir-lsp-server`.
/// - registry should contain all the dialects that can be parsed in source IR
/// passed to the server.
-LogicalResult MlirLspServerMain(int argc, char **argv,
- DialectRegistry &registry);
+llvm::LogicalResult MlirLspServerMain(int argc, char **argv,
+ DialectRegistry &registry);
} // namespace mlir
diff --git a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
index 4f7f83c..d0ca188 100644
--- a/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
+++ b/mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
@@ -14,7 +14,6 @@
#define MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
#include "mlir/Debug/CLOptionsSetup.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/ToolUtilities.h"
#include "llvm/ADT/StringRef.h"
diff --git a/mlir/include/mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h b/mlir/include/mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h
index a193732..c45ddb6 100644
--- a/mlir/include/mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h
+++ b/mlir/include/mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h
@@ -14,11 +14,13 @@
#ifndef MLIR_TOOLS_MLIR_PDLL_LSP_SERVER_MLIRPDLLLSPSERVERMAIN_H
#define MLIR_TOOLS_MLIR_PDLL_LSP_SERVER_MLIRPDLLLSPSERVERMAIN_H
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+namespace mlir {
/// Implementation for tools like `mlir-pdll-lsp-server`.
-LogicalResult MlirPdllLspServerMain(int argc, char **argv);
+llvm::LogicalResult MlirPdllLspServerMain(int argc, char **argv);
} // namespace mlir
diff --git a/mlir/include/mlir/Tools/mlir-query/MlirQueryMain.h b/mlir/include/mlir/Tools/mlir-query/MlirQueryMain.h
index fa1cd5d..44d5c8d 100644
--- a/mlir/include/mlir/Tools/mlir-query/MlirQueryMain.h
+++ b/mlir/include/mlir/Tools/mlir-query/MlirQueryMain.h
@@ -15,7 +15,7 @@
#define MLIR_TOOLS_MLIRQUERY_MLIRQUERYMAIN_H
#include "mlir/Query/Matcher/Registry.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
namespace mlir {
diff --git a/mlir/include/mlir/Tools/mlir-reduce/MlirReduceMain.h b/mlir/include/mlir/Tools/mlir-reduce/MlirReduceMain.h
index fccff9e..cb215b3 100644
--- a/mlir/include/mlir/Tools/mlir-reduce/MlirReduceMain.h
+++ b/mlir/include/mlir/Tools/mlir-reduce/MlirReduceMain.h
@@ -9,7 +9,7 @@
#ifndef MLIR_TOOLS_MLIR_REDUCE_MLIRREDUCEMAIN_H
#define MLIR_TOOLS_MLIR_REDUCE_MLIRREDUCEMAIN_H
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
namespace mlir {
diff --git a/mlir/include/mlir/Tools/mlir-translate/MlirTranslateMain.h b/mlir/include/mlir/Tools/mlir-translate/MlirTranslateMain.h
index 4776987..c9bc58b 100644
--- a/mlir/include/mlir/Tools/mlir-translate/MlirTranslateMain.h
+++ b/mlir/include/mlir/Tools/mlir-translate/MlirTranslateMain.h
@@ -13,7 +13,7 @@
#ifndef MLIR_TOOLS_MLIRTRANSLATE_MLIRTRANSLATEMAIN_H
#define MLIR_TOOLS_MLIRTRANSLATE_MLIRTRANSLATEMAIN_H
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "llvm/ADT/StringRef.h"
namespace mlir {
diff --git a/mlir/include/mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h b/mlir/include/mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h
index 6859300..f0799c5 100644
--- a/mlir/include/mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h
+++ b/mlir/include/mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h
@@ -13,12 +13,13 @@
#ifndef MLIR_TOOLS_TBLGENLSPSERVER_TABLEGENLSPSERVERMAIN_H
#define MLIR_TOOLS_TBLGENLSPSERVER_TABLEGENLSPSERVERMAIN_H
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+namespace mlir {
/// Implementation for tools like `tblgen-lsp-server`.
-LogicalResult TableGenLspServerMain(int argc, char **argv);
-
+llvm::LogicalResult TableGenLspServerMain(int argc, char **argv);
} // namespace mlir
#endif // MLIR_TOOLS_TBLGENLSPSERVER_TABLEGENLSPSERVERMAIN_H
diff --git a/mlir/include/mlir/Transforms/HomomorphismSimplification.h b/mlir/include/mlir/Transforms/HomomorphismSimplification.h
index d273260..386a315 100644
--- a/mlir/include/mlir/Transforms/HomomorphismSimplification.h
+++ b/mlir/include/mlir/Transforms/HomomorphismSimplification.h
@@ -13,7 +13,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/Value.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include <iterator>
diff --git a/mlir/include/mlir/Transforms/Inliner.h b/mlir/include/mlir/Transforms/Inliner.h
index 073b83f..ec77319 100644
--- a/mlir/include/mlir/Transforms/Inliner.h
+++ b/mlir/include/mlir/Transforms/Inliner.h
@@ -17,7 +17,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Pass/AnalysisManager.h"
#include "mlir/Pass/PassManager.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/StringMap.h"
namespace mlir {
diff --git a/mlir/include/mlir/Transforms/LocationSnapshot.h b/mlir/include/mlir/Transforms/LocationSnapshot.h
index a2b4200..ccfdbac 100644
--- a/mlir/include/mlir/Transforms/LocationSnapshot.h
+++ b/mlir/include/mlir/Transforms/LocationSnapshot.h
@@ -21,7 +21,6 @@
namespace mlir {
class Location;
-struct LogicalResult;
class Operation;
class OpPrintingFlags;
class Pass;
diff --git a/mlir/include/mlir/Transforms/SROA.h b/mlir/include/mlir/Transforms/SROA.h
index d48f809..88e4bab 100644
--- a/mlir/include/mlir/Transforms/SROA.h
+++ b/mlir/include/mlir/Transforms/SROA.h
@@ -10,7 +10,7 @@
#define MLIR_TRANSFORMS_SROA_H
#include "mlir/Interfaces/MemorySlotInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "llvm/ADT/Statistic.h"
namespace mlir {
diff --git a/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp b/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
index b22f3fd..6cece46 100644
--- a/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
+++ b/mlir/lib/Analysis/AliasAnalysis/LocalAliasAnalysis.cpp
@@ -22,7 +22,6 @@
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Casting.h"
#include <cassert>
#include <optional>
diff --git a/mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp b/mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp
index 99c0419..16799d3 100644
--- a/mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/ConstantPropagationAnalysis.cpp
@@ -13,7 +13,6 @@
#include "mlir/IR/Operation.h"
#include "mlir/IR/Value.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
diff --git a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
index 64df74e..fab2bd8 100644
--- a/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/DeadCodeAnalysis.cpp
@@ -21,7 +21,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Casting.h"
#include <cassert>
#include <optional>
diff --git a/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp
index d4b9134..9894810 100644
--- a/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/DenseAnalysis.cpp
@@ -16,7 +16,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Casting.h"
#include <cassert>
diff --git a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
index b47bba1..ad956b7 100644
--- a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
@@ -18,7 +18,6 @@
#include "mlir/Interfaces/CallInterfaces.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/Casting.h"
#include <cassert>
diff --git a/mlir/lib/Analysis/DataFlowFramework.cpp b/mlir/lib/Analysis/DataFlowFramework.cpp
index 5ef24f2..d0e827a 100644
--- a/mlir/lib/Analysis/DataFlowFramework.cpp
+++ b/mlir/lib/Analysis/DataFlowFramework.cpp
@@ -10,7 +10,6 @@
#include "mlir/IR/Location.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/iterator.h"
#include "llvm/Config/abi-breaking.h"
#include "llvm/Support/Casting.h"
diff --git a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
index 18047a6..746cff5 100644
--- a/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
+++ b/mlir/lib/Analysis/FlatLinearValueConstraints.cpp
@@ -16,7 +16,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/IntegerSet.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/AsmParser/AffineParser.cpp b/mlir/lib/AsmParser/AffineParser.cpp
index 54c2a1f..1797611 100644
--- a/mlir/lib/AsmParser/AffineParser.cpp
+++ b/mlir/lib/AsmParser/AffineParser.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/IntegerSet.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
diff --git a/mlir/lib/AsmParser/AsmParserState.cpp b/mlir/lib/AsmParser/AsmParserState.cpp
index 47cfb52..589bf6a 100644
--- a/mlir/lib/AsmParser/AsmParserState.cpp
+++ b/mlir/lib/AsmParser/AsmParserState.cpp
@@ -13,7 +13,6 @@
#include "mlir/IR/Types.h"
#include "mlir/IR/Value.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/mlir/lib/AsmParser/DialectSymbolParser.cpp b/mlir/lib/AsmParser/DialectSymbolParser.cpp
index 80cce7e..9f4a87a 100644
--- a/mlir/lib/AsmParser/DialectSymbolParser.cpp
+++ b/mlir/lib/AsmParser/DialectSymbolParser.cpp
@@ -23,7 +23,6 @@
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SourceMgr.h"
#include <cassert>
diff --git a/mlir/lib/AsmParser/LocationParser.cpp b/mlir/lib/AsmParser/LocationParser.cpp
index fed65c0..1365da0 100644
--- a/mlir/lib/AsmParser/LocationParser.cpp
+++ b/mlir/lib/AsmParser/LocationParser.cpp
@@ -12,7 +12,6 @@
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Location.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
using namespace mlir;
using namespace mlir::detail;
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index 1b8b4ba..7181f13 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -34,7 +34,6 @@
#include "mlir/IR/Verifier.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/TypeID.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/DenseMap.h"
diff --git a/mlir/lib/AsmParser/TypeParser.cpp b/mlir/lib/AsmParser/TypeParser.cpp
index 5da931b..0b46c96 100644
--- a/mlir/lib/AsmParser/TypeParser.cpp
+++ b/mlir/lib/AsmParser/TypeParser.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/TensorEncoding.h"
#include "mlir/IR/Types.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include <cassert>
#include <cstdint>
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index dd1e4ab..f767740 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -17,7 +17,6 @@
#include "mlir/IR/Verifier.h"
#include "mlir/IR/Visitors.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
index 9493a6c..449d754 100644
--- a/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
+++ b/mlir/lib/Bytecode/Writer/BytecodeWriter.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Diagnostics.h"
#include "mlir/IR/OpImplementation.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/MapVector.h"
diff --git a/mlir/lib/CAPI/IR/BuiltinTypes.cpp b/mlir/lib/CAPI/IR/BuiltinTypes.cpp
index c94c070..01bb71d 100644
--- a/mlir/lib/CAPI/IR/BuiltinTypes.cpp
+++ b/mlir/lib/CAPI/IR/BuiltinTypes.cpp
@@ -16,7 +16,6 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Types.h"
-#include "mlir/Support/LogicalResult.h"
#include <algorithm>
diff --git a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp
index 3d3ff00..58764ad 100644
--- a/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp
+++ b/mlir/lib/Conversion/ArithToAMDGPU/ArithToAMDGPU.cpp
@@ -16,7 +16,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir {
diff --git a/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp b/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp
index 93717e3..7c6fdab 100644
--- a/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp
+++ b/mlir/lib/Conversion/ArithToEmitC/ArithToEmitC.cpp
@@ -17,7 +17,6 @@
#include "mlir/Dialect/EmitC/IR/EmitC.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
using namespace mlir;
diff --git a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
index 810f82f..2aae39f 100644
--- a/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
+++ b/mlir/lib/Conversion/BufferizationToMemRef/BufferizationToMemRef.cpp
@@ -21,7 +21,6 @@
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
namespace mlir {
diff --git a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp
index 995eecf..f96bfd6 100644
--- a/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp
+++ b/mlir/lib/Conversion/ControlFlowToSPIRV/ControlFlowToSPIRV.cpp
@@ -19,7 +19,6 @@
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
index efb8046..059acb2 100644
--- a/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
+++ b/mlir/lib/Conversion/FuncToLLVM/FuncToLLVM.cpp
@@ -35,7 +35,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp
index a575551..4740b7c 100644
--- a/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp
+++ b/mlir/lib/Conversion/FuncToSPIRV/FuncToSPIRV.cpp
@@ -18,7 +18,6 @@
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "func-to-spirv-pattern"
diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
index d7885e0..98340bf 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRV.cpp
@@ -21,7 +21,6 @@
#include "mlir/Dialect/SPIRV/Transforms/SPIRVConversion.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Matchers.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include <optional>
diff --git a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
index 81b9f55..90b0d72 100644
--- a/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
+++ b/mlir/lib/Conversion/MemRefToSPIRV/MemRefToSPIRV.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Visitors.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Debug.h"
#include <cassert>
#include <optional>
diff --git a/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp b/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
index d1d68e3..662ee9e 100644
--- a/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
+++ b/mlir/lib/Conversion/NVVMToLLVM/NVVMToLLVM.cpp
@@ -25,7 +25,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/raw_ostream.h"
#define DEBUG_TYPE "nvvm-to-llvm"
diff --git a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
index 885bb5a..da09384 100644
--- a/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
+++ b/mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
@@ -20,7 +20,6 @@
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/lib/Conversion/TensorToLinalg/TensorToLinalg.cpp b/mlir/lib/Conversion/TensorToLinalg/TensorToLinalg.cpp
index 0458073..5bb79d4 100644
--- a/mlir/lib/Conversion/TensorToLinalg/TensorToLinalg.cpp
+++ b/mlir/lib/Conversion/TensorToLinalg/TensorToLinalg.cpp
@@ -14,7 +14,6 @@
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "tensor-to-linalg-pattern"
diff --git a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
index 373952c..0fb5862 100644
--- a/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
+++ b/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
@@ -18,7 +18,6 @@
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/AffineMap.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/Debug.h"
#define DEBUG_TYPE "tensor-to-spirv-pattern"
diff --git a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
index 0fd91b27..0150ff6 100644
--- a/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
+++ b/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Region.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/Passes.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
index 8baa31a..c936329 100644
--- a/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
+++ b/mlir/lib/Conversion/VectorToSPIRV/VectorToSPIRV.cpp
@@ -25,7 +25,6 @@
#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp b/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
index 707bba2..16c0d3d 100644
--- a/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/AffineScalarReplacement.cpp
@@ -17,7 +17,6 @@
#include "mlir/Dialect/Affine/Utils.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/IR/Dominance.h"
-#include "mlir/Support/LogicalResult.h"
#include <algorithm>
namespace mlir {
diff --git a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
index 0e7beff..aa5eb95 100644
--- a/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
+++ b/mlir/lib/Dialect/Arith/IR/ArithOps.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp
index e0e1385..1c1f65e 100644
--- a/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/EmulateNarrowType.cpp
@@ -15,7 +15,6 @@
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/APInt.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
index 8a4080e..9c91dd7 100644
--- a/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/APInt.h"
#include "llvm/Support/FormatVariadic.h"
diff --git a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
index f87f3d6..e2d42e9 100644
--- a/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/IntNarrowing.cpp
@@ -21,7 +21,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/ValueBoundsOpInterface.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractionToSMMLAPattern.cpp b/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractionToSMMLAPattern.cpp
index 3635cd3..2c0c84d 100644
--- a/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractionToSMMLAPattern.cpp
+++ b/mlir/lib/Dialect/ArmNeon/Transforms/LowerContractionToSMMLAPattern.cpp
@@ -20,7 +20,6 @@
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#define DEBUG_TYPE "lower-contract-to-arm-neon"
diff --git a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
index 982d955..7fb4691 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/LowerDeallocations.cpp
@@ -19,7 +19,6 @@
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
namespace mlir {
diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
index 3abaa3b..7bc2668 100644
--- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
+++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp
@@ -29,7 +29,6 @@
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
diff --git a/mlir/lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp b/mlir/lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp
index f457303..fb44075 100644
--- a/mlir/lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp
+++ b/mlir/lib/Dialect/GPU/Pipelines/GPUToNVVMPipeline.cpp
@@ -38,7 +38,6 @@
using namespace mlir;
-#if LLVM_HAS_NVPTX_TARGET
namespace {
//===----------------------------------------------------------------------===//
@@ -126,5 +125,3 @@ void mlir::gpu::registerGPUToNVVMPipeline() {
"code.",
buildLowerToNVVMPassPipeline);
}
-
-#endif // LLVM_HAS_NVPTX_TARGET
diff --git a/mlir/lib/Dialect/GPU/Transforms/ModuleToBinary.cpp b/mlir/lib/Dialect/GPU/Transforms/ModuleToBinary.cpp
index 1e7596e..adae3be 100644
--- a/mlir/lib/Dialect/GPU/Transforms/ModuleToBinary.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/ModuleToBinary.cpp
@@ -38,25 +38,10 @@ class GpuModuleToBinaryPass
: public impl::GpuModuleToBinaryPassBase<GpuModuleToBinaryPass> {
public:
using Base::Base;
- void getDependentDialects(DialectRegistry &registry) const override;
void runOnOperation() final;
};
} // namespace
-void GpuModuleToBinaryPass::getDependentDialects(
- DialectRegistry &registry) const {
- // Register all GPU related translations.
- registry.insert<gpu::GPUDialect>();
- registry.insert<LLVM::LLVMDialect>();
-#if LLVM_HAS_NVPTX_TARGET
- registry.insert<NVVM::NVVMDialect>();
-#endif
-#if MLIR_ENABLE_ROCM_CONVERSIONS
- registry.insert<ROCDL::ROCDLDialect>();
-#endif
- registry.insert<spirv::SPIRVDialect>();
-}
-
void GpuModuleToBinaryPass::runOnOperation() {
RewritePatternSet patterns(&getContext());
auto targetFormat =
diff --git a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
index b00c65c..561a7e5 100644
--- a/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/SubgroupReduceLowering.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/Location.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
diff --git a/mlir/lib/Dialect/IRDL/IR/IRDL.cpp b/mlir/lib/Dialect/IRDL/IR/IRDL.cpp
index 1f5584f..c5c44d9 100644
--- a/mlir/lib/Dialect/IRDL/IR/IRDL.cpp
+++ b/mlir/lib/Dialect/IRDL/IR/IRDL.cpp
@@ -17,7 +17,6 @@
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/IR/Metadata.h"
diff --git a/mlir/lib/Dialect/IRDL/IRDLLoading.cpp b/mlir/lib/Dialect/IRDL/IRDLLoading.cpp
index 5f623e8..9a2754f 100644
--- a/mlir/lib/Dialect/IRDL/IRDLLoading.cpp
+++ b/mlir/lib/Dialect/IRDL/IRDLLoading.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/OperationSupport.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/SMLoc.h"
diff --git a/mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp b/mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp
index 05dc154..50f04d0 100644
--- a/mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp
+++ b/mlir/lib/Dialect/IRDL/IRDLVerifiers.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/Location.h"
#include "mlir/IR/Region.h"
#include "mlir/IR/Value.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/FormatVariadic.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index 3dacc70..961944c 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -12,7 +12,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "ptx-builder"
#define DBGS() (llvm::dbgs() << "[" DEBUG_TYPE "]: ")
diff --git a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
index 94197e4..036a9a1 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/NVVMDialect.cpp
@@ -28,7 +28,6 @@
#include "mlir/IR/Operation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/Types.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/AsmParser/Parser.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/MeshShardingInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/MeshShardingInterfaceImpl.cpp
index 24001c5..36b6088 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/MeshShardingInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/MeshShardingInterfaceImpl.cpp
@@ -30,7 +30,6 @@
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/TilingInterface.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp b/mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp
index 9e0829e..1294043 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/TransposeConv2D.cpp
@@ -13,7 +13,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/ValueRange.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp b/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
index 847c2f3..f630c48 100644
--- a/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
+++ b/mlir/lib/Dialect/MemRef/IR/MemRefMemorySlot.cpp
@@ -20,7 +20,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Interfaces/MemorySlotInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/ErrorHandling.h"
diff --git a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
index f140c04..20ce1b1 100644
--- a/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
+++ b/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/OpDefinition.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
diff --git a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
index ec1acbb..75fceee 100644
--- a/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
+++ b/mlir/lib/Dialect/Mesh/IR/MeshOps.cpp
@@ -23,7 +23,6 @@
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/ViewLikeInterface.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
diff --git a/mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp b/mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp
index a233847..bcd0e15 100644
--- a/mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp
+++ b/mlir/lib/Dialect/Mesh/Interfaces/ShardingInterface.cpp
@@ -13,7 +13,6 @@
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
diff --git a/mlir/lib/Dialect/Mesh/Transforms/ShardingPropagation.cpp b/mlir/lib/Dialect/Mesh/Transforms/ShardingPropagation.cpp
index 870ac4a..511c910 100644
--- a/mlir/lib/Dialect/Mesh/Transforms/ShardingPropagation.cpp
+++ b/mlir/lib/Dialect/Mesh/Transforms/ShardingPropagation.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/Verifier.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
diff --git a/mlir/lib/Dialect/Mesh/Transforms/Simplifications.cpp b/mlir/lib/Dialect/Mesh/Transforms/Simplifications.cpp
index a29551a..4c14b1c 100644
--- a/mlir/lib/Dialect/Mesh/Transforms/Simplifications.cpp
+++ b/mlir/lib/Dialect/Mesh/Transforms/Simplifications.cpp
@@ -14,7 +14,6 @@
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/SymbolTable.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include <numeric>
diff --git a/mlir/lib/Dialect/Mesh/Transforms/Spmdization.cpp b/mlir/lib/Dialect/Mesh/Transforms/Spmdization.cpp
index 4ecc897..1df3cf6 100644
--- a/mlir/lib/Dialect/Mesh/Transforms/Spmdization.cpp
+++ b/mlir/lib/Dialect/Mesh/Transforms/Spmdization.cpp
@@ -28,7 +28,6 @@
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp b/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
index 8163f42..6222cc7 100644
--- a/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
+++ b/mlir/lib/Dialect/NVGPU/Transforms/MmaSyncTF32Transform.cpp
@@ -19,7 +19,6 @@
#include "mlir/Dialect/NVGPU/IR/NVGPUDialect.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
diff --git a/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp b/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
index 693bb53..31ffacb 100644
--- a/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
+++ b/mlir/lib/Dialect/NVGPU/Transforms/OptimizeSharedMemory.cpp
@@ -20,7 +20,6 @@
#include "mlir/Dialect/NVGPU/Transforms/Utils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
@@ -146,7 +145,7 @@ getShmReadAndWriteOps(Operation *parentOp, Value shmMemRef,
return success();
}
-mlir::LogicalResult
+llvm::LogicalResult
mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(Operation *parentOp,
Value memrefValue) {
auto memRefType = dyn_cast<MemRefType>(memrefValue.getType());
diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
index b13c8d1..abbd857 100644
--- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
+++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
@@ -38,7 +38,6 @@
#include "mlir/Dialect/OpenMP/OpenMPOpsEnums.cpp.inc"
#include "mlir/Dialect/OpenMP/OpenMPOpsInterfaces.cpp.inc"
#include "mlir/Dialect/OpenMP/OpenMPTypeInterfaces.cpp.inc"
-#include "mlir/Support/LogicalResult.h"
using namespace mlir;
using namespace mlir::omp;
diff --git a/mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp b/mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp
index e85bced..650a369 100644
--- a/mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp
+++ b/mlir/lib/Dialect/Polynomial/IR/Polynomial.cpp
@@ -8,7 +8,6 @@
#include "mlir/Dialect/Polynomial/IR/Polynomial.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/SmallVector.h"
namespace mlir {
diff --git a/mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp b/mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp
index cc7d317..93c7f9e 100644
--- a/mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp
+++ b/mlir/lib/Dialect/Polynomial/IR/PolynomialAttributes.cpp
@@ -9,7 +9,6 @@
#include "mlir/Dialect/Polynomial/IR/Polynomial.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
diff --git a/mlir/lib/Dialect/Polynomial/IR/PolynomialDialect.cpp b/mlir/lib/Dialect/Polynomial/IR/PolynomialDialect.cpp
index 825b80d..7f8ba06 100644
--- a/mlir/lib/Dialect/Polynomial/IR/PolynomialDialect.cpp
+++ b/mlir/lib/Dialect/Polynomial/IR/PolynomialDialect.cpp
@@ -18,7 +18,6 @@
#include "mlir/IR/Dialect.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/TypeSwitch.h"
diff --git a/mlir/lib/Dialect/Polynomial/IR/PolynomialOps.cpp b/mlir/lib/Dialect/Polynomial/IR/PolynomialOps.cpp
index 40fa97d..2ba13bb 100644
--- a/mlir/lib/Dialect/Polynomial/IR/PolynomialOps.cpp
+++ b/mlir/lib/Dialect/Polynomial/IR/PolynomialOps.cpp
@@ -15,7 +15,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APInt.h"
using namespace mlir;
diff --git a/mlir/lib/Dialect/Quant/IR/QuantDialectBytecode.cpp b/mlir/lib/Dialect/Quant/IR/QuantDialectBytecode.cpp
index ee6be25..c0c00fb 100644
--- a/mlir/lib/Dialect/Quant/IR/QuantDialectBytecode.cpp
+++ b/mlir/lib/Dialect/Quant/IR/QuantDialectBytecode.cpp
@@ -12,7 +12,6 @@
#include "mlir/Dialect/Quant/QuantOps.h"
#include "mlir/Dialect/Quant/QuantTypes.h"
#include "mlir/IR/Diagnostics.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index 3841562..d9bc05a 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -29,7 +29,6 @@
#include "mlir/IR/Operation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/FunctionImplementation.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp
index 5d4dd5b..d75c855 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp
@@ -17,7 +17,6 @@
#include "mlir/IR/Location.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index 288cbac..4337787 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -955,7 +955,7 @@ LogicalResult tosa::ReshapeOp::inferReturnTypeComponents(
return success();
}
-mlir::LogicalResult tosa::ReshapeOp::verify() {
+llvm::LogicalResult tosa::ReshapeOp::verify() {
TensorType inputType = getInput1().getType();
RankedTensorType outputType = getType();
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
index 6eef2c5..403ac48 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaFolders.cpp
@@ -20,7 +20,6 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/SmallVector.h"
diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
index ff02cb2..e2b314f9 100644
--- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
@@ -12,7 +12,6 @@
#include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/CastInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorBitCast.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorBitCast.cpp
index e5f11d8..d8c4939 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorBitCast.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorBitCast.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-bitcast-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp
index 44e3f76..32e7eb2 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorBroadcast.cpp
@@ -32,7 +32,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-broadcast-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
index ba1c968..3a799ce 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorContract.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-contract-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp
index a0df03c..f1a5aa7 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorGather.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-broadcast-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorInterleave.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorInterleave.cpp
index f7e01c7..cab0f21 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorInterleave.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorInterleave.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/PatternMatch.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-interleave-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp
index c4e8ddc..92fddc1 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorScan.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-broadcast-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp
index 85c4c03..95ebd4e 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorShapeCast.cpp
@@ -32,7 +32,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "vector-shape-cast-lowering"
diff --git a/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp b/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp
index ca8a6f6..3c92b22 100644
--- a/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/LowerVectorTranspose.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#define DEBUG_TYPE "lower-vector-transpose"
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
index a1bb81e..4a3ae1b 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorLinearize.cpp
@@ -18,7 +18,6 @@
#include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/DialectConversion.h"
#include "llvm/ADT/ArrayRef.h"
#include <cstdint>
diff --git a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
index da3d964..c7d3022 100644
--- a/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/VectorTransforms.cpp
@@ -38,7 +38,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/VectorInterfaces.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/MapVector.h"
diff --git a/mlir/lib/IR/AffineMap.cpp b/mlir/lib/IR/AffineMap.cpp
index e5993eb..62f5952 100644
--- a/mlir/lib/IR/AffineMap.cpp
+++ b/mlir/lib/IR/AffineMap.cpp
@@ -12,7 +12,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallSet.h"
diff --git a/mlir/lib/IR/ExtensibleDialect.cpp b/mlir/lib/IR/ExtensibleDialect.cpp
index ca7b0e1..8a7d747 100644
--- a/mlir/lib/IR/ExtensibleDialect.cpp
+++ b/mlir/lib/IR/ExtensibleDialect.cpp
@@ -11,7 +11,6 @@
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/StorageUniquerSupport.h"
-#include "mlir/Support/LogicalResult.h"
using namespace mlir;
diff --git a/mlir/lib/Query/Query.cpp b/mlir/lib/Query/Query.cpp
index 7495e70..7d9f360 100644
--- a/mlir/lib/Query/Query.cpp
+++ b/mlir/lib/Query/Query.cpp
@@ -12,7 +12,6 @@
#include "mlir/IR/IRMapping.h"
#include "mlir/Query/Matcher/MatchFinder.h"
#include "mlir/Query/QuerySession.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
@@ -102,19 +101,16 @@ static Operation *extractFunction(std::vector<Operation *> &ops,
Query::~Query() = default;
-mlir::LogicalResult InvalidQuery::run(llvm::raw_ostream &os,
- QuerySession &qs) const {
+LogicalResult InvalidQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
os << errStr << "\n";
return mlir::failure();
}
-mlir::LogicalResult NoOpQuery::run(llvm::raw_ostream &os,
- QuerySession &qs) const {
+LogicalResult NoOpQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
return mlir::success();
}
-mlir::LogicalResult HelpQuery::run(llvm::raw_ostream &os,
- QuerySession &qs) const {
+LogicalResult HelpQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
os << "Available commands:\n\n"
" match MATCHER, m MATCHER "
"Match the mlir against the given matcher.\n"
@@ -123,14 +119,12 @@ mlir::LogicalResult HelpQuery::run(llvm::raw_ostream &os,
return mlir::success();
}
-mlir::LogicalResult QuitQuery::run(llvm::raw_ostream &os,
- QuerySession &qs) const {
+LogicalResult QuitQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
qs.terminate = true;
return mlir::success();
}
-mlir::LogicalResult MatchQuery::run(llvm::raw_ostream &os,
- QuerySession &qs) const {
+LogicalResult MatchQuery::run(llvm::raw_ostream &os, QuerySession &qs) const {
Operation *rootOp = qs.getRootOp();
int matchCount = 0;
std::vector<Operation *> matches =
diff --git a/mlir/lib/Support/ToolUtilities.cpp b/mlir/lib/Support/ToolUtilities.cpp
index f05b4f5..748f928 100644
--- a/mlir/lib/Support/ToolUtilities.cpp
+++ b/mlir/lib/Support/ToolUtilities.cpp
@@ -12,7 +12,6 @@
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h"
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index 5986514..718a813 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -111,7 +111,7 @@ StringRef StaticVerifierFunctionEmitter::getRegionConstraintFn(
/// Code for a type constraint. These may be called on the type of either
/// operands or results.
static const char *const typeConstraintCode = R"(
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::Operation *op, ::mlir::Type type, ::llvm::StringRef valueKind,
unsigned valueIndex) {
if (!({1})) {
@@ -129,14 +129,14 @@ static ::mlir::LogicalResult {0}(
/// TODO: Unique constraints for adaptors. However, most Adaptor::verify
/// functions are stripped anyways.
static const char *const attrConstraintCode = R"(
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::Attribute attr, ::llvm::StringRef attrName, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) {{
if (attr && !({1}))
return emitError() << "attribute '" << attrName
<< "' failed to satisfy constraint: {2}";
return ::mlir::success();
}
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::Operation *op, ::mlir::Attribute attr, ::llvm::StringRef attrName) {{
return {0}(attr, attrName, [op]() {{
return op->emitOpError();
@@ -146,7 +146,7 @@ static ::mlir::LogicalResult {0}(
/// Code for a successor constraint.
static const char *const successorConstraintCode = R"(
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::Operation *op, ::mlir::Block *successor,
::llvm::StringRef successorName, unsigned successorIndex) {
if (!({1})) {
@@ -160,7 +160,7 @@ static ::mlir::LogicalResult {0}(
/// Code for a region constraint. Callers will need to pass in the region's name
/// for emitting an error message.
static const char *const regionConstraintCode = R"(
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::Operation *op, ::mlir::Region &region, ::llvm::StringRef regionName,
unsigned regionIndex) {
if (!({1})) {
@@ -176,7 +176,7 @@ static ::mlir::LogicalResult {0}(
///
/// {3}: "Type type" or "Attribute attr".
static const char *const patternAttrOrTypeConstraintCode = R"(
-static ::mlir::LogicalResult {0}(
+static ::llvm::LogicalResult {0}(
::mlir::PatternRewriter &rewriter, ::mlir::Operation *op, ::mlir::{3},
::llvm::StringRef failureStr) {
if (!({1})) {
diff --git a/mlir/lib/Target/LLVM/NVVM/Target.cpp b/mlir/lib/Target/LLVM/NVVM/Target.cpp
index acb903a..e608d26 100644
--- a/mlir/lib/Target/LLVM/NVVM/Target.cpp
+++ b/mlir/lib/Target/LLVM/NVVM/Target.cpp
@@ -157,7 +157,6 @@ SerializeGPUModuleBase::loadBitcodeFiles(llvm::Module &module) {
return std::move(bcFiles);
}
-#if LLVM_HAS_NVPTX_TARGET
namespace {
class NVPTXSerializer : public SerializeGPUModuleBase {
public:
@@ -532,6 +531,12 @@ NVPTXSerializer::moduleToObject(llvm::Module &llvmModule) {
if (targetOptions.getCompilationTarget() == gpu::CompilationTarget::Offload)
return SerializeGPUModuleBase::moduleToObject(llvmModule);
+#if !LLVM_HAS_NVPTX_TARGET
+ getOperation()->emitError(
+ "The `NVPTX` target was not built. Please enable it when building LLVM.");
+ return std::nullopt;
+#endif // LLVM_HAS_NVPTX_TARGET
+
// Emit PTX code.
std::optional<llvm::TargetMachine *> targetMachine =
getOrCreateTargetMachine();
@@ -569,7 +574,6 @@ NVPTXSerializer::moduleToObject(llvm::Module &llvmModule) {
return compileToBinary(*serializedISA);
#endif // MLIR_ENABLE_NVPTXCOMPILER
}
-#endif // LLVM_HAS_NVPTX_TARGET
std::optional<SmallVector<char, 0>>
NVVMTargetAttrImpl::serializeToObject(Attribute attribute, Operation *module,
@@ -581,15 +585,9 @@ NVVMTargetAttrImpl::serializeToObject(Attribute attribute, Operation *module,
module->emitError("Module must be a GPU module.");
return std::nullopt;
}
-#if LLVM_HAS_NVPTX_TARGET
NVPTXSerializer serializer(*module, cast<NVVMTargetAttr>(attribute), options);
serializer.init();
return serializer.run();
-#else
- module->emitError(
- "The `NVPTX` target was not built. Please enable it when building LLVM.");
- return std::nullopt;
-#endif // LLVM_HAS_NVPTX_TARGET
}
Attribute
diff --git a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
index 0eb3328..b023c4c 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/GPU/SelectObjectAttr.cpp
@@ -167,7 +167,7 @@ public:
Value *createKernelArgArray(mlir::gpu::LaunchFuncOp op);
// Create the full kernel launch.
- mlir::LogicalResult createKernelLaunch(mlir::gpu::LaunchFuncOp op,
+ llvm::LogicalResult createKernelLaunch(mlir::gpu::LaunchFuncOp op,
mlir::gpu::ObjectAttr object);
private:
@@ -345,7 +345,7 @@ llvm::LaunchKernel::createKernelArgArray(mlir::gpu::LaunchFuncOp op) {
// call %streamSynchronize(%4)
// call %streamDestroy(%4)
// call %moduleUnload(%1)
-mlir::LogicalResult
+llvm::LogicalResult
llvm::LaunchKernel::createKernelLaunch(mlir::gpu::LaunchFuncOp op,
mlir::gpu::ObjectAttr object) {
auto llvmValue = [&](mlir::Value value) -> Value * {
diff --git a/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp
index ea9fe26..a09c24d 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/NVVM/NVVMToLLVMIRTranslation.cpp
@@ -15,7 +15,6 @@
#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/Operation.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/IR/IRBuilder.h"
diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
index fe257a4..35971fb 100644
--- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
@@ -18,7 +18,6 @@
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/LLVMIR/Dialect/OpenMPCommon.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "mlir/Transforms/RegionUtils.h"
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 6e8b2de..e0b1816e 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -31,7 +31,6 @@
#include "mlir/IR/DialectResourceBlobManager.h"
#include "mlir/IR/RegionGraphTraits.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/LLVMIR/LLVMTranslationInterface.h"
#include "mlir/Target/LLVMIR/TypeToLLVM.h"
diff --git a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
index faaa420..d7a3085 100644
--- a/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
+++ b/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/Builders.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Location.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
diff --git a/mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp b/mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp
index c283e64..6c28c04 100644
--- a/mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp
+++ b/mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp
@@ -15,7 +15,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/IR/RegionGraphTraits.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
index 200abdf..4c4fef1 100644
--- a/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
+++ b/mlir/lib/Target/SPIRV/Serialization/Serializer.cpp
@@ -16,7 +16,6 @@
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
diff --git a/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp b/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp
index b02edc6..611b734 100644
--- a/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp
+++ b/mlir/lib/Tools/PDLL/CodeGen/CPPGen.cpp
@@ -216,7 +216,7 @@ void CodeGen::generateConstraintOrRewrite(const ast::CallableDecl *decl,
// TODO: This will need to change if we allow Constraints to return values as
// well.
if (isConstraint) {
- os << "::mlir::LogicalResult";
+ os << "::llvm::LogicalResult";
} else {
// Otherwise, generate a type based on the results of the callable.
// If the callable has explicit results, use those to build the result.
diff --git a/mlir/lib/Tools/PDLL/Parser/Lexer.cpp b/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
index 4673a73b..cc111a0 100644
--- a/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Lexer.cpp
@@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//
#include "Lexer.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/PDLL/AST/Diagnostic.h"
#include "mlir/Tools/PDLL/Parser/CodeComplete.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/mlir/lib/Tools/PDLL/Parser/Lexer.h b/mlir/lib/Tools/PDLL/Parser/Lexer.h
index c80cb36..cd9c2b7 100644
--- a/mlir/lib/Tools/PDLL/Parser/Lexer.h
+++ b/mlir/lib/Tools/PDLL/Parser/Lexer.h
@@ -18,8 +18,6 @@ class SourceMgr;
} // namespace llvm
namespace mlir {
-struct LogicalResult;
-
namespace pdll {
class CodeCompleteContext;
diff --git a/mlir/lib/Tools/PDLL/Parser/Parser.cpp b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
index 45f9e2f..1f0df03 100644
--- a/mlir/lib/Tools/PDLL/Parser/Parser.cpp
+++ b/mlir/lib/Tools/PDLL/Parser/Parser.cpp
@@ -9,7 +9,6 @@
#include "mlir/Tools/PDLL/Parser/Parser.h"
#include "Lexer.h"
#include "mlir/Support/IndentedOstream.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/TableGen/Argument.h"
#include "mlir/TableGen/Attribute.h"
#include "mlir/TableGen/Constraint.h"
diff --git a/mlir/lib/Tools/lsp-server-support/Protocol.cpp b/mlir/lib/Tools/lsp-server-support/Protocol.cpp
index 188f525..e4eb251 100644
--- a/mlir/lib/Tools/lsp-server-support/Protocol.cpp
+++ b/mlir/lib/Tools/lsp-server-support/Protocol.cpp
@@ -11,7 +11,6 @@
//===----------------------------------------------------------------------===//
#include "mlir/Tools/lsp-server-support/Protocol.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/lsp-server-support/Logging.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/SmallString.h"
diff --git a/mlir/lib/Tools/mlir-lsp-server/LSPServer.h b/mlir/lib/Tools/mlir-lsp-server/LSPServer.h
index faf5936..2c50c6b 100644
--- a/mlir/lib/Tools/mlir-lsp-server/LSPServer.h
+++ b/mlir/lib/Tools/mlir-lsp-server/LSPServer.h
@@ -11,16 +11,19 @@
#include <memory>
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+namespace mlir {
namespace lsp {
class JSONTransport;
class MLIRServer;
/// Run the main loop of the LSP server using the given MLIR server and
/// transport.
-LogicalResult runMlirLSPServer(MLIRServer &server, JSONTransport &transport);
+llvm::LogicalResult runMlirLSPServer(MLIRServer &server,
+ JSONTransport &transport);
} // namespace lsp
} // namespace mlir
diff --git a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
index a1b2893..831e1e6 100644
--- a/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
+++ b/mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
@@ -31,7 +31,6 @@
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
#include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/Timing.h"
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Tools/ParseUtilities.h"
diff --git a/mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.h b/mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.h
index 5551c4e..78c4c31 100644
--- a/mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.h
+++ b/mlir/lib/Tools/mlir-pdll-lsp-server/LSPServer.h
@@ -11,16 +11,19 @@
#include <memory>
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+namespace mlir {
namespace lsp {
class JSONTransport;
class PDLLServer;
/// Run the main loop of the LSP server using the given PDLL server and
/// transport.
-LogicalResult runPdllLSPServer(PDLLServer &server, JSONTransport &transport);
+llvm::LogicalResult runPdllLSPServer(PDLLServer &server,
+ JSONTransport &transport);
} // namespace lsp
} // namespace mlir
diff --git a/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h b/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
index 682c7b5..134431f 100644
--- a/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
+++ b/mlir/lib/Tools/mlir-pdll-lsp-server/PDLLServer.h
@@ -12,8 +12,9 @@
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
-#include <string>
#include <optional>
+#include <string>
+#include <vector>
namespace mlir {
namespace lsp {
diff --git a/mlir/lib/Tools/mlir-query/MlirQueryMain.cpp b/mlir/lib/Tools/mlir-query/MlirQueryMain.cpp
index 15de16a..9950050 100644
--- a/mlir/lib/Tools/mlir-query/MlirQueryMain.cpp
+++ b/mlir/lib/Tools/mlir-query/MlirQueryMain.cpp
@@ -18,7 +18,6 @@
#include "mlir/Query/Query.h"
#include "mlir/Query/QuerySession.h"
#include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/LineEditor/LineEditor.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
@@ -28,7 +27,7 @@
// Query Parser
//===----------------------------------------------------------------------===//
-mlir::LogicalResult
+llvm::LogicalResult
mlir::mlirQueryMain(int argc, char **argv, MLIRContext &context,
const mlir::query::matcher::Registry &matcherRegistry) {
diff --git a/mlir/lib/Tools/mlir-reduce/MlirReduceMain.cpp b/mlir/lib/Tools/mlir-reduce/MlirReduceMain.cpp
index 2f0ab8a..a9cde4a 100644
--- a/mlir/lib/Tools/mlir-reduce/MlirReduceMain.cpp
+++ b/mlir/lib/Tools/mlir-reduce/MlirReduceMain.cpp
@@ -21,7 +21,6 @@
#include "mlir/Reducer/Passes.h"
#include "mlir/Rewrite/FrozenRewritePatternSet.h"
#include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/ParseUtilities.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/SourceMgr.h"
diff --git a/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp b/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp
index bd992895..56773f5 100644
--- a/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp
+++ b/mlir/lib/Tools/mlir-translate/MlirTranslateMain.cpp
@@ -13,7 +13,6 @@
#include "mlir/IR/Verifier.h"
#include "mlir/Parser/Parser.h"
#include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Support/Timing.h"
#include "mlir/Support/ToolUtilities.h"
#include "mlir/Tools/mlir-translate/Translation.h"
diff --git a/mlir/lib/Tools/tblgen-lsp-server/LSPServer.h b/mlir/lib/Tools/tblgen-lsp-server/LSPServer.h
index bc85de1..501a9da 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/LSPServer.h
+++ b/mlir/lib/Tools/tblgen-lsp-server/LSPServer.h
@@ -11,17 +11,19 @@
#include <memory>
-namespace mlir {
+namespace llvm {
struct LogicalResult;
+} // namespace llvm
+namespace mlir {
namespace lsp {
class JSONTransport;
class TableGenServer;
/// Run the main loop of the LSP server using the given TableGen server and
/// transport.
-LogicalResult runTableGenLSPServer(TableGenServer &server,
- JSONTransport &transport);
+llvm::LogicalResult runTableGenLSPServer(TableGenServer &server,
+ JSONTransport &transport);
} // namespace lsp
} // namespace mlir
diff --git a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
index 5ea91a2..f7cf4de 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
+++ b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
@@ -9,7 +9,6 @@
#include "TableGenServer.h"
#include "mlir/Support/IndentedOstream.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Tools/lsp-server-support/CompilationDatabase.h"
#include "mlir/Tools/lsp-server-support/Logging.h"
#include "mlir/Tools/lsp-server-support/Protocol.h"
@@ -17,9 +16,6 @@
#include "llvm/ADT/IntervalMap.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
-#include "llvm/ADT/TypeSwitch.h"
-#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/TableGen/Parser.h"
#include "llvm/TableGen/Record.h"
diff --git a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
index d749a4f..bdc8510 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
+++ b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.h
@@ -12,8 +12,9 @@
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
-#include <string>
#include <optional>
+#include <string>
+#include <vector>
namespace mlir {
namespace lsp {
diff --git a/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp b/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp
index 6a67ddd..43005e2 100644
--- a/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp
+++ b/mlir/test/lib/Analysis/DataFlow/TestLivenessAnalysis.cpp
@@ -18,7 +18,6 @@
#include <mlir/Pass/Pass.h>
#include <mlir/Pass/PassRegistry.h>
#include <mlir/Support/LLVM.h>
-#include <mlir/Support/LogicalResult.h>
#include <mlir/Support/TypeID.h>
using namespace mlir;
diff --git a/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp b/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp
index 2e5a4a9..f6bfd9f 100644
--- a/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp
+++ b/mlir/test/lib/Dialect/ArmNeon/TestLowerToArmNeon.cpp
@@ -17,7 +17,6 @@
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassManager.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#define PASS_NAME "test-lower-to-arm-neon"
diff --git a/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp b/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp
index 321b6a4..1f836be 100644
--- a/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp
+++ b/mlir/test/lib/Dialect/Mesh/TestOpLowering.cpp
@@ -11,7 +11,6 @@
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using namespace mlir;
diff --git a/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp b/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp
index 5e3918f..f964102 100644
--- a/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp
+++ b/mlir/test/lib/Dialect/Mesh/TestReshardingSpmdization.cpp
@@ -19,7 +19,6 @@
#include "mlir/IR/SymbolTable.h"
#include "mlir/IR/Value.h"
#include "mlir/Pass/Pass.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using namespace mlir;
diff --git a/mlir/test/lib/Dialect/Test/TestAttributes.cpp b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
index d7e40d3..b66dfbf 100644
--- a/mlir/test/lib/Dialect/Test/TestAttributes.cpp
+++ b/mlir/test/lib/Dialect/Test/TestAttributes.cpp
@@ -17,7 +17,6 @@
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/ExtensibleDialect.h"
#include "mlir/IR/Types.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/StringExtras.h"
diff --git a/mlir/test/lib/Dialect/Test/TestDialect.cpp b/mlir/test/lib/Dialect/Test/TestDialect.cpp
index bfb9592..1bbf2cc 100644
--- a/mlir/test/lib/Dialect/Test/TestDialect.cpp
+++ b/mlir/test/lib/Dialect/Test/TestDialect.cpp
@@ -28,7 +28,6 @@
#include "mlir/Interfaces/FunctionImplementation.h"
#include "mlir/Interfaces/InferIntRangeInterface.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/Transforms/FoldUtils.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/STLFunctionalExtras.h"
diff --git a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
index b86f692..fbaa102 100644
--- a/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpDefs.cpp
@@ -1193,7 +1193,7 @@ void TestVersionedOpA::writeProperties(mlir::DialectBytecodeWriter &writer) {
// TestOpWithVersionedProperties
//===----------------------------------------------------------------------===//
-mlir::LogicalResult TestOpWithVersionedProperties::readFromMlirBytecode(
+llvm::LogicalResult TestOpWithVersionedProperties::readFromMlirBytecode(
mlir::DialectBytecodeReader &reader, test::VersionedProperties &prop) {
uint64_t value1, value2 = 0;
if (failed(reader.readVarInt(value1)))
diff --git a/mlir/test/lib/Dialect/Test/TestOps.h b/mlir/test/lib/Dialect/Test/TestOps.h
index 837ccca..f070c3b 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.h
+++ b/mlir/test/lib/Dialect/Test/TestOps.h
@@ -70,7 +70,7 @@ struct PropertiesWithCustomPrint {
}
};
-mlir::LogicalResult setPropertiesFromAttribute(
+llvm::LogicalResult setPropertiesFromAttribute(
PropertiesWithCustomPrint &prop, mlir::Attribute attr,
llvm::function_ref<mlir::InFlightDiagnostic()> emitError);
mlir::DictionaryAttr
@@ -92,7 +92,7 @@ public:
// These three methods are invoked through the `MyStructProperty` wrapper
// defined in TestOps.td
mlir::Attribute asAttribute(mlir::MLIRContext *ctx) const;
- static mlir::LogicalResult
+ static llvm::LogicalResult
setFromAttr(MyPropStruct &prop, mlir::Attribute attr,
llvm::function_ref<mlir::InFlightDiagnostic()> emitError);
llvm::hash_code hash() const;
@@ -101,7 +101,7 @@ public:
}
};
-mlir::LogicalResult readFromMlirBytecode(mlir::DialectBytecodeReader &reader,
+llvm::LogicalResult readFromMlirBytecode(mlir::DialectBytecodeReader &reader,
MyPropStruct &prop);
void writeToMlirBytecode(mlir::DialectBytecodeWriter &writer,
MyPropStruct &prop);
@@ -122,7 +122,7 @@ struct VersionedProperties {
}
};
-mlir::LogicalResult setPropertiesFromAttribute(
+llvm::LogicalResult setPropertiesFromAttribute(
VersionedProperties &prop, mlir::Attribute attr,
llvm::function_ref<mlir::InFlightDiagnostic()> emitError);
mlir::DictionaryAttr getPropertiesAsAttribute(mlir::MLIRContext *ctx,
@@ -137,7 +137,7 @@ mlir::ParseResult customParseProperties(mlir::OpAsmParser &parser,
// Bytecode Support
//===----------------------------------------------------------------------===//
-mlir::LogicalResult readFromMlirBytecode(mlir::DialectBytecodeReader &reader,
+llvm::LogicalResult readFromMlirBytecode(mlir::DialectBytecodeReader &reader,
llvm::MutableArrayRef<int64_t> prop);
void writeToMlirBytecode(mlir::DialectBytecodeWriter &writer,
llvm::ArrayRef<int64_t> prop);
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index c77f76d..e1ec142 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -462,7 +462,7 @@ def VariadicRegionInferredTypesOp : TEST_Op<"variadic_region_inferred",
let results = (outs Variadic<AnyType>);
let extraClassDeclaration = [{
- static mlir::LogicalResult inferReturnTypes(mlir::MLIRContext *context,
+ static llvm::LogicalResult inferReturnTypes(mlir::MLIRContext *context,
std::optional<::mlir::Location> location, mlir::ValueRange operands,
mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, mlir::RegionRange regions,
llvm::SmallVectorImpl<mlir::Type> &inferredReturnTypes) {
@@ -1368,7 +1368,7 @@ def TestOpInPlaceFoldSuccess : TEST_Op<"op_in_place_fold_success"> {
let results = (outs Variadic<I1>);
let hasFolder = 1;
let extraClassDefinition = [{
- ::mlir::LogicalResult $cppClass::fold(FoldAdaptor adaptor,
+ ::llvm::LogicalResult $cppClass::fold(FoldAdaptor adaptor,
SmallVectorImpl<OpFoldResult> &results) {
return success();
}
@@ -2408,7 +2408,7 @@ class TableGenBuildInferReturnTypeBaseOp<string mnemonic,
let results = (outs AnyType:$result);
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *,
+ static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *,
::std::optional<::mlir::Location> location, ::mlir::ValueRange operands,
::mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
@@ -3037,7 +3037,7 @@ def TestOpWithNiceProperties : TEST_Op<"with_nice_properties"> {
::mlir::ArrayRef<::llvm::StringRef> elidedProps);
static ::mlir::ParseResult parseProperties(::mlir::OpAsmParser &parser,
::mlir::OperationState &result);
- static ::mlir::LogicalResult readFromMlirBytecode(
+ static ::llvm::LogicalResult readFromMlirBytecode(
::mlir::DialectBytecodeReader &,
test::PropertiesWithCustomPrint &prop);
static void writeToMlirBytecode(
@@ -3045,7 +3045,7 @@ def TestOpWithNiceProperties : TEST_Op<"with_nice_properties"> {
const test::PropertiesWithCustomPrint &prop);
}];
let extraClassDefinition = [{
- ::mlir::LogicalResult TestOpWithNiceProperties::readFromMlirBytecode(
+ ::llvm::LogicalResult TestOpWithNiceProperties::readFromMlirBytecode(
::mlir::DialectBytecodeReader &reader,
test::PropertiesWithCustomPrint &prop) {
StringRef label;
@@ -3101,7 +3101,7 @@ def TestOpWithVersionedProperties : TEST_Op<"with_versioned_properties"> {
::mlir::ArrayRef<::llvm::StringRef> elidedProps);
static ::mlir::ParseResult parseProperties(::mlir::OpAsmParser &parser,
::mlir::OperationState &result);
- static ::mlir::LogicalResult readFromMlirBytecode(
+ static ::llvm::LogicalResult readFromMlirBytecode(
::mlir::DialectBytecodeReader &,
test::VersionedProperties &prop);
static void writeToMlirBytecode(
diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp b/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp
index ebaced5..664951f 100644
--- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp
+++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.cpp
@@ -280,7 +280,7 @@ void ParseB64BytesOp::print(OpAsmPrinter &p) {
p << " \"" << llvm::encodeBase64(getB64()) << "\"";
}
-::mlir::LogicalResult FormatInferType2Op::inferReturnTypes(
+::llvm::LogicalResult FormatInferType2Op::inferReturnTypes(
::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location,
::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
OpaqueProperties properties, ::mlir::RegionRange regions,
diff --git a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td
index 9522a77..3129085 100644
--- a/mlir/test/lib/Dialect/Test/TestOpsSyntax.td
+++ b/mlir/test/lib/Dialect/Test/TestOpsSyntax.td
@@ -632,7 +632,7 @@ def FormatInferTypeOp : TEST_Op<"format_infer_type", [InferTypeOpInterface]> {
let assemblyFormat = "attr-dict";
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
+ static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
::std::optional<::mlir::Location> location, ::mlir::ValueRange operands,
::mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
@@ -655,7 +655,7 @@ class FormatInferAllTypesBaseOp<string mnemonic, list<Trait> traits = []>
let arguments = (ins Variadic<AnyType>:$args);
let results = (outs Variadic<AnyType>:$outs);
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
+ static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
::std::optional<::mlir::Location> location, ::mlir::ValueRange operands,
::mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
@@ -702,7 +702,7 @@ def FormatInferTypeRegionsOp
let regions = (region AnyRegion:$region);
let assemblyFormat = "$region attr-dict";
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
+ static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
::std::optional<::mlir::Location> location, ::mlir::ValueRange operands,
::mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
@@ -723,7 +723,7 @@ def FormatInferTypeVariadicOperandsOp
let results = (outs Variadic<AnyType>:$outs);
let assemblyFormat = "`(` $a `:` type($a) `)` `(` $b `:` type($b) `)` attr-dict";
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
+ static ::llvm::LogicalResult inferReturnTypes(::mlir::MLIRContext *context,
::std::optional<::mlir::Location> location, ::mlir::ValueRange operands,
::mlir::DictionaryAttr attributes, mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
::llvm::SmallVectorImpl<::mlir::Type> &inferredReturnTypes) {
diff --git a/mlir/test/lib/Dialect/Test/TestTypeDefs.td b/mlir/test/lib/Dialect/Test/TestTypeDefs.td
index 492642b..d96152a 100644
--- a/mlir/test/lib/Dialect/Test/TestTypeDefs.td
+++ b/mlir/test/lib/Dialect/Test/TestTypeDefs.td
@@ -154,7 +154,7 @@ def TestTypeWithLayoutType : Test_Type<"TestTypeWithLayout", [
let mnemonic = "test_type_with_layout";
let parameters = (ins "unsigned":$key);
let extraClassDeclaration = [{
- ::mlir::LogicalResult verifyEntries(::mlir::DataLayoutEntryListRef params,
+ ::llvm::LogicalResult verifyEntries(::mlir::DataLayoutEntryListRef params,
::mlir::Location loc) const;
private:
diff --git a/mlir/test/lib/Dialect/Test/TestTypes.h b/mlir/test/lib/Dialect/Test/TestTypes.h
index da56049..cef3f05 100644
--- a/mlir/test/lib/Dialect/Test/TestTypes.h
+++ b/mlir/test/lib/Dialect/Test/TestTypes.h
@@ -108,7 +108,7 @@ struct TestRecursiveTypeStorage : public ::mlir::TypeStorage {
TestRecursiveTypeStorage(allocator.copyInto(key));
}
- ::mlir::LogicalResult mutate(::mlir::TypeStorageAllocator &allocator,
+ ::llvm::LogicalResult mutate(::mlir::TypeStorageAllocator &allocator,
::mlir::Type newBody) {
// Cannot set a different body than before.
if (body && body != newBody)
@@ -140,7 +140,7 @@ public:
}
/// Body getter and setter.
- ::mlir::LogicalResult setBody(Type body) { return Base::mutate(body); }
+ ::llvm::LogicalResult setBody(Type body) { return Base::mutate(body); }
::mlir::Type getBody() const { return getImpl()->body; }
/// Name/key getter.
diff --git a/mlir/test/mlir-pdll/CodeGen/CPP/general.pdll b/mlir/test/mlir-pdll/CodeGen/CPP/general.pdll
index 21a8966..4e869e5 100644
--- a/mlir/test/mlir-pdll/CodeGen/CPP/general.pdll
+++ b/mlir/test/mlir-pdll/CodeGen/CPP/general.pdll
@@ -46,7 +46,7 @@ Pattern => erase op<test.op3>;
#include "include/ods.td"
-// CHECK: static ::mlir::LogicalResult TestCstPDLFn(::mlir::PatternRewriter &rewriter,
+// CHECK: static ::llvm::LogicalResult TestCstPDLFn(::mlir::PatternRewriter &rewriter,
// CHECK-SAME: ::mlir::Attribute attr, ::mlir::Operation * op, ::mlir::Type type,
// CHECK-SAME: ::mlir::Value value, ::mlir::TypeRange typeRange, ::mlir::ValueRange valueRange) {
// CHECK-NEXT: return success();
diff --git a/mlir/test/mlir-tblgen/attrdefs.td b/mlir/test/mlir-tblgen/attrdefs.td
index 5683f34..35d2c49 100644
--- a/mlir/test/mlir-tblgen/attrdefs.td
+++ b/mlir/test/mlir-tblgen/attrdefs.td
@@ -86,7 +86,7 @@ def B_CompoundAttrA : TestAttr<"CompoundA"> {
// DECL-LABEL: class CompoundAAttr : public ::mlir::Attribute
// DECL: static CompoundAAttr getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int widthOfSomething, ::test::SimpleTypeA exampleTdType, ::llvm::APFloat apFloat, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
-// DECL: static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, ::llvm::APFloat apFloat, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
+// DECL: static ::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, ::llvm::APFloat apFloat, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
// DECL: static constexpr ::llvm::StringLiteral getMnemonic() {
// DECL: return {"cmpnd_a"};
// DECL: }
diff --git a/mlir/test/mlir-tblgen/constraint-unique.td b/mlir/test/mlir-tblgen/constraint-unique.td
index cd41efa..214cd6c 100644
--- a/mlir/test/mlir-tblgen/constraint-unique.td
+++ b/mlir/test/mlir-tblgen/constraint-unique.td
@@ -54,7 +54,7 @@ def OpC : NS_Op<"op_c"> {
}
/// Test that a type contraint was generated.
-// CHECK: static ::mlir::LogicalResult [[$A_TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$A_TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK: if (!((typePred(type, *op)))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be a type, but got " << type;
@@ -63,13 +63,13 @@ def OpC : NS_Op<"op_c"> {
// CHECK-NOT: << " must be a type, but got " << type;
/// Test that a type constraint with a different description was generated.
-// CHECK: static ::mlir::LogicalResult [[$O_TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$O_TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK: if (!((typePred(type, *op)))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be another type, but got " << type;
/// Test that an attribute contraint was generated.
-// CHECK: static ::mlir::LogicalResult [[$A_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$A_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
// CHECK: if (attr && !((attrPred(attr, *op))))
// CHECK-NEXT: return emitError() << "attribute '" << attrName
// CHECK-NEXT: << "' failed to satisfy constraint: an attribute";
@@ -78,14 +78,14 @@ def OpC : NS_Op<"op_c"> {
// CHECK-NOT: << "' failed to satisfy constraint: an attribute";
/// Test that a attribute constraint with a different description was generated.
-// CHECK: static ::mlir::LogicalResult [[$O_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
-// CHECK: static ::mlir::LogicalResult [[$O_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$O_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$O_ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
// CHECK: if (attr && !((attrPred(attr, *op))))
// CHECK-NEXT: return emitError() << "attribute '" << attrName
// CHECK-NEXT: << "' failed to satisfy constraint: another attribute";
/// Test that a successor contraint was generated.
-// CHECK: static ::mlir::LogicalResult [[$A_SUCCESSOR_CONSTRAINT:__mlir_ods_local_successor_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$A_SUCCESSOR_CONSTRAINT:__mlir_ods_local_successor_constraint.*]](
// CHECK: if (!((successorPred(successor, *op)))) {
// CHECK-NEXT: return op->emitOpError("successor #") << successorIndex << " ('"
// CHECK-NEXT: << successorName << ")' failed to verify constraint: a successor";
@@ -94,13 +94,13 @@ def OpC : NS_Op<"op_c"> {
// CHECK-NOT: << successorName << ")' failed to verify constraint: a successor";
/// Test that a successor constraint with a different description was generated.
-// CHECK: static ::mlir::LogicalResult [[$O_SUCCESSOR_CONSTRAINT:__mlir_ods_local_successor_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$O_SUCCESSOR_CONSTRAINT:__mlir_ods_local_successor_constraint.*]](
// CHECK: if (!((successorPred(successor, *op)))) {
// CHECK-NEXT: return op->emitOpError("successor #") << successorIndex << " ('"
// CHECK-NEXT: << successorName << ")' failed to verify constraint: another successor";
/// Test that a region contraint was generated.
-// CHECK: static ::mlir::LogicalResult [[$A_REGION_CONSTRAINT:__mlir_ods_local_region_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$A_REGION_CONSTRAINT:__mlir_ods_local_region_constraint.*]](
// CHECK: if (!((regionPred(region, *op)))) {
// CHECK-NEXT: return op->emitOpError("region #") << regionIndex
// CHECK-NEXT: << (regionName.empty() ? " " : " ('" + regionName + "') ")
@@ -110,7 +110,7 @@ def OpC : NS_Op<"op_c"> {
// CHECK-NOT: << "failed to verify constraint: a region";
/// Test that a region constraint with a different description was generated.
-// CHECK: static ::mlir::LogicalResult [[$O_REGION_CONSTRAINT:__mlir_ods_local_region_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$O_REGION_CONSTRAINT:__mlir_ods_local_region_constraint.*]](
// CHECK: if (!((regionPred(region, *op)))) {
// CHECK-NEXT: return op->emitOpError("region #") << regionIndex
// CHECK-NEXT: << (regionName.empty() ? " " : " ('" + regionName + "') ")
diff --git a/mlir/test/mlir-tblgen/interfaces-as-constraints.td b/mlir/test/mlir-tblgen/interfaces-as-constraints.td
index 109bf07..b0438c2 100644
--- a/mlir/test/mlir-tblgen/interfaces-as-constraints.td
+++ b/mlir/test/mlir-tblgen/interfaces-as-constraints.td
@@ -23,22 +23,22 @@ def OpUsingAllOfThose : Op<Test_Dialect, "OpUsingAllOfThose"> {
let results = (outs TopLevelTypeInterface:$res1, TypeInterfaceInNamespace:$res2);
}
-// CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
+// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
// CHECK: if (!((::llvm::isa<TopLevelTypeInterface>(type)))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be TopLevelTypeInterface instance, but got " << type;
-// CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
+// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
// CHECK: if (!((::llvm::isa<test::TypeInterfaceInNamespace>(type)))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be TypeInterfaceInNamespace instance, but got " << type;
-// CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
+// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
// CHECK: if (attr && !((::llvm::isa<TopLevelAttrInterface>(attr))))
// CHECK-NEXT: return emitError() << "attribute '" << attrName
// CHECK-NEXT: << "' failed to satisfy constraint: TopLevelAttrInterface instance";
-// CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
+// CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
// CHECK: if (attr && !((::llvm::isa<test::AttrInterfaceInNamespace>(attr))))
// CHECK-NEXT: return emitError() << "attribute '" << attrName
// CHECK-NEXT: << "' failed to satisfy constraint: AttrInterfaceInNamespace instance";
diff --git a/mlir/test/mlir-tblgen/op-attribute.td b/mlir/test/mlir-tblgen/op-attribute.td
index 6f2d430..a82cd2e 100644
--- a/mlir/test/mlir-tblgen/op-attribute.td
+++ b/mlir/test/mlir-tblgen/op-attribute.td
@@ -68,7 +68,7 @@ def AOp : NS_Op<"a_op", []> {
// Test verify method
// ---
-// DEF: ::mlir::LogicalResult AOpAdaptor::verify
+// DEF: ::llvm::LogicalResult AOpAdaptor::verify
// DEF: ::mlir::Attribute tblgen_aAttr;
// DEF: while (true) {
// DEF-NEXT: if (namedAttrIt == namedAttrRange.end())
@@ -220,7 +220,7 @@ def AgetOp : Op<Test2_Dialect, "a_get_op", []> {
// Test verify method
// ---
-// DEF: ::mlir::LogicalResult AgetOpAdaptor::verify
+// DEF: ::llvm::LogicalResult AgetOpAdaptor::verify
// DEF: ::mlir::Attribute tblgen_aAttr;
// DEF: while (true)
// DEF: ::mlir::Attribute tblgen_bAttr;
diff --git a/mlir/test/mlir-tblgen/op-decl-and-defs.td b/mlir/test/mlir-tblgen/op-decl-and-defs.td
index 836ddca..f6fe450 100644
--- a/mlir/test/mlir-tblgen/op-decl-and-defs.td
+++ b/mlir/test/mlir-tblgen/op-decl-and-defs.td
@@ -84,7 +84,7 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
// CHECK: class AOpAdaptor : public AOpGenericAdaptor<::mlir::ValueRange> {
// CHECK: public:
// CHECK: AOpAdaptor(AOp
-// CHECK: ::mlir::LogicalResult verify(
+// CHECK: ::llvm::LogicalResult verify(
// CHECK: };
// CHECK: class AOp : public ::mlir::Op<AOp, ::mlir::OpTrait::AtLeastNRegions<1>::Impl, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsIsolatedFromAbove
@@ -120,9 +120,9 @@ def NS_AOp : NS_Op<"a_op", [IsolatedFromAbove, IsolatedFromAbove]> {
// CHECK: static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions)
// CHECK: static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result);
// CHECK: void print(::mlir::OpAsmPrinter &p);
-// CHECK: ::mlir::LogicalResult verifyInvariants();
+// CHECK: ::llvm::LogicalResult verifyInvariants();
// CHECK: static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context);
-// CHECK: ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results);
+// CHECK: ::llvm::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results);
// CHECK: // Display a graph for debugging purposes.
// CHECK: void displayGraph();
// CHECK: };
@@ -205,7 +205,7 @@ def NS_FOp : NS_Op<"op_with_all_types_constraint",
}
// CHECK-LABEL: class FOp :
-// CHECK: static ::mlir::LogicalResult inferReturnTypes
+// CHECK: static ::llvm::LogicalResult inferReturnTypes
def NS_GOp : NS_Op<"op_with_fixed_return_type", []> {
let arguments = (ins AnyType:$a);
@@ -213,7 +213,7 @@ def NS_GOp : NS_Op<"op_with_fixed_return_type", []> {
}
// CHECK-LABEL: class GOp :
-// CHECK: static ::mlir::LogicalResult inferReturnTypes
+// CHECK: static ::llvm::LogicalResult inferReturnTypes
// Check default value for collective params builder. Check that other builders
// are generated as well.
diff --git a/mlir/test/mlir-tblgen/predicate.td b/mlir/test/mlir-tblgen/predicate.td
index 44f395d..c1fcd3f 100644
--- a/mlir/test/mlir-tblgen/predicate.td
+++ b/mlir/test/mlir-tblgen/predicate.td
@@ -16,7 +16,7 @@ def OpA : NS_Op<"op_for_CPred_containing_multiple_same_placeholder", []> {
let results = (outs Variadic<I32OrF32>:$y);
}
-// CHECK: static ::mlir::LogicalResult [[$INTEGER_FLOAT_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$INTEGER_FLOAT_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK: if (!((type.isInteger(32) || type.isF32()))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be 32-bit integer or floating-point type, but got " << type;
@@ -26,12 +26,12 @@ def OpA : NS_Op<"op_for_CPred_containing_multiple_same_placeholder", []> {
// CHECK-NOT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NOT. << " must be 32-bit integer or floating-point type, but got " << type;
-// CHECK: static ::mlir::LogicalResult [[$TENSOR_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$TENSOR_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK: if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return (true); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be tensor of any type values, but got " << type;
-// CHECK: static ::mlir::LogicalResult [[$TENSOR_INTEGER_FLOAT_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$TENSOR_INTEGER_FLOAT_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK: if (!(((::llvm::isa<::mlir::TensorType>(type))) && ([](::mlir::Type elementType) { return ((elementType.isF32())) || ((elementType.isSignlessInteger(32))); }(::llvm::cast<::mlir::ShapedType>(type).getElementType())))) {
// CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
// CHECK-NEXT: << " must be tensor of 32-bit float or 32-bit signless integer values, but got " << type;
diff --git a/mlir/test/mlir-tblgen/rewriter-static-matcher.td b/mlir/test/mlir-tblgen/rewriter-static-matcher.td
index 7a84dfd..c5debf5 100644
--- a/mlir/test/mlir-tblgen/rewriter-static-matcher.td
+++ b/mlir/test/mlir-tblgen/rewriter-static-matcher.td
@@ -48,11 +48,11 @@ def Foo : NativeCodeCall<"foo($_builder, $0)">;
// Test static matcher for duplicate DagNode
// ---
-// CHECK: static ::mlir::LogicalResult [[$TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$TYPE_CONSTRAINT:__mlir_ods_local_type_constraint.*]](
// CHECK-NEXT: {{.*::mlir::Type type}}
-// CHECK: static ::mlir::LogicalResult [[$ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
+// CHECK: static ::llvm::LogicalResult [[$ATTR_CONSTRAINT:__mlir_ods_local_attr_constraint.*]](
// CHECK-NEXT: {{.*::mlir::Attribute attr}}
-// CHECK: static ::mlir::LogicalResult [[$DAG_MATCHER:static_dag_matcher.*]](
+// CHECK: static ::llvm::LogicalResult [[$DAG_MATCHER:static_dag_matcher.*]](
// CHECK: if(::mlir::failed([[$ATTR_CONSTRAINT]]
// CHECK: if(::mlir::failed([[$TYPE_CONSTRAINT]]
diff --git a/mlir/test/mlir-tblgen/typedefs.td b/mlir/test/mlir-tblgen/typedefs.td
index 705da4e..b9e3a79 100644
--- a/mlir/test/mlir-tblgen/typedefs.td
+++ b/mlir/test/mlir-tblgen/typedefs.td
@@ -70,7 +70,7 @@ def B_CompoundTypeA : TestType<"CompoundA"> {
// DECL-LABEL: class CompoundAType : public ::mlir::Type
// DECL: static CompoundAType getChecked(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, ::mlir::MLIRContext *context, int widthOfSomething, ::test::SimpleTypeA exampleTdType, SomeCppStruct exampleCppType, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
-// DECL: static ::mlir::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, SomeCppStruct exampleCppType, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
+// DECL: static ::llvm::LogicalResult verify(::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError, int widthOfSomething, ::test::SimpleTypeA exampleTdType, SomeCppStruct exampleCppType, ::llvm::ArrayRef<int> dims, ::mlir::Type inner);
// DECL: static constexpr ::llvm::StringLiteral getMnemonic() {
// DECL: return {"cmpnd_a"};
// DECL: }
diff --git a/mlir/test/python/python_test_ops.td b/mlir/test/python/python_test_ops.td
index 9530198..c0bc184 100644
--- a/mlir/test/python/python_test_ops.td
+++ b/mlir/test/python/python_test_ops.td
@@ -128,7 +128,7 @@ def InferResultsOp : TestOp<"infer_results_op", [InferTypeOpInterface]> {
let results = (outs AnyInteger:$single, AnyInteger:$doubled);
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(
+ static ::llvm::LogicalResult inferReturnTypes(
::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location,
::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
::mlir::OpaqueProperties,
@@ -151,7 +151,7 @@ def InferResultsVariadicInputsOp : TestOp<"infer_results_variadic_inputs_op",
let results = (outs I32OrF32:$res);
let extraClassDeclaration = [{
- static ::mlir::LogicalResult inferReturnTypes(
+ static ::llvm::LogicalResult inferReturnTypes(
::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location,
::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes,
::mlir::OpaqueProperties,
@@ -180,7 +180,7 @@ def InferShapedTypeComponentsOp : TestOp<"infer_shaped_type_components_op",
let results = (outs AnyTensor:$result);
let extraClassDefinition = [{
- ::mlir::LogicalResult $cppClass::inferReturnTypeComponents(
+ ::llvm::LogicalResult $cppClass::inferReturnTypeComponents(
::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location,
::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes,
::mlir::OpaqueProperties properties, ::mlir::RegionRange regions,
diff --git a/mlir/tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp b/mlir/tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp
index de50fd3..ffda7c8 100644
--- a/mlir/tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp
+++ b/mlir/tools/mlir-pdll-lsp-server/mlir-pdll-lsp-server.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "mlir/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.h"
using namespace mlir;
diff --git a/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp b/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
index b15f2ce..2f92ff2 100644
--- a/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
+++ b/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/MemoryBuffer.h"
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
index 55bc071..ea0d152 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeDefGen.cpp
@@ -297,7 +297,7 @@ void DefGen::emitBuilders() {
void DefGen::emitVerifier() {
defCls.declare<UsingDeclaration>("Base::getChecked");
defCls.declareStaticMethod(
- "::mlir::LogicalResult", "verify",
+ "::llvm::LogicalResult", "verify",
getBuilderParams({{"::llvm::function_ref<::mlir::InFlightDiagnostic()>",
"emitError"}}));
}
@@ -819,7 +819,7 @@ void DefGenerator::emitParsePrintDispatch(ArrayRef<AttrOrTypeDef> defs) {
strfmt("generated{0}Parser", valueType), Method::StaticInline,
std::move(params));
// Declare the printer.
- Method printer("::mlir::LogicalResult",
+ Method printer("::llvm::LogicalResult",
strfmt("generated{0}Printer", valueType), Method::StaticInline,
{{strfmt("::mlir::{0}", valueType), "def"},
{"::mlir::AsmPrinter &", "printer"}});
@@ -839,7 +839,7 @@ void DefGenerator::emitParsePrintDispatch(ArrayRef<AttrOrTypeDef> defs) {
// The printer dispatch uses llvm::TypeSwitch to find and call the correct
// printer.
printer.body() << " return ::llvm::TypeSwitch<::mlir::" << valueType
- << ", ::mlir::LogicalResult>(def)";
+ << ", ::llvm::LogicalResult>(def)";
const char *const printValue = R"( .Case<{0}>([&](auto t) {{
printer << {0}::getMnemonic();{1}
return ::mlir::success();
diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
index 50378fe..ffd5a39 100644
--- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
@@ -9,7 +9,6 @@
#include "AttrOrTypeFormatGen.h"
#include "FormatGen.h"
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "mlir/TableGen/AttrOrTypeDef.h"
#include "mlir/TableGen/Format.h"
#include "mlir/TableGen/GenInfo.h"
diff --git a/mlir/tools/mlir-tblgen/DialectGen.cpp b/mlir/tools/mlir-tblgen/DialectGen.cpp
index 46e585a..2412876 100644
--- a/mlir/tools/mlir-tblgen/DialectGen.cpp
+++ b/mlir/tools/mlir-tblgen/DialectGen.cpp
@@ -166,7 +166,7 @@ static const char *const constantMaterializerDecl = R"(
static const char *const opAttrVerifierDecl = R"(
/// Provides a hook for verifying dialect attributes attached to the given
/// op.
- ::mlir::LogicalResult verifyOperationAttribute(
+ ::llvm::LogicalResult verifyOperationAttribute(
::mlir::Operation *op, ::mlir::NamedAttribute attribute) override;
)";
@@ -174,7 +174,7 @@ static const char *const opAttrVerifierDecl = R"(
static const char *const regionArgAttrVerifierDecl = R"(
/// Provides a hook for verifying dialect attributes attached to the given
/// op's region argument.
- ::mlir::LogicalResult verifyRegionArgAttribute(
+ ::llvm::LogicalResult verifyRegionArgAttribute(
::mlir::Operation *op, unsigned regionIndex, unsigned argIndex,
::mlir::NamedAttribute attribute) override;
)";
@@ -183,7 +183,7 @@ static const char *const regionArgAttrVerifierDecl = R"(
static const char *const regionResultAttrVerifierDecl = R"(
/// Provides a hook for verifying dialect attributes attached to the given
/// op's region result.
- ::mlir::LogicalResult verifyRegionResultAttribute(
+ ::llvm::LogicalResult verifyRegionResultAttribute(
::mlir::Operation *op, unsigned regionIndex, unsigned resultIndex,
::mlir::NamedAttribute attribute) override;
)";
diff --git a/mlir/tools/mlir-tblgen/FormatGen.h b/mlir/tools/mlir-tblgen/FormatGen.h
index b061d4d..1dc2cb3 100644
--- a/mlir/tools/mlir-tblgen/FormatGen.h
+++ b/mlir/tools/mlir-tblgen/FormatGen.h
@@ -15,7 +15,6 @@
#define MLIR_TOOLS_MLIRTBLGEN_FORMATGEN_H_
#include "mlir/Support/LLVM.h"
-#include "mlir/Support/LogicalResult.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Allocator.h"
diff --git a/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp b/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
index 2c7acec..ebadfe4 100644
--- a/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
+++ b/mlir/tools/mlir-tblgen/LLVMIRConversionGen.cpp
@@ -11,7 +11,6 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Support/LogicalResult.h"
#include "mlir/TableGen/Argument.h"
#include "mlir/TableGen/Attribute.h"
#include "mlir/TableGen/GenInfo.h"
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 3146e65..0fc750c 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -1250,7 +1250,7 @@ void OpEmitter::genPropertiesSupport() {
auto &setPropMethod =
opClass
.addStaticMethod(
- "::mlir::LogicalResult", "setPropertiesFromAttr",
+ "::llvm::LogicalResult", "setPropertiesFromAttr",
MethodParameter("Properties &", "prop"),
MethodParameter("::mlir::Attribute", "attr"),
MethodParameter(
@@ -1292,7 +1292,7 @@ void OpEmitter::genPropertiesSupport() {
auto &verifyInherentAttrsMethod =
opClass
.addStaticMethod(
- "::mlir::LogicalResult", "verifyInherentAttrs",
+ "::llvm::LogicalResult", "verifyInherentAttrs",
MethodParameter("::mlir::OperationName", "opName"),
MethodParameter("::mlir::NamedAttrList &", "attrs"),
MethodParameter(
@@ -1597,7 +1597,7 @@ void OpEmitter::genPropertiesSupportForBytecode(
ArrayRef<ConstArgument> attrOrProperties) {
if (op.useCustomPropertiesEncoding()) {
opClass.declareStaticMethod(
- "::mlir::LogicalResult", "readProperties",
+ "::llvm::LogicalResult", "readProperties",
MethodParameter("::mlir::DialectBytecodeReader &", "reader"),
MethodParameter("::mlir::OperationState &", "state"));
opClass.declareMethod(
@@ -1609,7 +1609,7 @@ void OpEmitter::genPropertiesSupportForBytecode(
auto &readPropertiesMethod =
opClass
.addStaticMethod(
- "::mlir::LogicalResult", "readProperties",
+ "::llvm::LogicalResult", "readProperties",
MethodParameter("::mlir::DialectBytecodeReader &", "reader"),
MethodParameter("::mlir::OperationState &", "state"))
->body();
@@ -3226,7 +3226,7 @@ void OpEmitter::genCanonicalizerDecls() {
SmallVector<MethodParameter> paramList;
paramList.emplace_back(op.getCppClassName(), "op");
paramList.emplace_back("::mlir::PatternRewriter &", "rewriter");
- auto *m = opClass.declareStaticMethod("::mlir::LogicalResult",
+ auto *m = opClass.declareStaticMethod("::llvm::LogicalResult",
"canonicalize", std::move(paramList));
ERROR_IF_PRUNED(m, "canonicalize", op);
}
@@ -3272,7 +3272,7 @@ void OpEmitter::genFolderDecls() {
} else {
paramList.emplace_back("::llvm::SmallVectorImpl<::mlir::OpFoldResult> &",
"results");
- retType = "::mlir::LogicalResult";
+ retType = "::llvm::LogicalResult";
}
auto *m = opClass.declareMethod(retType, "fold", std::move(paramList));
@@ -3563,7 +3563,7 @@ void OpEmitter::genPrinter() {
void OpEmitter::genVerifier() {
auto *implMethod =
- opClass.addMethod("::mlir::LogicalResult", "verifyInvariantsImpl");
+ opClass.addMethod("::llvm::LogicalResult", "verifyInvariantsImpl");
ERROR_IF_PRUNED(implMethod, "verifyInvariantsImpl", op);
auto &implBody = implMethod->body();
bool useProperties = emitHelper.hasProperties();
@@ -3592,7 +3592,7 @@ void OpEmitter::genVerifier() {
// This may not act as their expectation because this doesn't call any
// verifiers of native/interface traits. Needs to review those use cases and
// see if we should use the mlir::verify() instead.
- auto *method = opClass.addMethod("::mlir::LogicalResult", "verifyInvariants");
+ auto *method = opClass.addMethod("::llvm::LogicalResult", "verifyInvariants");
ERROR_IF_PRUNED(method, "verifyInvariants", op);
auto &body = method->body();
if (def.getValueAsBit("hasVerifier")) {
@@ -3607,13 +3607,13 @@ void OpEmitter::genVerifier() {
void OpEmitter::genCustomVerifier() {
if (def.getValueAsBit("hasVerifier")) {
- auto *method = opClass.declareMethod("::mlir::LogicalResult", "verify");
+ auto *method = opClass.declareMethod("::llvm::LogicalResult", "verify");
ERROR_IF_PRUNED(method, "verify", op);
}
if (def.getValueAsBit("hasRegionVerifier")) {
auto *method =
- opClass.declareMethod("::mlir::LogicalResult", "verifyRegions");
+ opClass.declareMethod("::llvm::LogicalResult", "verifyRegions");
ERROR_IF_PRUNED(method, "verifyRegions", op);
}
}
@@ -4334,7 +4334,7 @@ OpOperandAdaptorEmitter::OpOperandAdaptorEmitter(
}
void OpOperandAdaptorEmitter::addVerification() {
- auto *method = adaptor.addMethod("::mlir::LogicalResult", "verify",
+ auto *method = adaptor.addMethod("::llvm::LogicalResult", "verify",
MethodParameter("::mlir::Location", "loc"));
ERROR_IF_PRUNED(method, "verify", op);
auto &body = method->body();
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index f7cc0a2..a97d876 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1200,7 +1200,7 @@ static void genParsedAttrPropertiesSetter(OperationFormat &fmt, Operator &op,
paramList.emplace_back("::llvm::function_ref<::mlir::InFlightDiagnostic()>",
"emitError");
- Method *method = opClass.addStaticMethod("::mlir::LogicalResult",
+ Method *method = opClass.addStaticMethod("::llvm::LogicalResult",
"setPropertiesFromParsedAttr",
std::move(paramList));
MethodBody &body = method->body().indent();
diff --git a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
index 2a7406f..4b06b92 100644
--- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
@@ -480,7 +480,7 @@ void InterfaceGenerator::emitTraitDecl(const Interface &interface,
tblgen::FmtContext verifyCtx;
verifyCtx.addSubst("_op", "op");
os << llvm::formatv(
- " static ::mlir::LogicalResult {0}(::mlir::Operation *op) ",
+ " static ::llvm::LogicalResult {0}(::mlir::Operation *op) ",
(interface.verifyWithRegions() ? "verifyRegionTrait"
: "verifyTrait"))
<< "{\n " << tblgen::tgfmt(verify->trim(), &verifyCtx)
diff --git a/mlir/tools/mlir-tblgen/RewriterGen.cpp b/mlir/tools/mlir-tblgen/RewriterGen.cpp
index 0d3b29c..2c79ba2 100644
--- a/mlir/tools/mlir-tblgen/RewriterGen.cpp
+++ b/mlir/tools/mlir-tblgen/RewriterGen.cpp
@@ -366,7 +366,7 @@ std::string PatternEmitter::handleConstantAttr(Attribute attr,
void PatternEmitter::emitStaticMatcher(DagNode tree, std::string funcName) {
os << formatv(
- "static ::mlir::LogicalResult {0}(::mlir::PatternRewriter &rewriter, "
+ "static ::llvm::LogicalResult {0}(::mlir::PatternRewriter &rewriter, "
"::mlir::Operation *op0, ::llvm::SmallVector<::mlir::Operation "
"*, 4> &tblgen_ops",
funcName);
@@ -1081,7 +1081,7 @@ void PatternEmitter::emit(StringRef rewriteName) {
{
auto classScope = os.scope();
os.printReindented(R"(
- ::mlir::LogicalResult matchAndRewrite(::mlir::Operation *op0,
+ ::llvm::LogicalResult matchAndRewrite(::mlir::Operation *op0,
::mlir::PatternRewriter &rewriter) const override {)")
<< '\n';
{
diff --git a/mlir/tools/mlir-translate/mlir-translate.cpp b/mlir/tools/mlir-translate/mlir-translate.cpp
index 309def8..9d2dd88 100644
--- a/mlir/tools/mlir-translate/mlir-translate.cpp
+++ b/mlir/tools/mlir-translate/mlir-translate.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "mlir/InitAllTranslations.h"
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "mlir/Tools/mlir-translate/MlirTranslateMain.h"
using namespace mlir;
diff --git a/mlir/tools/mlir-vulkan-runner/VulkanRuntime.h b/mlir/tools/mlir-vulkan-runner/VulkanRuntime.h
index 9fa52b0..17db8d0 100644
--- a/mlir/tools/mlir-vulkan-runner/VulkanRuntime.h
+++ b/mlir/tools/mlir-vulkan-runner/VulkanRuntime.h
@@ -13,7 +13,7 @@
#ifndef VULKAN_RUNTIME_H
#define VULKAN_RUNTIME_H
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include <unordered_map>
#include <vector>
diff --git a/mlir/tools/tblgen-lsp-server/tblgen-lsp-server.cpp b/mlir/tools/tblgen-lsp-server/tblgen-lsp-server.cpp
index 90b2d98..e8fdbfc 100644
--- a/mlir/tools/tblgen-lsp-server/tblgen-lsp-server.cpp
+++ b/mlir/tools/tblgen-lsp-server/tblgen-lsp-server.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "mlir/Support/LogicalResult.h"
+#include "mlir/Support/LLVM.h"
#include "mlir/Tools/tblgen-lsp-server/TableGenLspServerMain.h"
using namespace mlir;
diff --git a/mlir/unittests/Analysis/Presburger/ParserTest.cpp b/mlir/unittests/Analysis/Presburger/ParserTest.cpp
index 4c9f54f..06b728c 100644
--- a/mlir/unittests/Analysis/Presburger/ParserTest.cpp
+++ b/mlir/unittests/Analysis/Presburger/ParserTest.cpp
@@ -45,6 +45,18 @@ static bool parseAndCompare(StringRef str, const IntegerPolyhedron &ex) {
}
TEST(ParseFACTest, ParseAndCompareTest) {
+ // constant-fold addition
+ EXPECT_TRUE(parseAndCompare("() : (4 + 3 >= 0)",
+ makeFACFromConstraints(0, 0, {}, {})));
+
+ // constant-fold addition + multiplication
+ EXPECT_TRUE(parseAndCompare("()[a] : (4 * 3 == 10 + 2)",
+ makeFACFromConstraints(0, 1, {}, {})));
+
+ // constant-fold ceildiv + floordiv
+ EXPECT_TRUE(parseAndCompare("(x) : (11 ceildiv 3 == 13 floordiv 3)",
+ makeFACFromConstraints(1, 0, {}, {})));
+
// simple ineq
EXPECT_TRUE(parseAndCompare("(x)[] : (x >= 0)",
makeFACFromConstraints(1, 0, {{1, 0}})));
@@ -57,6 +69,11 @@ TEST(ParseFACTest, ParseAndCompareTest) {
EXPECT_TRUE(parseAndCompare("(x)[] : (7 * x >= 0, -7 * x + 5 >= 0)",
makeFACFromConstraints(1, 0, {{7, 0}, {-7, 5}})));
+ // multiplication distribution
+ EXPECT_TRUE(
+ parseAndCompare("(x) : (2 * x >= 2, (-7 + x * 9) * 5 >= 0)",
+ makeFACFromConstraints(1, 0, {{2, -2}, {45, -35}})));
+
// multiple dimensions
EXPECT_TRUE(parseAndCompare("(x,y,z)[] : (x + y - z >= 0)",
makeFACFromConstraints(3, 0, {{1, 1, -1, 0}})));
@@ -70,20 +87,61 @@ TEST(ParseFACTest, ParseAndCompareTest) {
EXPECT_TRUE(parseAndCompare("()[a] : (2 * a - 4 == 0)",
makeFACFromConstraints(0, 1, {}, {{2, -4}})));
+ // no linear terms
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (26 * (x floordiv 6) == y floordiv 3)",
+ makeFACFromConstraints(2, 0, {}, {{0, 0, 26, -1, 0}},
+ {{{1, 0, 0}, 6}, {{0, 1, 0, 0}, 3}})));
+
// simple floordiv
EXPECT_TRUE(parseAndCompare(
"(x, y) : (y - 3 * ((x + y - 13) floordiv 3) - 42 == 0)",
makeFACFromConstraints(2, 0, {}, {{0, 1, -3, -42}}, {{{1, 1, -13}, 3}})));
+ // simple ceildiv
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (y - 3 * ((x + y - 13) ceildiv 3) - 42 == 0)",
+ makeFACFromConstraints(2, 0, {}, {{0, 1, -3, -42}}, {{{1, 1, -11}, 3}})));
+
+ // simple mod
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (y - 3 * ((x + y - 13) mod 3) - 42 == 0)",
+ makeFACFromConstraints(2, 0, {}, {{-3, -2, 9, -3}}, {{{1, 1, -13}, 3}})));
+
// multiple floordiv
EXPECT_TRUE(parseAndCompare(
"(x, y) : (y - x floordiv 3 - y floordiv 2 == 0)",
makeFACFromConstraints(2, 0, {}, {{0, 1, -1, -1, 0}},
{{{1, 0, 0}, 3}, {{0, 1, 0, 0}, 2}})));
+ // multiple ceildiv
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (y - x ceildiv 3 - y ceildiv 2 == 0)",
+ makeFACFromConstraints(2, 0, {}, {{0, 1, -1, -1, 0}},
+ {{{1, 0, 2}, 3}, {{0, 1, 0, 1}, 2}})));
+
+ // multiple mod
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (y - x mod 3 - y mod 2 == 0)",
+ makeFACFromConstraints(2, 0, {}, {{-1, 0, 3, 2, 0}},
+ {{{1, 0, 0}, 3}, {{0, 1, 0, 0}, 2}})));
+
// nested floordiv
EXPECT_TRUE(parseAndCompare(
"(x, y) : (y - (x + y floordiv 2) floordiv 3 == 0)",
makeFACFromConstraints(2, 0, {}, {{0, 1, 0, -1, 0}},
{{{0, 1, 0}, 2}, {{1, 0, 1, 0}, 3}})));
+
+ // nested mod
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : (y - (x + y mod 2) mod 3 == 0)",
+ makeFACFromConstraints(2, 0, {}, {{-1, 0, 2, 3, 0}},
+ {{{0, 1, 0}, 2}, {{1, 1, -2, 0}, 3}})));
+
+ // nested floordiv + ceildiv + mod
+ EXPECT_TRUE(parseAndCompare(
+ "(x, y) : ((2 * x + 3 * (y floordiv 2) + x mod 7 + 1) ceildiv 3 == 42)",
+ makeFACFromConstraints(
+ 2, 0, {}, {{0, 0, 0, 0, 1, -42}},
+ {{{0, 1, 0}, 2}, {{1, 0, 0, 0}, 7}, {{3, 0, 3, -7, 3}, 3}})));
}
diff --git a/mlir/unittests/Rewrite/PatternBenefit.cpp b/mlir/unittests/Rewrite/PatternBenefit.cpp
index 79552f0..65ea4ee 100644
--- a/mlir/unittests/Rewrite/PatternBenefit.cpp
+++ b/mlir/unittests/Rewrite/PatternBenefit.cpp
@@ -27,7 +27,7 @@ TEST(PatternBenefitTest, BenefitOrder) {
Pattern1(mlir::MLIRContext *context, bool *called)
: OpRewritePattern<ModuleOp>(context, /*benefit*/ 1), called(called) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(ModuleOp /*op*/,
mlir::PatternRewriter & /*rewriter*/) const override {
*called = true;
@@ -43,7 +43,7 @@ TEST(PatternBenefitTest, BenefitOrder) {
: RewritePattern(MatchAnyOpTypeTag(), /*benefit=*/2, context),
called(called) {}
- mlir::LogicalResult
+ llvm::LogicalResult
matchAndRewrite(Operation * /*op*/,
mlir::PatternRewriter & /*rewriter*/) const override {
*called = true;
diff --git a/openmp/runtime/src/dllexports b/openmp/runtime/src/dllexports
index 747b828..0667d53 100644
--- a/openmp/runtime/src/dllexports
+++ b/openmp/runtime/src/dllexports
@@ -1276,5 +1276,6 @@ kmp_set_disp_num_buffers 890
%endif
__kmpc_set_thread_limit
+__kmpc_dispatch_deinit
# end of file #
diff --git a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
index 725ac6b..caebcd0 100644
--- a/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/clang/BUILD.bazel
@@ -1869,11 +1869,19 @@ cc_library(
cc_library(
name = "interpreter",
- srcs = glob([
- "lib/Interpreter/*.cpp",
- "lib/Interpreter/*.h",
- ]),
- hdrs = glob(["include/clang/Interpreter/*.h"]),
+ srcs = glob(
+ [
+ "lib/Interpreter/*.cpp",
+ "lib/Interpreter/*.h",
+ ],
+ exclude = ["lib/Interpreter/Wasm.cpp"],
+ ),
+ hdrs = glob(
+ [
+ "include/clang/Interpreter/*.h",
+ ],
+ exclude = ["lib/Interpreter/Wasm.cpp"],
+ ),
includes = ["include"],
deps = [
":analysis",