[PATCH] [x86] Make vector legalization of extloads work more like the "normal" vector operation legalization with support for custom target lowering and fallback to expand when it fails, and use this to implement sext and anyext load lowering for x86 in a...

hfinkel at anl.gov hfinkel at anl.gov
Thu Jul 24 05:54:31 PDT 2014

Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp:213
@@ +212,3 @@
+            // lowering code took care of any chain values, and just handle the
+            // returned value.
+            return LegalizeOp(Lowered);
I think that an assert would be helpful here, something like:
assert(Result.getValue(1).use_empty() && "Custom lowering did not kill chain dependencies on the load?");

Comment at: lib/Target/X86/X86ISelLowering.cpp:12884
@@ +12883,3 @@
+    // correctly legalized. We do this late to allow the canonical form of
+    // sextload to persist throughout the rest of the DAG combiner.
+    SDValue Load;
I would quickly note what this canonical form is, "... the canonical form of sextload, where it is folded with any sex/sext_in_reg users, to persist..." (or whatever is actually correct).

Comment at: lib/Target/X86/X86ISelLowering.cpp:12914
@@ +12913,3 @@
+        SDValue(Ld, 1),
+        DAG.getNode(ISD::TokenFactor, dl, MVT::Other, Load.getValue(1)));
Why are you creating a TokenFactor with one operand? Can't you just use the chain directly?


More information about the llvm-commits mailing list