From 81cf150b5d3fa565eb661ba6878a8b0c32d2e048 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Sun, 12 Dec 2004 06:22:30 +0000 Subject: [PATCH] Add (currently disabled) code for canFoldSetCC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18820 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Sparc/SparcV8ISelSimple.cpp | 10 ++++++++++ lib/Target/SparcV8/SparcV8ISelSimple.cpp | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp index 68bc28a0f32..c93ced515ed 100644 --- a/lib/Target/Sparc/SparcV8ISelSimple.cpp +++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp @@ -1016,6 +1016,16 @@ static inline BasicBlock *getBlockAfter(BasicBlock *BB) { /// static SetCondInst *canFoldSetCCIntoBranch(Value *V) { return 0; // disable. + if (SetCondInst *SCI = dyn_cast(V)) + if (SCI->hasOneUse()) { + BranchInst *User = dyn_cast(SCI->use_back()); + if (User + && (SCI->getNext() == User) + && (getClassB(SCI->getOperand(0)->getType()) != cLong) + && User->isConditional() && (User->getCondition() == V)) + return SCI; + } + return 0; } /// visitBranchInst - Handles conditional and unconditional branches. diff --git a/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/lib/Target/SparcV8/SparcV8ISelSimple.cpp index 68bc28a0f32..c93ced515ed 100644 --- a/lib/Target/SparcV8/SparcV8ISelSimple.cpp +++ b/lib/Target/SparcV8/SparcV8ISelSimple.cpp @@ -1016,6 +1016,16 @@ static inline BasicBlock *getBlockAfter(BasicBlock *BB) { /// static SetCondInst *canFoldSetCCIntoBranch(Value *V) { return 0; // disable. + if (SetCondInst *SCI = dyn_cast(V)) + if (SCI->hasOneUse()) { + BranchInst *User = dyn_cast(SCI->use_back()); + if (User + && (SCI->getNext() == User) + && (getClassB(SCI->getOperand(0)->getType()) != cLong) + && User->isConditional() && (User->getCondition() == V)) + return SCI; + } + return 0; } /// visitBranchInst - Handles conditional and unconditional branches.