[PATCH] D27592: Reimplement depedency tracking in the ImplicitNullChecks pass

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 13:59:47 PST 2016


sanjoy created this revision.
sanjoy added reviewers: reames, anna, atrick.
sanjoy added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

This change rewrites a core component in the ImplicitNullChecks pass for
greater simplicity since the original design was over-complicated for no
good reason.  Please review this as essentially a new pass.  The change
is almost NFC and I've added a test case for a scenario that this new
code handles that wasn't handled earlier.

The implicit null check pass, at its core, is a code hoisting transform.
It differs from "normal" code transforms in that it speculates
potentially faulting instructions (by design), but a lot of the usual
hazard detection logic (register read-after-write etc.) still applies.
We previously detected hazards by keeping track of registers defined and
used by machine instructions over an instruction range, but that was
unwieldy and did not actually confer any performance benefits.  The
intent was to have linear time complexity over the number of machine
instructions considered, but it ended up being N^2 is practice.

This new version is more obviously O(N^2) (with N capped to 8 by
default) in hazard detection.  It does not attempt to be clever in
tracking register uses or defs (the previous cleverness here was a
source of bugs).

Once this is checked in, I'll extract out the `IsSuitableMemoryOp` and
`CanHoistLoadInst` lambda into member functions (they're too complicated
to be inline lambdas) and do some other related NFC cleanups.


https://reviews.llvm.org/D27592

Files:
  lib/CodeGen/ImplicitNullChecks.cpp
  test/CodeGen/X86/implicit-null-checks.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27592.80820.patch
Type: text/x-patch
Size: 18588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161208/0d4f0cec/attachment.bin>


More information about the llvm-commits mailing list