[llvm] [LoongArch] Fold conditional branches with constant conditions (PR #185161)

via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 7 01:42:56 PST 2026


================
@@ -1239,6 +1239,14 @@ SDValue LoongArchTargetLowering::lowerBRCOND(SDValue Op,
   SDLoc DL(Op);
   MVT GRLenVT = Subtarget.getGRLenVT();
 
+  if (auto *cond = dyn_cast<ConstantSDNode>(CondV)) {
+    if (cond->isZero()) {
----------------
wangleiat wrote:

LLVM coding style prefers [omitting braces when the body consists of a single simple statement](https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements).

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


More information about the llvm-commits mailing list