This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Delete body of isKnownNeverNaN
ClosedPublic

Authored by arsenm on Apr 10 2023, 2:41 PM.

Details

Summary

This should now be redundant with the nan handling in computeKnownFPClass.

Diff Detail

Event Timeline

arsenm created this revision.Apr 10 2023, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 2:41 PM
arsenm requested review of this revision.Apr 10 2023, 2:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2023, 2:41 PM
Herald added a subscriber: wdng. · View Herald Transcript
kpn accepted this revision.Apr 12 2023, 10:30 AM

Once the prereqs are in place this LGTM.

This revision is now accepted and ready to land.Apr 12 2023, 10:30 AM
foad added a subscriber: foad.May 18 2023, 5:15 AM

This causes:

; RUN: llc -march=amdgcn -mcpu=gfx1030 < %s

define void @f() {
bb:
  call void @g()
  ret void
}

define void @g() alwaysinline {
bb:
  %i = call <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32> zeroinitializer, i32 0, i32 0)
  %i1 = bitcast <4 x i32> %i to <4 x float>
  %i2 = extractelement <4 x float> %i1, i64 0
  %i3 = fmul float %i2, 0.000000e+00
  %i4 = call float @llvm.maxnum.f32(float %i3, float 0.000000e+00)
  %i5 = call float @llvm.maxnum.f32(float %i4, float %i2)
  %i6 = fcmp olt float %i5, 0.000000e+00
  ret void
}

declare float @llvm.maxnum.f32(float, float)
declare <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32>, i32, i32 immarg)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/jayfoad2/llvm-release/bin/llc -march=amdgcn -mcpu=gfx1030
1.	Running pass 'Inliner for always_inline functions' on module '<stdin>'.
 #0 0x000000000338afc7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jayfoad2/llvm-release/bin/llc+0x338afc7)
 #1 0x0000000003388e7e llvm::sys::RunSignalHandlers() (/home/jayfoad2/llvm-release/bin/llc+0x3388e7e)
 #2 0x000000000338b66a SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f1527842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000002b50cb4 llvm::AttributeList::getAttributeAtIndex(unsigned int, llvm::StringRef) const (/home/jayfoad2/llvm-release/bin/llc+0x2b50cb4)
 #5 0x0000000002c2e95d llvm::Function::getDenormalMode(llvm::fltSemantics const&) const (/home/jayfoad2/llvm-release/bin/llc+0x2c2e95d)
 #6 0x00000000024ebbda computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #7 0x00000000024ebf9e computeKnownFPClass(llvm::Value const*, llvm::KnownFPClass&, llvm::FPClassTest, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #8 0x000000000250e8a8 cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int)::$_25::operator()(llvm::Value*) const ValueTracking.cpp:0:0
 #9 0x00000000024e94aa cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int) ValueTracking.cpp:0:0
#10 0x0000000002389456 simplifyFCmpInst(unsigned int, llvm::Value*, llvm::Value*, llvm::FastMathFlags, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#11 0x0000000002390a43 simplifyInstructionWithOperands(llvm::Instruction*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#12 0x0000000002390fec llvm::simplifyInstruction(llvm::Instruction*, llvm::SimplifyQuery const&) (/home/jayfoad2/llvm-release/bin/llc+0x2390fec)
#13 0x00000000033cc8b8 (anonymous namespace)::PruningFunctionCloner::CloneBlock(llvm::BasicBlock const*, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, std::vector<llvm::BasicBlock const*, std::allocator<llvm::BasicBlock const*>>&) CloneFunction.cpp:0:0
#14 0x00000000033c90a2 llvm::CloneAndPruneIntoFromInst(llvm::Function*, llvm::Function const*, llvm::Instruction const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33c90a2)
#15 0x00000000033cdd02 llvm::CloneAndPruneFunctionInto(llvm::Function*, llvm::Function const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33cdd02)
#16 0x00000000033f8528 llvm::InlineFunction(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, llvm::Function*) (/home/jayfoad2/llvm-release/bin/llc+0x33f8528)
#17 0x000000000360c477 (anonymous namespace)::AlwaysInlineImpl(llvm::Module&, bool, llvm::ProfileSummaryInfo&, llvm::function_ref<llvm::AssumptionCache& (llvm::Function&)>, llvm::function_ref<llvm::AAResults& (llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>) AlwaysInliner.cpp:0:0
#18 0x000000000360d3f1 (anonymous namespace)::AlwaysInlinerLegacyPass::runOnModule(llvm::Module&) AlwaysInliner.cpp:0:0
#19 0x0000000002c8078c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jayfoad2/llvm-release/bin/llc+0x2c8078c)
#20 0x0000000001ea64c9 main (/home/jayfoad2/llvm-release/bin/llc+0x1ea64c9)
#21 0x00007f1527829d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007f1527829e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007f1527829e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x0000000001ea0f25 _start (/home/jayfoad2/llvm-release/bin/llc+0x1ea0f25)
Segmentation fault (core dumped)

Can you fix or revert please?

This causes:

; RUN: llc -march=amdgcn -mcpu=gfx1030 < %s

