Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 0 additions & 11 deletions llvm/test/Transforms/InstCombine/fold-fadd-with-zero-gh154238.ll
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Loading