[PATCH] When canonicalizing gep indices, prefer zext when possible (SelectionDAGBuilder)

Sanjoy Das sanjoy at playingwithpointers.com
Fri Feb 13 15:06:10 PST 2015


Small drop-by comment inline.  I don't know enough about SelectionDAG to LGTM this.


================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:3465
@@ -3461,1 +3464,3 @@
+      else
+        IdxN = DAG.getSExtOrTrunc(IdxN, getCurSDLoc(), N.getValueType());
 
----------------
A TODO here (definitely not this change) could be to exploit the case where you *know* that the high bit is set (i.e. `KnownOne == true`), and emit a bitwise OR of `0xffff0000` with a zext of the value.  I don't know if that will actually be faster, even on x86, but it does remove the data dependence of the higher bits on the sign bit of the source (narrower) value.

http://reviews.llvm.org/D7626

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






More information about the llvm-commits mailing list