[PATCH] D14340: [DAGCombiner] Improve zextload optimization.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 08:59:52 PST 2015


mcrosier accepted this revision.
mcrosier added a comment.
This revision is now accepted and ready to land.

LGTM with a few nits.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:423
@@ +422,3 @@
+    /// This is a helper function for visitAND and visitZERO_EXTEND.  Returns
+    /// true if the (and (load) C) pattern matches an extload.  ExtVT returns
+    /// the type of the loaded value to be extended.  LoadedVT returns the type
----------------
Perhaps, "(and (load x) cst)" to be consistent with documentation elsewhere?

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3003
@@ +3002,3 @@
+                                              ExtVT))) {
+    NarrowLoad = false;
+    return true;
----------------
Maybe add a comment about what's going on here?  Basically, no need to narrow the load for the pattern to match..

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:3007
@@ +3006,3 @@
+
+  // Do not change the width of a volatile load.
+  // Do not generate loads of non-round integer types since these can
----------------
You can simplify the below conditional as well as improve readability by hoisting out the volatile check.

if (LoadN->isVolatile())
  return false;


http://reviews.llvm.org/D14340





More information about the llvm-commits mailing list