[llvm] r197520 - Assert that the last operand is actually EFLAGS

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Dec 17 12:28:22 PST 2013


Author: dexonsmith
Date: Tue Dec 17 14:28:21 2013
New Revision: 197520

URL: http://llvm.org/viewvc/llvm-project?rev=197520&view=rev
Log:
Assert that the last operand is actually EFLAGS

This is another follow-up to r197503, after a post-commit review by
Andy.

<rdar://problem/15627766>

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=197520&r1=197519&r2=197520&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Dec 17 14:28:21 2013
@@ -15338,6 +15338,12 @@ X86TargetLowering::EmitVAStartSaveXMMReg
     MBB->addSuccessor(EndMBB);
   }
 
+  // Make sure the last operand is EFLAGS, which gets clobbered by the branch
+  // that was just emitted, but clearly shouldn't be "saved".
+  assert((MI->getNumOperands() <= 3 ||
+          !MI->getOperand(MI->getNumOperands() - 1).isReg() ||
+          MI->getOperand(MI->getNumOperands() - 1).getReg() == X86::EFLAGS)
+         && "Expected last argument to be EFLAGS");
   unsigned MOVOpc = Subtarget->hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr;
   // In the XMM save block, save all the XMM argument registers.
   for (int i = 3, e = MI->getNumOperands() - 1; i != e; ++i) {





More information about the llvm-commits mailing list