tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

revert-llvmorg-16-init-11301-g163bb6d64e5f_clang_22.patch (3167B)


      1 From cf00b30288c4c81b2c6a5af01c38f236148777a0 Mon Sep 17 00:00:00 2001
      2 From: Mike Hommey <mh@glandium.org>
      3 Date: Tue, 28 Mar 2023 06:13:36 +0900
      4 Subject: [PATCH] Revert "[Passes][VectorCombine] enable early run generally
      5 and try load folds"
      6 
      7 This reverts commit 163bb6d64e5f1220777c3ec2a8b58c0666a74d91.
      8 It causes various reftest regressions.
      9 ---
     10 llvm/lib/Passes/PassBuilderPipelines.cpp          |  7 ++++---
     11 llvm/lib/Transforms/Vectorize/VectorCombine.cpp   |  8 ++------
     12 9 files changed, 18 insertions(+), 19 deletions(-)
     13 
     14 diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
     15 index 256cf9d4cd1c..6817ba63e215 100644
     16 --- a/llvm/lib/Passes/PassBuilderPipelines.cpp
     17 +++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
     18 @@ -722,9 +722,10 @@ PassBuilder::buildFunctionSimplificationPipeline(OptimizationLevel Level,
     19   // Delete small array after loop unroll.
     20   FPM.addPass(SROAPass(SROAOptions::ModifyCFG));
     21 
     22 -  // Try vectorization/scalarization transforms that are both improvements
     23 -  // themselves and can allow further folds with GVN and InstCombine.
     24 -  FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
     25 +  // The matrix extension can introduce large vector operations early, which can
     26 +  // benefit from running vector-combine early on.
     27 +  if (EnableMatrix)
     28 +    FPM.addPass(VectorCombinePass(/*TryEarlyFoldsOnly=*/true));
     29 
     30   // Eliminate redundancies.
     31   FPM.addPass(MergedLoadStoreMotionPass());
     32 diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
     33 index 0ef933f59660..44bafd83bc88 100644
     34 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
     35 +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
     36 @@ -4497,25 +4497,6 @@ bool VectorCombine::run() {
     37 
     38     LLVM_DEBUG(dbgs() << "VC: Visiting: " << I << '\n');
     39 
     40 -    // These folds should be beneficial regardless of when this pass is run
     41 -    // in the optimization pipeline.
     42 -    // The type checking is for run-time efficiency. We can avoid wasting time
     43 -    // dispatching to folding functions if there's no chance of matching.
     44 -    if (IsFixedVectorType) {
     45 -      switch (Opcode) {
     46 -      case Instruction::InsertElement:
     47 -        if (vectorizeLoadInsert(I))
     48 -          return true;
     49 -        break;
     50 -      case Instruction::ShuffleVector:
     51 -        if (widenSubvectorLoad(I))
     52 -          return true;
     53 -        break;
     54 -      default:
     55 -        break;
     56 -      }
     57 -    }
     58 -
     59     // This transform works with scalable and fixed vectors
     60     // TODO: Identify and allow other scalable transforms
     61     if (IsVectorType) {
     62 @@ -4546,6 +4527,8 @@ bool VectorCombine::run() {
     63     if (IsFixedVectorType) {
     64       switch (Opcode) {
     65       case Instruction::InsertElement:
     66 +        if (vectorizeLoadInsert(I))
     67 +          return true;
     68         if (foldInsExtFNeg(I))
     69           return true;
     70         if (foldInsExtBinop(I))
     71 @@ -4554,6 +4537,8 @@ bool VectorCombine::run() {
     72           return true;
     73         break;
     74       case Instruction::ShuffleVector:
     75 +        if (widenSubvectorLoad(I))
     76 +          return true;
     77         if (foldPermuteOfBinops(I))
     78           return true;
     79         if (foldShuffleOfBinops(I))