[PATCH] D81723: [PowerPC] fold addi's imm operand to its imm form consumer's displacement

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 16:40:18 PDT 2020


steven.zhang added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:3587
+  int64_t Imm = ImmOperandMI.getImm();
+  if (!isImmElgibleForForwarding(*ImmMO, DefMI, III, Imm))
+    return false;
----------------
shchenz wrote:
> steven.zhang wrote:
> > We will initialize the Imm inside isImmElgibleForForwarding, and you don't need to initialize it with ImmOperandMI
> The Imm initialized in `isImmElgibleForForwarding` is just for `DefMI`, here we need the sum of the imm in `DefMI` and imm in `MI`. 
That’s really not a good idea to sum the imm secretly inside isImmElgibleForForwarding, as what that function does is to check if ImmMO is eligible for forwarding, if yes, extract and set the imm. Can we add another parameter named something like int64_t base which has default initializer as 0, and add some necessary comment for that function?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81723/new/

https://reviews.llvm.org/D81723





More information about the llvm-commits mailing list