[PATCH] Removing unnecessary addrspacecasts from non-generic address spaces to the generic address space

Matt Arsenault Matthew.Arsenault at amd.com
Mon Mar 31 18:00:33 PDT 2014


  I don't see any testcases for addrspacecasts that change the element type


================
Comment at: lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp:64
@@ +63,3 @@
+  /// Transforms "gep (addrspacecast X), indices" into "addrspacecast (gep X,
+  /// indices)".  This rordering exposes to optimizeMemoryInstruction more
+  /// optimization opportunities on loads and stores. Returns true if it changes
----------------
Typo "rordering"

================
Comment at: lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp:58
@@ +57,3 @@
+
+  virtual bool runOnFunction(Function &F);
+
----------------
override

================
Comment at: lib/Target/NVPTX/NVPTXFavorNonGenericAddrSpaces.cpp:80-85
@@ +79,8 @@
+
+// Decides whether removing Cast is valid and beneficial. Cast can be an
+// instruction or a constant expression.
+static bool IsEliminableAddrSpaceCast(Operator *Cast) {
+  // Returns false if not even an addrspacecast.
+  if (Cast->getOpcode() != Instruction::AddrSpaceCast)
+    return false;
+
----------------
Why not make this take an AddrSpaceCastInst?


http://llvm-reviews.chandlerc.com/D3235



More information about the llvm-commits mailing list