File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
lib/Transforms/InstCombine
test/Transforms/InstCombine Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1212
1313#include " InstCombineInternal.h"
1414#include " llvm/ADT/APInt.h"
15+ #include " llvm/ADT/FloatingPointMode.h"
1516#include " llvm/ADT/STLExtras.h"
1617#include " llvm/ADT/SmallVector.h"
1718#include " llvm/Analysis/AssumptionCache.h"
@@ -2853,6 +2854,9 @@ static bool ignoreSignBitOfNaN(Instruction &I) {
28532854 case Instruction::Select:
28542855 case Instruction::PHI:
28552856 return false ;
2857+ case Instruction::Ret:
2858+ return I.getFunction ()->getAttributes ().getRetNoFPClass () &
2859+ FPClassTest::fcNan;
28562860 case Instruction::Call:
28572861 case Instruction::Invoke: {
28582862 if (auto *II = dyn_cast<IntrinsicInst>(User)) {
Original file line number Diff line number Diff line change @@ -1380,6 +1380,17 @@ define void @test_fabs_used_by_nofpclass_nan(float %x) {
13801380 ret void
13811381}
13821382
1383+ define nofpclass(nan) float @test_fabs_used_by_ret_nofpclass_nan (float %x ) {
1384+ ; CHECK-LABEL: @test_fabs_used_by_ret_nofpclass_nan(
1385+ ; CHECK-NEXT: [[SEL:%.*]] = call nsz float @llvm.fabs.f32(float [[X:%.*]])
1386+ ; CHECK-NEXT: ret float [[SEL]]
1387+ ;
1388+ %cmp = fcmp oge float %x , 0 .000000e+00
1389+ %neg = fneg float %x
1390+ %sel = select nsz i1 %cmp , float %x , float %neg
1391+ ret float %sel
1392+ }
1393+
13831394define i32 @test_fabs_used_fptosi (float %x ) {
13841395; CHECK-LABEL: @test_fabs_used_fptosi(
13851396; CHECK-NEXT: [[SEL:%.*]] = call float @llvm.fabs.f32(float [[X:%.*]])
You can’t perform that action at this time.
0 commit comments