This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Implement XL compat __fnabs and __fnabss builtins.
ClosedPublic

Authored by amyk on May 12 2022, 4:07 PM.

Details

Summary

This patch implements the following floating point negative absolute value
builtins that required for compatibility with the XL compiler:

double __fnabs(double);
float __fnabss(float);

These builtins will emit :

  • fnabs on PWR6 and below, or if VSX is disabled.
  • xsnabsdp on PWR7 and above, if VSX is enabled.

Diff Detail

Event Timeline

amyk created this revision.May 12 2022, 4:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2022, 4:08 PM
amyk requested review of this revision.May 12 2022, 4:08 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2022, 4:08 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
amyk edited the summary of this revision. (Show Details)May 12 2022, 4:14 PM
lei accepted this revision.May 17 2022, 11:56 AM

LGTM with minor updates before commit.

clang/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.c
26

Since we emit xsnabsdp for pwr7 and above I don't think it's necessary to have all combination tested on both pwr7 and pwr8.

llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll
25

I think the default pwr level is lower then pwr6 which means it's no vsx by default. Maybe add pwr[7|8] to these test lines to test the -vsx attr?

46

probably don't need both NOVSX and PWR6 checks since they are the same.

This revision is now accepted and ready to land.May 17 2022, 11:56 AM
amyk updated this revision to Diff 430249.May 18 2022, 6:58 AM

Address review comments:

  • Remove -no-opaque-pointers and updates CHECKs
  • Simplify runs and checks of C and IR test files
amyk marked 3 inline comments as done.May 18 2022, 7:05 AM
lei added inline comments.May 18 2022, 7:38 AM
llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll
47

nit: same as before no need to test all combination for both pwr7 and pwr8. Just a mix of the 2 like in the clang test. What happens if we do pwr6 with +vsx? Is this a possible combination?

amyk added inline comments.May 19 2022, 7:22 AM
llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-fnabs.ll
47

Thanks Lei, I'll update those lines. We also discussed outside of this review that adding a P6 and VSX line results in xsnabsdp and it wouldn't hurt to add it here too, so I'll add one line for that, as well.

amyk updated this revision to Diff 430671.May 19 2022, 7:25 AM
  • Add a P6+VSX run line and remove extra P7/P8 lines for backend test
This revision was landed with ongoing or failed builds.May 19 2022, 9:29 AM
This revision was automatically updated to reflect the committed changes.

I bisected a crash when compiling the Linux kernel to this change.

A reduced C reproducer:

enum {
  OP_CB_GETATTR = 3,
  OP_CB_RECALL,
  OP_CB_RECALL_ANY = 8,
  OP_CB_RECALL_SLOT = 10,
  OP_CB_NOTIFY_LOCK = 13,
  OP_CB_NOTIFY_DEVICEID,
  OP_CB_OFFLOAD
} static callback_ops_0;
int preprocess_nfs42_op_op_nr, preprocess_nfs42_op_op;
void preprocess_nfs42_op() {
  switch (preprocess_nfs42_op_op_nr)
  case OP_CB_GETATTR:
  case OP_CB_RECALL:
  case OP_CB_RECALL_ANY:
  case OP_CB_RECALL_SLOT:
  case OP_CB_NOTIFY_DEVICEID:
  case OP_CB_NOTIFY_LOCK:
    preprocess_nfs42_op_op = preprocess_nfs42_op_op_nr;
  if (preprocess_nfs42_op_op_nr == OP_CB_OFFLOAD)
    preprocess_nfs42_op_op = callback_ops_0;
}
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project 559b8fc17ef6f5a65ccf9a11fce5f91c0a011b00)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
Impossible reg-to-reg copy
UNREACHABLE executed at /home/nathan/cbl/src/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1861!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'callback_xdr.i'.
4.      Running pass 'Post-RA pseudo instruction expansion pass' on function '@preprocess_nfs42_op'
 #0 0x000055a3bcb4e583 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3351583)
 #1 0x000055a3bcb4c50e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x334f50e)
 #2 0x000055a3bcad2923 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x000055a3bcad2a9e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007f4af3152b00 __restore_rt (/lib64/libc.so.6+0x3eb00)
 #5 0x00007f4af31a2d0c __pthread_kill_implementation (/lib64/libc.so.6+0x8ed0c)
 #6 0x00007f4af3152a56 gsignal (/lib64/libc.so.6+0x3ea56)
 #7 0x00007f4af313c7f4 abort (/lib64/libc.so.6+0x287f4)
 #8 0x000055a3bcad787f (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32da87f)
 #9 0x000055a3bb83b308 llvm::PPCInstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool) const PPCInstrInfo.cpp:0:0
