mirror of
https://github.com/intel/llvm.git
synced 2026-02-07 07:39:11 +08:00
Since FSub X, 0 gets canoncialised to FAdd X, -0 the said optimization didn't make much sense for FSub. Remove it from IC and the adjoined testcase.
This commit is contained in:
@@ -3155,16 +3155,6 @@ Instruction *InstCombinerImpl::visitFSub(BinaryOperator &I) {
|
||||
Value *X, *Y;
|
||||
Constant *C;
|
||||
|
||||
// B = fsub A, 0.0
|
||||
// Z = Op B
|
||||
// can be transformed into
|
||||
// Z = Op A
|
||||
// Where Op is such that we can ignore sign of 0 in fsub
|
||||
Value *A;
|
||||
if (match(&I, m_OneUse(m_FSub(m_Value(A), m_AnyZeroFP()))) &&
|
||||
canIgnoreSignBitOfZero(*I.use_begin()))
|
||||
return replaceInstUsesWith(I, A);
|
||||
|
||||
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
|
||||
// If Op0 is not -0.0 or we can ignore -0.0: Z - (X - Y) --> Z + (Y - X)
|
||||
// Canonicalize to fadd to make analysis easier.
|
||||
|
||||
@@ -24,14 +24,3 @@ define float @src2(float %arg1) {
|
||||
%v4 = fsub float %v2, %v3
|
||||
ret float %v4
|
||||
}
|
||||
|
||||
define float @src_sub(float %arg1) {
|
||||
; CHECK-LABEL: define float @src_sub(
|
||||
; CHECK-SAME: float [[ARG1:%.*]]) {
|
||||
; CHECK-NEXT: [[V3:%.*]] = call float @llvm.fabs.f32(float [[ARG1]])
|
||||
; CHECK-NEXT: ret float [[V3]]
|
||||
;
|
||||
%v2 = fsub float %arg1, 0.000000e+00
|
||||
%v3 = call float @llvm.fabs.f32(float %v2)
|
||||
ret float %v3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user