[PATCH] D87108: [ImplicitNullCheck] Handle instructions that do not modify null behaviour of null checked reg
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 4 03:54:21 PDT 2020
anna 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.
----------------
dantrushin wrote:
> Nit: Since you check specific opcodes anyway, that check is unnecessary, IMHO
We need this check because if you see the caller in ImplicitNullChecks, it was previously checking if `If MI re-defines the PointerReg (i.e. the NullValueReg`). We now have both checks within isNullBehaviourUnchanged. I originally thought of having the modifiesRegister in the caller itself and leaving an assert here instead of the check, but I felt this is better.
================
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
----------------
dantrushin wrote:
> 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`
agreed.
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