How to prevent Dead-Code-Elimination pass removing pseudo-instructions ADJCALLSTACK(DOWN | UP)?

Hi, LLVMer.

I use pseudo-instructions ADJCALLSTACK(DOWN | UP) to adjust call stacks, and it works well with “-O0” option. However, ADJCALLSTACK(DOWN | UP) are removed during codegen DCE pass under “-O2”.

What have I ignored?

Thanks.

You should set them as using/defining your stack register with :

let Defs = [STACKREG], Uses = [STACKREG] in {
__ YOUR INSTRUCTION __
}

Marcello

Thank you, Marcello. It works.