-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Closed
Labels
Description
Noticed this when working on https://reviews.llvm.org/D153089
Attributor seems to specially treat return of select, such that computeKnownFPClass
is never called on the select instruction. In this example, it fails to add nofpclass(nan)
to the return value. If you obscure the return value with some kind of call, it works:
define float @ret_select_nnan_flag(i1 %cond, float %arg0, float %arg1) {
%select = select nnan i1 %cond, float %arg0, float %arg1
ret float %select
}
declare float @llvm.arithmetic.fence.f32(float)
define float @ret_fence_select_nnan_flag(i1 %cond, float %arg0, float %arg1) {
%select = select nnan i1 %cond, float %arg0, float %arg1
%fence = call float @llvm.arithmetic.fence.f32(float %select)
ret float %fence
}
This will miss instruction flags and select clamping patterns computeKnownFPClass
could recognize