[PATCH] D132839: [RISCV] Optimization for using compressed beqz and bnez PR#56391
Tetyushkin Ivan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 03:44:39 PDT 2022
ita-sc added inline comments.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.td:1304
+class BrccCompessOpt<CondCode Cond, RVInstB Inst> : Pat<(riscv_brcc GPR:$lhs, simm12_no6:$Constant, Cond, bb:$place),
+ (Inst (ADDI GPR:$lhs, (NegImm simm12:$Constant)), X0, bb:$place)>;
----------------
craig.topper wrote:
> Please put the branch related code in the branch section of this file.
Done
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.td:1311
+
+def OptForMinSize : Predicate<"MF ? MF->getFunction().hasMinSize() : false">;
+
----------------
craig.topper wrote:
> When wouldn't we have a valid MF?
I guess It happens when we run LLVM IR pass that needs SubTargetImpl.
For example, pass Expand Atomic instructions tries to get SubTargetImpl.
It calls createRISCVInstructionSelector during initialization. In it there is an initialization of predicates for globalISel (see GET_GLOBALISEL_PREDICATES_INIT).
Internally it calls computeAvailableModuleFeatures, where all predicates initilized (usially they use subtarget, that is already initialized), but MF is uninitialized there so there will be error.
================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.td:1319
+}
/// Branches and jumps
----------------
craig.topper wrote:
> Blank line before this comment.
Done
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132839/new/
https://reviews.llvm.org/D132839
More information about the llvm-commits
mailing list