From 9e3edad932cc41be697ac6e38ba0c67ecd22151e Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 17 Aug 2016 01:23:58 +0000 Subject: [PATCH] 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 --- llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 4 ++-- 1 file 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. -- 2.7.4