[PATCH] D19255: [ppc64] fix bug in prologue that mfocrf's cr operand should be explict state instead of implicit

Chuang-Yu Cheng via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 01:36:51 PDT 2016


cycheng added a comment.

In http://reviews.llvm.org/D19255#411042, @mgrang wrote:

> Can you also add the testcase mentioned in the bug as a unit test?


Sure, I will add "-verify-machineinstrs" in test/CodeGen/PowerPC/crsave.ll, the option can catch this issue (I've tested)


================
Comment at: lib/Target/PowerPC/PPCFrameLowering.cpp:846
@@ -845,2 +845,3 @@
     unsigned MfcrOpcode = PPC::MFCR8;
-    if (isELFv2ABI && MustSaveCRs.size() == 1)
+    unsigned CrState = RegState::ImplicitKill;
+    if (isELFv2ABI && MustSaveCRs.size() == 1) {
----------------
kbarton wrote:
> Why does this need to be put into a variable? I only see it used once below - can you not just put RegState::ImplicitKill directly in the MIB.addReg call below?
Do you mean:


```
MIB.addReg(MustSaveCRs[i], MfcrOpcode == PPC::MFCR8 ? RegState::ImplicitKill : RegState::Kill);
```


http://reviews.llvm.org/D19255





More information about the llvm-commits mailing list