This is an archive of the discontinued LLVM Phabricator instance.

[LSR] Fix bug for optimizing unused IVs to final values
ClosedPublic

Authored by syzaara on May 19 2022, 10:03 AM.

Details

Summary

This is a fix for a crash reported for https://reviews.llvm.org/D118808
The fix is to only consider PHINodes which are induction phis.

Diff Detail

Event Timeline

syzaara created this revision.May 19 2022, 10:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 10:03 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
syzaara requested review of this revision.May 19 2022, 10:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2022, 10:03 AM
uabelho edited reviewers, added: Whitney; removed: uabelho.May 20 2022, 12:22 AM
uabelho added a subscriber: Whitney.

Thanks! I have confirmed this patch solves the crash I saw.

I don't feel confident reviewing this so adding @Whitney who reviewed the original patch.

Meinersbur requested changes to this revision.May 23 2022, 2:04 PM
Meinersbur added a subscriber: Meinersbur.
Meinersbur added inline comments.
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
5603–5604

Since this immediately returns true, no other non-induction phi is being considered. I.e. the test depends on the ordering of ExitBB->phis().

That's already a problem with the if (ExitPhi.getNumIncomingValues() != 1) break; test. Isn't here are more conceptional condition, such that all uses are recognized inductions by SCEV instead counting the number of uses?

5606
This revision now requires changes to proceed.May 23 2022, 2:04 PM
syzaara updated this revision to Diff 432317.May 26 2022, 9:55 AM

Shift handling into rewriteLoopExitValues so we can check each individual phi. Added a new entry to enum ReplaceExitVal called UnusedIndVar which will allow rewriteLoopExitValues to check for exit values that can be replaced when they are used as induction variables in the loop with no other uses in the loop.

I've verified that the updated fix also solves the problem I saw.
Thanks!

Meinersbur added inline comments.Jun 1 2022, 10:52 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
110

UnusedIndVar seems to subsume OnlyCheapRepl. If this not tautological (see comment below), consider reflecting that in the description. Suggestion: "Replace only unused induction variables and only when the cost is cheap".

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
5604–5606

I like deferring this to rewriteLoopExitValue itself. 👍

llvm/lib/Transforms/Utils/LoopUtils.cpp
1316

[style]

1329

[style] No Almost-Always-Auto

[suggestion] Instead of set-flag-and-break, you may also consider if (llvm::any_of(Inst->users(), [](User *U) {...})) continue;. Alternatively, you could move all the conditions into a separate function where you just return false; when a violating condition is found no matter what loops it is nested in.

1336

This tries to check the "instruction is induction-phi" and "instruction is induction-operator" cases at the same time. You already determined which of the two cases it is above. That the wrong case applies here. isInductionPHI does not necessarily depend on there being an BinaryOperator as it works on the normalized SCEV. I.e. there might not be a BinaryOperator at all and the condition just pass through.

Could we merge the the two for (auto &U : Inst->uses()) loops, determine which of the two cases it is, and then require exactly one PHINode or BinaryOperator use?

1414

Is this assuming that unused induction variables are always cheap?

syzaara updated this revision to Diff 433863.Jun 2 2022, 1:28 PM

Address review comments.

Verified that the current patch also solves the problem I saw.
Thanks!

@Meinersbur hi Michael, could you please take another look at the addressed review comments.

bjope added a subscriber: bjope.Jun 27 2022, 6:55 AM

We get the "Assertion `EVL->contains(L) && "LCSSA breach detected!"' failed." assertion failures more or less every day in fuzzy testing which is pretty annoying. Just saying that I'm looking forward to the solution, although this review seems to have get stuck a couple of weeks ago :-(

Unfortunately I do not know much about the code involved to help out reviewing (unless it only are stylistic things remaining).

This revision is now accepted and ready to land.Jun 29 2022, 7:27 AM
Meinersbur added inline comments.Jun 29 2022, 8:14 AM
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
113–114

Could you update this to indicate that it is "unused in the loop"/it is only used to compute the loop LCSSA exit value?

This revision was landed with ongoing or failed builds.Jul 5 2022, 9:31 AM
This revision was automatically updated to reflect the committed changes.
bjope added a comment.Jul 6 2022, 1:51 AM

Thanks! I've validated that our downstream tests that were hitting assertion failures related to this problem are passing again.

I bisected an assertion failure while building the Linux kernel for PowerPC to this patch:

