diff a/test/langtools/tools/javac/reflect/IfTest.java b/test/langtools/tools/javac/reflect/IfTest.java
--- /dev/null
+++ b/test/langtools/tools/javac/reflect/IfTest.java
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.incubator.code.CodeReflection;
+
+/*
+ * @test
+ * @summary Smoke test for code reflection with if statements.
+ * @modules jdk.incubator.code
+ * @build IfTest
+ * @build CodeReflectionTester
+ * @run main CodeReflectionTester IfTest
+ */
+
+public class IfTest {
+    @CodeReflection
+    @IR("""
+            func @"test1" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else()void -> {
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test1(int i) {
+        if (i < 1) {
+            i = 1;
+        }
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test2" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else()void -> {
+                        %7 : int = constant @"2";
+                        var.store %2 %7;
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test2(int i) {
+        if (i < 1) {
+            i = 1;
+        } else {
+            i = 2;
+        }
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test3" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else_if()boolean -> {
+                        %7 : int = var.load %2;
+                        %8 : int = constant @"2";
+                        %9 : boolean = lt %7 %8;
+                        yield %9;
+                    }
+                    ^then()void -> {
+                        %10 : int = constant @"2";
+                        var.store %2 %10;
+                        yield;
+                    }
+                    ^else()void -> {
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test3(int i) {
+        if (i < 1) {
+            i = 1;
+        } else if (i < 2) {
+            i = 2;
+        }
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test4" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else_if()boolean -> {
+                        %7 : int = var.load %2;
+                        %8 : int = constant @"2";
+                        %9 : boolean = lt %7 %8;
+                        yield %9;
+                    }
+                    ^then()void -> {
+                        %10 : int = constant @"2";
+                        var.store %2 %10;
+                        yield;
+                    }
+                    ^else()void -> {
+                        %11 : int = constant @"3";
+                        var.store %2 %11;
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test4(int i) {
+        if (i < 1) {
+            i = 1;
+        } else if (i < 2) {
+            i = 2;
+        } else {
+            i = 3;
+        }
+    }
+
+    @IR("""
+            func @"test5" (%0 : IfTest, %1 : int)int -> {
+              %2 : Var<int> = var %1 @"i";
+              java.if
+                  ()boolean -> {
+                      %3 : int = var.load %2;
+                      %4 : int = constant @"1";
+                      %5 : boolean = lt %3 %4;
+                      yield %5;
+                  }
+                  ^then()void -> {
+                      %6 : int = constant @"1";
+                      return %6;
+                  }
+                  ^else_if()boolean -> {
+                      %7 : int = var.load %2;
+                      %8 : int = constant @"2";
+                      %9 : boolean = lt %7 %8;
+                      yield %9;
+                  }
+                  ^then()void -> {
+                      %10 : int = constant @"2";
+                      return %10;
+                  }
+                  ^else()void -> {
+                      %11 : int = constant @"3";
+                      return %11;
+                  };
+              unreachable;
+            };
+            """)
+    @CodeReflection
+    int test5(int i) {
+        if (i < 1) {
+            return 1;
+        } else if (i < 2) {
+            return 2;
+        } else {
+            return 3;
+        }
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test6" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else()void -> {
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test6(int i) {
+        if (i < 1)
+            i = 1;
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test7" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else()void -> {
+                        %7 : int = constant @"2";
+                        var.store %2 %7;
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test7(int i) {
+        if (i < 1)
+            i = 1;
+        else
+            i = 2;
+    }
+
+    @CodeReflection
+    @IR("""
+            func @"test8" (%0 : IfTest, %1 : int)void -> {
+                %2 : Var<int> = var %1 @"i";
+                java.if
+                    ()boolean -> {
+                        %3 : int = var.load %2;
+                        %4 : int = constant @"1";
+                        %5 : boolean = lt %3 %4;
+                        yield %5;
+                    }
+                    ^then()void -> {
+                        %6 : int = constant @"1";
+                        var.store %2 %6;
+                        yield;
+                    }
+                    ^else_if()boolean -> {
+                        %7 : int = var.load %2;
+                        %8 : int = constant @"2";
+                        %9 : boolean = lt %7 %8;
+                        yield %9;
+                    }
+                    ^then()void -> {
+                        %10 : int = constant @"2";
+                        var.store %2 %10;
+                        yield;
+                    }
+                    ^else()void -> {
+                        %11 : int = constant @"3";
+                        var.store %2 %11;
+                        yield;
+                    };
+                return;
+            };
+            """)
+    void test8(int i) {
+        if (i < 1)
+            i = 1;
+        else if (i < 2)
+            i = 2;
+        else
+            i = 3;
+    }
+
+    @IR("""
+            func @"test9" (%0 : java.lang.Boolean)void -> {
+                %1 : Var<java.lang.Boolean> = var %0 @"b";
+                %3 : Var<int> = var @"i";
+                java.if
+                    ()boolean -> {
+                        %4 : java.lang.Boolean = var.load %1;
+                        %5 : boolean = invoke %4 @"java.lang.Boolean::booleanValue()boolean";
+                        yield %5;
+                    }
+                    ()void -> {
+                        %6 : int = constant @"1";
+                        var.store %3 %6;
+                        yield;
+                    }
+                    ()void -> {
+                        %7 : int = constant @"2";
+                        var.store %3 %7;
+                        yield;
+                    };
+                return;
+            };
+            """)
+    @CodeReflection
+    static void test9(Boolean b) {
+        int i;
+        if (b) {
+            i = 1;
+        } else {
+            i = 2;
+        }
+    }
+}
