[cfe-commits] r59103 - in /cfe/trunk/lib/CodeGen: CGExprScalar.cpp CGStmt.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 11 20:54:16 PST 2008
Author: lattner
Date: Tue Nov 11 22:54:14 2008
New Revision: 59103
URL: http://llvm.org/viewvc/llvm-project?rev=59103&view=rev
Log:
Clean up some code to use isZero instead of calling getZExtValue.
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=59103&r1=59102&r2=59103&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Nov 11 22:54:14 2008
@@ -1022,7 +1022,7 @@
if (llvm::ConstantInt *LHSCst = dyn_cast<llvm::ConstantInt>(LHSCond)) {
// If we have 0 && RHS, see if we can elide RHS, if so, just return LHSCond.
- if (LHSCst->getZExtValue() == 0) {
+ if (LHSCst->isZero()) {
if (!CGF.ContainsLabel(E->getRHS()))
// Elide RHS, return 0
return llvm::Constant::getNullValue(CGF.LLVMIntTy);
@@ -1063,7 +1063,7 @@
if (llvm::ConstantInt *LHSCst = dyn_cast<llvm::ConstantInt>(LHSCond)) {
// If we have 1 || RHS, see if we can elide RHS, if so, just return LHSCond.
- if (LHSCst->getZExtValue() != 0) {
+ if (!LHSCst->isZero()) {
if (!CGF.ContainsLabel(E->getRHS()))
// Elide RHS, return 1
return llvm::ConstantInt::get(CGF.LLVMIntTy, 1);
@@ -1120,7 +1120,7 @@
// can't do this if the dead side contains a label.
if (llvm::ConstantInt *CondCI = dyn_cast<llvm::ConstantInt>(CondVal)) {
Expr *Live = E->getLHS(), *Dead = E->getRHS();
- if (CondCI->getZExtValue() == 0)
+ if (CondCI->isZero())
std::swap(Live, Dead);
if (!Dead || !CGF.ContainsLabel(Dead)) {
// Emit the live side.
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=59103&r1=59102&r2=59103&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Nov 11 22:54:14 2008
@@ -233,7 +233,7 @@
if (llvm::ConstantInt *CondCst = dyn_cast<llvm::ConstantInt>(BoolCondVal)) {
// Figure out which block (then or else) is executed.
const Stmt *Executed = S.getThen(), *Skipped = S.getElse();
- if (!CondCst->getZExtValue())
+ if (CondCst->isZero())
std::swap(Executed, Skipped);
// If the skipped block has no labels in it, just emit the executed block.
More information about the cfe-commits
mailing list