[PATCH] D23630: [PPC] Expand ISEL instruction into if-then-else sequence

Nemanja Ivanovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 04:34:40 PST 2017


nemanjai added inline comments.


================
Comment at: lib/Target/PowerPC/PPCExpandISEL.cpp:260
+    // input for ISEL uses register class 'gprc_nor0' which explicitly excludes
+    // PPC::R0 (and similarly for the 64-bit variants). So:
+    // useSameRegister(TrueValue, FalseValue)  => FalseValue.getReg() != PPC::R0
----------------
kbarton wrote:
> There is currently a bug filed against the PPC backend for this (https://llvm.org/bugs/show_bug.cgi?id=31065). Once this bug is fixed, the register class will need to include r0.
> Please include a check for R0 here as well, to ensure correctness. 
The register class can't include PPC::R0/PPC::X0. It must include PPC::ZERO/PPC::ZERO8 instead. The bug mentioned isn't valid (I've added a clarifying comment to it). We certainly do allocate PPC::ZERO/PPC::ZERO8 for the ISEL instruction when the true operand comes from `LI 0` (i.e. it's an immediate zero). This is done in `PPCInstrInfo::FoldImmediate()`.


https://reviews.llvm.org/D23630





More information about the llvm-commits mailing list