[PATCH] D127858: [RISCV] Turn on SeparateConstOffsetFromGEPPass for RISC-V target
Elena Lepilkina via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 07:36:42 PDT 2022
eklepilkina updated this revision to Diff 438389.
eklepilkina added a comment.
Herald added a subscriber: mgorny.
- Added Scalar to CMakeLists
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
@@ -34,6 +34,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(
@@ -41,6 +42,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(true));
+
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeRISCVTarget() {
RegisterTargetMachine<RISCVTargetMachine> X(getTheRISCV32Target());
RegisterTargetMachine<RISCVTargetMachine> Y(getTheRISCV64Target());
@@ -167,7 +173,15 @@
addPass(createAtomicExpandPass());
addPass(createRISCVGatherScatterLoweringPass());
-
+ if (TM->getOptLevel() == CodeGenOpt::Aggressive && EnableGEPOpt) {
+ addPass(createSeparateConstOffsetFromGEPPass(false, true));
+ // 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());
+ }
TargetPassConfig::addIRPasses();
}
Index: llvm/lib/Target/RISCV/CMakeLists.txt
===================================================================
--- llvm/lib/Target/RISCV/CMakeLists.txt
+++ llvm/lib/Target/RISCV/CMakeLists.txt
@@ -49,6 +49,7 @@
AsmPrinter
Core
IPO
+ Scalar
CodeGen
MC
RISCVDesc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127858.438389.patch
Type: text/x-patch
Size: 1812 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220620/df9aded8/attachment.bin>
More information about the llvm-commits
mailing list