[llvm-commits] [llvm] r67144 - in /llvm/branches/Apple/Dib: lib/Target/X86/X86Instr64bit.td lib/Transforms/IPO/DeadArgumentElimination.cpp lib/Transforms/Scalar/LoopStrengthReduce.cpp test/CodeGen/Generic/2009-03-17-LSR-APInt.ll test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
Bill Wendling
isanbard at gmail.com
Tue Mar 17 17:48:45 PDT 2009
Author: void
Date: Tue Mar 17 19:48:45 2009
New Revision: 67144
URL: http://llvm.org/viewvc/llvm-project?rev=67144&view=rev
Log:
--- Merging (from foreign repository) r67134 into '.':
A test/CodeGen/Generic/2009-03-17-LSR-APInt.ll
U lib/Transforms/Scalar/LoopStrengthReduce.cpp
LSR shouldn't ever try to hack on integer IV's larger than 64-bits. Right now
it is not APInt clean, but even when it is it needs to be evaluated carefully
to determine whether it is actually profitable.
This fixes a crash on PR3806
--- Merging (from foreign repository) r67139 into '.':
A test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
U lib/Transforms/IPO/DeadArgumentElimination.cpp
Skipped missing target: 'test/CodeGen/X86/call-imm.ll'
Fix PR3807 by inserting 'insertelement' instructions in the normal dest of
an invoke instead of after the invoke (in its block), which is invalid.
--- Merging (from foreign repository) r67142 into '.':
U lib/Target/X86/X86Instr64bit.td
Disable the "call to immediate" optimization on x86-64. It is
not safe in general because the immediate could be an arbitrary
value that does not fit in a 32-bit pcrel displacement.
Conservatively fall back to loading the value into a register
and calling through it.
We still do the optzn on X86-32.
Added:
llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-03-17-LSR-APInt.ll
llvm/branches/Apple/Dib/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
Modified:
llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td
llvm/branches/Apple/Dib/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td?rev=67144&r1=67143&r2=67144&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td Tue Mar 17 19:48:45 2009
@@ -109,9 +109,13 @@
XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS],
Uses = [RSP] in {
+
+ // NOTE: this pattern doesn't match "X86call imm", because we do not know
+ // that the offset between an arbitrary immediate and the call will fit in
+ // the 32-bit pcrel field that we have.
def CALL64pcrel32 : I<0xE8, RawFrm,
(outs), (ins i64i32imm:$dst, variable_ops),
- "call\t${dst:call}", [(X86call imm:$dst)]>,
+ "call\t${dst:call}", []>,
Requires<[In64BitMode]>;
def CALL64r : I<0xFF, MRM2r, (outs), (ins GR64:$dst, variable_ops),
"call\t{*}$dst", [(X86call GR64:$dst)]>;
Modified: llvm/branches/Apple/Dib/lib/Transforms/IPO/DeadArgumentElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/IPO/DeadArgumentElimination.cpp?rev=67144&r1=67143&r2=67144&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/IPO/DeadArgumentElimination.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/IPO/DeadArgumentElimination.cpp Tue Mar 17 19:48:45 2009
@@ -798,9 +798,13 @@
// Replace by null for now.
Call->replaceAllUsesWith(Constant::getNullValue(Call->getType()));
} else {
- assert(isa<StructType>(RetTy) && "Return type changed, but not into a"
- "void. The old return type must have"
- "been a struct!");
+ assert(isa<StructType>(RetTy) &&
+ "Return type changed, but not into a void. The old return type"
+ " must have been a struct!");
+ Instruction *InsertPt = Call;
+ if (InvokeInst *II = dyn_cast<InvokeInst>(Call))
+ InsertPt = II->getNormalDest()->begin();
+
// We used to return a struct. Instead of doing smart stuff with all the
// uses of this struct, we will just rebuild it using
// extract/insertvalue chaining and let instcombine clean that up.
@@ -813,12 +817,13 @@
if (RetTypes.size() > 1)
// We are still returning a struct, so extract the value from our
// return value
- V = ExtractValueInst::Create(New, NewRetIdxs[i], "newret", Call);
+ V = ExtractValueInst::Create(New, NewRetIdxs[i], "newret",
+ InsertPt);
else
// We are now returning a single element, so just insert that
V = New;
// Insert the value at the old position
- RetVal = InsertValueInst::Create(RetVal, V, i, "oldret", Call);
+ RetVal = InsertValueInst::Create(RetVal, V, i, "oldret", InsertPt);
}
// Now, replace all uses of the old call instruction with the return
// struct we built
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=67144&r1=67143&r2=67144&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Mar 17 19:48:45 2009
@@ -550,6 +550,12 @@
SmallPtrSet<Instruction*,16> &Processed) {
if (!I->getType()->isInteger() && !isa<PointerType>(I->getType()))
return false; // Void and FP expressions cannot be reduced.
+
+ // LSR is not APInt clean, do not touch integers bigger than 64-bits.
+ if (I->getType()->isInteger() &&
+ I->getType()->getPrimitiveSizeInBits() > 64)
+ return false;
+
if (!Processed.insert(I))
return true; // Instruction already handled.
Added: llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-03-17-LSR-APInt.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-03-17-LSR-APInt.ll?rev=67144&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-03-17-LSR-APInt.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/Generic/2009-03-17-LSR-APInt.ll Tue Mar 17 19:48:45 2009
@@ -0,0 +1,92 @@
+; RUN: llvm-as < %s | llc
+; PR3806
+
+ %struct..0__pthread_mutex_s = type { i32, i32, i32, i32, i32, i32, %struct.__pthread_list_t }
+ %struct.Alignment = type { i32 }
+ %struct.QDesignerFormWindowInterface = type { %struct.QWidget }
+ %struct.QFont = type { %struct.QFontPrivate*, i32 }
+ %struct.QFontPrivate = type opaque
+ %"struct.QHash<QString,QList<QAbstractExtensionFactory*> >" = type { %"struct.QHash<QString,QList<QAbstractExtensionFactory*> >::._120" }
+ %"struct.QHash<QString,QList<QAbstractExtensionFactory*> >::._120" = type { %struct.QHashData* }
+ %struct.QHashData = type { %"struct.QHashData::Node"*, %"struct.QHashData::Node"**, %struct.Alignment, i32, i32, i16, i16, i32, i8 }
+ %"struct.QHashData::Node" = type { %"struct.QHashData::Node"*, i32 }
+ %"struct.QList<QAbstractExtensionFactory*>" = type { %"struct.QList<QAbstractExtensionFactory*>::._101" }
+ %"struct.QList<QAbstractExtensionFactory*>::._101" = type { %struct.QListData }
+ %struct.QListData = type { %"struct.QListData::Data"* }
+ %"struct.QListData::Data" = type { %struct.Alignment, i32, i32, i32, i8, [1 x i8*] }
+ %struct.QObject = type { i32 (...)**, %struct.QObjectData* }
+ %struct.QObjectData = type { i32 (...)**, %struct.QObject*, %struct.QObject*, %"struct.QList<QAbstractExtensionFactory*>", i32, i32 }
+ %struct.QPaintDevice.base = type { i32 (...)**, i16 }
+ %"struct.QPair<int,int>" = type { i32, i32 }
+ %struct.QPalette = type { %struct.QPalettePrivate*, i32 }
+ %struct.QPalettePrivate = type opaque
+ %struct.QRect = type { i32, i32, i32, i32 }
+ %struct.QWidget = type { %struct.QObject, %struct.QPaintDevice.base, %struct.QWidgetData* }
+ %struct.QWidgetData = type { i64, i32, %struct.Alignment, i8, i8, i16, %struct.QRect, %struct.QPalette, %struct.QFont, %struct.QRect }
+ %struct.__pthread_list_t = type { %struct.__pthread_list_t*, %struct.__pthread_list_t* }
+ %struct.pthread_attr_t = type { i64, [48 x i8] }
+ %struct.pthread_mutex_t = type { %struct..0__pthread_mutex_s }
+ %"struct.qdesigner_internal::Grid" = type { i32, i32, %struct.QWidget**, i8*, i8* }
+ %"struct.qdesigner_internal::GridLayout" = type { %"struct.qdesigner_internal::Layout", %"struct.QPair<int,int>", %"struct.qdesigner_internal::Grid"* }
+ %"struct.qdesigner_internal::Layout" = type { %struct.QObject, %"struct.QList<QAbstractExtensionFactory*>", %struct.QWidget*, %"struct.QHash<QString,QList<QAbstractExtensionFactory*> >", %struct.QWidget*, %struct.QDesignerFormWindowInterface*, i8, %"struct.QPair<int,int>", %struct.QRect, i8 }
+
+ at _ZL20__gthrw_pthread_oncePiPFvvE = alias weak i32 (i32*, void ()*)* @pthread_once ; <i32 (i32*, void ()*)*> [#uses=0]
+ at _ZL27__gthrw_pthread_getspecificj = alias weak i8* (i32)* @pthread_getspecific ; <i8* (i32)*> [#uses=0]
+ at _ZL27__gthrw_pthread_setspecificjPKv = alias weak i32 (i32, i8*)* @pthread_setspecific ; <i32 (i32, i8*)*> [#uses=0]
+ at _ZL22__gthrw_pthread_createPmPK14pthread_attr_tPFPvS3_ES3_ = alias weak i32 (i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)* @pthread_create ; <i32 (i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)*> [#uses=0]
+ at _ZL22__gthrw_pthread_cancelm = alias weak i32 (i64)* @pthread_cancel ; <i32 (i64)*> [#uses=0]
+ at _ZL26__gthrw_pthread_mutex_lockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_lock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+ at _ZL29__gthrw_pthread_mutex_trylockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_trylock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+ at _ZL28__gthrw_pthread_mutex_unlockP15pthread_mutex_t = alias weak i32 (%struct.pthread_mutex_t*)* @pthread_mutex_unlock ; <i32 (%struct.pthread_mutex_t*)*> [#uses=0]
+ at _ZL26__gthrw_pthread_mutex_initP15pthread_mutex_tPK19pthread_mutexattr_t = alias weak i32 (%struct.pthread_mutex_t*, %struct.Alignment*)* @pthread_mutex_init ; <i32 (%struct.pthread_mutex_t*, %struct.Alignment*)*> [#uses=0]
+ at _ZL26__gthrw_pthread_key_createPjPFvPvE = alias weak i32 (i32*, void (i8*)*)* @pthread_key_create ; <i32 (i32*, void (i8*)*)*> [#uses=0]
+ at _ZL26__gthrw_pthread_key_deletej = alias weak i32 (i32)* @pthread_key_delete ; <i32 (i32)*> [#uses=0]
+ at _ZL30__gthrw_pthread_mutexattr_initP19pthread_mutexattr_t = alias weak i32 (%struct.Alignment*)* @pthread_mutexattr_init ; <i32 (%struct.Alignment*)*> [#uses=0]
+ at _ZL33__gthrw_pthread_mutexattr_settypeP19pthread_mutexattr_ti = alias weak i32 (%struct.Alignment*, i32)* @pthread_mutexattr_settype ; <i32 (%struct.Alignment*, i32)*> [#uses=0]
+ at _ZL33__gthrw_pthread_mutexattr_destroyP19pthread_mutexattr_t = alias weak i32 (%struct.Alignment*)* @pthread_mutexattr_destroy ; <i32 (%struct.Alignment*)*> [#uses=0]
+
+define void @_ZN18qdesigner_internal10GridLayout9buildGridEv(%"struct.qdesigner_internal::GridLayout"* %this) nounwind {
+entry:
+ br label %bb44
+
+bb44: ; preds = %bb47, %entry
+ %indvar = phi i128 [ %indvar.next144, %bb47 ], [ 0, %entry ] ; <i128> [#uses=2]
+ br i1 false, label %bb46, label %bb47
+
+bb46: ; preds = %bb44
+ %tmp = shl i128 %indvar, 64 ; <i128> [#uses=1]
+ %tmp96 = and i128 %tmp, 79228162495817593519834398720 ; <i128> [#uses=0]
+ br label %bb47
+
+bb47: ; preds = %bb46, %bb44
+ %indvar.next144 = add i128 %indvar, 1 ; <i128> [#uses=1]
+ br label %bb44
+}
+
+declare i32 @pthread_once(i32*, void ()*)
+
+declare i8* @pthread_getspecific(i32)
+
+declare i32 @pthread_setspecific(i32, i8*)
+
+declare i32 @pthread_create(i64*, %struct.pthread_attr_t*, i8* (i8*)*, i8*)
+
+declare i32 @pthread_cancel(i64)
+
+declare i32 @pthread_mutex_lock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_trylock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_unlock(%struct.pthread_mutex_t*)
+
+declare i32 @pthread_mutex_init(%struct.pthread_mutex_t*, %struct.Alignment*)
+
+declare i32 @pthread_key_create(i32*, void (i8*)*)
+
+declare i32 @pthread_key_delete(i32)
+
+declare i32 @pthread_mutexattr_init(%struct.Alignment*)
+
+declare i32 @pthread_mutexattr_settype(%struct.Alignment*, i32)
+
+declare i32 @pthread_mutexattr_destroy(%struct.Alignment*)
Added: llvm/branches/Apple/Dib/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll?rev=67144&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/DeadArgElim/2009-03-17-MRE-Invoke.ll Tue Mar 17 19:48:45 2009
@@ -0,0 +1,15 @@
+; RUN: llvm-as < %s | opt -deadargelim | llvm-dis
+; PR3807
+
+define internal { i32, i32 } @foo() {
+ ret {i32,i32} {i32 42, i32 4}
+}
+
+define i32 @bar() {
+ %x = invoke {i32,i32} @foo() to label %T unwind label %T2
+T:
+ %y = extractvalue {i32,i32} %x, 1
+ ret i32 %y
+T2:
+ unreachable
+}
More information about the llvm-commits
mailing list