[OperandBundles] Make function attributes conservatively correct
[oota-llvm.git] / include / llvm / IR / Instructions.h
index 9fb44ca07a66e3cedf137ddc9411a9c865c31983..cb3a260e0d5fea4baaa4ee5f7cbd7492d11ed5c3 100644 (file)
@@ -1742,6 +1742,12 @@ private:
   template <typename AttrKind> bool hasFnAttrImpl(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 call instruction.
+    if (isFnAttrDisallowedByOpBundle(A))
+      return false;
+
     if (const Function *F = getCalledFunction())
       return F->getAttributes().hasAttribute(AttributeSet::FunctionIndex, A);
     return false;