[PATCH] D62699: [InlineCost] Add support for UnaryOperator

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 30 13:31:27 PDT 2019


craig.topper created this revision.
craig.topper added reviewers: cameron.mcinally, spatel, fhahn, bjope, efriedma.
Herald added subscribers: haicheng, hiraditya, kristof.beyls, eraman, javed.absar.
Herald added a project: LLVM.

This adds support for UnaryOperator in InlineCost similar to what is done for BinaryOperator. This allows fastmath flags to be passed to SimplifyInstruction and for the cost to be increased when fp is expensive.

Currently the only UnaryOperator is fneg and the code for it in SimplifyInstruction doesn't use fast math flags so I dont' know how to test that part.

I was able to test the increased fp cost. The included test case will report a cost of 100 before this patch and 125 after this patch. I based this on an earlier arm test case in the test file and just changed an fmul by constant to an fneg. I can pre-commit this test but wanted opinions on if this test needs changes.


https://reviews.llvm.org/D62699

Files:
  llvm/lib/Analysis/InlineCost.cpp
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/test/Transforms/Inline/ARM/inline-fp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62699.202283.patch
Type: text/x-patch
Size: 5870 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190530/ba8f9b70/attachment.bin>


More information about the llvm-commits mailing list