[OperandBundles] Allow operand-specific attributes in operand bundles
Currently `OperandBundleUse::operandsHaveAttr` computes its result
without being given a specific operand. This is problematic because it
forces us to say that, e.g., even non-pointer operands in `"deopt"`
operand bundles are `readonly`, which doesn't make sense.
This commit changes `operandsHaveAttr` to work in the context of a
specific operand, so that we can give the operand attributes that make
sense for the operands's `llvm::Type`.
llvm-svn: 254764
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index b8c72dd..bba0ef2 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -369,7 +369,7 @@
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either a call argument or an operand bundle!");
- return getOperandBundleForOperand(i - 1).operandsHaveAttr(A);
+ return bundleOperandHasAttr(i - 1, A);
}
/// IsConstantOne - Return true only if val is constant int 1
@@ -646,7 +646,7 @@
assert(hasOperandBundles() && i >= (getBundleOperandsStartIndex() + 1) &&
"Must be either an invoke argument or an operand bundle!");
- return getOperandBundleForOperand(i - 1).operandsHaveAttr(A);
+ return bundleOperandHasAttr(i - 1, A);
}
void InvokeInst::addAttribute(unsigned i, Attribute::AttrKind attr) {