[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp LowerAllocations.cpp LowerInvoke.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu May 5 23:48:34 PDT 2005



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.339 -> 1.340
LowerAllocations.cpp updated: 1.53 -> 1.54
LowerInvoke.cpp updated: 1.22 -> 1.23
---
Log message:

Preserve tail marker


---
Diffs of the changes:  (+7 -4)

 InstructionCombining.cpp |    2 ++
 LowerAllocations.cpp     |    3 ++-
 LowerInvoke.cpp          |    6 +++---
 3 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.339 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.340
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.339	Thu May  5 23:53:20 2005
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Fri May  6 01:48:21 2005
@@ -4232,6 +4232,8 @@
                         Args, Caller->getName(), Caller);
   } else {
     NC = new CallInst(Callee, Args, Caller->getName(), Caller);
+    if (cast<CallInst>(Caller)->isTailCall())
+      cast<CallInst>(NC)->setTailCall();
   }
 
   // Insert a cast of the return type as necessary...


Index: llvm/lib/Transforms/Scalar/LowerAllocations.cpp
diff -u llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.53 llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.54
--- llvm/lib/Transforms/Scalar/LowerAllocations.cpp:1.53	Thu Apr 21 18:45:12 2005
+++ llvm/lib/Transforms/Scalar/LowerAllocations.cpp	Fri May  6 01:48:21 2005
@@ -150,6 +150,7 @@
 
       // Create the call to Malloc...
       CallInst *MCall = new CallInst(MallocFunc, MallocArgs, "", I);
+      MCall->setTailCall();
 
       // Create a cast instruction to convert to the right type...
       Value *MCast;
@@ -180,7 +181,7 @@
        FreeArgs.push_back(Constant::getNullValue(FreeFTy->getParamType(i)));
 
       // Insert a call to the free function...
-      new CallInst(FreeFunc, FreeArgs, "", I);
+      (new CallInst(FreeFunc, FreeArgs, "", I))->setTailCall();
 
       // Delete the old free instruction
       I = --BBIL.erase(I);


Index: llvm/lib/Transforms/Scalar/LowerInvoke.cpp
diff -u llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.22 llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.23
--- llvm/lib/Transforms/Scalar/LowerInvoke.cpp:1.22	Mon May  2 09:47:42 2005
+++ llvm/lib/Transforms/Scalar/LowerInvoke.cpp	Fri May  6 01:48:21 2005
@@ -195,7 +195,7 @@
         Args[i] = ConstantExpr::getCast(cast<Constant>(Args[i]),
                                         FT->getParamType(i));
 
-    new CallInst(WriteFn, Args, "", IB);
+    (new CallInst(WriteFn, Args, "", IB))->setTailCall();
   }
 }
 
@@ -225,7 +225,7 @@
       writeAbortMessage(UI);
 
       // Insert a call to abort()
-      new CallInst(AbortFn, std::vector<Value*>(), "", UI);
+      (new CallInst(AbortFn, std::vector<Value*>(), "", UI))->setTailCall();
 
       // Insert a return instruction.  This really should be a "barrier", as it
       // is unreachable.
@@ -375,7 +375,7 @@
     writeAbortMessage(RI);
 
     // Insert a call to abort()
-    new CallInst(AbortFn, std::vector<Value*>(), "", RI);
+    (new CallInst(AbortFn, std::vector<Value*>(), "", RI))->setTailCall();
   }
 
   return Changed;






More information about the llvm-commits mailing list