[llvm-commits] [llvm] r69333 - in /llvm/trunk/lib/Target: CBackend/CBackend.cpp MSIL/MSILWriter.cpp PowerPC/PPCISelDAGToDAG.cpp

Chris Lattner sabre at nondot.org
Thu Apr 16 17:26:12 PDT 2009


Author: lattner
Date: Thu Apr 16 19:26:12 2009
New Revision: 69333

URL: http://llvm.org/viewvc/llvm-project?rev=69333&view=rev
Log:
Fix some failures in targets on available_externally functions,
this fixes a crash on CodeGen/Generic/externally_available.ll
on ppc hosts.  Thanks to Nicholas L for pointing this out.

Modified:
    llvm/trunk/lib/Target/CBackend/CBackend.cpp
    llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
    llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=69333&r1=69332&r2=69333&view=diff

==============================================================================
--- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original)
+++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Thu Apr 16 19:26:12 2009
@@ -116,6 +116,11 @@
     virtual bool doInitialization(Module &M);
 
     bool runOnFunction(Function &F) {
+     // Do not codegen any 'available_externally' functions at all, they have
+     // definitions outside the translation unit.
+     if (F.hasAvailableExternallyLinkage())
+       return false;
+
       LI = &getAnalysis<LoopInfo>();
 
       // Get rid of intrinsics we can't handle.

Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=69333&r1=69332&r2=69333&view=diff

==============================================================================
--- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original)
+++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Thu Apr 16 19:26:12 2009
@@ -93,6 +93,12 @@
 
 bool MSILWriter::runOnFunction(Function &F) {
   if (F.isDeclaration()) return false;
+
+  // Do not codegen any 'available_externally' functions at all, they have
+  // definitions outside the translation unit.
+  if (F.hasAvailableExternallyLinkage())
+    return false;
+
   LInfo = &getAnalysis<LoopInfo>();
   printFunction(F);
   return false;

Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=69333&r1=69332&r2=69333&view=diff

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Thu Apr 16 19:26:12 2009
@@ -25,6 +25,7 @@
 #include "llvm/CodeGen/SelectionDAGISel.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Constants.h"
+#include "llvm/Function.h"
 #include "llvm/GlobalValue.h"
 #include "llvm/Intrinsics.h"
 #include "llvm/Support/Debug.h"
@@ -49,6 +50,11 @@
         PPCSubTarget(*TM.getSubtargetImpl()) {}
     
     virtual bool runOnFunction(Function &Fn) {
+      // Do not codegen any 'available_externally' functions at all, they have
+      // definitions outside the translation unit.
+      if (Fn.hasAvailableExternallyLinkage())
+        return false;
+
       // Make sure we re-emit a set of the global base reg if necessary
       GlobalBaseReg = 0;
       SelectionDAGISel::runOnFunction(Fn);





More information about the llvm-commits mailing list