getFunctionAlignment should return log2 alignment.
authorEvan Cheng <evan.cheng@apple.com>
Fri, 2 Oct 2009 06:57:25 +0000 (06:57 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Fri, 2 Oct 2009 06:57:25 +0000 (06:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83242 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp

index a656ef93fe7fd12951aaafbd10e04fae2d6f8998..4fa24f341bf9587d0edd6e04bf6ffa125e12cd8e 100644 (file)
@@ -542,7 +542,7 @@ const char *ARMTargetLowering::getTargetNodeName(unsigned Opcode) const {
 
 /// getFunctionAlignment - Return the Log2 alignment of this function.
 unsigned ARMTargetLowering::getFunctionAlignment(const Function *F) const {
-  return getTargetMachine().getSubtarget<ARMSubtarget>().isThumb() ? 1 : 2;
+  return getTargetMachine().getSubtarget<ARMSubtarget>().isThumb() ? 0 : 1;
 }
 
 //===----------------------------------------------------------------------===//
index 64d9f16e594e9ef9deb7ccbac271910264d470f9..a441993d1b11651d603cba413042c701fd7360ac 100644 (file)
@@ -252,8 +252,9 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   printVisibility(CurrentFnName, F->getVisibility());
 
+  unsigned FnAlign = 1 << MF.getAlignment();  // MF alignment is log2.
   if (AFI->isThumbFunction()) {
-    EmitAlignment(MF.getAlignment(), F, AFI->getAlign());
+    EmitAlignment(FnAlign, F, AFI->getAlign());
     O << "\t.code\t16\n";
     O << "\t.thumb_func";
     if (Subtarget->isTargetDarwin())
@@ -261,7 +262,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     O << "\n";
     InCPMode = false;
   } else {
-    EmitAlignment(MF.getAlignment(), F);
+    EmitAlignment(FnAlign, F);
   }
 
   O << CurrentFnName << ":\n";