[PATCH] D12136: [X86] Emit more efficient >= comparisons against 0

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 12:15:15 PDT 2015


majnemer added inline comments.

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:24078
@@ +24077,3 @@
+static SDValue foldXorTruncShiftIntoCmp(SDNode *N, SelectionDAG &DAG) {
+  // This is only worth doing if the output type is i8.
+  if (N->getValueType(0) != MVT::i8)
----------------
mbodart wrote:
> majnemer wrote:
> > mbodart wrote:
> > > I would think we also want to suppress this if the xor has more than one user.
> > It might be a little early for me (no coffee, etc.), why is it undesirable to use a `test`/`setns` sequence if there is more than one user?
> More than one user likley means the xor is still live.
> 
> So the transformation would just add more instructions, without removing any.
> 
> I'm a bit new to LLVM, so maybe there's some larger context I'm not seeing.
> If so, please shed some light.
My understanding is that this would replace all users of the xor to instead use the setcc which would mean no additional instructions would get generated.  However, I think it makes sense to check to see if the truncate and shift both have one use.


http://reviews.llvm.org/D12136





More information about the llvm-commits mailing list