[Mlir-commits] [mlir] [mlir][vector] Add deinterleave operation to vector dialect (PR #92409)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 22 03:19:21 PDT 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 4ae896fe979b7db501cabde4b6b3504478958682 ef52ff0b495d2b8639ac17d7cf1c4de38fe51c9b -- clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-outofline.cpp clang/include/clang/Sema/SemaRISCV.h clang/lib/StaticAnalyzer/Checkers/SetgidSetuidOrderChecker.cpp clang/test/Analysis/setgid-setuid-order-notes.c clang/test/Analysis/setgid-setuid-order.c clang/test/Modules/implicit-module-remap.cpp libc/src/__support/threads/CndVar.h libc/src/__support/threads/linux/CndVar.cpp libc/startup/baremetal/fini.cpp libc/startup/baremetal/init.cpp libcxx/include/__atomic/atomic_ref.h libcxx/include/__atomic/to_gcc_order.h libcxx/test/libcxx/atomics/atomics.ref/assert.compare_exchange_strong.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.compare_exchange_weak.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.ctor.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.load.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.store.pass.cpp libcxx/test/libcxx/atomics/atomics.ref/assert.wait.pass.cpp libcxx/test/std/atomics/atomics.ref/assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_and_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_or_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/bitwise_xor_assign.pass.cpp libcxx/test/std/atomics/atomics.ref/compare_exchange_strong.pass.cpp libcxx/test/std/atomics/atomics.ref/compare_exchange_weak.pass.cpp libcxx/test/std/atomics/atomics.ref/convert.pass.cpp libcxx/test/std/atomics/atomics.ref/ctor.pass.cpp libcxx/test/std/atomics/atomics.ref/deduction.pass.cpp libcxx/test/std/atomics/atomics.ref/exchange.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_add.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_and.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_or.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_sub.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_xor.pass.cpp libcxx/test/std/atomics/atomics.ref/increment_decrement.pass.cpp libcxx/test/std/atomics/atomics.ref/is_always_lock_free.pass.cpp libcxx/test/std/atomics/atomics.ref/load.pass.cpp libcxx/test/std/atomics/atomics.ref/member_types.pass.cpp libcxx/test/std/atomics/atomics.ref/notify_all.pass.cpp libcxx/test/std/atomics/atomics.ref/notify_one.pass.cpp libcxx/test/std/atomics/atomics.ref/operator_minus_equals.pass.cpp libcxx/test/std/atomics/atomics.ref/operator_plus_equals.pass.cpp libcxx/test/std/atomics/atomics.ref/required_alignment.pass.cpp libcxx/test/std/atomics/atomics.ref/requires-trivially-copyable.verify.cpp libcxx/test/std/atomics/atomics.ref/store.pass.cpp libcxx/test/std/atomics/atomics.ref/test_helper.h libcxx/test/std/atomics/atomics.ref/wait.pass.cpp libcxx/test/std/experimental/simd/simd.class/simd_copy.pass.cpp libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_copy.pass.cpp bolt/include/bolt/Core/BinaryContext.h bolt/include/bolt/Passes/BinaryPasses.h bolt/include/bolt/Passes/StokeInfo.h bolt/include/bolt/Profile/DataAggregator.h bolt/lib/Core/BinaryContext.cpp bolt/lib/Core/BinaryFunction.cpp bolt/lib/Passes/BinaryPasses.cpp bolt/lib/Profile/DataAggregator.cpp bolt/lib/Profile/YAMLProfileWriter.cpp bolt/lib/Rewrite/RewriteInstance.cpp bolt/runtime/instr.cpp clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp clang-tools-extra/clang-tidy/bugprone/IncorrectEnableIfCheck.cpp clang-tools-extra/clang-tidy/modernize/UseConstraintsCheck.cpp clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp clang-tools-extra/clangd/Hover.cpp clang-tools-extra/clangd/unittests/FindTargetTests.cpp clang-tools-extra/test/clang-tidy/checkers/misc/new-delete-overloads.cpp clang/include/clang/AST/ASTNodeTraverser.h clang/include/clang/AST/DeclTemplate.h clang/include/clang/AST/RecursiveASTVisitor.h clang/include/clang/AST/Type.h clang/include/clang/Basic/FileManager.h clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/AST/ASTContext.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/DeclPrinter.cpp clang/lib/AST/DeclTemplate.cpp clang/lib/AST/Interp/Interp.h clang/lib/AST/Interp/Pointer.h clang/lib/AST/JSONNodeDumper.cpp clang/lib/AST/ODRDiagsEmitter.cpp clang/lib/AST/ODRHash.cpp clang/lib/AST/TypePrinter.cpp clang/lib/Basic/FileManager.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Darwin.cpp clang/lib/Driver/ToolChains/Darwin.h clang/lib/Driver/ToolChains/ZOS.cpp clang/lib/ExtractAPI/DeclarationFragments.cpp clang/lib/Format/UnwrappedLineParser.cpp clang/lib/Index/IndexDecl.cpp clang/lib/Parse/ParseDecl.cpp clang/lib/Parse/ParseDeclCXX.cpp clang/lib/Parse/ParsePragma.cpp clang/lib/Sema/HLSLExternalSemaSource.cpp clang/lib/Sema/Sema.cpp clang/lib/Sema/SemaCast.cpp clang/lib/Sema/SemaChecking.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaLookup.cpp clang/lib/Sema/SemaRISCV.cpp clang/lib/Sema/SemaTemplate.cpp clang/lib/Sema/SemaTemplateDeduction.cpp clang/lib/Sema/SemaTemplateInstantiate.cpp clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/lib/Serialization/ASTReaderDecl.cpp clang/lib/Serialization/ASTWriterDecl.cpp clang/test/AST/ast-dump-expr-json.cpp clang/test/AST/ast-dump-expr.cpp clang/test/AST/ast-dump-stmt-json.cpp clang/test/Analysis/builtin_signbit.cpp clang/test/Analysis/cxxnewexpr-callback.cpp clang/test/CXX/basic/basic.stc/basic.stc.dynamic/basic.stc.dynamic.deallocation/p2.cpp clang/test/CXX/drs/cwg292.cpp clang/test/CXX/expr/expr.unary/expr.new/p14.cpp clang/test/CodeGen/aarch64-sve-vector-subscript-ops.c clang/test/CodeGen/catch-nullptr-and-nonzero-offset.c clang/test/CodeGen/constantexpr-fneg.c clang/test/CodeGen/darwin-target-variant.c clang/test/CodeGen/fat-lto-objects.c clang/test/CodeGen/functions.c clang/test/CodeGenCXX/cxx11-thread-local.cpp clang/test/CodeGenCXX/cxx1y-sized-deallocation.cpp clang/test/CodeGenCXX/cxx1z-aligned-allocation.cpp clang/test/CodeGenCXX/cxx2a-destroying-delete.cpp clang/test/CodeGenCXX/delete-two-arg.cpp clang/test/CodeGenCXX/delete.cpp clang/test/CodeGenCXX/dllimport.cpp clang/test/CodeGenCXX/new.cpp clang/test/CodeGenCXX/ubsan-nullability-arg.cpp clang/test/CodeGenCXX/weak-external.cpp clang/test/CodeGenCoroutines/coro-aligned-alloc-2.cpp clang/test/CodeGenCoroutines/coro-aligned-alloc.cpp clang/test/CodeGenCoroutines/coro-alloc.cpp clang/test/CodeGenCoroutines/coro-cleanup.cpp clang/test/CodeGenCoroutines/coro-dealloc.cpp clang/test/CodeGenCoroutines/coro-gro.cpp clang/test/CodeGenCoroutines/pr56919.cpp clang/test/Driver/aarch64-v95a.c clang/test/Driver/linker-wrapper-image.c clang/test/Driver/tocdata-cc1.c clang/test/Lexer/cxx-features.cpp clang/test/OpenMP/threadprivate_codegen.cpp clang/test/PCH/cxx1z-aligned-alloc.cpp clang/test/Parser/altivec.c clang/test/Parser/cxx-altivec.cpp clang/test/Parser/lax-conv.cpp clang/test/Sema/builtins.c clang/test/SemaCXX/MicrosoftExtensions.cpp clang/test/SemaCXX/builtin-operator-new-delete.cpp clang/test/SemaCXX/cxx1y-sized-deallocation.cpp clang/test/SemaCXX/unavailable_aligned_allocation.cpp clang/test/SemaCXX/warn-thread-safety-analysis.cpp clang/tools/libclang/CIndex.cpp clang/unittests/AST/ASTImporterTest.cpp clang/unittests/Format/FormatTest.cpp clang/unittests/Format/TokenAnnotatorTest.cpp clang/unittests/StaticAnalyzer/CallEventTest.cpp compiler-rt/lib/dfsan/dfsan_allocator.cpp compiler-rt/lib/dfsan/dfsan_custom.cpp compiler-rt/lib/lsan/lsan_allocator.cpp compiler-rt/lib/msan/msan_allocator.cpp compiler-rt/test/dfsan/custom.cpp flang/lib/Lower/Bridge.cpp flang/lib/Optimizer/CodeGen/CodeGen.cpp flang/lib/Optimizer/Dialect/CUF/CUFOps.cpp flang/lib/Optimizer/Transforms/AddDebugInfo.cpp libc/src/threads/linux/cnd_broadcast.cpp libc/src/threads/linux/cnd_destroy.cpp libc/src/threads/linux/cnd_init.cpp libc/src/threads/linux/cnd_signal.cpp libc/src/threads/linux/cnd_wait.cpp libcxx/include/__atomic/atomic_sync.h libcxx/include/__atomic/check_memory_order.h libcxx/include/__atomic/cxx_atomic_impl.h libcxx/include/atomic libcxx/include/experimental/__simd/scalar.h libcxx/include/experimental/__simd/simd.h libcxx/include/experimental/__simd/simd_mask.h libcxx/include/experimental/__simd/vec_ext.h libcxx/include/locale libcxx/include/vector libcxx/modules/std/atomic.inc libcxx/test/libcxx/language.support/support.dynamic/libcpp_deallocate.sh.cpp libcxx/test/std/containers/associative/map/map.value_compare/types.pass.cpp libcxx/test/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp libcxx/test/std/iterators/predef.iterators/counted.iterator/implicit_ctad.pass.cpp libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iterator/implicit_ctad.pass.cpp libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iterator/implicit_ctad.pass.cpp libcxx/test/std/iterators/predef.iterators/move.iterators/move.iterator/implicit_ctad.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp libcxx/test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp libcxx/test/std/strings/string.view/string.view.deduct/implicit.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.guard/implicit_ctad.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.scoped/implicit_ctad.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/implicit_ctad.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.cons/mutex.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/lock.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.shared/thread.lock.shared.locking/try_lock.pass.cpp libcxx/test/std/thread/thread.mutex/thread.lock/thread.lock.unique/implicit_ctad.pass.cpp libcxx/test/std/utilities/function.objects/func.search/func.search.bm/implicit_ctad.pass.cpp libcxx/test/std/utilities/function.objects/func.search/func.search.bmh/implicit_ctad.pass.cpp libcxx/test/std/utilities/function.objects/func.search/func.search.default/implicit_ctad.pass.cpp libcxx/test/std/utilities/function.objects/operations.implicit_ctad.pass.cpp libcxxabi/include/cxxabi.h libcxxabi/src/cxa_exception.cpp libcxxabi/src/cxa_exception.h libcxxabi/src/cxa_personality.cpp libunwind/include/__libunwind_config.h libunwind/src/Unwind-wasm.c libunwind/src/UnwindLevel1.c libunwind/src/libunwind.cpp lld/ELF/Config.h lld/ELF/Driver.cpp lldb/source/Commands/CommandObjectThread.cpp lldb/source/Interpreter/CommandInterpreter.cpp llvm/include/llvm/Analysis/CFG.h llvm/include/llvm/Analysis/LoopInfo.h llvm/include/llvm/Analysis/TargetFolder.h llvm/include/llvm/BinaryFormat/ELF.h llvm/include/llvm/IR/ConstantFolder.h llvm/include/llvm/ProfileData/InstrProf.h llvm/include/llvm/Transforms/Utils/LoopUtils.h llvm/lib/Analysis/CFG.cpp llvm/lib/Analysis/ConstantFolding.cpp llvm/lib/CodeGen/MachineScheduler.cpp llvm/lib/CodeGen/RegisterPressure.cpp llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp llvm/lib/IR/ConstantFold.cpp llvm/lib/IR/MDBuilder.cpp llvm/lib/IR/Module.cpp llvm/lib/ProfileData/InstrProf.cpp llvm/lib/ProfileData/InstrProfReader.cpp llvm/lib/Support/raw_socket_stream.cpp llvm/lib/Target/AArch64/AArch64PointerAuth.cpp llvm/lib/Target/AArch64/AArch64PointerAuth.h llvm/lib/Target/AArch64/AArch64Subtarget.cpp llvm/lib/Target/AArch64/AArch64Subtarget.h llvm/lib/Target/AArch64/AArch64TargetMachine.cpp llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp llvm/lib/Target/AMDGPU/SIISelLowering.cpp llvm/lib/Target/AMDGPU/SIISelLowering.h llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp llvm/lib/Target/X86/X86FlagsCopyLowering.cpp llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/Coroutines/CoroElide.cpp llvm/lib/Transforms/Coroutines/CoroFrame.cpp llvm/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp llvm/lib/Transforms/Utils/LoopUtils.cpp llvm/unittests/IR/MDBuilderTest.cpp llvm/unittests/Support/raw_socket_stream_test.cpp llvm/unittests/TargetParser/TargetParserTest.cpp mlir/include/mlir/Analysis/SliceAnalysis.h mlir/include/mlir/Interfaces/Utils/InferIntRangeCommon.h mlir/include/mlir/Transforms/RegionUtils.h mlir/lib/Analysis/SliceAnalysis.cpp mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp mlir/lib/Dialect/Affine/Utils/LoopFusionUtils.cpp mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp mlir/lib/Dialect/ArmSME/Transforms/TileAllocation.cpp mlir/lib/Dialect/Index/IR/InferIntRangeInterfaceImpls.cpp mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp mlir/lib/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.cpp mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp mlir/lib/Target/LLVMIR/ModuleTranslation.cpp mlir/lib/Transforms/Mem2Reg.cpp mlir/lib/Transforms/SROA.cpp mlir/lib/Transforms/TopologicalSort.cpp mlir/lib/Transforms/Utils/RegionUtils.cpp mlir/lib/Transforms/ViewOpGraph.cpp mlir/test/lib/Analysis/TestSlice.cpp mlir/test/lib/Dialect/Test/TestOpDefs.cpp mlir/include/mlir/Analysis/TopologicalSortUtils.h mlir/lib/Analysis/TopologicalSortUtils.cpp mlir/test/lib/Analysis/TestTopologicalSort.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h
index 9d9beecf75..58e240cdf3 100644
--- a/libcxxabi/include/cxxabi.h
+++ b/libcxxabi/include/cxxabi.h
@@ -51,14 +51,13 @@ extern _LIBCXXABI_FUNC_VIS __cxa_exception*
 __cxa_init_primary_exception(void* object, std::type_info* tinfo, void(_LIBCXXABI_DTOR_FUNC* dest)(void*)) throw();
 
 // 2.4.3 Throwing the Exception Object
-extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void
-__cxa_throw(void *thrown_exception, std::type_info *tinfo,
-#ifdef __WASM_EXCEPTIONS__
-            // In Wasm, a destructor returns its argument
-            void *(_LIBCXXABI_DTOR_FUNC *dest)(void *));
-#else
+extern _LIBCXXABI_FUNC_VIS _LIBCXXABI_NORETURN void __cxa_throw(void* thrown_exception, std::type_info* tinfo,
+#  ifdef __WASM_EXCEPTIONS__
+                                                                // In Wasm, a destructor returns its argument
+                                                                void*(_LIBCXXABI_DTOR_FUNC* dest)(void*));
+#  else
             void (_LIBCXXABI_DTOR_FUNC *dest)(void *));
