[llvm-commits] [PATCH] Implement new LibCallSimplifier class
Eric Christopher
echristo at gmail.com
Thu Oct 4 11:21:09 PDT 2012
I like the code in general.
On Thu, Oct 4, 2012 at 8:14 AM, Meador Inge <meadori at codesourcery.com> wrote:
> This patch implements the new LibCallSimplifier class as outlined in [1].
> In addition to providing the new base library simplification infrastructure,
> all the fortified library call simplifications were moved over to the new
> infrastructure. The rest of the library simplification optimizations will
> be moved over with follow up patches.
>
OK.
> NOTE: The original fortified library call simplifier located in the
> SimplifyFortifiedLibCalls class was not removed because it is still
> used by CodeGenPrepare. This class will eventually go away too.
>
Good. I was wondering about that.
> + /// replaceCall - Implemented by derived classes to control exactly
> + /// how the optimized instruction gets replaced. The new replacement
> + /// instruction should be returned or 0 if no replacement is possible.
> + virtual Instruction *replaceCall(CallInst *CI, Value *With) = 0;
> +
> + /// fold - Take the given call instruction and if possible returns the
> + /// optimized instruction that has replaced the original call by way
> + /// of 'replaceCall'. If no optimization can be found, then 0 is
> + /// returned.
> + Instruction *fold(CallInst *CI);
> + };
>
This interface seems a bit odd. Why not just "optimizeCall" and either
return NULL if it's not changed or just return the original instruction?
-eric
More information about the llvm-commits
mailing list