Skip to content

Commit

Permalink
Add in new pass removed from InstCombine in refactor
Browse files Browse the repository at this point in the history
Upstream LLVM refactored InstCombine to extract a new InferAlignment pass which
needs adding back in to the passes being run.
  • Loading branch information
dstutt committed Nov 15, 2023
1 parent b138804 commit 49168dd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lgc/patch/Patch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
#include "llvm/Transforms/Scalar/EarlyCSE.h"
#include "llvm/Transforms/Scalar/GVN.h"
#include "llvm/Transforms/Scalar/IndVarSimplify.h"
#include "llvm/Transforms/Scalar/InferAlignment.h"
#include "llvm/Transforms/Scalar/InstSimplifyPass.h"
#include "llvm/Transforms/Scalar/LICM.h"
#include "llvm/Transforms/Scalar/LoopDeletion.h"
Expand All @@ -106,6 +107,10 @@

using namespace llvm;

namespace llvm {
extern cl::opt<bool> EnableInferAlignmentPass;
} // namespace llvm

namespace lgc {

// =====================================================================================================================
Expand Down Expand Up @@ -410,6 +415,8 @@ void Patch::addOptimizationPasses(lgc::PassManager &passMgr, uint32_t optLevel)
fpm.addPass(SROAPass(SROAOptions::ModifyCFG));
// uses UniformityAnalysis
fpm.addPass(PatchReadFirstLane());
if (EnableInferAlignmentPass)
fpm.addPass(InferAlignmentPass());
fpm.addPass(InstCombinePass());
passMgr.addPass(createModuleToFunctionPassAdaptor(std::move(fpm)));
passMgr.addPass(ConstantMergePass());
Expand Down

0 comments on commit 49168dd

Please sign in to comment.