mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 18:46:06 +00:00
Some small improvements to dead code elimination; helps a bit on
LLVM-Code-Symbols test. llvm-svn: 92152
This commit is contained in:
parent
fddc26cc64
commit
2e06e8bbcc
@ -1378,6 +1378,15 @@ LValue CodeGenFunction::EmitCompoundLiteralLValue(const CompoundLiteralExpr* E){
|
|||||||
LValue
|
LValue
|
||||||
CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) {
|
CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) {
|
||||||
if (E->isLvalue(getContext()) == Expr::LV_Valid) {
|
if (E->isLvalue(getContext()) == Expr::LV_Valid) {
|
||||||
|
if (int Cond = ConstantFoldsToSimpleInteger(E->getCond())) {
|
||||||
|
Expr *Live = Cond == 1 ? E->getLHS() : E->getRHS();
|
||||||
|
if (Live)
|
||||||
|
return EmitLValue(Live);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!E->getLHS())
|
||||||
|
return EmitUnsupportedLValue(E, "conditional operator with missing LHS");
|
||||||
|
|
||||||
llvm::BasicBlock *LHSBlock = createBasicBlock("cond.true");
|
llvm::BasicBlock *LHSBlock = createBasicBlock("cond.true");
|
||||||
llvm::BasicBlock *RHSBlock = createBasicBlock("cond.false");
|
llvm::BasicBlock *RHSBlock = createBasicBlock("cond.false");
|
||||||
llvm::BasicBlock *ContBlock = createBasicBlock("cond.end");
|
llvm::BasicBlock *ContBlock = createBasicBlock("cond.end");
|
||||||
|
@ -546,7 +546,7 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
|
|||||||
// static, static inline, always_inline, and extern inline functions can
|
// static, static inline, always_inline, and extern inline functions can
|
||||||
// always be deferred. Normal inline functions can be deferred in C99/C++.
|
// always be deferred. Normal inline functions can be deferred in C99/C++.
|
||||||
if (Linkage == GVA_Internal || Linkage == GVA_C99Inline ||
|
if (Linkage == GVA_Internal || Linkage == GVA_C99Inline ||
|
||||||
Linkage == GVA_CXXInline)
|
Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user