summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-25 17:46:30 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-25 17:46:30 +0000
commitf3dbd17d0a9f286591026a01a026aceec92dcfb7 (patch)
treeff5f538dbc45c42146175a03b37dbbde80a7e949 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp
parentb3b3c29c875af3246231dd8b2d4b9aade66c1b6c (diff)
downloadbcm5719-llvm-f3dbd17d0a9f286591026a01a026aceec92dcfb7.tar.gz
bcm5719-llvm-f3dbd17d0a9f286591026a01a026aceec92dcfb7.zip
[APInt] Use isSubsetOf, intersects, and bit counting methods to reduce temporary APInts
This patch uses various APInt methods to reduce temporary APInt creation. This should be all of the unrelated cleanups that got buried in D32376(creating a KnownBits struct) as well as some pointed out by Simon during the review of that. Plus a few improvements to use counting instead of masking. I've left out any places where we do something like (KnownZero & KnownOne) != 0 as I plan to add a helper method to KnownBits to ask that question and didn't want to thrash that code an additional time. Differential Revision: https://reviews.llvm.org/D32495 llvm-svn: 301338
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index e9152b8e88b..1c2c763cea0 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4380,7 +4380,7 @@ static bool EliminateDeadSwitchCases(SwitchInst *SI, AssumptionCache *AC,
SmallVector<ConstantInt *, 8> DeadCases;
for (auto &Case : SI->cases()) {
APInt CaseVal = Case.getCaseValue()->getValue();
- if ((CaseVal & KnownZero) != 0 || (CaseVal & KnownOne) != KnownOne ||
+ if (KnownZero.intersects(CaseVal) || !KnownOne.isSubsetOf(CaseVal) ||
(CaseVal.getMinSignedBits() > MaxSignificantBitsInCond)) {
DeadCases.push_back(Case.getCaseValue());
DEBUG(dbgs() << "SimplifyCFG: switch case " << CaseVal << " is dead.\n");
OpenPOWER on IntegriCloud