define void @f() {
bb:
  call void @g()
  ret void
}

define void @g() alwaysinline {
bb:
  %i = call <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32> zeroinitializer, i32 0, i32 0)
  %i1 = bitcast <4 x i32> %i to <4 x float>
  %i2 = extractelement <4 x float> %i1, i64 0
  %i3 = fmul float %i2, 0.000000e+00
  %i4 = call float @llvm.maxnum.f32(float %i3, float 0.000000e+00)
  %i5 = call float @llvm.maxnum.f32(float %i4, float %i2)
  %i6 = fcmp olt float %i5, 0.000000e+00
  ret void
}

declare float @llvm.maxnum.f32(float, float)
declare <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32>, i32, i32 immarg)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/jayfoad2/llvm-release/bin/llc -march=amdgcn -mcpu=gfx1030
1.	Running pass 'Inliner for always_inline functions' on module '<stdin>'.
 #0 0x000000000338afc7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jayfoad2/llvm-release/bin/llc+0x338afc7)
 #1 0x0000000003388e7e llvm::sys::RunSignalHandlers() (/home/jayfoad2/llvm-release/bin/llc+0x3388e7e)
 #2 0x000000000338b66a SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f1527842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000002b50cb4 llvm::AttributeList::getAttributeAtIndex(unsigned int, llvm::StringRef) const (/home/jayfoad2/llvm-release/bin/llc+0x2b50cb4)
 #5 0x0000000002c2e95d llvm::Function::getDenormalMode(llvm::fltSemantics const&) const (/home/jayfoad2/llvm-release/bin/llc+0x2c2e95d)
 #6 0x00000000024ebbda computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #7 0x00000000024ebf9e computeKnownFPClass(llvm::Value const*, llvm::KnownFPClass&, llvm::FPClassTest, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #8 0x000000000250e8a8 cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int)::$_25::operator()(llvm::Value*) const ValueTracking.cpp:0:0
 #9 0x00000000024e94aa cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int) ValueTracking.cpp:0:0
#10 0x0000000002389456 simplifyFCmpInst(unsigned int, llvm::Value*, llvm::Value*, llvm::FastMathFlags, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#11 0x0000000002390a43 simplifyInstructionWithOperands(llvm::Instruction*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#12 0x0000000002390fec llvm::simplifyInstruction(llvm::Instruction*, llvm::SimplifyQuery const&) (/home/jayfoad2/llvm-release/bin/llc+0x2390fec)
#13 0x00000000033cc8b8 (anonymous namespace)::PruningFunctionCloner::CloneBlock(llvm::BasicBlock const*, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, std::vector<llvm::BasicBlock const*, std::allocator<llvm::BasicBlock const*>>&) CloneFunction.cpp:0:0
#14 0x00000000033c90a2 llvm::CloneAndPruneIntoFromInst(llvm::Function*, llvm::Function const*, llvm::Instruction const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33c90a2)
#15 0x00000000033cdd02 llvm::CloneAndPruneFunctionInto(llvm::Function*, llvm::Function const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33cdd02)
#16 0x00000000033f8528 llvm::InlineFunction(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, llvm::Function*) (/home/jayfoad2/llvm-release/bin/llc+0x33f8528)
#17 0x000000000360c477 (anonymous namespace)::AlwaysInlineImpl(llvm::Module&, bool, llvm::ProfileSummaryInfo&, llvm::function_ref<llvm::AssumptionCache& (llvm::Function&)>, llvm::function_ref<llvm::AAResults& (llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>) AlwaysInliner.cpp:0:0
#18 0x000000000360d3f1 (anonymous namespace)::AlwaysInlinerLegacyPass::runOnModule(llvm::Module&) AlwaysInliner.cpp:0:0
#19 0x0000000002c8078c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jayfoad2/llvm-release/bin/llc+0x2c8078c)
#20 0x0000000001ea64c9 main (/home/jayfoad2/llvm-release/bin/llc+0x1ea64c9)
#21 0x00007f1527829d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007f1527829e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007f1527829e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x0000000001ea0f25 _start (/home/jayfoad2/llvm-release/bin/llc+0x1ea0f25)
Segmentation fault (core dumped)

Can you fix or revert please?

I’m assuming this is what f42136d4d6e102659c6a4a870349aae6425a3ba9 fixed

foad added a comment.May 18 2023, 5:23 AM

This causes:

; RUN: llc -march=amdgcn -mcpu=gfx1030 < %s

define void @f() {
bb:
  call void @g()
  ret void
}

define void @g() alwaysinline {
bb:
  %i = call <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32> zeroinitializer, i32 0, i32 0)
  %i1 = bitcast <4 x i32> %i to <4 x float>
  %i2 = extractelement <4 x float> %i1, i64 0
  %i3 = fmul float %i2, 0.000000e+00
  %i4 = call float @llvm.maxnum.f32(float %i3, float 0.000000e+00)
  %i5 = call float @llvm.maxnum.f32(float %i4, float %i2)
  %i6 = fcmp olt float %i5, 0.000000e+00
  ret void
}

