Skip to content

Commit 47c862f

Browse files
committed
[llvm] Fix fabs simplification
The existing code hits the std::optional<bool> is of comparing to a bool being "correct" for the std::optional and the intended comparison. This corrects the comparison while reinforcing the idea that we need some way to diagnose this. Fixes #152824
1 parent 6f53f1c commit 47c862f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/lib/Analysis/InstructionSimplify.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6304,7 +6304,8 @@ static Value *simplifyUnaryIntrinsic(Function *F, Value *Op0,
63046304
Value *X;
63056305
switch (IID) {
63066306
case Intrinsic::fabs:
6307-
if (computeKnownFPSignBit(Op0, Q) == false)
6307+
if (std::optional<bool> KnownSignBit = computeKnownFPSignBit(Op0, Q);
6308+
KnownSignBit && *KnownSignBit == false)
63086309
return Op0;
63096310
break;
63106311
case Intrinsic::bswap:

0 commit comments

Comments
 (0)