fix some bugs affecting functions with no arguments
authorRafael Espindola <rafael.espindola@gmail.com>
Fri, 6 Oct 2006 17:26:30 +0000 (17:26 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Fri, 6 Oct 2006 17:26:30 +0000 (17:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30767 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/ARM/call.ll

index 107ce5c543dd77e4ebe50099e5ca35354bf401fd..167c052c332af266e73a468679d3dc6eec000bcd 100644 (file)
@@ -181,6 +181,8 @@ public:
   }
   unsigned getStackSize(void) {
     int last = is_reg.size() - 1;
+    if (last < 0)
+      return 0;
     if (isRegister(last))
       return 0;
     return getOffset(last) + MVT::getSizeInBits(getType(last))/8;
@@ -193,7 +195,7 @@ public:
     last--;
     return last;
   }
-  unsigned lastRegNum(void) {
+  int lastRegNum(void) {
     int            l = lastRegArg();
     if (l < 0)
       return -1;
@@ -264,7 +266,7 @@ static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) {
   // Build a sequence of copy-to-reg nodes chained together with token chain
   // and flag operands which copy the outgoing args into the appropriate regs.
   SDOperand InFlag;
-  for (unsigned i = 0, e = Layout.lastRegArg(); i <= e; ++i) {
+  for (int i = 0, e = Layout.lastRegArg(); i <= e; ++i) {
     SDOperand     Arg = Op.getOperand(5+2*i);
     unsigned   RegNum = Layout.getRegisterNum(i);
     unsigned     Reg1 = regs[RegNum];
index cfffa99eb0bd9c4492c05716eb011cc2cd8a2e2a..890018396e85404ffb712981084fd5f8596502a2 100644 (file)
@@ -2,7 +2,9 @@
 void %f() {
 entry:
        call void %g( int 1, int 2, int 3, int 4 )
+       call void %h()
        ret void
 }
 
 declare void %g(int, int, int, int)
+declare void %h()