[PATCH] Add NVPTXPeephole pass to reduce unnecessary address cast

Xuetian Weng xweng at google.com
Thu Jun 18 17:37:39 PDT 2015


================
Comment at: lib/Target/NVPTX/NVPTXFrameLowering.cpp:58
@@ -61,3 +57,3 @@
                   MF.getSubtarget().getInstrInfo()->get(NVPTX::cvta_local_yes),
-                  NVPTX::VRFrame).addReg(LocalReg);
+                  NVPTX::VRFrame).addReg(NVPTX::VRFrameLocal);
       BuildMI(MBB, MI, dl,
----------------
jingyue wrote:
> Is `NVPTX::VRFrameLocal` 32-bit or 64-bit? You use it for both 32-bit and 64-bit. Does that matter? 
See NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters, it will change depending on arch.

Though NVPTXRegisterInfo.td defines them as i32, but seems this info is not used.

================
Comment at: lib/Target/NVPTX/NVPTXPeephole.cpp:109
@@ +108,3 @@
+
+  MBB.insert((MachineBasicBlock::iterator) &Root, (MachineInstr *) MIB);
+
----------------
jingyue wrote:
> The type casts seem unnecessary, aren't they? 
Latter one is unnecessary, first one is necessary to eliminate ambiguity.

http://reviews.llvm.org/D10549

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list