[PATCH] D11774: [NVPTX] Use LDG for pointer induction variables

Eli Bendersky eliben at google.com
Wed Aug 5 11:40:40 PDT 2015


eliben added inline comments.

================
Comment at: lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp:551
@@ +550,3 @@
+                          unsigned codeAddrSpace, const DataLayout &DL,
+                          MachineFunction *F) {
+  if (!Subtarget.hasLDG() || codeAddrSpace != NVPTX::PTXLdStInstCode::GLOBAL ||
----------------
Can't you get the data layout from F now?

================
Comment at: lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp:561
@@ +560,3 @@
+  // nodes to handle pointer induction variables.
+  SmallVector<Value *, 8> objs;
+  GetUnderlyingObjects(const_cast<Value *>(N->getMemOperand()->getValue()),
----------------
maybe Objs for coding style (elsewhere too)?

================
Comment at: lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp:562
@@ +561,3 @@
+  SmallVector<Value *, 8> objs;
+  GetUnderlyingObjects(const_cast<Value *>(N->getMemOperand()->getValue()),
+                       objs, DL);
----------------
How come const_cast is needed now but not before?

================
Comment at: lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp:565
@@ +564,3 @@
+  for (Value *obj : objs) {
+    const Argument *A = dyn_cast<const Argument>(obj);
+    if (!A || !A->onlyReadsMemory() || !A->hasNoAliasAttr()) return false;
----------------
Seems like a good candidate for auto, since the type is repeated in the cast?


http://reviews.llvm.org/D11774





More information about the llvm-commits mailing list