llvm.org GIT mirror llvm / ea5455c
[InstSimplify] Add "X / 1.0" to SimplifyFDivInst. Differential Revision: https://reviews.llvm.org/D27587 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289153 91177308-0d34-0410-b5e6-96231b3b80d8 Zia Ansari 2 years ago
2 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
11251125 // X / undef -> undef
11261126 if (match(Op1, m_Undef()))
11271127 return Op1;
1128
1129 // X / 1.0 -> X
1130 if (match(Op1, m_FPOne()))
1131 return Op0;
11281132
11291133 // 0 / X -> 0
11301134 // Requires that NaNs are off (X could be zero) and signed zeroes are
40924096 return SimplifyFSubInst(LHS, RHS, FMF, Q, MaxRecurse);
40934097 case Instruction::FMul:
40944098 return SimplifyFMulInst(LHS, RHS, FMF, Q, MaxRecurse);
4099 case Instruction::FDiv:
4100 return SimplifyFDivInst(LHS, RHS, FMF, Q, MaxRecurse);
40954101 default:
40964102 return SimplifyBinOp(Opcode, LHS, RHS, Q, MaxRecurse);
40974103 }
6161 ret double %b
6262 }
6363
64 ; FIXME:
6564 ; fdiv X, 1.0 ==> X
6665 define float @fdiv_x_1(float %a) {
6766 ; CHECK-LABEL: @fdiv_x_1(
68 ; CHECK-NEXT: [[RET:%.*]] = fdiv float %a, 1.000000e+00
69 ; CHECK-NEXT: ret float [[RET]]
67 ; CHECK-NEXT: ret float %a
7068 ;
7169 %ret = fdiv float %a, 1.0
7270 ret float %ret