[PATCH] D16275: [opaque pointer types] [NFC] GEP: replace get(Pointer)ElementType uses with get{Source, Result}ElementType.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 19 10:46:41 PST 2016


dblaikie added inline comments.

================
Comment at: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp:516
@@ -515,2 +515,3 @@
     } else {
-      Ty = cast<SequentialType>(Ty)->getElementType();
+      if (Ty->isPointerTy()) {
+        // The only pointer type is for the very first index,
----------------
This seems like a slightly indirect test of the property you describe in the comment.

Do you think it might be nicer to check if the iterator is == I->op_begin() + 1? Or to add a flag of some kind before the loop for this first case? Or perhaps to use a gep type iterator in parallel with the operands? (or an assert for any of these conditions)

Not necessary, just throwing some ideas around in case any of them seem like an improvement.

================
Comment at: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:3021
@@ -3020,2 +3020,3 @@
     } else {
-      Ty = cast<SequentialType>(Ty)->getElementType();
+      if (Ty->isPointerTy()) {
+        // The only pointer type is for the very first index,
----------------
Same as above

================
Comment at: llvm/trunk/lib/Target/AArch64/AArch64FastISel.cpp:4828
@@ -4827,2 +4827,3 @@
     } else {
-      Ty = cast<SequentialType>(Ty)->getElementType();
+      if (Ty->isPointerTy()) {
+        // The only pointer type is for the very first index,
----------------
Same as above

(starting to see a pattern - perhaps there's a common API/abstraction we could use for these?)


Repository:
  rL LLVM

http://reviews.llvm.org/D16275





More information about the llvm-commits mailing list