question about mem2reg

Hello,

I just upgraded my llvm to 5.0.0. I applied mem2reg pass as follows:

opt -mem2reg m2rtttl.bc > m2rtttl.opt

But after that, I compared m2rtttl.bc and m2rtttl.opt. I noticed that there are no difference between m2rtttl.bc and m2rtttl.opt. Did I apply llvm in the correct way?

Thanks a lot for the help!

Best,

Linhai

Hello Linhai,

When compiled with -O0, clang 5.0 started to add optnone attribute to each function, which prevents further optimizations afterwards including mem2reg pass. To prevent that, add “-Xclang -disable-O0-optnone” to clang command line arguments.

Thank you,
Heejin

Thanks a lot!

This solved my problem.

Best,

Linhai