# bad: [20962c1240691d25b21ce425313c81eed0b1b358] [SimplifyCFG] Don't split predecessors of callbr terminator
# good: [dc969061c68e62328607d68215ed8b9ef4a1e4b1] [SimplifyCFG] Thread all predecessors with same value at once
git bisect start '20962c1240691d25b21ce425313c81eed0b1b358' 'dc969061c68e62328607d68215ed8b9ef4a1e4b1'
# bad: [a6e63e35ede4b9f23b58437263eaac9a2926c9bf] [NFC][HLSL] Add tests for vector alias. Remove dead code.
git bisect bad a6e63e35ede4b9f23b58437263eaac9a2926c9bf
# good: [5493f8fc59ca9cc6fc14da8e6aafe6a52fb9ebc0] [VectorCombine] Improve shuffle select shuffle-of-shuffles
git bisect good 5493f8fc59ca9cc6fc14da8e6aafe6a52fb9ebc0
# bad: [b170d856a3a303ab826f6896812bfd0ce05ec706] [SimplifyCFG] Skip hoisting common instructions that return token type
git bisect bad b170d856a3a303ab826f6896812bfd0ce05ec706
# bad: [7b1ff859feaaf1316932d0be113d762626009fd6] [gn build] Port b8dbc6ffea93
git bisect bad 7b1ff859feaaf1316932d0be113d762626009fd6
# good: [a2158374ba1a6f81f4cce3eb54d0bc44f3ab75e0] [mlir][LLVMIR] Apply CallOp/CallableInterface on suitable operations
git bisect good a2158374ba1a6f81f4cce3eb54d0bc44f3ab75e0
# bad: [dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e] [LSR] Fix bug for optimizing unused IVs to final values
git bisect bad dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e
# good: [b8dbc6ffea93976dc0d8569c9d23e9c21e33e317] [HLSL] Add ExternalSemaSource & vector alias
git bisect good b8dbc6ffea93976dc0d8569c9d23e9c21e33e317
# first bad commit: [dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e] [LSR] Fix bug for optimizing unused IVs to final values

A simplified C reproducer:

enum { true } typedef size_t;
struct kernfs_node {
  struct kernfs_node *parent;
} kernfs_path_from_node_locked_kn_to;
size_t kernfs_path_from_node_locked___trans_tmp_1;
void kernfs_path_from_node() {
  asm goto("" : : : : __label_warn_on);
__label_warn_on:;
  struct kernfs_node *to = &kernfs_path_from_node_locked_kn_to;
  size_t depth;
  while (to) {
    depth++;
    to = to->parent;
  }
  kernfs_path_from_node_locked___trans_tmp_1 = depth;
}
$ clang --target=powerpc64-linux-gnu -O2 -c -o /dev/null dir.i
clang: /home/nathan/cbl/src/llvm-project/llvm/include/llvm/IR/Instructions.h:2838: llvm::Value *llvm::PHINode::getIncomingValueForBlock(const llvm::BasicBlock *) const: Assertion `Idx >= 0 && "Invalid basic block argument!"' failed.
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=powerpc64-linux-gnu -O2 -c -o /dev/null dir.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'dir.i'.
4.      Running pass 'Loop Pass Manager' on function '@kernfs_path_from_node'
5.      Running pass 'Loop Strength Reduction' on basic block '%while.body'
 #0 0x000055926ab23473 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3445473)
 #1 0x000055926ab2140e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x344340e)
 #2 0x000055926aaa7893 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x000055926aaa7a0e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007fbd976d8b90 __restore_rt (/lib64/libc.so.6+0x38b90)
 #5 0x00007fbd97728c4c __pthread_kill_implementation (/lib64/libc.so.6+0x88c4c)
 #6 0x00007fbd976d8ae6 gsignal (/lib64/libc.so.6+0x38ae6)
 #7 0x00007fbd976c27f4 abort (/lib64/libc.so.6+0x227f4)
 #8 0x00007fbd976c271b _nl_load_domain.cold (/lib64/libc.so.6+0x2271b)
 #9 0x00007fbd976d1696 (/lib64/libc.so.6+0x31696)
#10 0x0000559269ca1c1d llvm::InductionDescriptor::isInductionPHI(llvm::PHINode*, llvm::Loop const*, llvm::ScalarEvolution*, llvm::InductionDescriptor&, llvm::SCEV const*, llvm::SmallVectorImpl<llvm::Instruction*>*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x25c3c1d)
#11 0x000055926abe97dc llvm::rewriteLoopExitValues(llvm::Loop*, llvm::LoopInfo*, llvm::TargetLibraryInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const*, llvm::SCEVExpander&, llvm::DominatorTree*, llvm::ReplaceExitVal, llvm::SmallVector<llvm::WeakTrackingVH, 16u>&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x350b7dc)
#12 0x000055926a96f3d8 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::MemorySSA*) LoopStrengthReduce.cpp:0:0
#13 0x000055926a99d154 (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&) LoopStrengthReduce.cpp:0:0
#14 0x0000559269efcaeb llvm::LPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x281eaeb)
#15 0x000055926a3a7197 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cc9197)
#16 0x000055926a3aec41 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cd0c41)
#17 0x000055926a3a7ba5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cc9ba5)
#18 0x000055926b332f5d 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/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3c54f5d)
#19 0x000055926b6eafde clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#20 0x000055926bfbafc4 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x48dcfc4)
#21 0x000055926b62d8f0 clang::FrontendAction::Execute() (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3f4f8f0)
#22 0x000055926b5a1f5f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3ec3f5f)
#23 0x000055926b6e4682 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x4006682)
#24 0x00005592696f6f4a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2018f4a)
#25 0x00005592696f4cdf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#26 0x000055926b423572 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
#27 0x000055926aaa77a7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x33c97a7)
#28 0x000055926b4230cf 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/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d450cf)
#29 0x000055926b3e2dde clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d04dde)
#30 0x000055926b3e308e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d0508e)
#31 0x000055926b3ff030 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d21030)
#32 0x00005592696f43a1 clang_main(int, char**) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x20163a1)
#33 0x00007fbd976c3550 __libc_start_call_main (/lib64/libc.so.6+0x23550)
#34 0x00007fbd976c3609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x23609)
#35 0x00005592696f1945 _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 dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e)
Target: powerpc64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

At the parent commit, there is no crash.

I bisected an assertion failure while building the Linux kernel for PowerPC to this patch:

# bad: [20962c1240691d25b21ce425313c81eed0b1b358] [SimplifyCFG] Don't split predecessors of callbr terminator
# good: [dc969061c68e62328607d68215ed8b9ef4a1e4b1] [SimplifyCFG] Thread all predecessors with same value at once
git bisect start '20962c1240691d25b21ce425313c81eed0b1b358' 'dc969061c68e62328607d68215ed8b9ef4a1e4b1'
# bad: [a6e63e35ede4b9f23b58437263eaac9a2926c9bf] [NFC][HLSL] Add tests for vector alias. Remove dead code.
git bisect bad a6e63e35ede4b9f23b58437263eaac9a2926c9bf
# good: [5493f8fc59ca9cc6fc14da8e6aafe6a52fb9ebc0] [VectorCombine] Improve shuffle select shuffle-of-shuffles
git bisect good 5493f8fc59ca9cc6fc14da8e6aafe6a52fb9ebc0
# bad: [b170d856a3a303ab826f6896812bfd0ce05ec706] [SimplifyCFG] Skip hoisting common instructions that return token type
git bisect bad b170d856a3a303ab826f6896812bfd0ce05ec706
# bad: [7b1ff859feaaf1316932d0be113d762626009fd6] [gn build] Port b8dbc6ffea93
git bisect bad 7b1ff859feaaf1316932d0be113d762626009fd6
# good: [a2158374ba1a6f81f4cce3eb54d0bc44f3ab75e0] [mlir][LLVMIR] Apply CallOp/CallableInterface on suitable operations
git bisect good a2158374ba1a6f81f4cce3eb54d0bc44f3ab75e0
# bad: [dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e] [LSR] Fix bug for optimizing unused IVs to final values
git bisect bad dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e
# good: [b8dbc6ffea93976dc0d8569c9d23e9c21e33e317] [HLSL] Add ExternalSemaSource & vector alias
git bisect good b8dbc6ffea93976dc0d8569c9d23e9c21e33e317
# first bad commit: [dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e] [LSR] Fix bug for optimizing unused IVs to final values

A simplified C reproducer:

enum { true } typedef size_t;
struct kernfs_node {
  struct kernfs_node *parent;
} kernfs_path_from_node_locked_kn_to;
size_t kernfs_path_from_node_locked___trans_tmp_1;
void kernfs_path_from_node() {
  asm goto("" : : : : __label_warn_on);
__label_warn_on:;
  struct kernfs_node *to = &kernfs_path_from_node_locked_kn_to;
  size_t depth;
  while (to) {
    depth++;
    to = to->parent;
  }
  kernfs_path_from_node_locked___trans_tmp_1 = depth;
}
$ clang --target=powerpc64-linux-gnu -O2 -c -o /dev/null dir.i
clang: /home/nathan/cbl/src/llvm-project/llvm/include/llvm/IR/Instructions.h:2838: llvm::Value *llvm::PHINode::getIncomingValueForBlock(const llvm::BasicBlock *) const: Assertion `Idx >= 0 && "Invalid basic block argument!"' failed.
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=powerpc64-linux-gnu -O2 -c -o /dev/null dir.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'dir.i'.
4.      Running pass 'Loop Pass Manager' on function '@kernfs_path_from_node'
5.      Running pass 'Loop Strength Reduction' on basic block '%while.body'
 #0 0x000055926ab23473 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3445473)
 #1 0x000055926ab2140e llvm::sys::RunSignalHandlers() (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x344340e)
 #2 0x000055926aaa7893 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x000055926aaa7a0e CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #4 0x00007fbd976d8b90 __restore_rt (/lib64/libc.so.6+0x38b90)
 #5 0x00007fbd97728c4c __pthread_kill_implementation (/lib64/libc.so.6+0x88c4c)
 #6 0x00007fbd976d8ae6 gsignal (/lib64/libc.so.6+0x38ae6)
 #7 0x00007fbd976c27f4 abort (/lib64/libc.so.6+0x227f4)
 #8 0x00007fbd976c271b _nl_load_domain.cold (/lib64/libc.so.6+0x2271b)
 #9 0x00007fbd976d1696 (/lib64/libc.so.6+0x31696)