#10 0x000055a3bc1242bb (anonymous namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&) ExpandPostRAPseudos.cpp:0:0
#11 0x000055a3bbf62d4d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2765d4d)
#12 0x000055a3bc3fc107 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bff107)
#13 0x000055a3bc403b81 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2c06b81)
#14 0x000055a3bc3fcafc llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bffafc)
#15 0x000055a3bd2fd16d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3b0016d)
#16 0x000055a3bd6a27ee clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#17 0x000055a3bdf46cb4 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x4749cb4)
#18 0x000055a3bd5f0f50 clang::FrontendAction::Execute() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3df3f50)
#19 0x000055a3bd565d1f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3d68d1f)
#20 0x000055a3bd69be92 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3e9ee92)
#21 0x000055a3bb785028 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f88028)
#22 0x000055a3bb782f2f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#23 0x000055a3bd3ea372 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#24 0x000055a3bcad2837 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32d5837)
#25 0x000055a3bd3e9ecf clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bececf)
#26 0x000055a3bd3aaa68 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bada68)
#27 0x000055a3bd3aad37 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3badd37)
#28 0x000055a3bd3c5658 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bc8658)
#29 0x000055a3bb7828a2 main (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f858a2)
#30 0x00007f4af313d550 __libc_start_call_main (/lib64/libc.so.6+0x29550)
#31 0x00007f4af313d609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29609)
#32 0x000055a3bb77fe85 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-15: error: clang frontend command failed with exit code 134 (use -v to see invocation)
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/build/llvm-bisect/stage1/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
amyk added a comment.May 24 2022, 6:40 AM

I bisected a crash when compiling the Linux kernel to this change.

A reduced C reproducer:

enum {
  OP_CB_GETATTR = 3,
  OP_CB_RECALL,
  OP_CB_RECALL_ANY = 8,
  OP_CB_RECALL_SLOT = 10,
  OP_CB_NOTIFY_LOCK = 13,
  OP_CB_NOTIFY_DEVICEID,
  OP_CB_OFFLOAD
} static callback_ops_0;
int preprocess_nfs42_op_op_nr, preprocess_nfs42_op_op;
void preprocess_nfs42_op() {
  switch (preprocess_nfs42_op_op_nr)
  case OP_CB_GETATTR:
  case OP_CB_RECALL:
  case OP_CB_RECALL_ANY:
  case OP_CB_RECALL_SLOT:
  case OP_CB_NOTIFY_DEVICEID:
  case OP_CB_NOTIFY_LOCK:
    preprocess_nfs42_op_op = preprocess_nfs42_op_op_nr;
  if (preprocess_nfs42_op_op_nr == OP_CB_OFFLOAD)
    preprocess_nfs42_op_op = callback_ops_0;
}
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project 559b8fc17ef6f5a65ccf9a11fce5f91c0a011b00)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
Impossible reg-to-reg copy
UNREACHABLE executed at /home/nathan/cbl/src/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1861!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'callback_xdr.i'.
4.      Running pass 'Post-RA pseudo instruction expansion pass' on function '@preprocess_nfs42_op'
 #0 0x000055a3bcb4e583 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3351583)
 #1 0x000055a3bcb4c50e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x334f50e)
 #2 0x000055a3bcad2923 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x000055a3bcad2a9e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007f4af3152b00 __restore_rt (/lib64/libc.so.6+0x3eb00)
 #5 0x00007f4af31a2d0c __pthread_kill_implementation (/lib64/libc.so.6+0x8ed0c)
 #6 0x00007f4af3152a56 gsignal (/lib64/libc.so.6+0x3ea56)
 #7 0x00007f4af313c7f4 abort (/lib64/libc.so.6+0x287f4)
 #8 0x000055a3bcad787f (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32da87f)
 #9 0x000055a3bb83b308 llvm::PPCInstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool) const PPCInstrInfo.cpp:0:0
#10 0x000055a3bc1242bb (anonymous namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&) ExpandPostRAPseudos.cpp:0:0
#11 0x000055a3bbf62d4d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2765d4d)
#12 0x000055a3bc3fc107 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bff107)
#13 0x000055a3bc403b81 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2c06b81)
#14 0x000055a3bc3fcafc llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bffafc)
#15 0x000055a3bd2fd16d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3b0016d)
#16 0x000055a3bd6a27ee clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#17 0x000055a3bdf46cb4 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x4749cb4)
#18 0x000055a3bd5f0f50 clang::FrontendAction::Execute() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3df3f50)
#19 0x000055a3bd565d1f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3d68d1f)
#20 0x000055a3bd69be92 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3e9ee92)
#21 0x000055a3bb785028 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f88028)
#22 0x000055a3bb782f2f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#23 0x000055a3bd3ea372 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#24 0x000055a3bcad2837 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32d5837)
#25 0x000055a3bd3e9ecf clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bececf)
#26 0x000055a3bd3aaa68 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bada68)
#27 0x000055a3bd3aad37 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3badd37)
#28 0x000055a3bd3c5658 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bc8658)
#29 0x000055a3bb7828a2 main (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f858a2)
#30 0x00007f4af313d550 __libc_start_call_main (/lib64/libc.so.6+0x29550)
#31 0x00007f4af313d609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29609)
#32 0x000055a3bb77fe85 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-15: error: clang frontend command failed with exit code 134 (use -v to see invocation)
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/build/llvm-bisect/stage1/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