declare float @llvm.maxnum.f32(float, float)
declare <4 x i32> @llvm.amdgcn.s.buffer.load.v4i32(<4 x i32>, i32, i32 immarg)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /home/jayfoad2/llvm-release/bin/llc -march=amdgcn -mcpu=gfx1030
1.	Running pass 'Inliner for always_inline functions' on module '<stdin>'.
 #0 0x000000000338afc7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/jayfoad2/llvm-release/bin/llc+0x338afc7)
 #1 0x0000000003388e7e llvm::sys::RunSignalHandlers() (/home/jayfoad2/llvm-release/bin/llc+0x3388e7e)
 #2 0x000000000338b66a SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f1527842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000002b50cb4 llvm::AttributeList::getAttributeAtIndex(unsigned int, llvm::StringRef) const (/home/jayfoad2/llvm-release/bin/llc+0x2b50cb4)
 #5 0x0000000002c2e95d llvm::Function::getDenormalMode(llvm::fltSemantics const&) const (/home/jayfoad2/llvm-release/bin/llc+0x2c2e95d)
 #6 0x00000000024ebbda computeKnownFPClass(llvm::Value const*, llvm::APInt const&, llvm::FPClassTest, llvm::KnownFPClass&, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #7 0x00000000024ebf9e computeKnownFPClass(llvm::Value const*, llvm::KnownFPClass&, llvm::FPClassTest, unsigned int, (anonymous namespace)::Query const&, llvm::TargetLibraryInfo const*) ValueTracking.cpp:0:0
 #8 0x000000000250e8a8 cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int)::$_25::operator()(llvm::Value*) const ValueTracking.cpp:0:0
 #9 0x00000000024e94aa cannotBeOrderedLessThanZeroImpl(llvm::Value const*, llvm::DataLayout const&, llvm::TargetLibraryInfo const*, bool, unsigned int) ValueTracking.cpp:0:0
#10 0x0000000002389456 simplifyFCmpInst(unsigned int, llvm::Value*, llvm::Value*, llvm::FastMathFlags, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#11 0x0000000002390a43 simplifyInstructionWithOperands(llvm::Instruction*, llvm::ArrayRef<llvm::Value*>, llvm::SimplifyQuery const&, unsigned int) InstructionSimplify.cpp:0:0
#12 0x0000000002390fec llvm::simplifyInstruction(llvm::Instruction*, llvm::SimplifyQuery const&) (/home/jayfoad2/llvm-release/bin/llc+0x2390fec)
#13 0x00000000033cc8b8 (anonymous namespace)::PruningFunctionCloner::CloneBlock(llvm::BasicBlock const*, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, std::vector<llvm::BasicBlock const*, std::allocator<llvm::BasicBlock const*>>&) CloneFunction.cpp:0:0
#14 0x00000000033c90a2 llvm::CloneAndPruneIntoFromInst(llvm::Function*, llvm::Function const*, llvm::Instruction const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33c90a2)
#15 0x00000000033cdd02 llvm::CloneAndPruneFunctionInto(llvm::Function*, llvm::Function const*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, bool, llvm::SmallVectorImpl<llvm::ReturnInst*>&, char const*, llvm::ClonedCodeInfo*) (/home/jayfoad2/llvm-release/bin/llc+0x33cdd02)
#16 0x00000000033f8528 llvm::InlineFunction(llvm::CallBase&, llvm::InlineFunctionInfo&, bool, llvm::AAResults*, bool, llvm::Function*) (/home/jayfoad2/llvm-release/bin/llc+0x33f8528)
#17 0x000000000360c477 (anonymous namespace)::AlwaysInlineImpl(llvm::Module&, bool, llvm::ProfileSummaryInfo&, llvm::function_ref<llvm::AssumptionCache& (llvm::Function&)>, llvm::function_ref<llvm::AAResults& (llvm::Function&)>, llvm::function_ref<llvm::BlockFrequencyInfo& (llvm::Function&)>) AlwaysInliner.cpp:0:0
#18 0x000000000360d3f1 (anonymous namespace)::AlwaysInlinerLegacyPass::runOnModule(llvm::Module&) AlwaysInliner.cpp:0:0
#19 0x0000000002c8078c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/jayfoad2/llvm-release/bin/llc+0x2c8078c)
#20 0x0000000001ea64c9 main (/home/jayfoad2/llvm-release/bin/llc+0x1ea64c9)
#21 0x00007f1527829d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#22 0x00007f1527829e40 call_init ./csu/../csu/libc-start.c:128:20
#23 0x00007f1527829e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#24 0x0000000001ea0f25 _start (/home/jayfoad2/llvm-release/bin/llc+0x1ea0f25)
Segmentation fault (core dumped)

Can you fix or revert please?

I’m assuming this is what f42136d4d6e102659c6a4a870349aae6425a3ba9 fixed

No, it's still crashing after that fix.

Can you fix or revert please?

I’m assuming this is what f42136d4d6e102659c6a4a870349aae6425a3ba9 fixed

No, it's still crashing after that fix.

4130ccc8be9567bfd8673b2ab1bdcd4f1463af89 should catch this one