summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorXin Tong <trent.xin.tong@gmail.com>2018-03-06 02:24:02 +0000
committerXin Tong <trent.xin.tong@gmail.com>2018-03-06 02:24:02 +0000
commit8fd561f572b8992f3e1b94192e0285fbd237636b (patch)
tree178ed00e53fb093cc86c6ab7c7b3d52e2c499990 /llvm/lib
parent98af9efca5d63739d72ddeba4c1db5c6e076fb72 (diff)
downloadbcm5719-llvm-8fd561f572b8992f3e1b94192e0285fbd237636b.tar.gz
bcm5719-llvm-8fd561f572b8992f3e1b94192e0285fbd237636b.zip
[MergeICmp] Simplify how BCECmpBlock instructions are blacklisted
llvm-svn: 326761
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/MergeICmps.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/MergeICmps.cpp b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
index 3a5431b5171..4e54f1e47e7 100644
--- a/llvm/lib/Transforms/Scalar/MergeICmps.cpp
+++ b/llvm/lib/Transforms/Scalar/MergeICmps.cpp
@@ -159,22 +159,16 @@ class BCECmpBlock {
bool BCECmpBlock::doesOtherWork() const {
AssertConsistent();
+ // All the instructions we care about in the BCE cmp block.
+ DenseSet<Instruction *> BlockInsts(
+ {Lhs_.GEP, Rhs_.GEP, Lhs_.LoadI, Rhs_.LoadI, CmpI, BranchI});
// TODO(courbet): Can we allow some other things ? This is very conservative.
// We might be able to get away with anything does does not have any side
// effects outside of the basic block.
// Note: The GEPs and/or loads are not necessarily in the same block.
for (const Instruction &Inst : *BB) {
- if (const auto *const GEP = dyn_cast<GetElementPtrInst>(&Inst)) {
- if (!(Lhs_.GEP == GEP || Rhs_.GEP == GEP)) return true;
- } else if (const auto *const L = dyn_cast<LoadInst>(&Inst)) {
- if (!(Lhs_.LoadI == L || Rhs_.LoadI == L)) return true;
- } else if (const auto *const C = dyn_cast<ICmpInst>(&Inst)) {
- if (C != CmpI) return true;
- } else if (const auto *const Br = dyn_cast<BranchInst>(&Inst)) {
- if (Br != BranchI) return true;
- } else {
+ if (!BlockInsts.count(&Inst))
return true;
- }
}
return false;
}
OpenPOWER on IntegriCloud