Here is the beginning of the BB dump. entry (0x8503c80, LLVM BB @0x8501af0, ID#0): Live Ins: %R0 %R1 %reg1024 = ORI %R0<kill>, 0 %reg1025 = ORI %R1<kill>, 0 V4R0 is getting killed because handleLiveInRegister() is called on all results of getAliasSet() for each of the liveins (this is in LiveIntervals::computeIntervals() ). handleRegisterDef() does a similar thing where calls handlePhysicalRegisterDef() on all members of getAliasSet() returned for the def, which also triggers this problem. --- This is a pretty serious bug. LiveVariables::KillsRegister should not kill aliases that are "larger". The correct way to fix this is to explicitly list registers that are defined, used, and killed. So your example should look like: entry (0x8503c80, LLVM BB @0x8501af0, ID#0): Live Ins: %R0 %R1 %reg1024 = ORI %R0<kill>, 0, %V4R0<imp-use> %reg1025 = ORI %R1<kill>, 0, %V4R0<imp-use,kill> KillsRegister should check for exact match rather than regsOverlap. There are probably other similar bugs in LiveVariables.
This is causing me much pain. The correct fix, IMO, is to explicit add every single alias register as use / def operands. Change LiveVariables and LiveIntervalAnalysis to not iterate through alias sets when processing registers. Also change LiveVariables::KillsRegister(), RegisterDefIsDead(), etc. to check for exact register match rather than regsOverlap(). It's unclear though how copy coalescer handles this though. Anyway, it's a fairly involved set of changes. Anyone has a better suggestion?
My brute force fix works well on X86. All of the dejagnu tests are passing as well. I'll do some more testing on other targets.
Created attachment 791 [details] Patch 1
This is the patch. Chris, please see if it fixes the problems you run into. I'm working on a better fix.
The patch cleared up the issue I was seeing.
Great! Evan is working on a version that will be better for compile time and handle more cases. It should land in the next week or so.
Fixed. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048395.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048396.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048397.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048398.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048399.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048400.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048401.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048402.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048404.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048403.html A register def / use now implicitly affects sub-register liveness but does not affect liveness information of super-registers. Def of a larger register (if followed by a use later) is treated as read/mod/write of a smaller register. Chris, please verify this works for you.
This is working for me.
Should this be marked closed as it's working for me, or is it waiting for more testing?
Yep, evan should close it. He's unruly though, and doesn't like to close bugs ;-)
I like to leave bugs open to give the impression that I am busy.