[LLVMdev] ConstantExpr refactoring

Hal Finkel hfinkel at anl.gov
Fri Jun 29 15:40:15 PDT 2012


On Fri, 29 Jun 2012 23:10:39 +0100
Renato Golin <rengolin at systemcall.org> wrote:

> Hi all,
> 
> It's been a long time, and I'm probably going to kill myself, but I
> want to try it anyway.
> 
> Bug 10368 [1] tells me that ConstantExpr shouldn't automatically fold,
> and that this is source of many problems (most notably with traps) and
> code duplication.
> 
> However, I'm a bit lost... There seem to be constant folding in many
> places like
> 
> ConstantExpr::get*() uses
> lib/Analysis/ConstantFolding.cpp, that uses
> lib/VMCore/ConstantFold.cpp
> 
> InstCombine also has some instruction simplification (duh), but it
> mostly deal with variables, so it only returns a semantically and
> simpler equivalent operation, rather than go all the way to fold if
> both arguments are constants (I guess).
> 
> So, is the idea to transform ConstantFolding into a new function pass,
> or to recode another pass (like InstCombine) to deal with such things?
> 
> 

This seems like yet-another place where target-information integration
would be helpful (and, indeed, should be used).

 -Hal

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list