[clang] [llvm] [IRBuilder] Add new overload for CreateIntrinsic (PR #131942)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 20 08:04:57 PDT 2025


================
@@ -114,22 +114,23 @@ static Value *handleHlslClip(const CallExpr *E, CodeGenFunction *CGF) {
     CMP = CGF->Builder.CreateIntrinsic(
         CGF->Builder.getInt1Ty(), CGF->CGM.getHLSLRuntime().getAnyIntrinsic(),
         {FCompInst}, nullptr);
-  } else
+  } else {
     CMP = CGF->Builder.CreateFCmpOLT(Op0, FZeroConst);
+  }
 
-  if (CGF->CGM.getTarget().getTriple().isDXIL())
+  if (CGF->CGM.getTarget().getTriple().isDXIL()) {
     LastInstr = CGF->Builder.CreateIntrinsic(
         CGF->VoidTy, llvm::Intrinsic::dx_discard, {CMP}, nullptr);
-  else if (CGF->CGM.getTarget().getTriple().isSPIRV()) {
+  } else if (CGF->CGM.getTarget().getTriple().isSPIRV()) {
     BasicBlock *LT0 = CGF->createBasicBlock("lt0", CGF->CurFn);
     BasicBlock *End = CGF->createBasicBlock("end", CGF->CurFn);
 
     CGF->Builder.CreateCondBr(CMP, LT0, End);
 
     CGF->Builder.SetInsertPoint(LT0);
 
-    CGF->Builder.CreateIntrinsic(CGF->VoidTy, llvm::Intrinsic::spv_discard, {},
-                                 nullptr);
+    CGF->Builder.CreateIntrinsic(llvm::Intrinsic::spv_discard,
+                                 ArrayRef<Value *>{}, nullptr);
----------------
jurahul wrote:

Thanks, yeah removing the nullptr (the FMFSource argument) eliminates the need for the explicit cast as well.

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


More information about the llvm-commits mailing list