aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-11-12 04:54:14 +0000
committerChris Lattner <sabre@nondot.org>2008-11-12 04:54:14 +0000
commit746e03ed511664a1c781b209faaa3a66d4593480 (patch)
treeb8e2aed7b838aed3e3847ef5967b310bf81746d9 /lib/CodeGen/CGExprScalar.cpp
parentf0d960a2d303d1b7f8ee3bca2d52eee15f4c853e (diff)
Clean up some code to use isZero instead of calling getZExtValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 6077f8e61c..1a583a7158 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -1022,7 +1022,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {
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 @@ Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
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 @@ VisitConditionalOperator(const ConditionalOperator *E) {
// 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.