[PATCH] D127858: [RISCV] Turn on SeparateConstOffsetFromGEPPass for RISC-V target
Elena Lepilkina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 29 05:24:06 PDT 2022
eklepilkina updated this revision to Diff 456318.
eklepilkina added a comment.
- Update after abandoned D127727 <https://reviews.llvm.org/D127727>
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127858/new/
https://reviews.llvm.org/D127858
Files:
llvm/lib/Target/RISCV/CMakeLists.txt
llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
Index: llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -35,6 +35,7 @@
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/IPO.h"
+#include "llvm/Transforms/Scalar.h"
using namespace llvm;
static cl::opt<bool> EnableRedundantCopyElimination(
@@ -42,6 +43,11 @@
cl::desc("Enable the redundant copy elimination pass"), cl::init(true),
cl::Hidden);
+static cl::opt<bool>
+ EnableGEPOpt("riscv-enable-gep-opt", cl::Hidden,
+ cl::desc("Enable optimizations on complex GEPs"),
+ cl::init(false));
+
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
RegisterTargetMachine<RISCVTargetMachine> X(getTheRISCV32Target());
RegisterTargetMachine<RISCVTargetMachine> Y(getTheRISCV64Target());
@@ -191,10 +197,17 @@
if (getOptLevel() != CodeGenOpt::None)
addPass(createRISCVGatherScatterLoweringPass());
-
+ if (TM->getOptLevel() == CodeGenOpt::Aggressive && EnableGEPOpt) {
+ addPass(createSeparateConstOffsetFromGEPPass(false));
+ // Call EarlyCSE pass to find and remove subexpressions in the lowered
+ // result.
+ addPass(createEarlyCSEPass());
+ // Do loop invariant code motion in case part of the lowered result is
+ // invariant.
+ addPass(createLICMPass());
+ }
if (getOptLevel() != CodeGenOpt::None)
addPass(createRISCVCodeGenPreparePass());
-
TargetPassConfig::addIRPasses();
}
Index: llvm/lib/Target/RISCV/CMakeLists.txt
===================================================================
--- llvm/lib/Target/RISCV/CMakeLists.txt
+++ llvm/lib/Target/RISCV/CMakeLists.txt
@@ -51,6 +51,7 @@
AsmPrinter
Core
IPO
+ Scalar
CodeGen
MC
RISCVDesc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127858.456318.patch
Type: text/x-patch
Size: 1905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220829/081c41a8/attachment.bin>
More information about the llvm-commits
mailing list