This patch adds the handling of clobbers of the link register LR for inline
assembly.
This patch is to fix:
https://bugs.llvm.org/show_bug.cgi?id=50147
Differential D101657
[PowerPC] Handle inline assembly clobber of link regsiter stefanp on Apr 30 2021, 12:16 PM. Authored by
Details
This patch adds the handling of clobbers of the link register LR for inline This patch is to fix:
Diff Detail
Event TimelineComment Actions I added this commit on top of a45fd436aef4d5712da99f8292f5d0b16794892c, built a master branch Linux kernel from ppc44x_defconfig, and booted in under QEMU 5.0.1 without any issues as before. Thanks for the quick fix! Comment Actions You probably also want the following testcase: define void @UseLR() { tail call void asm sideeffect "", "{lr}"(i32 1) ret void } Comment Actions I looked into doing this but PowerPC does not have enough support for special registers (like lr) for us to be able to do this test correctly. The backend does not recognize the copy of the value 1 to the LR register and it does not know how to correctly spill special registers. This is on our TODO list and we will address these issues in a separate patch. Also, at this point, the clang frontend does not recognize the lr register as a valid input register anyway. (This work is also on our TODO list.) The plan is to address both of these deficiencies in future patches. Basically, if we try this example from C source we get: $ cat useLR.c void foo() { asm("" : : "l"(1)); } $ clang -O2 -S useLR.c clang: /data/stefanp/Wyvern/main/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:8657: void llvm::SelectionDAGBuilder::visitInlineAsm(const llvm::CallBase &): Assertion `(OpInfo.ConstraintType == TargetLowering::C_RegisterClass || OpInfo.ConstraintType == TargetLowering::C_Register) && "Unknown constraint type!"' failed. PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. We will add this test when we add more support for special regsiters on PowerPC. Comment Actions Is there anything we can do to help get this merged? It would be nice to have this fixed in LLVM 12.0.1, which is going to have its first release candidate soon. Comment Actions LGTM other than the allocatable nit. Let's go with this fix for now to unblock the kernel build and we'll follow-up with a more complete fix for other reserved registers later.
|
Should these have the let isAllocatable = 0 as well? Seems like they should.