[llvm-commits] CVS: llvm/lib/Transforms/Utils/InlineFunction.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Oct 13 20:12:01 PDT 2003


Changes in directory llvm/lib/Transforms/Utils:

InlineFunction.cpp updated: 1.12 -> 1.13

---
Log message:

Do not move variable sized allocations to the top of the caller, which might
break dominance relationships, and is otherwise bad.  This fixes bug: 
Inline/2003-10-13-AllocaDominanceProblem.ll.  This also fixes miscompilation 
of 3 176.gcc source files (reload1.c, global.c, flow.c)


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

Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.12 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.13
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.12	Mon Oct  6 10:23:43 2003
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp	Mon Oct 13 20:11:07 2003
@@ -175,13 +175,11 @@
     
     for (BasicBlock::iterator I = LastBlock->begin(), E = LastBlock->end();
          I != E; )
-      if (AllocaInst *AI = dyn_cast<AllocaInst>(I)) {
-        ++I;  // Move to the next instruction
-        LastBlock->getInstList().remove(AI);
-        Caller->front().getInstList().insert(InsertPoint, AI);      
-      } else {
-        ++I;
-      }
+      if (AllocaInst *AI = dyn_cast<AllocaInst>(I++))
+        if (isa<Constant>(AI->getArraySize())) {
+          LastBlock->getInstList().remove(AI);
+          Caller->front().getInstList().insert(InsertPoint, AI);      
+        }
   }
 
   // If we just inlined a call due to an invoke instruction, scan the inlined





More information about the llvm-commits mailing list