From e2ef9203a9515e5e4a7dddccfc6cc7abfddbc076 Mon Sep 17 00:00:00 2001 From: Nemanja Ivanovic Date: Fri, 15 Dec 2017 11:47:48 +0000 Subject: [PATCH] Fix code causing fallthrough warnings in the PPC back end. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320806 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 1 + lib/Target/PowerPC/PPCISelLowering.cpp | 1 + lib/Target/PowerPC/PPCInstrInfo.cpp | 1 + lib/Target/PowerPC/PPCMIPeephole.cpp | 5 ++++- 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp index cf5c3e8b5c6..5e7a9335968 100644 --- a/lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ b/lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -2224,6 +2224,7 @@ public: if (CmpInGPR == ICGPR_Sext || CmpInGPR == ICGPR_SextI32 || CmpInGPR == ICGPR_SextI64) return nullptr; + LLVM_FALLTHROUGH; case ISD::SIGN_EXTEND: if (CmpInGPR == ICGPR_Zext || CmpInGPR == ICGPR_ZextI32 || CmpInGPR == ICGPR_ZextI64) diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index 5c8ef7f1730..ac864baffd6 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -13045,6 +13045,7 @@ PPCTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI, return std::make_pair(0U, &PPC::QSRCRegClass); if (Subtarget.hasAltivec()) return std::make_pair(0U, &PPC::VRRCRegClass); + break; case 'y': // crrc return std::make_pair(0U, &PPC::CRRCRegClass); } diff --git a/lib/Target/PowerPC/PPCInstrInfo.cpp b/lib/Target/PowerPC/PPCInstrInfo.cpp index e047179586e..879bb4c797e 100644 --- a/lib/Target/PowerPC/PPCInstrInfo.cpp +++ b/lib/Target/PowerPC/PPCInstrInfo.cpp @@ -2415,6 +2415,7 @@ bool PPCInstrInfo::convertToImmediateForm(MachineInstr &MI, NewImm = Addend + SExtImm; break; } + return false; } case PPC::RLDICL: case PPC::RLDICLo: diff --git a/lib/Target/PowerPC/PPCMIPeephole.cpp b/lib/Target/PowerPC/PPCMIPeephole.cpp index 45647a2c36b..64c5e4ebb87 100644 --- a/lib/Target/PowerPC/PPCMIPeephole.cpp +++ b/lib/Target/PowerPC/PPCMIPeephole.cpp @@ -774,7 +774,7 @@ bool PPCMIPeephole::simplifyCode(void) { // Eliminate all the TOC save instructions which are redundant. Simplified |= eliminateRedundantTOCSaves(TOCSaves); // We try to eliminate redundant compare instruction. - //Simplified |= eliminateRedundantCompare(); + Simplified |= eliminateRedundantCompare(); return Simplified; } @@ -1025,6 +1025,9 @@ bool PPCMIPeephole::eliminateRedundantTOCSaves( // bge 0, .LBB0_4 bool PPCMIPeephole::eliminateRedundantCompare(void) { + // FIXME: this transformation is causing miscompiles. Disabling it for now + // until we can resolve the issue. + return false; bool Simplified = false; for (MachineBasicBlock &MBB2 : *MF) { -- 2.11.0