From b4c4496ef8013df25b6368bdebf082d223d6afed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=A4ssig?= Date: Fri, 13 Jun 2025 13:02:27 +0000 Subject: [PATCH] 8354196: C2: reorder and capitalize phase definition Reviewed-by: chagedorn, mchevalier --- src/hotspot/share/opto/phasetype.hpp | 66 +++---- .../lib/ir_framework/CompilePhase.java | 173 +++++++++--------- 2 files changed, 120 insertions(+), 119 deletions(-) diff --git a/src/hotspot/share/opto/phasetype.hpp b/src/hotspot/share/opto/phasetype.hpp index 2546b319762..517f0aa72c7 100644 --- a/src/hotspot/share/opto/phasetype.hpp +++ b/src/hotspot/share/opto/phasetype.hpp @@ -47,12 +47,15 @@ flags(EXPAND_VBOX, "Expand VectorBox") \ flags(ELIMINATE_VBOX_ALLOC, "Eliminate VectorBoxAllocate") \ flags(ITER_GVN_BEFORE_EA, "Iter GVN before EA") \ - flags(ITER_GVN_AFTER_VECTOR, "Iter GVN after vector box elimination") \ + flags(ITER_GVN_AFTER_VECTOR, "Iter GVN after Vector Box Elimination") \ flags(BEFORE_LOOP_OPTS, "Before Loop Optimizations") \ - flags(BEFORE_BEAUTIFY_LOOPS, "Before beautify loops") \ - flags(AFTER_BEAUTIFY_LOOPS, "After beautify loops") \ - flags(BEFORE_LOOP_UNROLLING, "Before Loop Unrolling") \ - flags(AFTER_LOOP_UNROLLING, "After Loop Unrolling") \ + flags(PHASEIDEAL_BEFORE_EA, "PhaseIdealLoop before EA") \ + flags(AFTER_EA, "After Escape Analysis") \ + flags(ITER_GVN_AFTER_EA, "Iter GVN after EA") \ + flags(BEFORE_BEAUTIFY_LOOPS, "Before Beautify Loops") \ + flags(AFTER_BEAUTIFY_LOOPS, "After Beautify Loops") \ + flags(BEFORE_CLOOPS, "Before CountedLoop") \ + flags(AFTER_CLOOPS, "After CountedLoop") \ flags(BEFORE_SPLIT_IF, "Before Split-If") \ flags(AFTER_SPLIT_IF, "After Split-If") \ flags(BEFORE_LOOP_PREDICATION_IC, "Before Loop Predication IC") \ @@ -69,22 +72,19 @@ flags(AFTER_LOOP_MULTIVERSIONING, "After Loop Multiversioning") \ flags(BEFORE_RANGE_CHECK_ELIMINATION, "Before Range Check Elimination") \ flags(AFTER_RANGE_CHECK_ELIMINATION, "After Range Check Elimination") \ + flags(ITER_GVN_AFTER_ELIMINATION, "Iter GVN after Eliminating Allocations and Locks") \ flags(BEFORE_PRE_MAIN_POST, "Before Pre/Main/Post Loops") \ flags(AFTER_PRE_MAIN_POST, "After Pre/Main/Post Loops") \ - flags(AUTO_VECTORIZATION1_BEFORE_APPLY, "AutoVectorization 1, Before Apply") \ - flags(AUTO_VECTORIZATION2_AFTER_REORDER, "AutoVectorization 2, After Apply Memop Reordering") \ - flags(AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT, "AutoVectorization 3, After Adjusting Pre-Loop Limit") \ - flags(AUTO_VECTORIZATION4_AFTER_SPECULATIVE_RUNTIME_CHECKS, "AutoVectorization 4, After Adding Speculative Runtime Checks") \ - flags(AUTO_VECTORIZATION5_AFTER_APPLY, "AutoVectorization 5, After Apply") \ - flags(BEFORE_CLOOPS, "Before CountedLoop") \ - flags(AFTER_CLOOPS, "After CountedLoop") \ - flags(PHASEIDEAL_BEFORE_EA, "PhaseIdealLoop before EA") \ - flags(AFTER_EA, "After Escape Analysis") \ - flags(ITER_GVN_AFTER_EA, "Iter GVN after EA") \ - flags(ITER_GVN_AFTER_ELIMINATION, "Iter GVN after eliminating allocations and locks") \ + flags(BEFORE_LOOP_UNROLLING, "Before Loop Unrolling") \ + flags(AFTER_LOOP_UNROLLING, "After Loop Unrolling") \ flags(PHASEIDEALLOOP1, "PhaseIdealLoop 1") \ flags(PHASEIDEALLOOP2, "PhaseIdealLoop 2") \ flags(PHASEIDEALLOOP3, "PhaseIdealLoop 3") \ + flags(AUTO_VECTORIZATION1_BEFORE_APPLY, "AutoVectorization 1, before Apply") \ + flags(AUTO_VECTORIZATION2_AFTER_REORDER, "AutoVectorization 2, after Apply Memop Reordering") \ + flags(AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT, "AutoVectorization 3, after Adjusting Pre-loop Limit") \ + flags(AUTO_VECTORIZATION4_AFTER_SPECULATIVE_RUNTIME_CHECKS, "AutoVectorization 4, after Adding Speculative Runtime Checks") \ + flags(AUTO_VECTORIZATION5_AFTER_APPLY, "AutoVectorization 5, after Apply") \ flags(BEFORE_CCP1, "Before PhaseCCP 1") \ flags(CCP1, "PhaseCCP 1") \ flags(ITER_GVN2, "Iter GVN 2") \ @@ -94,26 +94,26 @@ flags(BEFORE_MACRO_EXPANSION , "Before Macro Expansion") \ flags(AFTER_MACRO_EXPANSION_STEP, "After Macro Expansion Step") \ flags(AFTER_MACRO_EXPANSION, "After Macro Expansion") \ - flags(BARRIER_EXPANSION, "Barrier expand") \ - flags(OPTIMIZE_FINISHED, "Optimize finished") \ - flags(BEFORE_MATCHING, "Before matching") \ - flags(MATCHING, "After matching") \ - flags(GLOBAL_CODE_MOTION, "Global code motion") \ - flags(INITIAL_LIVENESS, "Initial liveness") \ - flags(LIVE_RANGE_STRETCHING, "Live range stretching") \ - flags(AGGRESSIVE_COALESCING, "Aggressive coalescing") \ - flags(INITIAL_SPILLING, "Initial spilling") \ - flags(CONSERVATIVE_COALESCING, "Conservative coalescing") \ - flags(ITERATIVE_SPILLING, "Iterative spilling") \ - flags(AFTER_ITERATIVE_SPILLING, "After iterative spilling") \ - flags(POST_ALLOCATION_COPY_REMOVAL, "Post-allocation copy removal") \ - flags(MERGE_MULTI_DEFS, "Merge multiple definitions") \ - flags(FIX_UP_SPILLS, "Fix up spills") \ + flags(BARRIER_EXPANSION, "Barrier Expand") \ + flags(OPTIMIZE_FINISHED, "Optimize Finished") \ + flags(BEFORE_MATCHING, "Before Matching") \ + flags(MATCHING, "After Matching") \ + flags(GLOBAL_CODE_MOTION, "Global Code Motion") \ + flags(INITIAL_LIVENESS, "Initial Liveness") \ + flags(LIVE_RANGE_STRETCHING, "Live Range Stretching") \ + flags(AGGRESSIVE_COALESCING, "Aggressive Coalescing") \ + flags(INITIAL_SPILLING, "Initial Spilling") \ + flags(CONSERVATIVE_COALESCING, "Conservative Coalescing") \ + flags(ITERATIVE_SPILLING, "Iterative Spilling") \ + flags(AFTER_ITERATIVE_SPILLING, "After Iterative Spilling") \ + flags(POST_ALLOCATION_COPY_REMOVAL, "Post-allocation Copy Removal") \ + flags(MERGE_MULTI_DEFS, "Merge Multiple Definitions") \ + flags(FIX_UP_SPILLS, "Fix up Spills") \ flags(REGISTER_ALLOCATION, "Register Allocation") \ flags(BLOCK_ORDERING, "Block Ordering") \ flags(PEEPHOLE, "Peephole") \ - flags(POSTALLOC_EXPAND, "Post-Allocation Expand") \ - flags(MACH_ANALYSIS, "After mach analysis") \ + flags(POSTALLOC_EXPAND, "Post-allocation Expand") \ + flags(MACH_ANALYSIS, "After Mach Analysis") \ flags(FINAL_CODE, "Final Code") \ flags(END, "End") \ flags(FAILURE, "Failure") \ diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java b/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java index 46900085b12..b0e5f2fda5c 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/CompilePhase.java @@ -37,95 +37,96 @@ import java.util.Map; * are treated as a separated compile phase as well. */ public enum CompilePhase { - DEFAULT("For IR node placeholder strings as defined in class IRNode only"), + DEFAULT( "For IR node placeholder strings as defined in class IRNode only"), - BEFORE_STRINGOPTS("Before StringOpts"), - AFTER_STRINGOPTS("After StringOpts"), - BEFORE_REMOVEUSELESS("Before RemoveUseless"), - AFTER_PARSING("After Parsing"), - BEFORE_ITER_GVN("Before Iter GVN"), - ITER_GVN1("Iter GVN 1"), - AFTER_ITER_GVN_STEP("After Iter GVN Step"), - AFTER_ITER_GVN("After Iter GVN"), - INCREMENTAL_INLINE_STEP("Incremental Inline Step"), - INCREMENTAL_INLINE_CLEANUP("Incremental Inline Cleanup"), - INCREMENTAL_INLINE("Incremental Inline"), - INCREMENTAL_BOXING_INLINE("Incremental Boxing Inline"), - EXPAND_VUNBOX("Expand VectorUnbox"), - SCALARIZE_VBOX("Scalarize VectorBox"), - INLINE_VECTOR_REBOX("Inline Vector Rebox Calls"), - EXPAND_VBOX("Expand VectorBox"), - ELIMINATE_VBOX_ALLOC("Eliminate VectorBoxAllocate"), - ITER_GVN_BEFORE_EA("Iter GVN before EA"), - ITER_GVN_AFTER_VECTOR("Iter GVN after vector box elimination"), - BEFORE_LOOP_OPTS("Before Loop Optimizations"), - BEFORE_BEAUTIFY_LOOPS("Before beautify loops"), - AFTER_BEAUTIFY_LOOPS("After beautify loops"), - BEFORE_LOOP_UNROLLING("Before Loop Unrolling"), - AFTER_LOOP_UNROLLING("After Loop Unrolling"), - BEFORE_SPLIT_IF("Before Split-If"), - AFTER_SPLIT_IF("After Split-If"), - BEFORE_LOOP_PREDICATION_IC("Before Loop Predication IC"), - AFTER_LOOP_PREDICATION_IC("After Loop Predication IC"), - BEFORE_LOOP_PREDICATION_RC("Before Loop Predication RC"), - AFTER_LOOP_PREDICATION_RC("After Loop Predication RC"), - BEFORE_PARTIAL_PEELING("Before Partial Peeling"), - AFTER_PARTIAL_PEELING("After Partial Peeling"), - BEFORE_LOOP_PEELING("Before Loop Peeling"), - AFTER_LOOP_PEELING("After Loop Peeling"), - BEFORE_LOOP_UNSWITCHING("Before Loop Unswitching"), - AFTER_LOOP_UNSWITCHING("After Loop Unswitching"), - BEFORE_RANGE_CHECK_ELIMINATION("Before Range Check Elimination"), - AFTER_RANGE_CHECK_ELIMINATION("After Range Check Elimination"), - BEFORE_PRE_MAIN_POST("Before Pre/Main/Post Loops"), - AFTER_PRE_MAIN_POST("After Pre/Main/Post Loops"), - SUPERWORD1_BEFORE_SCHEDULE("Superword 1, Before Schedule"), - SUPERWORD2_BEFORE_OUTPUT("Superword 2, Before Output"), - SUPERWORD3_AFTER_OUTPUT("Superword 3, After Output"), + BEFORE_STRINGOPTS( "Before StringOpts"), + AFTER_STRINGOPTS( "After StringOpts"), + BEFORE_REMOVEUSELESS( "Before RemoveUseless"), + AFTER_PARSING( "After Parsing"), + BEFORE_ITER_GVN( "Before Iter GVN"), + ITER_GVN1( "Iter GVN 1"), + AFTER_ITER_GVN_STEP( "After Iter GVN Step"), + AFTER_ITER_GVN( "After Iter GVN"), + INCREMENTAL_INLINE_STEP( "Incremental Inline Step"), + INCREMENTAL_INLINE_CLEANUP( "Incremental Inline Cleanup"), + INCREMENTAL_INLINE( "Incremental Inline"), + INCREMENTAL_BOXING_INLINE( "Incremental Boxing Inline"), + EXPAND_VUNBOX( "Expand VectorUnbox"), + SCALARIZE_VBOX( "Scalarize VectorBox"), + INLINE_VECTOR_REBOX( "Inline Vector Rebox Calls"), + EXPAND_VBOX( "Expand VectorBox"), + ELIMINATE_VBOX_ALLOC( "Eliminate VectorBoxAllocate"), + ITER_GVN_BEFORE_EA( "Iter GVN before EA"), + ITER_GVN_AFTER_VECTOR( "Iter GVN after Vector Box Elimination"), + BEFORE_LOOP_OPTS( "Before Loop Optimizations"), + PHASEIDEAL_BEFORE_EA( "PhaseIdealLoop before EA"), + AFTER_EA( "After Escape Analysis"), + ITER_GVN_AFTER_EA( "Iter GVN after EA"), + BEFORE_BEAUTIFY_LOOPS( "Before Beautify Loops"), + AFTER_BEAUTIFY_LOOPS( "After Beautify Loops"), // Match on very first BEFORE_CLOOPS phase (there could be multiple phases for multiple loops in the code). - BEFORE_CLOOPS("Before CountedLoop", RegexType.IDEAL_INDEPENDENT, ActionOnRepeat.KEEP_FIRST), - AFTER_CLOOPS("After CountedLoop"), - PHASEIDEAL_BEFORE_EA("PhaseIdealLoop before EA"), - AFTER_EA("After Escape Analysis"), - ITER_GVN_AFTER_EA("Iter GVN after EA"), - ITER_GVN_AFTER_ELIMINATION("Iter GVN after eliminating allocations and locks"), - PHASEIDEALLOOP1("PhaseIdealLoop 1"), - PHASEIDEALLOOP2("PhaseIdealLoop 2"), - PHASEIDEALLOOP3("PhaseIdealLoop 3"), - BEFORE_CCP1("Before PhaseCCP 1"), - CCP1("PhaseCCP 1"), - ITER_GVN2("Iter GVN 2"), - PHASEIDEALLOOP_ITERATIONS("PhaseIdealLoop iterations"), - AFTER_LOOP_OPTS("After Loop Optimizations"), - AFTER_MERGE_STORES("After Merge Stores"), - BEFORE_MACRO_EXPANSION("Before Macro Expansion"), - AFTER_MACRO_EXPANSION_STEP("After Macro Expansion Step"), - AFTER_MACRO_EXPANSION("After Macro Expansion"), - BARRIER_EXPANSION("Barrier expand"), - OPTIMIZE_FINISHED("Optimize finished"), - PRINT_IDEAL("PrintIdeal"), - BEFORE_MATCHING("Before matching"), - MATCHING("After matching", RegexType.MACH), - GLOBAL_CODE_MOTION("Global code motion", RegexType.MACH), - INITIAL_LIVENESS("Initial liveness", RegexType.MACH), - LIVE_RANGE_STRETCHING("Live range stretching", RegexType.MACH), - AGGRESSIVE_COALESCING("Aggressive coalescing", RegexType.MACH), - INITIAL_SPILLING("Initial spilling", RegexType.MACH), - CONSERVATIVE_COALESCING("Conservative coalescing", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), - ITERATIVE_SPILLING("Iterative spilling", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), - AFTER_ITERATIVE_SPILLING("After iterative spilling", RegexType.MACH), - POST_ALLOCATION_COPY_REMOVAL("Post-allocation copy removal", RegexType.MACH), - MERGE_MULTI_DEFS("Merge multiple definitions", RegexType.MACH), - FIX_UP_SPILLS("Fix up spills", RegexType.MACH), - REGISTER_ALLOCATION("Register Allocation", RegexType.MACH), - BLOCK_ORDERING("Block Ordering", RegexType.MACH), - PEEPHOLE("Peephole", RegexType.MACH), - POSTALLOC_EXPAND("Post-Allocation Expand", RegexType.MACH), - MACH_ANALYSIS("After mach analysis", RegexType.MACH), - FINAL_CODE("Final Code", RegexType.MACH), - END("End"), + BEFORE_CLOOPS( "Before CountedLoop", RegexType.IDEAL_INDEPENDENT, ActionOnRepeat.KEEP_FIRST), + AFTER_CLOOPS( "After CountedLoop"), + BEFORE_LOOP_UNROLLING( "Before Loop Unrolling"), + AFTER_LOOP_UNROLLING( "After Loop Unrolling"), + BEFORE_SPLIT_IF( "Before Split-If"), + AFTER_SPLIT_IF( "After Split-If"), + BEFORE_LOOP_PREDICATION_IC( "Before Loop Predication IC"), + AFTER_LOOP_PREDICATION_IC( "After Loop Predication IC"), + BEFORE_LOOP_PREDICATION_RC( "Before Loop Predication RC"), + AFTER_LOOP_PREDICATION_RC( "After Loop Predication RC"), + BEFORE_PARTIAL_PEELING( "Before Partial Peeling"), + AFTER_PARTIAL_PEELING( "After Partial Peeling"), + BEFORE_LOOP_PEELING( "Before Loop Peeling"), + AFTER_LOOP_PEELING( "After Loop Peeling"), + BEFORE_LOOP_UNSWITCHING( "Before Loop Unswitching"), + AFTER_LOOP_UNSWITCHING( "After Loop Unswitching"), + BEFORE_RANGE_CHECK_ELIMINATION( "Before Range Check Elimination"), + AFTER_RANGE_CHECK_ELIMINATION( "After Range Check Elimination"), + ITER_GVN_AFTER_ELIMINATION( "Iter GVN after Eliminating Allocations and Locks"), + BEFORE_PRE_MAIN_POST( "Before Pre/Main/Post Loops"), + AFTER_PRE_MAIN_POST( "After Pre/Main/Post Loops"), + PHASEIDEALLOOP1( "PhaseIdealLoop 1"), + PHASEIDEALLOOP2( "PhaseIdealLoop 2"), + PHASEIDEALLOOP3( "PhaseIdealLoop 3"), + AUTO_VECTORIZATION1_BEFORE_APPLY( "AutoVectorization 1, before Apply"), + AUTO_VECTORIZATION2_AFTER_REORDER( "AutoVectorization 2, after Apply Memop Reordering"), + AUTO_VECTORIZATION3_AFTER_ADJUST_LIMIT( "AutoVectorization 3, after Adjusting Pre-loop Limit"), + AUTO_VECTORIZATION4_AFTER_SPECULATIVE_RUNTIME_CHECKS("AutoVectorization 4, after Adding Speculative Runtime Checks"), + BEFORE_CCP1( "Before PhaseCCP 1"), + CCP1( "PhaseCCP 1"), + ITER_GVN2( "Iter GVN 2"), + PHASEIDEALLOOP_ITERATIONS( "PhaseIdealLoop Iterations"), + AFTER_LOOP_OPTS( "After Loop Optimizations"), + AFTER_MERGE_STORES( "After Merge Stores"), + BEFORE_MACRO_EXPANSION( "Before Macro Expansion"), + AFTER_MACRO_EXPANSION_STEP( "After Macro Expansion Step"), + AFTER_MACRO_EXPANSION( "After Macro Expansion"), + BARRIER_EXPANSION( "Barrier Expand"), + OPTIMIZE_FINISHED( "Optimize Finished"), + PRINT_IDEAL( "PrintIdeal"), + BEFORE_MATCHING( "Before Matching"), + MATCHING( "After Matching", RegexType.MACH), + GLOBAL_CODE_MOTION( "Global Code Motion", RegexType.MACH), + INITIAL_LIVENESS( "Initial Liveness", RegexType.MACH), + LIVE_RANGE_STRETCHING( "Live Range Stretching", RegexType.MACH), + AGGRESSIVE_COALESCING( "Aggressive Coalescing", RegexType.MACH), + INITIAL_SPILLING( "Initial Spilling", RegexType.MACH), + CONSERVATIVE_COALESCING( "Conservative Coalescing", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), + ITERATIVE_SPILLING( "Iterative Spilling", RegexType.MACH, ActionOnRepeat.KEEP_FIRST), + AFTER_ITERATIVE_SPILLING( "After Iterative Spilling", RegexType.MACH), + POST_ALLOCATION_COPY_REMOVAL( "Post-allocation Copy Removal", RegexType.MACH), + MERGE_MULTI_DEFS( "Merge Multiple Definitions", RegexType.MACH), + FIX_UP_SPILLS( "Fix up Spills", RegexType.MACH), + REGISTER_ALLOCATION( "Register Allocation", RegexType.MACH), + BLOCK_ORDERING( "Block Ordering", RegexType.MACH), + PEEPHOLE( "Peephole", RegexType.MACH), + POSTALLOC_EXPAND( "Post-allocation Expand", RegexType.MACH), + MACH_ANALYSIS( "After Mach Analysis", RegexType.MACH), + FINAL_CODE( "Final Code", RegexType.MACH), + END( "End"), - PRINT_OPTO_ASSEMBLY("PrintOptoAssembly", RegexType.OPTO_ASSEMBLY), + PRINT_OPTO_ASSEMBLY( "PrintOptoAssembly", RegexType.OPTO_ASSEMBLY), ; private static final Map PHASES_BY_PARSED_NAME = new HashMap<>();