[PATCH] D42533: [X86FixupBWInsts] Fix miscompilation if sibling sub-register is live.

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 09:33:32 PST 2018


andrew.w.kaylor added inline comments.


================
Comment at: lib/Target/X86/X86FixupBWInsts.cpp:256
+    if (MO.isUse() && !TRI->isSubRegisterEq(OrigDestReg, MO.getReg()) &&
+        TRI->checkRegistersAlias(SuperDestReg, MO.getReg()))
+      return false;
----------------
Wouldn't  TRI->isSuperOrSubRegisterEq() have the same effect as TRI->checkRegistersAlias()? It isn't clear to me why the new function is needed.

Also, a comment here saying more verbosely what this is meant to be looking for would be helpful. I'm thinking something like this:

```
// If MO is a use of any part of the destination register but is not equal to OrigDestReg
// or one of its subregisters, we cannot use SuperDestReg. For example, if OrigDestReg
// is  %al then an implicit use of %ah, %ax, %eax, or %rax will prevent us from using
// the %eax register.
```


Repository:
  rL LLVM

https://reviews.llvm.org/D42533





More information about the llvm-commits mailing list