Index: llvm/trunk/lib/IR/Instructions.cpp =================================================================== --- llvm/trunk/lib/IR/Instructions.cpp +++ llvm/trunk/lib/IR/Instructions.cpp @@ -2173,7 +2173,7 @@ { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0}, // UIToFP +- firstOp { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0}, // SIToFP | { 99,99,99, 0, 0,99,99, 0, 0,99,99, 4, 0}, // FPTrunc | - { 99,99,99, 2, 2,99,99,10, 2,99,99, 4, 0}, // FPExt | + { 99,99,99, 2, 2,99,99, 8, 2,99,99, 4, 0}, // FPExt | { 1, 0, 0,99,99, 0, 0,99,99,99, 7, 3, 0}, // PtrToInt | { 99,99,99,99,99,99,99,99,99,11,99,15, 0}, // IntToPtr | { 5, 5, 5, 6, 6, 5, 5, 6, 6,16, 5, 1,14}, // BitCast | @@ -2267,12 +2267,6 @@ case 9: // zext, sext -> zext, because sext can't sign extend after zext return Instruction::ZExt; - case 10: - // fpext followed by ftrunc is allowed if the bit size returned to is - // the same as the original, in which case its just a bitcast - if (SrcTy == DstTy) - return Instruction::BitCast; - return 0; // If the types are not the same we can't eliminate it. case 11: { // inttoptr, ptrtoint -> bitcast if SrcSize<=PtrSize and SrcSize==DstSize if (!MidIntPtrTy) Index: llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll =================================================================== --- llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll +++ llvm/trunk/test/Transforms/InstCombine/double-float-shrink-2.ll @@ -448,8 +448,7 @@ define float @test_shrink_intrin_floor_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_floor_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.floor.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -461,8 +460,7 @@ define float @test_shrink_intrin_ceil_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_ceil_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.ceil.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -474,8 +472,7 @@ define float @test_shrink_intrin_round_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_round_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.round.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -487,8 +484,7 @@ define float @test_shrink_intrin_nearbyint_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_nearbyint_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.nearbyint.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -500,8 +496,7 @@ define float @test_shrink_intrin_trunc_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_trunc_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.trunc.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -513,8 +508,7 @@ define float @test_shrink_intrin_fabs_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_fabs_fp16_src( ; ALL-NEXT: [[E:%.*]] = call half @llvm.fabs.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double @@ -527,8 +521,7 @@ define float @test_shrink_intrin_fabs_fast_fp16_src(half %C) { ; ALL-LABEL: @test_shrink_intrin_fabs_fast_fp16_src( ; ALL-NEXT: [[E:%.*]] = call fast half @llvm.fabs.f16(half [[C:%.*]]) -; ALL-NEXT: [[TMP1:%.*]] = fpext half [[E]] to double -; ALL-NEXT: [[F:%.*]] = fptrunc double [[TMP1]] to float +; ALL-NEXT: [[F:%.*]] = fpext half [[E]] to float ; ALL-NEXT: ret float [[F]] ; %D = fpext half %C to double Index: llvm/trunk/test/Transforms/InstCombine/fpextend.ll =================================================================== --- llvm/trunk/test/Transforms/InstCombine/fpextend.ll +++ llvm/trunk/test/Transforms/InstCombine/fpextend.ll @@ -102,8 +102,7 @@ define half @test7(float %a) nounwind { ; CHECK-LABEL: @test7( -; CHECK-NEXT: [[Y:%.*]] = fpext float [[A:%.*]] to double -; CHECK-NEXT: [[Z:%.*]] = fptrunc double [[Y]] to half +; CHECK-NEXT: [[Z:%.*]] = fptrunc float [[A:%.*]] to half ; CHECK-NEXT: ret half [[Z]] ; %y = fpext float %a to double @@ -113,8 +112,7 @@ define float @test8(half %a) nounwind { ; CHECK-LABEL: @test8( -; CHECK-NEXT: [[Y:%.*]] = fpext half [[A:%.*]] to double -; CHECK-NEXT: [[Z:%.*]] = fptrunc double [[Y]] to float +; CHECK-NEXT: [[Z:%.*]] = fpext half [[A:%.*]] to float ; CHECK-NEXT: ret float [[Z]] ; %y = fpext half %a to double