Skip to content

Commit 3495fa6

Browse files
committed
Unconditional Op access
1 parent 75af9b2 commit 3495fa6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,19 +4220,19 @@ void llvm::maybeMarkSanitizerLibraryCallNoBuiltin(
42204220
}
42214221

42224222
bool llvm::canReplaceOperandWithVariable(const Instruction *I, unsigned OpIdx) {
4223+
const auto *Op = I->getOperand(OpIdx);
42234224
// We can't have a PHI with a metadata type.
4224-
if (I->getOperand(OpIdx)->getType()->isMetadataTy())
4225+
if (Op->getType()->isMetadataTy())
42254226
return false;
42264227

42274228
// swifterror pointers can only be used by a load, store, or as a swifterror
42284229
// argument; swifterror pointers are not allowed to be used in select or phi
42294230
// instructions.
4230-
if (OpIdx < I->getNumOperands())
4231-
if (I->getOperand(OpIdx)->isSwiftError())
4232-
return false;
4231+
if (Op->isSwiftError())
4232+
return false;
42334233

42344234
// Early exit.
4235-
if (!isa<Constant>(I->getOperand(OpIdx)))
4235+
if (!isa<Constant>(Op))
42364236
return true;
42374237

42384238
switch (I->getOpcode()) {

0 commit comments

Comments
 (0)