[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
Fri Sep 4 04:42:35 PDT 2020


dantrushin added a comment.

Looks good for me.
The only thing that worries me is shouldn't we have broader audience since we're changing 'global' APIs?



================
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.
----------------
anna wrote:
> 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. 
Yeah, my bad, I've misread the code. :) If it is not modifies register, then it's safe.


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