[clang] [CIR] Split side_effect into memory effects, nounwind, and willreturn (PR #223890)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 16 06:52:13 PDT 2026


================
@@ -390,19 +389,22 @@ void CIRGenModule::constructAttributeList(
 
     assert(!cir::MissingFeatures::opCallAttrs());
 
-    // 'const', 'pure' and 'noalias' attributed functions are also nounwind.
-    if (targetDecl->hasAttr<ConstAttr>()) {
-      // gcc specifies that 'const' functions have greater restrictions than
-      // 'pure' functions, so they also cannot have infinite loops.
-      sideEffect = cir::SideEffect::Const;
-    } else if (targetDecl->hasAttr<PureAttr>()) {
-      // gcc specifies that 'pure' functions cannot have infinite loops.
-      sideEffect = cir::SideEffect::Pure;
+    // 'const' and 'pure' imply more than memory effects: the callee also
----------------
erichkeane wrote:

not a particularly useful comment?  Split it up on the individual 'add unit attr' below as something like:

"const and pure both imply no-unwind and will-return" or something.

https://github.com/llvm/llvm-project/pull/223890


More information about the cfe-commits mailing list