[LLVMdev] ConstantExpr refactoring

Renato Golin rengolin at systemcall.org
Fri Jun 29 15:10:39 PDT 2012


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?


-- 
cheers,
--renato

http://systemcall.org/

[1] http://llvm.org/bugs/show_bug.cgi?id=10368



More information about the llvm-dev mailing list