[OperandBundles] Make function attributes conservatively correct
[oota-llvm.git] / lib / IR / Instructions.cpp
index 49f9fe837082ef902c814ef3c0832cb3eea4c077..855101b4ac8b593721c50c1eb94dee8dc3735059 100644 (file)
@@ -563,6 +563,12 @@ void InvokeInst::setSuccessorV(unsigned idx, BasicBlock *B) {
 bool InvokeInst::hasFnAttrImpl(Attribute::AttrKind A) const {
   if (AttributeList.hasAttribute(AttributeSet::FunctionIndex, A))
     return true;
+
+  // Operand bundles override attributes on the called function, but don't
+  // override attributes directly present on the invoke instruction.
+  if (isFnAttrDisallowedByOpBundle(A))
+    return false;
+
   if (const Function *F = getCalledFunction())
     return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A);
   return false;