-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
floating-pointFloating-point mathFloating-point mathgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization
Description
If one of the select operands is a constant, we generally push operations through to select on the result.
define float @src(float %x, i1 %bool) {
%select = select i1 %bool, float 1.000000e+00, float %x
%frexp = tail call { float, i32 } @llvm.frexp.f32.i32(float %select)
%frexp.0 = extractvalue { float, i32 } %frexp, 0
ret float %frexp.0
}
define float @tgt(float %x, i1 %bool) {
%frexp = tail call { float, i32 } @llvm.frexp.f32.i32(float %x)
%frexp.0 = extractvalue { float, i32 } %frexp, 0
%select = select i1 %bool, float 5.000000e-01, float %frexp.0
ret float %select
}
This case is somewhat complicated by the extractvalue. The combine should be rooted at a hasOneUse extractvalue (frexp), 0
dtcxzyw
Metadata
Metadata
Labels
floating-pointFloating-point mathFloating-point mathgood first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization