[llvm-dev] [ConstantExpr] Adding folding tests

Cameron McInally via llvm-dev llvm-dev at lists.llvm.org
Fri May 3 07:32:57 PDT 2019


On Fri, May 3, 2019 at 9:56 AM Tim Northover <t.p.northover at gmail.com>
wrote:

> Hi Cameron,
>
> On Fri, 3 May 2019 at 14:46, Cameron McInally via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
> > I'd like to add some new constant foldings to ConstantExpr -- in
> particular ConstantExpr::get(...) and friends. But, I'm having trouble
> finding the correct place for adding IR tests in the /test directory.
>
> test/Analysis/ConstantFolding looks promising. You could also use
>

Ah, I should have mentioned that. So Matt and I looked into this, but that
directory appears to be testing the constant folding in InstructionSimplify
(and one or two other opt passes). That's a different set of folds.

Looking closer now, hooking up this instruction (namely FNeg) in
InstCombine to call ConstantExpr to do the folds is probably the best
option. There's prior art for this
in test/Analysis/ConstantFolding/min-max.ll. Does anyone see problems with
that plan?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190503/86b2d40e/attachment.html>


More information about the llvm-dev mailing list