[PATCH] D87108: [ImplicitNullCheck] Handle instructions that do not modify null behaviour of null checked reg

Denis Antrushin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 12:38:37 PDT 2020


dantrushin added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:3670
+  if (!MI->modifiesRegister(NullValueReg, TRI))
+    return true;
+  // Shift right/left of a null is still null.
----------------
Nit: Since you check specific opcodes anyway, that check is unnecessary, IMHO


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:3677
+      return true;
+  }
+  // Zero extend of a sub-reg of NullValueReg into itself does not change the
----------------
Again, since you're checking specific opcodes, you know that opnd 0 and 1 are registers,
so you can do something like
```
return MI->getOperand(0).getReg() == NullValueReg && MI->getOperand(1).getReg() == NullValueReg;
```
I.e., no need to check `MO.isReg` and direct register comparision might be more readable that `isTied`


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87108/new/

https://reviews.llvm.org/D87108



More information about the llvm-commits mailing list