[PATCH] D45673: [x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite uses across basic blocks in the limited cases where it is very straight forward to do so.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 17 09:45:23 PDT 2018


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

lgtm



================
Comment at: llvm/test/CodeGen/X86/copy-eflags.ll:293
+  %tmp11 = trunc i32 %tmp10 to i16
+  br label %bb1
+}
----------------
chandlerc wrote:
> chandlerc wrote:
> > rnk wrote:
> > > This infinite loop with selects of undef feels over-reduced. It seems fragile, since a pass could come along and optimize the select to the non-undef operand.
> > > 
> > > I liked the test case from PR37133, but it's reliance on debug info (any, not just standalone) scares me:
> > > ```
> > > int a, b;
> > > unsigned long long c;
> > > void e() {
> > >   long long d;
> > >   b = 33;
> > >   d = a;
> > >   if (c < a) {
> > >     b = 32;
> > >     d = c;
> > >   }
> > >   if (d)
> > >     b = 2;
> > > }
> > > ```
> > > 
> > > We should reopen it or file a split separate bug, because we generate two more BBs on that code when debug info is enabled. :(
> > > 
> > > In any case, is there a better way to write this test case using legalized arithmetic? An i128 x64 test case with live-out eflags might also be interesting.
> > I actually tried some to remove the undef stuff. I couldn't find a pattern that triggered the bug. =[ I guess I can keep trying...
> Got the undefs out. How much more should I do here?
I guess the live-out eflags are getting created by a combination of SBB and select-to-jump x86 lowering logic. I guess this is as reduced as we can get.


Repository:
  rL LLVM

https://reviews.llvm.org/D45673





More information about the llvm-commits mailing list