forked from OSchip/llvm-project
[InstCombine] propagate fast-math-flags when folding fcmp+fpext, part 2
llvm-svn: 346242
This commit is contained in:
parent
7c3ee4da42
commit
46bf3922c1
|
@ -5483,9 +5483,12 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
|||
Fabs.clearSign();
|
||||
if (!Lossy &&
|
||||
((Fabs.compare(APFloat::getSmallestNormalized(FPSem)) !=
|
||||
APFloat::cmpLessThan) || Fabs.isZero()))
|
||||
// TODO: Propagate FMF.
|
||||
return new FCmpInst(Pred, X, ConstantFP::get(C->getContext(), F));
|
||||
APFloat::cmpLessThan) || Fabs.isZero())) {
|
||||
Instruction *NewFCmp =
|
||||
new FCmpInst(Pred, X, ConstantFP::get(C->getContext(), F));
|
||||
NewFCmp->copyFastMathFlags(&I);
|
||||
return NewFCmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ define i1 @test1(float %x, float %y) {
|
|||
|
||||
define i1 @test2(float %a) {
|
||||
; CHECK-LABEL: @test2(
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[A:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt float [[A:%.*]], 1.000000e+00
|
||||
; CHECK-NEXT: ret i1 [[CMP]]
|
||||
;
|
||||
%ext = fpext float %a to double
|
||||
|
|
Loading…
Reference in New Issue