-#endif
+#  endif
 
 // 2.5.3 Exception Handlers
 extern _LIBCXXABI_FUNC_VIS void *
diff --git a/libcxxabi/src/cxa_exception.cpp b/libcxxabi/src/cxa_exception.cpp
index 3141d50a6b..3889fef1d6 100644
--- a/libcxxabi/src/cxa_exception.cpp
+++ b/libcxxabi/src/cxa_exception.cpp
@@ -269,7 +269,7 @@ exception.
 void
 #ifdef __WASM_EXCEPTIONS__
 // In Wasm, a destructor returns its argument
-__cxa_throw(void *thrown_object, std::type_info *tinfo, void *(_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
+__cxa_throw(void* thrown_object, std::type_info* tinfo, void*(_LIBCXXABI_DTOR_FUNC* dest)(void*)) {
 #else
 __cxa_throw(void *thrown_object, std::type_info *tinfo, void (_LIBCXXABI_DTOR_FUNC *dest)(void *)) {
 #endif
diff --git a/libcxxabi/src/cxa_personality.cpp b/libcxxabi/src/cxa_personality.cpp
index 843a18a4cb..eb18932ef0 100644
--- a/libcxxabi/src/cxa_personality.cpp
+++ b/libcxxabi/src/cxa_personality.cpp
@@ -548,7 +548,7 @@ set_registers(_Unwind_Exception* unwind_exception, _Unwind_Context* context,
               const scan_results& results)
 {
 #if defined(__USING_SJLJ_EXCEPTIONS__) || defined(__WASM_EXCEPTIONS__)
-#define __builtin_eh_return_data_regno(regno) regno
+#  define __builtin_eh_return_data_regno(regno) regno
 #elif defined(__ibmxl__)
 // IBM xlclang++ compiler does not support __builtin_eh_return_data_regno.
 #define __builtin_eh_return_data_regno(regno) regno + 3
@@ -694,157 +694,133 @@ static void scan_eh_tab(scan_results &results, _Unwind_Action actions,
         uintptr_t landingPad = readEncodedPointer(&callSitePtr, callSiteEncoding);
         uintptr_t actionEntry = readULEB128(&callSitePtr);
         if ((start <= ipOffset) && (ipOffset < (start + length)))
-#else  // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
-        // ip is 1-based index into this table
+#else  // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__                                                             \
+       // ip is 1-based index into this table
         uintptr_t landingPad = readULEB128(&callSitePtr);
         uintptr_t actionEntry = readULEB128(&callSitePtr);
         if (--ip == 0)
 #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
         {
-            // Found the call site containing ip.
+          // Found the call site containing ip.
 #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
-            if (landingPad == 0)
-            {
-                // No handler here
-                results.reason = _URC_CONTINUE_UNWIND;
-                return;
-            }
-            landingPad = (uintptr_t)lpStart + landingPad;
+          if (landingPad == 0) {
+            // No handler here
+            results.reason = _URC_CONTINUE_UNWIND;
+            return;
+          }
+          landingPad = (uintptr_t)lpStart + landingPad;
 #else  // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
-            ++landingPad;
+          ++landingPad;
 #endif // __USING_SJLJ_EXCEPTIONS__ || __WASM_EXCEPTIONS__
-            results.landingPad = landingPad;
-            if (actionEntry == 0)
-            {
-                // Found a cleanup
-                results.reason = (actions & _UA_SEARCH_PHASE) ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND;
+          results.landingPad = landingPad;
+          if (actionEntry == 0) {
+            // Found a cleanup
+            results.reason = (actions & _UA_SEARCH_PHASE) ? _URC_CONTINUE_UNWIND : _URC_HANDLER_FOUND;
+            return;
+          }
+          // Convert 1-based byte offset into
+          const uint8_t* action = actionTableStart + (actionEntry - 1);
+          bool hasCleanup = false;
+          // Scan action entries until you find a matching handler, cleanup, or the end of action list
+          while (true) {
+            const uint8_t* actionRecord = action;
+            int64_t ttypeIndex = readSLEB128(&action);
+            if (ttypeIndex > 0) {
+              // Found a catch, does it actually catch?
+              // First check for catch (...)
+              const __shim_type_info* catchType =
+                  get_shim_type_info(static_cast<uint64_t>(ttypeIndex), classInfo, ttypeEncoding, native_exception,
+                                     unwind_exception, base);
+              if (catchType == 0) {
+                // Found catch (...) catches everything, including
+                // foreign exceptions. This is search phase, cleanup
+                // phase with foreign exception, or forced unwinding.
+                assert(actions & (_UA_SEARCH_PHASE | _UA_HANDLER_FRAME | _UA_FORCE_UNWIND));
+                results.ttypeIndex = ttypeIndex;
+                results.actionRecord = actionRecord;
+                results.adjustedPtr = get_thrown_object_ptr(unwind_exception);
+                results.reason = _URC_HANDLER_FOUND;
                 return;
-            }
-            // Convert 1-based byte offset into
-            const uint8_t* action = actionTableStart + (actionEntry - 1);
-            bool hasCleanup = false;
-            // Scan action entries until you find a matching handler, cleanup, or the end of action list
-            while (true)
-            {
-                const uint8_t* actionRecord = action;
-                int64_t ttypeIndex = readSLEB128(&action);
-                if (ttypeIndex > 0)
-                {
-                    // Found a catch, does it actually catch?
-                    // First check for catch (...)
-                    const __shim_type_info* catchType =
-                        get_shim_type_info(static_cast<uint64_t>(ttypeIndex),
-                                           classInfo, ttypeEncoding,
-                                           native_exception, unwind_exception,
-                                           base);
-                    if (catchType == 0)
-                    {
-                        // Found catch (...) catches everything, including
-                        // foreign exceptions. This is search phase, cleanup
-                        // phase with foreign exception, or forced unwinding.
-                        assert(actions & (_UA_SEARCH_PHASE | _UA_HANDLER_FRAME |
-                                          _UA_FORCE_UNWIND));
-                        results.ttypeIndex = ttypeIndex;
-                        results.actionRecord = actionRecord;
-                        results.adjustedPtr =
-                            get_thrown_object_ptr(unwind_exception);
-                        results.reason = _URC_HANDLER_FOUND;
-                        return;
-                    }
-                    // Else this is a catch (T) clause and will never
-                    //    catch a foreign exception
-                    else if (native_exception)
-                    {
-                        __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception+1) - 1;
-                        void* adjustedPtr = get_thrown_object_ptr(unwind_exception);
-                        const __shim_type_info* excpType =
-                            static_cast<const __shim_type_info*>(exception_header->exceptionType);
-                        if (adjustedPtr == 0 || excpType == 0)
-                        {
-                            // Something very bad happened
-                            call_terminate(native_exception, unwind_exception);
-                        }
-                        if (catchType->can_catch(excpType, adjustedPtr))
-                        {
-                            // Found a matching handler. This is either search
-                            // phase or forced unwinding.
-                            assert(actions &
-                                   (_UA_SEARCH_PHASE | _UA_FORCE_UNWIND));
-                            results.ttypeIndex = ttypeIndex;
-                            results.actionRecord = actionRecord;
-                            results.adjustedPtr = adjustedPtr;
-                            results.reason = _URC_HANDLER_FOUND;
-                            return;
-                        }
-                    }
-                    // Scan next action ...
+              }
+              // Else this is a catch (T) clause and will never
+              //    catch a foreign exception
+              else if (native_exception) {
+                __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception + 1) - 1;
+                void* adjustedPtr = get_thrown_object_ptr(unwind_exception);
+                const __shim_type_info* excpType =
+                    static_cast<const __shim_type_info*>(exception_header->exceptionType);
+                if (adjustedPtr == 0 || excpType == 0) {
+                  // Something very bad happened
+                  call_terminate(native_exception, unwind_exception);
                 }
-                else if (ttypeIndex < 0)
-                {
-                    // Found an exception specification.
-                    if (actions & _UA_FORCE_UNWIND) {
-                        // Skip if forced unwinding.
-                    } else if (native_exception) {
-                        // Does the exception spec catch this native exception?
-                        __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception+1) - 1;
-                        void* adjustedPtr = get_thrown_object_ptr(unwind_exception);
-                        const __shim_type_info* excpType =
-                            static_cast<const __shim_type_info*>(exception_header->exceptionType);
-                        if (adjustedPtr == 0 || excpType == 0)
-                        {
-                            // Something very bad happened
-                            call_terminate(native_exception, unwind_exception);
-                        }
-                        if (exception_spec_can_catch(ttypeIndex, classInfo,
-                                                     ttypeEncoding, excpType,
-                                                     adjustedPtr,
-                                                     unwind_exception, base))
-                        {
-                            // Native exception caught by exception
-                            // specification.
-                            assert(actions & _UA_SEARCH_PHASE);
-                            results.ttypeIndex = ttypeIndex;
-                            results.actionRecord = actionRecord;
-                            results.adjustedPtr = adjustedPtr;
-                            results.reason = _URC_HANDLER_FOUND;
-                            return;
-                        }
-                    } else {
-                        // foreign exception caught by exception spec
-                        results.ttypeIndex = ttypeIndex;
-                        results.actionRecord = actionRecord;
-                        results.adjustedPtr =
-                            get_thrown_object_ptr(unwind_exception);
-                        results.reason = _URC_HANDLER_FOUND;
-                        return;
-                    }
-                    // Scan next action ...
-                } else {
-                    hasCleanup = true;
+                if (catchType->can_catch(excpType, adjustedPtr)) {
+                  // Found a matching handler. This is either search
+                  // phase or forced unwinding.
+                  assert(actions & (_UA_SEARCH_PHASE | _UA_FORCE_UNWIND));
+                  results.ttypeIndex = ttypeIndex;
+                  results.actionRecord = actionRecord;
+                  results.adjustedPtr = adjustedPtr;
+                  results.reason = _URC_HANDLER_FOUND;
+                  return;
                 }
-                const uint8_t* temp = action;
-                int64_t actionOffset = readSLEB128(&temp);
-                if (actionOffset == 0)
-                {
-                    // End of action list. If this is phase 2 and we have found
-                    // a cleanup (ttypeIndex=0), return _URC_HANDLER_FOUND;
-                    // otherwise return _URC_CONTINUE_UNWIND.
-                    results.reason = hasCleanup && actions & _UA_CLEANUP_PHASE
-                                         ? _URC_HANDLER_FOUND
-                                         : _URC_CONTINUE_UNWIND;
-                    return;
+              }
+              // Scan next action ...
+            } else if (ttypeIndex < 0) {
+              // Found an exception specification.
+              if (actions & _UA_FORCE_UNWIND) {
+                // Skip if forced unwinding.
+              } else if (native_exception) {
+                // Does the exception spec catch this native exception?
+                __cxa_exception* exception_header = (__cxa_exception*)(unwind_exception + 1) - 1;
+                void* adjustedPtr = get_thrown_object_ptr(unwind_exception);
+                const __shim_type_info* excpType =
+                    static_cast<const __shim_type_info*>(exception_header->exceptionType);
+                if (adjustedPtr == 0 || excpType == 0) {
+                  // Something very bad happened
+                  call_terminate(native_exception, unwind_exception);
+                }
+                if (exception_spec_can_catch(ttypeIndex, classInfo, ttypeEncoding, excpType, adjustedPtr,
+                                             unwind_exception, base)) {
+                  // Native exception caught by exception
+                  // specification.
+                  assert(actions & _UA_SEARCH_PHASE);
+                  results.ttypeIndex = ttypeIndex;
+                  results.actionRecord = actionRecord;
+                  results.adjustedPtr = adjustedPtr;
+                  results.reason = _URC_HANDLER_FOUND;
+                  return;
                 }
-                // Go to next action
-                action += actionOffset;
-            }  // there is no break out of this loop, only return
+              } else {
+                // foreign exception caught by exception spec
+                results.ttypeIndex = ttypeIndex;
+                results.actionRecord = actionRecord;
+                results.adjustedPtr = get_thrown_object_ptr(unwind_exception);
+                results.reason = _URC_HANDLER_FOUND;
+                return;
+              }
+              // Scan next action ...
+            } else {
+              hasCleanup = true;
+            }
+            const uint8_t* temp = action;
+            int64_t actionOffset = readSLEB128(&temp);
+            if (actionOffset == 0) {
+              // End of action list. If this is phase 2 and we have found
+              // a cleanup (ttypeIndex=0), return _URC_HANDLER_FOUND;
+              // otherwise return _URC_CONTINUE_UNWIND.
+              results.reason = hasCleanup && actions & _UA_CLEANUP_PHASE ? _URC_HANDLER_FOUND : _URC_CONTINUE_UNWIND;
+              return;
+            }
+            // Go to next action
+            action += actionOffset;
+          } // there is no break out of this loop, only return
         }
 #if !defined(__USING_SJLJ_EXCEPTIONS__) && !defined(__WASM_EXCEPTIONS__)
-        else if (ipOffset < start)
-        {
-            // There is no call site for this ip
-            // Something bad has happened.  We should never get here.
-            // Possible stack corruption.
-            call_terminate(native_exception, unwind_exception);
+        else if (ipOffset < start) {
+          // There is no call site for this ip
+          // Something bad has happened.  We should never get here.
+          // Possible stack corruption.
+          call_terminate(native_exception, unwind_exception);
         }
 #endif // !__USING_SJLJ_EXCEPTIONS__ && !__WASM_EXCEPTIONS__
     }  // there might be some tricky cases which break out of this loop
@@ -903,7 +879,7 @@ _UA_CLEANUP_PHASE
 */
 
 #if !defined(_LIBCXXABI_ARM_EHABI)
-#ifdef __WASM_EXCEPTIONS__
+#  ifdef __WASM_EXCEPTIONS__
 _Unwind_Reason_Code __gxx_personality_wasm0
 #elif defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
 static _Unwind_Reason_Code __gxx_personality_imp
@@ -972,7 +948,7 @@ __gxx_personality_v0
             exc->languageSpecificData = results.languageSpecificData;
             exc->catchTemp = reinterpret_cast<void*>(results.landingPad);
             exc->adjustedPtr = results.adjustedPtr;
-#ifdef __WASM_EXCEPTIONS__
+#  ifdef __WASM_EXCEPTIONS__
             // Wasm only uses a single phase (_UA_SEARCH_PHASE), so save the
             // results here.
             set_registers(unwind_exception, context, results);

``````````

</details>


https://github.com/llvm/llvm-project/pull/92409


More information about the Mlir-commits mailing list