Skip to content

Conversation

@dtcxzyw
Copy link
Owner

@dtcxzyw dtcxzyw commented Feb 25, 2025

Link: llvm/llvm-project#128466
Requested by: @dtcxzyw

@github-actions github-actions bot mentioned this pull request Feb 25, 2025
@dtcxzyw
Copy link
Owner Author

dtcxzyw commented Feb 25, 2025

Diff mode

runner: ariselab-64c-v2
baseline: llvm/llvm-project@352c48f
patch: llvm/llvm-project#128466
sha256: 05a4b2acdb0b76b59b77af283bd84824b34fb420a49a61a35a9158d77b963bab
commit: e9dcf60

179 files changed, 101607 insertions(+), 103317 deletions(-)

Improvements:
  simplifycfg.NumSpeculations 355183 -> 355306 +0.03%
  adce.NumBranchesRemoved 21124 -> 21130 +0.03%
  correlated-value-propagation.NumPhiCommon 49288 -> 49291 +0.01%
  jump-threading.NumDupes 111533 -> 111539 +0.01%
  licm.NumGEPsHoisted 38312 -> 38314 +0.01%
  instcombine.NumDeadInst 34448484 -> 34449910 +0.00%
  correlated-value-propagation.NumDeadCases 66356 -> 66358 +0.00%
  instcombine.NumSunkInst 2776823 -> 2776880 +0.00%
  licm.NumPromotionCandidates 443187 -> 443193 +0.00%
  loop-instsimplify.NumSimplified 159100 -> 159102 +0.00%
Regressions:
  instcombine.NumSel 24608 -> 24583 -0.10%
  adce.NumRemoved 89799 -> 89781 -0.02%
  lower-is-constant-intrinsic.IsConstantIntrinsicsHandled 18538 -> 18536 -0.01%
  correlated-value-propagation.NumPhis 1081401 -> 1081325 -0.01%
  correlated-value-propagation.NumSelects 210187 -> 210176 -0.01%
  gvn.NumGVNPRE 128047 -> 128042 -0.00%
  gvn.NumGVNLoad 1176402 -> 1176364 -0.00%
  simplifycfg.NumSinkCommonInstrs 685036 -> 685022 -0.00%
  gvn.NumGVNInstr 8076708 -> 8076580 -0.00%
  local.NumPHICSEs 146797 -> 146795 -0.00%

2 1 bench/abseil-cpp/optimized/cord_test.ll
4 4 bench/arrow/optimized/array_dict.ll
2 2 bench/arrow/optimized/vector_hash.ll
1 1 bench/boost/optimized/graphml.ll
25 34 bench/cpython/optimized/_ctypes.ll
4 6 bench/duckdb/optimized/regexp.ll
30 38 bench/gromacs/optimized/localtopology.ll
20 25 bench/gromacs/optimized/wholemoleculetransform.ll
4 4 bench/grpc/optimized/ring_hash.ll
3 4 bench/hermes/optimized/Callable.ll
6 18 bench/hermes/optimized/HermesBuiltin.ll
2 4 bench/hermes/optimized/HermesInternal.ll
9 6 bench/hermes/optimized/Interpreter.ll
23 18 bench/hermes/optimized/Operations.ll
1 4 bench/hermes/optimized/Passes.ll
0 2 bench/hermes/optimized/SemanticValidator.ll
4 9 bench/llvm/optimized/AArch64ISelLowering.ll
20 20 bench/llvm/optimized/ASTConsumers.ll
10 10 bench/llvm/optimized/ASTImporterLookupTable.ll
4 10 bench/llvm/optimized/ASTStructuralEquivalence.ll
2 3 bench/llvm/optimized/CFG.ll
1 4 bench/llvm/optimized/CGCleanup.ll
3 5 bench/llvm/optimized/CallGraphSCCPass.ll
32 46 bench/llvm/optimized/CanonicalizeFreezeInLoops.ll
1 15 bench/llvm/optimized/DemoteRegToStack.ll
8 20 bench/llvm/optimized/FunctionComparator.ll
3 17 bench/llvm/optimized/GVN.ll
1 15 bench/llvm/optimized/GVNHoist.ll
9 26 bench/llvm/optimized/HLSLExternalSemaSource.ll
6 18 bench/llvm/optimized/IROutliner.ll
1 2 bench/llvm/optimized/LazyMachineBlockFrequencyInfo.ll
21 23 bench/llvm/optimized/LoopPass.ll
40 56 bench/llvm/optimized/LoopPredication.ll
20 22 bench/llvm/optimized/LoopVectorizationLegality.ll
19 37 bench/llvm/optimized/MachineScheduler.ll
20 22 bench/llvm/optimized/RegionPass.ll
4 18 bench/llvm/optimized/SelectOptimize.ll
10 14 bench/llvm/optimized/SemaLookup.ll
14 26 bench/llvm/optimized/SimplifyCFG.ll
4 18 bench/llvm/optimized/SpeculativeExecution.ll
1 1 bench/llvm/optimized/X86FrameLowering.ll
5 10 bench/luau/optimized/AstQuery.ll
8 19 bench/luau/optimized/ConstraintGenerator.ll
10 22 bench/luau/optimized/Generalization.ll
36 60 bench/openjdk/optimized/compileBroker.ll
77 89 bench/openjdk/optimized/compileTask.ll
25 49 bench/openjdk/optimized/dfa_x86.ll
1 3 bench/openjdk/optimized/loopnode.ll
88 100 bench/openjdk/optimized/output.ll
14 26 bench/openjdk/optimized/shenandoahSupport.ll
4 4 bench/openspiel/optimized/observer.ll
38 25 bench/postgres/optimized/freepage.ll
3 8 bench/pybind11/optimized/test_tagbased_polymorphic.ll
41 53 bench/ruby/optimized/vm.ll
35 45 bench/sentencepiece/optimized/extension_set.ll
2 3 bench/yosys/optimized/preproc.ll

