summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit54664ed71444698e3f24ee372c3d9da42a1133c2 (patch)
tree119685b3bec1baad1658e3c2f59d4766b2f022b1 /llvm/lib/Analysis/InstructionSimplify.cpp
parent29f1db85dd5c4f78553b3e1c817417308da0a6ec (diff)
downloadbcm5719-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.cpp8
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;
}
OpenPOWER on IntegriCloud