[PATCH] D45560: [RISCV] Change function alignment to 4 bytes, and 2 bytes for RVC

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 04:34:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL329899: [RISCV] Change function alignment to 4 bytes, and 2 bytes for RVC (authored by shiva, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D45560?vs=142136&id=142148#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D45560

Files:
  llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/trunk/test/CodeGen/RISCV/align.ll


Index: llvm/trunk/test/CodeGen/RISCV/align.ll
===================================================================
--- llvm/trunk/test/CodeGen/RISCV/align.ll
+++ llvm/trunk/test/CodeGen/RISCV/align.ll
@@ -0,0 +1,13 @@
+; RUN: llc -mtriple=riscv32 -verify-machineinstrs < %s \
+; RUN:   | FileCheck %s -check-prefix=RV32I
+; RUN: llc -mtriple=riscv32 -mattr=+c -verify-machineinstrs < %s \
+; RUN:   | FileCheck %s -check-prefix=RV32C
+
+define void @foo() {
+;RV32I: .p2align 2
+;RV32I: foo:
+;RV32C: .p2align 1
+;RV32C: foo:
+entry:
+  ret void
+}
Index: llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/trunk/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -142,8 +142,9 @@
   setBooleanContents(ZeroOrOneBooleanContent);
 
   // Function alignments (log2).
-  setMinFunctionAlignment(3);
-  setPrefFunctionAlignment(3);
+  unsigned FunctionAlignment = Subtarget.hasStdExtC() ? 1 : 2;
+  setMinFunctionAlignment(FunctionAlignment);
+  setPrefFunctionAlignment(FunctionAlignment);
 
   // Effectively disable jump table generation.
   setMinimumJumpTableEntries(INT_MAX);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45560.142148.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180412/8f1d1a26/attachment.bin>


More information about the llvm-commits mailing list