LLVM opt mem2reg has no effect
I am currently playing around with LLVM and am trying to write a few optimizers to familiarize myself with opt and clang. I wrote a test.c file that is as follow: int foo(int aa, int bb, int cc){ int sum = aa + bb; return sum/cc; } I compiled the source code and generated 2 .ll files, one unoptimized and one with mem2reg optimizer pass: clang -emit-llvm -O0 -c test.c -o test.bc llvm-dis test.bc opt -mem2reg -S test.ll -o test-mem2reg.ll Both .ll files gave me the following output: ModuleID = 'test.bc' source_filename = "test.c" target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target