Thanks for reporting this issue, @nathanchance. Sorry for the delayed response. Just wanted to say that I've seen your response now and I will be investigating this.

amyk added a comment.May 24 2022, 2:34 PM

I bisected a crash when compiling the Linux kernel to this change.

A reduced C reproducer:

enum {
  OP_CB_GETATTR = 3,
  OP_CB_RECALL,
  OP_CB_RECALL_ANY = 8,
  OP_CB_RECALL_SLOT = 10,
  OP_CB_NOTIFY_LOCK = 13,
  OP_CB_NOTIFY_DEVICEID,
  OP_CB_OFFLOAD
} static callback_ops_0;
int preprocess_nfs42_op_op_nr, preprocess_nfs42_op_op;
void preprocess_nfs42_op() {
  switch (preprocess_nfs42_op_op_nr)
  case OP_CB_GETATTR:
  case OP_CB_RECALL:
  case OP_CB_RECALL_ANY:
  case OP_CB_RECALL_SLOT:
  case OP_CB_NOTIFY_DEVICEID:
  case OP_CB_NOTIFY_LOCK:
    preprocess_nfs42_op_op = preprocess_nfs42_op_op_nr;
  if (preprocess_nfs42_op_op_nr == OP_CB_OFFLOAD)
    preprocess_nfs42_op_op = callback_ops_0;
}
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project 559b8fc17ef6f5a65ccf9a11fce5f91c0a011b00)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
$ clang --version | head -1
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)

$ clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
Impossible reg-to-reg copy
UNREACHABLE executed at /home/nathan/cbl/src/llvm-project/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp:1861!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang --target=powerpc64le-linux-gnu -O2 -Wall -Wextra -c -o /dev/null callback_xdr.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'callback_xdr.i'.
4.      Running pass 'Post-RA pseudo instruction expansion pass' on function '@preprocess_nfs42_op'
 #0 0x000055a3bcb4e583 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3351583)
 #1 0x000055a3bcb4c50e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x334f50e)
 #2 0x000055a3bcad2923 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x000055a3bcad2a9e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007f4af3152b00 __restore_rt (/lib64/libc.so.6+0x3eb00)
 #5 0x00007f4af31a2d0c __pthread_kill_implementation (/lib64/libc.so.6+0x8ed0c)
 #6 0x00007f4af3152a56 gsignal (/lib64/libc.so.6+0x3ea56)
 #7 0x00007f4af313c7f4 abort (/lib64/libc.so.6+0x287f4)
 #8 0x000055a3bcad787f (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32da87f)
 #9 0x000055a3bb83b308 llvm::PPCInstrInfo::copyPhysReg(llvm::MachineBasicBlock&, llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>, llvm::DebugLoc const&, llvm::MCRegister, llvm::MCRegister, bool) const PPCInstrInfo.cpp:0:0
#10 0x000055a3bc1242bb (anonymous namespace)::ExpandPostRA::runOnMachineFunction(llvm::MachineFunction&) ExpandPostRAPseudos.cpp:0:0
#11 0x000055a3bbf62d4d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2765d4d)
#12 0x000055a3bc3fc107 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bff107)
#13 0x000055a3bc403b81 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2c06b81)
#14 0x000055a3bc3fcafc llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x2bffafc)
#15 0x000055a3bd2fd16d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3b0016d)
#16 0x000055a3bd6a27ee clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#17 0x000055a3bdf46cb4 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x4749cb4)
#18 0x000055a3bd5f0f50 clang::FrontendAction::Execute() (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3df3f50)
#19 0x000055a3bd565d1f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3d68d1f)
#20 0x000055a3bd69be92 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3e9ee92)
#21 0x000055a3bb785028 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f88028)
#22 0x000055a3bb782f2f ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#23 0x000055a3bd3ea372 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#24 0x000055a3bcad2837 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x32d5837)
#25 0x000055a3bd3e9ecf clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bececf)
#26 0x000055a3bd3aaa68 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bada68)
#27 0x000055a3bd3aad37 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) const (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3badd37)
#28 0x000055a3bd3c5658 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x3bc8658)
#29 0x000055a3bb7828a2 main (/home/nathan/tmp/build/llvm-bisect/stage1/bin/clang-15+0x1f858a2)
#30 0x00007f4af313d550 __libc_start_call_main (/lib64/libc.so.6+0x29550)
#31 0x00007f4af313d609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x29609)
#32 0x000055a3bb77fe85 _start /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:117:0
clang-15: error: clang frontend command failed with exit code 134 (use -v to see invocation)
ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project c35ca3a1c78f693b749ad11742350b7fc6c5cd89)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/build/llvm-bisect/stage1/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

Hi @nathanchance, I just wanted to say thanks for providing the reproducer and I wanted to update you that I committed 0bf3c38b0be3f9b45b589b780ed53f2de4d364d4 that should resolve the issue that you reported.

@amyk Thank you a lot for the fix! I'll pull it down and verify everything is fixed tonight.