[llvm-commits] [llvm] r142731 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/load.ll
Duncan Sands
baldrick at free.fr
Tue Oct 25 00:38:20 PDT 2011
Hi Nick,
> maybe you could use instsimplify here? It does constant folding and more
> besides. It can break LCSSA form, so y so,
> check out the loop transform users of instsimplify to seou may need to check
> for that (ife how).
>
>
> As far as I can see, LCSSA isn't documented and I don't understand it well
> enough to know whether I'm preserving it or breaking it etc.
you don't need to know, there is a helper that tells you:
replacementPreservesLCSSAForm
I know it involves
> creating 1-operand PHI nodes in strategic places and that's about it.
>
> Are there cases where InstructionSimplify will return a Constant that the
> constant folder won't?
Yes, because the constant folder only folds constants, while InstructionSimplify
can fold instructions to constants (eg: X - X -> 0) as well as to other pre
existing instructions (eg: (X + Y) - X -> Y).
This code is entirely based off of a mapping to
> Constant*, so instsimplify won't help without more refactoring.
OK.
Ciao, Duncan.
>
> That refactoring would be scary because while we can represent the arbitrary
> values, we'll find ourselves effectively unrolling the loop as we build up a
> larger and larger SCEV expression. I'd like to leave unrolling to the unrolling
> pass.
>
> Nick
>
> > @@ -4993,7 +5109,10 @@
> > if (const CmpInst *CI = dyn_cast<CmpInst>(I))
> > C = ConstantFoldCompareInstOperands(CI->getPredicate(),
> > Operands[0],
> Operands[1], TD);
> > - else
> > + else if (const LoadInst *LI = dyn_cast<LoadInst>(I)) {
> > + if (!LI->isVolatile())
> > + C = ConstantFoldLoadFromConstPtr(Operands[0], TD);
> > + } else
> > C = ConstantFoldInstOperands(I->getOpcode(), I->getType(),
> > Operands, TD);
> > if (!C) return V;
>
> Likewise.
>
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
More information about the llvm-commits
mailing list