From isanbard at gmail.com Mon Feb 9 00:42:41 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 06:42:41 -0000
Subject: [llvm-commits] [llvm] r64119 - /llvm/trunk/utils/buildit/build_llvm
Message-ID: <200902090642.n196gfuq003849@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 00:42:40 2009
New Revision: 64119
URL: http://llvm.org/viewvc/llvm-project?rev=64119&view=rev
Log:
Strip the LTO dylib.
Modified:
llvm/trunk/utils/buildit/build_llvm
Modified: llvm/trunk/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/buildit/build_llvm?rev=64119&r1=64118&r2=64119&view=diff
==============================================================================
--- llvm/trunk/utils/buildit/build_llvm (original)
+++ llvm/trunk/utils/buildit/build_llvm Mon Feb 9 00:42:40 2009
@@ -204,6 +204,7 @@
cd $DEST_DIR$DEST_ROOT
mkdir -p $DT_HOME/lib
mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
+strip -S lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
rm -f lib/libLTO.a lib/libLTO.la
# Compress manpages
From isanbard at gmail.com Mon Feb 9 00:43:10 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 06:43:10 -0000
Subject: [llvm-commits] [llvm] r64120 -
/llvm/branches/Apple/Dib/utils/buildit/build_llvm
Message-ID: <200902090643.n196hAjH003872@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 00:43:10 2009
New Revision: 64120
URL: http://llvm.org/viewvc/llvm-project?rev=64120&view=rev
Log:
Strip the LTO dylib.
Modified:
llvm/branches/Apple/Dib/utils/buildit/build_llvm
Modified: llvm/branches/Apple/Dib/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/utils/buildit/build_llvm?rev=64120&r1=64119&r2=64120&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/utils/buildit/build_llvm (original)
+++ llvm/branches/Apple/Dib/utils/buildit/build_llvm Mon Feb 9 00:43:10 2009
@@ -204,6 +204,7 @@
cd $DEST_DIR$DEST_ROOT
mkdir -p $DT_HOME/lib
mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
+strip -S lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
rm -f lib/libLTO.a lib/libLTO.la
# Compress manpages
From isanbard at gmail.com Mon Feb 9 00:54:13 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 06:54:13 -0000
Subject: [llvm-commits] [llvm] r64121 - /llvm/tags/Apple/llvmCore-2095.1/
Message-ID: <200902090654.n196sDga004229@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 00:54:13 2009
New Revision: 64121
URL: http://llvm.org/viewvc/llvm-project?rev=64121&view=rev
Log:
Creating llvmCore-2095.1 from llvmCore-2095.
Added:
llvm/tags/Apple/llvmCore-2095.1/
- copied from r64120, llvm/tags/Apple/llvmCore-2095/
From isanbard at gmail.com Mon Feb 9 00:54:57 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 06:54:57 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r64122 -
/llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/
Message-ID: <200902090654.n196sv88004262@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 00:54:57 2009
New Revision: 64122
URL: http://llvm.org/viewvc/llvm-project?rev=64122&view=rev
Log:
Creating llvmgcc42-2095.1 from llvmgcc42-2095.
Added:
llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/
- copied from r64121, llvm-gcc-4.2/tags/Apple/llvmgcc42-2095/
From isanbard at gmail.com Mon Feb 9 00:57:57 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 06:57:57 -0000
Subject: [llvm-commits] [llvm] r64123 -
/llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm
Message-ID: <200902090657.n196vviN004366@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 00:57:56 2009
New Revision: 64123
URL: http://llvm.org/viewvc/llvm-project?rev=64123&view=rev
Log:
- Make sure the 'strip' command has .so files to strip.
- Don't run 'lipo' on scripts.
- Strip the libLTO.dylib dylib.
Modified:
llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm
Modified: llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm
URL: http://llvm.org/viewvc/llvm-project/llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm?rev=64123&r1=64122&r2=64123&view=diff
==============================================================================
--- llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm (original)
+++ llvm/tags/Apple/llvmCore-2095.1/utils/buildit/build_llvm Mon Feb 9 00:57:56 2009
@@ -176,7 +176,9 @@
if [ "x$LLVM_DEBUG" != "x1" ]; then
# Strip local symbols from llvm libraries.
strip -S $DEST_DIR$DEST_ROOT/lib/*.[oa]
- strip -Sx $DEST_DIR$DEST_ROOT/lib/*.so
+ for f in `ls $DEST_DIR$DEST_ROOT/lib/*.so`; do
+ strip -Sx $f
+ done
fi
# Copy over the tblgen utility.
@@ -184,21 +186,25 @@
# Remove .dir files
cd $DEST_DIR$DEST_ROOT
-rm bin/.dir etc/llvm/.dir lib/.dir
+rm -f bin/.dir etc/llvm/.dir lib/.dir
# Remove PPC64 fat slices.
cd $DEST_DIR$DEST_ROOT/bin
if [ $MACOSX_DEPLOYMENT_TARGET = "10.4" ]; then
- find . -perm 755 -type f -exec lipo -extract ppc -extract i386 {} -output {} \;
+ find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \
+ -exec lipo -extract ppc -extract i386 {} -output {} \;
elif [ $MACOSX_DEPLOYMENT_TARGET = "10.5" ]; then
- find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 {} -output {} \;
+ find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \
+ -exec lipo -extract ppc7400 -extract i386 {} -output {} \;
else
- find . -perm 755 -type f -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \;
+ find . -perm 755 -type f \! \( -name '*gccas' -o -name '*gccld' -o -name llvm-config \) \
+ -exec lipo -extract ppc7400 -extract i386 -extract x86_64 {} -output {} \;
fi
cd $DEST_DIR$DEST_ROOT
mkdir -p $DT_HOME/lib
mv lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
+strip -S lib/libLTO.dylib $DT_HOME/lib/libLTO.dylib
rm -f lib/libLTO.a lib/libLTO.la
# Compress manpages
From evan.cheng at apple.com Mon Feb 9 01:14:22 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 07:14:22 -0000
Subject: [llvm-commits] [llvm] r64124 - in /llvm/trunk: include/llvm/Target/
lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/
lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/X86/ lib/Target/XCore/
Message-ID: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 01:14:22 2009
New Revision: 64124
URL: http://llvm.org/viewvc/llvm-project?rev=64124&view=rev
Log:
Turns out AnalyzeBranch can modify the mbb being analyzed. This is a nasty
suprise to some callers, e.g. register coalescer. For now, add an parameter
that tells AnalyzeBranch whether it's safe to modify the mbb. A better
solution is out there, but I don't have time to deal with it right now.
Modified:
llvm/trunk/include/llvm/Target/TargetInstrInfo.h
llvm/trunk/lib/CodeGen/BranchFolding.cpp
llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp
llvm/trunk/lib/Target/ARM/ARMInstrInfo.h
llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp
llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.h
llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp
llvm/trunk/lib/Target/Mips/MipsInstrInfo.h
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
llvm/trunk/lib/Target/X86/X86InstrInfo.h
llvm/trunk/lib/Target/XCore/XCoreInstrInfo.cpp
llvm/trunk/lib/Target/XCore/XCoreInstrInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -195,9 +195,13 @@
/// Note that RemoveBranch and InsertBranch must be implemented to support
/// cases where this method returns success.
///
+ /// If AllowModify is true, then this routine is allowed to modify the basic
+ /// block (e.g. delete instructions after the unconditional branch).
+ ///
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify = false) const {
return true;
}
Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Mon Feb 9 01:14:22 2009
@@ -191,7 +191,7 @@
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; I++) {
MachineBasicBlock *MBB = I, *TBB = 0, *FBB = 0;
SmallVector Cond;
- if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond))
+ if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond, true))
EverMadeChange |= MBB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty());
EverMadeChange |= OptimizeImpDefsBlock(MBB);
}
@@ -434,7 +434,7 @@
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
if (I != MF->end() &&
- !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond)) {
+ !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond, true)) {
MachineBasicBlock *NextBB = I;
if (TBB == NextBB && !Cond.empty() && !FBB) {
if (!TII->ReverseBranchCondition(Cond)) {
@@ -711,7 +711,7 @@
continue;
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
- if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond)) {
+ if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond, true)) {
// Failing case: IBB is the target of a cbr, and
// we cannot reverse the branch.
SmallVector NewCond(Cond);
@@ -845,7 +845,7 @@
bool BranchFolder::CanFallThrough(MachineBasicBlock *CurBB) {
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
- bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond);
+ bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond, true);
return CanFallThrough(CurBB, CurUnAnalyzable, TBB, FBB, Cond);
}
@@ -910,7 +910,7 @@
MachineBasicBlock *PriorTBB = 0, *PriorFBB = 0;
SmallVector PriorCond;
bool PriorUnAnalyzable =
- TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond);
+ TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond, true);
if (!PriorUnAnalyzable) {
// If the CFG for the prior block has extra edges, remove them.
MadeChange |= PrevBB.CorrectExtraCFGEdges(PriorTBB, PriorFBB,
@@ -1023,7 +1023,7 @@
// Analyze the branch in the current block.
MachineBasicBlock *CurTBB = 0, *CurFBB = 0;
SmallVector CurCond;
- bool CurUnAnalyzable = TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond);
+ bool CurUnAnalyzable= TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond, true);
if (!CurUnAnalyzable) {
// If the CFG for the prior block has extra edges, remove them.
MadeChange |= MBB->CorrectExtraCFGEdges(CurTBB, CurFBB, !CurCond.empty());
Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -335,7 +335,8 @@
// Branch analysis.
bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -385,7 +386,8 @@
(LastOpc == ARM::B || LastOpc == ARM::tB)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
@@ -396,7 +398,8 @@
SecondLastOpc == ARM::BR_JTadd || SecondLastOpc==ARM::tBR_JTr) &&
(LastOpc == ARM::B || LastOpc == ARM::tB)) {
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return true;
}
Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -172,7 +172,8 @@
// Branch analysis.
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -321,8 +321,9 @@
// Branch analysis.
bool AlphaInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
- MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ MachineBasicBlock *&FBB,
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -373,7 +374,8 @@
LastInst->getOpcode() == Alpha::BR) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -83,7 +83,8 @@
bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
unsigned RemoveBranch(MachineBasicBlock &MBB) const;
void insertNoop(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI) const;
Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -524,7 +524,8 @@
bool
SPUInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -575,7 +576,8 @@
if (isUncondBranch(SecondLastInst) && isUncondBranch(LastInst)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.h (original)
+++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -100,7 +100,8 @@
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -453,7 +453,8 @@
bool MipsInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const
+ SmallVectorImpl &Cond,
+ bool AllowModify) const
{
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
@@ -525,7 +526,8 @@
if ((SecondLastOpc == Mips::J) && (LastOpc == Mips::J)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsInstrInfo.h (original)
+++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -166,7 +166,8 @@
/// Branch Analysis
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -204,7 +204,8 @@
// Branch analysis.
bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -253,7 +254,8 @@
LastInst->getOpcode() == PPC::B) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -104,7 +104,8 @@
// Branch analysis.
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -1488,7 +1488,8 @@
bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// Start from the bottom of the block and work up, examining the
// terminator instructions.
MachineBasicBlock::iterator I = MBB.end();
@@ -1504,6 +1505,11 @@
return true;
// Handle unconditional branches.
if (I->getOpcode() == X86::JMP) {
+ if (!AllowModify) {
+ TBB = I->getOperand(0).getMBB();
+ return false;
+ }
+
// If the block has any instructions after a JMP, delete them.
while (next(I) != MBB.end())
next(I)->eraseFromParent();
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Mon Feb 9 01:14:22 2009
@@ -323,7 +323,8 @@
virtual bool isUnpredicatedTerminator(const MachineInstr* MI) const;
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.cpp?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.cpp Mon Feb 9 01:14:22 2009
@@ -228,8 +228,9 @@
///
bool
XCoreInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
- MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ MachineBasicBlock *&FBB,
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -288,7 +289,8 @@
IsBRU(LastInst->getOpcode())) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/trunk/lib/Target/XCore/XCoreInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreInstrInfo.h?rev=64124&r1=64123&r2=64124&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreInstrInfo.h (original)
+++ llvm/trunk/lib/Target/XCore/XCoreInstrInfo.h Mon Feb 9 01:14:22 2009
@@ -56,7 +56,8 @@
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
From clattner at apple.com Mon Feb 9 01:20:57 2009
From: clattner at apple.com (Chris Lattner)
Date: Sun, 8 Feb 2009 23:20:57 -0800
Subject: [llvm-commits] [llvm] r64124 - in /llvm/trunk:
include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/
lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/Mips/
lib/Target/PowerPC/ lib/Target/X86/ lib/Target/XCore/
In-Reply-To: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
References: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
Message-ID: <1067F87A-9600-411A-810D-9D450ADC7C46@apple.com>
On Feb 8, 2009, at 11:14 PM, Evan Cheng wrote:
> Author: evancheng
> Date: Mon Feb 9 01:14:22 2009
> New Revision: 64124
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64124&view=rev
> Log:
> Turns out AnalyzeBranch can modify the mbb being analyzed. This is a
> nasty
> suprise to some callers, e.g. register coalescer. For now, add an
> parameter
> that tells AnalyzeBranch whether it's safe to modify the mbb. A better
> solution is out there, but I don't have time to deal with it right
> now.
Whoa, that's really not cool. *why* does analyze branch modify a
mbb? What breaks if that is disabled from all targets?
-chris
From evan.cheng at apple.com Mon Feb 9 02:37:45 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 08:37:45 -0000
Subject: [llvm-commits] [llvm] r64125 -
/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Message-ID: <200902090837.n198bjBE008601@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 02:37:45 2009
New Revision: 64125
URL: http://llvm.org/viewvc/llvm-project?rev=64125&view=rev
Log:
Fix another case ShortenDeadCopySrcLiveRange is shortening too much. No test case possible since I don't know what to grep for. :-(
Modified:
llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=64125&r1=64124&r2=64125&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Feb 9 02:37:45 2009
@@ -861,22 +861,29 @@
// If there is a last use in the same bb, we can't remove the live range.
// Shorten the live interval and return.
- if (TrimLiveIntervalToLastUse(CopyIdx, CopyMI->getParent(), li, LR))
+ MachineBasicBlock *CopyMBB = CopyMI->getParent();
+ if (TrimLiveIntervalToLastUse(CopyIdx, CopyMBB, li, LR))
return false;
+ MachineBasicBlock *StartMBB = li_->getMBBFromIndex(RemoveStart);
+ if (!isSameOrFallThroughBB(StartMBB, CopyMBB, tii_))
+ // If the live range starts in another mbb and the copy mbb is not a fall
+ // through mbb, then we can only cut the range from the beginning of the
+ // copy mbb.
+ RemoveStart = li_->getMBBStartIdx(CopyMBB) + 1;
+
if (LR->valno->def == RemoveStart) {
// If the def MI defines the val# and this copy is the only kill of the
// val#, then propagate the dead marker.
- if (!li.isOnlyLROfValNo(LR)) {
- if (li.isKill(LR->valno, RemoveEnd))
- li.removeKill(LR->valno, RemoveEnd);
- } else {
+ if (li.isOnlyLROfValNo(LR)) {
PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
++numDeadValNo;
}
+ if (li.isKill(LR->valno, RemoveEnd))
+ li.removeKill(LR->valno, RemoveEnd);
}
- removeRange(li, RemoveStart, LR->end, li_, tri_);
+ removeRange(li, RemoveStart, RemoveEnd, li_, tri_);
return removeIntervalIfEmpty(li, li_, tri_);
}
From evan.cheng at apple.com Mon Feb 9 02:41:58 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 9 Feb 2009 00:41:58 -0800
Subject: [llvm-commits] [llvm] r64124 - in /llvm/trunk:
include/llvm/Target/ lib/CodeGen/
lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/
lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/X86/
lib/Target/XCore/
In-Reply-To: <1067F87A-9600-411A-810D-9D450ADC7C46@apple.com>
References: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
<1067F87A-9600-411A-810D-9D450ADC7C46@apple.com>
Message-ID: <6EE4E128-338A-4737-AE0A-1359A9DE6318@apple.com>
On Feb 8, 2009, at 11:20 PM, Chris Lattner wrote:
>
> On Feb 8, 2009, at 11:14 PM, Evan Cheng wrote:
>
>> Author: evancheng
>> Date: Mon Feb 9 01:14:22 2009
>> New Revision: 64124
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=64124&view=rev
>> Log:
>> Turns out AnalyzeBranch can modify the mbb being analyzed. This is a
>> nasty
>> suprise to some callers, e.g. register coalescer. For now, add an
>> parameter
>> that tells AnalyzeBranch whether it's safe to modify the mbb. A
>> better
>> solution is out there, but I don't have time to deal with it right
>> now.
>
> Whoa, that's really not cool. *why* does analyze branch modify a
> mbb? What breaks if that is disabled from all targets?
It's trimming instructions in a mbb after an unconditional branch. I
don't know why that would happen but it does. I think it's branching
folding's job to trim those instructions. But I don't have the energy
to deal with that right now.
Evan
>
>
> -chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Mon Feb 9 02:45:40 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 08:45:40 -0000
Subject: [llvm-commits] [llvm] r64126 - in /llvm/trunk:
lib/CodeGen/LLVMTargetMachine.cpp test/CodeGen/ARM/lsr-code-insertion.ll
test/CodeGen/X86/2006-05-11-InstrSched.ll
test/CodeGen/X86/2009-02-07-CoalescerBug.ll
Message-ID: <200902090845.n198jefX011242@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 02:45:39 2009
New Revision: 64126
URL: http://llvm.org/viewvc/llvm-project?rev=64126&view=rev
Log:
Re-enable machine sinking pass now that the coalescer bugs and the AnalyzeBrnach bug are fixed.
Modified:
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll
llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
llvm/trunk/test/CodeGen/X86/2009-02-07-CoalescerBug.ll
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=64126&r1=64125&r2=64126&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Feb 9 02:45:39 2009
@@ -38,11 +38,6 @@
static cl::opt PrintGCInfo("print-gc", cl::Hidden,
cl::desc("Dump garbage collector data"));
-// Hidden options to help debugging
-static cl::opt
-EnableSinking("enable-sinking", cl::init(false), cl::Hidden,
- cl::desc("Perform sinking on machine code"));
-
// When this works it will be on by default.
static cl::opt
DisablePostRAScheduler("disable-post-RA-scheduler",
@@ -183,11 +178,10 @@
if (PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));
- if (!Fast)
+ if (!Fast) {
PM.add(createMachineLICMPass());
-
- if (EnableSinking)
PM.add(createMachineSinkingPass());
+ }
// Run pre-ra passes.
if (addPreRegAlloc(PM, Fast) && PrintMachineCode)
Modified: llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll?rev=64126&r1=64125&r2=64126&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/lsr-code-insertion.ll Mon Feb 9 02:45:39 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -stats |& grep {39.*Number of machine instrs printed}
+; RUN: llvm-as < %s | llc -stats |& grep {40.*Number of machine instrs printed}
; RUN: llvm-as < %s | llc -stats |& grep {.*Number of re-materialization}
; This test really wants to check that the resultant "cond_true" block only
; has a single store in it, and that cond_true55 only has code to materialize
Modified: llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll?rev=64126&r1=64125&r2=64126&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2006-05-11-InstrSched.ll Mon Feb 9 02:45:39 2009
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats -realign-stack=0 |&\
-; RUN: grep {asm-printer} | grep 32
+; RUN: grep {asm-printer} | grep 31
target datalayout = "e-p:32:32"
define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) nounwind {
Modified: llvm/trunk/test/CodeGen/X86/2009-02-07-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-02-07-CoalescerBug.ll?rev=64126&r1=64125&r2=64126&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-02-07-CoalescerBug.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2009-02-07-CoalescerBug.ll Mon Feb 9 02:45:39 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 -enable-sinking -relocation-model=pic -stats |& grep {Number of valno def marked dead} | grep 1
+; RUN: llvm-as < %s | llc -march=x86 -relocation-model=pic -stats |& grep {Number of valno def marked dead} | grep 1
; rdar://6566708
target triple = "i386-apple-darwin9.6"
From clattner at apple.com Mon Feb 9 02:56:06 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 9 Feb 2009 00:56:06 -0800
Subject: [llvm-commits] [llvm] r64124 - in /llvm/trunk:
include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/
lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PowerPC/
lib/Target/X86/ lib/Target/XCore/
In-Reply-To: <6EE4E128-338A-4737-AE0A-1359A9DE6318@apple.com>
References: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
<1067F87A-9600-411A-810D-9D450ADC7C46@apple.com>
<6EE4E128-338A-4737-AE0A-1359A9DE6318@apple.com>
Message-ID: <512664C1-FD05-4271-A5B1-2B9A2A85B962@apple.com>
On Feb 9, 2009, at 12:41 AM, Evan Cheng wrote:
> On Feb 8, 2009, at 11:20 PM, Chris Lattner wrote:
>> On Feb 8, 2009, at 11:14 PM, Evan Cheng wrote:
>>
>>> Author: evancheng
>>> Date: Mon Feb 9 01:14:22 2009
>>> New Revision: 64124
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=64124&view=rev
>>> Log:
>>> Turns out AnalyzeBranch can modify the mbb being analyzed. This is a
>>> nasty
>>> suprise to some callers, e.g. register coalescer. For now, add an
>>> parameter
>>> that tells AnalyzeBranch whether it's safe to modify the mbb. A
>>> better
>>> solution is out there, but I don't have time to deal with it right
>>> now.
>>
>> Whoa, that's really not cool. *why* does analyze branch modify a
>> mbb? What breaks if that is disabled from all targets?
>
> It's trimming instructions in a mbb after an unconditional branch. I
> don't know why that would happen but it does. I think it's branching
> folding's job to trim those instructions. But I don't have the energy
> to deal with that right now.
Ok no problem, please file a bugzilla, thanks!
-Chris
From baldrick at free.fr Mon Feb 9 03:40:15 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 09 Feb 2009 09:40:15 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r64130 - in /llvm-gcc-4.2/trunk/gcc:
llvm-convert.cpp llvm-internal.h
Message-ID: <200902090940.n199eHHF019770@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Feb 9 03:40:04 2009
New Revision: 64130
URL: http://llvm.org/viewvc/llvm-project?rev=64130&view=rev
Log:
Add support for FLOOR_DIV_EXPR. This is sometimes
produced by the Fortran front-end, see PR2437.
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-internal.h
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=64130&r1=64129&r2=64130&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Feb 9 03:40:04 2009
@@ -1050,6 +1050,7 @@
break;
case RDIV_EXPR: Result = EmitBinOp(exp, DestLoc, Instruction::FDiv); break;
case CEIL_DIV_EXPR: Result = EmitCEIL_DIV_EXPR(exp); break;
+ case FLOOR_DIV_EXPR: Result = EmitFLOOR_DIV_EXPR(exp); break;
case ROUND_DIV_EXPR: Result = EmitROUND_DIV_EXPR(exp); break;
case TRUNC_MOD_EXPR:
if (TYPE_UNSIGNED(TREE_TYPE(exp)))
@@ -3698,6 +3699,55 @@
return Builder.CreateAdd(CDiv, Offset, "cdiv");
}
+Value *TreeToLLVM::EmitFLOOR_DIV_EXPR(tree exp) {
+ // Notation: FLOOR_DIV_EXPR <-> FDiv, TRUNC_DIV_EXPR <-> Div.
+ Value *LHS = Emit(TREE_OPERAND(exp, 0), 0);
+ Value *RHS = Emit(TREE_OPERAND(exp, 1), 0);
+
+ // FDiv calculates LHS/RHS by rounding down to the nearest integer. In terms
+ // of Div this means if the values of LHS and RHS have the same sign or if LHS
+ // is zero, then FDiv necessarily equals Div; and
+ // LHS FDiv RHS = (LHS + Sign(RHS)) Div RHS - 1
+ // otherwise.
+
+ if (TYPE_UNSIGNED(TREE_TYPE(exp)))
+ // In the case of unsigned arithmetic, LHS and RHS necessarily have the
+ // same sign, so FDiv is the same as Div.
+ return Builder.CreateUDiv(LHS, RHS, "fdiv");
+
+ const Type *Ty = ConvertType(TREE_TYPE(exp));
+ Constant *Zero = ConstantInt::get(Ty, 0);
+ Constant *One = ConstantInt::get(Ty, 1);
+ Constant *MinusOne = ConstantInt::getAllOnesValue(Ty);
+
+ // In the case of signed arithmetic, we calculate FDiv as follows:
+ // LHS FDiv RHS = (LHS + Sign(RHS) * Offset) Div RHS - Offset,
+ // where Offset is 1 if LHS and RHS have opposite signs and LHS is
+ // not zero, and 0 otherwise.
+
+ // Determine the signs of LHS and RHS, and whether they have the same sign.
+ Value *LHSIsPositive = Builder.CreateICmpSGE(LHS, Zero);
+ Value *RHSIsPositive = Builder.CreateICmpSGE(RHS, Zero);
+ Value *SignsDiffer = Builder.CreateICmpNE(LHSIsPositive, RHSIsPositive);
+
+ // Offset equals 1 if LHS and RHS have opposite signs and LHS is not zero.
+ Value *LHSNotZero = Builder.CreateICmpNE(LHS, Zero);
+ Value *OffsetOne = Builder.CreateAnd(SignsDiffer, LHSNotZero);
+ // ... otherwise it is 0.
+ Value *Offset = Builder.CreateSelect(OffsetOne, One, Zero);
+
+ // Calculate Sign(RHS) ...
+ Value *SignRHS = Builder.CreateSelect(RHSIsPositive, One, MinusOne);
+ // ... and Sign(RHS) * Offset
+ Value *SignedOffset = CastToType(Instruction::SExt, OffsetOne, Ty);
+ SignedOffset = Builder.CreateAnd(SignRHS, SignedOffset);
+
+ // Return FDiv = (LHS + Sign(RHS) * Offset) Div RHS - Offset.
+ Value *FDiv = Builder.CreateAdd(LHS, SignedOffset);
+ FDiv = Builder.CreateSDiv(FDiv, RHS);
+ return Builder.CreateSub(FDiv, Offset, "fdiv");
+}
+
Value *TreeToLLVM::EmitROUND_DIV_EXPR(tree exp) {
// Notation: ROUND_DIV_EXPR <-> RDiv, TRUNC_DIV_EXPR <-> Div.
Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=64130&r1=64129&r2=64130&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Mon Feb 9 03:40:04 2009
@@ -515,6 +515,7 @@
unsigned Opc);
Value *EmitFLOOR_MOD_EXPR(tree_node *exp, const MemRef *DestLoc);
Value *EmitCEIL_DIV_EXPR(tree_node *exp);
+ Value *EmitFLOOR_DIV_EXPR(tree_node *exp);
Value *EmitROUND_DIV_EXPR(tree_node *exp);
// Exception Handling.
From baldrick at free.fr Mon Feb 9 03:41:50 2009
From: baldrick at free.fr (Duncan Sands)
Date: Mon, 09 Feb 2009 09:41:50 -0000
Subject: [llvm-commits] [llvm] r64131 -
/llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90
Message-ID: <200902090941.n199foxd019837@zion.cs.uiuc.edu>
Author: baldrick
Date: Mon Feb 9 03:41:49 2009
New Revision: 64131
URL: http://llvm.org/viewvc/llvm-project?rev=64131&view=rev
Log:
Testcase for PR2437.
Added:
llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90
Added: llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90?rev=64131&view=auto
==============================================================================
--- llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90 (added)
+++ llvm/trunk/test/FrontendFortran/2009-02-09-FloorDivExpr.f90 Mon Feb 9 03:41:49 2009
@@ -0,0 +1,32 @@
+! RUN: %llvmgcc -c %s
+! PR2437
+program main
+ implicit none
+ call build (77)
+contains
+ subroutine build (order)
+ integer :: order, i, j
+
+
+ call test (1, order, 3, (/ (i, i = 1, order, 3) /))
+ call test (order, 1, -3, (/ (i, i = order, 1, -3) /))
+
+ do j = -10, 10
+ call test (order + j, order, 5, (/ (i, i = order + j, order, 5) /))
+ call test (order + j, order, -5, (/ (i, i = order + j, order, -5) /))
+ end do
+
+ end subroutine build
+
+ subroutine test (from, to, step, values)
+ integer, dimension (:) :: values
+ integer :: from, to, step, last, i
+
+ last = 0
+ do i = from, to, step
+ last = last + 1
+ if (values (last) .ne. i) call abort
+ end do
+ if (size (values, dim = 1) .ne. last) call abort
+ end subroutine test
+end program main
From sabre at nondot.org Mon Feb 9 04:01:06 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 09 Feb 2009 10:01:06 -0000
Subject: [llvm-commits] [llvm] r64132 - /llvm/trunk/docs/LangRef.html
Message-ID: <200902091001.n19A1AQm020415@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Feb 9 04:00:56 2009
New Revision: 64132
URL: http://llvm.org/viewvc/llvm-project?rev=64132&view=rev
Log:
fix typo, patch by Jonathan Brandmeyer!
Modified:
llvm/trunk/docs/LangRef.html
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=64132&r1=64131&r2=64132&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Mon Feb 9 04:00:56 2009
@@ -1677,7 +1677,7 @@
references (with their equivalent as named type declarations) include:
- { \2 * } %x = type { %t* }
+ { \2 * } %x = type { %x* }
{ \2 }* %y = type { %y }*
\1* %z = type %z*
From clattner at apple.com Mon Feb 9 04:01:34 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 9 Feb 2009 02:01:34 -0800
Subject: [llvm-commits] Minor nitpick patch to LangRef
In-Reply-To: <1234135800.31978.4.camel@localhost>
References: <1234135800.31978.4.camel@localhost>
Message-ID: <4B6059EC-2196-4CE1-AE79-EC856EC333B6@apple.com>
On Feb 8, 2009, at 3:29 PM, Jonathan Brandmeyer wrote:
> Correct a nit in the Type Up-references documentation.
Thanks!
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090209/073509.html
From isanbard at gmail.com Mon Feb 9 04:54:08 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 10:54:08 -0000
Subject: [llvm-commits] [llvm] r64133 - in /llvm/branches/Apple/Dib:
include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/
lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/X86/
lib/Target/XCore/
Message-ID: <200902091054.n19As93U022438@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 04:54:06 2009
New Revision: 64133
URL: http://llvm.org/viewvc/llvm-project?rev=64133&view=rev
Log:
Pull r64124 into Dib:
Turns out AnalyzeBranch can modify the mbb being analyzed. This is a nasty
suprise to some callers, e.g. register coalescer. For now, add an parameter that
tells AnalyzeBranch whether it's safe to modify the mbb. A better solution is
out there, but I don't have time to deal with it right now.
Modified:
llvm/branches/Apple/Dib/include/llvm/Target/TargetInstrInfo.h
llvm/branches/Apple/Dib/lib/CodeGen/BranchFolding.cpp
llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.h
llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.h
llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.h
llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.h
llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.h
llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.h
llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.cpp
llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.h
Modified: llvm/branches/Apple/Dib/include/llvm/Target/TargetInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Target/TargetInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/Target/TargetInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/Target/TargetInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -195,9 +195,13 @@
/// Note that RemoveBranch and InsertBranch must be implemented to support
/// cases where this method returns success.
///
+ /// If AllowModify is true, then this routine is allowed to modify the basic
+ /// block (e.g. delete instructions after the unconditional branch).
+ ///
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify = false) const {
return true;
}
Modified: llvm/branches/Apple/Dib/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/BranchFolding.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/BranchFolding.cpp Mon Feb 9 04:54:06 2009
@@ -191,7 +191,7 @@
for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; I++) {
MachineBasicBlock *MBB = I, *TBB = 0, *FBB = 0;
SmallVector Cond;
- if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond))
+ if (!TII->AnalyzeBranch(*MBB, TBB, FBB, Cond, true))
EverMadeChange |= MBB->CorrectExtraCFGEdges(TBB, FBB, !Cond.empty());
EverMadeChange |= OptimizeImpDefsBlock(MBB);
}
@@ -434,7 +434,7 @@
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
if (I != MF->end() &&
- !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond)) {
+ !TII->AnalyzeBranch(*CurMBB, TBB, FBB, Cond, true)) {
MachineBasicBlock *NextBB = I;
if (TBB == NextBB && !Cond.empty() && !FBB) {
if (!TII->ReverseBranchCondition(Cond)) {
@@ -711,7 +711,7 @@
continue;
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
- if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond)) {
+ if (!TII->AnalyzeBranch(*PBB, TBB, FBB, Cond, true)) {
// Failing case: IBB is the target of a cbr, and
// we cannot reverse the branch.
SmallVector NewCond(Cond);
@@ -845,7 +845,7 @@
bool BranchFolder::CanFallThrough(MachineBasicBlock *CurBB) {
MachineBasicBlock *TBB = 0, *FBB = 0;
SmallVector Cond;
- bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond);
+ bool CurUnAnalyzable = TII->AnalyzeBranch(*CurBB, TBB, FBB, Cond, true);
return CanFallThrough(CurBB, CurUnAnalyzable, TBB, FBB, Cond);
}
@@ -910,7 +910,7 @@
MachineBasicBlock *PriorTBB = 0, *PriorFBB = 0;
SmallVector PriorCond;
bool PriorUnAnalyzable =
- TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond);
+ TII->AnalyzeBranch(PrevBB, PriorTBB, PriorFBB, PriorCond, true);
if (!PriorUnAnalyzable) {
// If the CFG for the prior block has extra edges, remove them.
MadeChange |= PrevBB.CorrectExtraCFGEdges(PriorTBB, PriorFBB,
@@ -1023,7 +1023,7 @@
// Analyze the branch in the current block.
MachineBasicBlock *CurTBB = 0, *CurFBB = 0;
SmallVector CurCond;
- bool CurUnAnalyzable = TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond);
+ bool CurUnAnalyzable= TII->AnalyzeBranch(*MBB, CurTBB, CurFBB, CurCond, true);
if (!CurUnAnalyzable) {
// If the CFG for the prior block has extra edges, remove them.
MadeChange |= MBB->CorrectExtraCFGEdges(CurTBB, CurFBB, !CurCond.empty());
Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -335,7 +335,8 @@
// Branch analysis.
bool ARMInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -385,7 +386,8 @@
(LastOpc == ARM::B || LastOpc == ARM::tB)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
@@ -396,7 +398,8 @@
SecondLastOpc == ARM::BR_JTadd || SecondLastOpc==ARM::tBR_JTr) &&
(LastOpc == ARM::B || LastOpc == ARM::tB)) {
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return true;
}
Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -172,7 +172,8 @@
// Branch analysis.
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -321,8 +321,9 @@
// Branch analysis.
bool AlphaInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
- MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ MachineBasicBlock *&FBB,
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -373,7 +374,8 @@
LastInst->getOpcode() == Alpha::BR) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -83,7 +83,8 @@
bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
unsigned RemoveBranch(MachineBasicBlock &MBB) const;
void insertNoop(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MI) const;
Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -524,7 +524,8 @@
bool
SPUInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -575,7 +576,8 @@
if (isUncondBranch(SecondLastInst) && isUncondBranch(LastInst)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/CellSPU/SPUInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -100,7 +100,8 @@
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
Modified: llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -453,7 +453,8 @@
bool MipsInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const
+ SmallVectorImpl &Cond,
+ bool AllowModify) const
{
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
@@ -525,7 +526,8 @@
if ((SecondLastOpc == Mips::J) && (LastOpc == Mips::J)) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/Mips/MipsInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -166,7 +166,8 @@
/// Branch Analysis
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -204,7 +204,8 @@
// Branch analysis.
bool PPCInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -253,7 +254,8 @@
LastInst->getOpcode() == PPC::B) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/PowerPC/PPCInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -104,7 +104,8 @@
// Branch analysis.
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -1488,7 +1488,8 @@
bool X86InstrInfo::AnalyzeBranch(MachineBasicBlock &MBB,
MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// Start from the bottom of the block and work up, examining the
// terminator instructions.
MachineBasicBlock::iterator I = MBB.end();
@@ -1504,6 +1505,11 @@
return true;
// Handle unconditional branches.
if (I->getOpcode() == X86::JMP) {
+ if (!AllowModify) {
+ TBB = I->getOperand(0).getMBB();
+ return false;
+ }
+
// If the block has any instructions after a JMP, delete them.
while (next(I) != MBB.end())
next(I)->eraseFromParent();
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.h Mon Feb 9 04:54:06 2009
@@ -323,7 +323,8 @@
virtual bool isUnpredicatedTerminator(const MachineInstr* MI) const;
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.cpp?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.cpp Mon Feb 9 04:54:06 2009
@@ -228,8 +228,9 @@
///
bool
XCoreInstrInfo::AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
- MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const {
+ MachineBasicBlock *&FBB,
+ SmallVectorImpl &Cond,
+ bool AllowModify) const {
// If the block has no terminators, it just falls into the block after it.
MachineBasicBlock::iterator I = MBB.end();
if (I == MBB.begin() || !isUnpredicatedTerminator(--I))
@@ -288,7 +289,8 @@
IsBRU(LastInst->getOpcode())) {
TBB = SecondLastInst->getOperand(0).getMBB();
I = LastInst;
- I->eraseFromParent();
+ if (AllowModify)
+ I->eraseFromParent();
return false;
}
Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.h?rev=64133&r1=64132&r2=64133&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/XCore/XCoreInstrInfo.h Mon Feb 9 04:54:06 2009
@@ -56,7 +56,8 @@
virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
MachineBasicBlock *&FBB,
- SmallVectorImpl &Cond) const;
+ SmallVectorImpl &Cond,
+ bool AllowModify) const;
virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
MachineBasicBlock *FBB,
From isanbard at gmail.com Mon Feb 9 04:54:59 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 10:54:59 -0000
Subject: [llvm-commits] [llvm] r64134 -
/llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp
Message-ID: <200902091054.n19AsxbU022475@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 04:54:59 2009
New Revision: 64134
URL: http://llvm.org/viewvc/llvm-project?rev=64134&view=rev
Log:
Pull r64125 into Dib:
Fix another case ShortenDeadCopySrcLiveRange is shortening too much. No test
case possible since I don't know what to grep for. :-(
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=64134&r1=64133&r2=64134&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Feb 9 04:54:59 2009
@@ -861,22 +861,29 @@
// If there is a last use in the same bb, we can't remove the live range.
// Shorten the live interval and return.
- if (TrimLiveIntervalToLastUse(CopyIdx, CopyMI->getParent(), li, LR))
+ MachineBasicBlock *CopyMBB = CopyMI->getParent();
+ if (TrimLiveIntervalToLastUse(CopyIdx, CopyMBB, li, LR))
return false;
+ MachineBasicBlock *StartMBB = li_->getMBBFromIndex(RemoveStart);
+ if (!isSameOrFallThroughBB(StartMBB, CopyMBB, tii_))
+ // If the live range starts in another mbb and the copy mbb is not a fall
+ // through mbb, then we can only cut the range from the beginning of the
+ // copy mbb.
+ RemoveStart = li_->getMBBStartIdx(CopyMBB) + 1;
+
if (LR->valno->def == RemoveStart) {
// If the def MI defines the val# and this copy is the only kill of the
// val#, then propagate the dead marker.
- if (!li.isOnlyLROfValNo(LR)) {
- if (li.isKill(LR->valno, RemoveEnd))
- li.removeKill(LR->valno, RemoveEnd);
- } else {
+ if (li.isOnlyLROfValNo(LR)) {
PropagateDeadness(li, CopyMI, RemoveStart, li_, tri_);
++numDeadValNo;
}
+ if (li.isKill(LR->valno, RemoveEnd))
+ li.removeKill(LR->valno, RemoveEnd);
}
- removeRange(li, RemoveStart, LR->end, li_, tri_);
+ removeRange(li, RemoveStart, RemoveEnd, li_, tri_);
return removeIntervalIfEmpty(li, li_, tri_);
}
From isanbard at gmail.com Mon Feb 9 04:56:41 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 10:56:41 -0000
Subject: [llvm-commits] [llvm] r64135 - in /llvm/branches/Apple/Dib:
lib/CodeGen/LLVMTargetMachine.cpp test/CodeGen/ARM/lsr-code-insertion.ll
test/CodeGen/X86/2006-05-11-InstrSched.ll
test/CodeGen/X86/2009-02-07-CoalescerBug.ll
Message-ID: <200902091056.n19Aufeb022534@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 04:56:40 2009
New Revision: 64135
URL: http://llvm.org/viewvc/llvm-project?rev=64135&view=rev
Log:
Pull r64126 into Dib:
Re-enable machine sinking pass now that the coalescer bugs and the AnalyzeBrnach
bug are fixed.
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp
llvm/branches/Apple/Dib/test/CodeGen/ARM/lsr-code-insertion.ll
llvm/branches/Apple/Dib/test/CodeGen/X86/2006-05-11-InstrSched.ll
llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-07-CoalescerBug.ll
Modified: llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp?rev=64135&r1=64134&r2=64135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/LLVMTargetMachine.cpp Mon Feb 9 04:56:40 2009
@@ -38,11 +38,6 @@
static cl::opt PrintGCInfo("print-gc", cl::Hidden,
cl::desc("Dump garbage collector data"));
-// Hidden options to help debugging
-static cl::opt
-EnableSinking("enable-sinking", cl::init(false), cl::Hidden,
- cl::desc("Perform sinking on machine code"));
-
// When this works it will be on by default.
static cl::opt
DisablePostRAScheduler("disable-post-RA-scheduler",
@@ -183,11 +178,10 @@
if (PrintMachineCode)
PM.add(createMachineFunctionPrinterPass(cerr));
- if (!Fast)
+ if (!Fast) {
PM.add(createMachineLICMPass());
-
- if (EnableSinking)
PM.add(createMachineSinkingPass());
+ }
// Run pre-ra passes.
if (addPreRegAlloc(PM, Fast) && PrintMachineCode)
Modified: llvm/branches/Apple/Dib/test/CodeGen/ARM/lsr-code-insertion.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/ARM/lsr-code-insertion.ll?rev=64135&r1=64134&r2=64135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/ARM/lsr-code-insertion.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/ARM/lsr-code-insertion.ll Mon Feb 9 04:56:40 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -stats |& grep {39.*Number of machine instrs printed}
+; RUN: llvm-as < %s | llc -stats |& grep {40.*Number of machine instrs printed}
; RUN: llvm-as < %s | llc -stats |& grep {.*Number of re-materialization}
; This test really wants to check that the resultant "cond_true" block only
; has a single store in it, and that cond_true55 only has code to materialize
Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/2006-05-11-InstrSched.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2006-05-11-InstrSched.ll?rev=64135&r1=64134&r2=64135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2006-05-11-InstrSched.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2006-05-11-InstrSched.ll Mon Feb 9 04:56:40 2009
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats -realign-stack=0 |&\
-; RUN: grep {asm-printer} | grep 32
+; RUN: grep {asm-printer} | grep 31
target datalayout = "e-p:32:32"
define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) nounwind {
Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-07-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-07-CoalescerBug.ll?rev=64135&r1=64134&r2=64135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-07-CoalescerBug.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-07-CoalescerBug.ll Mon Feb 9 04:56:40 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 -enable-sinking -relocation-model=pic -stats |& grep {Number of valno def marked dead} | grep 1
+; RUN: llvm-as < %s | llc -march=x86 -relocation-model=pic -stats |& grep {Number of valno def marked dead} | grep 1
; rdar://6566708
target triple = "i386-apple-darwin9.6"
From isanbard at gmail.com Mon Feb 9 06:31:27 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 12:31:27 -0000
Subject: [llvm-commits] [llvm] r64136 - in /llvm/trunk/include/llvm/ADT:
APInt.h APSInt.h
Message-ID: <200902091231.n19CVSwl025669@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 06:31:26 2009
New Revision: 64136
URL: http://llvm.org/viewvc/llvm-project?rev=64136&view=rev
Log:
These function return 'void'. Don't have 'return' return anything.
Modified:
llvm/trunk/include/llvm/ADT/APInt.h
llvm/trunk/include/llvm/ADT/APSInt.h
Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=64136&r1=64135&r2=64136&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Mon Feb 9 06:31:26 2009
@@ -1125,13 +1125,13 @@
/// Considers the APInt to be unsigned and converts it into a string in the
/// radix given. The radix can be 2, 8, 10 or 16.
void toStringUnsigned(SmallVectorImpl &Str, unsigned Radix = 10) const {
- return toString(Str, Radix, false);
+ toString(Str, Radix, false);
}
/// Considers the APInt to be signed and converts it into a string in the
/// radix given. The radix can be 2, 8, 10 or 16.
void toStringSigned(SmallVectorImpl &Str, unsigned Radix = 10) const {
- return toString(Str, Radix, true);
+ toString(Str, Radix, true);
}
/// toString - This returns the APInt as a std::string. Note that this is an
Modified: llvm/trunk/include/llvm/ADT/APSInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=64136&r1=64135&r2=64136&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Mon Feb 9 06:31:26 2009
@@ -59,7 +59,7 @@
/// toString - Append this APSInt to the specified SmallString.
void toString(SmallVectorImpl &Str, unsigned Radix = 10) const {
- return APInt::toString(Str, Radix, isSigned());
+ APInt::toString(Str, Radix, isSigned());
}
/// toString - Converts an APInt to a std::string. This is an inefficient
/// method, your should prefer passing in a SmallString instead.
From isanbard at gmail.com Mon Feb 9 06:31:41 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 12:31:41 -0000
Subject: [llvm-commits] [llvm] r64137 - /llvm/trunk/unittests/ADT/APInt.cpp
Message-ID: <200902091231.n19CVfZt025686@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 06:31:40 2009
New Revision: 64137
URL: http://llvm.org/viewvc/llvm-project?rev=64137&view=rev
Log:
Fix comment.
Modified:
llvm/trunk/unittests/ADT/APInt.cpp
Modified: llvm/trunk/unittests/ADT/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/APInt.cpp?rev=64137&r1=64136&r2=64137&view=diff
==============================================================================
--- llvm/trunk/unittests/ADT/APInt.cpp (original)
+++ llvm/trunk/unittests/ADT/APInt.cpp Mon Feb 9 06:31:40 2009
@@ -1,4 +1,4 @@
-//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests -----------*- C++ -*-===//
+//===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
//
// The LLVM Compiler Infrastructure
//
From ggreif at gmail.com Mon Feb 9 09:45:07 2009
From: ggreif at gmail.com (Gabor Greif)
Date: Mon, 09 Feb 2009 15:45:07 -0000
Subject: [llvm-commits] [llvm] r64142 - in /llvm/trunk:
include/llvm/Instructions.h lib/VMCore/AsmWriter.cpp
Message-ID: <200902091545.n19Fj8E5032006@zion.cs.uiuc.edu>
Author: ggreif
Date: Mon Feb 9 09:45:06 2009
New Revision: 64142
URL: http://llvm.org/viewvc/llvm-project?rev=64142&view=rev
Log:
make sure that BranchInst::getSuccessor() does not assert in cast<>
even if the underlying operand is NULL. This may happen in debugging context
within opt with partial loop unrolling (see test/Transforms/LoopUnroll/partial.ll).
After this fix I can resubmit the (backed out) r63459:
* lib/VMCore/AsmWriter.cpp: use precise accessors.
Modified:
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/lib/VMCore/AsmWriter.cpp
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=64142&r1=64141&r2=64142&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Feb 9 09:45:06 2009
@@ -2186,7 +2186,9 @@
BasicBlock *getSuccessor(unsigned i) const {
assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
- return cast(getOperand(i));
+ if (Value *V = getOperand(i))
+ return cast(V);
+ return 0;
}
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=64142&r1=64141&r2=64142&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
+++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Feb 9 09:45:06 2009
@@ -1505,13 +1505,14 @@
const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0;
// Special case conditional branches to swizzle the condition out to the front
- if (isa(I) && I.getNumOperands() > 1) {
+ if (isa(I) && cast(I).isConditional()) {
+ BranchInst &BI(cast(I));
Out << ' ';
- writeOperand(I.getOperand(2), true);
+ writeOperand(BI.getCondition(), true);
Out << ", ";
- writeOperand(Operand, true);
+ writeOperand(BI.getSuccessor(0), true);
Out << ", ";
- writeOperand(I.getOperand(1), true);
+ writeOperand(BI.getSuccessor(1), true);
} else if (isa(I)) {
// Special case switch statement to get formatting nice and correct...
From nicholas at mxc.ca Mon Feb 9 11:06:49 2009
From: nicholas at mxc.ca (Nick Lewycky)
Date: Mon, 09 Feb 2009 09:06:49 -0800
Subject: [llvm-commits] [llvm] r64142 - in /llvm/trunk:
include/llvm/Instructions.h lib/VMCore/AsmWriter.cpp
In-Reply-To: <200902091545.n19Fj8E5032006@zion.cs.uiuc.edu>
References: <200902091545.n19Fj8E5032006@zion.cs.uiuc.edu>
Message-ID: <499062A9.5000703@mxc.ca>
Gabor Greif wrote:
> Author: ggreif
> Date: Mon Feb 9 09:45:06 2009
> New Revision: 64142
>
> URL: http://llvm.org/viewvc/llvm-project?rev=64142&view=rev
> Log:
> make sure that BranchInst::getSuccessor() does not assert in cast<>
> even if the underlying operand is NULL. This may happen in debugging context
> within opt with partial loop unrolling (see test/Transforms/LoopUnroll/partial.ll).
> After this fix I can resubmit the (backed out) r63459:
> * lib/VMCore/AsmWriter.cpp: use precise accessors.
>
> Modified:
> llvm/trunk/include/llvm/Instructions.h
> llvm/trunk/lib/VMCore/AsmWriter.cpp
>
> Modified: llvm/trunk/include/llvm/Instructions.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=64142&r1=64141&r2=64142&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Instructions.h (original)
> +++ llvm/trunk/include/llvm/Instructions.h Mon Feb 9 09:45:06 2009
> @@ -2186,7 +2186,9 @@
>
> BasicBlock *getSuccessor(unsigned i) const {
> assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
> - return cast(getOperand(i));
> + if (Value *V = getOperand(i))
> + return cast(V);
> + return 0;
return cast_or_null(getOperand(i));
Nick
> }
>
> void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
>
> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=64142&r1=64141&r2=64142&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Feb 9 09:45:06 2009
> @@ -1505,13 +1505,14 @@
> const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0;
>
> // Special case conditional branches to swizzle the condition out to the front
> - if (isa(I) && I.getNumOperands() > 1) {
> + if (isa(I) && cast(I).isConditional()) {
> + BranchInst &BI(cast(I));
> Out << ' ';
> - writeOperand(I.getOperand(2), true);
> + writeOperand(BI.getCondition(), true);
> Out << ", ";
> - writeOperand(Operand, true);
> + writeOperand(BI.getSuccessor(0), true);
> Out << ", ";
> - writeOperand(I.getOperand(1), true);
> + writeOperand(BI.getSuccessor(1), true);
>
> } else if (isa(I)) {
> // Special case switch statement to get formatting nice and correct...
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
From foldr at codedgers.com Mon Feb 9 11:11:05 2009
From: foldr at codedgers.com (Mikhail Glushenkov)
Date: Mon, 09 Feb 2009 17:11:05 -0000
Subject: [llvm-commits] [llvm] r64147 - in /llvm/trunk/include/llvm:
InstrTypes.h Instructions.h
Message-ID: <200902091711.n19HB6Io002531@zion.cs.uiuc.edu>
Author: foldr
Date: Mon Feb 9 11:11:05 2009
New Revision: 64147
URL: http://llvm.org/viewvc/llvm-project?rev=64147&view=rev
Log:
80-column violations.
Modified:
llvm/trunk/include/llvm/InstrTypes.h
llvm/trunk/include/llvm/Instructions.h
Modified: llvm/trunk/include/llvm/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InstrTypes.h?rev=64147&r1=64146&r2=64147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/InstrTypes.h Mon Feb 9 11:11:05 2009
@@ -90,7 +90,8 @@
UnaryInstruction(const UnaryInstruction&); // Do not implement
protected:
- UnaryInstruction(const Type *Ty, unsigned iType, Value *V, Instruction *IB = 0)
+ UnaryInstruction(const Type *Ty, unsigned iType, Value *V,
+ Instruction *IB = 0)
: Instruction(Ty, iType, &Op<0>(), 1, IB) {
Op<0>() = V;
}
@@ -109,7 +110,7 @@
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const UnaryInstruction *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -266,22 +267,22 @@
: UnaryInstruction(CI.getType(), CI.getOpcode(), CI.getOperand(0)) {
}
/// @brief Do not allow default construction
- CastInst();
+ CastInst();
protected:
/// @brief Constructor with insert-before-instruction semantics for subclasses
- CastInst(const Type *Ty, unsigned iType, Value *S,
+ CastInst(const Type *Ty, unsigned iType, Value *S,
const std::string &NameStr = "", Instruction *InsertBefore = 0)
: UnaryInstruction(Ty, iType, S, InsertBefore) {
setName(NameStr);
}
/// @brief Constructor with insert-at-end-of-block semantics for subclasses
- CastInst(const Type *Ty, unsigned iType, Value *S,
+ CastInst(const Type *Ty, unsigned iType, Value *S,
const std::string &NameStr, BasicBlock *InsertAtEnd)
: UnaryInstruction(Ty, iType, S, InsertAtEnd) {
setName(NameStr);
}
public:
- /// Provides a way to construct any of the CastInst subclasses using an
+ /// Provides a way to construct any of the CastInst subclasses using an
/// opcode instead of the subclass's constructor. The opcode must be in the
/// CastOps category (Instruction::isCast(opcode) returns true). This
/// constructor has insert-before-instruction semantics to automatically
@@ -376,7 +377,7 @@
/// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
static CastInst *CreateFPCast(
- Value *S, ///< The floating point value to be casted
+ Value *S, ///< The floating point value to be casted
const Type *Ty, ///< The floating point type to cast to
const std::string &Name = "", ///< Name for the instruction
Instruction *InsertBefore = 0 ///< Place to insert the instruction
@@ -384,7 +385,7 @@
/// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts
static CastInst *CreateFPCast(
- Value *S, ///< The floating point value to be casted
+ Value *S, ///< The floating point value to be casted
const Type *Ty, ///< The floating point type to cast to
const std::string &Name, ///< The name for the instruction
BasicBlock *InsertAtEnd ///< The block to insert the instruction into
@@ -422,7 +423,7 @@
bool DstIsSigned ///< Whether to treate the dest. as signed
);
- /// There are several places where we need to know if a cast instruction
+ /// There are several places where we need to know if a cast instruction
/// only deals with integer source and destination types. To simplify that
/// logic, this method is provided.
/// @returns true iff the cast has only integral typed operand and dest type.
@@ -431,20 +432,20 @@
/// A lossless cast is one that does not alter the basic value. It implies
/// a no-op cast but is more stringent, preventing things like int->float,
- /// long->double, int->ptr, or vector->anything.
+ /// long->double, int->ptr, or vector->anything.
/// @returns true iff the cast is lossless.
/// @brief Determine if this is a lossless cast.
bool isLosslessCast() const;
- /// A no-op cast is one that can be effected without changing any bits.
+ /// A no-op cast is one that can be effected without changing any bits.
/// It implies that the source and destination types are the same size. The
- /// IntPtrTy argument is used to make accurate determinations for casts
+ /// IntPtrTy argument is used to make accurate determinations for casts
/// involving Integer and Pointer types. They are no-op casts if the integer
- /// is the same size as the pointer. However, pointer size varies with
+ /// is the same size as the pointer. However, pointer size varies with
/// platform. Generally, the result of TargetData::getIntPtrType() should be
/// passed in. If that's not available, use Type::Int64Ty, which will make
/// the isNoopCast call conservative.
- /// @brief Determine if this cast is a no-op cast.
+ /// @brief Determine if this cast is a no-op cast.
bool isNoopCast(
const Type *IntPtrTy ///< Integer type corresponding to pointer
) const;
@@ -452,7 +453,7 @@
/// Determine how a pair of casts can be eliminated, if they can be at all.
/// This is a helper function for both CastInst and ConstantExpr.
/// @returns 0 if the CastInst pair can't be eliminated
- /// @returns Instruction::CastOps value for a cast that can replace
+ /// @returns Instruction::CastOps value for a cast that can replace
/// the pair, casting SrcTy to DstTy.
/// @brief Determine if a cast pair is eliminable
static unsigned isEliminableCastPair(
@@ -465,8 +466,8 @@
);
/// @brief Return the opcode of this CastInst
- Instruction::CastOps getOpcode() const {
- return Instruction::CastOps(Instruction::getOpcode());
+ Instruction::CastOps getOpcode() const {
+ return Instruction::CastOps(Instruction::getOpcode());
}
/// @brief Return the source type, as a convenience
@@ -475,7 +476,7 @@
const Type* getDestTy() const { return getType(); }
/// This method can be used to determine if a cast from S to DstTy using
- /// Opcode op is valid or not.
+ /// Opcode op is valid or not.
/// @returns true iff the proposed cast is valid.
/// @brief Determine if a cast is valid without creating one.
static bool castIsValid(Instruction::CastOps op, Value *S, const Type *DstTy);
@@ -494,7 +495,7 @@
// CmpInst Class
//===----------------------------------------------------------------------===//
-/// This class is the base class for the comparison instructions.
+/// This class is the base class for the comparison instructions.
/// @brief Abstract base class of comparison instructions.
// FIXME: why not derive from BinaryOperator?
class CmpInst: public Instruction {
@@ -504,7 +505,7 @@
CmpInst(const Type *ty, Instruction::OtherOps op, unsigned short pred,
Value *LHS, Value *RHS, const std::string &Name = "",
Instruction *InsertBefore = 0);
-
+
CmpInst(const Type *ty, Instruction::OtherOps op, unsigned short pred,
Value *LHS, Value *RHS, const std::string &Name,
BasicBlock *InsertAtEnd);
@@ -554,21 +555,21 @@
void *operator new(size_t s) {
return User::operator new(s, 2);
}
- /// Construct a compare instruction, given the opcode, the predicate and
- /// the two operands. Optionally (if InstBefore is specified) insert the
- /// instruction into a BasicBlock right before the specified instruction.
+ /// Construct a compare instruction, given the opcode, the predicate and
+ /// the two operands. Optionally (if InstBefore is specified) insert the
+ /// instruction into a BasicBlock right before the specified instruction.
/// The specified Instruction is allowed to be a dereferenced end iterator.
/// @brief Create a CmpInst
- static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
+ static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
Value *S2, const std::string &Name = "",
Instruction *InsertBefore = 0);
- /// Construct a compare instruction, given the opcode, the predicate and the
- /// two operands. Also automatically insert this instruction to the end of
+ /// Construct a compare instruction, given the opcode, the predicate and the
+ /// two operands. Also automatically insert this instruction to the end of
/// the BasicBlock specified.
/// @brief Create a CmpInst
- static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
- Value *S2, const std::string &Name,
+ static CmpInst *Create(OtherOps Op, unsigned short predicate, Value *S1,
+ Value *S2, const std::string &Name,
BasicBlock *InsertAtEnd);
/// @brief Get the opcode casted to the right type
@@ -581,10 +582,10 @@
/// @brief Set the predicate for this instruction to the specified value.
void setPredicate(Predicate P) { SubclassData = P; }
-
+
/// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
/// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
- /// @returns the inverse predicate for the instruction's current predicate.
+ /// @returns the inverse predicate for the instruction's current predicate.
/// @brief Return the inverse of the instruction's predicate.
Predicate getInversePredicate() const {
return getInversePredicate(getPredicate());
@@ -592,21 +593,21 @@
/// For example, EQ -> NE, UGT -> ULE, SLT -> SGE,
/// OEQ -> UNE, UGT -> OLE, OLT -> UGE, etc.
- /// @returns the inverse predicate for predicate provided in \p pred.
+ /// @returns the inverse predicate for predicate provided in \p pred.
/// @brief Return the inverse of a given predicate
static Predicate getInversePredicate(Predicate pred);
/// For example, EQ->EQ, SLE->SGE, ULT->UGT,
/// OEQ->OEQ, ULE->UGE, OLT->OGT, etc.
- /// @returns the predicate that would be the result of exchanging the two
- /// operands of the CmpInst instruction without changing the result
- /// produced.
+ /// @returns the predicate that would be the result of exchanging the two
+ /// operands of the CmpInst instruction without changing the result
+ /// produced.
/// @brief Return the predicate as if the operands were swapped
Predicate getSwappedPredicate() const {
return getSwappedPredicate(getPredicate());
}
- /// This is a static version that you can use without an instruction
+ /// This is a static version that you can use without an instruction
/// available.
/// @brief Return the predicate as if the operands were swapped.
static Predicate getSwappedPredicate(Predicate pred);
@@ -644,7 +645,7 @@
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const CmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
- return I->getOpcode() == Instruction::ICmp ||
+ return I->getOpcode() == Instruction::ICmp ||
I->getOpcode() == Instruction::FCmp ||
I->getOpcode() == Instruction::VICmp ||
I->getOpcode() == Instruction::VFCmp;
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=64147&r1=64146&r2=64147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Feb 9 11:11:05 2009
@@ -164,7 +164,7 @@
: AllocationInst(Ty, ArraySize, Alloca, Align, NameStr, InsertAtEnd) {}
virtual AllocaInst *clone() const;
-
+
/// isStaticAlloca - Return true if this alloca is in the entry block of the
/// function and is a constant size. If so, the code generator will fold it
/// into the prolog/epilog code, so it is basically free.
@@ -194,7 +194,7 @@
FreeInst(Value *Ptr, BasicBlock *InsertAfter);
virtual FreeInst *clone() const;
-
+
// Accessor methods for consistency with other memory operations
Value *getPointerOperand() { return getOperand(0); }
const Value *getPointerOperand() const { return getOperand(0); }
@@ -232,7 +232,7 @@
public:
LoadInst(Value *Ptr, const std::string &NameStr, Instruction *InsertBefore);
LoadInst(Value *Ptr, const std::string &NameStr, BasicBlock *InsertAtEnd);
- LoadInst(Value *Ptr, const std::string &NameStr, bool isVolatile = false,
+ LoadInst(Value *Ptr, const std::string &NameStr, bool isVolatile = false,
Instruction *InsertBefore = 0);
LoadInst(Value *Ptr, const std::string &NameStr, bool isVolatile,
unsigned Align, Instruction *InsertBefore = 0);
@@ -247,7 +247,7 @@
bool isVolatile = false, Instruction *InsertBefore = 0);
LoadInst(Value *Ptr, const char *NameStr, bool isVolatile,
BasicBlock *InsertAtEnd);
-
+
/// isVolatile - Return true if this is a load from a volatile memory
/// location.
///
@@ -255,8 +255,8 @@
/// setVolatile - Specify whether this is a volatile load or not.
///
- void setVolatile(bool V) {
- SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
+ void setVolatile(bool V) {
+ SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
}
virtual LoadInst *clone() const;
@@ -266,7 +266,7 @@
unsigned getAlignment() const {
return (1 << (SubclassData>>1)) >> 1;
}
-
+
void setAlignment(unsigned Align);
Value *getPointerOperand() { return getOperand(0); }
@@ -292,14 +292,14 @@
///
class StoreInst : public Instruction {
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
-
+
StoreInst(const StoreInst &SI) : Instruction(SI.getType(), Store,
&Op<0>(), 2) {
Op<0>() = SI.Op<0>();
Op<1>() = SI.Op<1>();
setVolatile(SI.isVolatile());
setAlignment(SI.getAlignment());
-
+
#ifndef NDEBUG
AssertOK();
#endif
@@ -328,8 +328,8 @@
/// setVolatile - Specify whether this is a volatile load or not.
///
- void setVolatile(bool V) {
- SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
+ void setVolatile(bool V) {
+ SubclassData = (SubclassData & ~1) | (V ? 1 : 0);
}
/// Transparently provide more efficient getOperand methods.
@@ -340,9 +340,9 @@
unsigned getAlignment() const {
return (1 << (SubclassData>>1)) >> 1;
}
-
+
void setAlignment(unsigned Align);
-
+
virtual StoreInst *clone() const;
Value *getPointerOperand() { return getOperand(1); }
@@ -393,7 +393,7 @@
// do arithmetic on in constant time
std::random_access_iterator_tag) {
unsigned NumIdx = static_cast(std::distance(IdxBegin, IdxEnd));
-
+
if (NumIdx > 0) {
// This requires that the iterator points to contiguous memory.
init(Ptr, &*IdxBegin, NumIdx, NameStr); // FIXME: for the general case
@@ -412,7 +412,7 @@
///
template
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
+ InputIterator IdxBegin,
InputIterator IdxEnd,
// This argument ensures that we
// have an iterator we can do
@@ -432,7 +432,7 @@
/// instruction, the second appends the new instruction to the specified
/// BasicBlock.
template
- inline GetElementPtrInst(Value *Ptr, InputIterator IdxBegin,
+ inline GetElementPtrInst(Value *Ptr, InputIterator IdxBegin,
InputIterator IdxEnd,
unsigned Values,
const std::string &NameStr,
@@ -451,11 +451,11 @@
const std::string &NameStr, BasicBlock *InsertAtEnd);
public:
template
- static GetElementPtrInst *Create(Value *Ptr, InputIterator IdxBegin,
+ static GetElementPtrInst *Create(Value *Ptr, InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr = "",
Instruction *InsertBefore = 0) {
- typename std::iterator_traits::difference_type Values =
+ typename std::iterator_traits::difference_type Values =
1 + std::distance(IdxBegin, IdxEnd);
return new(Values)
GetElementPtrInst(Ptr, IdxBegin, IdxEnd, Values, NameStr, InsertBefore);
@@ -465,7 +465,7 @@
InputIterator IdxBegin, InputIterator IdxEnd,
const std::string &NameStr,
BasicBlock *InsertAtEnd) {
- typename std::iterator_traits::difference_type Values =
+ typename std::iterator_traits::difference_type Values =
1 + std::distance(IdxBegin, IdxEnd);
return new(Values)
GetElementPtrInst(Ptr, IdxBegin, IdxEnd, Values, NameStr, InsertAtEnd);
@@ -507,7 +507,7 @@
return getIndexedType(Ptr, IdxBegin, IdxEnd,
typename std::iterator_traits::
iterator_category());
- }
+ }
static const Type *getIndexedType(const Type *Ptr,
Value* const *Idx, unsigned NumIdx);
@@ -531,13 +531,13 @@
static unsigned getPointerOperandIndex() {
return 0U; // get index for modifying correct operand
}
-
+
/// getPointerOperandType - Method to return the pointer operand as a
/// PointerType.
const PointerType *getPointerOperandType() const {
return reinterpret_cast(getPointerOperand()->getType());
}
-
+
unsigned getNumIndices() const { // Note: always non-negative
return getNumOperands() - 1;
@@ -546,17 +546,17 @@
bool hasIndices() const {
return getNumOperands() > 1;
}
-
+
/// hasAllZeroIndices - Return true if all of the indices of this GEP are
/// zeros. If so, the result pointer and the first operand have the same
/// value, just potentially different types.
bool hasAllZeroIndices() const;
-
+
/// hasAllConstantIndices - Return true if all of the indices of this GEP are
/// constant integers. If so, the result pointer and the first operand have
/// a constant offset between them.
bool hasAllConstantIndices() const;
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const GetElementPtrInst *) { return true; }
@@ -574,7 +574,7 @@
template
GetElementPtrInst::GetElementPtrInst(Value *Ptr,
- InputIterator IdxBegin,
+ InputIterator IdxBegin,
InputIterator IdxEnd,
unsigned Values,
const std::string &NameStr,
@@ -639,7 +639,7 @@
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
- assert((getOperand(0)->getType()->isIntOrIntVector() ||
+ assert((getOperand(0)->getType()->isIntOrIntVector() ||
isa(getOperand(0)->getType())) &&
"Invalid operand types for ICmp instruction");
}
@@ -660,7 +660,7 @@
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to ICmp instruction are not of the same type!");
// Check that the operands are the right type
- assert((getOperand(0)->getType()->isIntOrIntVector() ||
+ assert((getOperand(0)->getType()->isIntOrIntVector() ||
isa(getOperand(0)->getType())) &&
"Invalid operand types for ICmp instruction");
}
@@ -694,7 +694,7 @@
static bool isEquality(Predicate P) {
return P == ICMP_EQ || P == ICMP_NE;
}
-
+
/// isEquality - Return true if this predicate is either EQ or NE. This also
/// tests for commutativity.
bool isEquality() const {
@@ -705,18 +705,18 @@
/// @brief Determine if this relation is commutative.
bool isCommutative() const { return isEquality(); }
- /// isRelational - Return true if the predicate is relational (not EQ or NE).
+ /// isRelational - Return true if the predicate is relational (not EQ or NE).
///
bool isRelational() const {
return !isEquality();
}
- /// isRelational - Return true if the predicate is relational (not EQ or NE).
+ /// isRelational - Return true if the predicate is relational (not EQ or NE).
///
static bool isRelational(Predicate P) {
return !isEquality(P);
}
-
+
/// @returns true if the predicate of this ICmpInst is signed, false otherwise
/// @brief Determine if this instruction's predicate is signed.
bool isSignedPredicate() const { return isSignedPredicate(getPredicate()); }
@@ -741,14 +741,14 @@
return isTrueWhenEqual(getPredicate());
}
- /// Initialize a set of values that all satisfy the predicate with C.
+ /// Initialize a set of values that all satisfy the predicate with C.
/// @brief Make a ConstantRange for a relation with a constant value.
static ConstantRange makeConstantRange(Predicate pred, const APInt &C);
/// Exchange the two operands to this instruction in such a way that it does
/// not modify the semantics of the instruction. The predicate value may be
/// changed to retain the same result if the predicate is order dependent
- /// (e.g. ult).
+ /// (e.g. ult).
/// @brief Swap operands and adjust predicate.
void swapOperands() {
SubclassData = getSwappedPredicate();
@@ -773,7 +773,7 @@
//===----------------------------------------------------------------------===//
/// This instruction compares its operands according to the predicate given
-/// to the constructor. It only operates on floating point values or packed
+/// to the constructor. It only operates on floating point values or packed
/// vectors of floating point values. The operands must be identical types.
/// @brief Represents a floating point comparison operator.
class FCmpInst: public CmpInst {
@@ -833,14 +833,14 @@
SubclassData == FCMP_UNO;
}
- /// @returns true if the predicate is relational (not EQ or NE).
+ /// @returns true if the predicate is relational (not EQ or NE).
/// @brief Determine if this a relational predicate.
bool isRelational() const { return !isEquality(); }
/// Exchange the two operands to this instruction in such a way that it does
/// not modify the semantics of the instruction. The predicate value may be
/// changed to retain the same result if the predicate is order dependent
- /// (e.g. ult).
+ /// (e.g. ult).
/// @brief Swap operands and adjust predicate.
void swapOperands() {
SubclassData = getSwappedPredicate();
@@ -857,7 +857,7 @@
static inline bool classof(const Value *V) {
return isa(V) && classof(cast(V));
}
-
+
};
//===----------------------------------------------------------------------===//
@@ -901,7 +901,7 @@
assert(getOperand(0)->getType() == getOperand(1)->getType() &&
"Both operands to VICmp instruction are not of the same type!");
}
-
+
/// @brief Return the predicate for this instruction.
Predicate getPredicate() const { return Predicate(SubclassData); }
@@ -996,7 +996,7 @@
// do arithmetic on in constant time
std::random_access_iterator_tag) {
unsigned NumArgs = (unsigned)std::distance(ArgBegin, ArgEnd);
-
+
// This requires that the iterator points to contiguous memory.
init(Func, NumArgs ? &*ArgBegin : 0, NumArgs);
setName(NameStr);
@@ -1074,7 +1074,7 @@
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
+
/// getCallingConv/setCallingConv - Get or set the calling convention of this
/// function call.
unsigned getCallingConv() const { return SubclassData >> 1; }
@@ -1089,7 +1089,7 @@
/// setAttributes - Set the parameter attributes for this call.
///
void setAttributes(const AttrListPtr &Attrs) { AttributeList = Attrs; }
-
+
/// addAttribute - adds the attribute to the list of attributes.
void addAttribute(unsigned i, Attributes attr);
@@ -1140,7 +1140,7 @@
else removeAttribute(~0, Attribute::NoUnwind);
}
- /// @brief Determine if the call returns a structure through first
+ /// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
@@ -1159,7 +1159,7 @@
return dyn_cast(getOperand(0));
}
- /// getCalledValue - Get a pointer to the function that is invoked by this
+ /// getCalledValue - Get a pointer to the function that is invoked by this
/// instruction
const Value *getCalledValue() const { return getOperand(0); }
Value *getCalledValue() { return getOperand(0); }
@@ -1198,7 +1198,7 @@
Instruction::Call,
OperandTraits::op_end(this) - (ArgEnd - ArgBegin + 1),
(unsigned)(ArgEnd - ArgBegin + 1), InsertBefore) {
- init(Func, ArgBegin, ArgEnd, NameStr,
+ init(Func, ArgBegin, ArgEnd, NameStr,
typename std::iterator_traits::iterator_category());
}
@@ -1251,7 +1251,7 @@
Value *getCondition() const { return Op<0>(); }
Value *getTrueValue() const { return Op<1>(); }
Value *getFalseValue() const { return Op<2>(); }
-
+
/// areInvalidOperands - Return a string if the specified operands are invalid
/// for a select operation, otherwise return null.
static const char *areInvalidOperands(Value *Cond, Value *True, Value *False);
@@ -1378,9 +1378,11 @@
class InsertElementInst : public Instruction {
InsertElementInst(const InsertElementInst &IE);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
- const std::string &NameStr = "",Instruction *InsertBefore = 0);
+ const std::string &NameStr = "",
+ Instruction *InsertBefore = 0);
InsertElementInst(Value *Vec, Value *NewElt, unsigned Idx,
- const std::string &NameStr = "",Instruction *InsertBefore = 0);
+ const std::string &NameStr = "",
+ Instruction *InsertBefore = 0);
InsertElementInst(Value *Vec, Value *NewElt, Value *Idx,
const std::string &NameStr, BasicBlock *InsertAtEnd);
InsertElementInst(Value *Vec, Value *NewElt, unsigned Idx,
@@ -1477,7 +1479,7 @@
/// Transparently provide more efficient getOperand methods.
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
+
/// getMaskValue - Return the index from the shuffle mask for the specified
/// output result. This is either -1 if the element is undef or a number less
/// than 2*numelements.
@@ -1521,7 +1523,7 @@
// do arithmetic on in constant time
std::random_access_iterator_tag) {
unsigned NumIdx = static_cast(std::distance(IdxBegin, IdxEnd));
-
+
// There's no fundamental reason why we require at least one index
// (other than weirdness with &*IdxBegin being invalid; see
// getelementptr's init routine for example). But there's no
@@ -1544,7 +1546,7 @@
template
static const Type *getIndexedType(const Type *Ptr,
- InputIterator IdxBegin,
+ InputIterator IdxBegin,
InputIterator IdxEnd,
// This argument ensures that we
// have an iterator we can do
@@ -1564,7 +1566,7 @@
/// an existing instruction, the second appends the new instruction to the
/// specified BasicBlock.
template
- inline ExtractValueInst(Value *Agg, InputIterator IdxBegin,
+ inline ExtractValueInst(Value *Agg, InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr,
Instruction *InsertBefore);
@@ -1580,7 +1582,7 @@
public:
template
- static ExtractValueInst *Create(Value *Agg, InputIterator IdxBegin,
+ static ExtractValueInst *Create(Value *Agg, InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr = "",
Instruction *InsertBefore = 0) {
@@ -1631,7 +1633,7 @@
return getIndexedType(Ptr, IdxBegin, IdxEnd,
typename std::iterator_traits::
iterator_category());
- }
+ }
static const Type *getIndexedType(const Type *Ptr, unsigned Idx);
typedef const unsigned* idx_iterator;
@@ -1655,7 +1657,7 @@
bool hasIndices() const {
return true;
}
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ExtractValueInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -1668,7 +1670,7 @@
template
ExtractValueInst::ExtractValueInst(Value *Agg,
- InputIterator IdxBegin,
+ InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr,
Instruction *InsertBefore)
@@ -1716,7 +1718,7 @@
// do arithmetic on in constant time
std::random_access_iterator_tag) {
unsigned NumIdx = static_cast(std::distance(IdxBegin, IdxEnd));
-
+
// There's no fundamental reason why we require at least one index
// (other than weirdness with &*IdxBegin being invalid; see
// getelementptr's init routine for example). But there's no
@@ -1733,7 +1735,7 @@
/// optionally insert before an existing instruction, the second appends
/// the new instruction to the specified BasicBlock.
template
- inline InsertValueInst(Value *Agg, Value *Val, InputIterator IdxBegin,
+ inline InsertValueInst(Value *Agg, Value *Val, InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr,
Instruction *InsertBefore);
@@ -1827,7 +1829,7 @@
bool hasIndices() const {
return true;
}
-
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const InsertValueInst *) { return true; }
static inline bool classof(const Instruction *I) {
@@ -1845,7 +1847,7 @@
template
InsertValueInst::InsertValueInst(Value *Agg,
Value *Val,
- InputIterator IdxBegin,
+ InputIterator IdxBegin,
InputIterator IdxEnd,
const std::string &NameStr,
Instruction *InsertBefore)
@@ -2030,7 +2032,7 @@
struct OperandTraits : HungoffOperandTraits<2> {
};
-DEFINE_TRANSPARENT_OPERAND_ACCESSORS(PHINode, Value)
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(PHINode, Value)
//===----------------------------------------------------------------------===//
@@ -2246,7 +2248,7 @@
/// constructor can also autoinsert before another instruction.
SwitchInst(Value *Value, BasicBlock *Default, unsigned NumCases,
Instruction *InsertBefore = 0);
-
+
/// SwitchInst ctor - Create a new switch instruction, specifying a value to
/// switch on and a default destination. The number of additional cases can
/// be specified here to make memory allocation more efficient. This
@@ -2367,7 +2369,7 @@
struct OperandTraits : HungoffOperandTraits<2> {
};
-DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SwitchInst, Value)
+DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SwitchInst, Value)
//===----------------------------------------------------------------------===//
@@ -2391,7 +2393,7 @@
// do arithmetic on in constant time
std::random_access_iterator_tag) {
unsigned NumArgs = (unsigned)std::distance(ArgBegin, ArgEnd);
-
+
// This requires that the iterator points to contiguous memory.
init(Func, IfNormal, IfException, NumArgs ? &*ArgBegin : 0, NumArgs);
setName(NameStr);
@@ -2448,7 +2450,7 @@
/// Provide fast operand accessors
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value);
-
+
/// getCallingConv/setCallingConv - Get or set the calling convention of this
/// function call.
unsigned getCallingConv() const { return SubclassData; }
@@ -2472,7 +2474,7 @@
/// @brief Determine whether the call or the callee has the given attribute.
bool paramHasAttr(unsigned i, Attributes attr) const;
-
+
/// @brief Extract the alignment for a call or parameter (0=unknown).
unsigned getParamAlignment(unsigned i) const {
return AttributeList.getParamAlignment(i);
@@ -2514,7 +2516,7 @@
else removeAttribute(~0, Attribute::NoUnwind);
}
- /// @brief Determine if the call returns a structure through first
+ /// @brief Determine if the call returns a structure through first
/// pointer argument.
bool hasStructRetAttr() const {
// Be friendly and also check the callee.
@@ -2533,7 +2535,7 @@
return dyn_cast(getOperand(0));
}
- /// getCalledValue - Get a pointer to the function that is invoked by this
+ /// getCalledValue - Get a pointer to the function that is invoked by this
/// instruction
const Value *getCalledValue() const { return getOperand(0); }
Value *getCalledValue() { return getOperand(0); }
From gohman at apple.com Mon Feb 9 11:41:23 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 17:41:23 -0000
Subject: [llvm-commits] [llvm] r64148 -
/llvm/trunk/lib/AsmParser/LLParser.cpp
Message-ID: <200902091741.n19HfNXD003385@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 11:41:21 2009
New Revision: 64148
URL: http://llvm.org/viewvc/llvm-project?rev=64148&view=rev
Log:
Use slightly more correct grammar in error messages.
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=64148&r1=64147&r2=64148&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Feb 9 11:41:21 2009
@@ -1025,7 +1025,7 @@
if (Result.get() == Type::LabelTy)
return TokError("basic block pointers are invalid");
if (Result.get() == Type::VoidTy)
- return TokError("pointers to void are invalid, use i8* instead");
+ return TokError("pointers to void are invalid; use i8* instead");
Result = HandleUpRefs(PointerType::getUnqual(Result.get()));
Lex.Lex();
break;
@@ -1035,7 +1035,7 @@
if (Result.get() == Type::LabelTy)
return TokError("basic block pointers are invalid");
if (Result.get() == Type::VoidTy)
- return TokError("pointers to void are invalid, use i8* instead");
+ return TokError("pointers to void are invalid; use i8* instead");
unsigned AddrSpace;
if (ParseOptionalAddrSpace(AddrSpace) ||
ParseToken(lltok::star, "expected '*' in address space"))
From gohman at apple.com Mon Feb 9 12:12:09 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 18:12:09 -0000
Subject: [llvm-commits] [llvm] r64150 -
/llvm/trunk/lib/Target/X86/X86TargetMachine.h
Message-ID: <200902091812.n19IC9Xr004325@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 12:12:09 2009
New Revision: 64150
URL: http://llvm.org/viewvc/llvm-project?rev=64150&view=rev
Log:
Use doxygen comment syntax.
Modified:
llvm/trunk/lib/Target/X86/X86TargetMachine.h
Modified: llvm/trunk/lib/Target/X86/X86TargetMachine.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetMachine.h?rev=64150&r1=64149&r2=64150&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetMachine.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetMachine.h Mon Feb 9 12:12:09 2009
@@ -83,10 +83,10 @@
virtual bool addSimpleCodeEmitter(PassManagerBase &PM, bool Fast,
bool DumpAsm, MachineCodeEmitter &MCE);
- // symbolicAddressesAreRIPRel - Return true if symbolic addresses are
- // RIP-relative on this machine, taking into consideration the relocation
- // model and subtarget. RIP-relative addresses cannot have a separate
- // base or index register.
+ /// symbolicAddressesAreRIPRel - Return true if symbolic addresses are
+ /// RIP-relative on this machine, taking into consideration the relocation
+ /// model and subtarget. RIP-relative addresses cannot have a separate
+ /// base or index register.
bool symbolicAddressesAreRIPRel() const;
};
From ggreif at gmail.com Mon Feb 9 14:27:45 2009
From: ggreif at gmail.com (Gabor Greif)
Date: Mon, 09 Feb 2009 20:27:45 -0000
Subject: [llvm-commits] [llvm] r64158 -
/llvm/trunk/include/llvm/Instructions.h
Message-ID: <200902092027.n19KRjJj009540@zion.cs.uiuc.edu>
Author: ggreif
Date: Mon Feb 9 14:27:45 2009
New Revision: 64158
URL: http://llvm.org/viewvc/llvm-project?rev=64158&view=rev
Log:
incorporate review feedback
Modified:
llvm/trunk/include/llvm/Instructions.h
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=64158&r1=64157&r2=64158&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Mon Feb 9 14:27:45 2009
@@ -2188,9 +2188,7 @@
BasicBlock *getSuccessor(unsigned i) const {
assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
- if (Value *V = getOperand(i))
- return cast(V);
- return 0;
+ return cast_or_null(getOperand(i));
}
void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
From ggreif at gmail.com Mon Feb 9 14:32:31 2009
From: ggreif at gmail.com (Gabor Greif)
Date: Mon, 9 Feb 2009 12:32:31 -0800 (PST)
Subject: [llvm-commits] [llvm] r64142 - in /llvm/trunk:
include/llvm/Instructions.h lib/VMCore/AsmWriter.cpp
In-Reply-To: <499062A9.5000703@mxc.ca>
References: <200902091545.n19Fj8E5032006@zion.cs.uiuc.edu>
<499062A9.5000703@mxc.ca>
Message-ID: <84d1206a-b551-4b2a-aec8-48cdd4d6ccc7@l39g2000yqn.googlegroups.com>
On 9 Feb., 18:06, Nick Lewycky wrote:
> Gabor Greif wrote:
> > Author: ggreif
> > Date: Mon Feb ?9 09:45:06 2009
> > New Revision: 64142
>
> > URL:http://llvm.org/viewvc/llvm-project?rev=64142&view=rev
> > Log:
> > make sure that BranchInst::getSuccessor() does not assert in cast<>
> > even if the underlying operand is NULL. This may happen in debugging context
> > within opt with partial loop unrolling (see test/Transforms/LoopUnroll/partial.ll).
> > After this fix I can resubmit the (backed out) r63459:
> > * lib/VMCore/AsmWriter.cpp: use precise accessors.
>
> > Modified:
> > ? ? llvm/trunk/include/llvm/Instructions.h
> > ? ? llvm/trunk/lib/VMCore/AsmWriter.cpp
>
> > Modified: llvm/trunk/include/llvm/Instructions.h
> > URL:http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructi...
>
> > =========================================================================== ===
> > --- llvm/trunk/include/llvm/Instructions.h (original)
> > +++ llvm/trunk/include/llvm/Instructions.h Mon Feb ?9 09:45:06 2009
> > @@ -2186,7 +2186,9 @@
>
> > ? ?BasicBlock *getSuccessor(unsigned i) const {
> > ? ? ?assert(i < getNumSuccessors() && "Successor # out of range for Branch!");
> > - ? ?return cast(getOperand(i));
> > + ? ?if (Value *V = getOperand(i))
> > + ? ? ?return cast(V);
> > + ? ?return 0;
>
> return cast_or_null(getOperand(i));
Thanks, committed!
Cheers,
Gabor
>
> Nick
>
>
>
> > ? ?}
>
> > ? ?void setSuccessor(unsigned idx, BasicBlock *NewSucc) {
>
> > Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
> > URL:http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.c...
>
> > =========================================================================== ===
> > --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
> > +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Mon Feb ?9 09:45:06 2009
> > @@ -1505,13 +1505,14 @@
> > ? ?const Value *Operand = I.getNumOperands() ? I.getOperand(0) : 0;
>
> > ? ?// Special case conditional branches to swizzle the condition out to the front
> > - ?if (isa(I) && I.getNumOperands() > 1) {
> > + ?if (isa(I) && cast(I).isConditional()) {
> > + ? ?BranchInst &BI(cast(I));
> > ? ? ?Out << ' ';
> > - ? ?writeOperand(I.getOperand(2), true);
> > + ? ?writeOperand(BI.getCondition(), true);
> > ? ? ?Out << ", ";
> > - ? ?writeOperand(Operand, true);
> > + ? ?writeOperand(BI.getSuccessor(0), true);
> > ? ? ?Out << ", ";
> > - ? ?writeOperand(I.getOperand(1), true);
> > + ? ?writeOperand(BI.getSuccessor(1), true);
>
> > ? ?} else if (isa(I)) {
> > ? ? ?// Special case switch statement to get formatting nice and correct...
>
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-comm... at cs.uiuc.edu
> >http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-comm... at cs.uiuc.eduhttp://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From evan.cheng at apple.com Mon Feb 9 14:54:38 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 20:54:38 -0000
Subject: [llvm-commits] [llvm] r64163 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
test/CodeGen/X86/negative-subscript.ll
Message-ID: <200902092054.n19Ksc5H010422@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 14:54:38 2009
New Revision: 64163
URL: http://llvm.org/viewvc/llvm-project?rev=64163&view=rev
Log:
Make sure constant subscript is truncated to ptr size if it may not fit.
Added:
llvm/trunk/test/CodeGen/X86/negative-subscript.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=64163&r1=64162&r2=64163&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 9 14:54:38 2009
@@ -2699,8 +2699,15 @@
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD->getTypePaddedSize(Ty)*cast(CI)->getSExtValue();
+ SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
+ unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
+ if (PtrBits < 64)
+ OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
+ TLI.getPointerTy(), OffsVal);
+ else
+ OffsVal = DAG.getIntPtrConstant(Offs);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
- DAG.getIntPtrConstant(Offs));
+ OffsVal);
continue;
}
Added: llvm/trunk/test/CodeGen/X86/negative-subscript.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/negative-subscript.ll?rev=64163&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/negative-subscript.ll (added)
+++ llvm/trunk/test/CodeGen/X86/negative-subscript.ll Mon Feb 9 14:54:38 2009
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=x86
+; rdar://6559995
+
+ at a = external global [255 x i8*], align 32
+
+define i32 @main() nounwind {
+entry:
+ store i8* bitcast (i8** getelementptr ([255 x i8*]* @a, i32 0, i32 -2147483624) to i8*), i8** getelementptr ([255 x i8*]* @a, i32 0, i32 16), align 32
+ ret i32 0
+}
From evan.cheng at apple.com Mon Feb 9 15:01:06 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 21:01:06 -0000
Subject: [llvm-commits] [llvm] r64164 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Message-ID: <200902092101.n19L16kv010768@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 15:01:06 2009
New Revision: 64164
URL: http://llvm.org/viewvc/llvm-project?rev=64164&view=rev
Log:
Simplify code.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=64164&r1=64163&r2=64164&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 9 15:01:06 2009
@@ -2699,12 +2699,13 @@
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD->getTypePaddedSize(Ty)*cast(CI)->getSExtValue();
- SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
+ SDValue OffsVal;
unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
- if (PtrBits < 64)
- OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
- TLI.getPointerTy(), OffsVal);
- else
+ if (PtrBits < 64) {
+ OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
+ TLI.getPointerTy(),
+ DAG.getConstant(Offs, MVT::i64));
+ } else
OffsVal = DAG.getIntPtrConstant(Offs);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
OffsVal);
From isanbard at gmail.com Mon Feb 9 15:04:05 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 21:04:05 -0000
Subject: [llvm-commits] [llvm] r64165 - in /llvm/branches/Apple/Dib:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
test/CodeGen/X86/negative-subscript.ll
Message-ID: <200902092104.n19L45qs010877@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 15:04:05 2009
New Revision: 64165
URL: http://llvm.org/viewvc/llvm-project?rev=64165&view=rev
Log:
Pull r64163 into Dib:
Make sure constant subscript is truncated to ptr size if it may not fit.
Added:
llvm/branches/Apple/Dib/test/CodeGen/X86/negative-subscript.ll
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=64165&r1=64164&r2=64165&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 9 15:04:05 2009
@@ -2695,8 +2695,15 @@
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD->getTypePaddedSize(Ty)*cast(CI)->getSExtValue();
+ SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
+ unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
+ if (PtrBits < 64)
+ OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
+ TLI.getPointerTy(), OffsVal);
+ else
+ OffsVal = DAG.getIntPtrConstant(Offs);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
- DAG.getIntPtrConstant(Offs));
+ OffsVal);
continue;
}
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/negative-subscript.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/negative-subscript.ll?rev=64165&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/negative-subscript.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/negative-subscript.ll Mon Feb 9 15:04:05 2009
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=x86
+; rdar://6559995
+
+ at a = external global [255 x i8*], align 32
+
+define i32 @main() nounwind {
+entry:
+ store i8* bitcast (i8** getelementptr ([255 x i8*]* @a, i32 0, i32 -2147483624) to i8*), i8** getelementptr ([255 x i8*]* @a, i32 0, i32 16), align 32
+ ret i32 0
+}
From isanbard at gmail.com Mon Feb 9 15:05:45 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 21:05:45 -0000
Subject: [llvm-commits] [llvm] r64167 -
/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Message-ID: <200902092105.n19L5jGd010956@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 15:05:45 2009
New Revision: 64167
URL: http://llvm.org/viewvc/llvm-project?rev=64167&view=rev
Log:
Pull r64164 into Dib: Simplify code.
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp?rev=64167&r1=64166&r2=64167&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Feb 9 15:05:45 2009
@@ -2695,12 +2695,13 @@
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
TD->getTypePaddedSize(Ty)*cast(CI)->getSExtValue();
- SDValue OffsVal = DAG.getConstant(Offs, MVT::i64);
+ SDValue OffsVal;
unsigned PtrBits = TLI.getPointerTy().getSizeInBits();
- if (PtrBits < 64)
- OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
- TLI.getPointerTy(), OffsVal);
- else
+ if (PtrBits < 64) {
+ OffsVal = DAG.getNode(ISD::TRUNCATE, getCurDebugLoc(),
+ TLI.getPointerTy(),
+ DAG.getConstant(Offs, MVT::i64));
+ } else
OffsVal = DAG.getIntPtrConstant(Offs);
N = DAG.getNode(ISD::ADD, getCurDebugLoc(), N.getValueType(), N,
OffsVal);
From gohman at apple.com Mon Feb 9 15:25:34 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 21:25:34 -0000
Subject: [llvm-commits] [test-suite] r64170 - in /test-suite/trunk/External:
HMMER/ Nurbs/ SPEC/CINT95/099.go/ SPEC/CINT95/124.m88ksim/
SPEC/CINT95/126.gcc/ SPEC/CINT95/129.compress/ SPEC/CINT95/130.li/
SPEC/CINT95/132.ijpeg/ SPEC/CINT95/134.perl/ SPEC/CINT95/147.vortex/
Message-ID: <200902092125.n19LPZNh011720@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 15:25:34 2009
New Revision: 64170
URL: http://llvm.org/viewvc/llvm-project?rev=64170&view=rev
Log:
Add svn:ignore properties for Output directories.
Modified:
test-suite/trunk/External/HMMER/ (props changed)
test-suite/trunk/External/Nurbs/ (props changed)
test-suite/trunk/External/SPEC/CINT95/099.go/ (props changed)
test-suite/trunk/External/SPEC/CINT95/124.m88ksim/ (props changed)
test-suite/trunk/External/SPEC/CINT95/126.gcc/ (props changed)
test-suite/trunk/External/SPEC/CINT95/129.compress/ (props changed)
test-suite/trunk/External/SPEC/CINT95/130.li/ (props changed)
test-suite/trunk/External/SPEC/CINT95/132.ijpeg/ (props changed)
test-suite/trunk/External/SPEC/CINT95/134.perl/ (props changed)
test-suite/trunk/External/SPEC/CINT95/147.vortex/ (props changed)
Propchange: test-suite/trunk/External/HMMER/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/Nurbs/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/099.go/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/124.m88ksim/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/126.gcc/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/129.compress/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/130.li/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/132.ijpeg/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/134.perl/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
Propchange: test-suite/trunk/External/SPEC/CINT95/147.vortex/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 9 15:25:34 2009
@@ -0,0 +1 @@
+Output
From gohman at apple.com Mon Feb 9 15:27:50 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 21:27:50 -0000
Subject: [llvm-commits] [test-suite] r64171 -
/test-suite/trunk/SingleSource/UnitTests/Vector/Makefile
Message-ID: <200902092127.n19LRo6D011814@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 15:27:49 2009
New Revision: 64171
URL: http://llvm.org/viewvc/llvm-project?rev=64171&view=rev
Log:
Run the SSE tests when ARCH is x86_64.
Modified:
test-suite/trunk/SingleSource/UnitTests/Vector/Makefile
Modified: test-suite/trunk/SingleSource/UnitTests/Vector/Makefile
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/Makefile?rev=64171&r1=64170&r2=64171&view=diff
==============================================================================
--- test-suite/trunk/SingleSource/UnitTests/Vector/Makefile (original)
+++ test-suite/trunk/SingleSource/UnitTests/Vector/Makefile Mon Feb 9 15:27:49 2009
@@ -12,6 +12,9 @@
ifeq ($(ARCH),x86)
DIRS += SSE
endif
+ifeq ($(ARCH),x86_64)
+DIRS += SSE
+endif
include $(LEVEL)/SingleSource/Makefile.singlesrc
From evan.cheng at apple.com Mon Feb 9 15:36:39 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 21:36:39 -0000
Subject: [llvm-commits] [test-suite] r64172 -
/test-suite/trunk/Makefile.programs
Message-ID: <200902092136.n19LadFP012114@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 15:36:38 2009
New Revision: 64172
URL: http://llvm.org/viewvc/llvm-project?rev=64172&view=rev
Log:
Machine sinking is now on by default.
Modified:
test-suite/trunk/Makefile.programs
Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=64172&r1=64171&r2=64172&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Mon Feb 9 15:36:38 2009
@@ -211,10 +211,9 @@
endif#DISABLE_DIFFS
ifeq ($(ARCH),PowerPC)
-LLCBETAOPTION := -enable-sinking
+LLCBETAOPTION := --enable-ppc-preinc
#-aggressive-remat
#--enable-tail-merge
-#--enable-ppc-preinc
#-regalloc=local -fast
endif
ifeq ($(ARCH),Alpha)
From gohman at apple.com Mon Feb 9 15:51:02 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 21:51:02 -0000
Subject: [llvm-commits] [test-suite] r64174 -
/test-suite/trunk/Makefile.rules
Message-ID: <200902092151.n19Lp2mt012518@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 15:51:02 2009
New Revision: 64174
URL: http://llvm.org/viewvc/llvm-project?rev=64174&view=rev
Log:
Remove the predefine of __NO_MATH_INLINES. It is now predefined
by llvm-gcc. See PR879 for details.
Modified:
test-suite/trunk/Makefile.rules
Modified: test-suite/trunk/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.rules?rev=64174&r1=64173&r2=64174&view=diff
==============================================================================
--- test-suite/trunk/Makefile.rules (original)
+++ test-suite/trunk/Makefile.rules Mon Feb 9 15:51:02 2009
@@ -338,12 +338,6 @@
endif
endif
-ifeq ($(OS),Linux)
-ifeq ($(ARCH),x86)
-CPPFLAGS += -D__NO_MATH_INLINES
-endif
-endif
-
ifeq ($(ARCH),Alpha)
CPPFLAGS += -mieee
CFLAGS += -mieee
From gohman at apple.com Mon Feb 9 16:00:18 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 09 Feb 2009 22:00:18 -0000
Subject: [llvm-commits] [test-suite] r64176 -
/test-suite/trunk/Makefile.programs
Message-ID: <200902092200.n19M0I3a012971@zion.cs.uiuc.edu>
Author: djg
Date: Mon Feb 9 16:00:17 2009
New Revision: 64176
URL: http://llvm.org/viewvc/llvm-project?rev=64176&view=rev
Log:
Handle ARCH=x86_64 the same as ARCH=x86 here.
Modified:
test-suite/trunk/Makefile.programs
Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=64176&r1=64175&r2=64176&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Mon Feb 9 16:00:17 2009
@@ -223,6 +223,9 @@
ifeq ($(ARCH),IA64)
LLCBETAOPTION := -sched=simple
endif
+ifeq ($(ARCH),x86_64)
+LLCBETAOPTION := -disable-post-RA-scheduler=false
+endif
ifeq ($(ARCH),x86)
LLCBETAOPTION := -disable-post-RA-scheduler=false
#-pre-alloc-split
@@ -347,11 +350,13 @@
# -enable-eh is no longer required to get DWARF exceptions.
ifneq ($(ARCH),PowerPC)
ifneq ($(ARCH),x86)
+ifneq ($(ARCH),x86_64)
LLCFLAGS += -enable-correct-eh-support
LLVMLD_FLAGS += -disable-inlining
endif
endif
endif
+endif
# Pass target specific llc flags
ifdef TARGET_LLCFLAGS
From dalej at apple.com Mon Feb 9 16:14:15 2009
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 09 Feb 2009 22:14:15 -0000
Subject: [llvm-commits] [llvm] r64177 - in /llvm/trunk:
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
Message-ID: <200902092214.n19MEFhH013451@zion.cs.uiuc.edu>
Author: johannes
Date: Mon Feb 9 16:14:15 2009
New Revision: 64177
URL: http://llvm.org/viewvc/llvm-project?rev=64177&view=rev
Log:
Fix PR 3471, and some cleanups.
Added:
llvm/trunk/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=64177&r1=64176&r2=64177&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Feb 9 16:14:15 2009
@@ -430,8 +430,8 @@
if (!AddRec->isAffine()) return false;
// If Start contains an SCEVAddRecExpr from a different loop, other than an
- // outer loop of the current loop, reject it. SCEV has no concept of operating
- // on one loop at a time so don't confuse it with such expressions.
+ // outer loop of the current loop, reject it. SCEV has no concept of
+ // operating on one loop at a time so don't confuse it with such expressions.
if (containsAddRecFromDifferentLoop(Start, L))
return false;
@@ -774,14 +774,14 @@
// which need not be an immediate predecessor of this PHI. This way we
// need only one copy of it even if it is referenced multiple times in
// the PHI. We don't do this when the original expression is inside the
- // loop because multiple copies sometimes do useful sinking of code in that
- // case(?).
+ // loop because multiple copies sometimes do useful sinking of code in
+ // that case(?).
Instruction *OldLoc = dyn_cast(OperandValToReplace);
if (L->contains(OldLoc->getParent())) {
- // If this is a critical edge, split the edge so that we do not insert the
- // code on all predecessor/successor paths. We do this unless this is the
- // canonical backedge for this loop, as this can make some inserted code
- // be in an illegal position.
+ // If this is a critical edge, split the edge so that we do not insert
+ // the code on all predecessor/successor paths. We do this unless this
+ // is the canonical backedge for this loop, as this can make some
+ // inserted code be in an illegal position.
BasicBlock *PHIPred = PN->getIncomingBlock(i);
if (e != 1 && PHIPred->getTerminator()->getNumSuccessors() > 1 &&
(PN->getParent() != L->getHeader() || !L->contains(PHIPred))) {
@@ -1224,19 +1224,21 @@
return true;
}
-/// RequiresTypeConversion - Returns true if converting Ty to NewTy is not
+/// RequiresTypeConversion - Returns true if converting Ty1 to Ty2 is not
/// a nop.
bool LoopStrengthReduce::RequiresTypeConversion(const Type *Ty1,
const Type *Ty2) {
if (Ty1 == Ty2)
return false;
+ if (Ty1->canLosslesslyBitCastTo(Ty2))
+ return false;
if (TLI && TLI->isTruncateFree(Ty1, Ty2))
return false;
- return (!Ty1->canLosslesslyBitCastTo(Ty2) &&
- !(isa(Ty2) &&
- Ty1->canLosslesslyBitCastTo(UIntPtrTy)) &&
- !(isa(Ty1) &&
- Ty2->canLosslesslyBitCastTo(UIntPtrTy)));
+ if (isa(Ty2) && Ty1->canLosslesslyBitCastTo(UIntPtrTy))
+ return false;
+ if (isa(Ty1) && Ty2->canLosslesslyBitCastTo(UIntPtrTy))
+ return false;
+ return true;
}
/// CheckForIVReuse - Returns the multiple if the stride is the multiple
@@ -1661,15 +1663,28 @@
Rewriter.clear();
// If we are reusing the iv, then it must be multiplied by a constant
- // factor take advantage of addressing mode scale component.
+ // factor to take advantage of the addressing mode scale component.
if (!isa(RewriteFactor) ||
!cast(RewriteFactor)->isZero()) {
// If we're reusing an IV with a nonzero base (currently this happens
// only when all reuses are outside the loop) subtract that base here.
// The base has been used to initialize the PHI node but we don't want
// it here.
- if (!ReuseIV.Base->isZero())
- RewriteExpr = SE->getMinusSCEV(RewriteExpr, ReuseIV.Base);
+ if (!ReuseIV.Base->isZero()) {
+ SCEVHandle typedBase = ReuseIV.Base;
+ if (RewriteExpr->getType()->getPrimitiveSizeInBits() !=
+ ReuseIV.Base->getType()->getPrimitiveSizeInBits()) {
+ // It's possible the original IV is a larger type than the new IV,
+ // in which case we have to truncate the Base. We checked in
+ // RequiresTypeConversion that this is valid.
+ assert (RewriteExpr->getType()->getPrimitiveSizeInBits() <
+ ReuseIV.Base->getType()->getPrimitiveSizeInBits() &&
+ "Unexpected lengthening conversion!");
+ typedBase = SE->getTruncateExpr(ReuseIV.Base,
+ RewriteExpr->getType());
+ }
+ RewriteExpr = SE->getMinusSCEV(RewriteExpr, typedBase);
+ }
// Multiply old variable, with base removed, by new scale factor.
RewriteExpr = SE->getMulExpr(RewriteFactor,
Added: llvm/trunk/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll?rev=64177&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll (added)
+++ llvm/trunk/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll Mon Feb 9 16:14:15 2009
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | llc
+; This used to crash.
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout ="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @parse_number(i8* nocapture %p) nounwind {
+entry:
+ %shift.0 = select i1 false, i32 4, i32 2 ; [#uses=1]
+ br label %bb47
+
+bb47: ; preds = %bb47, %entry
+ br i1 false, label %bb54, label %bb47
+
+bb54: ; preds = %bb47
+ br i1 false, label %bb56, label %bb66
+
+bb56: ; preds = %bb62, %bb54
+ %p_addr.0.pn.rec = phi i64 [ %p_addr.6.rec, %bb62 ], [ 0, %bb54 ] ; [#uses=2]
+ %ch.6.in.in = phi i8* [ %p_addr.6, %bb62 ], [ null, %bb54 ] ; [#uses=0]
+ %indvar202 = trunc i64 %p_addr.0.pn.rec to i32 ; [#uses=1]
+ %frac_bits.0 = mul i32 %indvar202, %shift.0 ; [#uses=1]
+ %p_addr.6.rec = add i64 %p_addr.0.pn.rec, 1 ; [#uses=2]
+ %p_addr.6 = getelementptr i8* null, i64 %p_addr.6.rec ; [#uses=1]
+ br i1 false, label %bb66, label %bb62
+
+bb62: ; preds = %bb56
+ br label %bb56
+
+bb66: ; preds = %bb56, %bb54
+ %frac_bits.1 = phi i32 [ 0, %bb54 ], [ %frac_bits.0, %bb56 ] ; [#uses=0]
+ unreachable
+}
From kremenek at apple.com Mon Feb 9 16:23:44 2009
From: kremenek at apple.com (Ted Kremenek)
Date: Mon, 09 Feb 2009 22:23:44 -0000
Subject: [llvm-commits] [llvm] r64178 - /llvm/tags/checker/checker-0.152/
Message-ID: <200902092223.n19MNisJ013798@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Feb 9 16:23:44 2009
New Revision: 64178
URL: http://llvm.org/viewvc/llvm-project?rev=64178&view=rev
Log:
Tagging checker-0.152.
Added:
llvm/tags/checker/checker-0.152/
- copied from r64177, llvm/trunk/
From isanbard at gmail.com Mon Feb 9 16:24:56 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 22:24:56 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r64180 - /llvm-gcc-4.2/trunk/build_gcc
Message-ID: <200902092224.n19MOuxb013861@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 16:24:56 2009
New Revision: 64180
URL: http://llvm.org/viewvc/llvm-project?rev=64180&view=rev
Log:
Don't strip dSYM objects.
Modified:
llvm-gcc-4.2/trunk/build_gcc
Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=64180&r1=64179&r2=64180&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Mon Feb 9 16:24:56 2009
@@ -582,17 +582,20 @@
# Remove debugging information from DEST_DIR.
if [ "x$LLVM_DEBUG" != "x1" ]; then
- find $DEST_DIR -perm -0111 \! -name \*.dylib \! -name fixinc.sh \
- \! -name mkheaders \! -name libstdc++.dylib -type f -print \
+ # LLVM LOCAL begin - don't strip dSYM objects
+ find $DEST_DIR -perm -0111 \! -path '*DWARF*' \! -name \*.dylib \
+ \! -name fixinc.sh \! -name mkheaders \! -name libstdc++.dylib \
+ -type f -print \
| xargs strip || exit 1
- # APPLE LOCAL begin LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR \( -name \*.a -or -name \*.dylib \) \
+ # LLVM LOCAL begin - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' \( -name \*.a -or -name \*.dylib \) \
\! -name libgcc_s.10.*.dylib \! -name libstdc++.dylib -type f \
-print \
| xargs strip -SX || exit 1
- # APPLE LOCAL end LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR -name \*.a -type f -print \
+ # LLVM LOCAL end - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' -name \*.a -type f -print \
| xargs ranlib || exit 1
+ # LLVM LOCAL end - don't strip dSYM objects
fi
# LLVM LOCAL begin
From isanbard at gmail.com Mon Feb 9 16:25:24 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 22:25:24 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r64181 -
/llvm-gcc-4.2/branches/Apple/Dib/build_gcc
Message-ID: <200902092225.n19MPOeL013888@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 16:25:23 2009
New Revision: 64181
URL: http://llvm.org/viewvc/llvm-project?rev=64181&view=rev
Log:
Don't strip dSYM objects.
Modified:
llvm-gcc-4.2/branches/Apple/Dib/build_gcc
Modified: llvm-gcc-4.2/branches/Apple/Dib/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/build_gcc?rev=64181&r1=64180&r2=64181&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/build_gcc (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/build_gcc Mon Feb 9 16:25:23 2009
@@ -582,17 +582,20 @@
# Remove debugging information from DEST_DIR.
if [ "x$LLVM_DEBUG" != "x1" ]; then
- find $DEST_DIR -perm -0111 \! -name \*.dylib \! -name fixinc.sh \
- \! -name mkheaders \! -name libstdc++.dylib -type f -print \
+ # LLVM LOCAL begin - don't strip dSYM objects
+ find $DEST_DIR -perm -0111 \! -path '*DWARF*' \! -name \*.dylib \
+ \! -name fixinc.sh \! -name mkheaders \! -name libstdc++.dylib \
+ -type f -print \
| xargs strip || exit 1
- # APPLE LOCAL begin LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR \( -name \*.a -or -name \*.dylib \) \
+ # LLVM LOCAL begin - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' \( -name \*.a -or -name \*.dylib \) \
\! -name libgcc_s.10.*.dylib \! -name libstdc++.dylib -type f \
-print \
| xargs strip -SX || exit 1
- # APPLE LOCAL end LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR -name \*.a -type f -print \
+ # LLVM LOCAL end - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' -name \*.a -type f -print \
| xargs ranlib || exit 1
+ # LLVM LOCAL end - don't strip dSYM objects
fi
# LLVM LOCAL begin
From isanbard at gmail.com Mon Feb 9 16:34:46 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 22:34:46 -0000
Subject: [llvm-commits] [llvm] r64182 - in /llvm/branches/Apple/Dib:
lib/Transforms/Scalar/LoopStrengthReduce.cpp
test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
Message-ID: <200902092234.n19MYkpi014204@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 16:34:46 2009
New Revision: 64182
URL: http://llvm.org/viewvc/llvm-project?rev=64182&view=rev
Log:
Pull r64177 into Dib:
Fix PR 3471, and some cleanups.
Added:
llvm/branches/Apple/Dib/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
Modified:
llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp
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=64182&r1=64181&r2=64182&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Feb 9 16:34:46 2009
@@ -430,8 +430,8 @@
if (!AddRec->isAffine()) return false;
// If Start contains an SCEVAddRecExpr from a different loop, other than an
- // outer loop of the current loop, reject it. SCEV has no concept of operating
- // on one loop at a time so don't confuse it with such expressions.
+ // outer loop of the current loop, reject it. SCEV has no concept of
+ // operating on one loop at a time so don't confuse it with such expressions.
if (containsAddRecFromDifferentLoop(Start, L))
return false;
@@ -774,14 +774,14 @@
// which need not be an immediate predecessor of this PHI. This way we
// need only one copy of it even if it is referenced multiple times in
// the PHI. We don't do this when the original expression is inside the
- // loop because multiple copies sometimes do useful sinking of code in that
- // case(?).
+ // loop because multiple copies sometimes do useful sinking of code in
+ // that case(?).
Instruction *OldLoc = dyn_cast(OperandValToReplace);
if (L->contains(OldLoc->getParent())) {
- // If this is a critical edge, split the edge so that we do not insert the
- // code on all predecessor/successor paths. We do this unless this is the
- // canonical backedge for this loop, as this can make some inserted code
- // be in an illegal position.
+ // If this is a critical edge, split the edge so that we do not insert
+ // the code on all predecessor/successor paths. We do this unless this
+ // is the canonical backedge for this loop, as this can make some
+ // inserted code be in an illegal position.
BasicBlock *PHIPred = PN->getIncomingBlock(i);
if (e != 1 && PHIPred->getTerminator()->getNumSuccessors() > 1 &&
(PN->getParent() != L->getHeader() || !L->contains(PHIPred))) {
@@ -1224,19 +1224,21 @@
return true;
}
-/// RequiresTypeConversion - Returns true if converting Ty to NewTy is not
+/// RequiresTypeConversion - Returns true if converting Ty1 to Ty2 is not
/// a nop.
bool LoopStrengthReduce::RequiresTypeConversion(const Type *Ty1,
const Type *Ty2) {
if (Ty1 == Ty2)
return false;
+ if (Ty1->canLosslesslyBitCastTo(Ty2))
+ return false;
if (TLI && TLI->isTruncateFree(Ty1, Ty2))
return false;
- return (!Ty1->canLosslesslyBitCastTo(Ty2) &&
- !(isa(Ty2) &&
- Ty1->canLosslesslyBitCastTo(UIntPtrTy)) &&
- !(isa(Ty1) &&
- Ty2->canLosslesslyBitCastTo(UIntPtrTy)));
+ if (isa(Ty2) && Ty1->canLosslesslyBitCastTo(UIntPtrTy))
+ return false;
+ if (isa(Ty1) && Ty2->canLosslesslyBitCastTo(UIntPtrTy))
+ return false;
+ return true;
}
/// CheckForIVReuse - Returns the multiple if the stride is the multiple
@@ -1661,15 +1663,28 @@
Rewriter.clear();
// If we are reusing the iv, then it must be multiplied by a constant
- // factor take advantage of addressing mode scale component.
+ // factor to take advantage of the addressing mode scale component.
if (!isa(RewriteFactor) ||
!cast(RewriteFactor)->isZero()) {
// If we're reusing an IV with a nonzero base (currently this happens
// only when all reuses are outside the loop) subtract that base here.
// The base has been used to initialize the PHI node but we don't want
// it here.
- if (!ReuseIV.Base->isZero())
- RewriteExpr = SE->getMinusSCEV(RewriteExpr, ReuseIV.Base);
+ if (!ReuseIV.Base->isZero()) {
+ SCEVHandle typedBase = ReuseIV.Base;
+ if (RewriteExpr->getType()->getPrimitiveSizeInBits() !=
+ ReuseIV.Base->getType()->getPrimitiveSizeInBits()) {
+ // It's possible the original IV is a larger type than the new IV,
+ // in which case we have to truncate the Base. We checked in
+ // RequiresTypeConversion that this is valid.
+ assert (RewriteExpr->getType()->getPrimitiveSizeInBits() <
+ ReuseIV.Base->getType()->getPrimitiveSizeInBits() &&
+ "Unexpected lengthening conversion!");
+ typedBase = SE->getTruncateExpr(ReuseIV.Base,
+ RewriteExpr->getType());
+ }
+ RewriteExpr = SE->getMinusSCEV(RewriteExpr, typedBase);
+ }
// Multiply old variable, with base removed, by new scale factor.
RewriteExpr = SE->getMulExpr(RewriteFactor,
Added: llvm/branches/Apple/Dib/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll?rev=64182&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/LoopStrengthReduce/2009-02-09-ivs-different-sizes.ll Mon Feb 9 16:34:46 2009
@@ -0,0 +1,33 @@
+; RUN: llvm-as < %s | llc
+; This used to crash.
+; ModuleID = 'bugpoint-reduced-simplified.bc'
+target datalayout ="e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
+target triple = "x86_64-unknown-linux-gnu"
+
+define void @parse_number(i8* nocapture %p) nounwind {
+entry:
+ %shift.0 = select i1 false, i32 4, i32 2 ; [#uses=1]
+ br label %bb47
+
+bb47: ; preds = %bb47, %entry
+ br i1 false, label %bb54, label %bb47
+
+bb54: ; preds = %bb47
+ br i1 false, label %bb56, label %bb66
+
+bb56: ; preds = %bb62, %bb54
+ %p_addr.0.pn.rec = phi i64 [ %p_addr.6.rec, %bb62 ], [ 0, %bb54 ] ; [#uses=2]
+ %ch.6.in.in = phi i8* [ %p_addr.6, %bb62 ], [ null, %bb54 ] ; [#uses=0]
+ %indvar202 = trunc i64 %p_addr.0.pn.rec to i32 ; [#uses=1]
+ %frac_bits.0 = mul i32 %indvar202, %shift.0 ; [#uses=1]
+ %p_addr.6.rec = add i64 %p_addr.0.pn.rec, 1 ; [#uses=2]
+ %p_addr.6 = getelementptr i8* null, i64 %p_addr.6.rec ; [#uses=1]
+ br i1 false, label %bb66, label %bb62
+
+bb62: ; preds = %bb56
+ br label %bb56
+
+bb66: ; preds = %bb56, %bb54
+ %frac_bits.1 = phi i32 [ 0, %bb54 ], [ %frac_bits.0, %bb56 ] ; [#uses=0]
+ unreachable
+}
From isanbard at gmail.com Mon Feb 9 16:41:59 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 09 Feb 2009 22:41:59 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r64183 -
/llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc
Message-ID: <200902092242.n19Mg0Ou014461@zion.cs.uiuc.edu>
Author: void
Date: Mon Feb 9 16:41:59 2009
New Revision: 64183
URL: http://llvm.org/viewvc/llvm-project?rev=64183&view=rev
Log:
Don't strip dSYM objects.
Modified:
llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc
Modified: llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc?rev=64183&r1=64182&r2=64183&view=diff
==============================================================================
--- llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc (original)
+++ llvm-gcc-4.2/tags/Apple/llvmgcc42-2095.1/build_gcc Mon Feb 9 16:41:59 2009
@@ -582,17 +582,20 @@
# Remove debugging information from DEST_DIR.
if [ "x$LLVM_DEBUG" != "x1" ]; then
- find $DEST_DIR -perm -0111 \! -name \*.dylib \! -name fixinc.sh \
- \! -name mkheaders \! -name libstdc++.dylib -type f -print \
+ # LLVM LOCAL begin - don't strip dSYM objects
+ find $DEST_DIR -perm -0111 \! -path '*DWARF*' \! -name \*.dylib \
+ \! -name fixinc.sh \! -name mkheaders \! -name libstdc++.dylib \
+ -type f -print \
| xargs strip || exit 1
- # APPLE LOCAL begin LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR \( -name \*.a -or -name \*.dylib \) \
+ # LLVM LOCAL begin - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' \( -name \*.a -or -name \*.dylib \) \
\! -name libgcc_s.10.*.dylib \! -name libstdc++.dylib -type f \
-print \
| xargs strip -SX || exit 1
- # APPLE LOCAL end LLVM - Strip with -Sx instead of -SX
- find $DEST_DIR -name \*.a -type f -print \
+ # LLVM LOCAL end - Strip with -Sx instead of -SX
+ find $DEST_DIR \! -path '*DWARF*' -name \*.a -type f -print \
| xargs ranlib || exit 1
+ # LLVM LOCAL end - don't strip dSYM objects
fi
# LLVM LOCAL begin
From evan.cheng at apple.com Mon Feb 9 16:47:36 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 22:47:36 -0000
Subject: [llvm-commits] [llvm] r64184 -
/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp
Message-ID: <200902092247.n19MlaFN014685@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 16:47:36 2009
New Revision: 64184
URL: http://llvm.org/viewvc/llvm-project?rev=64184&view=rev
Log:
If the target cannot issue a copy for the given source and dest registers, abort instead of silently continue.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp?rev=64184&r1=64183&r2=64184&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodesEmit.cpp Mon Feb 9 16:47:36 2009
@@ -125,10 +125,11 @@
} else {
// Create the reg, emit the copy.
VRBase = MRI.createVirtualRegister(DstRC);
- bool Emitted =
- TII->copyRegToReg(*BB, End, VRBase, SrcReg, DstRC, SrcRC);
- Emitted = Emitted; // Silence compiler warning.
- assert(Emitted && "Unable to issue a copy instruction!");
+ bool Emitted = TII->copyRegToReg(*BB, End, VRBase, SrcReg, DstRC, SrcRC);
+ if (!Emitted) {
+ cerr << "Unable to issue a copy instruction!\n";
+ abort();
+ }
}
SDValue Op(Node, ResNo);
@@ -529,7 +530,11 @@
else
DstTRC = TRI->getPhysicalRegisterRegClass(DestReg,
Node->getOperand(1).getValueType());
- TII->copyRegToReg(*BB, End, DestReg, SrcReg, DstTRC, SrcTRC);
+ bool Emitted = TII->copyRegToReg(*BB, End, DestReg, SrcReg, DstTRC, SrcTRC);
+ if (!Emitted) {
+ cerr << "Unable to issue a copy instruction!\n";
+ abort();
+ }
break;
}
case ISD::CopyFromReg: {
From dalej at apple.com Mon Feb 9 16:59:35 2009
From: dalej at apple.com (Dale Johannesen)
Date: Mon, 9 Feb 2009 14:59:35 -0800
Subject: [llvm-commits] [llvm] r64124 - in /llvm/trunk:
include/llvm/Target/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/
lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PowerPC/
lib/Target/X86/ lib/Target/XCore/
In-Reply-To: <6EE4E128-338A-4737-AE0A-1359A9DE6318@apple.com>
References: <200902090714.n197EMxc004979@zion.cs.uiuc.edu>
<1067F87A-9600-411A-810D-9D450ADC7C46@apple.com>
<6EE4E128-338A-4737-AE0A-1359A9DE6318@apple.com>
Message-ID:
On Feb 9, 2009, at 12:41 AMPST, Evan Cheng wrote:
>
> On Feb 8, 2009, at 11:20 PM, Chris Lattner wrote:
>
>>
>> On Feb 8, 2009, at 11:14 PM, Evan Cheng wrote:
>>
>>> Author: evancheng
>>> Date: Mon Feb 9 01:14:22 2009
>>> New Revision: 64124
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=64124&view=rev
>>> Log:
>>> Turns out AnalyzeBranch can modify the mbb being analyzed. This is a
>>> nasty
>>> suprise to some callers, e.g. register coalescer. For now, add an
>>> parameter
>>> that tells AnalyzeBranch whether it's safe to modify the mbb. A
>>> better
>>> solution is out there, but I don't have time to deal with it right
>>> now.
>>
>> Whoa, that's really not cool. *why* does analyze branch modify a
>> mbb? What breaks if that is disabled from all targets?
>
> It's trimming instructions in a mbb after an unconditional branch. I
> don't know why that would happen but it does. I think it's branching
> folding's job to trim those instructions. But I don't have the energy
> to deal with that right now.
I think it's every pass's job to be sure things like this don't get
created, and the verification between passes should check it. This
was not a popular view last time I expressed it:)
From evan.cheng at apple.com Mon Feb 9 17:32:07 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 09 Feb 2009 23:32:07 -0000
Subject: [llvm-commits] [llvm] r64186 - in /llvm/trunk:
lib/Target/X86/X86FloatingPoint.cpp lib/Target/X86/X86InstrFPStack.td
lib/Target/X86/X86InstrInfo.cpp test/CodeGen/X86/fp-stack-set-st1.ll
Message-ID: <200902092332.n19NW72X016523@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Feb 9 17:32:07 2009
New Revision: 64186
URL: http://llvm.org/viewvc/llvm-project?rev=64186&view=rev
Log:
Implement FpSET_ST1_*.
Added:
llvm/trunk/test/CodeGen/X86/fp-stack-set-st1.ll
Modified:
llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
llvm/trunk/lib/Target/X86/X86InstrFPStack.td
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=64186&r1=64185&r2=64186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Feb 9 17:32:07 2009
@@ -982,7 +982,21 @@
case X86::FpSET_ST0_32:
case X86::FpSET_ST0_64:
case X86::FpSET_ST0_80:
- assert(StackTop == 1 && "Stack should have one element on it to return!");
+ assert((StackTop == 1 || StackTop == 2)
+ && "Stack should have one or two element on it to return!");
+ --StackTop; // "Forget" we have something on the top of stack!
+ break;
+ case X86::FpSET_ST1_32:
+ case X86::FpSET_ST1_64:
+ case X86::FpSET_ST1_80:
+ // StackTop can be 1 if a FpSET_ST0_* was before this. Exchange them.
+ if (StackTop == 1) {
+ BuildMI(*MBB, I, TII->get(X86::XCH_F)).addReg(X86::ST1);
+ NumFXCH++;
+ StackTop = 0;
+ break;
+ }
+ assert(StackTop == 2 && "Stack should have two element on it to return!");
--StackTop; // "Forget" we have something on the top of stack!
break;
case X86::MOV_Fp3232:
Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=64186&r1=64185&r2=64186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Mon Feb 9 17:32:07 2009
@@ -151,6 +151,12 @@
def FpSET_ST0_80 : FpI_<(outs), (ins RFP80:$src), SpecialFP, []>; // ST(0) = FPR
}
+let Defs = [ST1] in {
+def FpSET_ST1_32 : FpI_<(outs), (ins RFP32:$src), SpecialFP, []>; // ST(1) = FPR
+def FpSET_ST1_64 : FpI_<(outs), (ins RFP64:$src), SpecialFP, []>; // ST(1) = FPR
+def FpSET_ST1_80 : FpI_<(outs), (ins RFP80:$src), SpecialFP, []>; // ST(1) = FPR
+}
+
// FpIf32, FpIf64 - Floating Point Psuedo Instruction template.
// f32 instructions can use SSE1 and are predicated on FPStackf32 == !SSE1.
// f64 instructions can use SSE2 and are predicated on FPStackf64 == !SSE2.
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=64186&r1=64185&r2=64186&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Feb 9 17:32:07 2009
@@ -1753,19 +1753,20 @@
// Moving to ST(0) turns into FpSET_ST0_32 etc.
if (DestRC == &X86::RSTRegClass) {
- // Copying to ST(0). FIXME: handle ST(1) also
- if (DestReg != X86::ST0)
+ // Copying to ST(0) / ST(1).
+ if (DestReg != X86::ST0 && DestReg != X86::ST1)
// Can only copy to TOS right now
return false;
+ bool isST0 = DestReg == X86::ST0;
unsigned Opc;
if (SrcRC == &X86::RFP32RegClass)
- Opc = X86::FpSET_ST0_32;
+ Opc = isST0 ? X86::FpSET_ST0_32 : X86::FpSET_ST1_32;
else if (SrcRC == &X86::RFP64RegClass)
- Opc = X86::FpSET_ST0_64;
+ Opc = isST0 ? X86::FpSET_ST0_64 : X86::FpSET_ST1_64;
else {
if (SrcRC != &X86::RFP80RegClass)
return false;
- Opc = X86::FpSET_ST0_80;
+ Opc = isST0 ? X86::FpSET_ST0_80 : X86::FpSET_ST1_80;
}
BuildMI(MBB, MI, get(Opc)).addReg(SrcReg);
return true;
Added: llvm/trunk/test/CodeGen/X86/fp-stack-set-st1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-stack-set-st1.ll?rev=64186&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fp-stack-set-st1.ll (added)
+++ llvm/trunk/test/CodeGen/X86/fp-stack-set-st1.ll Mon Feb 9 17:32:07 2009
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llc -march=x86 | grep fxch | count 2
+
+define i32 @main() nounwind {
+entry:
+ %asmtmp = tail call { double, double } asm sideeffect "fmul\09%st(1),%st\0A\09fst\09%st(1)\0A\09frndint\0A\09fxch %st(1)\0A\09fsub\09%st(1),%st\0A\09f2xm1\0A\09", "={st},={st(1)},0,1,~{dirflag},~{fpsr},~{flags}"(double 0x4030FEFBD582097D, double 4.620000e+01) nounwind ; <{ double, double }> [#uses=0]
+ unreachable
+}
From sanjiv.gupta at microchip.com Mon Feb 9 22:20:27 2009
From: sanjiv.gupta at microchip.com (Sanjiv Gupta)
Date: Tue, 10 Feb 2009 04:20:27 -0000
Subject: [llvm-commits] [llvm] r64199 -
/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
Message-ID: <200902100420.n1A4KRXx010552@zion.cs.uiuc.edu>
Author: sgupta
Date: Mon Feb 9 22:20:26 2009
New Revision: 64199
URL: http://llvm.org/viewvc/llvm-project?rev=64199&view=rev
Log:
Function temporaries can not overlap with retval or args.See the comment in source code to know the reason. Anything having .auto. in its name is local to a function in nature irrespective of the linkage specified. print static local variables in module level IDATA section.
Modified:
llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp?rev=64199&r1=64198&r2=64199&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PIC16/PIC16AsmPrinter.cpp Mon Feb 9 22:20:26 2009
@@ -212,15 +212,19 @@
// Emit declarations for external globals.
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
I != E; I++) {
+ // Any variables reaching here with ".auto." in its name is a local scope
+ // variable and should not be printed in global data section.
std::string Name = Mang->getValueName(I);
+ if (Name.find(".auto.") != std::string::npos)
+ continue;
+
if (I->isDeclaration())
O << "\textern "<< Name << "\n";
- else if (I->getLinkage() == GlobalValue::CommonLinkage)
- O << "\tglobal "<< Name << "\n";
- else if (I->getLinkage() == GlobalValue::ExternalLinkage)
+ else if (I->hasCommonLinkage() || I->hasExternalLinkage())
O << "\tglobal "<< Name << "\n";
}
}
+
void PIC16AsmPrinter::EmitInitData (Module &M) {
SwitchToSection(TAI->getDataSection());
for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
@@ -240,7 +244,7 @@
// Any variables reaching here with "." in its name is a local scope
// variable and should not be printed in global data section.
std::string name = Mang->getValueName(I);
- if (name.find(".") != std::string::npos)
+ if (name.find(".auto.") != std::string::npos)
continue;
O << name;
@@ -352,9 +356,12 @@
// The variables of a function are of form FuncName.* . If this variable
// does not belong to this function then continue.
- if (!(VarName.find(FuncName + ".") == 0 ? true : false))
+ // Static local varilabes of a function does not have .auto. in their
+ // name. They are not printed as part of function data but module
+ // level global data.
+ if (!(VarName.find(FuncName + ".auto.") == 0 ? true : false))
continue;
-
+
Constant *C = I->getInitializer();
const Type *Ty = C->getType();
unsigned Size = TD->getTypePaddedSize(Ty);
@@ -362,9 +369,14 @@
// Emit memory reserve directive.
O << VarName << " RES " << Size << "\n";
}
- emitFunctionTempData(MF, FrameSize);
+
+ // Return value can not overlap with temp data, becasue a temp slot
+ // may be read/written after a return value is calculated and saved
+ // within the function.
if (RetSize > FrameSize)
- O << CurrentFnName << ".dummy" << "RES" << (RetSize - FrameSize);
+ O << CurrentFnName << ".dummy" << " RES " << (RetSize - FrameSize) << "\n";
+
+ emitFunctionTempData(MF, FrameSize);
}
void PIC16AsmPrinter::emitFunctionTempData(MachineFunction &MF,
From kremenek at apple.com Mon Feb 9 23:44:31 2009
From: kremenek at apple.com (Ted Kremenek)
Date: Tue, 10 Feb 2009 05:44:31 -0000
Subject: [llvm-commits] [llvm] r64201 - /llvm/tags/checker/checker-0.153/
Message-ID: <200902100544.n1A5iVXe013502@zion.cs.uiuc.edu>
Author: kremenek
Date: Mon Feb 9 23:44:31 2009
New Revision: 64201
URL: http://llvm.org/viewvc/llvm-project?rev=64201&view=rev
Log:
Tagging checker-0.153.
Added:
llvm/tags/checker/checker-0.153/
- copied from r64200, llvm/trunk/
From dpatel at apple.com Tue Feb 10 00:04:08 2009
From: dpatel at apple.com (Devang Patel)
Date: Tue, 10 Feb 2009 06:04:08 -0000
Subject: [llvm-commits] [llvm] r64204 -
/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Message-ID: <200902100604.n1A6481f014098@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Feb 10 00:04:08 2009
New Revision: 64204
URL: http://llvm.org/viewvc/llvm-project?rev=64204&view=rev
Log:
Validate file id.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=64204&r1=64203&r2=64204&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Tue Feb 10 00:04:08 2009
@@ -1554,6 +1554,7 @@
unsigned Line = V->getLineNumber();
CompileUnit *Unit = FindCompileUnit(V->getCompileUnit());
FileID = Unit->getID();
+ assert (FileID && "Invalid file id");
AddUInt(Die, DW_AT_decl_file, 0, FileID);
AddUInt(Die, DW_AT_decl_line, 0, Line);
}
@@ -1565,6 +1566,7 @@
unsigned Line = G->getLineNumber();
CompileUnit *Unit = FindCompileUnit(G->getCompileUnit());
FileID = Unit->getID();
+ assert (FileID && "Invalid file id");
AddUInt(Die, DW_AT_decl_file, 0, FileID);
AddUInt(Die, DW_AT_decl_line, 0, Line);
}
@@ -1577,6 +1579,7 @@
return;
CompileUnit *Unit = FindCompileUnit(CU);
FileID = Unit->getID();
+ assert (FileID && "Invalid file id");
AddUInt(Die, DW_AT_decl_file, 0, FileID);
AddUInt(Die, DW_AT_decl_line, 0, Line);
}
From anton at korobeynikov.info Tue Feb 10 00:06:29 2009
From: anton at korobeynikov.info (Anton Korobeynikov)
Date: Tue, 10 Feb 2009 09:06:29 +0300
Subject: [llvm-commits] [llvm] r64186 - in /llvm/trunk:
lib/Target/X86/X86FloatingPoint.cpp
lib/Target/X86/X86InstrFPStack.td lib/Target/X86/X86InstrInfo.cpp
test/CodeGen/X86/fp-stack-set-st1.ll
In-Reply-To: <200902092332.n19NW72X016523@zion.cs.uiuc.edu>
References: <200902092332.n19NW72X016523@zion.cs.uiuc.edu>
Message-ID:
Hello, Evan
> Log:
> Implement FpSET_ST1_*.
Did this fix PR2257?
--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
From dpatel at apple.com Tue Feb 10 01:00:59 2009
From: dpatel at apple.com (Devang Patel)
Date: Tue, 10 Feb 2009 07:00:59 -0000
Subject: [llvm-commits] [llvm] r64207 - in /llvm/trunk:
include/llvm/Transforms/Utils/Local.h
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/Local.cpp test/Transforms/ScalarRepl/debuginfo.ll
Message-ID: <200902100700.n1A70xfb016017@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Feb 10 01:00:59 2009
New Revision: 64207
URL: http://llvm.org/viewvc/llvm-project?rev=64207&view=rev
Log:
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
Added:
llvm/trunk/test/Transforms/ScalarRepl/debuginfo.ll
Modified:
llvm/trunk/include/llvm/Transforms/Utils/Local.h
llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
llvm/trunk/lib/Transforms/Utils/Local.cpp
Modified: llvm/trunk/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Local.h?rev=64207&r1=64206&r2=64207&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Local.h Tue Feb 10 01:00:59 2009
@@ -25,6 +25,7 @@
class AllocaInst;
class ConstantExpr;
class TargetData;
+class DbgInfoIntrinsic;
template class SmallVectorImpl;
@@ -94,6 +95,11 @@
/// The phi node is deleted and it returns the pointer to the alloca inserted.
AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = 0);
+/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
+/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled
+/// with DbgInfoIntrinsic that use the instruction I.
+bool OnlyUsedByDbgInfoIntrinsics(Instruction *I,
+ SmallVectorImpl *DbgInUses = 0);
} // End llvm namespace
#endif
Modified: llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=64207&r1=64206&r2=64207&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Feb 10 01:00:59 2009
@@ -31,6 +31,7 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/IRBuilder.h"
@@ -80,9 +81,9 @@
/// isUnsafe - This is set to true if the alloca cannot be SROA'd.
bool isUnsafe : 1;
- /// needsCanon - This is set to true if there is some use of the alloca
- /// that requires canonicalization.
- bool needsCanon : 1;
+ /// needsCleanup - This is set to true if there is some use of the alloca
+ /// that requires cleanup.
+ bool needsCleanup : 1;
/// isMemCpySrc - This is true if this aggregate is memcpy'd from.
bool isMemCpySrc : 1;
@@ -91,7 +92,7 @@
bool isMemCpyDst : 1;
AllocaInfo()
- : isUnsafe(false), needsCanon(false),
+ : isUnsafe(false), needsCleanup(false),
isMemCpySrc(false), isMemCpyDst(false) {}
};
@@ -112,7 +113,8 @@
void DoScalarReplacement(AllocationInst *AI,
std::vector &WorkList);
- void CanonicalizeAllocaUsers(AllocationInst *AI);
+ void CleanupGEP(GetElementPtrInst *GEP);
+ void CleanupAllocaUsers(AllocationInst *AI);
AllocaInst *AddNewAlloca(Function &F, const Type *Ty, AllocationInst *Base);
void RewriteBitCastUserOfAlloca(Instruction *BCInst, AllocationInst *AI,
@@ -265,7 +267,7 @@
case 0: // Not safe to scalar replace.
break;
case 1: // Safe, but requires cleanup/canonicalizations first
- CanonicalizeAllocaUsers(AI);
+ CleanupAllocaUsers(AI);
// FALL THROUGH.
case 3: // Safe to scalar replace.
DoScalarReplacement(AI, WorkList);
@@ -548,7 +550,7 @@
// out if this is the only problem.
if ((NumElements == 1 || NumElements == 2) &&
AllUsersAreLoads(GEPI)) {
- Info.needsCanon = true;
+ Info.needsCleanup = true;
return; // Canonicalization required!
}
return MarkUnsafe(Info);
@@ -655,7 +657,17 @@
continue;
}
return MarkUnsafe(Info);
- } else {
+ } else if (isa(UI)) {
+ // If one user is DbgInfoIntrinsic then check if all users are
+ // DbgInfoIntrinsics.
+ if (OnlyUsedByDbgInfoIntrinsics(BC)) {
+ Info.needsCleanup = true;
+ return;
+ }
+ else
+ MarkUnsafe(Info);
+ }
+ else {
return MarkUnsafe(Info);
}
if (Info.isUnsafe) return;
@@ -1121,59 +1133,76 @@
return 0;
// If we require cleanup, return 1, otherwise return 3.
- return Info.needsCanon ? 1 : 3;
+ return Info.needsCleanup ? 1 : 3;
+}
+
+/// CleanupGEP - GEP is used by an Alloca, which can be prompted after the GEP
+/// is canonicalized here.
+void SROA::CleanupGEP(GetElementPtrInst *GEPI) {
+ gep_type_iterator I = gep_type_begin(GEPI);
+ ++I;
+
+ if (const ArrayType *AT = dyn_cast(*I)) {
+ uint64_t NumElements = AT->getNumElements();
+
+ if (!isa(I.getOperand())) {
+ if (NumElements == 1) {
+ GEPI->setOperand(2, Constant::getNullValue(Type::Int32Ty));
+ } else {
+ assert(NumElements == 2 && "Unhandled case!");
+ // All users of the GEP must be loads. At each use of the GEP, insert
+ // two loads of the appropriate indexed GEP and select between them.
+ Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(),
+ Constant::getNullValue(I.getOperand()->getType()),
+ "isone", GEPI);
+ // Insert the new GEP instructions, which are properly indexed.
+ SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end());
+ Indices[1] = Constant::getNullValue(Type::Int32Ty);
+ Value *ZeroIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
+ Indices.begin(),
+ Indices.end(),
+ GEPI->getName()+".0", GEPI);
+ Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
+ Value *OneIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
+ Indices.begin(),
+ Indices.end(),
+ GEPI->getName()+".1", GEPI);
+ // Replace all loads of the variable index GEP with loads from both
+ // indexes and a select.
+ while (!GEPI->use_empty()) {
+ LoadInst *LI = cast(GEPI->use_back());
+ Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI);
+ Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI);
+ Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI);
+ LI->replaceAllUsesWith(R);
+ LI->eraseFromParent();
+ }
+ GEPI->eraseFromParent();
+ }
+ }
+ }
}
-/// CanonicalizeAllocaUsers - If SROA reported that it can promote the specified
+/// CleanupAllocaUsers - If SROA reported that it can promote the specified
/// allocation, but only if cleaned up, perform the cleanups required.
-void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) {
+void SROA::CleanupAllocaUsers(AllocationInst *AI) {
// At this point, we know that the end result will be SROA'd and promoted, so
// we can insert ugly code if required so long as sroa+mem2reg will clean it
// up.
for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
UI != E; ) {
- GetElementPtrInst *GEPI = dyn_cast(*UI++);
- if (!GEPI) continue;
- gep_type_iterator I = gep_type_begin(GEPI);
- ++I;
-
- if (const ArrayType *AT = dyn_cast(*I)) {
- uint64_t NumElements = AT->getNumElements();
-
- if (!isa(I.getOperand())) {
- if (NumElements == 1) {
- GEPI->setOperand(2, Constant::getNullValue(Type::Int32Ty));
- } else {
- assert(NumElements == 2 && "Unhandled case!");
- // All users of the GEP must be loads. At each use of the GEP, insert
- // two loads of the appropriate indexed GEP and select between them.
- Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(),
- Constant::getNullValue(I.getOperand()->getType()),
- "isone", GEPI);
- // Insert the new GEP instructions, which are properly indexed.
- SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end());
- Indices[1] = Constant::getNullValue(Type::Int32Ty);
- Value *ZeroIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
- Indices.begin(),
- Indices.end(),
- GEPI->getName()+".0", GEPI);
- Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
- Value *OneIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
- Indices.begin(),
- Indices.end(),
- GEPI->getName()+".1", GEPI);
- // Replace all loads of the variable index GEP with loads from both
- // indexes and a select.
- while (!GEPI->use_empty()) {
- LoadInst *LI = cast(GEPI->use_back());
- Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI);
- Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI);
- Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI);
- LI->replaceAllUsesWith(R);
- LI->eraseFromParent();
- }
- GEPI->eraseFromParent();
+ User *U = *UI++;
+ if (GetElementPtrInst *GEPI = dyn_cast(U))
+ CleanupGEP(GEPI);
+ else if (Instruction *I = dyn_cast(U)) {
+ SmallVector DbgInUses;
+ if (OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) {
+ // Safe to remove debug info uses.
+ while (!DbgInUses.empty()) {
+ DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back();
+ DI->eraseFromParent();
}
+ I->eraseFromParent();
}
}
}
Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=64207&r1=64206&r2=64207&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Tue Feb 10 01:00:59 2009
@@ -248,3 +248,25 @@
// Nuke BB.
PredBB->eraseFromParent();
}
+
+/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
+/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled
+/// with the DbgInfoIntrinsic that use the instruction I.
+bool llvm::OnlyUsedByDbgInfoIntrinsics(Instruction *I,
+ SmallVectorImpl *DbgInUses) {
+ if (DbgInUses)
+ DbgInUses->clear();
+
+ for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
+ ++UI) {
+ if (DbgInfoIntrinsic *DI = dyn_cast(*UI)) {
+ if (DbgInUses)
+ DbgInUses->push_back(DI);
+ } else {
+ if (DbgInUses)
+ DbgInUses->clear();
+ return false;
+ }
+ }
+ return true;
+}
Added: llvm/trunk/test/Transforms/ScalarRepl/debuginfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ScalarRepl/debuginfo.ll?rev=64207&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/ScalarRepl/debuginfo.ll (added)
+++ llvm/trunk/test/Transforms/ScalarRepl/debuginfo.ll Tue Feb 10 01:00:59 2009
@@ -0,0 +1,105 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+ %struct.Sphere = type { %struct.Vec }
+ %struct.Vec = type { i32, i32, i32 }
+ at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str = internal constant [6 x i8] c"r.cpp\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+ at .str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at .str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+ at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+ at .str3 = internal constant [4 x i8] c"Vec\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at .str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at .str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at .str6 = internal constant [2 x i8] c"y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype7 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 32, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at .str8 = internal constant [2 x i8] c"z\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype9 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 64, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype10 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype11 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 96, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype12 = internal constant %llvm.dbg.derivedtype.type { i32 458768, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite13 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite13 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array14 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite15 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array14 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprogram16 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite15 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array17 = internal constant [5 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype7 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite18 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array17 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.derivedtype19 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array20 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array20 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str21 = internal constant [13 x i8] c"__comp_ctor \00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+ at .str22 = internal constant [14 x i8] c"_ZN3VecC1Eiii\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+ at llvm.dbg.array32 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite33 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array32 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str34 = internal constant [10 x i8] c"operator-\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+ at .str35 = internal constant [14 x i8] c"_ZmiRK3VecS1_\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+ at .str41 = internal constant [7 x i8] c"Sphere\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+ at .str43 = internal constant [7 x i8] c"center\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype44 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str43, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 14, i64 96, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype45 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array46 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype45 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite47 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array46 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str48 = internal constant [11 x i8] c"ray_sphere\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+ at .str49 = internal constant [30 x i8] c"_ZN6Sphere10ray_sphereERK3Vec\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram50 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite47 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array51 = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype44 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+ at llvm.dbg.composite52 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str41, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array51 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.derivedtype53 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array54 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype53 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite55 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array54 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprogram56 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite55 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at .str61 = internal constant [2 x i8] c"v\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.variable62 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*), i8* getelementptr ([2 x i8]* @.str61, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 17, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
+
+define i32 @_ZN6Sphere10ray_sphereERK3Vec(%struct.Sphere* %this, %struct.Vec* %Orig) nounwind {
+entry:
+ %v = alloca %struct.Vec, align 8 ; <%struct.Vec*> [#uses=4]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ %0 = bitcast %struct.Vec* %v to { }* ; <{ }*> [#uses=1]
+ call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable62 to { }*))
+ %1 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 2 ; [#uses=1]
+ %2 = load i32* %1, align 4 ; [#uses=1]
+ %3 = getelementptr %struct.Vec* %Orig, i32 0, i32 2 ; [#uses=1]
+ %4 = load i32* %3, align 4 ; [#uses=1]
+ %5 = sub i32 %2, %4 ; [#uses=1]
+ %6 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 1 ; [#uses=1]
+ %7 = load i32* %6, align 4 ; [#uses=1]
+ %8 = getelementptr %struct.Vec* %Orig, i32 0, i32 1 ; [#uses=1]
+ %9 = load i32* %8, align 4 ; [#uses=1]
+ %10 = sub i32 %7, %9 ; [#uses=1]
+ %11 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 0 ; [#uses=1]
+ %12 = load i32* %11, align 4 ; [#uses=1]
+ %13 = getelementptr %struct.Vec* %Orig, i32 0, i32 0 ; [#uses=1]
+ %14 = load i32* %13, align 4 ; [#uses=1]
+ %15 = sub i32 %12, %14 ; [#uses=1]
+ %16 = getelementptr %struct.Vec* %v, i32 0, i32 0 ; [#uses=2]
+ store i32 %15, i32* %16, align 8
+ %17 = getelementptr %struct.Vec* %v, i32 0, i32 1 ; [#uses=1]
+ store i32 %10, i32* %17, align 4
+ %18 = getelementptr %struct.Vec* %v, i32 0, i32 2 ; [#uses=1]
+ store i32 %5, i32* %18, align 8
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ call void @llvm.dbg.stoppoint(i32 9, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ %19 = load i32* %16, align 8 ; [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 18, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ ret i32 %19
+}
From dpatel at apple.com Tue Feb 10 01:48:18 2009
From: dpatel at apple.com (Devang Patel)
Date: Tue, 10 Feb 2009 07:48:18 -0000
Subject: [llvm-commits] [llvm] r64209 - in /llvm/trunk:
lib/Transforms/Utils/CloneFunction.cpp
test/Transforms/Inline/llvm.dbg.func.start.ll
Message-ID: <200902100748.n1A7mIgb017528@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Feb 10 01:48:18 2009
New Revision: 64209
URL: http://llvm.org/viewvc/llvm-project?rev=64209&view=rev
Log:
Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end during inlining.
Added:
llvm/trunk/test/Transforms/Inline/llvm.dbg.func.start.ll
Modified:
llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=64209&r1=64208&r2=64209&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Tue Feb 10 01:48:18 2009
@@ -17,6 +17,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Function.h"
#include "llvm/Support/CFG.h"
@@ -181,7 +182,7 @@
const char *NameSuffix;
ClonedCodeInfo *CodeInfo;
const TargetData *TD;
-
+ Value *DbgFnStart;
public:
PruningFunctionCloner(Function *newFunc, const Function *oldFunc,
DenseMap &valueMap,
@@ -190,7 +191,7 @@
ClonedCodeInfo *codeInfo,
const TargetData *td)
: NewFunc(newFunc), OldFunc(oldFunc), ValueMap(valueMap), Returns(returns),
- NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td) {
+ NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td), DbgFnStart(NULL) {
}
/// CloneBlock - The specified block is found to be reachable, clone it and
@@ -231,7 +232,17 @@
ValueMap[II] = C;
continue;
}
-
+
+ // Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end.
+ if (const DbgFuncStartInst *DFSI = dyn_cast(II)) {
+ DbgFnStart = DFSI->getSubprogram();
+ continue;
+ }
+ if (const DbgRegionEndInst *DREIS = dyn_cast(II)) {
+ if (DREIS->getContext() == DbgFnStart)
+ continue;
+ }
+
Instruction *NewInst = II->clone();
if (II->hasName())
NewInst->setName(II->getName()+NameSuffix);
Added: llvm/trunk/test/Transforms/Inline/llvm.dbg.func.start.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/llvm.dbg.func.start.ll?rev=64209&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Inline/llvm.dbg.func.start.ll (added)
+++ llvm/trunk/test/Transforms/Inline/llvm.dbg.func.start.ll Tue Feb 10 01:48:18 2009
@@ -0,0 +1,86 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep func.start | count 3
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep region.end | count 3
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+ at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at .str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+ at .str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+ at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+ at .str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at .str4 = internal constant [5 x i8] c"char\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at llvm.dbg.basictype5 = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 6 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype5 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+ at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str6 = internal constant [4 x i8] c"bar\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at .str7 = internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+ at llvm.dbg.array8 = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1]
+ at llvm.dbg.composite9 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array8 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str10 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram11 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str10, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@"\01LC" = internal constant [3 x i8] c"hi\00" ; <[3 x i8]*> [#uses=1]
+
+define i32 @bar(i8* %c) nounwind {
+entry:
+ %c_addr = alloca i8* ; [#uses=3]
+ %retval = alloca i32 ; [#uses=2]
+ %0 = alloca i32 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ %1 = bitcast i8** %c_addr to { }* ; <{ }*> [#uses=1]
+ call void @llvm.dbg.declare({ }* %1, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))
+ store i8* %c, i8** %c_addr
+ call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %2 = load i8** %c_addr, align 4 ; [#uses=1]
+ %3 = load i8* %2, align 1 ; [#uses=1]
+ %4 = sext i8 %3 to i32 ; [#uses=1]
+ %5 = add i32 %4, 42 ; [#uses=1]
+ store i32 %5, i32* %0, align 4
+ %6 = load i32* %0, align 4 ; [#uses=1]
+ store i32 %6, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 1, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*))
+ ret i32 %retval1
+}
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
+
+define i32 @main() nounwind {
+entry:
+ %retval = alloca i32 ; [#uses=2]
+ %0 = alloca i32 ; [#uses=2]
+ %"alloca point" = bitcast i32 0 to i32 ; [#uses=0]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram11 to { }*))
+ call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ %1 = call i32 @bar(i8* getelementptr ([3 x i8]* @"\01LC", i32 0, i32 0)) nounwind ; [#uses=1]
+ store i32 %1, i32* %0, align 4
+ %2 = load i32* %0, align 4 ; [#uses=1]
+ store i32 %2, i32* %retval, align 4
+ br label %return
+
+return: ; preds = %entry
+ %retval1 = load i32* %retval ; [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 2, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram11 to { }*))
+ ret i32 %retval1
+}
From evan.cheng at apple.com Tue Feb 10 02:30:11 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 10 Feb 2009 08:30:11 -0000
Subject: [llvm-commits] [llvm] r64210 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
test/CodeGen/ARM/memcpy-inline.ll test/CodeGen/X86/fold-pcmpeqd-0.ll
test/CodeGen/X86/pr3457.ll
Message-ID: <200902100830.n1A8UBhk018796@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Feb 10 02:30:11 2009
New Revision: 64210
URL: http://llvm.org/viewvc/llvm-project?rev=64210&view=rev
Log:
Fix PR3457: Ignore control successors when looking for closest scheduled successor. A control successor doesn't read result(s) produced by the scheduling unit being evaluated.
Added:
llvm/trunk/test/CodeGen/X86/pr3457.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
llvm/trunk/test/CodeGen/ARM/memcpy-inline.ll
llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-0.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=64210&r1=64209&r2=64210&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Feb 10 02:30:11 2009
@@ -30,7 +30,6 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include
-#include "llvm/Support/CommandLine.h"
using namespace llvm;
STATISTIC(NumBacktracks, "Number of times scheduler backtracked");
@@ -1047,6 +1046,7 @@
unsigned MaxHeight = 0;
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
+ if (I->isCtrl()) continue; // ignore chain succs
unsigned Height = I->getSUnit()->getHeight();
// If there are bunch of CopyToRegs stacked up, they should be considered
// to be at the same position.
Modified: llvm/trunk/test/CodeGen/ARM/memcpy-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/memcpy-inline.ll?rev=64210&r1=64209&r2=64210&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/memcpy-inline.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/memcpy-inline.ll Tue Feb 10 02:30:11 2009
@@ -1,6 +1,9 @@
-; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldmia
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrb
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrh
+; This used to look for ldmia. But it's no longer lucky enough to
+; have the load / store instructions lined up just right after
+; scheduler change for pr3457. We'll look for a robust solution
+; later.
%struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
@src = external global %struct.x
Modified: llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-0.ll?rev=64210&r1=64209&r2=64210&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-0.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fold-pcmpeqd-0.ll Tue Feb 10 02:30:11 2009
@@ -1,8 +1,10 @@
-; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep pcmpeqd | count 1
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep pcmpeqd
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep orps | grep CPI1_2 | count 2
; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep pcmpeqd | count 1
; This testcase shouldn't need to spill the -1 value,
; so it should just use pcmpeqd to materialize an all-ones vector.
+; For i386, cp load of -1 are folded.
%struct.__ImageExecInfo = type <{ <4 x i32>, <4 x float>, <2 x i64>, i8*, i8*, i8*, i32, i32, i32, i32, i32 }>
%struct._cl_image_format_t = type <{ i32, i32, i32 }>
Added: llvm/trunk/test/CodeGen/X86/pr3457.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr3457.ll?rev=64210&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr3457.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr3457.ll Tue Feb 10 02:30:11 2009
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep fstpt
+; PR3457
+; rdar://6548010
+
+define void @foo(double* nocapture %P) nounwind {
+entry:
+ %0 = tail call double (...)* @test() nounwind ; [#uses=2]
+ %1 = tail call double (...)* @test() nounwind ; [#uses=2]
+ %2 = mul double %0, %0 ; [#uses=1]
+ %3 = mul double %1, %1 ; [#uses=1]
+ %4 = add double %2, %3 ; [#uses=1]
+ store double %4, double* %P, align 8
+ ret void
+}
+
+declare double @test(...)
From isanbard at gmail.com Tue Feb 10 05:10:33 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 10 Feb 2009 11:10:33 -0000
Subject: [llvm-commits] [llvm] r64214 - in /llvm/branches/Apple/Dib:
lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
test/CodeGen/ARM/memcpy-inline.ll test/CodeGen/X86/fold-pcmpeqd-0.ll
Message-ID: <200902101110.n1ABAZqE001868@zion.cs.uiuc.edu>
Author: void
Date: Tue Feb 10 05:10:12 2009
New Revision: 64214
URL: http://llvm.org/viewvc/llvm-project?rev=64214&view=rev
Log:
Pull r64210 into Dib:
Fix PR3457: Ignore control successors when looking for closest scheduled
successor. A control successor doesn't read result(s) produced by the scheduling
unit being evaluated.
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
llvm/branches/Apple/Dib/test/CodeGen/ARM/memcpy-inline.ll
llvm/branches/Apple/Dib/test/CodeGen/X86/fold-pcmpeqd-0.ll
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=64214&r1=64213&r2=64214&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Feb 10 05:10:12 2009
@@ -30,7 +30,6 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
#include
-#include "llvm/Support/CommandLine.h"
using namespace llvm;
STATISTIC(NumBacktracks, "Number of times scheduler backtracked");
@@ -1047,6 +1046,7 @@
unsigned MaxHeight = 0;
for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end();
I != E; ++I) {
+ if (I->isCtrl()) continue; // ignore chain succs
unsigned Height = I->getSUnit()->getHeight();
// If there are bunch of CopyToRegs stacked up, they should be considered
// to be at the same position.
Modified: llvm/branches/Apple/Dib/test/CodeGen/ARM/memcpy-inline.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/ARM/memcpy-inline.ll?rev=64214&r1=64213&r2=64214&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/ARM/memcpy-inline.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/ARM/memcpy-inline.ll Tue Feb 10 05:10:12 2009
@@ -1,6 +1,9 @@
-; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldmia
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrb
; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin | grep ldrh
+; This used to look for ldmia. But it's no longer lucky enough to
+; have the load / store instructions lined up just right after
+; scheduler change for pr3457. We'll look for a robust solution
+; later.
%struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
@src = external global %struct.x
Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/fold-pcmpeqd-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/fold-pcmpeqd-0.ll?rev=64214&r1=64213&r2=64214&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/fold-pcmpeqd-0.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/fold-pcmpeqd-0.ll Tue Feb 10 05:10:12 2009
@@ -1,8 +1,10 @@
-; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep pcmpeqd | count 1
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep pcmpeqd
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep orps | grep CPI1_2 | count 2
; RUN: llvm-as < %s | llc -mtriple=x86_64-apple-darwin | grep pcmpeqd | count 1
; This testcase shouldn't need to spill the -1 value,
; so it should just use pcmpeqd to materialize an all-ones vector.
+; For i386, cp load of -1 are folded.
%struct.__ImageExecInfo = type <{ <4 x i32>, <4 x float>, <2 x i64>, i8*, i8*, i8*, i32, i32, i32, i32, i32 }>
%struct._cl_image_format_t = type <{ i32, i32, i32 }>
From isanbard at gmail.com Tue Feb 10 05:11:31 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 10 Feb 2009 11:11:31 -0000
Subject: [llvm-commits] [llvm] r64215 - in
/llvm/branches/Apple/Dib/test/CodeGen/X86: 2009-02-08-CoalescerBug.ll
pr3457.ll
Message-ID: <200902101111.n1ABBVYT001916@zion.cs.uiuc.edu>
Author: void
Date: Tue Feb 10 05:11:30 2009
New Revision: 64215
URL: http://llvm.org/viewvc/llvm-project?rev=64215&view=rev
Log:
New tests.
Added:
llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-08-CoalescerBug.ll
llvm/branches/Apple/Dib/test/CodeGen/X86/pr3457.ll
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-08-CoalescerBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-08-CoalescerBug.ll?rev=64215&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-08-CoalescerBug.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/2009-02-08-CoalescerBug.ll Tue Feb 10 05:11:30 2009
@@ -0,0 +1,22 @@
+; RUN: llvm-as < %s | llc -march=x86
+; PR3486
+
+define i32 @foo(i8 signext %p_26) nounwind {
+entry:
+ %0 = icmp eq i8 %p_26, 0 ; [#uses=2]
+ %or.cond = or i1 false, %0 ; [#uses=2]
+ %iftmp.1.0 = zext i1 %or.cond to i16 ; [#uses=1]
+ br i1 %0, label %bb.i, label %bar.exit
+
+bb.i: ; preds = %entry
+ %1 = zext i1 %or.cond to i32 ; [#uses=1]
+ %2 = sdiv i32 %1, 0 ; [#uses=1]
+ %3 = trunc i32 %2 to i16 ; [#uses=1]
+ br label %bar.exit
+
+bar.exit: ; preds = %bb.i, %entry
+ %4 = phi i16 [ %3, %bb.i ], [ %iftmp.1.0, %entry ] ; [#uses=1]
+ %5 = trunc i16 %4 to i8 ; [#uses=1]
+ %6 = sext i8 %5 to i32 ; [#uses=1]
+ ret i32 %6
+}
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/pr3457.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/pr3457.ll?rev=64215&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/pr3457.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/pr3457.ll Tue Feb 10 05:11:30 2009
@@ -0,0 +1,16 @@
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | not grep fstpt
+; PR3457
+; rdar://6548010
+
+define void @foo(double* nocapture %P) nounwind {
+entry:
+ %0 = tail call double (...)* @test() nounwind ; [#uses=2]
+ %1 = tail call double (...)* @test() nounwind ; [#uses=2]
+ %2 = mul double %0, %0 ; [#uses=1]
+ %3 = mul double %1, %1 ; [#uses=1]
+ %4 = add double %2, %3 ; [#uses=1]
+ store double %4, double* %P, align 8
+ ret void
+}
+
+declare double @test(...)
From isanbard at gmail.com Tue Feb 10 05:13:49 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 10 Feb 2009 11:13:49 -0000
Subject: [llvm-commits] [llvm] r64216 - in /llvm/branches/Apple/Dib:
include/llvm/Transforms/Utils/Local.h
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Utils/Local.cpp test/Transforms/ScalarRepl/debuginfo.ll
Message-ID: <200902101113.n1ABDnCK002024@zion.cs.uiuc.edu>
Author: void
Date: Tue Feb 10 05:13:48 2009
New Revision: 64216
URL: http://llvm.org/viewvc/llvm-project?rev=64216&view=rev
Log:
Pull r64207 into Dib:
Enable scalar replacement of AllocaInst whose one of the user is dbg info.
Added:
llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/debuginfo.ll
Modified:
llvm/branches/Apple/Dib/include/llvm/Transforms/Utils/Local.h
llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp
llvm/branches/Apple/Dib/lib/Transforms/Utils/Local.cpp
Modified: llvm/branches/Apple/Dib/include/llvm/Transforms/Utils/Local.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Transforms/Utils/Local.h?rev=64216&r1=64215&r2=64216&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/Transforms/Utils/Local.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/Transforms/Utils/Local.h Tue Feb 10 05:13:48 2009
@@ -25,6 +25,7 @@
class AllocaInst;
class ConstantExpr;
class TargetData;
+class DbgInfoIntrinsic;
template class SmallVectorImpl;
@@ -94,6 +95,11 @@
/// The phi node is deleted and it returns the pointer to the alloca inserted.
AllocaInst *DemotePHIToStack(PHINode *P, Instruction *AllocaPoint = 0);
+/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
+/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled
+/// with DbgInfoIntrinsic that use the instruction I.
+bool OnlyUsedByDbgInfoIntrinsics(Instruction *I,
+ SmallVectorImpl *DbgInUses = 0);
} // End llvm namespace
#endif
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp?rev=64216&r1=64215&r2=64216&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Feb 10 05:13:48 2009
@@ -31,6 +31,7 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Transforms/Utils/PromoteMemToReg.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
@@ -79,9 +80,9 @@
/// isUnsafe - This is set to true if the alloca cannot be SROA'd.
bool isUnsafe : 1;
- /// needsCanon - This is set to true if there is some use of the alloca
- /// that requires canonicalization.
- bool needsCanon : 1;
+ /// needsCleanup - This is set to true if there is some use of the alloca
+ /// that requires cleanup.
+ bool needsCleanup : 1;
/// isMemCpySrc - This is true if this aggregate is memcpy'd from.
bool isMemCpySrc : 1;
@@ -90,7 +91,7 @@
bool isMemCpyDst : 1;
AllocaInfo()
- : isUnsafe(false), needsCanon(false),
+ : isUnsafe(false), needsCleanup(false),
isMemCpySrc(false), isMemCpyDst(false) {}
};
@@ -111,7 +112,8 @@
void DoScalarReplacement(AllocationInst *AI,
std::vector &WorkList);
- void CanonicalizeAllocaUsers(AllocationInst *AI);
+ void CleanupGEP(GetElementPtrInst *GEP);
+ void CleanupAllocaUsers(AllocationInst *AI);
AllocaInst *AddNewAlloca(Function &F, const Type *Ty, AllocationInst *Base);
void RewriteBitCastUserOfAlloca(Instruction *BCInst, AllocationInst *AI,
@@ -243,7 +245,7 @@
case 0: // Not safe to scalar replace.
break;
case 1: // Safe, but requires cleanup/canonicalizations first
- CanonicalizeAllocaUsers(AI);
+ CleanupAllocaUsers(AI);
// FALL THROUGH.
case 3: // Safe to scalar replace.
DoScalarReplacement(AI, WorkList);
@@ -514,7 +516,7 @@
// out if this is the only problem.
if ((NumElements == 1 || NumElements == 2) &&
AllUsersAreLoads(GEPI)) {
- Info.needsCanon = true;
+ Info.needsCleanup = true;
return; // Canonicalization required!
}
return MarkUnsafe(Info);
@@ -621,7 +623,17 @@
continue;
}
return MarkUnsafe(Info);
- } else {
+ } else if (isa(UI)) {
+ // If one user is DbgInfoIntrinsic then check if all users are
+ // DbgInfoIntrinsics.
+ if (OnlyUsedByDbgInfoIntrinsics(BC)) {
+ Info.needsCleanup = true;
+ return;
+ }
+ else
+ MarkUnsafe(Info);
+ }
+ else {
return MarkUnsafe(Info);
}
if (Info.isUnsafe) return;
@@ -1087,59 +1099,76 @@
return 0;
// If we require cleanup, return 1, otherwise return 3.
- return Info.needsCanon ? 1 : 3;
+ return Info.needsCleanup ? 1 : 3;
}
-/// CanonicalizeAllocaUsers - If SROA reported that it can promote the specified
+/// CleanupGEP - GEP is used by an Alloca, which can be prompted after the GEP
+/// is canonicalized here.
+void SROA::CleanupGEP(GetElementPtrInst *GEPI) {
+ gep_type_iterator I = gep_type_begin(GEPI);
+ ++I;
+
+ if (const ArrayType *AT = dyn_cast(*I)) {
+ uint64_t NumElements = AT->getNumElements();
+
+ if (!isa(I.getOperand())) {
+ if (NumElements == 1) {
+ GEPI->setOperand(2, Constant::getNullValue(Type::Int32Ty));
+ } else {
+ assert(NumElements == 2 && "Unhandled case!");
+ // All users of the GEP must be loads. At each use of the GEP, insert
+ // two loads of the appropriate indexed GEP and select between them.
+ Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(),
+ Constant::getNullValue(I.getOperand()->getType()),
+ "isone", GEPI);
+ // Insert the new GEP instructions, which are properly indexed.
+ SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end());
+ Indices[1] = Constant::getNullValue(Type::Int32Ty);
+ Value *ZeroIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
+ Indices.begin(),
+ Indices.end(),
+ GEPI->getName()+".0", GEPI);
+ Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
+ Value *OneIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
+ Indices.begin(),
+ Indices.end(),
+ GEPI->getName()+".1", GEPI);
+ // Replace all loads of the variable index GEP with loads from both
+ // indexes and a select.
+ while (!GEPI->use_empty()) {
+ LoadInst *LI = cast(GEPI->use_back());
+ Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI);
+ Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI);
+ Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI);
+ LI->replaceAllUsesWith(R);
+ LI->eraseFromParent();
+ }
+ GEPI->eraseFromParent();
+ }
+ }
+ }
+}
+
+/// CleanupAllocaUsers - If SROA reported that it can promote the specified
/// allocation, but only if cleaned up, perform the cleanups required.
-void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) {
+void SROA::CleanupAllocaUsers(AllocationInst *AI) {
// At this point, we know that the end result will be SROA'd and promoted, so
// we can insert ugly code if required so long as sroa+mem2reg will clean it
// up.
for (Value::use_iterator UI = AI->use_begin(), E = AI->use_end();
UI != E; ) {
- GetElementPtrInst *GEPI = dyn_cast(*UI++);
- if (!GEPI) continue;
- gep_type_iterator I = gep_type_begin(GEPI);
- ++I;
-
- if (const ArrayType *AT = dyn_cast(*I)) {
- uint64_t NumElements = AT->getNumElements();
-
- if (!isa(I.getOperand())) {
- if (NumElements == 1) {
- GEPI->setOperand(2, Constant::getNullValue(Type::Int32Ty));
- } else {
- assert(NumElements == 2 && "Unhandled case!");
- // All users of the GEP must be loads. At each use of the GEP, insert
- // two loads of the appropriate indexed GEP and select between them.
- Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(),
- Constant::getNullValue(I.getOperand()->getType()),
- "isone", GEPI);
- // Insert the new GEP instructions, which are properly indexed.
- SmallVector Indices(GEPI->op_begin()+1, GEPI->op_end());
- Indices[1] = Constant::getNullValue(Type::Int32Ty);
- Value *ZeroIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
- Indices.begin(),
- Indices.end(),
- GEPI->getName()+".0", GEPI);
- Indices[1] = ConstantInt::get(Type::Int32Ty, 1);
- Value *OneIdx = GetElementPtrInst::Create(GEPI->getOperand(0),
- Indices.begin(),
- Indices.end(),
- GEPI->getName()+".1", GEPI);
- // Replace all loads of the variable index GEP with loads from both
- // indexes and a select.
- while (!GEPI->use_empty()) {
- LoadInst *LI = cast(GEPI->use_back());
- Value *Zero = new LoadInst(ZeroIdx, LI->getName()+".0", LI);
- Value *One = new LoadInst(OneIdx , LI->getName()+".1", LI);
- Value *R = SelectInst::Create(IsOne, One, Zero, LI->getName(), LI);
- LI->replaceAllUsesWith(R);
- LI->eraseFromParent();
- }
- GEPI->eraseFromParent();
+ User *U = *UI++;
+ if (GetElementPtrInst *GEPI = dyn_cast(U))
+ CleanupGEP(GEPI);
+ else if (Instruction *I = dyn_cast(U)) {
+ SmallVector DbgInUses;
+ if (OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) {
+ // Safe to remove debug info uses.
+ while (!DbgInUses.empty()) {
+ DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back();
+ DI->eraseFromParent();
}
+ I->eraseFromParent();
}
}
}
Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/Local.cpp?rev=64216&r1=64215&r2=64216&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Utils/Local.cpp Tue Feb 10 05:13:48 2009
@@ -248,3 +248,25 @@
// Nuke BB.
PredBB->eraseFromParent();
}
+
+/// OnlyUsedByDbgIntrinsics - Return true if the instruction I is only used
+/// by DbgIntrinsics. If DbgInUses is specified then the vector is filled
+/// with the DbgInfoIntrinsic that use the instruction I.
+bool llvm::OnlyUsedByDbgInfoIntrinsics(Instruction *I,
+ SmallVectorImpl *DbgInUses) {
+ if (DbgInUses)
+ DbgInUses->clear();
+
+ for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
+ ++UI) {
+ if (DbgInfoIntrinsic *DI = dyn_cast(*UI)) {
+ if (DbgInUses)
+ DbgInUses->push_back(DI);
+ } else {
+ if (DbgInUses)
+ DbgInUses->clear();
+ return false;
+ }
+ }
+ return true;
+}
Added: llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/debuginfo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/debuginfo.ll?rev=64216&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/debuginfo.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/ScalarRepl/debuginfo.ll Tue Feb 10 05:13:48 2009
@@ -0,0 +1,105 @@
+; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | not grep alloca
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+ %struct.Sphere = type { %struct.Vec }
+ %struct.Vec = type { i32, i32, i32 }
+ at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str = internal constant [6 x i8] c"r.cpp\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+ at .str1 = internal constant [5 x i8] c"/tmp\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at .str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+ at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 4, i8* getelementptr ([6 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+ at .str3 = internal constant [4 x i8] c"Vec\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at .str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at .str5 = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str5, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at .str6 = internal constant [2 x i8] c"y\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype7 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str6, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 32, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at .str8 = internal constant [2 x i8] c"z\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype9 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @.str8, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 4, i64 32, i64 32, i64 64, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype10 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype11 = internal constant %llvm.dbg.derivedtype.type { i32 458790, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 96, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype12 = internal constant %llvm.dbg.derivedtype.type { i32 458768, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype11 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array = internal constant [3 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite13 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite13 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array14 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype10 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite15 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array14 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprogram16 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 5, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite15 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array17 = internal constant [5 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype7 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype9 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram16 to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite18 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array17 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.derivedtype19 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array20 = internal constant [5 x { }*] [ { }* null, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype19 to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[5 x { }*]*> [#uses=1]
+ at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([5 x { }*]* @llvm.dbg.array20 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str21 = internal constant [13 x i8] c"__comp_ctor \00", section "llvm.metadata" ; <[13 x i8]*> [#uses=1]
+ at .str22 = internal constant [14 x i8] c"_ZN3VecC1Eiii\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+ at llvm.dbg.array32 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite33 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array32 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str34 = internal constant [10 x i8] c"operator-\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
+ at .str35 = internal constant [14 x i8] c"_ZmiRK3VecS1_\00", section "llvm.metadata" ; <[14 x i8]*> [#uses=1]
+ at .str41 = internal constant [7 x i8] c"Sphere\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+ at .str43 = internal constant [7 x i8] c"center\00", section "llvm.metadata" ; <[7 x i8]*> [#uses=1]
+ at llvm.dbg.derivedtype44 = internal constant %llvm.dbg.derivedtype.type { i32 458765, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str43, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 14, i64 96, i64 32, i64 0, i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.derivedtype45 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array46 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype45 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite47 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array46 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str48 = internal constant [11 x i8] c"ray_sphere\00", section "llvm.metadata" ; <[11 x i8]*> [#uses=1]
+ at .str49 = internal constant [30 x i8] c"_ZN6Sphere10ray_sphereERK3Vec\00", section "llvm.metadata" ; <[30 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram50 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite47 to { }*), i1 false, i1 false }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at llvm.dbg.array51 = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype44 to { }*), { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram50 to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+ at llvm.dbg.composite52 = internal constant %llvm.dbg.composite.type { i32 458771, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([7 x i8]* @.str41, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 12, i64 96, i64 32, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array51 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.derivedtype53 = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite52 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array54 = internal constant [3 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype53 to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype12 to { }*) ], section "llvm.metadata" ; <[3 x { }*]*> [#uses=1]
+ at llvm.dbg.composite55 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([3 x { }*]* @llvm.dbg.array54 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprogram56 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([11 x i8]* @.str48, i32 0, i32 0), i8* getelementptr ([30 x i8]* @.str49, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 16, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite55 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at .str61 = internal constant [2 x i8] c"v\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.variable62 = internal constant %llvm.dbg.variable.type { i32 459008, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*), i8* getelementptr ([2 x i8]* @.str61, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 17, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite18 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+
+declare void @llvm.dbg.func.start({ }*) nounwind
+
+declare void @llvm.dbg.declare({ }*, { }*) nounwind
+
+declare void @llvm.dbg.stoppoint(i32, i32, { }*) nounwind
+
+declare void @llvm.dbg.region.end({ }*) nounwind
+
+define i32 @_ZN6Sphere10ray_sphereERK3Vec(%struct.Sphere* %this, %struct.Vec* %Orig) nounwind {
+entry:
+ %v = alloca %struct.Vec, align 8 ; <%struct.Vec*> [#uses=4]
+ call void @llvm.dbg.func.start({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ %0 = bitcast %struct.Vec* %v to { }* ; <{ }*> [#uses=1]
+ call void @llvm.dbg.declare({ }* %0, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable62 to { }*))
+ %1 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 2 ; [#uses=1]
+ %2 = load i32* %1, align 4 ; [#uses=1]
+ %3 = getelementptr %struct.Vec* %Orig, i32 0, i32 2 ; [#uses=1]
+ %4 = load i32* %3, align 4 ; [#uses=1]
+ %5 = sub i32 %2, %4 ; [#uses=1]
+ %6 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 1 ; [#uses=1]
+ %7 = load i32* %6, align 4 ; [#uses=1]
+ %8 = getelementptr %struct.Vec* %Orig, i32 0, i32 1 ; [#uses=1]
+ %9 = load i32* %8, align 4 ; [#uses=1]
+ %10 = sub i32 %7, %9 ; [#uses=1]
+ %11 = getelementptr %struct.Sphere* %this, i32 0, i32 0, i32 0 ; [#uses=1]
+ %12 = load i32* %11, align 4 ; [#uses=1]
+ %13 = getelementptr %struct.Vec* %Orig, i32 0, i32 0 ; [#uses=1]
+ %14 = load i32* %13, align 4 ; [#uses=1]
+ %15 = sub i32 %12, %14 ; [#uses=1]
+ %16 = getelementptr %struct.Vec* %v, i32 0, i32 0 ; [#uses=2]
+ store i32 %15, i32* %16, align 8
+ %17 = getelementptr %struct.Vec* %v, i32 0, i32 1 ; [#uses=1]
+ store i32 %10, i32* %17, align 4
+ %18 = getelementptr %struct.Vec* %v, i32 0, i32 2 ; [#uses=1]
+ store i32 %5, i32* %18, align 8
+ call void @llvm.dbg.stoppoint(i32 5, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ call void @llvm.dbg.stoppoint(i32 9, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*)) nounwind
+ %19 = load i32* %16, align 8 ; [#uses=1]
+ call void @llvm.dbg.stoppoint(i32 18, i32 0, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*))
+ call void @llvm.dbg.region.end({ }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram56 to { }*))
+ ret i32 %19
+}
From isanbard at gmail.com Tue Feb 10 05:14:56 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 10 Feb 2009 11:14:56 -0000
Subject: [llvm-commits] [llvm] r64217 - in /llvm/branches/Apple/Dib:
lib/Transforms/Utils/CloneFunction.cpp
test/Transforms/Inline/llvm.dbg.func.start.ll
Message-ID: <200902101114.n1ABEuIB002077@zion.cs.uiuc.edu>
Author: void
Date: Tue Feb 10 05:14:56 2009
New Revision: 64217
URL: http://llvm.org/viewvc/llvm-project?rev=64217&view=rev
Log:
Pull r64209 into Dib:
Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end during
inlining.
Added:
llvm/branches/Apple/Dib/test/Transforms/Inline/llvm.dbg.func.start.ll
Modified:
llvm/branches/Apple/Dib/lib/Transforms/Utils/CloneFunction.cpp
Modified: llvm/branches/Apple/Dib/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Utils/CloneFunction.cpp?rev=64217&r1=64216&r2=64217&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Utils/CloneFunction.cpp Tue Feb 10 05:14:56 2009
@@ -17,6 +17,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
+#include "llvm/IntrinsicInst.h"
#include "llvm/GlobalVariable.h"
#include "llvm/Function.h"
#include "llvm/Support/CFG.h"
@@ -181,7 +182,7 @@
const char *NameSuffix;
ClonedCodeInfo *CodeInfo;
const TargetData *TD;
-
+ Value *DbgFnStart;
public:
PruningFunctionCloner(Function *newFunc, const Function *oldFunc,
DenseMap &valueMap,
@@ -190,7 +191,7 @@
ClonedCodeInfo *codeInfo,
const TargetData *td)
: NewFunc(newFunc), OldFunc(oldFunc), ValueMap(valueMap), Returns(returns),
- NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td) {
+ NameSuffix(nameSuffix), CodeInfo(codeInfo), TD(td), DbgFnStart(NULL) {
}
/// CloneBlock - The specified block is found to be reachable, clone it and
@@ -231,7 +232,17 @@
ValueMap[II] = C;
continue;
}
-
+
+ // Do not clone llvm.dbg.func.start and corresponding llvm.dbg.region.end.
+ if (const DbgFuncStartInst *DFSI = dyn_cast(II)) {
+ DbgFnStart = DFSI->getSubprogram();
+ continue;
+ }
+ if (const DbgRegionEndInst *DREIS = dyn_cast(II)) {
+ if (DREIS->getContext() == DbgFnStart)
+ continue;
+ }
+
Instruction *NewInst = II->clone();
if (II->hasName())
NewInst->setName(II->getName()+NameSuffix);
Added: llvm/branches/Apple/Dib/test/Transforms/Inline/llvm.dbg.func.start.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/Inline/llvm.dbg.func.start.ll?rev=64217&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/Inline/llvm.dbg.func.start.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/Inline/llvm.dbg.func.start.ll Tue Feb 10 05:14:56 2009
@@ -0,0 +1,86 @@
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep func.start | count 3
+; RUN: llvm-as < %s | opt -inline | llvm-dis | grep region.end | count 3
+ %llvm.dbg.anchor.type = type { i32, i32 }
+ %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
+ %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8*, i1, i1, i8* }
+ %llvm.dbg.composite.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }*, { }* }
+ %llvm.dbg.derivedtype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, { }* }
+ %llvm.dbg.subprogram.type = type { i32, { }*, { }*, i8*, i8*, i8*, { }*, i32, { }*, i1, i1 }
+ %llvm.dbg.variable.type = type { i32, { }*, i8*, { }*, i32, { }* }
+ at llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str = internal constant [4 x i8] c"a.c\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at .str1 = internal constant [6 x i8] c"/tmp/\00", section "llvm.metadata" ; <[6 x i8]*> [#uses=1]
+ at .str2 = internal constant [55 x i8] c"4.2.1 (Based on Apple Inc. build 5636) (LLVM build 00)\00", section "llvm.metadata" ; <[55 x i8]*> [#uses=1]
+ at llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 458769, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*), i32 1, i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0), i8* getelementptr ([6 x i8]* @.str1, i32 0, i32 0), i8* getelementptr ([55 x i8]* @.str2, i32 0, i32 0), i1 true, i1 false, i8* null }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
+ at .str3 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str3, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at .str4 = internal constant [5 x i8] c"char\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at llvm.dbg.basictype5 = internal constant %llvm.dbg.basictype.type { i32 458788, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str4, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 8, i64 8, i64 0, i32 0, i32 6 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
+ at llvm.dbg.derivedtype = internal constant %llvm.dbg.derivedtype.type { i32 458767, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 32, i64 32, i64 0, i32 0, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype5 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.derivedtype.type*> [#uses=1]
+ at llvm.dbg.array = internal constant [2 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*), { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) ], section "llvm.metadata" ; <[2 x { }*]*> [#uses=1]
+ at llvm.dbg.composite = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([2 x { }*]* @llvm.dbg.array to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at llvm.dbg.subprograms = linkonce constant %llvm.dbg.anchor.type { i32 458752, i32 46 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
+ at .str6 = internal constant [4 x i8] c"bar\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* getelementptr ([4 x i8]* @.str6, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+ at .str7 = internal constant [2 x i8] c"c\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
+ at llvm.dbg.variable = internal constant %llvm.dbg.variable.type { i32 459009, { }* bitcast (%llvm.dbg.subprogram.type* @llvm.dbg.subprogram to { }*), i8* getelementptr ([2 x i8]* @.str7, i32 0, i32 0), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 1, { }* bitcast (%llvm.dbg.derivedtype.type* @llvm.dbg.derivedtype to { }*) }, section "llvm.metadata" ; <%llvm.dbg.variable.type*> [#uses=1]
+ at llvm.dbg.array8 = internal constant [1 x { }*] [ { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*) ], section "llvm.metadata" ; <[1 x { }*]*> [#uses=1]
+ at llvm.dbg.composite9 = internal constant %llvm.dbg.composite.type { i32 458773, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 0, i64 0, i64 0, i64 0, i32 0, { }* null, { }* bitcast ([1 x { }*]* @llvm.dbg.array8 to { }*) }, section "llvm.metadata" ; <%llvm.dbg.composite.type*> [#uses=1]
+ at .str10 = internal constant [5 x i8] c"main\00", section "llvm.metadata" ; <[5 x i8]*> [#uses=1]
+ at llvm.dbg.subprogram11 = internal constant %llvm.dbg.subprogram.type { i32 458798, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.subprograms to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i8* getelementptr ([5 x i8]* @.str10, i32 0, i32 0), i8* getelementptr ([5 x i8]* @.str10, i32 0, i32 0), i8* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*), i32 2, { }* bitcast (%llvm.dbg.composite.type* @llvm.dbg.composite9 to { }*), i1 false, i1 true }, section "llvm.metadata" ; <%llvm.dbg.subprogram.type*> [#uses=1]
+@"\01LC" = internal constant [3 x i8] c"hi\00" ; <[3 x i8]*> [#uses=1]
+
+define i32 @bar(i8* %c) nounwind {
+entry:
+ %c_addr = alloca i8* ; [#uses=3]
+ %retval = alloca i32 ;