summaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCBoolRetToInt.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /lib/Target/PowerPC/PPCBoolRetToInt.cpp
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Diffstat (limited to 'lib/Target/PowerPC/PPCBoolRetToInt.cpp')
-rw-r--r--lib/Target/PowerPC/PPCBoolRetToInt.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/lib/Target/PowerPC/PPCBoolRetToInt.cpp
index 7920240bc2b9e..bfb4d8756901b 100644
--- a/lib/Target/PowerPC/PPCBoolRetToInt.cpp
+++ b/lib/Target/PowerPC/PPCBoolRetToInt.cpp
@@ -119,7 +119,7 @@ class PPCBoolRetToInt : public FunctionPass {
Promotable.insert(P);
SmallVector<const PHINode *, 8> ToRemove;
- for (const auto &P : Promotable) {
+ for (const PHINode *P : Promotable) {
// Condition 2 and 3
auto IsValidUser = [] (const Value *V) -> bool {
return isa<ReturnInst>(V) || isa<CallInst>(V) || isa<PHINode>(V) ||
@@ -146,7 +146,7 @@ class PPCBoolRetToInt : public FunctionPass {
Promotable.erase(User);
ToRemove.clear();
- for (const auto &P : Promotable) {
+ for (const PHINode *P : Promotable) {
// Condition 4 and 5
const auto &Users = P->users();
const auto &Operands = P->operands();
@@ -168,6 +168,9 @@ class PPCBoolRetToInt : public FunctionPass {
}
bool runOnFunction(Function &F) {
+ if (skipFunction(F))
+ return false;
+
PHINodeSet PromotablePHINodes = getPromotablePHINodes(F);
B2IMap Bool2IntMap;
bool Changed = false;
@@ -199,11 +202,11 @@ class PPCBoolRetToInt : public FunctionPass {
// Presently, we only know how to handle PHINode, Constant, and Arguments.
// Potentially, bitwise operations (AND, OR, XOR, NOT) and sign extension
// could also be handled in the future.
- for (const auto &V : Defs)
+ for (Value *V : Defs)
if (!isa<PHINode>(V) && !isa<Constant>(V) && !isa<Argument>(V))
return false;
- for (const auto &V : Defs)
+ for (Value *V : Defs)
if (const PHINode *P = dyn_cast<PHINode>(V))
if (!PromotablePHINodes.count(P))
return false;
@@ -214,7 +217,7 @@ class PPCBoolRetToInt : public FunctionPass {
++NumBoolCallPromotion;
++NumBoolToIntPromotion;
- for (const auto &V : Defs)
+ for (Value *V : Defs)
if (!BoolToIntMap.count(V))
BoolToIntMap[V] = translate(V);