Index: lib/Target/X86/X86ISelLowering.cpp =================================================================== --- lib/Target/X86/X86ISelLowering.cpp +++ lib/Target/X86/X86ISelLowering.cpp @@ -477,11 +477,19 @@ } if (Subtarget->isTarget64BitLP64()) { - setExceptionPointerRegister(X86::RAX); - setExceptionSelectorRegister(X86::RDX); + if (Subtarget->isTargetWindowsCoreCLR()) { + setExceptionPointerRegister(X86::RDX); + } else { + setExceptionPointerRegister(X86::RAX); + setExceptionSelectorRegister(X86::RDX); + } } else { - setExceptionPointerRegister(X86::EAX); - setExceptionSelectorRegister(X86::EDX); + if (Subtarget->isTargetWindowsCoreCLR()) { + setExceptionPointerRegister(X86::EDX); + } else { + setExceptionPointerRegister(X86::EAX); + setExceptionSelectorRegister(X86::EDX); + } } setOperationAction(ISD::FRAME_TO_ARGS_OFFSET, MVT::i32, Custom); setOperationAction(ISD::FRAME_TO_ARGS_OFFSET, MVT::i64, Custom);