[PATCH] [MIScheduler] Slightly better handling of constrainLocalCopy when both source and dest are local

Andrew Trick atrick at apple.com
Thu Jan 15 11:18:26 PST 2015

Thanks for the improvement!

Your test case comment lists an incorrect bug number: PR21972.

I'm not sure the logic makes sense to me. What if DstReg is local, and SrcReg is global, but a single interval? Now we'll just fail.

I don't think your example has any live intervals with "holes". I think you just wanted to change the bias from Local=DstReg to Local=SrcReg because the contraints will happen to work in that case.

I would avoid checking LI->size() == 1. I'm not sure it's really relevant. For example, two-address instructions may tie two segments together like this:
128B		%vreg5<def,tied1> = SAR64ri %vreg5<tied0>, 32, %EFLAGS<imp-def,dead>; GR64_NOSP:%vreg5

I think you can just reverse the default global LI. It really looks like that's what I intended. I have no idea why I defaulted to SrcReg=Global. It may have just been messed up during code cleanup. I would try this:

+  // If both the copy's source and dest are local live intervals, then we
+  // should treat the dest as the global for the purpose of adding
+  // constraints. This adds edges from source's other uses to the copy.
+  unsigned LocalReg = SrcReg;
+  unsigned GlobalReg = DstReg;

If you do that, it looks like a trivial fix is needed in the widen_load-2.ll test.



More information about the llvm-commits mailing list