[llvm-commits] [PATCH] make SCEV work in presence of llvm.dbg.*

Török Edwin edwintorok at gmail.com
Fri Oct 31 12:20:39 PDT 2008


Hi,

The attached patch makes BasicAA respond NoModRef for llvm.dbg.*
intrinsics.
This allows GVN to work in presence of llvm.dbg.*, so that SCEV will
still be able to compute trip counts at -O1.

Actually the debug intrinsics don't access anything, but making the
intrinsic IntrNoMem, or IntrReadArgMem  causes them to be
completely remove at -O1.
A NoModRef answer doesn't cause them to be removed. The attached patch
contains 2 testcases:
- make sure tripcounts are computable for a simple case even with debug info
- make sure debug info is preserved after -O1

OK to commit?

While we're at it, I think llvm.readcyclecounter should be handled the same
(we don't want it to be reordered, but we don't want it to inhibit
optimizations either)
Should I add that to BasicAA too?

Another approach would be to introduce a new attribute that specifies
that the intrinsic doesn't access memory at all,
but it is not allowed to be reordered, and can only be removed if the BB
is dead.

Best regards,
--Edwin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbgaa.patch
Type: text/x-diff
Size: 14483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081031/f28e4193/attachment.patch>


More information about the llvm-commits mailing list