================
@@ -282,10 +293,32 @@ class AggExprEmitter : public StmtVisitor<AggExprEmitter> 
{
       if (dest.isIgnored() || !cgf.cgm.isPaddedAtomicType(atomicType))
         return Visit(e->getSubExpr());
 
-      cgf.cgm.errorNYI(
-          e->getSourceRange(),
-          "AggExprEmitter: AtomicCast not ignored and has padded atomic type");
-      return;
+      // These two cases are reverses of each other; try to peephole them.
+      CastKind peepholeTarget =
+          (isToAtomic ? CK_AtomicToNonAtomic : CK_NonAtomicToAtomic);
+      if (Expr *op =
+              findPeephole(e->getSubExpr(), peepholeTarget, cgf.getContext())) 
{
+        cgf.cgm.errorNYI(op->getSourceRange(),
----------------
erichkeane wrote:

This is a pretty easy case right?  Just a situation where we have a 
atomic-to-nonatomic cast 'around' a non-atomic-to-atomic cast (or vice versa).  
Can we just come up with an example?

Alternatively, and not something we can do now (as we're not really modeling 
these casts?!), this seems like something that we could do as a opt in CIR :) 

https://github.com/llvm/llvm-project/pull/219680
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to