summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 05afc4f5501..6eac4b3b4af 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -3580,6 +3580,9 @@ static Value *SimplifySelectInst(Value *CondVal, Value *TrueVal,
// select true, X, Y -> X
// select false, X, Y -> Y
if (Constant *CB = dyn_cast<Constant>(CondVal)) {
+ if (Constant *CT = dyn_cast<Constant>(TrueVal))
+ if (Constant *CF = dyn_cast<Constant>(FalseVal))
+ return ConstantFoldSelectInstruction(CB, CT, CF);
if (CB->isAllOnesValue())
return TrueVal;
if (CB->isNullValue())
OpenPOWER on IntegriCloud