#include "verifier_array_access.skel.h"
 #include "verifier_basic_stack.skel.h"
 #include "verifier_bounds_deduction.skel.h"
+#include "verifier_bounds_deduction_non_const.skel.h"
 #include "verifier_bounds_mix_sign_unsign.skel.h"
 #include "verifier_cfg.skel.h"
 #include "verifier_cgroup_inv_retcode.skel.h"
 void test_verifier_array_access(void)         { RUN(verifier_array_access); }
 void test_verifier_basic_stack(void)          { RUN(verifier_basic_stack); }
 void test_verifier_bounds_deduction(void)     { RUN(verifier_bounds_deduction); }
+void test_verifier_bounds_deduction_non_const(void)     { RUN(verifier_bounds_deduction_non_const); }
 void test_verifier_bounds_mix_sign_unsign(void) { RUN(verifier_bounds_mix_sign_unsign); }
 void test_verifier_cfg(void)                  { RUN(verifier_cfg); }
 void test_verifier_cgroup_inv_retcode(void)   { RUN(verifier_cgroup_inv_retcode); }
 
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/bpf.h>
+#include <bpf/bpf_helpers.h>
+#include "bpf_misc.h"
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp64, <non_const> == <const>, 1")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_1(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if r0 < 3 goto l0_%=;                           \
+       r2 = 2;                                         \
+       if r0 == r2 goto l1_%=;                         \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp64, <non_const> == <const>, 2")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_2(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if r0 > 3 goto l0_%=;                           \
+       r2 = 4;                                         \
+       if r0 == r2 goto l1_%=;                         \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp64, <non_const> != <const>, 1")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_3(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if r0 < 3 goto l0_%=;                           \
+       r2 = 2;                                         \
+       if r0 != r2 goto l0_%=;                         \
+       goto l1_%=;                                     \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp64, <non_const> != <const>, 2")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_4(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if r0 > 3 goto l0_%=;                           \
+       r2 = 4;                                         \
+       if r0 != r2 goto l0_%=;                         \
+       goto l1_%=;                                     \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp32, <non_const> == <const>, 1")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_5(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if w0 < 4 goto l0_%=;                           \
+       w2 = 3;                                         \
+       if w0 == w2 goto l1_%=;                         \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp32, <non_const> == <const>, 2")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_6(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if w0 > 4 goto l0_%=;                           \
+       w2 = 5;                                         \
+       if w0 == w2 goto l1_%=;                         \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp32, <non_const> != <const>, 1")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_7(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if w0 < 3 goto l0_%=;                           \
+       w2 = 2;                                         \
+       if w0 != w2 goto l0_%=;                         \
+       goto l1_%=;                                     \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+SEC("socket")
+__description("check deducing bounds from non-const, jmp32, <non_const> != <const>, 2")
+__success __retval(0)
+__naked void deducing_bounds_from_non_const_8(void)
+{
+       asm volatile ("                                 \
+       call %[bpf_ktime_get_ns];                       \
+       if w0 > 3 goto l0_%=;                           \
+       w2 = 4;                                         \
+       if w0 != w2 goto l0_%=;                         \
+       goto l1_%=;                                     \
+l0_%=:                                                 \
+       r0 = 0;                                         \
+       exit;                                           \
+l1_%=:                                                 \
+       r0 -= r1;                                       \
+       exit;                                           \
+"      :
+       : __imm(bpf_ktime_get_ns)
+       : __clobber_all);
+}
+
+char _license[] SEC("license") = "GPL";