diff options
author | Dan Gohman <gohman@apple.com> | 2011-07-01 01:03:43 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2011-07-01 01:03:43 +0000 |
commit | 54664ed71444698e3f24ee372c3d9da42a1133c2 (patch) | |
tree | 119685b3bec1baad1658e3c2f59d4766b2f022b1 /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | 29f1db85dd5c4f78553b3e1c817417308da0a6ec (diff) | |
download | bcm5719-llvm-54664ed71444698e3f24ee372c3d9da42a1133c2.tar.gz bcm5719-llvm-54664ed71444698e3f24ee372c3d9da42a1133c2.zip |
Improve constant folding of undef for cmp and select operators.
llvm-svn: 134223
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r-- | llvm/lib/Analysis/InstructionSimplify.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp index 9d78f8bf404..8709f6bf9d2 100644 --- a/llvm/lib/Analysis/InstructionSimplify.cpp +++ b/llvm/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; } |