[PATCH] D35027: [PowerPC] Reduce register pressure by not materializing a constant just for use as an index register for X-Form loads/stores

Tony Jiang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 11:10:54 PDT 2017


jtony added inline comments.


================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:2246
+  if (N.getOpcode() == ISD::ADD &&
+      (!(isIntS16Immediate(N.getOperand(1), imm) &&
+         N.getOperand(1).hasOneUse() && N.getOperand(0).hasOneUse()))) {
----------------
It would be nice to break the complex condition into several parts and give an meaningful name for each. It increase the code readability maintainability. Maybe something like this:
bool AAAA = N.getOpcode() == ISD::ADD;
bool BBBB = isIntS16Immediate(N.getOperand(1), imm) && N.getOperand(1).hasOneUse() && N.getOperand(0).hasOneUse(), then we can use
if (AAAA && !BBBB ) {...} instead. As an example name for AAAA, we can use IsADD, and for BBBB: CanGetRidOfAdd. I am not good at naming, you can figure out some better name than I. :-)


https://reviews.llvm.org/D35027





More information about the llvm-commits mailing list