llvm / llvm/llvm-project

InstCombine does not check contract flag on all instructions in cos * tan -> sin combine

Open
#179,972 1 comment 0 reactions 0 assignees View on GitHub
floating-point llvm:instcombine
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This combine has a viral interpretation of contract which is incorrect: https://godbolt.org/z/YWshG18Ge
```llvm
; RUN: opt -S -p=instcombine %s
define float @missing_contract_cos_mul_tan(float %x) {
%tan = call float @llvm.tan.f32(float %x)
%cos = call float @llvm.cos.f32(float %x)
%mul = fmul contract float %tan, %cos
ret float %mul
}
```

This should require contract on both the tan and cos calls to perform the contraction.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.