[llvm] r278375 - [Hexagon] Skip byval arguments when checking parameter attributes

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 11:15:16 PDT 2016


Author: kparzysz
Date: Thu Aug 11 13:15:16 2016
New Revision: 278375

URL: http://llvm.org/viewvc/llvm-project?rev=278375&view=rev
Log:
[Hexagon] Skip byval arguments when checking parameter attributes

>From the point of view of register assignment, byval parameters are
ignored: a byval parameter is not going to be assigned to a register,
and it will not affect the assignments of subsequent parameters.
When matching registers with parameters in the bit tracker, make sure
to skip byval parameters before advancing the registers.

Added:
    llvm/trunk/test/CodeGen/Hexagon/bit-skip-byval.ll
Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp

Modified: llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp?rev=278375&r1=278374&r2=278375&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonBitTracker.cpp Thu Aug 11 13:15:16 2016
@@ -60,13 +60,15 @@ HexagonEvaluator::HexagonEvaluator(const
     // Module::AnyPointerSize.
     if (Width == 0 || Width > 64)
       break;
+    AttributeSet Attrs = F.getAttributes();
+    if (Attrs.hasAttribute(AttrIdx, Attribute::ByVal))
+      continue;
     InPhysReg = getNextPhysReg(InPhysReg, Width);
     if (!InPhysReg)
       break;
     InVirtReg = getVirtRegFor(InPhysReg);
     if (!InVirtReg)
       continue;
-    AttributeSet Attrs = F.getAttributes();
     if (Attrs.hasAttribute(AttrIdx, Attribute::SExt))
       VRX.insert(std::make_pair(InVirtReg, ExtType(ExtType::SExt, Width)));
     else if (Attrs.hasAttribute(AttrIdx, Attribute::ZExt))

Added: llvm/trunk/test/CodeGen/Hexagon/bit-skip-byval.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/bit-skip-byval.ll?rev=278375&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/bit-skip-byval.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/bit-skip-byval.ll Thu Aug 11 13:15:16 2016
@@ -0,0 +1,11 @@
+; RUN: llc -march=hexagon < %s | FileCheck %s
+;
+; Either and or zxtb.
+; CHECK: r0 = and(r1, #255)
+
+%struct.t0 = type { i32 }
+
+define i32 @foo(%struct.t0* byval align 8 %s, i8 zeroext %t, i8 %u) #0 {
+  %a = zext i8 %u to i32
+  ret i32 %a
+}




More information about the llvm-commits mailing list