-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict floating point is incompatible with SPE #49729
Comments
As mentioned in llvm/llvm-bugzilla-archive#50070 , strictfp stuff around comparison on SPE is little bit messy. Disabling it looks fine if SPE doesn't need it. CC Justin for comments. |
I think disabling StrictFP for SPE is fine. I don't know enough about strictfp to say much. |
Has someone pushed the fix to disable StrictFP on SPE targets? If not, can you please do so Qiu and then we can mark the commit that includes the fix and mark this bug as a blocker for 12.0.1 to make sure we get it back ported. |
Merged: 6279fd1 |
*** Bug llvm/llvm-bugzilla-archive#51001 has been marked as a duplicate of this bug. *** |
mentioned in issue llvm/llvm-bugzilla-archive#51001 |
Extended Description
Enabling strict floating point support on PowerPC[1] caused a regression with SPE-enabled targets making them crash when compiling SPE-enabled code without the ability to avoid it. Example:
#define ZEROINFNAN (0x7ff-0x3ff-52-1)
struct num { unsigned long long m; int e; int sign; };
double func(double x, double y, double z)
{
#pragma STDC FENV_ACCESS ON
}
$ clang -o fma.o -c -target powerpc-gnu-linux-eabi -mspe fma.c
fatal error: error in backend: Cannot select: 0x7f8c58889e88: f64,ch = strict_fadd 0x7f8c3fd05968, 0x7f8c5888a1c8, 0x7f8c58889f58
0x7f8c5888a1c8: f64,ch = strict_fmul 0x7f8c3fd05968, 0x7f8c5888a0f8, 0x7f8c5888bc00
0x7f8c5888a0f8: f64,ch = load<(dereferenceable load 8 from %ir.5)> 0x7f8c3fd05968, FrameIndex:i32<1>, undef:i32
0x7f8c5888be08: i32 = FrameIndex<1>
0x7f8c5888bfa8: i32 = undef
0x7f8c5888bc00: f64,ch = load<(dereferenceable load 8 from %ir.6)> 0x7f8c3fd05968, FrameIndex:i32<2>, undef:i32
0x7f8c5888a028: i32 = FrameIndex<2>
0x7f8c5888bfa8: i32 = undef
0x7f8c58889f58: f64,ch = load<(dereferenceable load 8 from %ir.7)> 0x7f8c3fd05968, FrameIndex:i32<3>, undef:i32
0x7f8c5888bc68: i32 = FrameIndex<3>
0x7f8c5888bfa8: i32 = undef
In function: func
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: clang -o fma.o -c -target powerpc-gnu-linux-eabi -mspe fma.c
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var
LLVM_SYMBOLIZER_PATH
to point to it):0 clang 0x000000010cb986ba llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 43
1 clang 0x000000010cb981a7 llvm::sys::CleanupOnSignal(unsigned long) + 184
2 clang 0x000000010cb1ad59 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) + 97
3 clang 0x000000010cb1acf6 llvm::CrashRecoveryContext::HandleExit(int) + 14
4 clang 0x000000010cb95c7e llvm::sys::Process::Exit(int, bool) + 44
5 clang 0x000000010bb97632 std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_stringstd::nullptr_t(char const*) + 0
6 clang 0x000000010cb21088 llvm::report_fatal_error(llvm::Twine const&, bool) + 293
7 clang 0x000000010cb210bf llvm::report_fatal_error(llvm::StringRef, bool) + 0
8 clang 0x000000010d4b9af8 llvm::SelectionDAGISel::isOrEquivalentToAdd(llvm::SDNode const*) const + 0
9 clang 0x000000010d4b9294 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) + 12192
10 clang 0x000000010bf2ce92 (anonymous namespace)::PPCDAGToDAGISel::Select(llvm::SDNode*) + 20582
11 clang 0x000000010d4b38b5 llvm::SelectionDAGISel::DoInstructionSelection() + 341
12 clang 0x000000010d4b3154 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1500
13 clang 0x000000010d4b273b llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 3605
14 clang 0x000000010d4b1004 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1774
15 clang 0x000000010bf246f8 (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 58
16 clang 0x000000010c49680f llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 255
17 clang 0x000000010c6c59ba llvm::FPPassManager::runOnFunction(llvm::Function&) + 512
18 clang 0x000000010c6c936e llvm::FPPassManager::runOnModule(llvm::Module&) + 52
19 clang 0x000000010c6c5de1 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 649
20 clang 0x000000010cd38695 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_deletellvm::raw_pwrite_stream >) + 8829
21 clang 0x000000010cf42470 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 1080
22 clang 0x000000010dac2324 clang::ParseAST(clang::Sema&, bool, bool) + 543
23 clang 0x000000010d122ce7 clang::FrontendAction::Execute() + 75
24 clang 0x000000010d0dc880 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 1516
25 clang 0x000000010d17091d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1025
26 clang 0x000000010bb972fc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) + 1690
27 clang 0x000000010bb9642d ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) + 331
28 clang 0x000000010d00d37b void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, bool) const::$_1>(long) + 23
29 clang 0x000000010cb1acd6 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 226
30 clang 0x000000010d00cac2 clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optionalllvm::StringRef >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, bool) const + 230
31 clang 0x000000010cff061e clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const + 510
32 clang 0x000000010cff0727 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) const + 95
33 clang 0x000000010cffcd8f clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__1::pair<int, clang::driver::Command const*> >&) + 213
34 clang 0x000000010bb960ab main + 7314
35 libdyld.dylib 0x00007fff205b6f3d start + 1
clang-12: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 12.0.0
Target: powerpc-gnu-linux-eabi
Thread model: posix
InstalledDir: /opt/llvm/bin
clang-12: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-12: note: diagnostic msg: /var/folders/v8/mhvsdtrj3d97rmymc2218nl80000gn/T/fma-2bbb85.c
clang-12: note: diagnostic msg: /var/folders/v8/mhvsdtrj3d97rmymc2218nl80000gn/T/fma-2bbb85.sh
clang-12: note: diagnostic msg: Crash backtrace is located in
clang-12: note: diagnostic msg: /Users/user/Library/Logs/DiagnosticReports/clang-12__.crash
clang-12: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang-12: note: diagnostic msg:
For the time being this can be avoided by the following patch, which I suggest including in 12.0.1 to avoid the regression:
diff --git clang/lib/Basic/Targets/PPC.cpp clang/lib/Basic/Targets/PPC.cpp
index ff09c0fa2..17c1d1606 100644
--- clang/lib/Basic/Targets/PPC.cpp
+++ clang/lib/Basic/Targets/PPC.cpp
@@ -58,6 +58,7 @@ bool PPCTargetInfo::handleTargetFeatures(std::vectorstd::string &Features,
HasPCRelativeMemops = true;
} else if (Feature == "+spe" || Feature == "+efpu2") {
HasSPE = true;
[1] 8ecc852
The text was updated successfully, but these errors were encountered: