summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2014-03-17 16:19:07 +0000
committerEli Bendersky <eliben@google.com>2014-03-17 16:19:07 +0000
commitbbbc2b1140e67f0c8783d4f8dd3977a482e1211e (patch)
tree9f4adafcb646896959ab3bbff95260a9d125309e /lib
parent133aacf0dd1d7d8c7828594e5cd2e9595e0331ed (diff)
downloadllvm-bbbc2b1140e67f0c8783d4f8dd3977a482e1211e.tar.gz
llvm-bbbc2b1140e67f0c8783d4f8dd3977a482e1211e.tar.bz2
llvm-bbbc2b1140e67f0c8783d4f8dd3977a482e1211e.tar.xz
Consistent use of the noduplicate attribute.
The "noduplicate" attribute of call instructions is sometimes queried directly and sometimes through the cannotDuplicate() predicate. This patch streamlines all queries to use the cannotDuplicate() predicate. It also adds this predicate to InvokeInst, to mirror what CallInst has. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/CodeMetrics.cpp4
-rw-r--r--lib/Analysis/IPA/InlineCost.cpp2
-rw-r--r--lib/Analysis/LoopInfo.cpp4
-rw-r--r--lib/Transforms/Scalar/JumpThreading.cpp2
4 files changed, 6 insertions, 6 deletions
diff --git a/lib/Analysis/CodeMetrics.cpp b/lib/Analysis/CodeMetrics.cpp
index 4a05888170..4c8a093684 100644
--- a/lib/Analysis/CodeMetrics.cpp
+++ b/lib/Analysis/CodeMetrics.cpp
@@ -65,11 +65,11 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB,
++NumVectorInsts;
if (const CallInst *CI = dyn_cast<CallInst>(II))
- if (CI->hasFnAttr(Attribute::NoDuplicate))
+ if (CI->cannotDuplicate())
notDuplicatable = true;
if (const InvokeInst *InvI = dyn_cast<InvokeInst>(II))
- if (InvI->hasFnAttr(Attribute::NoDuplicate))
+ if (InvI->cannotDuplicate())
notDuplicatable = true;
NumInsts += TTI.getUserCost(&*II);
diff --git a/lib/Analysis/IPA/InlineCost.cpp b/lib/Analysis/IPA/InlineCost.cpp
index d4ef2247e2..8dafc1c1c6 100644
--- a/lib/Analysis/IPA/InlineCost.cpp
+++ b/lib/Analysis/IPA/InlineCost.cpp
@@ -723,7 +723,7 @@ bool CallAnalyzer::visitCallSite(CallSite CS) {
return false;
}
if (CS.isCall() &&
- cast<CallInst>(CS.getInstruction())->hasFnAttr(Attribute::NoDuplicate))
+ cast<CallInst>(CS.getInstruction())->cannotDuplicate())
ContainsNoDuplicateCall = true;
if (Function *F = CS.getCalledFunction()) {
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index d4e7b54f22..b38672ec39 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -218,12 +218,12 @@ bool Loop::isSafeToClone() const {
return false;
if (const InvokeInst *II = dyn_cast<InvokeInst>((*I)->getTerminator()))
- if (II->hasFnAttr(Attribute::NoDuplicate))
+ if (II->cannotDuplicate())
return false;
for (BasicBlock::iterator BI = (*I)->begin(), BE = (*I)->end(); BI != BE; ++BI) {
if (const CallInst *CI = dyn_cast<CallInst>(BI)) {
- if (CI->hasFnAttr(Attribute::NoDuplicate))
+ if (CI->cannotDuplicate())
return false;
}
}
diff --git a/lib/Transforms/Scalar/JumpThreading.cpp b/lib/Transforms/Scalar/JumpThreading.cpp
index dcb4a954fc..067deb7d78 100644
--- a/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/lib/Transforms/Scalar/JumpThreading.cpp
@@ -255,7 +255,7 @@ static unsigned getJumpThreadDuplicationCost(const BasicBlock *BB,
// as having cost of 2 total, and if they are a vector intrinsic, we model
// them as having cost 1.
if (const CallInst *CI = dyn_cast<CallInst>(I)) {
- if (CI->hasFnAttr(Attribute::NoDuplicate))
+ if (CI->cannotDuplicate())
// Blocks with NoDuplicate are modelled as having infinite cost, so they
// are never duplicated.
return ~0U;