================
@@ -43,7 +43,56 @@ mlir::Value CIRGenFunction::emitX86BuiltinExpr(unsigned 
builtinID,
   // Find out if any arguments are required to be integer constant expressions.
   assert(!cir::MissingFeatures::handleBuiltinICEArguments());
 
-  switch (builtinID) {
+  llvm::SmallVector<mlir::Value, 4> Ops;
+
+  // Find out if any arguments are required to be integer constant expressions.
+  unsigned ICEArguments = 0;
+  ASTContext::GetBuiltinTypeError Error;
+  getContext().GetBuiltinType(BuiltinID, Error, &ICEArguments);
+  assert(Error == ASTContext::GE_None && "Should not codegen an error");
+  for (unsigned i = 0, e = E->getNumArgs(); i != e; i++) {
----------------
andykaylor wrote:

```suggestion
  for (auto [idx, arg] : llvm::enumerate(e->arguments())) {
```
We prefer using range-for loops when possible. Using `llvm::enumerate` tracks 
the index while still using the range-for. You'll have to change the signature 
of `emitScalarOrConstFoldImmArg` to take the argument expression (as `const 
Expr *`) rather than the call expression, but all of the callers of 
`emitScalarOrConstFoldImmArg` follow the pattern seen here, so that should be 
fine.

This also avoids the terrible `e` versus `E` ambiguity in the original code 
here.

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

Reply via email to