Skip to content

Commit 9dd2c59

Browse files
authored
InstCombine: Enable SimplifyDemandedUseFPClass and remove flag (llvm#81108)
This completes the unrevert of ef38833.
1 parent e20462a commit 9dd2c59

File tree

3 files changed

+45
-22
lines changed

3 files changed

+45
-22
lines changed

clang/test/Headers/__clang_hip_math.hip

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,33 +2557,65 @@ extern "C" __device__ double test_nan(const char *tag) {
25572557
return nan(tag);
25582558
}
25592559

2560-
// CHECK-LABEL: @test_nanf_emptystr(
2561-
// CHECK-NEXT: entry:
2562-
// CHECK-NEXT: ret float 0x7FF8000000000000
2560+
// DEFAULT-LABEL: @test_nanf_emptystr(
2561+
// DEFAULT-NEXT: entry:
2562+
// DEFAULT-NEXT: ret float 0x7FF8000000000000
2563+
//
2564+
// FINITEONLY-LABEL: @test_nanf_emptystr(
2565+
// FINITEONLY-NEXT: entry:
2566+
// FINITEONLY-NEXT: ret float poison
2567+
//
2568+
// APPROX-LABEL: @test_nanf_emptystr(
2569+
// APPROX-NEXT: entry:
2570+
// APPROX-NEXT: ret float 0x7FF8000000000000
25632571
//
25642572
extern "C" __device__ float test_nanf_emptystr() {
25652573
return nanf("");
25662574
}
25672575

2568-
// CHECK-LABEL: @test_nan_emptystr(
2569-
// CHECK-NEXT: entry:
2570-
// CHECK-NEXT: ret double 0x7FF8000000000000
2576+
// DEFAULT-LABEL: @test_nan_emptystr(
2577+
// DEFAULT-NEXT: entry:
2578+
// DEFAULT-NEXT: ret double 0x7FF8000000000000
2579+
//
2580+
// FINITEONLY-LABEL: @test_nan_emptystr(
2581+
// FINITEONLY-NEXT: entry:
2582+
// FINITEONLY-NEXT: ret double poison
2583+
//
2584+
// APPROX-LABEL: @test_nan_emptystr(
2585+
// APPROX-NEXT: entry:
2586+
// APPROX-NEXT: ret double 0x7FF8000000000000
25712587
//
25722588
extern "C" __device__ double test_nan_emptystr() {
25732589
return nan("");
25742590
}
25752591

2576-
// CHECK-LABEL: @test_nanf_fill(
2577-
// CHECK-NEXT: entry:
2578-
// CHECK-NEXT: ret float 0x7FF8000000000000
2592+
// DEFAULT-LABEL: @test_nanf_fill(
2593+
// DEFAULT-NEXT: entry:
2594+
// DEFAULT-NEXT: ret float 0x7FF8000000000000
2595+
//
2596+
// FINITEONLY-LABEL: @test_nanf_fill(
2597+
// FINITEONLY-NEXT: entry:
2598+
// FINITEONLY-NEXT: ret float poison
2599+
//
2600+
// APPROX-LABEL: @test_nanf_fill(
2601+
// APPROX-NEXT: entry:
2602+
// APPROX-NEXT: ret float 0x7FF8000000000000
25792603
//
25802604
extern "C" __device__ float test_nanf_fill() {
25812605
return nanf("0x456");
25822606
}
25832607

2584-
// CHECK-LABEL: @test_nan_fill(
2585-
// CHECK-NEXT: entry:
2586-
// CHECK-NEXT: ret double 0x7FF8000000000000
2608+
// DEFAULT-LABEL: @test_nan_fill(
2609+
// DEFAULT-NEXT: entry:
2610+
// DEFAULT-NEXT: ret double 0x7FF8000000000000
2611+
//
2612+
// FINITEONLY-LABEL: @test_nan_fill(
2613+
// FINITEONLY-NEXT: entry:
2614+
// FINITEONLY-NEXT: ret double poison
2615+
//
2616+
// APPROX-LABEL: @test_nan_fill(
2617+
// APPROX-NEXT: entry:
2618+
// APPROX-NEXT: ret double 0x7FF8000000000000
25872619
//
25882620
extern "C" __device__ double test_nan_fill() {
25892621
return nan("0x123");

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,6 @@ static cl::opt<unsigned>
142142
MaxArraySize("instcombine-maxarray-size", cl::init(1024),
143143
cl::desc("Maximum array size considered when doing a combine"));
144144

145-
// TODO: Remove this option
146-
static cl::opt<bool> EnableSimplifyDemandedUseFPClass(
147-
"instcombine-simplify-demanded-fp-class",
148-
cl::desc("Enable demanded floating-point class optimizations"),
149-
cl::init(false));
150-
151145
// FIXME: Remove this flag when it is no longer necessary to convert
152146
// llvm.dbg.declare to avoid inaccurate debug info. Setting this to false
153147
// increases variable availability at the cost of accuracy. Variables that
@@ -3111,9 +3105,6 @@ Instruction *InstCombinerImpl::visitFree(CallInst &FI, Value *Op) {
31113105
}
31123106

31133107
Instruction *InstCombinerImpl::visitReturnInst(ReturnInst &RI) {
3114-
if (!EnableSimplifyDemandedUseFPClass)
3115-
return nullptr;
3116-
31173108
Value *RetVal = RI.getReturnValue();
31183109
if (!RetVal || !AttributeFuncs::isNoFPClassCompatibleType(RetVal->getType()))
31193110
return nullptr;

llvm/test/Transforms/InstCombine/simplify-demanded-fpclass.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2-
; RUN: opt -S -passes=instcombine -instcombine-simplify-demanded-fp-class < %s | FileCheck %s
2+
; RUN: opt -S -passes=instcombine < %s | FileCheck %s
33

44
declare float @llvm.fabs.f32(float)
55
declare float @llvm.copysign.f32(float, float)

0 commit comments

Comments
 (0)