On Thu, 2024-11-14 at 16:19 -0800, Andrii Nakryiko wrote: [...] > I was also always hoping that we'll eventually optimize the following pattern: > > r1 = *(global var) > if r1 == 1 /* always 1 or 0 */ > goto +... > ... > > > This is extremely common with .rodata global variables, and while the > branches are dead code eliminated, memory reads are not. Not sure how > involved it would be to do this. Could you please elaborate a bit. For a simple test like below compiler replaces 'flag' with 1, so no action is needed from verifier: const int flag = 1; SEC("socket") __success __xlated("foobar") int rodata_test(void *ctx) { if (flag) return 1; return 0; }