[llvm-commits] [llvm] r65958 - in /llvm/branches/Apple/Dib: lib/Transforms/IPO/StripSymbols.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
Bill Wendling
isanbard at gmail.com
Tue Mar 3 11:12:01 PST 2009
Author: void
Date: Tue Mar 3 13:12:00 2009
New Revision: 65958
URL: http://llvm.org/viewvc/llvm-project?rev=65958&view=rev
Log:
--- Merging (from foreign repository) r65889 into '.':
U lib/Transforms/IPO/StripSymbols.cpp
Remove all dbg symobls, including those with circular references.
This is ugly, but I can't figure out a quick way out of this.
--- Merging (from foreign repository) r65902 into '.':
A test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
U lib/Transforms/Scalar/LoopIndexSplit.cpp
If branch conditions' one successor is dominating another non-latch successor
then this loop's iteration space can not be restricted. In this example block
bb5 is always executed.
--- Merging (from foreign repository) r65915 into '.':
U lib/Transforms/Scalar/InstructionCombining.cpp
Don't count DebugInfo instructions in another limit
(lest they affect codegen).
Added:
llvm/branches/Apple/Dib/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
Modified:
llvm/branches/Apple/Dib/lib/Transforms/IPO/StripSymbols.cpp
llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/branches/Apple/Dib/lib/Transforms/IPO/StripSymbols.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/IPO/StripSymbols.cpp?rev=65958&r1=65957&r2=65958&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/IPO/StripSymbols.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/IPO/StripSymbols.cpp Tue Mar 3 13:12:00 2009
@@ -185,6 +185,21 @@
// llvm.dbg.region.end calls, and any globals they point to if now dead.
bool StripDebugInfo(Module &M) {
+ SmallPtrSet<const GlobalValue*, 8> llvmUsedValues;
+ findUsedValues(M, llvmUsedValues);
+
+ // Delete all dbg variables.
+ for (Module::global_iterator I = M.global_begin(), E = M.global_end();
+ I != E; ++I) {
+ GlobalVariable *GV = dyn_cast<GlobalVariable>(I);
+ if (!GV) continue;
+ if (!GV->use_empty() && llvmUsedValues.count(I) == 0) {
+ if (strncmp(GV->getNameStart(), "llvm.dbg", 8) == 0) {
+ GV->replaceAllUsesWith(UndefValue::get(GV->getType()));
+ }
+ }
+ }
+
Function *FuncStart = M.getFunction("llvm.dbg.func.start");
Function *StopPoint = M.getFunction("llvm.dbg.stoppoint");
Function *RegionStart = M.getFunction("llvm.dbg.region.start");
@@ -263,9 +278,6 @@
Declare->eraseFromParent();
}
- SmallPtrSet<const GlobalValue*, 8> llvmUsedValues;
- findUsedValues(M, llvmUsedValues);
-
// llvm.dbg.compile_units and llvm.dbg.subprograms are marked as linkonce
// but since we are removing all debug information, make them internal now.
// FIXME: Use private linkage maybe?
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp?rev=65958&r1=65957&r2=65958&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp Tue Mar 3 13:12:00 2009
@@ -11422,12 +11422,18 @@
SI.getAlignment()))
SI.setAlignment(KnownAlign);
- // Do really simple DSE, to catch cases where there are several consequtive
+ // Do really simple DSE, to catch cases where there are several consecutive
// stores to the same location, separated by a few arithmetic operations. This
// situation often occurs with bitfield accesses.
BasicBlock::iterator BBI = &SI;
for (unsigned ScanInsts = 6; BBI != SI.getParent()->begin() && ScanInsts;
--ScanInsts) {
+ // Don't count debug info directives, lest they affect codegen.
+ if (isa<DbgInfoIntrinsic>(BBI)) {
+ ScanInsts++;
+ --BBI;
+ continue;
+ }
--BBI;
if (StoreInst *PrevSI = dyn_cast<StoreInst>(BBI)) {
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=65958&r1=65957&r2=65958&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Mar 3 13:12:00 2009
@@ -535,6 +535,21 @@
BasicBlock *ExitingBlock = ExitCondition->getParent();
if (!cleanBlock(ExitingBlock)) return false;
+ // If the merge point for BR is not loop latch then skip this loop.
+ if (BR->getSuccessor(0) != Latch) {
+ DominanceFrontier::iterator DF0 = DF->find(BR->getSuccessor(0));
+ assert (DF0 != DF->end() && "Unable to find dominance frontier");
+ if (!DF0->second.count(Latch))
+ return false;
+ }
+
+ if (BR->getSuccessor(1) != Latch) {
+ DominanceFrontier::iterator DF1 = DF->find(BR->getSuccessor(1));
+ assert (DF1 != DF->end() && "Unable to find dominance frontier");
+ if (!DF1->second.count(Latch))
+ return false;
+ }
+
// Verify that loop exiting block has only two predecessor, where one pred
// is split condition block. The other predecessor will become exiting block's
// dominator after CFG is updated. TODO : Handle CFG's where exiting block has
Added: llvm/branches/Apple/Dib/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll?rev=65958&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/LoopIndexSplit/2009-03-02-UpdateIterationSpace-crash.ll Tue Mar 3 13:12:00 2009
@@ -0,0 +1,64 @@
+; RUN: llvm-as < %s | opt -loop-index-split -disable-output
+ %struct.CGPoint = type { double, double }
+ %struct.IBCFMutableDictionary = type { %struct.NSMutableArray, %struct.__CFDictionary*, %struct.NSSortDescriptor*, %struct.NSSortDescriptor* }
+ %struct.IBInspectorMode = type opaque
+ %struct.IBInspectorModeView = type { %struct.NSView, %struct.NSArray*, %struct.IBCFMutableDictionary*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.IBInspectorMode*, %struct.objc_selector*, %struct.NSObject* }
+ %struct.NSArray = type { %struct.NSObject }
+ %struct.NSImage = type { %struct.NSObject, %struct.NSArray*, %struct.CGPoint, %struct.__imageFlags, %struct.NSObject*, %struct._NSImageAuxiliary* }
+ %struct.NSMutableArray = type { %struct.NSArray }
+ %struct.NSObject = type { %struct.objc_class* }
+ %struct.NSRect = type { %struct.CGPoint, %struct.CGPoint }
+ %struct.NSResponder = type { %struct.NSObject, %struct.NSObject* }
+ %struct.NSSortDescriptor = type { %struct.NSObject, i64, %struct.NSArray*, %struct.objc_selector*, %struct.NSObject* }
+ %struct.NSURL = type { %struct.NSObject, %struct.NSArray*, %struct.NSURL*, i8*, i8* }
+ %struct.NSView = type { %struct.NSResponder, %struct.NSRect, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSWindow*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct.NSObject*, %struct._NSViewAuxiliary*, %struct._VFlags, %struct.__VFlags2 }
+ %struct.NSWindow = type { %struct.NSResponder, %struct.NSRect, %struct.NSObject*, %struct.NSObject*, %struct.NSResponder*, %struct.NSView*, %struct.NSView*, %struct.NSObject*, %struct.NSObject*, i32, i64, i32, %struct.NSArray*, %struct.NSObject*, i8, i8, i8, i8, i8*, i8*, %struct.NSImage*, i32, %struct.NSMutableArray*, %struct.NSURL*, %struct.CGPoint*, %struct.NSArray*, %struct.NSArray*, %struct.__wFlags, %struct.NSObject*, %struct.NSView*, %struct.NSWindowAuxiliary* }
+ %struct.NSWindowAuxiliary = type opaque
+ %struct._NSImageAuxiliary = type opaque
+ %struct._NSViewAuxiliary = type opaque
+ %struct._VFlags = type <{ i8, i8, i8, i8 }>
+ %struct.__CFDictionary = type opaque
+ %struct.__VFlags2 = type <{ i32 }>
+ %struct.__imageFlags = type <{ i8, [3 x i8] }>
+ %struct.__wFlags = type <{ i8, i8, i8, i8, i8, i8, i8, i8 }>
+ %struct.objc_class = type opaque
+ %struct.objc_selector = type opaque
+
+define %struct.NSArray* @"\01-[IBInspectorModeView calculateModeRects]"(%struct.IBInspectorModeView* %self, %struct.objc_selector* %_cmd) optsize ssp {
+entry:
+ br i1 false, label %bb7, label %bb
+
+bb: ; preds = %entry
+ br i1 false, label %bb.nph, label %bb7.loopexit
+
+bb.nph: ; preds = %bb
+ br label %bb1
+
+bb1: ; preds = %bb6, %bb.nph
+ %midx.01 = phi i64 [ %3, %bb6 ], [ 0, %bb.nph ] ; <i64> [#uses=3]
+ %0 = icmp sge i64 %midx.01, 0 ; <i1> [#uses=1]
+ %1 = icmp sle i64 %midx.01, 0 ; <i1> [#uses=1]
+ %2 = and i1 %0, %1 ; <i1> [#uses=1]
+ br i1 %2, label %bb4, label %bb5
+
+bb4: ; preds = %bb1
+ br label %bb5
+
+bb5: ; preds = %bb4, %bb1
+ %modeWidth.0 = phi double [ 0.000000e+00, %bb1 ], [ 0.000000e+00, %bb4 ] ; <double> [#uses=0]
+ %3 = add i64 %midx.01, 1 ; <i64> [#uses=1]
+ br label %bb6
+
+bb6: ; preds = %bb5
+ %4 = icmp slt i64 0, 0 ; <i1> [#uses=1]
+ br i1 %4, label %bb1, label %bb6.bb7.loopexit_crit_edge
+
+bb6.bb7.loopexit_crit_edge: ; preds = %bb6
+ br label %bb7.loopexit
+
+bb7.loopexit: ; preds = %bb6.bb7.loopexit_crit_edge, %bb
+ br label %bb7
+
+bb7: ; preds = %bb7.loopexit, %entry
+ ret %struct.NSArray* null
+}
More information about the llvm-commits
mailing list