@@ -324,19 +324,28 @@ CodeGenIntrinsic::CodeGenIntrinsic(const Record *R,
324324 for (unsigned E = TypeList->size (); Idx < E; ++Idx)
325325 IS.ParamTys .push_back (TypeList->getElementAsRecord (Idx));
326326
327+ // Apply default properties, unless they are disabled.
328+ ArrayRef<const Record *> DefaultProperties (Ctx.DefaultProperties );
329+ if (TheDef->getValueAsBit (" DisableDefaultAttributes" ))
330+ DefaultProperties = {};
331+ for (const Record *Property : DefaultProperties)
332+ setProperty (Property);
333+
327334 // Parse the intrinsic properties.
328335 const ListInit *PropList = R->getValueAsListInit (" IntrProperties" );
329336 for (unsigned i = 0 , e = PropList->size (); i != e; ++i) {
330337 const Record *Property = PropList->getElementAsRecord (i);
331338 assert (Property->isSubClassOf (" IntrinsicProperty" ) &&
332339 " Expected a property!" );
333340
341+ if (is_contained (DefaultProperties, Property)) {
342+ PrintWarning (TheDef->getLoc (), " property '" + Property->getName () +
343+ " ' is already enabled by default" );
344+ }
345+
334346 setProperty (Property);
335347 }
336348
337- // Set default properties to true.
338- setDefaultProperties (Ctx.DefaultProperties );
339-
340349 // Also record the SDPatternOperator Properties.
341350 Properties = parseSDPatternOperatorProperties (R);
342351
@@ -345,16 +354,6 @@ CodeGenIntrinsic::CodeGenIntrinsic(const Record *R,
345354 llvm::sort (Attrs);
346355}
347356
348- void CodeGenIntrinsic::setDefaultProperties (
349- ArrayRef<const Record *> DefaultProperties) {
350- // opt-out of using default attributes.
351- if (TheDef->getValueAsBit (" DisableDefaultAttributes" ))
352- return ;
353-
354- for (const Record *Rec : DefaultProperties)
355- setProperty (Rec);
356- }
357-
358357void CodeGenIntrinsic::setProperty (const Record *R) {
359358 if (R->getName () == " IntrNoMem" )
360359 ME = MemoryEffects::none ();
0 commit comments