How to test isDereferenceablePointer?

I'm have a
    [PATCH] isDereferenceablePointer: look through gc.relocates

and I want to know how to test this patch. So far, I've found one
candiate: speculative execution in SimplifyCFG
(test/Transforms/SimplifyCFG/SpeculativeExec.ll). However, it's
somewhat involved to show that SimplifyCFG does kick in for
gc.relocate. Is there a better way to directly test it?

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>

T.M.K., there's no direct way to test it. You have to construct a transformation which happens with the information you added and not otherwise.

The easiest case might be LICM.

Philip

Philip Reames wrote:

T.M.K., there's no direct way to test it.

There is. See the 'unittests/' directory which contains the C++ unit tests. See unittests/IR/UserTest.cpp for an example that builds up IR from a .ll-in-a-C-string then queries C++ API operations on it.

Nick

  You have to construct a

Philip Reames wrote:

T.M.K., there's no direct way to test it.

There is. See the 'unittests/' directory which contains the C++ unit tests. See unittests/IR/UserTest.cpp for an example that builds up IR from a .ll-in-a-C-string then queries C++ API operations on it.

Thanks for pointing that out. Another option might be to introduce a small printing pass that simply prints the dereferenceability of every pointer in a function - analogous to MemDepPrinter - then use FileCheck on the result of that.

Philip Reames wrote:

Another option might be to introduce a small printing pass that simply
prints the dereferenceability of every pointer in a function - analogous to
MemDepPrinter - then use FileCheck on the result of that.

Perfect. I'll do that.

Ramkumar Ramachandra wrote:

Philip Reames wrote:

Another option might be to introduce a small printing pass that simply
prints the dereferenceability of every pointer in a function - analogous to
MemDepPrinter - then use FileCheck on the result of that.

Perfect. I'll do that.

Done. I hope this approach doesn't lead to an explosion of little printers.