[Lldb-commits] [lldb] Complex range (PR #70244)

via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 25 12:17:31 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 0ab694754e3722f7edbd8b3ad23ac0b312515d3b 2aa766352db0c3010991b4bc53ded7a2d1693bfd -- clang/test/CodeGen/cx-complex-range.c clang/test/CodeGen/pragma-cx-limited-range.c clang/include/clang/Parse/Parser.h clang/include/clang/Sema/Sema.h clang/lib/CodeGen/CGExprComplex.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Parse/ParsePragma.cpp clang/lib/Parse/ParseStmt.cpp clang/lib/Parse/Parser.cpp clang/lib/Sema/SemaAttr.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/CodeGen/CGExprComplex.cpp b/clang/lib/CodeGen/CGExprComplex.cpp
index 4b559a5dc747..f73dd0538e78 100644
--- a/clang/lib/CodeGen/CGExprComplex.cpp
+++ b/clang/lib/CodeGen/CGExprComplex.cpp
@@ -920,8 +920,8 @@ ComplexPairTy ComplexExprEmitter::EmitRangeReductionDiv(llvm::Value *LHSr,
   // f = (b - ar)/tmp
   llvm::Value *DdC = Builder.CreateFDiv(RHSi, RHSr); // d/c
 
-  llvm::Value *RD = Builder.CreateFMul(DdC, RHSi);   // (d/c)d
-  llvm::Value *CpRD = Builder.CreateFAdd(RHSr, RD);  // c+((d/c)d)
+  llvm::Value *RD = Builder.CreateFMul(DdC, RHSi);  // (d/c)d
+  llvm::Value *CpRD = Builder.CreateFAdd(RHSr, RD); // c+((d/c)d)
 
   llvm::Value *T3 = Builder.CreateFMul(LHSi, DdC);   // b(d/c)
   llvm::Value *T4 = Builder.CreateFAdd(LHSr, T3);    // a+b(d/c)
@@ -938,17 +938,17 @@ ComplexPairTy ComplexExprEmitter::EmitRangeReductionDiv(llvm::Value *LHSr,
   // tmp = d + rc
   // e = (ar + b)/tmp
   // f = (br - a)/tmp
-  llvm::Value *CdD = Builder.CreateFDiv(RHSr, RHSi);  // c/d
+  llvm::Value *CdD = Builder.CreateFDiv(RHSr, RHSi); // c/d
 
-  llvm::Value *RC = Builder.CreateFMul(CdD, RHSr);    // (c/d)c
-  llvm::Value *DpRC = Builder.CreateFAdd(RHSi, RC);   // d+(c/d)c
+  llvm::Value *RC = Builder.CreateFMul(CdD, RHSr);  // (c/d)c
+  llvm::Value *DpRC = Builder.CreateFAdd(RHSi, RC); // d+(c/d)c
 
-  llvm::Value *T7 = Builder.CreateFAdd(CdD, RHSi);    // (c/d)+b
-  llvm::Value *T8 = Builder.CreateFMul(LHSr, T7);     // a((c/d)+b)
-  llvm::Value *DSTFr = Builder.CreateFDiv(T8, DpRC);  // (a((c/d)+b)/(d+(c/d)c))
+  llvm::Value *T7 = Builder.CreateFAdd(CdD, RHSi);   // (c/d)+b
+  llvm::Value *T8 = Builder.CreateFMul(LHSr, T7);    // a((c/d)+b)
+  llvm::Value *DSTFr = Builder.CreateFDiv(T8, DpRC); // (a((c/d)+b)/(d+(c/d)c))
 
-  llvm::Value *T9 = Builder.CreateFSub(CdD, LHSr);    // (c/d)-a
-  llvm::Value *T10 = Builder.CreateFMul(RHSi, T9);    // b((c/d)-a)
+  llvm::Value *T9 = Builder.CreateFSub(CdD, LHSr); // (c/d)-a
+  llvm::Value *T10 = Builder.CreateFMul(RHSi, T9); // b((c/d)-a)
   llvm::Value *DSTFi =
       Builder.CreateFDiv(T10, DpRC); // (b((c/d)-a))/(d+(c/d)c))
   Builder.CreateBr(ContBB);
@@ -977,7 +977,7 @@ ComplexPairTy ComplexExprEmitter::EmitBinDiv(const BinOpInfo &Op) {
         !Op.FPFeatures.getCxLimitedRange()) {
       return EmitRangeReductionDiv(LHSr, LHSi, RHSr, RHSi);
     } else if (RHSi && (Op.FPFeatures.getCxLimitedRange() ||
-                 CGF.getLangOpts().CxLimitedRange)) {
+                        CGF.getLangOpts().CxLimitedRange)) {
       if (!LHSi)
         LHSi = llvm::Constant::getNullValue(RHSi->getType());
       return EmitAlgebraicDiv(LHSr, LHSi, RHSr, RHSi);
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index f10912d772bd..ca414b1956f5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3295,14 +3295,14 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
                    options::OPT_fstrict_float_cast_overflow, false))
     CmdArgs.push_back("-fno-strict-float-cast-overflow");
 
-   if (const Arg *A = Args.getLastArg(options::OPT_fcx_limited_range))
-        CmdArgs.push_back("-fcx-limited-range");
-   if (const Arg *A = Args.getLastArg(options::OPT_fcx_fortran_rules))
-     CmdArgs.push_back("-fcx-fortran-rules");
-   if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_limited_range))
-     CmdArgs.push_back("-fno-cx-limited-range");
-   if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_fortran_rules))
-     CmdArgs.push_back("-fno-cx-fortran-rules");
+  if (const Arg *A = Args.getLastArg(options::OPT_fcx_limited_range))
+    CmdArgs.push_back("-fcx-limited-range");
+  if (const Arg *A = Args.getLastArg(options::OPT_fcx_fortran_rules))
+    CmdArgs.push_back("-fcx-fortran-rules");
+  if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_limited_range))
+    CmdArgs.push_back("-fno-cx-limited-range");
+  if (const Arg *A = Args.getLastArg(options::OPT_fno_cx_fortran_rules))
+    CmdArgs.push_back("-fno-cx-fortran-rules");
 }
 
 static void RenderAnalyzerOptions(const ArgList &Args, ArgStringList &CmdArgs,

``````````

</details>


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


More information about the lldb-commits mailing list