@github-actions
Copy link
Contributor

Summary of Major Changes in the LLVM IR Patch

  1. Removal of select Instructions:

    • In several files, such as HermesBuiltin.ll, LazyMachineBlockFrequencyInfo.ll, and LoopPass.ll, select instructions have been removed or replaced with simpler control flow logic. For example, instead of using a select instruction to choose between two values based on a condition, the code now directly uses one of the values or branches to handle the condition explicitly.
    • This simplifies the control flow and reduces unnecessary instructions, potentially improving performance and readability.
  2. Reordering of Control Flow:

    • Files like CanonicalizeFreezeInLoops.ll and SimplifyCFG.ll show reordering of control flow blocks. Some intermediate blocks have been eliminated, and the remaining blocks have been rearranged to streamline the execution path.
    • For instance, in CanonicalizeFreezeInLoops.ll, the .thread block is simplified by removing redundant phi nodes and directly handling the branch conditions.
  3. Phi Node Adjustments:

    • Phi nodes are adjusted in multiple files (Arrow/optimized/array_dict.ll, Duckdb/optimized/regexp.ll, LLVM/optimized/ASTConsumers.ll) to reflect changes in control flow or operand usage. This ensures that the correct values are propagated through the program without unnecessary complexity.
    • For example, in array_dict.ll, the phi node %self.0 is updated to use %2 instead of %cond.i.i.i.i.i.
  4. Optimization of Load and Store Operations:

    • Several files (LLVM/optimized/CFG.ll, LLVM/optimized/SemaLookup.ll, OpenJDK/optimized/compileTask.ll) demonstrate optimizations in load and store operations. Unnecessary intermediate variables and redundant loads/stores are eliminated, leading to more efficient memory access patterns.
    • In CFG.ll, the pointer %72 is reused for a store operation instead of creating a new pointer %73.
  5. Function Signature and Attribute Updates:

    • The function signatures and attributes in Luau/optimized/ConstraintGenerator.ll and SpeculativeExecution.ll are updated to reflect changes in parameter qualifiers (e.g., readonly, captures(none)). This ensures better alignment with the actual usage of the functions and helps the optimizer make more informed decisions.
    • For example, in SpeculativeExecution.ll, the second parameter of _ZN4llvm24SpeculativeExecutionPass15runOnBasicBlockERNS_10BasicBlockE is changed from ptr noundef nonnull align 8 dereferenceable(80) to ptr noundef nonnull readonly align 8 dereferenceable(80).

High-Level Overview

The patch primarily focuses on simplifying control flow, reducing redundancy in phi nodes, and optimizing load/store operations. These changes aim to improve the efficiency of the generated code by eliminating unnecessary instructions and streamlining the execution paths. Additionally, updates to function signatures and attributes ensure that the compiler can better optimize the code based on the actual usage of the functions. Overall, these modifications contribute to cleaner and potentially faster LLVM IR.

model: qwen-plus-latest
CompletionUsage(completion_tokens=676, prompt_tokens=101485, total_tokens=102161, completion_tokens_details=None, prompt_tokens_details=None)

@dtcxzyw dtcxzyw closed this Feb 25, 2025
@dtcxzyw dtcxzyw deleted the test-run13525228313 branch March 12, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant