summaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InstructionSimplify.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-07-26 19:46:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-07-26 19:46:28 +0000
commit2cedf089162d7ff08af2fb09e4adea44608e7233 (patch)
treeba6ce010fd991778200b43335a161f546d953a55 /llvm/lib/Analysis/InstructionSimplify.cpp
parentcfca06d7963fa0909f90483b42a6d7d194d01e08 (diff)
Notes
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
-rw-r--r--llvm/lib/Analysis/InstructionSimplify.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/llvm/lib/Analysis/InstructionSimplify.cpp b/llvm/lib/Analysis/InstructionSimplify.cpp
index 0975a65d183e..d3bdf9d6aafd 100644
--- a/llvm/lib/Analysis/InstructionSimplify.cpp
+++ b/llvm/lib/Analysis/InstructionSimplify.cpp
@@ -4118,15 +4118,9 @@ static Value *SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
if (TrueVal == FalseVal)
return TrueVal;
- // If the true or false value is undef, we can fold to the other value as
- // long as the other value isn't poison.
- // select ?, undef, X -> X
- if (isa<UndefValue>(TrueVal) &&
- isGuaranteedNotToBeUndefOrPoison(FalseVal, Q.CxtI, Q.DT))
+ if (isa<UndefValue>(TrueVal)) // select ?, undef, X -> X
return FalseVal;
- // select ?, X, undef -> X
- if (isa<UndefValue>(FalseVal) &&
- isGuaranteedNotToBeUndefOrPoison(TrueVal, Q.CxtI, Q.DT))
+ if (isa<UndefValue>(FalseVal)) // select ?, X, undef -> X
return TrueVal;
// Deal with partial undef vector constants: select ?, VecC, VecC' --> VecC''
@@ -4146,11 +4140,9 @@ static Value *SimplifySelectInst(Value *Cond, Value *TrueVal, Value *FalseVal,
// one element is undef, choose the defined element as the safe result.
if (TEltC == FEltC)
NewC.push_back(TEltC);
- else if (isa<UndefValue>(TEltC) &&
- isGuaranteedNotToBeUndefOrPoison(FEltC))
+ else if (isa<UndefValue>(TEltC))
NewC.push_back(FEltC);
- else if (isa<UndefValue>(FEltC) &&
- isGuaranteedNotToBeUndefOrPoison(TEltC))
+ else if (isa<UndefValue>(FEltC))
NewC.push_back(TEltC);
else
break;