[PATCH] D25878: IR, X86: Understand !range metadata on global variables.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 19:24:59 PST 2016


pcc added inline comments.


================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1725
+  EVT VT = N.getValueType();
+  bool WasTruncated = false;
+  if (N.getOpcode() == ISD::TRUNCATE) {
----------------
craig.topper wrote:
> This code WasTruncated stuff could probably use some comments explaining it.
Added more comments here and in the rest of this function.


================
Comment at: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1735
   unsigned Opc = N.getOperand(0)->getOpcode();
-  if (Opc == ISD::TargetConstantPool || Opc == ISD::TargetJumpTable ||
-      Opc == ISD::TargetExternalSymbol || Opc == ISD::TargetGlobalAddress ||
-      Opc == ISD::TargetGlobalTLSAddress || Opc == ISD::MCSymbol ||
-      Opc == ISD::TargetBlockAddress) {
+  if (Opc != ISD::TargetGlobalAddress || !WasTruncated) {
     Op = N.getOperand(0);
----------------
craig.topper wrote:
> Were the 7 different opcode checks we had before significant? It safe to replace them with this single check for TargetGlobalAddress?
I looked at all places where we create X86ISD::Wrapper nodes by following links from http://llvm-cs.pcc.me.uk/lib/Target/X86/X86ISelLowering.h/rWrapper

My conclusion was that I believe that it is only possible for us to have these 7 nodes as operands of X86ISD::Wrapper.

We can make this simplification separately; I've sent out D26731.


https://reviews.llvm.org/D25878





More information about the llvm-commits mailing list