From a64bd44fd8269bdd246fb21a7ca645e957bc9501 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Tue, 18 Nov 2014 00:33:22 +0000 Subject: [PATCH] Revert r222040 because of bot failure. http://lab.llvm.org:8080/green/job/clang-Rlto_master/298/ Hopefully, bot will be green. llvm-svn: 222203 --- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 15 ++++++--------- llvm/test/Transforms/InstCombine/fpcast.ll | 10 ---------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index a0570f7..b41cdc6 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -1269,17 +1269,14 @@ Instruction *InstCombiner::visitFPTrunc(FPTruncInst &CI) { // type of OpI doesn't enter into things at all. We simply evaluate // in whichever source type is larger, then convert to the // destination type. - Value *NewLHS = LHSOrig, *NewRHS = RHSOrig; if (LHSWidth < SrcWidth) - NewLHS = Builder->CreateFPExt(NewLHS, RHSOrig->getType()); + LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType()); else if (RHSWidth <= SrcWidth) - NewRHS = Builder->CreateFPExt(NewRHS, LHSOrig->getType()); - if (NewLHS != LHSOrig || NewRHS != RHSOrig) { - Value *ExactResult = Builder->CreateFRem(NewLHS, NewRHS); - if (Instruction *RI = dyn_cast(ExactResult)) - RI->copyFastMathFlags(OpI); - return CastInst::CreateFPCast(ExactResult, CI.getType()); - } + RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType()); + Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig); + if (Instruction *RI = dyn_cast(ExactResult)) + RI->copyFastMathFlags(OpI); + return CastInst::CreateFPCast(ExactResult, CI.getType()); } // (fptrunc (fneg x)) -> (fneg (fptrunc x)) diff --git a/llvm/test/Transforms/InstCombine/fpcast.ll b/llvm/test/Transforms/InstCombine/fpcast.ll index c4c8578..9be66fd 100644 --- a/llvm/test/Transforms/InstCombine/fpcast.ll +++ b/llvm/test/Transforms/InstCombine/fpcast.ll @@ -53,13 +53,3 @@ define half @test5(float %a, float %b, float %c) { } declare float @llvm.fabs.f32(float) nounwind readonly - -define <1 x float> @test6(<1 x double> %V) { - %frem = frem <1 x double> %V, %V - %trunc = fptrunc <1 x double> %frem to <1 x float> - ret <1 x float> %trunc -; CHECK-LABEL: @test6 -; CHECK-NEXT: %[[frem:.*]] = frem <1 x double> %V, %V -; CHECK-NEXT: %[[trunc:.*]] = fptrunc <1 x double> %[[frem]] to <1 x float> -; CHECK-NEXT: ret <1 x float> %trunc -} -- 2.7.4