[arm fast-isel] Appease the machine verifier by using the proper register
authorChad Rosier <mcrosier@apple.com>
Wed, 7 Nov 2012 00:13:01 +0000 (00:13 +0000)
committerChad Rosier <mcrosier@apple.com>
Wed, 7 Nov 2012 00:13:01 +0000 (00:13 +0000)
classes.  For my test case the number of errors drop from 356 to 21.
Part of rdar://12594152

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167508 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMFastISel.cpp

index 89b85d09b729be98570e1f9ccd225aed2d2ab2dd..6611862ca0710d3014b2bf5fea12f944a44b74e4 100644 (file)
@@ -619,7 +619,10 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, EVT VT) {
 
   Reloc::Model RelocM = TM.getRelocationModel();
   bool IsIndirect = Subtarget->GVIsIndirectSymbol(GV, RelocM);
-  unsigned DestReg = createResultReg(TLI.getRegClassFor(VT));
+  const TargetRegisterClass *RC = isThumb2 ?
+    (const TargetRegisterClass*)&ARM::rGPRRegClass :
+    (const TargetRegisterClass*)&ARM::GPRRegClass;
+  unsigned DestReg = createResultReg(RC);
 
   // Use movw+movt when possible, it avoids constant pool entries.
   // Darwin targets don't support movt with Reloc::Static, see