HomePhabricator

[X86] Make sure we do not clobber RBX with mwaitx when used as a base

Authored by Pierre Gousseau <pierre.gousseau@sony.com> on Jan 15 2020, 10:33 AM.

Description

[X86] Make sure we do not clobber RBX with mwaitx when used as a base
pointer.

mwaitx uses EBX as one of its argument.
Using this instruction clobbers RBX as it is defined to hold one of the
input. When the backend uses dynamically allocated stack, RBX is used as
a reserved register for the base pointer.

This patch is adapted from @qcolombet patch for cmpxchg at r263325.

This fixes PR43528.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D73475