[PATCH] D49103: Lower llvm.objectsize earlier in our optimization pipeline

George Burgess IV via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 15:04:26 PDT 2018


george.burgess.iv created this revision.
george.burgess.iv added a reviewer: efriedma.
Herald added a subscriber: mehdi_amini.

For context, please see "cleaning up ‘br i1 false’ cases in CodeGenPrepare <http://lists.llvm.org/pipermail/llvm-dev/2018-June/124359.html>"

I don't know if InstCombine is a great place for this, or if we'd prefer to have some kind of `LowerBestEffortPostOptimizationIntrinsics` pass, or ...

Suggestions for how to better test this are appreciated.

Summarizing my appearing-soon response on said email thread, I ran this on a large project that has a clang-tailored FORTIFY implementation. With this change, we fail to lower (e.g. we return failure values for) 1.9% more calls to objectsize, but we also end up lowering quite a few more objectsize intrinsics in total. The most likely explanation for this seems to be that we're able to DCE most of those "new" failures before hitting CGP. So, I think a 1.9% degradation is likely to be an overstatement.

During that test, I added an `llvm_unreachable` to CGP's objectsize lowering logic. It wasn't hit.


https://reviews.llvm.org/D49103

Files:
  include/llvm/Transforms/IPO/PassManagerBuilder.h
  include/llvm/Transforms/InstCombine/InstCombine.h
  lib/CodeGen/CodeGenPrepare.cpp
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/InstCombine/InstCombineCalls.cpp
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstructionCombining.cpp
  test/Transforms/InstCombine/force-lower-objectsize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49103.154703.patch
Type: text/x-patch
Size: 11286 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/699793bb/attachment.bin>


More information about the llvm-commits mailing list