[PATCH] D23893: [DAGCombine] Don't fold a trunc if it feeds an anyext

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 06:14:03 PDT 2016

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


Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:7139
@@ +7138,3 @@
+  // If this is anyext(trunc), don't fold it, allow ourselves to be folded.
+  if (N->hasOneUse() && (N->use_begin()->getOpcode() == ISD::ANY_EXTEND))
+    return SDValue();
mkuper wrote:
> RKSimon wrote:
> > Should we limit this to AfterLegalizeTypes or later?
> My motivation for this was a situation that occurs post-legalization, but I don't see anything specific to being post-legalization that makes this a good (or bad) idea.
> Why do you think we should limit this?
I was trying to think if there were any cases where it should be reduced, but you're right it will be from legalization anyhow.

Comment at: test/CodeGen/X86/2011-10-21-widen-cmp.ll:18
@@ -20,3 +17,3 @@
 ; CHECK-NEXT:    retq
   %0 = fcmp oeq <2 x float> undef, undef
This code still makes me shudder, but its a job for another day..... 


More information about the llvm-commits mailing list