[Mlir-commits] [mlir] [mlir][EmitC] Do not inline expressions used by ops with the CExpression trait (PR #93691)

Gil Rapaport llvmlistbot at llvm.org
Tue Jun 4 01:57:06 PDT 2024


================
@@ -303,7 +303,12 @@ static bool shouldBeInlined(ExpressionOp expressionOp) {
 
   // Do not inline expressions used by other expressions, as any desired
   // expression folding was taken care of by transformations.
-  return !user->getParentOfType<ExpressionOp>();
+  if (user->getParentOfType<ExpressionOp>())
+    return false;
+
+  // Do not inline expressions used by ops with the CExpression trait. If this
+  // was intended, the user could have been merged into the expression op.
+  return !user->hasTrait<OpTrait::emitc::CExpression>();
----------------
aniragil wrote:

Actually, isn't the first check now redundant?
If the user is part of an ExpressionOp then it must have the CExpression trait, right?

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


More information about the Mlir-commits mailing list