From evan.cheng at apple.com Mon Mar 30 01:17:34 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 30 Mar 2009 06:17:34 -0000
Subject: [llvm-commits] [llvm] r68025 -
/llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll
Message-ID: <200903300617.n2U6HZnH006135@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Mar 30 01:17:34 2009
New Revision: 68025
URL: http://llvm.org/viewvc/llvm-project?rev=68025&view=rev
Log:
Forgot this test.
Added:
llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll
Added: llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll?rev=68025&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll (added)
+++ llvm/trunk/test/CodeGen/X86/2009-03-26-NoImplicitFPBug.ll Mon Mar 30 01:17:34 2009
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -no-implicit-float
+
+define double @t(double %x) nounwind ssp {
+entry:
+ br i1 false, label %return, label %bb3
+
+bb3: ; preds = %entry
+ ret double 0.000000e+00
+
+return: ; preds = %entry
+ ret double undef
+}
From sabre at nondot.org Mon Mar 30 01:35:00 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 30 Mar 2009 06:35:00 -0000
Subject: [llvm-commits] [llvm] r68026 - /llvm/trunk/docs/BitCodeFormat.html
Message-ID: <200903300635.n2U6Z1pI006739@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Mar 30 01:34:59 2009
New Revision: 68026
URL: http://llvm.org/viewvc/llvm-project?rev=68026&view=rev
Log:
fix some validation problems.
Modified:
llvm/trunk/docs/BitCodeFormat.html
Modified: llvm/trunk/docs/BitCodeFormat.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/BitCodeFormat.html?rev=68026&r1=68025&r2=68026&view=diff
==============================================================================
--- llvm/trunk/docs/BitCodeFormat.html (original)
+++ llvm/trunk/docs/BitCodeFormat.html Mon Mar 30 01:34:59 2009
@@ -563,13 +563,8 @@
-
-[Magic32,
- Version32,
- Offset32,
- Size32,
- CPUType32]
-
+[Magic32, Version32, Offset32,
+ Size32, CPUType32]
Each of the fields are 32-bit fields stored in little endian form (as with
the rest of the bitcode file fields). The Magic number is always
From evan.cheng at apple.com Mon Mar 30 03:42:15 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 30 Mar 2009 01:42:15 -0700
Subject: [llvm-commits] [llvm] r67881 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
In-Reply-To: <200903272355.n2RNt58L001640@zion.cs.uiuc.edu>
References: <200903272355.n2RNt58L001640@zion.cs.uiuc.edu>
Message-ID: <03E88F79-1516-44B8-A395-A048166AA1AE@apple.com>
Hi Dan,
This is pretty bizarre. Somehow this patch is causing lua to fail see
"grawp-pic". I think the bug is elsewhere (because the fix is
obvious). But do you mind taking a look?
Evan
On Mar 27, 2009, at 4:55 PM, Dan Gohman wrote:
> Author: djg
> Date: Fri Mar 27 18:55:04 2009
> New Revision: 67881
>
> URL: http://llvm.org/viewvc/llvm-project?rev=67881&view=rev
> Log:
> Fix what surely must be a copy+pasto.
>
> Modified:
> llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=67881&r1=67880&r2=67881&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
> (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Mar
> 27 18:55:04 2009
> @@ -548,8 +548,8 @@
> FLI.LiveOutRegInfo.resize(DestReg+1);
> FunctionLoweringInfo::LiveOutInfo &LOI =
> FLI.LiveOutRegInfo[DestReg];
> LOI.NumSignBits = NumSignBits;
> - LOI.KnownOne = NumSignBits;
> - LOI.KnownZero = NumSignBits;
> + LOI.KnownOne = KnownOne;
> + LOI.KnownZero = KnownZero;
> }
> }
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From gohman at apple.com Mon Mar 30 09:47:50 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 07:47:50 -0700
Subject: [llvm-commits] [llvm] r67879 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.h
In-Reply-To: <200903281155.09133.baldrick@free.fr>
References: <200903272351.n2RNp3h6001260@zion.cs.uiuc.edu>
<200903281155.09133.baldrick@free.fr>
Message-ID:
On Mar 28, 2009, at 3:55 AM, Duncan Sands wrote:
> Hi Dan,
>
>> Initialize LiveOutInfo's APInt members to zero, as APInt's
>> default constructor produces an uninitialized APInt.
>> This fixes PR3896.
>
> is this the correct fix? If LiveOutInfo was default
> constructed, doesn't this mean it doesn't contain
> anything useful. If so, why is it being examined?
> Also, will the code that uses it come to the right
> conclusions given this initialization?
Hi Duncan,
LiveOutRegInfo is a std::vector which is populated
with resize. The expectation is that elements contain
"nothing known" values unless more information is added to them.
Dan
From gohman at apple.com Mon Mar 30 09:55:08 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 07:55:08 -0700
Subject: [llvm-commits] [llvm] r67849 -
/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
In-Reply-To:
References: <200903271617.n2RGHboQ032209@zion.cs.uiuc.edu>
Message-ID: <72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
On Mar 28, 2009, at 3:07 AM, Bill Wendling wrote:
> On Mar 27, 2009, at 9:17 AM, Dan Gohman wrote:
>
>> Author: djg
>> Date: Fri Mar 27 11:17:22 2009
>> New Revision: 67849
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=67849&view=rev
>> Log:
>> Fix this test so that it doesn't spuriously fail due to some
>> unrelated debugging output happening to contain the string "store".
>>
>> Modified:
>> llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
>>
>> Modified: llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll?rev=67849&r1=67848&r2=67849&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll (original)
>> +++ llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll Fri Mar 27
>> 11:17:22 2009
>> @@ -1,4 +1,4 @@
>> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
>> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {= store}
>
> I thought that "store" instructions were never assigned to a
> variable...
This test is grepping through the -debug output of llc, and the stores
its
looking for do happen to be printed with =.
Grepping through -debug output isn't very nice in any case, but at the
moment there aren't any better ways to express this specific test.
Dan
From asl at math.spbu.ru Mon Mar 30 10:27:05 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 15:27:05 -0000
Subject: [llvm-commits] [llvm] r68031 - in /llvm/trunk:
include/llvm/Target/ELFTargetAsmInfo.h include/llvm/Target/TargetAsmInfo.h
lib/Target/DarwinTargetAsmInfo.cpp lib/Target/ELFTargetAsmInfo.cpp
lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp
Message-ID: <200903301527.n2UFR5Lg008061@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 10:27:03 2009
New Revision: 68031
URL: http://llvm.org/viewvc/llvm-project?rev=68031&view=rev
Log:
Add data.rel stuff
Modified:
llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Mar 30 10:27:03 2009
@@ -32,6 +32,11 @@
const Section* MergeableStringSection(const GlobalVariable *GV) const;
virtual const Section*
SelectSectionForMachineConst(const Type *Ty) const;
+
+ const Section* DataRelSection;
+ const Section* DataRelLocalSection;
+ const Section* DataRelROSection;
+ const Section* DataRelROLocalSection;
};
}
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Mar 30 10:27:03 2009
@@ -36,8 +36,12 @@
Unknown = 0, ///< Custom section
Text, ///< Text section
Data, ///< Data section
+ DataRel, ///< Contains data that has relocations
+ DataRelLocal, ///< Contains data that has only local relocations
BSS, ///< BSS section
ROData, ///< Readonly data section
+ DataRelRO, ///< Contains data that is otherwise readonly
+ DataRelROLocal, ///< Contains r/o data with only local relocations
RODataMergeStr, ///< Readonly data section (mergeable strings)
RODataMergeConst, ///< Readonly data section (mergeable constants)
SmallData, ///< Small data section
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Mar 30 10:27:03 2009
@@ -85,6 +85,9 @@
else
return TextSection;
case SectionKind::Data:
+ case SectionKind::DataRel:
+ case SectionKind::DataRelRO:
+ case SectionKind::DataRelROLocal:
case SectionKind::ThreadData:
case SectionKind::BSS:
case SectionKind::ThreadBSS:
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Mar 30 10:27:03 2009
@@ -35,6 +35,13 @@
TLSBSSSection = getNamedSection("\t.tbss",
SectionFlags::Writeable | SectionFlags::TLS | SectionFlags::BSS);
+ DataRelSection = getNamedSection("\t.data.rel", SectionFlags::Writeable);
+ DataRelLocalSection = getNamedSection("\t.data.rel.local",
+ SectionFlags::Writeable);
+ DataRelROSection = getNamedSection("\t.data.rel.ro",
+ SectionFlags::Writeable);
+ DataRelROLocalSection = getNamedSection("\t.data.rel.ro.local",
+ SectionFlags::Writeable);
}
const Section*
@@ -67,6 +74,14 @@
case SectionKind::Data:
case SectionKind::SmallData:
return DataSection;
+ case SectionKind::DataRel:
+ return DataRelSection;
+ case SectionKind::DataRelLocal:
+ return DataRelLocalSection;
+ case SectionKind::DataRelRO:
+ return DataRelROSection;
+ case SectionKind::DataRelROLocal:
+ return DataRelROLocalSection;
case SectionKind::BSS:
case SectionKind::SmallBSS:
// ELF targets usually have BSS sections
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Mar 30 10:27:03 2009
@@ -124,7 +124,7 @@
DataSection = getUnnamedSection("\t.data", SectionFlags::Writeable);
}
-TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm)
+TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm)
: TM(tm) {
fillDefaultValues();
}
@@ -220,14 +220,18 @@
unsigned Reloc = RelocBehaviour();
// We already did a query for 'all' relocs, thus - early exits.
- if (Reloc == Reloc::LocalOrGlobal)
- return SectionKind::Data;
- else if (Reloc == Reloc::None)
+ if (Reloc == Reloc::LocalOrGlobal) {
+ return (C->ContainsRelocations(Reloc::Local) ?
+ SectionKind::DataRelROLocal : SectionKind::DataRelRO);
+ } else if (Reloc == Reloc::None)
return SectionKind::ROData;
else {
// Ok, target wants something funny. Honour it.
- return (C->ContainsRelocations(Reloc) ?
- SectionKind::Data : SectionKind::ROData);
+ if (C->ContainsRelocations(Reloc)) {
+ return (Reloc == Reloc::Local ?
+ SectionKind::DataRelROLocal : SectionKind::DataRelRO);
+ } else
+ return SectionKind::ROData;
}
} else {
// Check, if initializer is a null-terminated string
@@ -238,8 +242,19 @@
}
}
- // Variable is not constant or thread-local - emit to generic data section.
- return (isThreadLocal ? SectionKind::ThreadData : SectionKind::Data);
+ // Variable either is not constant or thread-local - output to data section.
+ if (isThreadLocal)
+ return SectionKind::ThreadData;
+
+ if (GVar->hasInitializer()) {
+ Constant *C = GVar->getInitializer();
+ unsigned Reloc = RelocBehaviour();
+ if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
+ return (C->ContainsRelocations(Reloc::Local) ?
+ SectionKind::DataRelLocal : SectionKind::DataRel);
+ }
+
+ return SectionKind::Data;
}
unsigned
@@ -259,6 +274,10 @@
Flags |= SectionFlags::TLS;
// FALLS THROUGH
case SectionKind::Data:
+ case SectionKind::DataRel:
+ case SectionKind::DataRelLocal:
+ case SectionKind::DataRelRO:
+ case SectionKind::DataRelROLocal:
case SectionKind::BSS:
Flags |= SectionFlags::Writeable;
break;
@@ -360,6 +379,14 @@
return ".gnu.linkonce.t." + GV->getName();
case SectionKind::Data:
return ".gnu.linkonce.d." + GV->getName();
+ case SectionKind::DataRel:
+ return ".gnu.linkonce.d.rel" + GV->getName();
+ case SectionKind::DataRelLocal:
+ return ".gnu.linkonce.d.rel.local" + GV->getName();
+ case SectionKind::DataRelRO:
+ return ".gnu.linkonce.d.rel.ro" + GV->getName();
+ case SectionKind::DataRelROLocal:
+ return ".gnu.linkonce.d.rel.ro.local" + GV->getName();
case SectionKind::SmallData:
return ".gnu.linkonce.s." + GV->getName();
case SectionKind::BSS:
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=68031&r1=68030&r2=68031&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Mar 30 10:27:03 2009
@@ -305,17 +305,12 @@
switch (kind) {
case SectionKind::Text:
return ".text$linkonce" + GV->getName();
- case SectionKind::Data:
- case SectionKind::BSS:
- case SectionKind::ThreadData:
- case SectionKind::ThreadBSS:
- return ".data$linkonce" + GV->getName();
case SectionKind::ROData:
case SectionKind::RODataMergeConst:
case SectionKind::RODataMergeStr:
return ".rdata$linkonce" + GV->getName();
default:
- assert(0 && "Unknown section kind");
+ return ".data$linkonce" + GV->getName();
}
return NULL;
}
From asl at math.spbu.ru Mon Mar 30 10:27:43 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 15:27:43 -0000
Subject: [llvm-commits] [llvm] r68032 - in /llvm/trunk:
include/llvm/Target/ELFTargetAsmInfo.h lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.cpp
Message-ID: <200903301527.n2UFRh8l008094@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 10:27:43 2009
New Revision: 68032
URL: http://llvm.org/viewvc/llvm-project?rev=68032&view=rev
Log:
Do not propagate ELF-specific stuff (data.rel) into other targets. This simplifies code and also ensures correctness.
Modified:
llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h?rev=68032&r1=68031&r2=68032&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/ELFTargetAsmInfo.h Mon Mar 30 10:27:43 2009
@@ -25,6 +25,7 @@
struct ELFTargetAsmInfo: public TargetAsmInfo {
explicit ELFTargetAsmInfo(const TargetMachine &TM);
+ SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV) const;
virtual const Section* SelectSectionForGlobal(const GlobalValue *GV) const;
virtual std::string printSectionFlags(unsigned flags) const;
const Section* MergeableConstSection(const GlobalVariable *GV) const;
Modified: llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp?rev=68032&r1=68031&r2=68032&view=diff
==============================================================================
--- llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/DarwinTargetAsmInfo.cpp Mon Mar 30 10:27:43 2009
@@ -85,9 +85,6 @@
else
return TextSection;
case SectionKind::Data:
- case SectionKind::DataRel:
- case SectionKind::DataRelRO:
- case SectionKind::DataRelROLocal:
case SectionKind::ThreadData:
case SectionKind::BSS:
case SectionKind::ThreadBSS:
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=68032&r1=68031&r2=68032&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Mar 30 10:27:43 2009
@@ -44,6 +44,30 @@
SectionFlags::Writeable);
}
+SectionKind::Kind
+ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
+ SectionKind::Kind Kind = TargetAsmInfo::SectionKindForGlobal(GV);
+
+ if (Kind != SectionKind::Data)
+ return Kind;
+
+ // Decide, whether we need data.rel stuff
+ const GlobalVariable* GVar = dyn_cast(GV);
+ if (GVar->hasInitializer()) {
+ Constant *C = GVar->getInitializer();
+ bool isConstant = GVar->isConstant();
+ unsigned Reloc = RelocBehaviour();
+ if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
+ return (C->ContainsRelocations(Reloc::Local) ?
+ (isConstant ?
+ SectionKind::DataRelROLocal : SectionKind::DataRelLocal) :
+ (isConstant ?
+ SectionKind::DataRelRO : SectionKind::DataRel));
+ }
+
+ return Kind;
+}
+
const Section*
ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind Kind = SectionKindForGlobal(GV);
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=68032&r1=68031&r2=68032&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Mar 30 10:27:43 2009
@@ -220,18 +220,14 @@
unsigned Reloc = RelocBehaviour();
// We already did a query for 'all' relocs, thus - early exits.
- if (Reloc == Reloc::LocalOrGlobal) {
- return (C->ContainsRelocations(Reloc::Local) ?
- SectionKind::DataRelROLocal : SectionKind::DataRelRO);
- } else if (Reloc == Reloc::None)
+ if (Reloc == Reloc::LocalOrGlobal)
+ return SectionKind::Data;
+ else if (Reloc == Reloc::None)
return SectionKind::ROData;
else {
// Ok, target wants something funny. Honour it.
- if (C->ContainsRelocations(Reloc)) {
- return (Reloc == Reloc::Local ?
- SectionKind::DataRelROLocal : SectionKind::DataRelRO);
- } else
- return SectionKind::ROData;
+ return (C->ContainsRelocations(Reloc) ?
+ SectionKind::Data : SectionKind::ROData);
}
} else {
// Check, if initializer is a null-terminated string
@@ -243,18 +239,7 @@
}
// Variable either is not constant or thread-local - output to data section.
- if (isThreadLocal)
- return SectionKind::ThreadData;
-
- if (GVar->hasInitializer()) {
- Constant *C = GVar->getInitializer();
- unsigned Reloc = RelocBehaviour();
- if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
- return (C->ContainsRelocations(Reloc::Local) ?
- SectionKind::DataRelLocal : SectionKind::DataRel);
- }
-
- return SectionKind::Data;
+ return (isThreadLocal ? SectionKind::ThreadData : SectionKind::Data);
}
unsigned
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=68032&r1=68031&r2=68032&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Mar 30 10:27:43 2009
@@ -305,12 +305,17 @@
switch (kind) {
case SectionKind::Text:
return ".text$linkonce" + GV->getName();
+ case SectionKind::Data:
+ case SectionKind::BSS:
+ case SectionKind::ThreadData:
+ case SectionKind::ThreadBSS:
+ return ".data$linkonce" + GV->getName();
case SectionKind::ROData:
case SectionKind::RODataMergeConst:
case SectionKind::RODataMergeStr:
return ".rdata$linkonce" + GV->getName();
default:
- return ".data$linkonce" + GV->getName();
+ assert(0 && "Unknown section kind");
}
return NULL;
}
From asl at math.spbu.ru Mon Mar 30 10:28:00 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 15:28:00 -0000
Subject: [llvm-commits] [llvm] r68033 - /llvm/trunk/lib/VMCore/Constants.cpp
Message-ID: <200903301528.n2UFS0VM008112@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 10:28:00 2009
New Revision: 68033
URL: http://llvm.org/viewvc/llvm-project?rev=68033&view=rev
Log:
Properly propagate Kind.
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=68033&r1=68032&r2=68033&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Mar 30 10:28:00 2009
@@ -110,7 +110,7 @@
}
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
- if (getOperand(i)->ContainsRelocations())
+ if (getOperand(i)->ContainsRelocations(Kind))
return true;
return false;
From asl at math.spbu.ru Mon Mar 30 10:28:21 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 15:28:21 -0000
Subject: [llvm-commits] [llvm] r68034 - /llvm/trunk/lib/VMCore/Constants.cpp
Message-ID: <200903301528.n2UFSLQE008134@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 10:28:21 2009
New Revision: 68034
URL: http://llvm.org/viewvc/llvm-project?rev=68034&view=rev
Log:
Fix infinite looping
Modified:
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=68034&r1=68033&r2=68034&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Mon Mar 30 10:28:21 2009
@@ -107,6 +107,8 @@
// requested
return true;
}
+
+ return false;
}
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
From asl at math.spbu.ru Mon Mar 30 10:28:40 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 15:28:40 -0000
Subject: [llvm-commits] [llvm] r68035 -
/llvm/trunk/test/CodeGen/X86/rodata-relocs.ll
Message-ID: <200903301528.n2UFSeLw008153@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 10:28:40 2009
New Revision: 68035
URL: http://llvm.org/viewvc/llvm-project?rev=68035&view=rev
Log:
Tweak test for recent relro stuff
Modified:
llvm/trunk/test/CodeGen/X86/rodata-relocs.ll
Modified: llvm/trunk/test/CodeGen/X86/rodata-relocs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/rodata-relocs.ll?rev=68035&r1=68034&r2=68035&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/rodata-relocs.ll (original)
+++ llvm/trunk/test/CodeGen/X86/rodata-relocs.ll Mon Mar 30 10:28:40 2009
@@ -1,15 +1,23 @@
; RUN: llvm-as < %s | llc -relocation-model=static | grep rodata | count 3
; RUN: llvm-as < %s | llc -relocation-model=static | grep -F "rodata.cst" | count 2
; RUN: llvm-as < %s | llc -relocation-model=pic | grep rodata | count 2
-; RUN: llvm-as < %s | llc -relocation-model=pic | grep -F ".data" | count 1
+; RUN: llvm-as < %s | llc -relocation-model=pic | grep -F ".data.rel.ro" | count 2
+; RUN: llvm-as < %s | llc -relocation-model=pic | grep -F ".data.rel.ro.local" | count 1
+; RUN: llvm-as < %s | llc -relocation-model=pic | grep -F ".data.rel" | count 4
+; RUN: llvm-as < %s | llc -relocation-model=pic | grep -F ".data.rel.local" | count 1
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"
- at a = internal constant [2 x i32] [i32 1, i32 2] ; <[2 x i32]*> [#uses=1]
- at a1 = constant [2 x i32] [i32 1, i32 2] ; <[2 x i32]*> [#uses=1]
- at e = internal constant [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]], align 16 ; <[2 x [2 x i32]]*> [#uses=1]
- at e1 = constant [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]], align 16 ; <[2 x [2 x i32]]*> [#uses=1]
- at p = constant i8* bitcast ([2 x i32]* @a to i8*) ; [#uses=0]
- at t = constant i8* bitcast ([2 x [2 x i32]]* @e to i8*) ; [#uses=0]
- at p1 = constant i8* bitcast ([2 x i32]* @a1 to i8*) ; [#uses=0]
- at t1 = constant i8* bitcast ([2 x [2 x i32]]* @e1 to i8*) ; [#uses=0]
+ at a = internal constant [2 x i32] [i32 1, i32 2]
+ at a1 = constant [2 x i32] [i32 1, i32 2]
+ at e = internal constant [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]], align 16
+ at e1 = constant [2 x [2 x i32]] [[2 x i32] [i32 1, i32 2], [2 x i32] [i32 3, i32 4]], align 16
+ at p = constant i8* bitcast ([2 x i32]* @a to i8*)
+ at t = constant i8* bitcast ([2 x [2 x i32]]* @e to i8*)
+ at p1 = constant i8* bitcast ([2 x i32]* @a1 to i8*)
+ at t1 = constant i8* bitcast ([2 x [2 x i32]]* @e1 to i8*)
+ at p2 = internal global i8* bitcast([2 x i32]* @a1 to i8*)
+ at t2 = internal global i8* bitcast([2 x [2 x i32]]* @e1 to i8*)
+ at p3 = internal global i8* bitcast([2 x i32]* @a to i8*)
+ at t3 = internal global i8* bitcast([2 x [2 x i32]]* @e to i8*)
+
From gohman at apple.com Mon Mar 30 10:43:40 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 08:43:40 -0700
Subject: [llvm-commits] [llvm] r68004 - in /llvm/trunk:
include/llvm/Constant.h lib/VMCore/Constants.cpp
In-Reply-To: <200903291713.n2THDLls031259@zion.cs.uiuc.edu>
References: <200903291713.n2THDLls031259@zion.cs.uiuc.edu>
Message-ID:
On Mar 29, 2009, at 10:13 AM, Anton Korobeynikov wrote:
> Author: asl
> Date: Sun Mar 29 12:13:18 2009
> New Revision: 68004
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68004&view=rev
> Log:
> Extend the relocation tracker handler, so we can filter on different
> 'kinds' of relocations required.
>
> Modified:
> llvm/trunk/include/llvm/Constant.h
> llvm/trunk/lib/VMCore/Constants.cpp
>
> Modified: llvm/trunk/include/llvm/Constant.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=68004&r1=68003&r2=68004&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/include/llvm/Constant.h (original)
> +++ llvm/trunk/include/llvm/Constant.h Sun Mar 29 12:13:18 2009
> @@ -19,6 +19,12 @@
> namespace llvm {
> template class SmallVectorImpl;
>
> + namespace Reloc {
> + const unsigned Local = 1 << 0; ///< Local relocations are
> required
> + const unsigned Global = 1 << 1; ///< Global relocations are
> required
> + const unsigned LocalOrGlobal = Local | Global;
> + }
Hi Anton,
Can you add comments describing what "local" and "global" mean here?
Specifically, do these express linkage information, visibility
information,
both, or something else?
Looking at the code, it appears the answer is linkage information.
Please
mention this in a comment in Constant.h.
Thanks,
Dan
From gohman at apple.com Mon Mar 30 11:49:37 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 09:49:37 -0700
Subject: [llvm-commits] [llvm] r68023 -
/llvm/trunk/docs/TestingGuide.html
In-Reply-To: <200903300437.n2U4bsT6002346@zion.cs.uiuc.edu>
References: <200903300437.n2U4bsT6002346@zion.cs.uiuc.edu>
Message-ID: <17C222A8-8566-478A-A274-66E082256A19@apple.com>
On Mar 29, 2009, at 9:37 PM, John Mosby wrote:
> Author: jdm
> Date: Sun Mar 29 23:37:51 2009
> New Revision: 68023
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68023&view=rev
> Log:
> Clarify section on setting up and running test-suite
>
> Modified:
> llvm/trunk/docs/TestingGuide.html
>
> Modified: llvm/trunk/docs/TestingGuide.html
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=68023&r1=68022&r2=68023&view=diff
Hi John,
>
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/docs/TestingGuide.html (original)
> +++ llvm/trunk/docs/TestingGuide.html Sun Mar 29 23:37:51 2009
> @@ -695,12 +695,14 @@
>
> First, all tests are executed within the LLVM object directory
> tree. They
> are not executed inside of the LLVM source tree. This is
> because the
> -test suite creates temporary files during execution.
> +test suite creates temporary files during execution. This means you
> must create
> +a build tree separate from the LLVM source tree in which to run the
> test suite.
Is this true? Is it not possible to run the test-suite in srdir ==
objdir mode
when it is run from projects/test-suite?
In fact, there's a major problem with running the test-suite in
srcdir != objdir
mode -- the objdir contains copies of the srcdir's Makefiles, and the
copies
are not updated after an svn update.
>
>
> To run the test suite, you need to use the following steps:
>
>
> - - cd into the llvm/projects directory
> + - cd into the llvm/projects directory in your
> source tree.
> +
>
> Check out the test-suite module with:
>
> @@ -709,24 +711,35 @@
> % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
>
>
> -
> - This will get the test suite into llvm/projects/llvm-
> test
> -
> - Configure the test suite using llvm configure. This will
> automatically
> - configure test-suite. You must do it from the top level
> otherwise llvm-gcc
> - will not be set which is required to run llvm-test:
> + This will get the test suite into llvm/projects/test-
> suite.
> +
[The Makefiles expect the test suite directory to be
> named either
> + test-suite or llvm-test. To be safe, use
> + test-suite as in the above svn command line.]
The name "llvm-test" is a historical artifact. "test-suite" is the
preferred
name currently. It would be better to avoid mentioning "llvm-test"
here,
to avoid confusion.
Dan
From artur.pietrek at kalray.eu Mon Mar 30 09:50:55 2009
From: artur.pietrek at kalray.eu (Artur Pietrek)
Date: Mon, 30 Mar 2009 16:50:55 +0200
Subject: [llvm-commits] MSIL codegen, global pointers initialization fix
Message-ID: <49D0DC4F.40105@kalray.eu>
Hello,
The patch proposal for fixing global pointers initialization in MSIL
codegen. See attachement.
Regards,
Artur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_globals_init.patch
Type: text/x-patch
Size: 1492 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/e2d9b41f/attachment.bin
From mrs at apple.com Mon Mar 30 12:06:18 2009
From: mrs at apple.com (Mike Stump)
Date: Mon, 30 Mar 2009 10:06:18 -0700
Subject: [llvm-commits] [llvm] r67892 - in /llvm/trunk:
include/llvm/Support/CommandLine.h lib/Support/CommandLine.cpp
In-Reply-To: <0EAEDD00-16A2-4847-8C24-315B87661232@apple.com>
References: <200903280208.n2S28lQ4010375@zion.cs.uiuc.edu>
<0EAEDD00-16A2-4847-8C24-315B87661232@apple.com>
Message-ID: <8B5AC6AA-D7EF-45B6-BB7A-D9912244CE12@apple.com>
On Mar 27, 2009, at 7:09 PM, Chris Lattner wrote:
> Mike, who delete[]'s the string that is new'd in this code?
It leaks.
> Why should this exist?
I put it in so that we could handle -foption and -fno-option style
options.
From clattner at apple.com Mon Mar 30 12:08:02 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 30 Mar 2009 10:08:02 -0700
Subject: [llvm-commits] [llvm] r67849 -
/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
In-Reply-To: <72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
References: <200903271617.n2RGHboQ032209@zion.cs.uiuc.edu>
<72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
Message-ID: <520670C5-EEC2-40B9-9317-7700D3DCF0FA@apple.com>
On Mar 30, 2009, at 7:55 AM, Dan Gohman wrote:
>>> =
>>> =
>>> ====================================================================
>>> --- llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll (original)
>>> +++ llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll Fri Mar 27
>>> 11:17:22 2009
>>> @@ -1,4 +1,4 @@
>>> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
>>> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {= store}
>>
>> I thought that "store" instructions were never assigned to a
>> variable...
>
> This test is grepping through the -debug output of llc, and the stores
> its
> looking for do happen to be printed with =.
>
> Grepping through -debug output isn't very nice in any case, but at the
> moment there aren't any better ways to express this specific test.
Actually, now that you mention it, grepping through -debug output is
not acceptable. This test won't pass in a release-asserts build.
-Chris
From fvbommel at wxs.nl Mon Mar 30 12:09:50 2009
From: fvbommel at wxs.nl (Frits van Bommel)
Date: Mon, 30 Mar 2009 19:09:50 +0200
Subject: [llvm-commits] [llvm] r68032 - in /llvm/trunk:
include/llvm/Target/ELFTargetAsmInfo.h lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.cpp
In-Reply-To: <200903301527.n2UFRh8l008094@zion.cs.uiuc.edu>
References: <200903301527.n2UFRh8l008094@zion.cs.uiuc.edu>
Message-ID: <49D0FCDE.3010907@wxs.nl>
Anton Korobeynikov wrote:
> Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=68032&r1=68031&r2=68032&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
> +++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Mar 30 10:27:43 2009
> @@ -44,6 +44,30 @@
> SectionFlags::Writeable);
> }
>
> +SectionKind::Kind
> +ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
> + SectionKind::Kind Kind = TargetAsmInfo::SectionKindForGlobal(GV);
> +
> + if (Kind != SectionKind::Data)
> + return Kind;
> +
> + // Decide, whether we need data.rel stuff
> + const GlobalVariable* GVar = dyn_cast(GV);
> + if (GVar->hasInitializer()) {
> + Constant *C = GVar->getInitializer();
> + bool isConstant = GVar->isConstant();
> + unsigned Reloc = RelocBehaviour();
> + if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
> + return (C->ContainsRelocations(Reloc::Local) ?
> + (isConstant ?
> + SectionKind::DataRelROLocal : SectionKind::DataRelLocal) :
> + (isConstant ?
> + SectionKind::DataRelRO : SectionKind::DataRel));
Doesn't this last bit put data with both global and local relocations in
the section supposedly reserved for data with *only* local relocations?
(According to the comments you added in the previous commit)
So shouldn't this be something like:
----
+ return (C->ContainsRelocations(Reloc::Global) ?
+ (isConstant ?
+ SectionKind::DataRelRO : SectionKind::DataRel) :
+ (isConstant ?
+ SectionKind::DataRelROLocal : SectionKind::DataRelLocal));
----
instead?
> + }
> +
> + return Kind;
> +}
> +
> const Section*
> ELFTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
> SectionKind::Kind Kind = SectionKindForGlobal(GV);
>
From ojomojo at gmail.com Mon Mar 30 12:23:38 2009
From: ojomojo at gmail.com (John Mosby)
Date: Mon, 30 Mar 2009 11:23:38 -0600
Subject: [llvm-commits] [llvm] r68023 -
/llvm/trunk/docs/TestingGuide.html
In-Reply-To: <17C222A8-8566-478A-A274-66E082256A19@apple.com>
References: <200903300437.n2U4bsT6002346@zion.cs.uiuc.edu>
<17C222A8-8566-478A-A274-66E082256A19@apple.com>
Message-ID: <645d868c0903301023n25c412aic8f269c9da916711@mail.gmail.com>
On Mon, Mar 30, 2009 at 10:49 AM, Dan Gohman wrote:
>
> Hi John,
>
> >
> > ======================================================================
> > --- llvm/trunk/docs/TestingGuide.html (original)
> > +++ llvm/trunk/docs/TestingGuide.html Sun Mar 29 23:37:51 2009
> > @@ -695,12 +695,14 @@
> >
> > First, all tests are executed within the LLVM object directory
> > tree. They
> > are not executed inside of the LLVM source tree. This is
> > because the
> > -test suite creates temporary files during execution.
> > +test suite creates temporary files during execution. This means you
> > must create
> > +a build tree separate from the LLVM source tree in which to run the
> > test suite.
>
> Is this true? Is it not possible to run the test-suite in srdir ==
> objdir mode
> when it is run from projects/test-suite?
I followed what appeared to be the original process description which starts
off saying that tests are run from within the object (build) directory
rather
than the source tree.
> In fact, there's a major problem with running the test-suite in
> srcdir != objdir mode -- the objdir contains copies of the srcdir's
> Makefiles, and the
> copies are not updated after an svn update.
Absolutely. I see now I confused things here. I run the test suite from
within a build
tree and I maintain consistency manually by removing old test results and
re-configing
in the build tree. I originally ran it from within my source tree but wanted
to have
more than one test area.
Should the docs describe running from within the source tree only?
> ...
> > +
[The Makefiles expect the test suite directory to be
> > named either
> > + test-suite or llvm-test. To be safe, use
> > + test-suite as in the above svn command line.]
>
> The name "llvm-test" is a historical artifact. "test-suite" is the
> preferred name currently. It would be better to avoid mentioning
> "llvm-test"
> here, to avoid confusion.
I was unsure about that, I'll remove "llvm-test".
Thanks for your help,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/6d5bbf87/attachment.html
From anton at korobeynikov.info Mon Mar 30 12:37:05 2009
From: anton at korobeynikov.info (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 21:37:05 +0400
Subject: [llvm-commits] [llvm] r68032 - in /llvm/trunk:
include/llvm/Target/ELFTargetAsmInfo.h lib/Target/DarwinTargetAsmInfo.cpp
lib/Target/ELFTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.cpp
In-Reply-To: <49D0FCDE.3010907@wxs.nl>
References: <200903301527.n2UFRh8l008094@zion.cs.uiuc.edu>
<49D0FCDE.3010907@wxs.nl>
Message-ID: <1238434625.12734.45.camel@aslstation>
Hi, Frits
> Doesn't this last bit put data with both global and local relocations in
> the section supposedly reserved for data with *only* local relocations?
> (According to the comments you added in the previous commit)
Nice catch! Thanks!
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
From asl at math.spbu.ru Mon Mar 30 12:37:44 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 17:37:44 -0000
Subject: [llvm-commits] [llvm] r68036 -
/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
Message-ID: <200903301737.n2UHbiFP013683@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 12:37:43 2009
New Revision: 68036
URL: http://llvm.org/viewvc/llvm-project?rev=68036&view=rev
Log:
Fix thinko: put stuff with both global and local relocations into data.rel{.ro}, not .local
Modified:
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=68036&r1=68035&r2=68036&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Mon Mar 30 12:37:43 2009
@@ -58,11 +58,11 @@
bool isConstant = GVar->isConstant();
unsigned Reloc = RelocBehaviour();
if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
- return (C->ContainsRelocations(Reloc::Local) ?
+ return (C->ContainsRelocations(Reloc::Global) ?
(isConstant ?
- SectionKind::DataRelROLocal : SectionKind::DataRelLocal) :
+ SectionKind::DataRelRO : SectionKind::DataRel) :
(isConstant ?
- SectionKind::DataRelRO : SectionKind::DataRel));
+ SectionKind::DataRelROLocal : SectionKind::DataRelLocal));
}
return Kind;
From asl at math.spbu.ru Mon Mar 30 12:38:00 2009
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 17:38:00 -0000
Subject: [llvm-commits] [llvm] r68037 - /llvm/trunk/include/llvm/Constant.h
Message-ID: <200903301738.n2UHc06u013706@zion.cs.uiuc.edu>
Author: asl
Date: Mon Mar 30 12:38:00 2009
New Revision: 68037
URL: http://llvm.org/viewvc/llvm-project?rev=68037&view=rev
Log:
Clearify local/global relocations wording
Modified:
llvm/trunk/include/llvm/Constant.h
Modified: llvm/trunk/include/llvm/Constant.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=68037&r1=68036&r2=68037&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Constant.h (original)
+++ llvm/trunk/include/llvm/Constant.h Mon Mar 30 12:38:00 2009
@@ -19,6 +19,13 @@
namespace llvm {
template class SmallVectorImpl;
+ /// If object contains references to other objects, then relocations are
+ /// usually required for emission of such object (especially in PIC mode). One
+ /// usually distinguishes local and global relocations. Local relocations are
+ /// made wrt objects in the same module and these objects have local (internal
+ /// or private) linkage. Global relocations are made wrt externally visible
+ /// objects. In most cases local relocations can be resolved via so-called
+ /// 'pre-link' technique.
namespace Reloc {
const unsigned None = 0;
const unsigned Local = 1 << 0; ///< Local relocations are required
@@ -70,7 +77,9 @@
bool canTrap() const;
/// ContainsRelocations - Return true if the constant value contains
- /// relocations which cannot be resolved at compile time.
+ /// relocations which cannot be resolved at compile time. Note that answer is
+ /// not exclusive: there can be possibility that relocations of other kind are
+ /// required as well.
bool ContainsRelocations(unsigned Kind = Reloc::LocalOrGlobal) const;
// Specialize get/setOperand for Constants as their operands are always
From anton at korobeynikov.info Mon Mar 30 12:37:48 2009
From: anton at korobeynikov.info (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 21:37:48 +0400
Subject: [llvm-commits] [llvm] r68004 - in /llvm/trunk:
include/llvm/Constant.h lib/VMCore/Constants.cpp
In-Reply-To:
References: <200903291713.n2THDLls031259@zion.cs.uiuc.edu>
Message-ID: <1238434668.12734.46.camel@aslstation>
Hi Dan
> Looking at the code, it appears the answer is linkage information.
That's correct. Just local / non-local linkage.
> Please mention this in a comment in Constant.h.
Done!
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
From mrs at apple.com Mon Mar 30 12:43:05 2009
From: mrs at apple.com (Mike Stump)
Date: Mon, 30 Mar 2009 17:43:05 -0000
Subject: [llvm-commits] [llvm] r68038 - /llvm/trunk/Makefile
Message-ID: <200903301743.n2UHh5o3013979@zion.cs.uiuc.edu>
Author: mrs
Date: Mon Mar 30 12:43:04 2009
New Revision: 68038
URL: http://llvm.org/viewvc/llvm-project?rev=68038&view=rev
Log:
Add ccc back for now.
Modified:
llvm/trunk/Makefile
Modified: llvm/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=68038&r1=68037&r2=68038&view=diff
==============================================================================
--- llvm/trunk/Makefile (original)
+++ llvm/trunk/Makefile Mon Mar 30 12:43:04 2009
@@ -56,7 +56,7 @@
ifeq ($(MAKECMDGOALS),install-clang)
DIRS := tools/clang/tools/driver tools/clang/tools/clang-cc \
- tools/clang/lib/Headers
+ tools/clang/lib/Headers tools/clang/tools/ccc
OPTIONAL_DIRS :=
NO_INSTALL = 1
endif
From dpatel at apple.com Mon Mar 30 13:34:48 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 30 Mar 2009 18:34:48 -0000
Subject: [llvm-commits] [llvm] r68047 -
/llvm/trunk/lib/Analysis/AliasSetTracker.cpp
Message-ID: <200903301834.n2UIYmnp016556@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Mar 30 13:34:47 2009
New Revision: 68047
URL: http://llvm.org/viewvc/llvm-project?rev=68047&view=rev
Log:
getEntryFor() may invalidate DenseMap iterator.
Walking an invalidated iterator is not a good idea.
Modified:
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=68047&r1=68046&r2=68047&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Mar 30 13:34:47 2009
@@ -520,6 +520,7 @@
if (Entry.hasAliasSet()) return; // Already in the tracker!
// Add it to the alias set it aliases...
+ I = PointerMap.find(From);
AliasSet *AS = I->second->getAliasSet(*this);
AS->addPointer(*this, Entry, I->second->getSize(), true);
}
From lattner at apple.com Mon Mar 30 13:35:54 2009
From: lattner at apple.com (Tanya Lattner)
Date: Mon, 30 Mar 2009 11:35:54 -0700
Subject: [llvm-commits] [llvm] r68023
- /llvm/trunk/docs/TestingGuide.html
In-Reply-To: <17C222A8-8566-478A-A274-66E082256A19@apple.com>
References: <200903300437.n2U4bsT6002346@zion.cs.uiuc.edu>
<17C222A8-8566-478A-A274-66E082256A19@apple.com>
Message-ID: <673D9F82-6ABF-4BE8-92A7-6E3B9B34F396@apple.com>
On Mar 30, 2009, at 9:49 AM, Dan Gohman wrote:
>
> On Mar 29, 2009, at 9:37 PM, John Mosby wrote:
>
>> Author: jdm
>> Date: Sun Mar 29 23:37:51 2009
>> New Revision: 68023
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=68023&view=rev
>> Log:
>> Clarify section on setting up and running test-suite
>>
>> Modified:
>> llvm/trunk/docs/TestingGuide.html
>>
>> Modified: llvm/trunk/docs/TestingGuide.html
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=68023&r1=68022&r2=68023&view=diff
>
> Hi John,
>
>>
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- llvm/trunk/docs/TestingGuide.html (original)
>> +++ llvm/trunk/docs/TestingGuide.html Sun Mar 29 23:37:51 2009
>> @@ -695,12 +695,14 @@
>>
>> First, all tests are executed within the LLVM object directory
>> tree. They
>> are not executed inside of the LLVM source tree. This is
>> because the
>> -test suite creates temporary files during execution.
>> +test suite creates temporary files during execution. This means you
>> must create
>> +a build tree separate from the LLVM source tree in which to run the
>> test suite.
>
> Is this true? Is it not possible to run the test-suite in srdir ==
> objdir mode
> when it is run from projects/test-suite?
>
This is NOT true. I test this every single time I do a release
(srcdir=objdir). Please undo this change to the documentation.
-Tanya
> In fact, there's a major problem with running the test-suite in
> srcdir != objdir
> mode -- the objdir contains copies of the srcdir's Makefiles, and the
> copies
> are not updated after an svn update.
>
>>
>>
>> To run the test suite, you need to use the following steps:
>>
>>
>> - - cd into the llvm/projects directory
>> + - cd into the llvm/projects directory in your
>> source tree.
>> +
>>
>> Check out the test-suite module with:
>>
>> @@ -709,24 +711,35 @@
>> % svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
>>
>>
>> -
>> - This will get the test suite into llvm/projects/llvm-
>> test
>> -
>> - Configure the test suite using llvm configure. This will
>> automatically
>> - configure test-suite. You must do it from the top level
>> otherwise llvm-gcc
>> - will not be set which is required to run llvm-test:
>> + This will get the test suite into llvm/projects/test-
>> suite.
>> +
[The Makefiles expect the test suite directory to be
>> named either
>> + test-suite or llvm-test. To be safe, use
>> + test-suite as in the above svn command line.]
>
> The name "llvm-test" is a historical artifact. "test-suite" is the
> preferred
> name currently. It would be better to avoid mentioning "llvm-test"
> here,
> to avoid confusion.
>
> Dan
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/f2612597/attachment.html
From brukman at gmail.com Mon Mar 30 13:36:20 2009
From: brukman at gmail.com (Misha Brukman)
Date: Mon, 30 Mar 2009 14:36:20 -0400
Subject: [llvm-commits] [llvm] r67849 -
/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
In-Reply-To: <72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
References: <200903271617.n2RGHboQ032209@zion.cs.uiuc.edu>
<72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
Message-ID:
On Mon, Mar 30, 2009 at 10:55 AM, Dan Gohman wrote:
> >> --- llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll (original)
> >> +++ llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll Fri Mar 27
> >> 11:17:22 2009
> >> @@ -1,4 +1,4 @@
> >> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
> >> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {= store}
> >
> > I thought that "store" instructions were never assigned to a
> > variable...
>
> This test is grepping through the -debug output of llc, and the stores
> its
> looking for do happen to be printed with =.
>
> Grepping through -debug output isn't very nice in any case, but at the
> moment there aren't any better ways to express this specific test.
>
You can write a unittest to check this. It might require some refactoring
to be able to run all of LLC's passes separately from running the tool on
the command line, since they are currently hard-coded in its main()
function.
Let me know if you run into any issues with writing the tests.
Misha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/cafe1717/attachment.html
From bob.wilson at apple.com Mon Mar 30 13:49:37 2009
From: bob.wilson at apple.com (Bob Wilson)
Date: Mon, 30 Mar 2009 18:49:37 -0000
Subject: [llvm-commits] [llvm] r68050 -
/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h
Message-ID: <200903301849.n2UInb6n017095@zion.cs.uiuc.edu>
Author: bwilson
Date: Mon Mar 30 13:49:37 2009
New Revision: 68050
URL: http://llvm.org/viewvc/llvm-project?rev=68050&view=rev
Log:
Fix comment to match function name.
Modified:
llvm/trunk/lib/Target/ARM/ARMAddressingModes.h
Modified: llvm/trunk/lib/Target/ARM/ARMAddressingModes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAddressingModes.h?rev=68050&r1=68049&r2=68050&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAddressingModes.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMAddressingModes.h Mon Mar 30 13:49:37 2009
@@ -131,7 +131,7 @@
static inline unsigned getSOImmValImm(unsigned Imm) {
return Imm & 0xFF;
}
- /// getSOImmValRotate - Given an encoded imm field for the reg/imm form, return
+ /// getSOImmValRot - Given an encoded imm field for the reg/imm form, return
/// the rotate amount.
static inline unsigned getSOImmValRot(unsigned Imm) {
return (Imm >> 8) * 2;
From gohman at apple.com Mon Mar 30 13:49:16 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 11:49:16 -0700
Subject: [llvm-commits] [llvm] r68037 -
/llvm/trunk/include/llvm/Constant.h
In-Reply-To: <200903301738.n2UHc06u013706@zion.cs.uiuc.edu>
References: <200903301738.n2UHc06u013706@zion.cs.uiuc.edu>
Message-ID: <561A08B8-7A46-42F5-AAFD-D8293EC94E08@apple.com>
On Mar 30, 2009, at 10:38 AM, Anton Korobeynikov wrote:
> Author: asl
> Date: Mon Mar 30 12:38:00 2009
> New Revision: 68037
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68037&view=rev
> Log:
> Clearify local/global relocations wording
>
> Modified:
> llvm/trunk/include/llvm/Constant.h
>
> Modified: llvm/trunk/include/llvm/Constant.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=68037&r1=68036&r2=68037&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/include/llvm/Constant.h (original)
> +++ llvm/trunk/include/llvm/Constant.h Mon Mar 30 12:38:00 2009
> @@ -19,6 +19,13 @@
> namespace llvm {
> template class SmallVectorImpl;
>
> + /// If object contains references to other objects, then
> relocations are
> + /// usually required for emission of such object (especially in
> PIC mode). One
> + /// usually distinguishes local and global relocations. Local
> relocations are
> + /// made wrt objects in the same module and these objects have
> local (internal
> + /// or private) linkage. Global relocations are made wrt
> externally visible
> + /// objects. In most cases local relocations can be resolved via
> so-called
> + /// 'pre-link' technique.
Thanks for adding this.
This is still a little unclear to me though, however it may
just be wording now. The phrase "objects in the same
module" seems either redundant or contradictory.
The rest of the comment seems to support that it's
redundant. However, many optimizations that apply to
symbols with internal and private linkage also apply to
symbols with hidden or protected visibility and a
definition in the same module, so the intent here
isn't clear.
Thanks,
Dan
From ojomojo at gmail.com Mon Mar 30 13:56:53 2009
From: ojomojo at gmail.com (John Mosby)
Date: Mon, 30 Mar 2009 18:56:53 -0000
Subject: [llvm-commits] [llvm] r68051 - /llvm/trunk/docs/TestingGuide.html
Message-ID: <200903301856.n2UIurNQ017438@zion.cs.uiuc.edu>
Author: jdm
Date: Mon Mar 30 13:56:53 2009
New Revision: 68051
URL: http://llvm.org/viewvc/llvm-project?rev=68051&view=rev
Log:
docs/TestingGuide.html: correction to prev. text (objdir!=srcdir required for running test-suite), removed refs to llvm-test
Modified:
llvm/trunk/docs/TestingGuide.html
Modified: llvm/trunk/docs/TestingGuide.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=68051&r1=68050&r2=68051&view=diff
==============================================================================
--- llvm/trunk/docs/TestingGuide.html (original)
+++ llvm/trunk/docs/TestingGuide.html Mon Mar 30 13:56:53 2009
@@ -695,8 +695,7 @@
First, all tests are executed within the LLVM object directory tree. They
are not executed inside of the LLVM source tree. This is because the
-test suite creates temporary files during execution. This means you must create
-a build tree separate from the LLVM source tree in which to run the test suite.
+test suite creates temporary files during execution.
To run the test suite, you need to use the following steps:
@@ -711,13 +710,10 @@
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
- This will get the test suite into llvm/projects/test-suite.
-
[The Makefiles expect the test suite directory to be named either
- test-suite or llvm-test. To be safe, use
- test-suite as in the above svn command line.]
+ This will get the test suite into llvm/projects/test-suite.
Configure llvm from the top level of each build tree (LLVM object directory tree)
- in which you want to run the test suite, just like what you do before building LLVM.
+ in which you want to run the test suite, just as you do before building LLVM.
When running configure, you must either: (1) have llvm-gcc
in your path, or (2) specify the directory where llvm-gcc is
installed using --with-llvmgccdir=$LLVM_GCC_DIR.
From anton at korobeynikov.info Mon Mar 30 14:31:44 2009
From: anton at korobeynikov.info (Anton Korobeynikov)
Date: Mon, 30 Mar 2009 23:31:44 +0400
Subject: [llvm-commits] [llvm] r68037 -
/llvm/trunk/include/llvm/Constant.h
In-Reply-To: <561A08B8-7A46-42F5-AAFD-D8293EC94E08@apple.com>
References: <200903301738.n2UHc06u013706@zion.cs.uiuc.edu>
<561A08B8-7A46-42F5-AAFD-D8293EC94E08@apple.com>
Message-ID:
Hi, Dan
> The rest of the comment seems to support that it's
> redundant. However, many optimizations that apply to
> symbols with internal and private linkage also apply to
> symbols with hidden or protected visibility and a
> definition in the same module, so the intent here
> isn't clear.
Here I tried to mimic gcc's behaviour. It does not check for
visibility at all during computation of relocations. I don't know for
sure, whether adding visibility stuff here would break things or not,
that's why I tried to be as conservative as possible.
--
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University
From clattner at apple.com Mon Mar 30 14:52:24 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 30 Mar 2009 12:52:24 -0700
Subject: [llvm-commits] [llvm] r67849 -
/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
In-Reply-To:
References: <200903271617.n2RGHboQ032209@zion.cs.uiuc.edu>
<72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
Message-ID:
On Mar 30, 2009, at 11:36 AM, Misha Brukman wrote:
> >> @@ -1,4 +1,4 @@
> >> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
> >> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {=
> store}
> >
> > I thought that "store" instructions were never assigned to a
> > variable...
>
> This test is grepping through the -debug output of llc, and the stores
> its
> looking for do happen to be printed with =.
>
> Grepping through -debug output isn't very nice in any case, but at the
> moment there aren't any better ways to express this specific test.
>
> You can write a unittest to check this. It might require some
> refactoring to be able to run all of LLC's passes separately from
> running the tool on the command line, since they are currently hard-
> coded in its main() function.
I don't think we want unit tests for passes. We only want unit tests
for low level APIs.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/788ed9c4/attachment.html
From gohman at apple.com Mon Mar 30 14:59:02 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 19:59:02 -0000
Subject: [llvm-commits] [llvm] r68053 - /llvm/trunk/utils/llvm.grm
Message-ID: <200903301959.n2UJx2Ju019793@zion.cs.uiuc.edu>
Author: djg
Date: Mon Mar 30 14:59:02 2009
New Revision: 68053
URL: http://llvm.org/viewvc/llvm-project?rev=68053&view=rev
Log:
Update the polygen grammer to reflect that zext and sext are no longer
valid argument attributes (zeroext and signext are).
Modified:
llvm/trunk/utils/llvm.grm
Modified: llvm/trunk/utils/llvm.grm
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/llvm.grm?rev=68053&r1=68052&r2=68053&view=diff
==============================================================================
--- llvm/trunk/utils/llvm.grm (original)
+++ llvm/trunk/utils/llvm.grm Mon Mar 30 14:59:02 2009
@@ -130,9 +130,7 @@
cc EUINT64VAL ;
ParamAttr ::= zeroext
- | zext
| signext
- | sext
| inreg
| sret
| noalias
From gohman at apple.com Mon Mar 30 15:06:29 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 20:06:29 -0000
Subject: [llvm-commits] [llvm] r68054 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp
Message-ID: <200903302006.n2UK6TNa020184@zion.cs.uiuc.edu>
Author: djg
Date: Mon Mar 30 15:06:29 2009
New Revision: 68054
URL: http://llvm.org/viewvc/llvm-project?rev=68054&view=rev
Log:
Constify arguments in isSuccessor and isLayoutSuccessor.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68054&r1=68053&r2=68054&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar 30 15:06:29 2009
@@ -239,14 +239,14 @@
/// isSuccessor - Return true if the specified MBB is a successor of this
/// block.
- bool isSuccessor(MachineBasicBlock *MBB) const;
+ bool isSuccessor(const MachineBasicBlock *MBB) const;
/// isLayoutSuccessor - Return true if the specified MBB will be emitted
/// immediately after this block, such that if this block exits by
/// falling through, control will transfer to the specified MBB. Note
/// that MBB need not be a successor at all, for example if this block
/// ends with an unconditional branch to some other block.
- bool isLayoutSuccessor(MachineBasicBlock *MBB) const;
+ bool isLayoutSuccessor(const MachineBasicBlock *MBB) const;
/// getFirstTerminator - returns an iterator to the first terminator
/// instruction of this basic block. If a terminator does not exist,
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=68054&r1=68053&r2=68054&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Mar 30 15:06:29 2009
@@ -248,13 +248,13 @@
fromMBB->removeSuccessor(fromMBB->succ_begin());
}
-bool MachineBasicBlock::isSuccessor(MachineBasicBlock *MBB) const {
+bool MachineBasicBlock::isSuccessor(const MachineBasicBlock *MBB) const {
std::vector::const_iterator I =
std::find(Successors.begin(), Successors.end(), MBB);
return I != Successors.end();
}
-bool MachineBasicBlock::isLayoutSuccessor(MachineBasicBlock *MBB) const {
+bool MachineBasicBlock::isLayoutSuccessor(const MachineBasicBlock *MBB) const {
MachineFunction::const_iterator I(this);
return next(I) == MachineFunction::const_iterator(MBB);
}
From sabre at nondot.org Mon Mar 30 15:28:50 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 30 Mar 2009 20:28:50 -0000
Subject: [llvm-commits] [llvm] r68055 -
/llvm/trunk/include/llvm/ADT/PointerIntPair.h
Message-ID: <200903302028.n2UKSoAb021308@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Mar 30 15:28:50 2009
New Revision: 68055
URL: http://llvm.org/viewvc/llvm-project?rev=68055&view=rev
Log:
fix the PointerLikeTypeTraits specialization for PointerIntPair to
allow the traits to be specified as well.
Modified:
llvm/trunk/include/llvm/ADT/PointerIntPair.h
Modified: llvm/trunk/include/llvm/ADT/PointerIntPair.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerIntPair.h?rev=68055&r1=68054&r2=68055&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerIntPair.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerIntPair.h Mon Mar 30 15:28:50 2009
@@ -125,8 +125,10 @@
};
// Teach SmallPtrSet that PointerIntPair is "basically a pointer".
-template
-class PointerLikeTypeTraits > {
+template
+class PointerLikeTypeTraits > {
public:
static inline void *
getAsVoidPointer(const PointerIntPair &P) {
From sabre at nondot.org Mon Mar 30 15:29:27 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 30 Mar 2009 20:29:27 -0000
Subject: [llvm-commits] [llvm] r68056 -
/llvm/trunk/include/llvm/ADT/PointerUnion.h
Message-ID: <200903302029.n2UKTSRl021342@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Mar 30 15:29:27 2009
New Revision: 68056
URL: http://llvm.org/viewvc/llvm-project?rev=68056&view=rev
Log:
add a PointerUnion3 class and generalize PointerUnion to work with
anything pointer-like, which may or may not actually be a pointer.
Modified:
llvm/trunk/include/llvm/ADT/PointerUnion.h
Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68056&r1=68055&r2=68056&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Mar 30 15:29:27 2009
@@ -22,12 +22,11 @@
/// getPointerUnionTypeNum - If the argument has type PT1* or PT2* return
/// false or true respectively.
template
- static inline bool getPointerUnionTypeNum(PT1 *P) { return false; }
+ static inline int getPointerUnionTypeNum(PT1 *P) { return 0; }
template
- static inline bool getPointerUnionTypeNum(PT2 *P) { return true; }
- // Enable, if we could use static_assert.
- //template
- //static inline bool getPointerUnionTypeNum(...) { abort() }
+ static inline int getPointerUnionTypeNum(PT2 *P) { return 1; }
+ template
+ static inline int getPointerUnionTypeNum(...) { return -1; }
/// Provide PointerLikeTypeTraits for void* that is used by PointerUnion
@@ -70,22 +69,25 @@
PointerUnion() {}
PointerUnion(PT1 V) {
- Val.setPointer(V);
+ Val.setPointer(PointerLikeTypeTraits::getAsVoidPointer(V));
Val.setInt(0);
}
PointerUnion(PT2 V) {
- Val.setPointer(V);
+ Val.setPointer(PointerLikeTypeTraits::getAsVoidPointer(V));
Val.setInt(1);
}
/// isNull - Return true if the pointer help in the union is null,
/// regardless of which type it is.
bool isNull() const { return Val.getPointer() == 0; }
-
+ operator bool() const { return !isNull(); }
+
/// is() return true if the Union currently holds the type matching T.
template
int is() const {
- return Val.getInt() == ::llvm::getPointerUnionTypeNum((T*)0);
+ int TyNo = ::llvm::getPointerUnionTypeNum((T*)0);
+ assert(TyNo != -1 && "Type query could never succeed on PointerUnion!");
+ return Val.getInt() == TyNo;
}
/// get() - Return the value of the specified pointer type. If the
@@ -93,26 +95,26 @@
template
T get() const {
assert(is() && "Invalid accessor called");
- return static_cast(Val.getPointer());
+ return PointerLikeTypeTraits::getFromVoidPointer(Val.getPointer());
}
/// dyn_cast() - If the current value is of the specified pointer type,
/// return it, otherwise return null.
template
T dyn_cast() const {
- if (is()) return static_cast(Val.getPointer());
+ if (is()) return get();
return T();
}
/// Assignment operators - Allow assigning into this union from either
/// pointer type, setting the discriminator to remember what it came from.
const PointerUnion &operator=(const PT1 &RHS) {
- Val.setPointer(RHS);
+ Val.setPointer(PointerLikeTypeTraits::getAsVoidPointer(RHS));
Val.setInt(0);
return *this;
}
const PointerUnion &operator=(const PT2 &RHS) {
- Val.setPointer(RHS);
+ Val.setPointer(PointerLikeTypeTraits::getAsVoidPointer(RHS));
Val.setInt(1);
return *this;
}
@@ -125,7 +127,7 @@
}
};
- // Teach SmallPtrSet that PointerIntPair is "basically a pointer", that has
+ // Teach SmallPtrSet that PointerUnion is "basically a pointer", that has
// # low bits available = min(PT1bits,PT2bits)-1.
template
class PointerLikeTypeTraits > {
@@ -142,7 +144,110 @@
// The number of bits available are the min of the two pointer types.
enum {
NumLowBitsAvailable =
- PointerUnion::ValTy::NumLowBitsAvailable
+ PointerLikeTypeTraits::ValTy>
+ ::NumLowBitsAvailable
+ };
+ };
+
+
+ /// PointerUnion3 - This is a pointer union of three pointer types. See
+ /// documentation for PointerUnion for usage.
+ template
+ class PointerUnion3 {
+ public:
+ typedef PointerUnion InnerUnion;
+ typedef PointerUnion ValTy;
+ private:
+ ValTy Val;
+ public:
+ PointerUnion3() {}
+
+ PointerUnion3(PT1 V) {
+ Val = InnerUnion(V);
+ }
+ PointerUnion3(PT2 V) {
+ Val = InnerUnion(V);
+ }
+ PointerUnion3(PT3 V) {
+ Val = V;
+ }
+
+ /// isNull - Return true if the pointer help in the union is null,
+ /// regardless of which type it is.
+ bool isNull() const { return Val.isNull(); }
+ operator bool() const { return !isNull(); }
+
+ /// is() return true if the Union currently holds the type matching T.
+ template
+ int is() const {
+ // Is it PT1/PT2?
+ if (::llvm::getPointerUnionTypeNum((T*)0) != -1)
+ return Val.get().is();
+ // Must be PT3 or statically invalid.
+ assert(Val.is());
+ return true;
+ }
+
+ /// get() - Return the value of the specified pointer type. If the
+ /// specified pointer type is incorrect, assert.
+ template
+ T get() const {
+ assert(is() && "Invalid accessor called");
+ if (Val.is())
+ return Val.get();
+ return Val.get().get();
+ }
+
+ /// dyn_cast() - If the current value is of the specified pointer type,
+ /// return it, otherwise return null.
+ template
+ T dyn_cast() const {
+ if (is()) return get();
+ return T();
+ }
+
+ /// Assignment operators - Allow assigning into this union from either
+ /// pointer type, setting the discriminator to remember what it came from.
+ const PointerUnion3 &operator=(const PT1 &RHS) {
+ Val = InnerUnion(RHS);
+ return *this;
+ }
+ const PointerUnion3 &operator=(const PT2 &RHS) {
+ Val = InnerUnion(RHS);
+ return *this;
+ }
+ const PointerUnion3 &operator=(const PT3 &RHS) {
+ Val = RHS;
+ return *this;
+ }
+
+ void *getOpaqueValue() const { return Val.getOpaqueValue(); }
+ static PointerUnion3 getFromOpaqueValue(void *VP) {
+ PointerUnion3 V;
+ V.Val = ValTy::getFromOpaqueValue(VP);
+ return V;
+ }
+ };
+
+ // Teach SmallPtrSet that PointerUnion3 is "basically a pointer", that has
+ // # low bits available = min(PT1bits,PT2bits,PT2bits)-2.
+ template
+ class PointerLikeTypeTraits > {
+ public:
+ static inline void *
+ getAsVoidPointer(const PointerUnion3 &P) {
+ return P.getOpaqueValue();
+ }
+ static inline PointerUnion3
+ getFromVoidPointer(void *P) {
+ return PointerUnion3::getFromOpaqueValue(P);
+ }
+
+ // The number of bits available are the min of the two pointer types.
+ enum {
+ NumLowBitsAvailable =
+ PointerLikeTypeTraits::ValTy>
+ ::NumLowBitsAvailable
};
};
}
From isanbard at gmail.com Mon Mar 30 15:30:02 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 30 Mar 2009 20:30:02 -0000
Subject: [llvm-commits] [llvm] r68057 -
/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
Message-ID: <200903302030.n2UKU2Lb021389@zion.cs.uiuc.edu>
Author: void
Date: Mon Mar 30 15:30:02 2009
New Revision: 68057
URL: http://llvm.org/viewvc/llvm-project?rev=68057&view=rev
Log:
Fix grammar-o in comment.
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=68057&r1=68056&r2=68057&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Mar 30 15:30:02 2009
@@ -1746,7 +1746,7 @@
// vr1024 = op
// = vr1025
// Even though vr1025 is copied from vr1024, it's not safe to
- // coalesced them since live range of vr1025 intersects the
+ // coalesce them since the live range of vr1025 intersects the
// def of vr1024. This happens because vr1025 is assigned the
// value of the previous iteration of vr1024.
return false;
From isanbard at gmail.com Mon Mar 30 15:32:22 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Mon, 30 Mar 2009 20:32:22 -0000
Subject: [llvm-commits] [llvm] r68059 - /llvm/trunk/lib/CodeGen/Spiller.cpp
Message-ID: <200903302032.n2UKWMtq021527@zion.cs.uiuc.edu>
Author: void
Date: Mon Mar 30 15:32:22 2009
New Revision: 68059
URL: http://llvm.org/viewvc/llvm-project?rev=68059&view=rev
Log:
Balance out quote in debug output.
Modified:
llvm/trunk/lib/CodeGen/Spiller.cpp
Modified: llvm/trunk/lib/CodeGen/Spiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.cpp?rev=68059&r1=68058&r2=68059&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/Spiller.cpp Mon Mar 30 15:32:22 2009
@@ -906,7 +906,7 @@
AvailableSpills &Spills, BitVector &RegKills,
std::vector &KillOps) {
DOUT << "\n**** Local spiller rewriting MBB '"
- << MBB.getBasicBlock()->getName() << ":\n";
+ << MBB.getBasicBlock()->getName() << "':\n";
MachineFunction &MF = *MBB.getParent();
From brukman at gmail.com Mon Mar 30 15:34:59 2009
From: brukman at gmail.com (Misha Brukman)
Date: Mon, 30 Mar 2009 16:34:59 -0400
Subject: [llvm-commits] [llvm] r67849 -
/llvm/trunk/test/CodeGen/PowerPC/int-fp-conv-0.ll
In-Reply-To:
References: <200903271617.n2RGHboQ032209@zion.cs.uiuc.edu>
<72C9DC5F-1723-4FEC-B8B5-B57E51201611@apple.com>
Message-ID:
On Mon, Mar 30, 2009 at 3:52 PM, Chris Lattner wrote:
> On Mar 30, 2009, at 11:36 AM, Misha Brukman wrote:
>
> >> @@ -1,4 +1,4 @@
>> >> -; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep store
>> >> +; RUN: llvm-as < %s | llc -march=ppc64 -debug |& not grep {= store}
>> >
>> > I thought that "store" instructions were never assigned to a
>> > variable...
>>
>> This test is grepping through the -debug output of llc, and the stores
>> its
>> looking for do happen to be printed with =.
>>
>> Grepping through -debug output isn't very nice in any case, but at the
>> moment there aren't any better ways to express this specific test.
>>
>
> You can write a unittest to check this. It might require some refactoring
> to be able to run all of LLC's passes separately from running the tool on
> the command line, since they are currently hard-coded in its main()
> function.
>
> I don't think we want unit tests for passes. We only want unit tests for
> low level APIs.
>
Let's drop the term "unit" and just call them tests. I'm proposing we test
passes in C++ instead of a shell script that calls grep.
How else can we check the correctness of a pass, which involves
pattern-matching multiple instructions? Grep can only look at a single line
at a time, and doesn't have the semantic knowledge of what's an instruction
and what's an operand, whereas we have all this information in C++.
This thread also shows how brittle shell scripts are for testing pass
output, which shouldn't be the case for the LLVM C++ API.
Misha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20090330/856c5e86/attachment.html
From sabre at nondot.org Mon Mar 30 15:44:07 2009
From: sabre at nondot.org (Chris Lattner)
Date: Mon, 30 Mar 2009 20:44:07 -0000
Subject: [llvm-commits] [llvm] r68060 -
/llvm/trunk/include/llvm/ADT/PointerUnion.h
Message-ID: <200903302044.n2UKi7td022105@zion.cs.uiuc.edu>
Author: lattner
Date: Mon Mar 30 15:44:04 2009
New Revision: 68060
URL: http://llvm.org/viewvc/llvm-project?rev=68060&view=rev
Log:
update comment.
Modified:
llvm/trunk/include/llvm/ADT/PointerUnion.h
Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68060&r1=68059&r2=68060&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Mar 30 15:44:04 2009
@@ -54,7 +54,7 @@
/// printf("%d %d", P.is(), P.is()); // prints "1 0"
/// X = P.get(); // ok.
/// Y = P.get(); // runtime assertion failure.
- /// Z = P.get(); // does not compile.
+ /// Z = P.get(); // runtime assertion failure (regardless of tag)
/// P = (float*)0;
/// Y = P.get(); // ok.
/// X = P.get(); // runtime assertion failure.
From evan.cheng at apple.com Mon Mar 30 16:34:12 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 30 Mar 2009 21:34:12 -0000
Subject: [llvm-commits] [llvm] r68065 - in /llvm/trunk:
lib/CodeGen/TwoAddressInstructionPass.cpp
test/CodeGen/X86/inline-asm-2addr.ll
Message-ID: <200903302134.n2ULYCoN024377@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Mar 30 16:34:07 2009
New Revision: 68065
URL: http://llvm.org/viewvc/llvm-project?rev=68065&view=rev
Log:
Turn a 2-address instruction into a 3-address one when it's profitable even if the two-address operand is killed.
e.g.
%reg1024 = MOV r1
%reg1025 = ADD %reg1024, %reg1026
r0 = MOV %reg1025
If it's not possible / profitable to commute ADD, then turning ADD into a LEA saves a copy.
Modified:
llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/trunk/test/CodeGen/X86/inline-asm-2addr.ll
Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=68065&r1=68064&r2=68065&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Mar 30 16:34:07 2009
@@ -96,6 +96,13 @@
MachineFunction::iterator &mbbi,
unsigned RegB, unsigned RegC, unsigned Dist);
+ bool isProfitableToConv3Addr(unsigned RegA);
+
+ bool ConvertInstTo3Addr(MachineBasicBlock::iterator &mi,
+ MachineBasicBlock::iterator &nmi,
+ MachineFunction::iterator &mbbi,
+ unsigned RegB, unsigned Dist);
+
void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB,
SmallPtrSet &Processed);
public:
@@ -334,7 +341,9 @@
/// as a two-address use. If so, return the destination register by reference.
static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) {
const TargetInstrDesc &TID = MI.getDesc();
- for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) {
+ unsigned NumOps = (MI.getOpcode() == TargetInstrInfo::INLINEASM)
+ ? MI.getNumOperands() : TID.getNumOperands();
+ for (unsigned i = 0; i != NumOps; ++i) {
const MachineOperand &MO = MI.getOperand(i);
if (!MO.isReg() || !MO.isUse() || MO.getReg() != Reg)
continue;
@@ -503,6 +512,53 @@
return true;
}
+/// isProfitableToConv3Addr - Return true if it is profitable to convert the
+/// given 2-address instruction to a 3-address one.
+bool
+TwoAddressInstructionPass::isProfitableToConv3Addr(unsigned RegA) {
+ // Look for situations like this:
+ // %reg1024 = MOV r1
+ // %reg1025 = MOV r0
+ // %reg1026 = ADD %reg1024, %reg1025
+ // r2 = MOV %reg1026
+ // Turn ADD into a 3-address instruction to avoid a copy.
+ unsigned FromRegA = getMappedReg(RegA, SrcRegMap);
+ unsigned ToRegA = getMappedReg(RegA, DstRegMap);
+ return (FromRegA && ToRegA && !regsAreCompatible(FromRegA, ToRegA, TRI));
+}
+
+/// ConvertInstTo3Addr - Convert the specified two-address instruction into a
+/// three address one. Return true if this transformation was successful.
+bool
+TwoAddressInstructionPass::ConvertInstTo3Addr(MachineBasicBlock::iterator &mi,
+ MachineBasicBlock::iterator &nmi,
+ MachineFunction::iterator &mbbi,
+ unsigned RegB, unsigned Dist) {
+ MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, LV);
+ if (NewMI) {
+ DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
+ DOUT << "2addr: TO 3-ADDR: " << *NewMI;
+ bool Sunk = false;
+
+ if (NewMI->findRegisterUseOperand(RegB, false, TRI))
+ // FIXME: Temporary workaround. If the new instruction doesn't
+ // uses RegB, convertToThreeAddress must have created more
+ // then one instruction.
+ Sunk = Sink3AddrInstruction(mbbi, NewMI, RegB, mi);
+
+ mbbi->erase(mi); // Nuke the old inst.
+
+ if (!Sunk) {
+ DistanceMap.insert(std::make_pair(NewMI, Dist));
+ mi = NewMI;
+ nmi = next(mi);
+ }
+ return true;
+ }
+
+ return false;
+}
+
/// ProcessCopy - If the specified instruction is not yet processed, process it
/// if it's a copy. For a copy instruction, we find the physical registers the
/// source and destination registers might be mapped to. These are kept in
@@ -716,26 +772,7 @@
assert(TID.getOperandConstraint(i, TOI::TIED_TO) == -1);
#endif
- MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, LV);
- if (NewMI) {
- DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
- DOUT << "2addr: TO 3-ADDR: " << *NewMI;
- bool Sunk = false;
-
- if (NewMI->findRegisterUseOperand(regB, false, TRI))
- // FIXME: Temporary workaround. If the new instruction doesn't
- // uses regB, convertToThreeAddress must have created more
- // then one instruction.
- Sunk = Sink3AddrInstruction(mbbi, NewMI, regB, mi);
-
- mbbi->erase(mi); // Nuke the old inst.
-
- if (!Sunk) {
- DistanceMap.insert(std::make_pair(NewMI, Dist));
- mi = NewMI;
- nmi = next(mi);
- }
-
+ if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) {
++NumConvertedTo3Addr;
break; // Done with this instruction.
}
@@ -750,9 +787,19 @@
++NumAggrCommuted;
++NumCommuted;
regB = regC;
+ goto InstructionRearranged;
}
}
+ // If it's profitable to convert the 2-address instruction to a
+ // 3-address one, do so.
+ if (TID.isConvertibleTo3Addr() && isProfitableToConv3Addr(regA)) {
+ if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) {
+ ++NumConvertedTo3Addr;
+ break; // Done with this instruction.
+ }
+ }
+
InstructionRearranged:
const TargetRegisterClass* rc = MRI->getRegClass(regB);
MachineInstr *DefMI = MRI->getVRegDef(regB);
Modified: llvm/trunk/test/CodeGen/X86/inline-asm-2addr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/inline-asm-2addr.ll?rev=68065&r1=68064&r2=68065&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/inline-asm-2addr.ll (original)
+++ llvm/trunk/test/CodeGen/X86/inline-asm-2addr.ll Mon Mar 30 16:34:07 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86-64 | grep movq | count 1
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep movq
define i64 @t(i64 %a, i64 %b) nounwind ssp {
entry:
From evan.cheng at apple.com Mon Mar 30 16:36:48 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Mon, 30 Mar 2009 21:36:48 -0000
Subject: [llvm-commits] [llvm] r68066 - in /llvm/trunk/lib/Target/X86:
X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86Instr64bit.td
X86InstrInfo.td
Message-ID: <200903302136.n2ULanHc024467@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Mar 30 16:36:47 2009
New Revision: 68066
URL: http://llvm.org/viewvc/llvm-project?rev=68066&view=rev
Log:
When optimzing a mul by immediate into two, the resulting mul's should get a x86 specific node to avoid dag combiner from hacking on them further.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.h
llvm/trunk/lib/Target/X86/X86Instr64bit.td
llvm/trunk/lib/Target/X86/X86InstrInfo.td
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=68066&r1=68065&r2=68066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 30 16:36:47 2009
@@ -852,6 +852,7 @@
if (N.getResNo() != 0) break;
// FALL THROUGH
case ISD::MUL:
+ case X86ISD::MUL_IMM:
// X*[3,5,9] -> X+X*[2,4,8]
if (AM.BaseType == X86ISelAddressMode::RegBase &&
AM.Base.Reg.getNode() == 0 &&
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=68066&r1=68065&r2=68066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Mar 30 16:36:47 2009
@@ -7176,6 +7176,7 @@
case X86ISD::UMUL: return "X86ISD::UMUL";
case X86ISD::INC: return "X86ISD::INC";
case X86ISD::DEC: return "X86ISD::DEC";
+ case X86ISD::MUL_IMM: return "X86ISD::MUL_IMM";
}
}
@@ -8458,14 +8459,14 @@
NewMul = DAG.getNode(ISD::SHL, DL, VT, N->getOperand(0),
DAG.getConstant(Log2_64(MulAmt1), MVT::i8));
else
- NewMul = DAG.getNode(ISD::MUL, DL, VT, N->getOperand(0),
+ NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, N->getOperand(0),
DAG.getConstant(MulAmt1, VT));
if (isPowerOf2_64(MulAmt2))
NewMul = DAG.getNode(ISD::SHL, DL, VT, NewMul,
DAG.getConstant(Log2_64(MulAmt2), MVT::i8));
else
- NewMul = DAG.getNode(ISD::MUL, DL, VT, NewMul,
+ NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, NewMul,
DAG.getConstant(MulAmt2, VT));
// Do not add new nodes to DAG combiner worklist.
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=68066&r1=68065&r2=68066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Mar 30 16:36:47 2009
@@ -237,7 +237,10 @@
// ADD, SUB, SMUL, UMUL, etc. - Arithmetic operations with FLAGS results.
ADD, SUB, SMUL, UMUL,
- INC, DEC
+ INC, DEC,
+
+ // MUL_IMM - X86 specific multiply by immediate.
+ MUL_IMM
};
}
Modified: llvm/trunk/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Instr64bit.td?rev=68066&r1=68065&r2=68066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/trunk/lib/Target/X86/X86Instr64bit.td Mon Mar 30 16:36:47 2009
@@ -36,8 +36,8 @@
// Complex Pattern Definitions.
//
def lea64addr : ComplexPattern;
+ [add, mul, X86mul_imm, shl, or, frameindex, X86Wrapper],
+ []>;
//===----------------------------------------------------------------------===//
// Pattern fragments.
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=68066&r1=68065&r2=68066&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Mon Mar 30 16:36:47 2009
@@ -157,6 +157,8 @@
def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>;
def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>;
+def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>;
+
//===----------------------------------------------------------------------===//
// X86 Operand Definitions.
//
From dgregor at apple.com Mon Mar 30 16:44:13 2009
From: dgregor at apple.com (Douglas Gregor)
Date: Mon, 30 Mar 2009 21:44:13 -0000
Subject: [llvm-commits] [llvm] r68067 -
/llvm/trunk/include/llvm/ADT/PointerUnion.h
Message-ID: <200903302144.n2ULiDHC024748@zion.cs.uiuc.edu>
Author: dgregor
Date: Mon Mar 30 16:44:13 2009
New Revision: 68067
URL: http://llvm.org/viewvc/llvm-project?rev=68067&view=rev
Log:
Make PointerUnion3::get work properly
Modified:
llvm/trunk/include/llvm/ADT/PointerUnion.h
Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68067&r1=68066&r2=68067&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Mar 30 16:44:13 2009
@@ -193,9 +193,11 @@
template
T get() const {
assert(is() && "Invalid accessor called");
- if (Val.is())
- return Val.get();
- return Val.get().get();
+ // Is it PT1/PT2?
+ if (::llvm::getPointerUnionTypeNum((T*)0) != -1)
+ return Val.get().get();
+
+ return Val.get();
}
/// dyn_cast() - If the current value is of the specified pointer type,
From dpatel at apple.com Mon Mar 30 17:24:10 2009
From: dpatel at apple.com (Devang Patel)
Date: Mon, 30 Mar 2009 22:24:10 -0000
Subject: [llvm-commits] [llvm] r68071 - in /llvm/trunk:
lib/Transforms/Scalar/LoopIndexSplit.cpp
test/Transforms/LoopIndexSplit/2009-03-30-undef.ll
Message-ID: <200903302224.n2UMOACE026181@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Mar 30 17:24:10 2009
New Revision: 68071
URL: http://llvm.org/viewvc/llvm-project?rev=68071&view=rev
Log:
Loop Index Split can eliminate a loop if it can determin if loop body is executed only once. There was a bug in determining IV based value of the iteration for which the loop body is executed. Fix it.
Added:
llvm/trunk/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=68071&r1=68070&r2=68071&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Mar 30 17:24:10 2009
@@ -48,6 +48,7 @@
#include "llvm/Analysis/Dominators.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Cloning.h"
+#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Support/Compiler.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/Statistic.h"
@@ -345,10 +346,25 @@
if (!L->isLoopInvariant(SplitValue))
return false;
Instruction *OPI = dyn_cast(OPV);
- if (!OPI) return false;
+ if (!OPI)
+ return false;
if (OPI->getParent() != Header || isUsedOutsideLoop(OPI, L))
return false;
-
+ Value *StartValue = IVStartValue;
+ Value *ExitValue = IVExitValue;;
+
+ if (OPV != IndVar) {
+ // If BR operand is IV based then use this operand to calculate
+ // effective conditions for loop body.
+ BinaryOperator *BOPV = dyn_cast(OPV);
+ if (!BOPV)
+ return false;
+ if (BOPV->getOpcode() != Instruction::Add)
+ return false;
+ StartValue = BinaryOperator::CreateAdd(OPV, StartValue, "" , BR);
+ ExitValue = BinaryOperator::CreateAdd(OPV, ExitValue, "" , BR);
+ }
+
if (!cleanBlock(Header))
return false;
@@ -399,13 +415,13 @@
// and i32 c1, c2
Instruction *C1 = new ICmpInst(ExitCondition->isSignedPredicate() ?
ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE,
- SplitValue, IVStartValue, "lisplit", BR);
+ SplitValue, StartValue, "lisplit", BR);
CmpInst::Predicate C2P = ExitCondition->getPredicate();
BranchInst *LatchBR = cast(Latch->getTerminator());
if (LatchBR->getOperand(0) != Header)
C2P = CmpInst::getInversePredicate(C2P);
- Instruction *C2 = new ICmpInst(C2P, SplitValue, IVExitValue, "lisplit", BR);
+ Instruction *C2 = new ICmpInst(C2P, SplitValue, ExitValue, "lisplit", BR);
Instruction *NSplitCond = BinaryOperator::CreateAnd(C1, C2, "lisplit", BR);
SplitCondition->replaceAllUsesWith(NSplitCond);
@@ -419,11 +435,11 @@
if (Header != *SI)
LatchSucc = *SI;
}
- LatchBR->setUnconditionalDest(LatchSucc);
- // Remove IVIncrement
- IVIncrement->replaceAllUsesWith(UndefValue::get(IVIncrement->getType()));
- IVIncrement->eraseFromParent();
+ // Clean up latch block.
+ Value *LatchBRCond = LatchBR->getCondition();
+ LatchBR->setUnconditionalDest(LatchSucc);
+ RecursivelyDeleteTriviallyDeadInstructions(LatchBRCond);
LPM->deleteLoopFromQueue(L);
Added: llvm/trunk/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll?rev=68071&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll (added)
+++ llvm/trunk/test/Transforms/LoopIndexSplit/2009-03-30-undef.ll Mon Mar 30 17:24:10 2009
@@ -0,0 +1,24 @@
+; RUN: llvm-as < %s | opt -loop-index-split | llvm-dis | not grep undef
+define i32 @main() {
+entry:
+ br label %header
+
+header:
+ %r = phi i32 [ 0, %entry ], [ %r3, %skip ]
+ %i = phi i32 [ 0, %entry ], [ %i1, %skip ]
+ %i99 = add i32 %i, 99
+ %cond = icmp eq i32 %i99, 3
+ br i1 %cond, label %body, label %skip
+
+body:
+ br label %skip
+
+skip:
+ %r3 = phi i32 [ %r, %header ], [ 3, %body ]
+ %i1 = add i32 %i, 1
+ %exitcond = icmp eq i32 %i1, 10
+ br i1 %exitcond, label %exit, label %header
+
+exit:
+ ret i32 %r3
+}
From gohman at apple.com Mon Mar 30 17:55:18 2009
From: gohman at apple.com (Dan Gohman)
Date: Mon, 30 Mar 2009 22:55:18 -0000
Subject: [llvm-commits] [llvm] r68073 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903302255.n2UMtIQc027270@zion.cs.uiuc.edu>
Author: djg
Date: Mon Mar 30 17:55:17 2009
New Revision: 68073
URL: http://llvm.org/viewvc/llvm-project?rev=68073&view=rev
Log:
Except in asm-verbose mode, avoid printing labels for blocks that are
only reachable via fall-through edges. This dramatically reduces the
number of labels printed, and thus also the number of labels the
assembler must parse and remember.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68073&r1=68072&r2=68073&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar 30 17:55:17 2009
@@ -253,6 +253,15 @@
/// it returns end()
iterator getFirstTerminator();
+ /// isOnlyReachableViaFallthough - Return true if this basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ bool isOnlyReachableByFallthrough() const {
+ return !pred_empty() &&
+ next(pred_begin()) == pred_end() &&
+ (*pred_begin())->getFirstTerminator() == (*pred_begin())->end();
+ }
+
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68073&r1=68072&r2=68073&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon Mar 30 17:55:17 2009
@@ -238,7 +238,12 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!I->pred_empty()) {
+ if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
+ // This is an entry block or a block that's only reachable via a
+ // fallthrough edge. In non-VerboseAsm mode, don't print the label.
+ assert((I->pred_empty() || (*I->pred_begin())->isLayoutSuccessor(I)) &&
+ "Fall-through predecessor not adjacent to its successor!");
+ } else {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From dgregor at apple.com Mon Mar 30 19:34:32 2009
From: dgregor at apple.com (Douglas Gregor)
Date: Tue, 31 Mar 2009 00:34:32 -0000
Subject: [llvm-commits] [llvm] r68079 -
/llvm/trunk/include/llvm/ADT/PointerUnion.h
Message-ID: <200903310034.n2V0YWRB031269@zion.cs.uiuc.edu>
Author: dgregor
Date: Mon Mar 30 19:34:31 2009
New Revision: 68079
URL: http://llvm.org/viewvc/llvm-project?rev=68079&view=rev
Log:
Really, really fix PointerUnion3::is
Modified:
llvm/trunk/include/llvm/ADT/PointerUnion.h
Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68079&r1=68078&r2=68079&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Mar 30 19:34:31 2009
@@ -182,7 +182,7 @@
int is() const {
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum((T*)0) != -1)
- return Val.get().is();
+ return Val.is() && Val.get().is();
// Must be PT3 or statically invalid.
assert(Val.is());
return true;
From stuart at apple.com Mon Mar 30 19:39:26 2009
From: stuart at apple.com (Stuart Hastings)
Date: Tue, 31 Mar 2009 00:39:26 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r68080 -
/llvm-gcc-4.2/trunk/gcc/config/darwin.c
Message-ID: <200903310039.n2V0dQmO031458@zion.cs.uiuc.edu>
Author: stuart
Date: Mon Mar 30 19:39:25 2009
New Revision: 68080
URL: http://llvm.org/viewvc/llvm-project?rev=68080&view=rev
Log:
Move ObjC CFString objects to a writable __DATA section under -fwritable-strings.
Modified:
llvm-gcc-4.2/trunk/gcc/config/darwin.c
Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=68080&r1=68079&r2=68080&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Mon Mar 30 19:39:25 2009
@@ -1760,7 +1760,11 @@
else
return "__OBJC, __string_object,no_dead_strip";
} else if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_CFString")) {
- return "__DATA, __cfstring";
+ return
+#ifdef LLVM_CONST_DATA_SECTION
+ (flag_writable_strings) ? LLVM_CONST_DATA_SECTION :
+#endif
+ "__DATA, __cfstring";
} else {
return 0;
}
From evan.cheng at apple.com Mon Mar 30 20:13:54 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 31 Mar 2009 01:13:54 -0000
Subject: [llvm-commits] [llvm] r68082 -
/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Message-ID: <200903310113.n2V1DsSl032730@zion.cs.uiuc.edu>
Author: evancheng
Date: Mon Mar 30 20:13:53 2009
New Revision: 68082
URL: http://llvm.org/viewvc/llvm-project?rev=68082&view=rev
Log:
X86 address mode isel tweak. If the base of the address is also used by a CopyToReg (i.e. it's likely live-out), do not fold the sub-expressions into the addressing mode to avoid computing the address twice. The CopyToReg use will be isel'ed to a LEA, re-use it for address instead.
This is not yet enabled.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=68082&r1=68081&r2=68082&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Mar 30 20:13:53 2009
@@ -41,6 +41,9 @@
#include "llvm/ADT/Statistic.h"
using namespace llvm;
+#include "llvm/Support/CommandLine.h"
+static cl::opt AvoidDupAddrCompute("x86-avoid-dup-address", cl::Hidden);
+
STATISTIC(NumLoadMoved, "Number of loads moved below TokenFactor");
//===----------------------------------------------------------------------===//
@@ -1035,7 +1038,28 @@
SDValue &Scale, SDValue &Index,
SDValue &Disp) {
X86ISelAddressMode AM;
- if (MatchAddress(N, AM))
+ bool Done = false;
+ if (AvoidDupAddrCompute && !N.hasOneUse()) {
+ unsigned Opcode = N.getOpcode();
+ if (Opcode != ISD::Constant && Opcode != ISD::FrameIndex &&
+ Opcode != X86ISD::Wrapper) {
+ // If we are able to fold N into addressing mode, then we'll allow it even
+ // if N has multiple uses. In general, addressing computation is used as
+ // addresses by all of its uses. But watch out for CopyToReg uses, that
+ // means the address computation is liveout. It will be computed by a LEA
+ // so we want to avoid computing the address twice.
+ for (SDNode::use_iterator UI = N.getNode()->use_begin(),
+ UE = N.getNode()->use_end(); UI != UE; ++UI) {
+ if (UI->getOpcode() == ISD::CopyToReg) {
+ MatchAddressBase(N, AM, true, 0);
+ Done = true;
+ break;
+ }
+ }
+ }
+ }
+
+ if (!Done && MatchAddress(N, AM))
return false;
MVT VT = N.getValueType();
From gohman at apple.com Mon Mar 30 20:38:29 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 01:38:29 -0000
Subject: [llvm-commits] [llvm] r68083 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
test/CodeGen/X86/live-out-reg-info.ll
Message-ID: <200903310138.n2V1cTe2001172@zion.cs.uiuc.edu>
Author: djg
Date: Mon Mar 30 20:38:29 2009
New Revision: 68083
URL: http://llvm.org/viewvc/llvm-project?rev=68083&view=rev
Log:
Fix live-out reg logic to not insert over-aggressive AssertZExt
instructions. This fixes lua.
Added:
llvm/trunk/test/CodeGen/X86/live-out-reg-info.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=68083&r1=68082&r2=68083&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Mon Mar 30 20:38:29 2009
@@ -4587,15 +4587,15 @@
isSExt = false, FromVT = MVT::i1; // ASSERT ZEXT 1
else if (NumSignBits > RegSize-8)
isSExt = true, FromVT = MVT::i8; // ASSERT SEXT 8
- else if (NumZeroBits >= RegSize-9)
+ else if (NumZeroBits >= RegSize-8)
isSExt = false, FromVT = MVT::i8; // ASSERT ZEXT 8
else if (NumSignBits > RegSize-16)
isSExt = true, FromVT = MVT::i16; // ASSERT SEXT 16
- else if (NumZeroBits >= RegSize-17)
+ else if (NumZeroBits >= RegSize-16)
isSExt = false, FromVT = MVT::i16; // ASSERT ZEXT 16
else if (NumSignBits > RegSize-32)
isSExt = true, FromVT = MVT::i32; // ASSERT SEXT 32
- else if (NumZeroBits >= RegSize-33)
+ else if (NumZeroBits >= RegSize-32)
isSExt = false, FromVT = MVT::i32; // ASSERT ZEXT 32
if (FromVT != MVT::Other) {
Added: llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll?rev=68083&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll (added)
+++ llvm/trunk/test/CodeGen/X86/live-out-reg-info.ll Mon Mar 30 20:38:29 2009
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep testl
+
+; Make sure dagcombine doesn't eliminate the comparison due
+; to an off-by-one bug with ComputeMaskedBits information.
+
+declare void @qux()
+
+define void @foo(i32 %a) {
+ %t0 = lshr i32 %a, 23
+ br label %next
+next:
+ %t1 = and i32 %t0, 256
+ %t2 = icmp eq i32 %t1, 0
+ br i1 %t2, label %true, label %false
+true:
+ call void @qux()
+ ret void
+false:
+ ret void
+}
From clattner at apple.com Mon Mar 30 20:38:50 2009
From: clattner at apple.com (Chris Lattner)
Date: Mon, 30 Mar 2009 18:38:50 -0700
Subject: [llvm-commits] [llvm] r68082 -
/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
In-Reply-To: <200903310113.n2V1DsSl032730@zion.cs.uiuc.edu>
References: <200903310113.n2V1DsSl032730@zion.cs.uiuc.edu>
Message-ID:
On Mar 30, 2009, at 6:13 PM, Evan Cheng wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=68082&view=rev
> Log:
> X86 address mode isel tweak. If the base of the address is also used
> by a CopyToReg (i.e. it's likely live-out), do not fold the sub-
> expressions into the addressing mode to avoid computing the address
> twice. The CopyToReg use will be isel'ed to a LEA, re-use it for
> address instead.
Ok.
> + for (SDNode::use_iterator UI = N.getNode()->use_begin(),
> + UE = N.getNode()->use_end(); UI != UE; ++UI) {
> + if (UI->getOpcode() == ISD::CopyToReg) {
How about turning this into a "isUsedByCopyToRegNode" predicate?
-Chris
From sabre at nondot.org Tue Mar 31 02:25:23 2009
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 31 Mar 2009 07:25:23 -0000
Subject: [llvm-commits] [llvm] r68087 - /llvm/trunk/include/llvm/Value.h
Message-ID: <200903310725.n2V7PNdu012239@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Mar 31 02:25:22 2009
New Revision: 68087
URL: http://llvm.org/viewvc/llvm-project?rev=68087&view=rev
Log:
shrink subclassid, liberating some bits for future (ab)use.
Modified:
llvm/trunk/include/llvm/Value.h
Modified: llvm/trunk/include/llvm/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=68087&r1=68086&r2=68087&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Value.h (original)
+++ llvm/trunk/include/llvm/Value.h Tue Mar 31 02:25:22 2009
@@ -53,7 +53,7 @@
/// using this Value.
/// @brief LLVM Value Representation
class Value {
- const unsigned short SubclassID; // Subclass identifier (for isa/dyn_cast)
+ const unsigned char SubclassID; // Subclass identifier (for isa/dyn_cast)
protected:
/// SubclassData - This member is defined by this class, but is not used for
/// anything. Subclasses can use it to hold whatever state they find useful.
From isanbard at gmail.com Tue Mar 31 03:00:31 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:00:31 -0000
Subject: [llvm-commits] [llvm] r68089 - in
/llvm/branches/Apple/Dib/lib/Target/X86: X86ISelDAGToDAG.cpp
X86ISelLowering.cpp X86ISelLowering.h X86Instr64bit.td X86InstrInfo.td
Message-ID: <200903310800.n2V80XWF019395@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:00:28 2009
New Revision: 68089
URL: http://llvm.org/viewvc/llvm-project?rev=68089&view=rev
Log:
--- Merging (from foreign repository) r68066 into '.':
U lib/Target/X86/X86Instr64bit.td
U lib/Target/X86/X86InstrInfo.td
U lib/Target/X86/X86ISelLowering.cpp
U lib/Target/X86/X86ISelDAGToDAG.cpp
U lib/Target/X86/X86ISelLowering.h
When optimzing a mul by immediate into two, the resulting mul's should get a x86
specific node to avoid dag combiner from hacking on them further.
Modified:
llvm/branches/Apple/Dib/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h
llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td
llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=68089&r1=68088&r2=68089&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Mar 31 03:00:28 2009
@@ -852,6 +852,7 @@
if (N.getResNo() != 0) break;
// FALL THROUGH
case ISD::MUL:
+ case X86ISD::MUL_IMM:
// X*[3,5,9] -> X+X*[2,4,8]
if (AM.BaseType == X86ISelAddressMode::RegBase &&
AM.Base.Reg.getNode() == 0 &&
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=68089&r1=68088&r2=68089&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Tue Mar 31 03:00:28 2009
@@ -7176,6 +7176,7 @@
case X86ISD::UMUL: return "X86ISD::UMUL";
case X86ISD::INC: return "X86ISD::INC";
case X86ISD::DEC: return "X86ISD::DEC";
+ case X86ISD::MUL_IMM: return "X86ISD::MUL_IMM";
}
}
@@ -8451,14 +8452,14 @@
NewMul = DAG.getNode(ISD::SHL, DL, VT, N->getOperand(0),
DAG.getConstant(Log2_64(MulAmt1), MVT::i8));
else
- NewMul = DAG.getNode(ISD::MUL, DL, VT, N->getOperand(0),
+ NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, N->getOperand(0),
DAG.getConstant(MulAmt1, VT));
if (isPowerOf2_64(MulAmt2))
NewMul = DAG.getNode(ISD::SHL, DL, VT, NewMul,
DAG.getConstant(Log2_64(MulAmt2), MVT::i8));
else
- NewMul = DAG.getNode(ISD::MUL, DL, VT, NewMul,
+ NewMul = DAG.getNode(X86ISD::MUL_IMM, DL, VT, NewMul,
DAG.getConstant(MulAmt2, VT));
// Do not add new nodes to DAG combiner worklist.
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h?rev=68089&r1=68088&r2=68089&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.h Tue Mar 31 03:00:28 2009
@@ -237,7 +237,10 @@
// ADD, SUB, SMUL, UMUL, etc. - Arithmetic operations with FLAGS results.
ADD, SUB, SMUL, UMUL,
- INC, DEC
+ INC, DEC,
+
+ // MUL_IMM - X86 specific multiply by immediate.
+ MUL_IMM
};
}
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td?rev=68089&r1=68088&r2=68089&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86Instr64bit.td Tue Mar 31 03:00:28 2009
@@ -36,8 +36,8 @@
// Complex Pattern Definitions.
//
def lea64addr : ComplexPattern;
+ [add, mul, X86mul_imm, shl, or, frameindex, X86Wrapper],
+ []>;
//===----------------------------------------------------------------------===//
// Pattern fragments.
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td?rev=68089&r1=68088&r2=68089&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86InstrInfo.td Tue Mar 31 03:00:28 2009
@@ -157,6 +157,8 @@
def X86inc_flag : SDNode<"X86ISD::INC", SDTUnaryArithWithFlags>;
def X86dec_flag : SDNode<"X86ISD::DEC", SDTUnaryArithWithFlags>;
+def X86mul_imm : SDNode<"X86ISD::MUL_IMM", SDTIntBinOp>;
+
//===----------------------------------------------------------------------===//
// X86 Operand Definitions.
//
From isanbard at gmail.com Tue Mar 31 03:01:04 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:01:04 -0000
Subject: [llvm-commits] [llvm] r68090 -
/llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp
Message-ID: <200903310801.n2V81431019482@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:01:04 2009
New Revision: 68090
URL: http://llvm.org/viewvc/llvm-project?rev=68090&view=rev
Log:
--- Merging (from foreign repository) r68047 into '.':
U lib/Analysis/AliasSetTracker.cpp
getEntryFor() may invalidate DenseMap iterator.
Walking an invalidated iterator is not a good idea.
Modified:
llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp
Modified: llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp?rev=68090&r1=68089&r2=68090&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Analysis/AliasSetTracker.cpp Tue Mar 31 03:01:04 2009
@@ -520,6 +520,7 @@
if (Entry.hasAliasSet()) return; // Already in the tracker!
// Add it to the alias set it aliases...
+ I = PointerMap.find(From);
AliasSet *AS = I->second->getAliasSet(*this);
AS->addPointer(*this, Entry, I->second->getSize(), true);
}
From isanbard at gmail.com Tue Mar 31 03:26:28 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:26:28 -0000
Subject: [llvm-commits] [llvm] r68092 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/Spiller.cpp
lib/CodeGen/Spiller.h lib/CodeGen/VirtRegMap.cpp lib/CodeGen/VirtRegMap.h
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903310826.n2V8QTqd024503@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:26:26 2009
New Revision: 68092
URL: http://llvm.org/viewvc/llvm-project?rev=68092&view=rev
Log:
Revert r68073. It's causing a failure in the Apple-style builds.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/CodeGen/Spiller.cpp
llvm/trunk/lib/CodeGen/Spiller.h
llvm/trunk/lib/CodeGen/VirtRegMap.cpp
llvm/trunk/lib/CodeGen/VirtRegMap.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 03:26:26 2009
@@ -253,15 +253,6 @@
/// it returns end()
iterator getFirstTerminator();
- /// isOnlyReachableViaFallthough - Return true if this basic block has
- /// exactly one predecessor and the control transfer mechanism between
- /// the predecessor and this block is a fall-through.
- bool isOnlyReachableByFallthrough() const {
- return !pred_empty() &&
- next(pred_begin()) == pred_end() &&
- (*pred_begin())->getFirstTerminator() == (*pred_begin())->end();
- }
-
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/trunk/lib/CodeGen/Spiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.cpp?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/Spiller.cpp Tue Mar 31 03:26:26 2009
@@ -578,6 +578,20 @@
DOUT << "**** Post Machine Instrs ****\n";
DEBUG(MF.dump());
+ // See if any of the spills we added are actually dead and can be deleted.
+ for (std::vector >::iterator
+ I = AddedSpills.begin(), E = AddedSpills.end(); I != E; ++I) {
+ MachineInstr *MI = *I;
+
+ if (VRM.OnlyUseOfStackSlot(MI)) {
+ MachineBasicBlock *MBB = MI->getParent();
+ DOUT << "Removed dead store:\t" << *MI;
+ VRM.RemoveMachineInstrFromMaps(MI);
+ MBB->erase(MI);
+ ++NumDSE;
+ }
+ }
+
// Mark unused spill slots.
MachineFrameInfo *MFI = MF.getFrameInfo();
int SS = VRM.getLowSpillSlot();
@@ -588,6 +602,7 @@
++NumDSS;
}
+ AddedSpills.clear();
return true;
}
@@ -798,9 +813,50 @@
return false;
}
+void LocalSpiller::RemoveDeadStore(MachineInstr *Store,
+ MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator &MII,
+ SmallSet &ReMatDefs,
+ BitVector &RegKills,
+ std::vector &KillOps,
+ VirtRegMap &VRM) {
+ // If there is a dead store to this stack slot, nuke it now.
+ DOUT << "Removed dead store:\t" << *Store;
+ ++NumDSE;
+ SmallVector KillRegs;
+ InvalidateKills(*Store, RegKills, KillOps, &KillRegs);
+
+ MachineBasicBlock::iterator PrevMII = Store;
+ bool CheckDef = PrevMII != MBB.begin();
+ if (CheckDef) --PrevMII;
+
+ VRM.RemoveMachineInstrFromMaps(Store);
+ MBB.erase(Store);
+
+ if (CheckDef) {
+ // Look at defs of killed registers on the store. Mark the defs as dead
+ // since the store has been deleted and they aren't being reused.
+ for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) {
+ bool HasOtherDef = false;
+
+ if (InvalidateRegDef(PrevMII, *MII, KillRegs[j], HasOtherDef)) {
+ MachineInstr *DeadDef = PrevMII;
+
+ if (ReMatDefs.count(DeadDef) && !HasOtherDef) {
+ // FIXME: This assumes a remat def does not have side effects.
+ VRM.RemoveMachineInstrFromMaps(DeadDef);
+ MBB.erase(DeadDef);
+ ++NumDRM;
+ }
+ }
+ }
+ }
+}
+
/// SpillRegToStackSlot - Spill a register to a specified stack slot. Check if
/// the last store to the same slot is now dead. If so, remove the last store.
-void LocalSpiller::SpillRegToStackSlot(MachineBasicBlock &MBB,
+void
+LocalSpiller::SpillRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &MII,
int Idx, unsigned PhysReg, int StackSlot,
const TargetRegisterClass *RC,
@@ -816,36 +872,8 @@
DOUT << "Store:\t" << *StoreMI;
// If there is a dead store to this stack slot, nuke it now.
- if (LastStore) {
- DOUT << "Removed dead store:\t" << *LastStore;
- ++NumDSE;
- SmallVector KillRegs;
- InvalidateKills(*LastStore, RegKills, KillOps, &KillRegs);
- MachineBasicBlock::iterator PrevMII = LastStore;
- bool CheckDef = PrevMII != MBB.begin();
- if (CheckDef)
- --PrevMII;
- VRM.RemoveMachineInstrFromMaps(LastStore);
- MBB.erase(LastStore);
- if (CheckDef) {
- // Look at defs of killed registers on the store. Mark the defs
- // as dead since the store has been deleted and they aren't
- // being reused.
- for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) {
- bool HasOtherDef = false;
- if (InvalidateRegDef(PrevMII, *MII, KillRegs[j], HasOtherDef)) {
- MachineInstr *DeadDef = PrevMII;
- if (ReMatDefs.count(DeadDef) && !HasOtherDef) {
- // FIXME: This assumes a remat def does not have side
- // effects.
- VRM.RemoveMachineInstrFromMaps(DeadDef);
- MBB.erase(DeadDef);
- ++NumDRM;
- }
- }
- }
- }
- }
+ if (LastStore)
+ RemoveDeadStore(LastStore, MBB, MII, ReMatDefs, RegKills, KillOps, VRM);
LastStore = next(MII);
@@ -1060,6 +1088,7 @@
if (VRM.isSpillPt(&MI)) {
std::vector > &SpillRegs =
VRM.getSpillPtSpills(&MI);
+
for (unsigned i = 0, e = SpillRegs.size(); i != e; ++i) {
unsigned VirtReg = SpillRegs[i].first;
bool isKill = SpillRegs[i].second;
@@ -1073,7 +1102,9 @@
VRM.addSpillSlotUse(StackSlot, StoreMI);
DOUT << "Store:\t" << *StoreMI;
VRM.virtFolded(VirtReg, StoreMI, VirtRegMap::isMod);
+ AddedSpills.push_back(StoreMI);
}
+
NextMII = next(MII);
}
Modified: llvm/trunk/lib/CodeGen/Spiller.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.h?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.h (original)
+++ llvm/trunk/lib/CodeGen/Spiller.h Tue Mar 31 03:26:26 2009
@@ -285,6 +285,7 @@
const TargetRegisterInfo *TRI;
const TargetInstrInfo *TII;
DenseMap DistanceMap;
+ std::vector AddedSpills;
public:
bool runOnMachineFunction(MachineFunction &MF, VirtRegMap &VRM);
private:
@@ -305,6 +306,14 @@
std::vector &KillOps,
const TargetRegisterInfo *TRI,
VirtRegMap &VRM);
+ void RemoveDeadStore(MachineInstr *Store,
+ MachineBasicBlock &MBB,
+ MachineBasicBlock::iterator &MII,
+ SmallSet &ReMatDefs,
+ BitVector &RegKills,
+ std::vector &KillOps,
+ VirtRegMap &VRM);
+
void SpillRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &MII,
int Idx, unsigned PhysReg, int StackSlot,
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Mar 31 03:26:26 2009
@@ -188,7 +188,7 @@
if (MF->getFrameInfo()->isFixedObjectIndex(FI))
continue;
// This stack reference was produced by instruction selection and
- // is not a spill
+ // is not a spill.
if (FI < LowSpillSlot)
continue;
assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size()
@@ -201,6 +201,27 @@
EmergencySpillMap.erase(MI);
}
+bool VirtRegMap::OnlyUseOfStackSlot(const MachineInstr *MI) const {
+ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
+ const MachineOperand &MO = MI->getOperand(i);
+ if (!MO.isFI())
+ continue;
+ int FI = MO.getIndex();
+ if (MF->getFrameInfo()->isFixedObjectIndex(FI))
+ continue;
+ // This stack reference was produced by instruction selection and
+ // is not a spill.
+ if (FI < LowSpillSlot)
+ continue;
+ assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size()
+ && "Invalid spill slot");
+ if (SpillSlotToUsesMap[FI - LowSpillSlot].size() != 1)
+ return false;
+ }
+
+ return true;
+}
+
void VirtRegMap::print(std::ostream &OS, const Module* M) const {
const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo();
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.h?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.h (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.h Tue Mar 31 03:26:26 2009
@@ -430,6 +430,8 @@
/// the folded instruction map and spill point map.
void RemoveMachineInstrFromMaps(MachineInstr *MI);
+ bool OnlyUseOfStackSlot(const MachineInstr *MI) const;
+
void print(std::ostream &OS, const Module* M = 0) const;
void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68092&r1=68091&r2=68092&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 03:26:26 2009
@@ -238,12 +238,7 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
- // This is an entry block or a block that's only reachable via a
- // fallthrough edge. In non-VerboseAsm mode, don't print the label.
- assert((I->pred_empty() || (*I->pred_begin())->isLayoutSuccessor(I)) &&
- "Fall-through predecessor not adjacent to its successor!");
- } else {
+ if (!I->pred_empty()) {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From isanbard at gmail.com Tue Mar 31 03:27:00 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 01:27:00 -0700
Subject: [llvm-commits] [llvm] r68073 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
In-Reply-To: <200903302255.n2UMtIQc027270@zion.cs.uiuc.edu>
References: <200903302255.n2UMtIQc027270@zion.cs.uiuc.edu>
Message-ID:
Dan,
This is causing a failure in the Apple-style builds. I had to revert
it. Please take a look. Thanks!
http://blamebot.apple.com:8020/builders/full-llvm-OSX/builds/982/steps/shell/logs/stdio
-bw
On Mar 30, 2009, at 3:55 PM, Dan Gohman wrote:
> Author: djg
> Date: Mon Mar 30 17:55:17 2009
> New Revision: 68073
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68073&view=rev
> Log:
> Except in asm-verbose mode, avoid printing labels for blocks that are
> only reachable via fall-through edges. This dramatically reduces the
> number of labels printed, and thus also the number of labels the
> assembler must parse and remember.
>
> Modified:
> llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
> llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68073&r1=68072&r2=68073&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Mon Mar 30
> 17:55:17 2009
> @@ -253,6 +253,15 @@
> /// it returns end()
> iterator getFirstTerminator();
>
> + /// isOnlyReachableViaFallthough - Return true if this basic
> block has
> + /// exactly one predecessor and the control transfer mechanism
> between
> + /// the predecessor and this block is a fall-through.
> + bool isOnlyReachableByFallthrough() const {
> + return !pred_empty() &&
> + next(pred_begin()) == pred_end() &&
> + (*pred_begin())->getFirstTerminator() == (*pred_begin())-
> >end();
> + }
> +
> void pop_front() { Insts.pop_front(); }
> void pop_back() { Insts.pop_back(); }
> void push_back(MachineInstr *MI) { Insts.push_back(MI); }
>
> Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68073&r1=68072&r2=68073&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
> (original)
> +++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Mon
> Mar 30 17:55:17 2009
> @@ -238,7 +238,12 @@
> for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
> I != E; ++I) {
> // Print a label for the basic block.
> - if (!I->pred_empty()) {
> + if (!VerboseAsm && (I->pred_empty() || I-
> >isOnlyReachableByFallthrough())) {
> + // This is an entry block or a block that's only reachable
> via a
> + // fallthrough edge. In non-VerboseAsm mode, don't print the
> label.
> + assert((I->pred_empty() || (*I->pred_begin())-
> >isLayoutSuccessor(I)) &&
> + "Fall-through predecessor not adjacent to its
> successor!");
> + } else {
> printBasicBlockLabel(I, true, true, VerboseAsm);
> O << '\n';
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
From resistor at mac.com Tue Mar 31 03:27:10 2009
From: resistor at mac.com (Owen Anderson)
Date: Tue, 31 Mar 2009 08:27:10 -0000
Subject: [llvm-commits] [llvm] r68093 - in /llvm/trunk:
lib/CodeGen/PreAllocSplitting.cpp test/CodeGen/X86/pre-split4.ll
Message-ID: <200903310827.n2V8RAq0024636@zion.cs.uiuc.edu>
Author: resistor
Date: Tue Mar 31 03:27:09 2009
New Revision: 68093
URL: http://llvm.org/viewvc/llvm-project?rev=68093&view=rev
Log:
Remove the "fast" cases for spill and restore point determination, as these were subtlely wrong in obscure cases. Patch the testcase
to account for this change.
Modified:
llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
llvm/trunk/test/CodeGen/X86/pre-split4.ll
Modified: llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp?rev=68093&r1=68092&r2=68093&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp (original)
+++ llvm/trunk/lib/CodeGen/PreAllocSplitting.cpp Tue Mar 31 03:27:09 2009
@@ -232,68 +232,38 @@
unsigned &SpillIndex) {
MachineBasicBlock::iterator Pt = MBB->begin();
- // Go top down if RefsInMBB is empty.
- if (RefsInMBB.empty() && !DefMI) {
- MachineBasicBlock::iterator MII = MBB->begin();
- MachineBasicBlock::iterator EndPt = MI;
-
- if (MII == EndPt) return Pt;
-
- do {
- ++MII;
- unsigned Index = LIs->getInstructionIndex(MII);
- unsigned Gap = LIs->findGapBeforeInstr(Index);
-
- // We can't insert the spill between the barrier (a call), and its
- // corresponding call frame setup/teardown.
- if (prior(MII)->getOpcode() == TRI->getCallFrameSetupOpcode()) {
- bool reachedBarrier = false;
- do {
- if (MII == EndPt) {
- reachedBarrier = true;
- break;
- }
- ++MII;
- } while (MII->getOpcode() != TRI->getCallFrameDestroyOpcode());
-
- if (reachedBarrier) break;
- } else if (Gap) {
- Pt = MII;
- SpillIndex = Gap;
- break;
- }
- } while (MII != EndPt);
- } else {
- MachineBasicBlock::iterator MII = MI;
- MachineBasicBlock::iterator EndPt = DefMI
- ? MachineBasicBlock::iterator(DefMI) : MBB->begin();
+ MachineBasicBlock::iterator MII = MI;
+ MachineBasicBlock::iterator EndPt = DefMI
+ ? MachineBasicBlock::iterator(DefMI) : MBB->begin();
- while (MII != EndPt && !RefsInMBB.count(MII)) {
- unsigned Index = LIs->getInstructionIndex(MII);
-
- // We can't insert the spill between the barrier (a call), and its
- // corresponding call frame setup.
- if (prior(MII)->getOpcode() == TRI->getCallFrameSetupOpcode()) {
+ while (MII != EndPt && !RefsInMBB.count(MII) &&
+ MII->getOpcode() != TRI->getCallFrameSetupOpcode())
+ --MII;
+ if (MII == EndPt || RefsInMBB.count(MII)) return Pt;
+
+ while (MII != EndPt && !RefsInMBB.count(MII)) {
+ unsigned Index = LIs->getInstructionIndex(MII);
+
+ // We can't insert the spill between the barrier (a call), and its
+ // corresponding call frame setup.
+ if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode()) {
+ while (MII->getOpcode() != TRI->getCallFrameSetupOpcode()) {
--MII;
- continue;
- } if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode()) {
- bool reachedBarrier = false;
- while (MII->getOpcode() != TRI->getCallFrameSetupOpcode()) {
- --MII;
- if (MII == EndPt) {
- reachedBarrier = true;
- break;
- }
+ if (MII == EndPt) {
+ return Pt;
}
-
- if (reachedBarrier) break;
- else continue;
- } else if (LIs->hasGapBeforeInstr(Index)) {
- Pt = MII;
- SpillIndex = LIs->findGapBeforeInstr(Index, true);
}
- --MII;
+ continue;
+ } else if (LIs->hasGapBeforeInstr(Index)) {
+ Pt = MII;
+ SpillIndex = LIs->findGapBeforeInstr(Index, true);
}
+
+ if (RefsInMBB.count(MII))
+ return Pt;
+
+
+ --MII;
}
return Pt;
@@ -311,81 +281,44 @@
// FIXME: Allow spill to be inserted to the beginning of the mbb. Update mbb
// begin index accordingly.
MachineBasicBlock::iterator Pt = MBB->end();
- unsigned EndIdx = LIs->getMBBEndIdx(MBB);
+ MachineBasicBlock::iterator EndPt = MBB->getFirstTerminator();
- // Go bottom up if RefsInMBB is empty and the end of the mbb isn't beyond
- // the last index in the live range.
- if (RefsInMBB.empty() && LastIdx >= EndIdx) {
- MachineBasicBlock::iterator MII = MBB->getFirstTerminator();
- MachineBasicBlock::iterator EndPt = MI;
-
- if (MII == EndPt) return Pt;
-
- --MII;
- do {
- unsigned Index = LIs->getInstructionIndex(MII);
- unsigned Gap = LIs->findGapBeforeInstr(Index);
-
- // We can't insert a restore between the barrier (a call) and its
- // corresponding call frame teardown.
- if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode()) {
- bool reachedBarrier = false;
- while (MII->getOpcode() != TRI->getCallFrameSetupOpcode()) {
- --MII;
- if (MII == EndPt) {
- reachedBarrier = true;
- break;
- }
- }
-
- if (reachedBarrier) break;
- else continue;
- } else if (Gap) {
- Pt = MII;
- RestoreIndex = Gap;
- break;
- }
-
- --MII;
- } while (MII != EndPt);
- } else {
- MachineBasicBlock::iterator MII = MI;
- MII = ++MII;
-
- // FIXME: Limit the number of instructions to examine to reduce
- // compile time?
- while (MII != MBB->getFirstTerminator()) {
- unsigned Index = LIs->getInstructionIndex(MII);
- if (Index > LastIdx)
- break;
- unsigned Gap = LIs->findGapBeforeInstr(Index);
+ // We start at the call, so walk forward until we find the call frame teardown
+ // since we can't insert restores before that. Bail if we encounter a use
+ // during this time.
+ MachineBasicBlock::iterator MII = MI;
+ if (MII == EndPt) return Pt;
+
+ while (MII != EndPt && !RefsInMBB.count(MII) &&
+ MII->getOpcode() != TRI->getCallFrameDestroyOpcode())
+ ++MII;
+ if (MII == EndPt || RefsInMBB.count(MII)) return Pt;
+ ++MII;
+
+ // FIXME: Limit the number of instructions to examine to reduce
+ // compile time?
+ while (MII != EndPt) {
+ unsigned Index = LIs->getInstructionIndex(MII);
+ if (Index > LastIdx)
+ break;
+ unsigned Gap = LIs->findGapBeforeInstr(Index);
- // We can't insert a restore between the barrier (a call) and its
- // corresponding call frame teardown.
- if (MII->getOpcode() == TRI->getCallFrameDestroyOpcode()) {
+ // We can't insert a restore between the barrier (a call) and its
+ // corresponding call frame teardown.
+ if (MII->getOpcode() == TRI->getCallFrameSetupOpcode()) {
+ do {
+ if (MII == EndPt || RefsInMBB.count(MII)) return Pt;
++MII;
- continue;
- } else if (prior(MII)->getOpcode() == TRI->getCallFrameSetupOpcode()) {
- bool reachedBarrier = false;
- do {
- if (MII == MBB->getFirstTerminator() || RefsInMBB.count(MII)) {
- reachedBarrier = true;
- break;
- }
-
- ++MII;
- } while (MII->getOpcode() != TRI->getCallFrameDestroyOpcode());
-
- if (reachedBarrier) break;
- } else if (Gap) {
- Pt = MII;
- RestoreIndex = Gap;
- }
-
- if (RefsInMBB.count(MII))
- break;
- ++MII;
+ } while (MII->getOpcode() != TRI->getCallFrameDestroyOpcode());
+ } else if (Gap) {
+ Pt = MII;
+ RestoreIndex = Gap;
}
+
+ if (RefsInMBB.count(MII))
+ return Pt;
+
+ ++MII;
}
return Pt;
Modified: llvm/trunk/test/CodeGen/X86/pre-split4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pre-split4.ll?rev=68093&r1=68092&r2=68093&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pre-split4.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pre-split4.ll Tue Mar 31 03:27:09 2009
@@ -1,5 +1,5 @@
; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -pre-alloc-split -stats |& \
-; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 4
+; RUN: grep {pre-alloc-split} | grep {Number of intervals split} | grep 2
define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
From isanbard at gmail.com Tue Mar 31 03:33:19 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:33:19 -0000
Subject: [llvm-commits] [llvm] r68096 - in /llvm/branches/Apple/Dib:
lib/CodeGen/TwoAddressInstructionPass.cpp
test/CodeGen/X86/inline-asm-2addr.ll
Message-ID: <200903310833.n2V8XKI4025099@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:33:19 2009
New Revision: 68096
URL: http://llvm.org/viewvc/llvm-project?rev=68096&view=rev
Log:
--- Merging (from foreign repository) r68065 into '.':
U test/CodeGen/X86/inline-asm-2addr.ll
U lib/CodeGen/TwoAddressInstructionPass.cpp
Turn a 2-address instruction into a 3-address one when it's profitable even if
the two-address operand is killed. e.g.
%reg1024 = MOV r1
%reg1025 = ADD %reg1024, %reg1026
r0 = MOV %reg1025
If it's not possible / profitable to commute ADD, then turning ADD into a LEA
saves a copy.
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/branches/Apple/Dib/test/CodeGen/X86/inline-asm-2addr.ll
Modified: llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=68096&r1=68095&r2=68096&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/TwoAddressInstructionPass.cpp Tue Mar 31 03:33:19 2009
@@ -96,6 +96,13 @@
MachineFunction::iterator &mbbi,
unsigned RegB, unsigned RegC, unsigned Dist);
+ bool isProfitableToConv3Addr(unsigned RegA);
+
+ bool ConvertInstTo3Addr(MachineBasicBlock::iterator &mi,
+ MachineBasicBlock::iterator &nmi,
+ MachineFunction::iterator &mbbi,
+ unsigned RegB, unsigned Dist);
+
void ProcessCopy(MachineInstr *MI, MachineBasicBlock *MBB,
SmallPtrSet &Processed);
public:
@@ -334,7 +341,9 @@
/// as a two-address use. If so, return the destination register by reference.
static bool isTwoAddrUse(MachineInstr &MI, unsigned Reg, unsigned &DstReg) {
const TargetInstrDesc &TID = MI.getDesc();
- for (unsigned i = 0, e = TID.getNumOperands(); i != e; ++i) {
+ unsigned NumOps = (MI.getOpcode() == TargetInstrInfo::INLINEASM)
+ ? MI.getNumOperands() : TID.getNumOperands();
+ for (unsigned i = 0; i != NumOps; ++i) {
const MachineOperand &MO = MI.getOperand(i);
if (!MO.isReg() || !MO.isUse() || MO.getReg() != Reg)
continue;
@@ -503,6 +512,53 @@
return true;
}
+/// isProfitableToConv3Addr - Return true if it is profitable to convert the
+/// given 2-address instruction to a 3-address one.
+bool
+TwoAddressInstructionPass::isProfitableToConv3Addr(unsigned RegA) {
+ // Look for situations like this:
+ // %reg1024 = MOV r1
+ // %reg1025 = MOV r0
+ // %reg1026 = ADD %reg1024, %reg1025
+ // r2 = MOV %reg1026
+ // Turn ADD into a 3-address instruction to avoid a copy.
+ unsigned FromRegA = getMappedReg(RegA, SrcRegMap);
+ unsigned ToRegA = getMappedReg(RegA, DstRegMap);
+ return (FromRegA && ToRegA && !regsAreCompatible(FromRegA, ToRegA, TRI));
+}
+
+/// ConvertInstTo3Addr - Convert the specified two-address instruction into a
+/// three address one. Return true if this transformation was successful.
+bool
+TwoAddressInstructionPass::ConvertInstTo3Addr(MachineBasicBlock::iterator &mi,
+ MachineBasicBlock::iterator &nmi,
+ MachineFunction::iterator &mbbi,
+ unsigned RegB, unsigned Dist) {
+ MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, LV);
+ if (NewMI) {
+ DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
+ DOUT << "2addr: TO 3-ADDR: " << *NewMI;
+ bool Sunk = false;
+
+ if (NewMI->findRegisterUseOperand(RegB, false, TRI))
+ // FIXME: Temporary workaround. If the new instruction doesn't
+ // uses RegB, convertToThreeAddress must have created more
+ // then one instruction.
+ Sunk = Sink3AddrInstruction(mbbi, NewMI, RegB, mi);
+
+ mbbi->erase(mi); // Nuke the old inst.
+
+ if (!Sunk) {
+ DistanceMap.insert(std::make_pair(NewMI, Dist));
+ mi = NewMI;
+ nmi = next(mi);
+ }
+ return true;
+ }
+
+ return false;
+}
+
/// ProcessCopy - If the specified instruction is not yet processed, process it
/// if it's a copy. For a copy instruction, we find the physical registers the
/// source and destination registers might be mapped to. These are kept in
@@ -716,26 +772,7 @@
assert(TID.getOperandConstraint(i, TOI::TIED_TO) == -1);
#endif
- MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, LV);
- if (NewMI) {
- DOUT << "2addr: CONVERTING 2-ADDR: " << *mi;
- DOUT << "2addr: TO 3-ADDR: " << *NewMI;
- bool Sunk = false;
-
- if (NewMI->findRegisterUseOperand(regB, false, TRI))
- // FIXME: Temporary workaround. If the new instruction doesn't
- // uses regB, convertToThreeAddress must have created more
- // then one instruction.
- Sunk = Sink3AddrInstruction(mbbi, NewMI, regB, mi);
-
- mbbi->erase(mi); // Nuke the old inst.
-
- if (!Sunk) {
- DistanceMap.insert(std::make_pair(NewMI, Dist));
- mi = NewMI;
- nmi = next(mi);
- }
-
+ if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) {
++NumConvertedTo3Addr;
break; // Done with this instruction.
}
@@ -750,9 +787,19 @@
++NumAggrCommuted;
++NumCommuted;
regB = regC;
+ goto InstructionRearranged;
}
}
+ // If it's profitable to convert the 2-address instruction to a
+ // 3-address one, do so.
+ if (TID.isConvertibleTo3Addr() && isProfitableToConv3Addr(regA)) {
+ if (ConvertInstTo3Addr(mi, nmi, mbbi, regB, Dist)) {
+ ++NumConvertedTo3Addr;
+ break; // Done with this instruction.
+ }
+ }
+
InstructionRearranged:
const TargetRegisterClass* rc = MRI->getRegClass(regB);
MachineInstr *DefMI = MRI->getVRegDef(regB);
Modified: llvm/branches/Apple/Dib/test/CodeGen/X86/inline-asm-2addr.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/inline-asm-2addr.ll?rev=68096&r1=68095&r2=68096&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/inline-asm-2addr.ll (original)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/inline-asm-2addr.ll Tue Mar 31 03:33:19 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86-64 | grep movq | count 1
+; RUN: llvm-as < %s | llc -march=x86-64 | not grep movq
define i64 @t(i64 %a, i64 %b) nounwind ssp {
entry:
From isanbard at gmail.com Tue Mar 31 03:35:22 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:35:22 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r68097 -
/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c
Message-ID: <200903310835.n2V8ZMWc025165@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:35:22 2009
New Revision: 68097
URL: http://llvm.org/viewvc/llvm-project?rev=68097&view=rev
Log:
--- Merging (from foreign repository) r68080 into '.':
U gcc/config/darwin.c
Move ObjC CFString objects to a writable __DATA section under
-fwritable-strings.
Modified:
llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c
Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c?rev=68097&r1=68096&r2=68097&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/config/darwin.c Tue Mar 31 03:35:22 2009
@@ -1760,7 +1760,11 @@
else
return "__OBJC, __string_object,no_dead_strip";
} else if (!strcmp(IDENTIFIER_POINTER(typename), "__builtin_CFString")) {
- return "__DATA, __cfstring";
+ return
+#ifdef LLVM_CONST_DATA_SECTION
+ (flag_writable_strings) ? LLVM_CONST_DATA_SECTION :
+#endif
+ "__DATA, __cfstring";
} else {
return 0;
}
From isanbard at gmail.com Tue Mar 31 03:41:32 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:41:32 -0000
Subject: [llvm-commits] [llvm] r68099 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/Spiller.cpp
lib/CodeGen/Spiller.h lib/CodeGen/VirtRegMap.cpp lib/CodeGen/VirtRegMap.h
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903310841.n2V8fWDR025503@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:41:31 2009
New Revision: 68099
URL: http://llvm.org/viewvc/llvm-project?rev=68099&view=rev
Log:
Oy! When reverting r68073, I added in experimental code. Sorry...
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/CodeGen/Spiller.cpp
llvm/trunk/lib/CodeGen/Spiller.h
llvm/trunk/lib/CodeGen/VirtRegMap.cpp
llvm/trunk/lib/CodeGen/VirtRegMap.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 03:41:31 2009
@@ -253,6 +253,15 @@
/// it returns end()
iterator getFirstTerminator();
+ /// isOnlyReachableViaFallthough - Return true if this basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ bool isOnlyReachableByFallthrough() const {
+ return !pred_empty() &&
+ next(pred_begin()) == pred_end() &&
+ (*pred_begin())->getFirstTerminator() == (*pred_begin())->end();
+ }
+
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/trunk/lib/CodeGen/Spiller.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.cpp?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.cpp (original)
+++ llvm/trunk/lib/CodeGen/Spiller.cpp Tue Mar 31 03:41:31 2009
@@ -578,20 +578,6 @@
DOUT << "**** Post Machine Instrs ****\n";
DEBUG(MF.dump());
- // See if any of the spills we added are actually dead and can be deleted.
- for (std::vector >::iterator
- I = AddedSpills.begin(), E = AddedSpills.end(); I != E; ++I) {
- MachineInstr *MI = *I;
-
- if (VRM.OnlyUseOfStackSlot(MI)) {
- MachineBasicBlock *MBB = MI->getParent();
- DOUT << "Removed dead store:\t" << *MI;
- VRM.RemoveMachineInstrFromMaps(MI);
- MBB->erase(MI);
- ++NumDSE;
- }
- }
-
// Mark unused spill slots.
MachineFrameInfo *MFI = MF.getFrameInfo();
int SS = VRM.getLowSpillSlot();
@@ -602,7 +588,6 @@
++NumDSS;
}
- AddedSpills.clear();
return true;
}
@@ -813,50 +798,9 @@
return false;
}
-void LocalSpiller::RemoveDeadStore(MachineInstr *Store,
- MachineBasicBlock &MBB,
- MachineBasicBlock::iterator &MII,
- SmallSet &ReMatDefs,
- BitVector &RegKills,
- std::vector &KillOps,
- VirtRegMap &VRM) {
- // If there is a dead store to this stack slot, nuke it now.
- DOUT << "Removed dead store:\t" << *Store;
- ++NumDSE;
- SmallVector KillRegs;
- InvalidateKills(*Store, RegKills, KillOps, &KillRegs);
-
- MachineBasicBlock::iterator PrevMII = Store;
- bool CheckDef = PrevMII != MBB.begin();
- if (CheckDef) --PrevMII;
-
- VRM.RemoveMachineInstrFromMaps(Store);
- MBB.erase(Store);
-
- if (CheckDef) {
- // Look at defs of killed registers on the store. Mark the defs as dead
- // since the store has been deleted and they aren't being reused.
- for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) {
- bool HasOtherDef = false;
-
- if (InvalidateRegDef(PrevMII, *MII, KillRegs[j], HasOtherDef)) {
- MachineInstr *DeadDef = PrevMII;
-
- if (ReMatDefs.count(DeadDef) && !HasOtherDef) {
- // FIXME: This assumes a remat def does not have side effects.
- VRM.RemoveMachineInstrFromMaps(DeadDef);
- MBB.erase(DeadDef);
- ++NumDRM;
- }
- }
- }
- }
-}
-
/// SpillRegToStackSlot - Spill a register to a specified stack slot. Check if
/// the last store to the same slot is now dead. If so, remove the last store.
-void
-LocalSpiller::SpillRegToStackSlot(MachineBasicBlock &MBB,
+void LocalSpiller::SpillRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &MII,
int Idx, unsigned PhysReg, int StackSlot,
const TargetRegisterClass *RC,
@@ -872,8 +816,36 @@
DOUT << "Store:\t" << *StoreMI;
// If there is a dead store to this stack slot, nuke it now.
- if (LastStore)
- RemoveDeadStore(LastStore, MBB, MII, ReMatDefs, RegKills, KillOps, VRM);
+ if (LastStore) {
+ DOUT << "Removed dead store:\t" << *LastStore;
+ ++NumDSE;
+ SmallVector KillRegs;
+ InvalidateKills(*LastStore, RegKills, KillOps, &KillRegs);
+ MachineBasicBlock::iterator PrevMII = LastStore;
+ bool CheckDef = PrevMII != MBB.begin();
+ if (CheckDef)
+ --PrevMII;
+ VRM.RemoveMachineInstrFromMaps(LastStore);
+ MBB.erase(LastStore);
+ if (CheckDef) {
+ // Look at defs of killed registers on the store. Mark the defs
+ // as dead since the store has been deleted and they aren't
+ // being reused.
+ for (unsigned j = 0, ee = KillRegs.size(); j != ee; ++j) {
+ bool HasOtherDef = false;
+ if (InvalidateRegDef(PrevMII, *MII, KillRegs[j], HasOtherDef)) {
+ MachineInstr *DeadDef = PrevMII;
+ if (ReMatDefs.count(DeadDef) && !HasOtherDef) {
+ // FIXME: This assumes a remat def does not have side
+ // effects.
+ VRM.RemoveMachineInstrFromMaps(DeadDef);
+ MBB.erase(DeadDef);
+ ++NumDRM;
+ }
+ }
+ }
+ }
+ }
LastStore = next(MII);
@@ -1088,7 +1060,6 @@
if (VRM.isSpillPt(&MI)) {
std::vector > &SpillRegs =
VRM.getSpillPtSpills(&MI);
-
for (unsigned i = 0, e = SpillRegs.size(); i != e; ++i) {
unsigned VirtReg = SpillRegs[i].first;
bool isKill = SpillRegs[i].second;
@@ -1102,9 +1073,7 @@
VRM.addSpillSlotUse(StackSlot, StoreMI);
DOUT << "Store:\t" << *StoreMI;
VRM.virtFolded(VirtReg, StoreMI, VirtRegMap::isMod);
- AddedSpills.push_back(StoreMI);
}
-
NextMII = next(MII);
}
Modified: llvm/trunk/lib/CodeGen/Spiller.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Spiller.h?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/Spiller.h (original)
+++ llvm/trunk/lib/CodeGen/Spiller.h Tue Mar 31 03:41:31 2009
@@ -285,7 +285,6 @@
const TargetRegisterInfo *TRI;
const TargetInstrInfo *TII;
DenseMap DistanceMap;
- std::vector AddedSpills;
public:
bool runOnMachineFunction(MachineFunction &MF, VirtRegMap &VRM);
private:
@@ -306,14 +305,6 @@
std::vector &KillOps,
const TargetRegisterInfo *TRI,
VirtRegMap &VRM);
- void RemoveDeadStore(MachineInstr *Store,
- MachineBasicBlock &MBB,
- MachineBasicBlock::iterator &MII,
- SmallSet &ReMatDefs,
- BitVector &RegKills,
- std::vector &KillOps,
- VirtRegMap &VRM);
-
void SpillRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator &MII,
int Idx, unsigned PhysReg, int StackSlot,
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Mar 31 03:41:31 2009
@@ -188,7 +188,7 @@
if (MF->getFrameInfo()->isFixedObjectIndex(FI))
continue;
// This stack reference was produced by instruction selection and
- // is not a spill.
+ // is not a spill
if (FI < LowSpillSlot)
continue;
assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size()
@@ -201,27 +201,6 @@
EmergencySpillMap.erase(MI);
}
-bool VirtRegMap::OnlyUseOfStackSlot(const MachineInstr *MI) const {
- for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
- const MachineOperand &MO = MI->getOperand(i);
- if (!MO.isFI())
- continue;
- int FI = MO.getIndex();
- if (MF->getFrameInfo()->isFixedObjectIndex(FI))
- continue;
- // This stack reference was produced by instruction selection and
- // is not a spill.
- if (FI < LowSpillSlot)
- continue;
- assert((unsigned)FI-LowSpillSlot < SpillSlotToUsesMap.size()
- && "Invalid spill slot");
- if (SpillSlotToUsesMap[FI - LowSpillSlot].size() != 1)
- return false;
- }
-
- return true;
-}
-
void VirtRegMap::print(std::ostream &OS, const Module* M) const {
const TargetRegisterInfo* TRI = MF->getTarget().getRegisterInfo();
Modified: llvm/trunk/lib/CodeGen/VirtRegMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.h?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/VirtRegMap.h (original)
+++ llvm/trunk/lib/CodeGen/VirtRegMap.h Tue Mar 31 03:41:31 2009
@@ -430,8 +430,6 @@
/// the folded instruction map and spill point map.
void RemoveMachineInstrFromMaps(MachineInstr *MI);
- bool OnlyUseOfStackSlot(const MachineInstr *MI) const;
-
void print(std::ostream &OS, const Module* M = 0) const;
void print(std::ostream *OS) const { if (OS) print(*OS); }
void dump() const;
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68099&r1=68098&r2=68099&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 03:41:31 2009
@@ -238,7 +238,12 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!I->pred_empty()) {
+ if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
+ // This is an entry block or a block that's only reachable via a
+ // fallthrough edge. In non-VerboseAsm mode, don't print the label.
+ assert((I->pred_empty() || (*I->pred_begin())->isLayoutSuccessor(I)) &&
+ "Fall-through predecessor not adjacent to its successor!");
+ } else {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From isanbard at gmail.com Tue Mar 31 03:42:40 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 08:42:40 -0000
Subject: [llvm-commits] [llvm] r68100 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903310842.n2V8genb025581@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 03:42:40 2009
New Revision: 68100
URL: http://llvm.org/viewvc/llvm-project?rev=68100&view=rev
Log:
Really temporarily revert r68073.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68100&r1=68099&r2=68100&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 03:42:40 2009
@@ -253,15 +253,6 @@
/// it returns end()
iterator getFirstTerminator();
- /// isOnlyReachableViaFallthough - Return true if this basic block has
- /// exactly one predecessor and the control transfer mechanism between
- /// the predecessor and this block is a fall-through.
- bool isOnlyReachableByFallthrough() const {
- return !pred_empty() &&
- next(pred_begin()) == pred_end() &&
- (*pred_begin())->getFirstTerminator() == (*pred_begin())->end();
- }
-
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68100&r1=68099&r2=68100&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 03:42:40 2009
@@ -238,12 +238,7 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
- // This is an entry block or a block that's only reachable via a
- // fallthrough edge. In non-VerboseAsm mode, don't print the label.
- assert((I->pred_empty() || (*I->pred_begin())->isLayoutSuccessor(I)) &&
- "Fall-through predecessor not adjacent to its successor!");
- } else {
+ if (!I->pred_empty()) {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From rafael.espindola at gmail.com Tue Mar 31 11:17:00 2009
From: rafael.espindola at gmail.com (Rafael Espindola)
Date: Tue, 31 Mar 2009 16:17:00 -0000
Subject: [llvm-commits] [llvm] r68109 -
/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Message-ID: <200903311617.n2VGH05k014030@zion.cs.uiuc.edu>
Author: rafael
Date: Tue Mar 31 11:16:57 2009
New Revision: 68109
URL: http://llvm.org/viewvc/llvm-project?rev=68109&view=rev
Log:
remove unused arguments.
Modified:
llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=68109&r1=68108&r2=68109&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Mar 31 11:16:57 2009
@@ -160,9 +160,8 @@
SDNode *SelectAtomic64(SDNode *Node, unsigned Opc);
bool MatchAddress(SDValue N, X86ISelAddressMode &AM,
- bool isRoot = true, unsigned Depth = 0);
- bool MatchAddressBase(SDValue N, X86ISelAddressMode &AM,
- bool isRoot, unsigned Depth);
+ unsigned Depth = 0);
+ bool MatchAddressBase(SDValue N, X86ISelAddressMode &AM);
bool SelectAddr(SDValue Op, SDValue N, SDValue &Base,
SDValue &Scale, SDValue &Index, SDValue &Disp);
bool SelectLEAAddr(SDValue Op, SDValue N, SDValue &Base,
@@ -731,13 +730,13 @@
/// returning true if it cannot be done. This just pattern matches for the
/// addressing mode.
bool X86DAGToDAGISel::MatchAddress(SDValue N, X86ISelAddressMode &AM,
- bool isRoot, unsigned Depth) {
+ unsigned Depth) {
bool is64Bit = Subtarget->is64Bit();
DebugLoc dl = N.getDebugLoc();
DOUT << "MatchAddress: "; DEBUG(AM.dump());
// Limit recursion.
if (Depth > 5)
- return MatchAddressBase(N, AM, isRoot, Depth);
+ return MatchAddressBase(N, AM);
// RIP relative addressing: %rip + 32-bit displacement!
if (AM.isRIPRel) {
@@ -896,12 +895,12 @@
case ISD::ADD: {
X86ISelAddressMode Backup = AM;
- if (!MatchAddress(N.getNode()->getOperand(0), AM, false, Depth+1) &&
- !MatchAddress(N.getNode()->getOperand(1), AM, false, Depth+1))
+ if (!MatchAddress(N.getNode()->getOperand(0), AM, Depth+1) &&
+ !MatchAddress(N.getNode()->getOperand(1), AM, Depth+1))
return false;
AM = Backup;
- if (!MatchAddress(N.getNode()->getOperand(1), AM, false, Depth+1) &&
- !MatchAddress(N.getNode()->getOperand(0), AM, false, Depth+1))
+ if (!MatchAddress(N.getNode()->getOperand(1), AM, Depth+1) &&
+ !MatchAddress(N.getNode()->getOperand(0), AM, Depth+1))
return false;
AM = Backup;
@@ -926,7 +925,7 @@
X86ISelAddressMode Backup = AM;
uint64_t Offset = CN->getSExtValue();
// Start with the LHS as an addr mode.
- if (!MatchAddress(N.getOperand(0), AM, false) &&
+ if (!MatchAddress(N.getOperand(0), AM, Depth+1) &&
// Address could not have picked a GV address for the displacement.
AM.GV == NULL &&
// On x86-64, the resultant disp must fit in 32-bits.
@@ -1005,13 +1004,12 @@
}
}
- return MatchAddressBase(N, AM, isRoot, Depth);
+ return MatchAddressBase(N, AM);
}
/// MatchAddressBase - Helper for MatchAddress. Add the specified node to the
/// specified addressing mode without any further recursion.
-bool X86DAGToDAGISel::MatchAddressBase(SDValue N, X86ISelAddressMode &AM,
- bool isRoot, unsigned Depth) {
+bool X86DAGToDAGISel::MatchAddressBase(SDValue N, X86ISelAddressMode &AM) {
// Is the base register already occupied?
if (AM.BaseType != X86ISelAddressMode::RegBase || AM.Base.Reg.getNode()) {
// If so, check to see if the scale index register is set.
@@ -1051,7 +1049,7 @@
for (SDNode::use_iterator UI = N.getNode()->use_begin(),
UE = N.getNode()->use_end(); UI != UE; ++UI) {
if (UI->getOpcode() == ISD::CopyToReg) {
- MatchAddressBase(N, AM, true, 0);
+ MatchAddressBase(N, AM);
Done = true;
break;
}
From gohman at apple.com Tue Mar 31 11:46:45 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 16:46:45 -0000
Subject: [llvm-commits] [llvm] r68111 -
/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
Message-ID: <200903311646.n2VGkjhA015161@zion.cs.uiuc.edu>
Author: djg
Date: Tue Mar 31 11:46:45 2009
New Revision: 68111
URL: http://llvm.org/viewvc/llvm-project?rev=68111&view=rev
Log:
Add a comment.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h?rev=68111&r1=68110&r2=68111&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.h Tue Mar 31 11:46:45 2009
@@ -145,7 +145,8 @@
/// TreePatternNode objects!
class TreePatternNode {
/// The inferred type for this node, or EMVT::isUnknown if it hasn't
- /// been determined yet.
+ /// been determined yet. This is a std::vector because during inference
+ /// there may be multiple possible types.
std::vector Types;
/// Operator - The Record for the operator if this is an interior node (not
From gohman at apple.com Tue Mar 31 11:48:35 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 16:48:35 -0000
Subject: [llvm-commits] [llvm] r68112 -
/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Message-ID: <200903311648.n2VGmZRX015261@zion.cs.uiuc.edu>
Author: djg
Date: Tue Mar 31 11:48:35 2009
New Revision: 68112
URL: http://llvm.org/viewvc/llvm-project?rev=68112&view=rev
Log:
Tidy up some comments.
Modified:
llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
Modified: llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp?rev=68112&r1=68111&r2=68112&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp (original)
+++ llvm/trunk/utils/TableGen/CodeGenDAGPatterns.cpp Tue Mar 31 11:48:35 2009
@@ -75,16 +75,16 @@
return true;
}
-/// isExtIntegerVT - Return true if the specified extended value type vector
-/// contains isInt or an integer value type.
namespace llvm {
namespace EMVT {
+/// isExtIntegerInVTs - Return true if the specified extended value type vector
+/// contains isInt or an integer value type.
bool isExtIntegerInVTs(const std::vector &EVTs) {
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
return EVTs[0] == isInt || !(FilterEVTs(EVTs, isInteger).empty());
}
-/// isExtFloatingPointVT - Return true if the specified extended value type
+/// isExtFloatingPointInVTs - Return true if the specified extended value type
/// vector contains isFP or a FP value type.
bool isExtFloatingPointInVTs(const std::vector &EVTs) {
assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!");
From gohman at apple.com Tue Mar 31 11:51:19 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 16:51:19 -0000
Subject: [llvm-commits] [llvm] r68113 -
/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
Message-ID: <200903311651.n2VGpJi8015356@zion.cs.uiuc.edu>
Author: djg
Date: Tue Mar 31 11:51:18 2009
New Revision: 68113
URL: http://llvm.org/viewvc/llvm-project?rev=68113&view=rev
Log:
Minor top-level comment fix.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp?rev=68113&r1=68112&r2=68113&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Tue Mar 31 11:51:18 2009
@@ -1,4 +1,4 @@
-//===-- llvm/CallingConvLower.cpp - Calling Conventions -------------------===//
+//===-- CallingConvLower.cpp - Calling Conventions ------------------------===//
//
// The LLVM Compiler Infrastructure
//
From daniel at zuster.org Tue Mar 31 12:30:15 2009
From: daniel at zuster.org (Daniel Dunbar)
Date: Tue, 31 Mar 2009 17:30:15 -0000
Subject: [llvm-commits] [llvm] r68118 - in /llvm/trunk:
include/llvm/System/Host.h lib/System/Unix/Host.inc
lib/System/Win32/Host.inc
Message-ID: <200903311730.n2VHUFqp016822@zion.cs.uiuc.edu>
Author: ddunbar
Date: Tue Mar 31 12:30:15 2009
New Revision: 68118
URL: http://llvm.org/viewvc/llvm-project?rev=68118&view=rev
Log:
Add llvm::sys::getHostTriple and remove
llvm::sys::getOS{Name,Version}.
Right now the implementation just derives from LLVM_HOSTTRIPLE (which
is wrong, but it doesn't look like we have a define for the target
triple). Ideally this routine would actually be able to compute the
triple for targets we care about.
Modified:
llvm/trunk/include/llvm/System/Host.h
llvm/trunk/lib/System/Unix/Host.inc
llvm/trunk/lib/System/Win32/Host.inc
Modified: llvm/trunk/include/llvm/System/Host.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Host.h?rev=68118&r1=68117&r2=68118&view=diff
==============================================================================
--- llvm/trunk/include/llvm/System/Host.h (original)
+++ llvm/trunk/include/llvm/System/Host.h Tue Mar 31 12:30:15 2009
@@ -32,13 +32,15 @@
return !isLittleEndianHost();
}
- /// getOSName() - Return the name of the host operating system or "" if
- /// unknown.
- std::string getOSName();
+ /// getHostTriple() - Return the target triple of the running
+ /// system.
+ ///
+ /// The target triple is a string in the format of:
+ /// CPU_TYPE-VENDOR-OPERATING_SYSTEM
+ /// or
+ /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
+ std::string getHostTriple();
- /// getOSVersion() - Return the operating system version as a string or
- /// "" if unknown.
- std::string getOSVersion();
}
}
Modified: llvm/trunk/lib/System/Unix/Host.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Host.inc?rev=68118&r1=68117&r2=68118&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Host.inc (original)
+++ llvm/trunk/lib/System/Unix/Host.inc Tue Mar 31 12:30:15 2009
@@ -23,20 +23,36 @@
using namespace llvm;
-std::string llvm::sys::getOSName() {
+static std::string getOSVersion() {
struct utsname info;
if (uname(&info))
return "";
- return info.sysname;
+ return info.release;
}
-std::string llvm::sys::getOSVersion() {
- struct utsname info;
-
- if (uname(&info))
- return "";
+std::string sys::getHostTriple() {
+ // FIXME: Derive more directly instead of relying on the autoconf
+ // generated variable.
+
+ std::string Triple = LLVM_HOSTTRIPLE;
+
+ // Force i86 to i386.
+ if (Triple[0] == 'i' && isdigit(Triple[1]) &&
+ Triple[2] == '8' && Triple[3] == '6')
+ Triple[1] = '3';
+
+ // On darwin, we want to update the version to match that of the
+ // host.
+ std::string::size_type DarwinDashIdx = Triple.find("-darwin");
+ if (DarwinDashIdx != std::string::npos) {
+ Triple.resize(DarwinDashIdx + strlen("-darwin"));
+
+ // Only add the major part of the os version.
+ std::string Version = getOSVersion();
+ Triple += Version.substr(0, Version.find('.'));
+ }
- return info.release;
+ return Triple;
}
Modified: llvm/trunk/lib/System/Win32/Host.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Host.inc?rev=68118&r1=68117&r2=68118&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Host.inc (original)
+++ llvm/trunk/lib/System/Win32/Host.inc Tue Mar 31 12:30:15 2009
@@ -17,21 +17,7 @@
using namespace llvm;
-std::string sys::getOSName() {
- return "Windows";
-}
-
-std::string sys::getOSVersion() {
- OSVERSIONINFO osvi;
-
- memset(&osvi, 0, sizeof(osvi));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- if (!GetVersionEx(&osvi))
- return "";
-
- char buf[64];
- sprintf(buf, "%d.%d", (int)osvi.dwMajorVersion, (int)osvi.dwMinorVersion);
-
- return buf;
+std::string sys::getHostTriple() {
+ // FIXME: Adapt to running version.
+ return LLVM_HOSTTRIPLE;
}
From dpatel at apple.com Tue Mar 31 12:36:12 2009
From: dpatel at apple.com (Devang Patel)
Date: Tue, 31 Mar 2009 17:36:12 -0000
Subject: [llvm-commits] [llvm] r68120 - in /llvm/trunk:
lib/Transforms/Utils/InlineFunction.cpp test/Other/2009-03-31-CallGraph.ll
Message-ID: <200903311736.n2VHaCjg017012@zion.cs.uiuc.edu>
Author: dpatel
Date: Tue Mar 31 12:36:12 2009
New Revision: 68120
URL: http://llvm.org/viewvc/llvm-project?rev=68120&view=rev
Log:
Update call graph after inlining invoke.
Patch by Jay Foad.
Added:
llvm/trunk/test/Other/2009-03-31-CallGraph.ll
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=68120&r1=68119&r2=68120&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Tue Mar 31 12:36:12 2009
@@ -41,7 +41,8 @@
/// block of the inlined code (the last block is the end of the function),
/// and InlineCodeInfo is information about the code that got inlined.
static void HandleInlinedInvoke(InvokeInst *II, BasicBlock *FirstNewBlock,
- ClonedCodeInfo &InlinedCodeInfo) {
+ ClonedCodeInfo &InlinedCodeInfo,
+ CallGraph *CG) {
BasicBlock *InvokeDest = II->getUnwindDest();
std::vector InvokeDestPHIValues;
@@ -93,6 +94,22 @@
// Make sure that anything using the call now uses the invoke!
CI->replaceAllUsesWith(II);
+ // Update the callgraph.
+ if (CG) {
+ // We should be able to do this:
+ // (*CG)[Caller]->replaceCallSite(CI, II);
+ // but that fails if the old call site isn't in the call graph,
+ // which, because of LLVM bug 3601, it sometimes isn't.
+ CallGraphNode *CGN = (*CG)[Caller];
+ for (CallGraphNode::iterator NI = CGN->begin(), NE = CGN->end();
+ NI != NE; ++NI) {
+ if (NI->first == CI) {
+ NI->first = II;
+ break;
+ }
+ }
+ }
+
// Delete the unconditional branch inserted by splitBasicBlock
BB->getInstList().pop_back();
Split->getInstList().pop_front(); // Delete the original call
@@ -433,7 +450,7 @@
// any inlined 'unwind' instructions into branches to the invoke exception
// destination, and call instructions into invoke instructions.
if (InvokeInst *II = dyn_cast(TheCall))
- HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo);
+ HandleInlinedInvoke(II, FirstNewBlock, InlinedFunctionInfo, CG);
// If we cloned in _exactly one_ basic block, and if that block ends in a
// return instruction, we splice the body of the inlined callee directly into
Added: llvm/trunk/test/Other/2009-03-31-CallGraph.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2009-03-31-CallGraph.ll?rev=68120&view=auto
==============================================================================
--- llvm/trunk/test/Other/2009-03-31-CallGraph.ll (added)
+++ llvm/trunk/test/Other/2009-03-31-CallGraph.ll Tue Mar 31 12:36:12 2009
@@ -0,0 +1,31 @@
+; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output
+define void @f2() {
+ invoke void @f6()
+ to label %ok1 unwind label %lpad1
+
+ok1:
+ ret void
+
+lpad1:
+ invoke void @f4()
+ to label %ok2 unwind label %lpad2
+
+ok2:
+ call void @f8()
+ unreachable
+
+lpad2:
+ unreachable
+}
+
+declare void @f3()
+
+define void @f4() {
+ call void @f3()
+ ret void
+}
+
+declare void @f6() nounwind
+
+declare void @f8()
+
From isanbard at gmail.com Tue Mar 31 13:18:28 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 18:18:28 -0000
Subject: [llvm-commits] [llvm] r68123 - in /llvm/branches/Apple/Dib:
lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
test/CodeGen/X86/live-out-reg-info.ll
Message-ID: <200903311818.n2VIITEH018822@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 13:18:28 2009
New Revision: 68123
URL: http://llvm.org/viewvc/llvm-project?rev=68123&view=rev
Log:
--- Merging (from foreign repository) r68083 into '.':
A test/CodeGen/X86/live-out-reg-info.ll
U lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
Fix live-out reg logic to not insert over-aggressive AssertZExt
instructions. This fixes lua.
Added:
llvm/branches/Apple/Dib/test/CodeGen/X86/live-out-reg-info.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=68123&r1=68122&r2=68123&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Tue Mar 31 13:18:28 2009
@@ -4587,15 +4587,15 @@
isSExt = false, FromVT = MVT::i1; // ASSERT ZEXT 1
else if (NumSignBits > RegSize-8)
isSExt = true, FromVT = MVT::i8; // ASSERT SEXT 8
- else if (NumZeroBits >= RegSize-9)
+ else if (NumZeroBits >= RegSize-8)
isSExt = false, FromVT = MVT::i8; // ASSERT ZEXT 8
else if (NumSignBits > RegSize-16)
isSExt = true, FromVT = MVT::i16; // ASSERT SEXT 16
- else if (NumZeroBits >= RegSize-17)
+ else if (NumZeroBits >= RegSize-16)
isSExt = false, FromVT = MVT::i16; // ASSERT ZEXT 16
else if (NumSignBits > RegSize-32)
isSExt = true, FromVT = MVT::i32; // ASSERT SEXT 32
- else if (NumZeroBits >= RegSize-33)
+ else if (NumZeroBits >= RegSize-32)
isSExt = false, FromVT = MVT::i32; // ASSERT ZEXT 32
if (FromVT != MVT::Other) {
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/live-out-reg-info.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/live-out-reg-info.ll?rev=68123&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/live-out-reg-info.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/live-out-reg-info.ll Tue Mar 31 13:18:28 2009
@@ -0,0 +1,20 @@
+; RUN: llvm-as < %s | llc -march=x86-64 | grep testl
+
+; Make sure dagcombine doesn't eliminate the comparison due
+; to an off-by-one bug with ComputeMaskedBits information.
+
+declare void @qux()
+
+define void @foo(i32 %a) {
+ %t0 = lshr i32 %a, 23
+ br label %next
+next:
+ %t1 = and i32 %t0, 256
+ %t2 = icmp eq i32 %t1, 0
+ br i1 %t2, label %true, label %false
+true:
+ call void @qux()
+ ret void
+false:
+ ret void
+}
From gohman at apple.com Tue Mar 31 13:20:47 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 18:20:47 -0000
Subject: [llvm-commits] [llvm] r68124 - in /llvm/trunk/test/CodeGen/X86:
2006-10-19-SwitchUnnecessaryBranching.ll 2007-06-04-tailmerge4.ll
2008-03-23-DarwinAsmComments.ll 2009-03-16-PHIElimInLPad.ll
Message-ID: <200903311820.n2VIKloL018911@zion.cs.uiuc.edu>
Author: djg
Date: Tue Mar 31 13:20:47 2009
New Revision: 68124
URL: http://llvm.org/viewvc/llvm-project?rev=68124&view=rev
Log:
Add an explicit -asm-verbose to these tests, to make it
possible to run the tests with -asm-verbose defaulting
to false.
Modified:
llvm/trunk/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll
llvm/trunk/test/CodeGen/X86/2007-06-04-tailmerge4.ll
llvm/trunk/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll
llvm/trunk/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll
Modified: llvm/trunk/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll?rev=68124&r1=68123&r2=68124&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2006-10-19-SwitchUnnecessaryBranching.ll Tue Mar 31 13:20:47 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 | %prcontext je 1 | \
+; RUN: llvm-as < %s | llc -march=x86 -asm-verbose | %prcontext je 1 | \
; RUN: grep BB1_1:
@str = internal constant [14 x i8] c"Hello world!\0A\00" ; <[14 x i8]*> [#uses=1]
Modified: llvm/trunk/test/CodeGen/X86/2007-06-04-tailmerge4.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-06-04-tailmerge4.ll?rev=68124&r1=68123&r2=68124&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-06-04-tailmerge4.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2007-06-04-tailmerge4.ll Tue Mar 31 13:20:47 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -enable-eh | grep invcont131
+; RUN: llvm-as < %s | llc -enable-eh -asm-verbose | grep invcont131
; PR 1496: tail merge was incorrectly removing this block
; ModuleID = 'report.1.bc'
Modified: llvm/trunk/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll?rev=68124&r1=68123&r2=68124&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2008-03-23-DarwinAsmComments.ll Tue Mar 31 13:20:47 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin | grep {#} | not grep -v {##}
+; RUN: llvm-as < %s | llc -mtriple=i386-apple-darwin -asm-verbose | grep {#} | not grep -v {##}
%struct.AGenericCall = type { %struct.AGenericManager*, %struct.ComponentParameters*, i32* }
%struct.AGenericManager = type <{ i8 }>
Modified: llvm/trunk/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll?rev=68124&r1=68123&r2=68124&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll Tue Mar 31 13:20:47 2009
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -march=x86 | grep -A 1 lpad | grep Llabel
+; RUN: llvm-as < %s | llc -march=x86 -asm-verbose | grep -A 1 lpad | grep Llabel
; Check that register copies in the landing pad come after the EH_LABEL
declare i32 @f()
From dgregor at apple.com Tue Mar 31 13:31:03 2009
From: dgregor at apple.com (Douglas Gregor)
Date: Tue, 31 Mar 2009 18:31:03 -0000
Subject: [llvm-commits] [llvm] r68126 -
/llvm/trunk/include/llvm/ADT/PointerUnion.h
Message-ID: <200903311831.n2VIV3k8019425@zion.cs.uiuc.edu>
Author: dgregor
Date: Tue Mar 31 13:31:03 2009
New Revision: 68126
URL: http://llvm.org/viewvc/llvm-project?rev=68126&view=rev
Log:
Stop guessing, start thinking, and make PointerUnion3::is actually be correct.
Modified:
llvm/trunk/include/llvm/ADT/PointerUnion.h
Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68126&r1=68125&r2=68126&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Tue Mar 31 13:31:03 2009
@@ -183,9 +183,7 @@
// Is it PT1/PT2?
if (::llvm::getPointerUnionTypeNum((T*)0) != -1)
return Val.is() && Val.get().is();
- // Must be PT3 or statically invalid.
- assert(Val.is());
- return true;
+ return Val.is();
}
/// get() - Return the value of the specified pointer type. If the
From foldr at codedgers.com Tue Mar 31 13:33:55 2009
From: foldr at codedgers.com (Mikhail Glushenkov)
Date: Tue, 31 Mar 2009 18:33:55 -0000
Subject: [llvm-commits] [llvm] r68127 -
/llvm/trunk/tools/llvmc/plugins/Base/Base.td
Message-ID: <200903311833.n2VIXtIe019531@zion.cs.uiuc.edu>
Author: foldr
Date: Tue Mar 31 13:33:54 2009
New Revision: 68127
URL: http://llvm.org/viewvc/llvm-project?rev=68127&view=rev
Log:
Do not pass '-relocation-model=pic' to llc.
Does not work well on 32 bit targets. Bug reported by Albert Graef.
This patch also adds new "-Wllc,option" syntax to pass options to llc.
Modified:
llvm/trunk/tools/llvmc/plugins/Base/Base.td
Modified: llvm/trunk/tools/llvmc/plugins/Base/Base.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Base/Base.td?rev=68127&r1=68126&r2=68127&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Base/Base.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Base/Base.td Tue Mar 31 13:33:54 2009
@@ -38,6 +38,8 @@
(help "Add a directory to include path")),
(prefix_list_option "Wa,",
(help "Pass options to assembler")),
+ (prefix_list_option "Wllc,",
+ (help "Pass options to llc")),
(prefix_list_option "L",
(help "Add a directory to link path")),
(prefix_list_option "l",
@@ -113,8 +115,10 @@
[(in_language "llvm-bitcode"),
(out_language "assembler"),
(output_suffix "s"),
- (cmd_line "llc -relocation-model=pic -f $INFILE -o $OUTFILE"),
- (actions (case (switch_on "S"), (stop_compilation)))
+ (cmd_line "llc -f $INFILE -o $OUTFILE"),
+ (actions (case
+ (switch_on "S"), (stop_compilation),
+ (not_empty "Wllc,"), (unpack_values "Wllc,")))
]>;
// Base class for linkers
From gohman at apple.com Tue Mar 31 13:39:13 2009
From: gohman at apple.com (Dan Gohman)
Date: Tue, 31 Mar 2009 18:39:13 -0000
Subject: [llvm-commits] [llvm] r68129 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903311839.n2VIdDi8019797@zion.cs.uiuc.edu>
Author: djg
Date: Tue Mar 31 13:39:13 2009
New Revision: 68129
URL: http://llvm.org/viewvc/llvm-project?rev=68129&view=rev
Log:
Reapply 68073, with fixes. EH Landing-pad basic blocks are not
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=68129&r1=68128&r2=68129&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 13:39:13 2009
@@ -253,6 +253,11 @@
/// it returns end()
iterator getFirstTerminator();
+ /// isOnlyReachableViaFallthough - Return true if this basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ bool isOnlyReachableByFallthrough() const;
+
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=68129&r1=68128&r2=68129&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue Mar 31 13:39:13 2009
@@ -123,6 +123,16 @@
return I;
}
+bool
+MachineBasicBlock::isOnlyReachableByFallthrough() const {
+ return !isLandingPad() &&
+ !pred_empty() &&
+ next(pred_begin()) == pred_end() &&
+ (*pred_begin())->isLayoutSuccessor(this) &&
+ ((*pred_begin())->empty() ||
+ !(*pred_begin())->back().getDesc().isBarrier());
+}
+
void MachineBasicBlock::dump() const {
print(*cerr.stream());
}
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68129&r1=68128&r2=68129&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 13:39:13 2009
@@ -238,7 +238,10 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!I->pred_empty()) {
+ if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
+ // This is an entry block or a block that's only reachable via a
+ // fallthrough edge. In non-VerboseAsm mode, don't print the label.
+ } else {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From isanbard at gmail.com Tue Mar 31 13:42:31 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 11:42:31 -0700
Subject: [llvm-commits] [llvm] r68129 - in /llvm/trunk:
include/llvm/CodeGen/MachineBasicBlock.h
lib/CodeGen/MachineBasicBlock.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
In-Reply-To: <200903311839.n2VIdDi8019797@zion.cs.uiuc.edu>
References: <200903311839.n2VIdDi8019797@zion.cs.uiuc.edu>
Message-ID: <16e5fdf90903311142i79ef8d42ja809cf56556048ed@mail.gmail.com>
On Tue, Mar 31, 2009 at 11:39 AM, Dan Gohman wrote:
> Author: djg
> Date: Tue Mar 31 13:39:13 2009
> New Revision: 68129
>
> URL: http://llvm.org/viewvc/llvm-project?rev=68129&view=rev
> Log:
> Reapply 68073, with fixes. EH Landing-pad basic blocks are not
> entered via fall-through. Don't miss fallthroughs from blocks
> terminated by conditional branches. Also, move
> isOnlyReachableByFallthrough out of line.
>
Thanks, Dan!
-bw
From evan.cheng at apple.com Tue Mar 31 14:38:54 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 31 Mar 2009 19:38:54 -0000
Subject: [llvm-commits] [llvm] r68133 -
/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Message-ID: <200903311938.n2VJcsOG022044@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Mar 31 14:38:51 2009
New Revision: 68133
URL: http://llvm.org/viewvc/llvm-project?rev=68133&view=rev
Log:
i128 shift libcalls are not available on x86.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=68133&r1=68132&r2=68133&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Mar 31 14:38:51 2009
@@ -816,6 +816,13 @@
setOperationAction(ISD::UMULO, MVT::i32, Custom);
setOperationAction(ISD::UMULO, MVT::i64, Custom);
+ if (!Subtarget->is64Bit()) {
+ // These libcalls are not available in 32-bit.
+ setLibcallName(RTLIB::SHL_I128, 0);
+ setLibcallName(RTLIB::SRL_I128, 0);
+ setLibcallName(RTLIB::SRA_I128, 0);
+ }
+
// We have target-specific dag combine patterns for the following nodes:
setTargetDAGCombine(ISD::VECTOR_SHUFFLE);
setTargetDAGCombine(ISD::BUILD_VECTOR);
From evan.cheng at apple.com Tue Mar 31 14:39:24 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 31 Mar 2009 19:39:24 -0000
Subject: [llvm-commits] [llvm] r68134 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeTypes.h test/CodeGen/X86/shift-i128.ll
test/CodeGen/X86/shift-i256.ll
Message-ID: <200903311939.n2VJdO5S022073@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Mar 31 14:39:24 2009
New Revision: 68134
URL: http://llvm.org/viewvc/llvm-project?rev=68134&view=rev
Log:
Fully general expansion of integer shift of any size.
Added:
llvm/trunk/test/CodeGen/X86/shift-i128.ll
llvm/trunk/test/CodeGen/X86/shift-i256.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=68134&r1=68133&r2=68134&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Tue Mar 31 14:39:24 2009
@@ -1231,6 +1231,78 @@
return false;
}
+/// ExpandShiftWithUnknownAmountBit - Fully general expansion of integer shift
+/// of any size.
+bool DAGTypeLegalizer::
+ExpandShiftWithUnknownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
+ SDValue Amt = N->getOperand(1);
+ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
+ MVT ShTy = Amt.getValueType();
+ unsigned NVTBits = NVT.getSizeInBits();
+ assert(isPowerOf2_32(NVTBits) &&
+ "Expanded integer type size not a power of two!");
+ DebugLoc dl = N->getDebugLoc();
+
+ // Get the incoming operand to be shifted.
+ SDValue InL, InH;
+ GetExpandedInteger(N->getOperand(0), InL, InH);
+
+ SDValue NVBitsNode = DAG.getConstant(NVTBits, ShTy);
+ SDValue Amt2 = DAG.getNode(ISD::SUB, dl, ShTy, NVBitsNode, Amt);
+ SDValue Cmp = DAG.getSetCC(dl, TLI.getSetCCResultType(ShTy),
+ Amt, NVBitsNode, ISD::SETULT);
+
+ SDValue Lo1, Hi1, Lo2, Hi2;
+ switch (N->getOpcode()) {
+ default: assert(0 && "Unknown shift");
+ case ISD::SHL:
+ // ShAmt < NVTBits
+ Lo1 = DAG.getConstant(0, NVT); // Low part is zero.
+ Hi1 = DAG.getNode(ISD::SHL, dl, NVT, InL, Amt); // High part from Lo part.
+
+ // ShAmt >= NVTBits
+ Lo2 = DAG.getNode(ISD::SHL, dl, NVT, InL, Amt);
+ Hi2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt),
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ case ISD::SRL:
+ // ShAmt < NVTBits
+ Hi1 = DAG.getConstant(0, NVT); // Hi part is zero.
+ Lo1 = DAG.getNode(ISD::SRL, dl, NVT, InH, Amt); // Lo part from Hi part.
+
+ // ShAmt >= NVTBits
+ Hi2 = DAG.getNode(ISD::SRL, dl, NVT, InH, Amt);
+ Lo2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt),
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ case ISD::SRA:
+ // ShAmt < NVTBits
+ Hi1 = DAG.getNode(ISD::SRA, dl, NVT, InH, // Sign extend high part.
+ DAG.getConstant(NVTBits-1, ShTy));
+ Lo1 = DAG.getNode(ISD::SRA, dl, NVT, InH, Amt); // Lo part from Hi part.
+
+ // ShAmt >= NVTBits
+ Hi2 = DAG.getNode(ISD::SRA, dl, NVT, InH, Amt);
+ Lo2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt),
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ }
+
+ return false;
+}
+
void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
SDValue &Lo, SDValue &Hi) {
DebugLoc dl = N->getDebugLoc();
@@ -1792,10 +1864,15 @@
else if (VT == MVT::i128)
LC = RTLIB::SRA_I128;
}
- assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported shift!");
+
+ if (LC != RTLIB::UNKNOWN_LIBCALL && TLI.getLibcallName(LC)) {
+ SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
+ SplitInteger(MakeLibCall(LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
+ return;
+ }
- SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
- SplitInteger(MakeLibCall(LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
+ if (!ExpandShiftWithUnknownAmountBit(N, Lo, Hi))
+ assert(0 && "Unsupported shift!");
}
void DAGTypeLegalizer::ExpandIntRes_SIGN_EXTEND(SDNode *N,
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=68134&r1=68133&r2=68134&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Tue Mar 31 14:39:24 2009
@@ -353,6 +353,7 @@
void ExpandShiftByConstant(SDNode *N, unsigned Amt,
SDValue &Lo, SDValue &Hi);
bool ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi);
+ bool ExpandShiftWithUnknownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi);
// Integer Operand Expansion.
bool ExpandIntegerOperand(SDNode *N, unsigned OperandNo);
Added: llvm/trunk/test/CodeGen/X86/shift-i128.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shift-i128.ll?rev=68134&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/shift-i128.ll (added)
+++ llvm/trunk/test/CodeGen/X86/shift-i128.ll Tue Mar 31 14:39:24 2009
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -march=x86
+; RUN: llvm-as < %s | llc -march=x86-64
+
+define void @t(i128 %x, i128 %a, i128* nocapture %r) nounwind {
+entry:
+ %0 = lshr i128 %x, %a
+ store i128 %0, i128* %r, align 16
+ ret void
+}
Added: llvm/trunk/test/CodeGen/X86/shift-i256.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/shift-i256.ll?rev=68134&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/shift-i256.ll (added)
+++ llvm/trunk/test/CodeGen/X86/shift-i256.ll Tue Mar 31 14:39:24 2009
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -march=x86
+; RUN: llvm-as < %s | llc -march=x86-64
+
+define void @t(i256 %x, i256 %a, i256* nocapture %r) nounwind readnone {
+entry:
+ %0 = ashr i256 %x, %a
+ store i256 %0, i256* %r
+ ret void
+}
From isanbard at gmail.com Tue Mar 31 15:05:03 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 20:05:03 -0000
Subject: [llvm-commits] [llvm] r68135 - in /llvm/branches/Apple/Dib:
include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Message-ID: <200903312005.n2VK53M5023217@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 15:05:03 2009
New Revision: 68135
URL: http://llvm.org/viewvc/llvm-project?rev=68135&view=rev
Log:
--- Merging (from foreign repository) r68129 into '.':
U include/llvm/CodeGen/MachineBasicBlock.h
U lib/CodeGen/MachineBasicBlock.cpp
U lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Reapply 68073, with fixes. EH Landing-pad basic blocks are not
entered via fall-through. Don't miss fallthroughs from blocks
terminated by conditional branches. Also, move
isOnlyReachableByFallthrough out of line.
Modified:
llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h
llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp
llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
Modified: llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/CodeGen/MachineBasicBlock.h Tue Mar 31 15:05:03 2009
@@ -253,6 +253,11 @@
/// it returns end()
iterator getFirstTerminator();
+ /// isOnlyReachableViaFallthough - Return true if this basic block has
+ /// exactly one predecessor and the control transfer mechanism between
+ /// the predecessor and this block is a fall-through.
+ bool isOnlyReachableByFallthrough() const;
+
void pop_front() { Insts.pop_front(); }
void pop_back() { Insts.pop_back(); }
void push_back(MachineInstr *MI) { Insts.push_back(MI); }
Modified: llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/MachineBasicBlock.cpp Tue Mar 31 15:05:03 2009
@@ -123,6 +123,16 @@
return I;
}
+bool
+MachineBasicBlock::isOnlyReachableByFallthrough() const {
+ return !isLandingPad() &&
+ !pred_empty() &&
+ next(pred_begin()) == pred_end() &&
+ (*pred_begin())->isLayoutSuccessor(this) &&
+ ((*pred_begin())->empty() ||
+ !(*pred_begin())->back().getDesc().isBarrier());
+}
+
void MachineBasicBlock::dump() const {
print(*cerr.stream());
}
Modified: llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp?rev=68135&r1=68134&r2=68135&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp Tue Mar 31 15:05:03 2009
@@ -238,7 +238,10 @@
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (!I->pred_empty()) {
+ if (!VerboseAsm && (I->pred_empty() || I->isOnlyReachableByFallthrough())) {
+ // This is an entry block or a block that's only reachable via a
+ // fallthrough edge. In non-VerboseAsm mode, don't print the label.
+ } else {
printBasicBlockLabel(I, true, true, VerboseAsm);
O << '\n';
}
From isanbard at gmail.com Tue Mar 31 15:08:06 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 20:08:06 -0000
Subject: [llvm-commits] [llvm] r68137 - in /llvm/branches/Apple/Dib:
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
lib/CodeGen/SelectionDAG/LegalizeTypes.h lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/shift-i128.ll test/CodeGen/X86/shift-i256.ll
Message-ID: <200903312008.n2VK86GF023375@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 15:08:05 2009
New Revision: 68137
URL: http://llvm.org/viewvc/llvm-project?rev=68137&view=rev
Log:
--- Merging (from foreign repository) r68133 into '.':
U lib/Target/X86/X86ISelLowering.cpp
i128 shift libcalls are not available on x86.
--- Merging (from foreign repository) r68134 into '.':
A test/CodeGen/X86/shift-i128.ll
A test/CodeGen/X86/shift-i256.ll
U lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
U lib/CodeGen/SelectionDAG/LegalizeTypes.h
Fully general expansion of integer shift of any size.
Added:
llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i128.ll
llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i256.ll
Modified:
llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=68137&r1=68136&r2=68137&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Tue Mar 31 15:08:05 2009
@@ -1231,6 +1231,78 @@
return false;
}
+/// ExpandShiftWithUnknownAmountBit - Fully general expansion of integer shift
+/// of any size.
+bool DAGTypeLegalizer::
+ExpandShiftWithUnknownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi) {
+ SDValue Amt = N->getOperand(1);
+ MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
+ MVT ShTy = Amt.getValueType();
+ unsigned NVTBits = NVT.getSizeInBits();
+ assert(isPowerOf2_32(NVTBits) &&
+ "Expanded integer type size not a power of two!");
+ DebugLoc dl = N->getDebugLoc();
+
+ // Get the incoming operand to be shifted.
+ SDValue InL, InH;
+ GetExpandedInteger(N->getOperand(0), InL, InH);
+
+ SDValue NVBitsNode = DAG.getConstant(NVTBits, ShTy);
+ SDValue Amt2 = DAG.getNode(ISD::SUB, dl, ShTy, NVBitsNode, Amt);
+ SDValue Cmp = DAG.getSetCC(dl, TLI.getSetCCResultType(ShTy),
+ Amt, NVBitsNode, ISD::SETULT);
+
+ SDValue Lo1, Hi1, Lo2, Hi2;
+ switch (N->getOpcode()) {
+ default: assert(0 && "Unknown shift");
+ case ISD::SHL:
+ // ShAmt < NVTBits
+ Lo1 = DAG.getConstant(0, NVT); // Low part is zero.
+ Hi1 = DAG.getNode(ISD::SHL, dl, NVT, InL, Amt); // High part from Lo part.
+
+ // ShAmt >= NVTBits
+ Lo2 = DAG.getNode(ISD::SHL, dl, NVT, InL, Amt);
+ Hi2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt),
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ case ISD::SRL:
+ // ShAmt < NVTBits
+ Hi1 = DAG.getConstant(0, NVT); // Hi part is zero.
+ Lo1 = DAG.getNode(ISD::SRL, dl, NVT, InH, Amt); // Lo part from Hi part.
+
+ // ShAmt >= NVTBits
+ Hi2 = DAG.getNode(ISD::SRL, dl, NVT, InH, Amt);
+ Lo2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt),
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ case ISD::SRA:
+ // ShAmt < NVTBits
+ Hi1 = DAG.getNode(ISD::SRA, dl, NVT, InH, // Sign extend high part.
+ DAG.getConstant(NVTBits-1, ShTy));
+ Lo1 = DAG.getNode(ISD::SRA, dl, NVT, InH, Amt); // Lo part from Hi part.
+
+ // ShAmt >= NVTBits
+ Hi2 = DAG.getNode(ISD::SRA, dl, NVT, InH, Amt);
+ Lo2 = DAG.getNode(ISD::OR, dl, NVT,
+ DAG.getNode(ISD::SRL, dl, NVT, InL, Amt),
+ DAG.getNode(ISD::SHL, dl, NVT, InH, Amt2));
+
+ Lo = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Lo1, Lo2);
+ Hi = DAG.getNode(ISD::SELECT, dl, NVT, Cmp, Hi1, Hi2);
+ return true;
+ }
+
+ return false;
+}
+
void DAGTypeLegalizer::ExpandIntRes_ADDSUB(SDNode *N,
SDValue &Lo, SDValue &Hi) {
DebugLoc dl = N->getDebugLoc();
@@ -1792,10 +1864,15 @@
else if (VT == MVT::i128)
LC = RTLIB::SRA_I128;
}
- assert(LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported shift!");
+
+ if (LC != RTLIB::UNKNOWN_LIBCALL && TLI.getLibcallName(LC)) {
+ SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
+ SplitInteger(MakeLibCall(LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
+ return;
+ }
- SDValue Ops[2] = { N->getOperand(0), N->getOperand(1) };
- SplitInteger(MakeLibCall(LC, VT, Ops, 2, isSigned, dl), Lo, Hi);
+ if (!ExpandShiftWithUnknownAmountBit(N, Lo, Hi))
+ assert(0 && "Unsupported shift!");
}
void DAGTypeLegalizer::ExpandIntRes_SIGN_EXTEND(SDNode *N,
Modified: llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=68137&r1=68136&r2=68137&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/branches/Apple/Dib/lib/CodeGen/SelectionDAG/LegalizeTypes.h Tue Mar 31 15:08:05 2009
@@ -353,6 +353,7 @@
void ExpandShiftByConstant(SDNode *N, unsigned Amt,
SDValue &Lo, SDValue &Hi);
bool ExpandShiftWithKnownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi);
+ bool ExpandShiftWithUnknownAmountBit(SDNode *N, SDValue &Lo, SDValue &Hi);
// Integer Operand Expansion.
bool ExpandIntegerOperand(SDNode *N, unsigned OperandNo);
Modified: llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp?rev=68137&r1=68136&r2=68137&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/X86/X86ISelLowering.cpp Tue Mar 31 15:08:05 2009
@@ -816,6 +816,13 @@
setOperationAction(ISD::UMULO, MVT::i32, Custom);
setOperationAction(ISD::UMULO, MVT::i64, Custom);
+ if (!Subtarget->is64Bit()) {
+ // These libcalls are not available in 32-bit.
+ setLibcallName(RTLIB::SHL_I128, 0);
+ setLibcallName(RTLIB::SRL_I128, 0);
+ setLibcallName(RTLIB::SRA_I128, 0);
+ }
+
// We have target-specific dag combine patterns for the following nodes:
setTargetDAGCombine(ISD::VECTOR_SHUFFLE);
setTargetDAGCombine(ISD::BUILD_VECTOR);
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i128.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i128.ll?rev=68137&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i128.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i128.ll Tue Mar 31 15:08:05 2009
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -march=x86
+; RUN: llvm-as < %s | llc -march=x86-64
+
+define void @t(i128 %x, i128 %a, i128* nocapture %r) nounwind {
+entry:
+ %0 = lshr i128 %x, %a
+ store i128 %0, i128* %r, align 16
+ ret void
+}
Added: llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i256.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i256.ll?rev=68137&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i256.ll (added)
+++ llvm/branches/Apple/Dib/test/CodeGen/X86/shift-i256.ll Tue Mar 31 15:08:05 2009
@@ -0,0 +1,9 @@
+; RUN: llvm-as < %s | llc -march=x86
+; RUN: llvm-as < %s | llc -march=x86-64
+
+define void @t(i256 %x, i256 %a, i256* nocapture %r) nounwind readnone {
+entry:
+ %0 = ashr i256 %x, %a
+ store i256 %0, i256* %r
+ ret void
+}
From evan.cheng at apple.com Tue Mar 31 15:42:46 2009
From: evan.cheng at apple.com (Evan Cheng)
Date: Tue, 31 Mar 2009 20:42:46 -0000
Subject: [llvm-commits] [llvm] r68142 - in /llvm/trunk:
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/select-2.ll
Message-ID: <200903312042.n2VKgkQ5025152@zion.cs.uiuc.edu>
Author: evancheng
Date: Tue Mar 31 15:42:45 2009
New Revision: 68142
URL: http://llvm.org/viewvc/llvm-project?rev=68142&view=rev
Log:
Throttle back "fold select into operand" transformation. InstCombine should not generate selects of two constants unless they are selects of 0 and 1.
e.g.
define i32 @t1(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = lshr i32 %x, 18
%t3 = select i1 %t1, i32 %t2, i32 %x
ret i32 %t3
}
was turned into
define i32 @t2(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = select i1 %t1, i32 18, i32 0
%t3 = lshr i32 %x, %t2
ret i32 %t3
}
For most targets, that means materializing two constants and then a select. e.g. On x86-64
movl %esi, %eax
shrl $18, %eax
testl %edi, %edi
cmovne %esi, %eax
ret
=>
xorl %eax, %eax
testl %edi, %edi
movl $18, %ecx
cmovne %eax, %ecx
movl %esi, %eax
shrl %cl, %eax
ret
Also, the optimizer and codegen can reason about shl / and / add, etc. by a constant. This optimization will hinder optimizations using ComputeMaskedBits.
Added:
llvm/trunk/test/Transforms/InstCombine/select-2.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=68142&r1=68141&r2=68142&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Mar 31 15:42:45 2009
@@ -223,6 +223,7 @@
Instruction *visitBitCast(BitCastInst &CI);
Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI,
Instruction *FI);
+ Instruction *FoldSelectIntoOp(SelectInst &SI, Value*, Value*);
Instruction *visitSelectInst(SelectInst &SI);
Instruction *visitSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
Instruction *visitCallInst(CallInst &CI);
@@ -8836,6 +8837,83 @@
return 0;
}
+static bool isSelect01(Constant *C1, Constant *C2) {
+ ConstantInt *C1I = dyn_cast(C1);
+ if (!C1I)
+ return false;
+ ConstantInt *C2I = dyn_cast(C2);
+ if (!C2I)
+ return false;
+ return (C1I->isZero() || C1I->isOne()) && (C2I->isZero() || C2I->isOne());
+}
+
+/// FoldSelectIntoOp - Try fold the select into one of the operands to
+/// facilitate further optimization.
+Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal,
+ Value *FalseVal) {
+ // See the comment above GetSelectFoldableOperands for a description of the
+ // transformation we are doing here.
+ if (Instruction *TVI = dyn_cast(TrueVal)) {
+ if (TVI->hasOneUse() && TVI->getNumOperands() == 2 &&
+ !isa(FalseVal)) {
+ if (unsigned SFO = GetSelectFoldableOperands(TVI)) {
+ unsigned OpToFold = 0;
+ if ((SFO & 1) && FalseVal == TVI->getOperand(0)) {
+ OpToFold = 1;
+ } else if ((SFO & 2) && FalseVal == TVI->getOperand(1)) {
+ OpToFold = 2;
+ }
+
+ if (OpToFold) {
+ Constant *C = GetSelectFoldableConstant(TVI);
+ Value *OOp = TVI->getOperand(2-OpToFold);
+ // Avoid creating select between 2 constants unless it's selecting
+ // between 0 and 1.
+ if (!isa(OOp) || isSelect01(C, cast(OOp))) {
+ Instruction *NewSel = SelectInst::Create(SI.getCondition(), OOp, C);
+ InsertNewInstBefore(NewSel, SI);
+ NewSel->takeName(TVI);
+ if (BinaryOperator *BO = dyn_cast(TVI))
+ return BinaryOperator::Create(BO->getOpcode(), FalseVal, NewSel);
+ assert(0 && "Unknown instruction!!");
+ }
+ }
+ }
+ }
+ }
+
+ if (Instruction *FVI = dyn_cast(FalseVal)) {
+ if (FVI->hasOneUse() && FVI->getNumOperands() == 2 &&
+ !isa(TrueVal)) {
+ if (unsigned SFO = GetSelectFoldableOperands(FVI)) {
+ unsigned OpToFold = 0;
+ if ((SFO & 1) && TrueVal == FVI->getOperand(0)) {
+ OpToFold = 1;
+ } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) {
+ OpToFold = 2;
+ }
+
+ if (OpToFold) {
+ Constant *C = GetSelectFoldableConstant(FVI);
+ Value *OOp = FVI->getOperand(2-OpToFold);
+ // Avoid creating select between 2 constants unless it's selecting
+ // between 0 and 1.
+ if (!isa(OOp) || isSelect01(C, cast(OOp))) {
+ Instruction *NewSel = SelectInst::Create(SI.getCondition(), C, OOp);
+ InsertNewInstBefore(NewSel, SI);
+ NewSel->takeName(FVI);
+ if (BinaryOperator *BO = dyn_cast(FVI))
+ return BinaryOperator::Create(BO->getOpcode(), TrueVal, NewSel);
+ assert(0 && "Unknown instruction!!");
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
/// visitSelectInstWithICmp - Visit a SelectInst that has an
/// ICmpInst as its first operand.
///
@@ -9181,58 +9259,9 @@
// See if we can fold the select into one of our operands.
if (SI.getType()->isInteger()) {
- // See the comment above GetSelectFoldableOperands for a description of the
- // transformation we are doing here.
- if (Instruction *TVI = dyn_cast(TrueVal))
- if (TVI->hasOneUse() && TVI->getNumOperands() == 2 &&
- !isa(FalseVal))
- if (unsigned SFO = GetSelectFoldableOperands(TVI)) {
- unsigned OpToFold = 0;
- if ((SFO & 1) && FalseVal == TVI->getOperand(0)) {
- OpToFold = 1;
- } else if ((SFO & 2) && FalseVal == TVI->getOperand(1)) {
- OpToFold = 2;
- }
-
- if (OpToFold) {
- Constant *C = GetSelectFoldableConstant(TVI);
- Instruction *NewSel =
- SelectInst::Create(SI.getCondition(),
- TVI->getOperand(2-OpToFold), C);
- InsertNewInstBefore(NewSel, SI);
- NewSel->takeName(TVI);
- if (BinaryOperator *BO = dyn_cast(TVI))
- return BinaryOperator::Create(BO->getOpcode(), FalseVal, NewSel);
- else {
- assert(0 && "Unknown instruction!!");
- }
- }
- }
-
- if (Instruction *FVI = dyn_cast(FalseVal))
- if (FVI->hasOneUse() && FVI->getNumOperands() == 2 &&
- !isa(TrueVal))
- if (unsigned SFO = GetSelectFoldableOperands(FVI)) {
- unsigned OpToFold = 0;
- if ((SFO & 1) && TrueVal == FVI->getOperand(0)) {
- OpToFold = 1;
- } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) {
- OpToFold = 2;
- }
-
- if (OpToFold) {
- Constant *C = GetSelectFoldableConstant(FVI);
- Instruction *NewSel =
- SelectInst::Create(SI.getCondition(), C,
- FVI->getOperand(2-OpToFold));
- InsertNewInstBefore(NewSel, SI);
- NewSel->takeName(FVI);
- if (BinaryOperator *BO = dyn_cast(FVI))
- return BinaryOperator::Create(BO->getOpcode(), TrueVal, NewSel);
- else
- assert(0 && "Unknown instruction!!");
- }
- }
+ Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal);
+ if (FoldI)
+ return FoldI;
}
if (BinaryOperator::isNot(CondVal)) {
Added: llvm/trunk/test/Transforms/InstCombine/select-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/select-2.ll?rev=68142&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/select-2.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/select-2.ll Tue Mar 31 15:42:45 2009
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2
+
+; Make sure instcombine don't fold select into operands. We don't want to emit
+; select of two integers unless it's selecting 0 / 1.
+
+define i32 @t1(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = lshr i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
+
+define i32 @t2(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = and i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
From isanbard at gmail.com Tue Mar 31 15:52:46 2009
From: isanbard at gmail.com (Bill Wendling)
Date: Tue, 31 Mar 2009 20:52:46 -0000
Subject: [llvm-commits] [llvm] r68143 - in /llvm/branches/Apple/Dib:
lib/Transforms/Scalar/InstructionCombining.cpp
test/Transforms/InstCombine/select-2.ll
Message-ID: <200903312052.n2VKqkjJ025517@zion.cs.uiuc.edu>
Author: void
Date: Tue Mar 31 15:52:46 2009
New Revision: 68143
URL: http://llvm.org/viewvc/llvm-project?rev=68143&view=rev
Log:
--- Merging (from foreign repository) r68142 into '.':
A test/Transforms/InstCombine/select-2.ll
U lib/Transforms/Scalar/InstructionCombining.cpp
Throttle back "fold select into operand" transformation. InstCombine should not
generate selects of two constants unless they are selects of 0 and 1.
e.g.
define i32 @t1(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = lshr i32 %x, 18
%t3 = select i1 %t1, i32 %t2, i32 %x
ret i32 %t3
}
was turned into
define i32 @t2(i32 %c, i32 %x) nounwind {
%t1 = icmp eq i32 %c, 0
%t2 = select i1 %t1, i32 18, i32 0
%t3 = lshr i32 %x, %t2
ret i32 %t3
}
For most targets, that means materializing two constants and then a
select. e.g. On x86-64
movl %esi, %eax
shrl $18, %eax
testl %edi, %edi
cmovne %esi, %eax
ret
=>
xorl %eax, %eax
testl %edi, %edi
movl $18, %ecx
cmovne %eax, %ecx
movl %esi, %eax
shrl %cl, %eax
ret
Also, the optimizer and codegen can reason about shl / and / add, etc. by a
constant. This optimization will hinder optimizations using ComputeMaskedBits.
Added:
llvm/branches/Apple/Dib/test/Transforms/InstCombine/select-2.ll
Modified:
llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp?rev=68143&r1=68142&r2=68143&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Transforms/Scalar/InstructionCombining.cpp Tue Mar 31 15:52:46 2009
@@ -223,6 +223,7 @@
Instruction *visitBitCast(BitCastInst &CI);
Instruction *FoldSelectOpOp(SelectInst &SI, Instruction *TI,
Instruction *FI);
+ Instruction *FoldSelectIntoOp(SelectInst &SI, Value*, Value*);
Instruction *visitSelectInst(SelectInst &SI);
Instruction *visitSelectInstWithICmp(SelectInst &SI, ICmpInst *ICI);
Instruction *visitCallInst(CallInst &CI);
@@ -8820,6 +8821,83 @@
return 0;
}
+static bool isSelect01(Constant *C1, Constant *C2) {
+ ConstantInt *C1I = dyn_cast(C1);
+ if (!C1I)
+ return false;
+ ConstantInt *C2I = dyn_cast(C2);
+ if (!C2I)
+ return false;
+ return (C1I->isZero() || C1I->isOne()) && (C2I->isZero() || C2I->isOne());
+}
+
+/// FoldSelectIntoOp - Try fold the select into one of the operands to
+/// facilitate further optimization.
+Instruction *InstCombiner::FoldSelectIntoOp(SelectInst &SI, Value *TrueVal,
+ Value *FalseVal) {
+ // See the comment above GetSelectFoldableOperands for a description of the
+ // transformation we are doing here.
+ if (Instruction *TVI = dyn_cast(TrueVal)) {
+ if (TVI->hasOneUse() && TVI->getNumOperands() == 2 &&
+ !isa(FalseVal)) {
+ if (unsigned SFO = GetSelectFoldableOperands(TVI)) {
+ unsigned OpToFold = 0;
+ if ((SFO & 1) && FalseVal == TVI->getOperand(0)) {
+ OpToFold = 1;
+ } else if ((SFO & 2) && FalseVal == TVI->getOperand(1)) {
+ OpToFold = 2;
+ }
+
+ if (OpToFold) {
+ Constant *C = GetSelectFoldableConstant(TVI);
+ Value *OOp = TVI->getOperand(2-OpToFold);
+ // Avoid creating select between 2 constants unless it's selecting
+ // between 0 and 1.
+ if (!isa(OOp) || isSelect01(C, cast(OOp))) {
+ Instruction *NewSel = SelectInst::Create(SI.getCondition(), OOp, C);
+ InsertNewInstBefore(NewSel, SI);
+ NewSel->takeName(TVI);
+ if (BinaryOperator *BO = dyn_cast(TVI))
+ return BinaryOperator::Create(BO->getOpcode(), FalseVal, NewSel);
+ assert(0 && "Unknown instruction!!");
+ }
+ }
+ }
+ }
+ }
+
+ if (Instruction *FVI = dyn_cast(FalseVal)) {
+ if (FVI->hasOneUse() && FVI->getNumOperands() == 2 &&
+ !isa(TrueVal)) {
+ if (unsigned SFO = GetSelectFoldableOperands(FVI)) {
+ unsigned OpToFold = 0;
+ if ((SFO & 1) && TrueVal == FVI->getOperand(0)) {
+ OpToFold = 1;
+ } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) {
+ OpToFold = 2;
+ }
+
+ if (OpToFold) {
+ Constant *C = GetSelectFoldableConstant(FVI);
+ Value *OOp = FVI->getOperand(2-OpToFold);
+ // Avoid creating select between 2 constants unless it's selecting
+ // between 0 and 1.
+ if (!isa(OOp) || isSelect01(C, cast(OOp))) {
+ Instruction *NewSel = SelectInst::Create(SI.getCondition(), C, OOp);
+ InsertNewInstBefore(NewSel, SI);
+ NewSel->takeName(FVI);
+ if (BinaryOperator *BO = dyn_cast(FVI))
+ return BinaryOperator::Create(BO->getOpcode(), TrueVal, NewSel);
+ assert(0 && "Unknown instruction!!");
+ }
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
/// visitSelectInstWithICmp - Visit a SelectInst that has an
/// ICmpInst as its first operand.
///
@@ -9165,58 +9243,9 @@
// See if we can fold the select into one of our operands.
if (SI.getType()->isInteger()) {
- // See the comment above GetSelectFoldableOperands for a description of the
- // transformation we are doing here.
- if (Instruction *TVI = dyn_cast(TrueVal))
- if (TVI->hasOneUse() && TVI->getNumOperands() == 2 &&
- !isa(FalseVal))
- if (unsigned SFO = GetSelectFoldableOperands(TVI)) {
- unsigned OpToFold = 0;
- if ((SFO & 1) && FalseVal == TVI->getOperand(0)) {
- OpToFold = 1;
- } else if ((SFO & 2) && FalseVal == TVI->getOperand(1)) {
- OpToFold = 2;
- }
-
- if (OpToFold) {
- Constant *C = GetSelectFoldableConstant(TVI);
- Instruction *NewSel =
- SelectInst::Create(SI.getCondition(),
- TVI->getOperand(2-OpToFold), C);
- InsertNewInstBefore(NewSel, SI);
- NewSel->takeName(TVI);
- if (BinaryOperator *BO = dyn_cast(TVI))
- return BinaryOperator::Create(BO->getOpcode(), FalseVal, NewSel);
- else {
- assert(0 && "Unknown instruction!!");
- }
- }
- }
-
- if (Instruction *FVI = dyn_cast(FalseVal))
- if (FVI->hasOneUse() && FVI->getNumOperands() == 2 &&
- !isa(TrueVal))
- if (unsigned SFO = GetSelectFoldableOperands(FVI)) {
- unsigned OpToFold = 0;
- if ((SFO & 1) && TrueVal == FVI->getOperand(0)) {
- OpToFold = 1;
- } else if ((SFO & 2) && TrueVal == FVI->getOperand(1)) {
- OpToFold = 2;
- }
-
- if (OpToFold) {
- Constant *C = GetSelectFoldableConstant(FVI);
- Instruction *NewSel =
- SelectInst::Create(SI.getCondition(), C,
- FVI->getOperand(2-OpToFold));
- InsertNewInstBefore(NewSel, SI);
- NewSel->takeName(FVI);
- if (BinaryOperator *BO = dyn_cast(FVI))
- return BinaryOperator::Create(BO->getOpcode(), TrueVal, NewSel);
- else
- assert(0 && "Unknown instruction!!");
- }
- }
+ Instruction *FoldI = FoldSelectIntoOp(SI, TrueVal, FalseVal);
+ if (FoldI)
+ return FoldI;
}
if (BinaryOperator::isNot(CondVal)) {
Added: llvm/branches/Apple/Dib/test/Transforms/InstCombine/select-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/test/Transforms/InstCombine/select-2.ll?rev=68143&view=auto
==============================================================================
--- llvm/branches/Apple/Dib/test/Transforms/InstCombine/select-2.ll (added)
+++ llvm/branches/Apple/Dib/test/Transforms/InstCombine/select-2.ll Tue Mar 31 15:52:46 2009
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep select | count 2
+
+; Make sure instcombine don't fold select into operands. We don't want to emit
+; select of two integers unless it's selecting 0 / 1.
+
+define i32 @t1(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = lshr i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
+
+define i32 @t2(i32 %c, i32 %x) nounwind {
+ %t1 = icmp eq i32 %c, 0
+ %t2 = and i32 %x, 18
+ %t3 = select i1 %t1, i32 %t2, i32 %x
+ ret i32 %t3
+}
From sabre at nondot.org Tue Mar 31 15:57:23 2009
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 31 Mar 2009 20:57:23 -0000
Subject: [llvm-commits] [llvm] r68145 -
/llvm/trunk/include/llvm/ADT/DenseMap.h
Message-ID: <200903312057.n2VKvNPo025764@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Mar 31 15:57:23 2009
New Revision: 68145
URL: http://llvm.org/viewvc/llvm-project?rev=68145&view=rev
Log:
add some accessors so I can play games with DenseMaps.
Modified:
llvm/trunk/include/llvm/ADT/DenseMap.h
Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=68145&r1=68144&r2=68145&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Tue Mar 31 15:57:23 2009
@@ -279,6 +279,18 @@
return *this;
}
+ /// isPointerIntoBucketsArray - Return true if the specified pointer points
+ /// somewhere into the DenseMap's array of buckets (i.e. either to a key or
+ /// value in the DenseMap).
+ bool isPointerIntoBucketsArray(const void *Ptr) const {
+ return Ptr >= Buckets && Ptr < Buckets+NumBuckets;
+ }
+
+ /// getPointerIntoBucketsArray() - Return an opaque pointer into the buckets
+ /// array. In conjunction with the previous method, this can be used to
+ /// determine whether an insertion caused the DenseMap to reallocate.
+ const void *getPointerIntoBucketsArray() const { return Buckets; }
+
private:
void CopyFrom(const DenseMap& other) {
if (NumBuckets != 0 && (!KeyInfoT::isPod() || !ValueInfoT::isPod())) {
From sabre at nondot.org Tue Mar 31 16:28:39 2009
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 31 Mar 2009 21:28:39 -0000
Subject: [llvm-commits] [llvm] r68147 - in /llvm/trunk/include/llvm:
Support/PointerLikeTypeTraits.h Use.h
Message-ID: <200903312128.n2VLSd0w027118@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Mar 31 16:28:39 2009
New Revision: 68147
URL: http://llvm.org/viewvc/llvm-project?rev=68147&view=rev
Log:
teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
Modified:
llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
llvm/trunk/include/llvm/Use.h
Modified: llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h?rev=68147&r1=68146&r2=68147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h (original)
+++ llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h Tue Mar 31 16:28:39 2009
@@ -58,6 +58,20 @@
enum { NumLowBitsAvailable = 3 };
};
+// Pointers to pointers are only 4-byte aligned on 32-bit systems.
+template
+class PointerLikeTypeTraits {
+public:
+ static inline void *getAsVoidPointer(T** P) { return P; }
+ static inline T **getFromVoidPointer(void *P) {
+ return static_cast(P);
+ }
+ enum { NumLowBitsAvailable = 2 };
+};
+
+
+
+
// Provide PointerLikeTypeTraits for uintptr_t.
template<>
class PointerLikeTypeTraits {
Modified: llvm/trunk/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=68147&r1=68146&r2=68147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Use.h (original)
+++ llvm/trunk/include/llvm/Use.h Tue Mar 31 16:28:39 2009
@@ -29,17 +29,6 @@
/// Tag - generic tag type for (at least 32 bit) pointers
enum Tag { noTag, tagOne, tagTwo, tagThree };
-// Use** is only 4-byte aligned.
-template<>
-class PointerLikeTypeTraits