[cfe-commits] r92152 - in /cfe/trunk/lib/CodeGen: CGExpr.cpp CodeGenModule.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Dec 24 21:29:41 PST 2009
Author: efriedma
Date: Thu Dec 24 23:29:40 2009
New Revision: 92152
URL: http://llvm.org/viewvc/llvm-project?rev=92152&view=rev
Log:
Some small improvements to dead code elimination; helps a bit on
LLVM-Code-Symbols test.
Modified:
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=92152&r1=92151&r2=92152&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Dec 24 23:29:40 2009
@@ -1378,6 +1378,15 @@
LValue
CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) {
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 *RHSBlock = createBasicBlock("cond.false");
llvm::BasicBlock *ContBlock = createBasicBlock("cond.end");
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=92152&r1=92151&r2=92152&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Dec 24 23:29:40 2009
@@ -546,7 +546,7 @@
// static, static inline, always_inline, and extern inline functions can
// always be deferred. Normal inline functions can be deferred in C99/C++.
if (Linkage == GVA_Internal || Linkage == GVA_C99Inline ||
- Linkage == GVA_CXXInline)
+ Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation)
return true;
return false;
}
More information about the cfe-commits
mailing list