[PATCH] [X86] Try to combine vector anyext + and into a vector zext

Michael Kuperstein michael.m.kuperstein at intel.com
Mon Feb 16 07:26:22 PST 2015


Thanks a lot for the review, Andrea!

You're right, it deserves its own function.

Regarding legalization - I think it should be guarded by BeforeLegalizeOps(), I've accidentally put it before the guard. 
I could make it BeforeLegalize(), but that's probably a bit redundant, since, at least for the cases I've looked at the vector_shuffle in question is created as part of vector ops legalization.


================
Comment at: lib/Target/X86/X86ISelLowering.cpp:24668-24669
@@ +24667,4 @@
+      N0.getOperand(0).getOpcode() == ISD::VECTOR_SHUFFLE &&
+      (N1.getOpcode() == ISD::BUILD_VECTOR ||
+       N1.getOpcode() == ISD::BITCAST)) {
+
----------------
andreadb wrote:
> I think you can remove these two checks.
> Your algorithm already checks (between line 24682 and 24686) that N1 is a build_vector or a bitcast of a build_vector.
Right, either the check here or the second check (in 24685) is redundant.
I'd rather remove the check in 24685, to be honest.

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:24691
@@ +24690,3 @@
+    bool HasAnyUndefs;
+    BuildVectorSDNode *Vector = dyn_cast<BuildVectorSDNode>(Splat);
+    if (!Vector->isConstantSplat(SplatValue, SplatUndef,
----------------
andreadb wrote:
> You don't need a dyn_cast here. Node Splat can only be an ISD::BUILD_VECTOR at this point.
> I think you can safely use a 'cast' here.
Right.

http://reviews.llvm.org/D7666

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






More information about the llvm-commits mailing list