#10 0x0000559269ca1c1d llvm::InductionDescriptor::isInductionPHI(llvm::PHINode*, llvm::Loop const*, llvm::ScalarEvolution*, llvm::InductionDescriptor&, llvm::SCEV const*, llvm::SmallVectorImpl<llvm::Instruction*>*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x25c3c1d)
#11 0x000055926abe97dc llvm::rewriteLoopExitValues(llvm::Loop*, llvm::LoopInfo*, llvm::TargetLibraryInfo*, llvm::ScalarEvolution*, llvm::TargetTransformInfo const*, llvm::SCEVExpander&, llvm::DominatorTree*, llvm::ReplaceExitVal, llvm::SmallVector<llvm::WeakTrackingVH, 16u>&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x350b7dc)
#12 0x000055926a96f3d8 ReduceLoopStrength(llvm::Loop*, llvm::IVUsers&, llvm::ScalarEvolution&, llvm::DominatorTree&, llvm::LoopInfo&, llvm::TargetTransformInfo const&, llvm::AssumptionCache&, llvm::TargetLibraryInfo&, llvm::MemorySSA*) LoopStrengthReduce.cpp:0:0
#13 0x000055926a99d154 (anonymous namespace)::LoopStrengthReduce::runOnLoop(llvm::Loop*, llvm::LPPassManager&) LoopStrengthReduce.cpp:0:0
#14 0x0000559269efcaeb llvm::LPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x281eaeb)
#15 0x000055926a3a7197 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cc9197)
#16 0x000055926a3aec41 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cd0c41)
#17 0x000055926a3a7ba5 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2cc9ba5)
#18 0x000055926b332f5d 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/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3c54f5d)
#19 0x000055926b6eafde clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#20 0x000055926bfbafc4 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x48dcfc4)
#21 0x000055926b62d8f0 clang::FrontendAction::Execute() (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3f4f8f0)
#22 0x000055926b5a1f5f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3ec3f5f)
#23 0x000055926b6e4682 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x4006682)
#24 0x00005592696f6f4a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x2018f4a)
#25 0x00005592696f4cdf ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#26 0x000055926b423572 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
#27 0x000055926aaa77a7 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x33c97a7)
#28 0x000055926b4230cf 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/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d450cf)
#29 0x000055926b3e2dde clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d04dde)
#30 0x000055926b3e308e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d0508e)
#31 0x000055926b3ff030 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x3d21030)
#32 0x00005592696f43a1 clang_main(int, char**) (/home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin/clang-15+0x20163a1)
#33 0x00007fbd976c3550 __libc_start_call_main (/lib64/libc.so.6+0x23550)
#34 0x00007fbd976c3609 __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x23609)
#35 0x00005592696f1945 _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 dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e)
Target: powerpc64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/nathan/tmp/install/llvm/dbf6ab5ef9ae0e1f4706917c2b3f98a67c35826e/bin
clang-15: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

At the parent commit, there is no crash.

Thank you for the reproducer! Posted fix in https://reviews.llvm.org/D129297