aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-07-01 01:03:43 +0000
committerDan Gohman <gohman@apple.com>2011-07-01 01:03:43 +0000
commit68c0dbc14fb7599987fb3e27be4e12c1ac36535e (patch)
treed1eb614605e080339290cc5405e433c3b2ffd0ea /lib/Analysis/InstructionSimplify.cpp
parent5e653c925c7da969c3fb5fa9a46263ffb160b81e (diff)
downloadexternal_llvm-68c0dbc14fb7599987fb3e27be4e12c1ac36535e.zip
external_llvm-68c0dbc14fb7599987fb3e27be4e12c1ac36535e.tar.gz
external_llvm-68c0dbc14fb7599987fb3e27be4e12c1ac36535e.tar.bz2
Improve constant folding of undef for cmp and select operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134223 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--lib/Analysis/InstructionSimplify.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Analysis/InstructionSimplify.cpp b/lib/Analysis/InstructionSimplify.cpp
index 9d78f8b..8709f6b 100644
--- a/lib/Analysis/InstructionSimplify.cpp
+++ b/lib/Analysis/InstructionSimplify.cpp
@@ -2204,15 +2204,15 @@ Value *llvm::SimplifySelectInst(Value *CondVal, Value *TrueVal, Value *FalseVal,
if (TrueVal == FalseVal)
return TrueVal;
- if (isa<UndefValue>(TrueVal)) // select C, undef, X -> X
- return FalseVal;
- if (isa<UndefValue>(FalseVal)) // select C, X, undef -> X
- return TrueVal;
if (isa<UndefValue>(CondVal)) { // select undef, X, Y -> X or Y
if (isa<Constant>(TrueVal))
return TrueVal;
return FalseVal;
}
+ if (isa<UndefValue>(TrueVal)) // select C, undef, X -> X
+ return FalseVal;
+ if (isa<UndefValue>(FalseVal)) // select C, X, undef -> X
+ return TrueVal;
return 0;
}