aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-08-17 01:23:58 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2016-08-17 01:23:58 +0000
commit9e3edad932cc41be697ac6e38ba0c67ecd22151e (patch)
tree21d03cb367573cb5633ca6788230f96a21ec2fef /llvm/lib/Transforms/IPO/FunctionAttrs.cpp
parent3bcaa812042ba8ffb598c96fae99b07528a0caa5 (diff)
downloadllvm-9e3edad932cc41be697ac6e38ba0c67ecd22151e.zip
llvm-9e3edad932cc41be697ac6e38ba0c67ecd22151e.tar.gz
llvm-9e3edad932cc41be697ac6e38ba0c67ecd22151e.tar.bz2
IPO: Swap || operands to avoid dereferencing end()
IsOperandBundleUse conveniently indicates whether std::next(F->arg_begin(),UseIndex) will get to (or past) end(). Check it first to avoid dereferencing end(). llvm-svn: 278884
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 273e5e2..1de5f4f 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -448,8 +448,8 @@ determinePointerReadAttrs(Argument *A,
// to a operand bundle use, these cannot participate in the optimistic SCC
// analysis. Instead, we model the operand bundle uses as arguments in
// call to a function external to the SCC.
- if (!SCCNodes.count(&*std::next(F->arg_begin(), UseIndex)) ||
- IsOperandBundleUse) {
+ if (IsOperandBundleUse ||
+ !SCCNodes.count(&*std::next(F->arg_begin(), UseIndex))) {
// The accessors used on CallSite here do the right thing for calls and
// invokes with operand bundles.