[llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr
Jin Gu Kang
jaykang10 at imrc.kist.re.kr
Tue Feb 22 04:55:44 PST 2011
Functions like replaceAllUsesWith() is used as following:
file: gcc/llvm-backend.cpp on llvm-gcc-4.2
void emit_global_to_llvm(tree decl) {
...
if (GV->getType()->getElementType() != Init->getType()) {
GV->removeFromParent();
GlobalVariable *NGV = new GlobalVariable(*TheModule, Init->getType(),
GV->isConstant(),
GV->getLinkage(), 0,
GV->getName());
...
GV->replaceAllUsesWith(TheFolder->CreateBitCast(NGV, GV->getType()));
...
}
llvm-gcc makes new Global variable when Global variable's type is different from intializer's type
and All Uses which use previous Global Variable are changed to new Global variable.
If we makes useless ConstantExpr with previous Global variable,
replaceAllUsesWith() function will change useless ConstantExpr's previous Global variable
to new Global variable. I think it is inefficient.
Thanks,
Jin-Gu Kang
________________________________________
From: Duncan Sands [baldrick at free.fr]
Sent: Tuesday, February 22, 2011 9:22 PM
To: Jin Gu Kang
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] Fold() function on TargetFolder class - removal of redundant constantexpr
Hi Jin Gu Kang,
> I thought useless ConstantExpr makes useless Use information for its constant operands and
> they causes inefficient behavior when we use functions like replaceAllUsesWith()
> because of wrong Use inforamtion.
I doubt there is any measurable compile time impact due to this effect.
Did you see one?
Ciao, Duncan.
More information about the llvm-commits
mailing list