Only mrs & msr can access the NZCV flags register, so don't try to create any instructions spilling it.
Bit of an ugly test-case I'm afraid, so I decided the best way to limit scope for things to change and invalidate it was going the MIR route.
| Paths 
 |  Differential  D128513  
AArch64: don't try to fold NZCV spill into an operation AbandonedPublic Authored by t.p.northover on Jun 24 2022, 3:38 AM. 
Details 
 Summary Only mrs & msr can access the NZCV flags register, so don't try to create any instructions spilling it. Bit of an ugly test-case I'm afraid, so I decided the best way to limit scope for things to change and invalidate it was going the MIR route. 
Diff Detail 
Unit TestsFailed Event TimelineComment Actions Is this related with https://reviews.llvm.org/D127294? Can the NZCV check be pulled out before the if (MI.isFullCopy()) block? 
Revision Contents 
 
Diff 439693 llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
 
 llvm/test/CodeGen/AArch64/nospill-nzcv.mir
 
 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||