Skip to content

Commit 8018daa

Browse files
author
git apple-llvm automerger
committed
Merge commit 'b64cb72019f6' from apple/master into swift/master-next
2 parents 59ef304 + b64cb72 commit 8018daa

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

llvm/include/llvm/IR/Operator.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,20 +379,25 @@ class FPMathOperator : public Operator {
379379
return false;
380380

381381
switch (Opcode) {
382+
case Instruction::FNeg:
383+
case Instruction::FAdd:
384+
case Instruction::FSub:
385+
case Instruction::FMul:
386+
case Instruction::FDiv:
387+
case Instruction::FRem:
382388
// FIXME: To clean up and correct the semantics of fast-math-flags, FCmp
383389
// should not be treated as a math op, but the other opcodes should.
384390
// This would make things consistent with Select/PHI (FP value type
385391
// determines whether they are math ops and, therefore, capable of
386392
// having fast-math-flags).
387393
case Instruction::FCmp:
388394
return true;
389-
// non math FP Operators (no FMF)
390-
case Instruction::ExtractElement:
391-
case Instruction::ShuffleVector:
392-
case Instruction::InsertElement:
393-
return false;
394-
default:
395+
case Instruction::PHI:
396+
case Instruction::Select:
397+
case Instruction::Call:
395398
return V->getType()->isFPOrFPVectorTy();
399+
default:
400+
return false;
396401
}
397402
}
398403
};

llvm/unittests/IR/IRBuilderTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ TEST_F(IRBuilderTest, UnaryOperators) {
376376
ASSERT_FALSE(isa<BinaryOperator>(U));
377377

378378
// Test CreateFNegFMF(X)
379-
Instruction *I = cast<Instruction>(V);
379+
Instruction *I = cast<Instruction>(U);
380380
I->setHasNoSignedZeros(true);
381381
I->setHasNoNaNs(true);
382382
Value *VFMF = Builder.CreateFNegFMF(V, I);

0 commit comments

Comments
 (0)