From resistor at mac.com Mon Nov 26 01:17:21 2007
From: resistor at mac.com (Owen Anderson)
Date: Mon, 26 Nov 2007 07:17:21 -0000
Subject: [llvm-commits] [llvm] r44325 -
/llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Message-ID: <200711260717.lAQ7HLdp010525@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Nov 26 01:17:19 2007
New Revision: 44325
URL: http://llvm.org/viewvc/llvm-project?rev=44325&view=rev
Log:
Fix another bug that was causing siod to fail.
Modified:
llvm/trunk/lib/Transforms/Scalar/GVN.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=44325&r1=44324&r2=44325&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Nov 26 01:17:19 2007
@@ -150,6 +150,7 @@
void erase(Value* v);
unsigned size();
void setAliasAnalysis(AliasAnalysis* A) { AA = A; }
+ uint32_t hash_operand(Value* v);
};
}
@@ -338,6 +339,15 @@
}
}
+uint32_t ValueTable::hash_operand(Value* v) {
+ if (CallInst* CI = dyn_cast(v))
+ if (CI->getCalledFunction() &&
+ !AA->doesNotAccessMemory(CI->getCalledFunction()))
+ return nextValueNumber++;
+
+ return lookup_or_add(v);
+}
+
Expression ValueTable::create_expression(CallInst* C) {
Expression e;
@@ -350,7 +360,7 @@
for (CallInst::op_iterator I = C->op_begin()+1, E = C->op_end();
I != E; ++I)
- e.varargs.push_back(lookup_or_add(*I));
+ e.varargs.push_back(hash_operand(*I));
return e;
}
@@ -358,8 +368,8 @@
Expression ValueTable::create_expression(BinaryOperator* BO) {
Expression e;
- e.firstVN = lookup_or_add(BO->getOperand(0));
- e.secondVN = lookup_or_add(BO->getOperand(1));
+ e.firstVN = hash_operand(BO->getOperand(0));
+ e.secondVN = hash_operand(BO->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = BO->getType();
@@ -371,8 +381,8 @@
Expression ValueTable::create_expression(CmpInst* C) {
Expression e;
- e.firstVN = lookup_or_add(C->getOperand(0));
- e.secondVN = lookup_or_add(C->getOperand(1));
+ e.firstVN = hash_operand(C->getOperand(0));
+ e.secondVN = hash_operand(C->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = C->getType();
@@ -384,7 +394,7 @@
Expression ValueTable::create_expression(CastInst* C) {
Expression e;
- e.firstVN = lookup_or_add(C->getOperand(0));
+ e.firstVN = hash_operand(C->getOperand(0));
e.secondVN = 0;
e.thirdVN = 0;
e.function = 0;
@@ -397,9 +407,9 @@
Expression ValueTable::create_expression(ShuffleVectorInst* S) {
Expression e;
- e.firstVN = lookup_or_add(S->getOperand(0));
- e.secondVN = lookup_or_add(S->getOperand(1));
- e.thirdVN = lookup_or_add(S->getOperand(2));
+ e.firstVN = hash_operand(S->getOperand(0));
+ e.secondVN = hash_operand(S->getOperand(1));
+ e.thirdVN = hash_operand(S->getOperand(2));
e.function = 0;
e.type = S->getType();
e.opcode = Expression::SHUFFLE;
@@ -410,8 +420,8 @@
Expression ValueTable::create_expression(ExtractElementInst* E) {
Expression e;
- e.firstVN = lookup_or_add(E->getOperand(0));
- e.secondVN = lookup_or_add(E->getOperand(1));
+ e.firstVN = hash_operand(E->getOperand(0));
+ e.secondVN = hash_operand(E->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = E->getType();
@@ -423,9 +433,9 @@
Expression ValueTable::create_expression(InsertElementInst* I) {
Expression e;
- e.firstVN = lookup_or_add(I->getOperand(0));
- e.secondVN = lookup_or_add(I->getOperand(1));
- e.thirdVN = lookup_or_add(I->getOperand(2));
+ e.firstVN = hash_operand(I->getOperand(0));
+ e.secondVN = hash_operand(I->getOperand(1));
+ e.thirdVN = hash_operand(I->getOperand(2));
e.function = 0;
e.type = I->getType();
e.opcode = Expression::INSERT;
@@ -436,9 +446,9 @@
Expression ValueTable::create_expression(SelectInst* I) {
Expression e;
- e.firstVN = lookup_or_add(I->getCondition());
- e.secondVN = lookup_or_add(I->getTrueValue());
- e.thirdVN = lookup_or_add(I->getFalseValue());
+ e.firstVN = hash_operand(I->getCondition());
+ e.secondVN = hash_operand(I->getTrueValue());
+ e.thirdVN = hash_operand(I->getFalseValue());
e.function = 0;
e.type = I->getType();
e.opcode = Expression::SELECT;
@@ -449,7 +459,7 @@
Expression ValueTable::create_expression(GetElementPtrInst* G) {
Expression e;
- e.firstVN = lookup_or_add(G->getPointerOperand());
+ e.firstVN = hash_operand(G->getPointerOperand());
e.secondVN = 0;
e.thirdVN = 0;
e.function = 0;
@@ -458,7 +468,7 @@
for (GetElementPtrInst::op_iterator I = G->idx_begin(), E = G->idx_end();
I != E; ++I)
- e.varargs.push_back(lookup_or_add(*I));
+ e.varargs.push_back(hash_operand(*I));
return e;
}
From dpatel at apple.com Mon Nov 26 13:26:53 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 26 Nov 2007 19:26:53 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r44329 -
/llvm-gcc-4.2/trunk/GNUmakefile
Message-ID: <200711261926.lAQJQrwY024785@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Nov 26 13:26:53 2007
New Revision: 44329
URL: http://llvm.org/viewvc/llvm-project?rev=44329&view=rev
Log:
Use DEVELOPER_DIR if it is set.
Modified:
llvm-gcc-4.2/trunk/GNUmakefile
Modified: llvm-gcc-4.2/trunk/GNUmakefile
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/GNUmakefile?rev=44329&r1=44328&r2=44329&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/GNUmakefile (original)
+++ llvm-gcc-4.2/trunk/GNUmakefile Mon Nov 26 13:26:53 2007
@@ -39,8 +39,12 @@
ifndef DISABLE_LLVM
ENABLE_LLVM = true
# LLVM gets installed into /usr/local, not /usr.
+ifndef DEVELOPER_DIR
PREFIX = /Developer/usr/llvm-gcc-4.2
else
+PREFIX = ${DEVELOPER_DIR}/usr/llvm-gcc-4.2
+endif
+else
ENABLE_LLVM = false
endif
From dpatel at apple.com Mon Nov 26 13:28:19 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 26 Nov 2007 19:28:19 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r44330 -
/llvm-gcc-4.0/trunk/GNUmakefile
Message-ID: <200711261928.lAQJSJ6P024927@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Nov 26 13:28:19 2007
New Revision: 44330
URL: http://llvm.org/viewvc/llvm-project?rev=44330&view=rev
Log:
Use DEVELOPER_DIR if it is set.
Modified:
llvm-gcc-4.0/trunk/GNUmakefile
Modified: llvm-gcc-4.0/trunk/GNUmakefile
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/GNUmakefile?rev=44330&r1=44329&r2=44330&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/GNUmakefile (original)
+++ llvm-gcc-4.0/trunk/GNUmakefile Mon Nov 26 13:28:19 2007
@@ -39,8 +39,12 @@
ifndef DISABLE_LLVM
ENABLE_LLVM = true
# LLVM gets installed into /usr/local, not /usr.
+#ifndef DEVELOPER_DIR
PREFIX = /Developer/usr/llvm-gcc-4.0
else
+PREFIX = ${DEVELOPER_DIR}/usr/lvm-gcc-4.0
+endif
+else
ENABLE_LLVM = false
endif
From dpatel at apple.com Mon Nov 26 13:48:47 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 26 Nov 2007 19:48:47 -0000
Subject: [llvm-commits] [llvm-gcc-4.2] r44331 - /llvm-gcc-4.2/trunk/build_gcc
Message-ID: <200711261948.lAQJmlD0026225@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Nov 26 13:48:47 2007
New Revision: 44331
URL: http://llvm.org/viewvc/llvm-project?rev=44331&view=rev
Log:
Do not hard code LLVM_BIN_DIR. Use $DEST_ROOT value.
Modified:
llvm-gcc-4.2/trunk/build_gcc
Modified: llvm-gcc-4.2/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/build_gcc?rev=44331&r1=44330&r2=44331&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/build_gcc (original)
+++ llvm-gcc-4.2/trunk/build_gcc Mon Nov 26 13:48:47 2007
@@ -82,7 +82,7 @@
LLVM_SUBMIT_SUBVERSION="${11}"
# LLVM_BIN_DIR - This is the place where llvm-gcc/llvm-g++ symlinks get installed.
-LLVM_BIN_DIR=/Developer/usr/bin
+LLVM_BIN_DIR=$DEST_ROOT/../bin
# LLVM_ARCHS - This tells us which architectures we'd like the libraries to be
# build for. The default is 4-way.
From dpatel at apple.com Mon Nov 26 13:49:17 2007
From: dpatel at apple.com (Devang Patel)
Date: Mon, 26 Nov 2007 19:49:17 -0000
Subject: [llvm-commits] [llvm-gcc-4.0] r44332 - /llvm-gcc-4.0/trunk/build_gcc
Message-ID: <200711261949.lAQJnHfO026276@zion.cs.uiuc.edu>
Author: dpatel
Date: Mon Nov 26 13:49:16 2007
New Revision: 44332
URL: http://llvm.org/viewvc/llvm-project?rev=44332&view=rev
Log:
Do not hard code LLVM_BIN_DIR. Use $DEST_ROOT value.
Modified:
llvm-gcc-4.0/trunk/build_gcc
Modified: llvm-gcc-4.0/trunk/build_gcc
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/build_gcc?rev=44332&r1=44331&r2=44332&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/build_gcc (original)
+++ llvm-gcc-4.0/trunk/build_gcc Mon Nov 26 13:49:16 2007
@@ -80,7 +80,7 @@
LLVM_SUBMIT_SUBVERSION="${11}"
# LLVM_BIN_DIR - This is the place where llvm-gcc/llvm-g++ symlinks get installed.
-LLVM_BIN_DIR=/Developer/usr/bin
+LLVM_BIN_DIR=$DEST_ROOT/../bin
# LLVM_ARCHS - This tells us which architectures we'd like the libraries to be
# build for. The default is 4-way.
From pawel.kunio at gmail.com Mon Nov 26 06:46:51 2007
From: pawel.kunio at gmail.com (pawel kunio)
Date: Mon, 26 Nov 2007 13:46:51 +0100
Subject: [llvm-commits] PR889 patch
Message-ID:
Hello,
Please find attached the changelist for PR889. As suggested in
bugzilla, I devirtualized the Value destructor, renamed the
destructors of Value-inherited classes to static destroythis methods,
added the code for type checking and destroythis scheduling to Value
destructor.
Currently i am not full-time available for this project but I will try
to get some new tasks on llvmdev mailing list, as time allows.
Best regards,
Pawel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm PR889.patch
Type: application/octet-stream
Size: 19270 bytes
Desc: not available
Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071126/55847f74/attachment.obj
From cfr at adobe.com Mon Nov 26 17:20:00 2007
From: cfr at adobe.com (Chuck Rose III)
Date: Mon, 26 Nov 2007 23:20:00 -0000
Subject: [llvm-commits] [llvm] r44340 - in /llvm/trunk:
utils/TableGen/TGParser.cpp win32/TableGen/TableGen.vcproj
Message-ID: <200711262320.lAQNK0nA005874@zion.cs.uiuc.edu>
Author: cfr
Date: Mon Nov 26 17:19:59 2007
New Revision: 44340
URL: http://llvm.org/viewvc/llvm-project?rev=44340&view=rev
Log:
Add TGParser files to VStudio project files. Removed generated files section from TableGen project file as it is no longer needed. #Include directly from TGParser.cpp so it can see std::reverse.
Modified:
llvm/trunk/utils/TableGen/TGParser.cpp
llvm/trunk/win32/TableGen/TableGen.vcproj
Modified: llvm/trunk/utils/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/TGParser.cpp?rev=44340&r1=44339&r2=44340&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/TGParser.cpp (original)
+++ llvm/trunk/utils/TableGen/TGParser.cpp Mon Nov 26 17:19:59 2007
@@ -11,6 +11,8 @@
//
//===----------------------------------------------------------------------===//
+#include
+
#include "TGParser.h"
#include "Record.h"
#include "llvm/ADT/StringExtras.h"
Modified: llvm/trunk/win32/TableGen/TableGen.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/TableGen/TableGen.vcproj?rev=44340&r1=44339&r2=44340&view=diff
==============================================================================
--- llvm/trunk/win32/TableGen/TableGen.vcproj (original)
+++ llvm/trunk/win32/TableGen/TableGen.vcproj Mon Nov 26 17:19:59 2007
@@ -388,50 +388,6 @@
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -463,6 +419,14 @@
RelativePath="..\..\utils\TableGen\TGLexer.cpp"
>
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From djg at cray.com Mon Nov 26 17:46:12 2007
From: djg at cray.com (Dan Gohman)
Date: Mon, 26 Nov 2007 23:46:12 -0000
Subject: [llvm-commits] [llvm] r44341 - in /llvm/trunk:
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
test/CodeGen/X86/urem-i8-constant.ll
Message-ID: <200711262346.lAQNkCr7007422@zion.cs.uiuc.edu>
Author: djg
Date: Mon Nov 26 17:46:11 2007
New Revision: 44341
URL: http://llvm.org/viewvc/llvm-project?rev=44341&view=rev
Log:
Don't lower srem/urem X%C to X-X/C*C unless the division is actually
optimized. This avoids creating illegal divisions when the combiner is
running after legalize; this fixes PR1815. Also, it produces better
code in the included testcase by avoiding the subtract and multiply
when the division isn't optimized.
Added:
llvm/trunk/test/CodeGen/X86/urem-i8-constant.ll
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=44341&r1=44340&r2=44341&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Nov 26 17:46:11 2007
@@ -1306,15 +1306,17 @@
DAG.MaskedValueIsZero(N0, SignBit))
return DAG.getNode(ISD::UREM, VT, N0, N1);
- // Unconditionally lower X%C -> X-X/C*C. This allows the X/C logic to hack on
- // the remainder operation.
+ // If X/C can be simplified by the division-by-constant logic, lower
+ // X%C to the equivalent of X-X/C*C.
if (N1C && !N1C->isNullValue()) {
SDOperand Div = DAG.getNode(ISD::SDIV, VT, N0, N1);
- SDOperand Mul = DAG.getNode(ISD::MUL, VT, Div, N1);
- SDOperand Sub = DAG.getNode(ISD::SUB, VT, N0, Mul);
- AddToWorkList(Div.Val);
- AddToWorkList(Mul.Val);
- return Sub;
+ SDOperand OptimizedDiv = combine(Div.Val);
+ if (OptimizedDiv.Val && OptimizedDiv.Val != Div.Val) {
+ SDOperand Mul = DAG.getNode(ISD::MUL, VT, OptimizedDiv, N1);
+ SDOperand Sub = DAG.getNode(ISD::SUB, VT, N0, Mul);
+ AddToWorkList(Mul.Val);
+ return Sub;
+ }
}
// undef % X -> 0
@@ -1351,15 +1353,17 @@
}
}
- // Unconditionally lower X%C -> X-X/C*C. This allows the X/C logic to hack on
- // the remainder operation.
+ // If X/C can be simplified by the division-by-constant logic, lower
+ // X%C to the equivalent of X-X/C*C.
if (N1C && !N1C->isNullValue()) {
SDOperand Div = DAG.getNode(ISD::UDIV, VT, N0, N1);
- SDOperand Mul = DAG.getNode(ISD::MUL, VT, Div, N1);
- SDOperand Sub = DAG.getNode(ISD::SUB, VT, N0, Mul);
- AddToWorkList(Div.Val);
- AddToWorkList(Mul.Val);
- return Sub;
+ SDOperand OptimizedDiv = combine(Div.Val);
+ if (OptimizedDiv.Val && OptimizedDiv.Val != Div.Val) {
+ SDOperand Mul = DAG.getNode(ISD::MUL, VT, OptimizedDiv, N1);
+ SDOperand Sub = DAG.getNode(ISD::SUB, VT, N0, Mul);
+ AddToWorkList(Mul.Val);
+ return Sub;
+ }
}
// undef % X -> 0
Added: llvm/trunk/test/CodeGen/X86/urem-i8-constant.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/urem-i8-constant.ll?rev=44341&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/urem-i8-constant.ll (added)
+++ llvm/trunk/test/CodeGen/X86/urem-i8-constant.ll Mon Nov 26 17:46:11 2007
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=x86 | not grep mul
+
+define i8 @foo(i8 %tmp325) {
+ %t546 = urem i8 %tmp325, 37
+ ret i8 %t546
+}
From djg at cray.com Mon Nov 26 18:03:40 2007
From: djg at cray.com (Dan Gohman)
Date: Tue, 27 Nov 2007 00:03:40 -0000
Subject: [llvm-commits] [llvm] r44342 -
/llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll
Message-ID: <200711270003.lAR03frT008249@zion.cs.uiuc.edu>
Author: djg
Date: Mon Nov 26 18:03:38 2007
New Revision: 44342
URL: http://llvm.org/viewvc/llvm-project?rev=44342&view=rev
Log:
Remove unnecessary && from the RUN lines of this test.
Modified:
llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll
Modified: llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll?rev=44342&r1=44341&r2=44342&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll Mon Nov 26 18:03:38 2007
@@ -1,5 +1,5 @@
-; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx | grep {movd %rsi, %mm0} &&
-; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx | grep {movd %rdi, %mm1} &&
+; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx | grep {movd %rsi, %mm0}
+; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx | grep {movd %rdi, %mm1}
; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+mmx | grep {paddusw %mm0, %mm1}
@R = external global <1 x i64> ; <<1 x i64>*> [#uses=1]
From djg at cray.com Mon Nov 26 18:07:34 2007
From: djg at cray.com (Dan Gohman)
Date: Tue, 27 Nov 2007 00:07:34 -0000
Subject: [llvm-commits] [llvm] r44343 -
/llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll
Message-ID: <200711270007.lAR07YS3008471@zion.cs.uiuc.edu>
Author: djg
Date: Mon Nov 26 18:07:33 2007
New Revision: 44343
URL: http://llvm.org/viewvc/llvm-project?rev=44343&view=rev
Log:
Don't redirect llvm-as's stderr to llvm-dis.
Change grep '' to grep {}.
Modified:
llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll
Modified: llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll?rev=44343&r1=44342&r2=44343&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll (original)
+++ llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll Mon Nov 26 18:07:33 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s |& llvm-dis |& grep 'align 1024'
+; RUN: llvm-as < %s | llvm-dis |& grep {align 1024}
define i32 @test(i32* %arg) {
entry:
From djg at cray.com Mon Nov 26 18:10:35 2007
From: djg at cray.com (Dan Gohman)
Date: Tue, 27 Nov 2007 00:10:35 -0000
Subject: [llvm-commits] [llvm] r44344 - in
/llvm/trunk/test/Analysis/ScalarEvolution: 2007-07-15-NegativeStride.ll
2007-09-27-LargeStepping.ll 2007-11-18-OrInstruction.ll
Message-ID: <200711270010.lAR0AZDE008720@zion.cs.uiuc.edu>
Author: djg
Date: Mon Nov 26 18:10:35 2007
New Revision: 44344
URL: http://llvm.org/viewvc/llvm-project?rev=44344&view=rev
Log:
Change grep '' to grep {}.
Change 2>&1 | to |&.
Modified:
llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
llvm/trunk/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll?rev=44344&r1=44343&r2=44344&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2007-07-15-NegativeStride.ll Mon Nov 26 18:10:35 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -analyze -scalar-evolution 2>&1 | grep "Loop bb: 100 iterations"
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {Loop bb: 100 iterations}
; PR1533
@array = weak global [101 x i32] zeroinitializer, align 32 ; <[100 x i32]*> [#uses=1]
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll?rev=44344&r1=44343&r2=44344&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2007-09-27-LargeStepping.ll Mon Nov 26 18:10:35 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -analyze -scalar-evolution 2>&1 | grep "13 iterations"
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep {13 iterations}
; PR1706
define i32 @f() {
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll?rev=44344&r1=44343&r2=44344&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2007-11-18-OrInstruction.ll Mon Nov 26 18:10:35 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | opt -analyze -scalar-evolution 2>&1 | grep -e '--> %b'
+; RUN: llvm-as < %s | opt -analyze -scalar-evolution |& grep -e {--> %b}
; PR1810
define void @fun() {
From djg at cray.com Mon Nov 26 18:50:58 2007
From: djg at cray.com (Dan Gohman)
Date: Tue, 27 Nov 2007 00:50:58 -0000
Subject: [llvm-commits] [llvm] r44345 - in /llvm/trunk/test/Verifier:
invoke-1.ll invoke-2.ll
Message-ID: <200711270050.lAR0oweB010963@zion.cs.uiuc.edu>
Author: djg
Date: Mon Nov 26 18:50:57 2007
New Revision: 44345
URL: http://llvm.org/viewvc/llvm-project?rev=44345&view=rev
Log:
Change &| to |&.
Modified:
llvm/trunk/test/Verifier/invoke-1.ll
llvm/trunk/test/Verifier/invoke-2.ll
Modified: llvm/trunk/test/Verifier/invoke-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/invoke-1.ll?rev=44345&r1=44344&r2=44345&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/invoke-1.ll (original)
+++ llvm/trunk/test/Verifier/invoke-1.ll Mon Nov 26 18:50:57 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-upgrade < %s | not llvm-as &| grep {not verify as correct}
+; RUN: llvm-upgrade < %s | not llvm-as |& grep {not verify as correct}
; PR1042
int %foo() {
Modified: llvm/trunk/test/Verifier/invoke-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/invoke-2.ll?rev=44345&r1=44344&r2=44345&view=diff
==============================================================================
--- llvm/trunk/test/Verifier/invoke-2.ll (original)
+++ llvm/trunk/test/Verifier/invoke-2.ll Mon Nov 26 18:50:57 2007
@@ -1,4 +1,4 @@
-; RUN: llvm-upgrade < %s | not llvm-as -f &| grep {not verify as correct}
+; RUN: llvm-upgrade < %s | not llvm-as -f |& grep {not verify as correct}
; PR1042
int %foo() {
From cfr at adobe.com Mon Nov 26 19:25:13 2007
From: cfr at adobe.com (Chuck Rose III)
Date: Tue, 27 Nov 2007 01:25:13 -0000
Subject: [llvm-commits] [llvm] r44346 -
/llvm/trunk/win32/TableGen/TableGen.vcproj
Message-ID: <200711270125.lAR1PD86012723@zion.cs.uiuc.edu>
Author: cfr
Date: Mon Nov 26 19:25:12 2007
New Revision: 44346
URL: http://llvm.org/viewvc/llvm-project?rev=44346&view=rev
Log:
Moving TGLexer.h from source to header file tab in TableGen project file
Modified:
llvm/trunk/win32/TableGen/TableGen.vcproj
Modified: llvm/trunk/win32/TableGen/TableGen.vcproj
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/TableGen/TableGen.vcproj?rev=44346&r1=44345&r2=44346&view=diff
==============================================================================
--- llvm/trunk/win32/TableGen/TableGen.vcproj (original)
+++ llvm/trunk/win32/TableGen/TableGen.vcproj Mon Nov 26 19:25:12 2007
@@ -420,10 +420,6 @@
>
-
-
@@ -490,6 +486,10 @@
>
+
+
From resistor at mac.com Mon Nov 26 21:33:41 2007
From: resistor at mac.com (Owen Anderson)
Date: Tue, 27 Nov 2007 03:33:41 -0000
Subject: [llvm-commits] [llvm] r44347 - in /llvm/trunk/include/llvm:
Analysis/Dominators.h CodeGen/MachineDominators.h
Message-ID: <200711270333.lAR3Xf89019995@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Nov 26 21:33:40 2007
New Revision: 44347
URL: http://llvm.org/viewvc/llvm-project?rev=44347&view=rev
Log:
Add accessor for getting the underlying templated type. This is necessary for templated LoopInfo.
Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/CodeGen/MachineDominators.h
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=44347&r1=44346&r2=44347&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Nov 26 21:33:40 2007
@@ -670,6 +670,8 @@
delete DT;
}
+ DominatorTreeBase& getBase() { return *DT; }
+
/// getRoots - Return the root blocks of the current CFG. This may include
/// multiple blocks if we are computing post dominators. For forward
/// dominators, this will always be a single block (the entry node).
Modified: llvm/trunk/include/llvm/CodeGen/MachineDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDominators.h?rev=44347&r1=44346&r2=44347&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineDominators.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineDominators.h Mon Nov 26 21:33:40 2007
@@ -54,10 +54,12 @@
delete DT;
}
- virtual void getAnalysisUsage(AnalysisUsage &AU) const {
- AU.setPreservesAll();
- MachineFunctionPass::getAnalysisUsage(AU);
- }
+ DominatorTreeBase& getBase() { return *DT; }
+
+ virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+ AU.setPreservesAll();
+ MachineFunctionPass::getAnalysisUsage(AU);
+ }
/// getRoots - Return the root blocks of the current CFG. This may include
/// multiple blocks if we are computing post dominators. For forward
From resistor at mac.com Mon Nov 26 21:43:36 2007
From: resistor at mac.com (Owen Anderson)
Date: Tue, 27 Nov 2007 03:43:36 -0000
Subject: [llvm-commits] [llvm] r44348 - in /llvm/trunk:
include/llvm/Analysis/LoopInfo.h lib/Analysis/LoopInfo.cpp
lib/Transforms/Scalar/LoopRotation.cpp lib/Transforms/Scalar/LoopUnroll.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
lib/Transforms/Utils/BasicBlockUtils.cpp
lib/Transforms/Utils/BreakCriticalEdges.cpp
lib/Transforms/Utils/CloneLoop.cpp lib/Transforms/Utils/LoopSimplify.cpp
Message-ID: <200711270343.lAR3ha8m020685@zion.cs.uiuc.edu>
Author: resistor
Date: Mon Nov 26 21:43:35 2007
New Revision: 44348
URL: http://llvm.org/viewvc/llvm-project?rev=44348&view=rev
Log:
Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
Modified:
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/lib/Analysis/LoopInfo.cpp
llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp
llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp
llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Mon Nov 26 21:43:35 2007
@@ -65,7 +65,7 @@
template
class LoopBase {
LoopBase *ParentLoop;
- std::vector*> SubLoops; // Loops contained entirely within this one
+ std::vector*> SubLoops; // Loops contained entirely within this one
std::vector Blocks; // First entry is the header node
LoopBase(const LoopBase &); // DO NOT IMPLEMENT
@@ -113,8 +113,10 @@
/// that is outside of the current loop.
///
bool isLoopExit(const BlockT *BB) const {
- for (succ_const_iterator SI = succ_begin(BB), SE = succ_end(BB);
- SI != SE; ++SI) {
+ typedef GraphTraits BlockTraits;
+ for (typename BlockTraits::ChildIteratorType SI =
+ BlockTraits::child_begin(const_cast(BB)),
+ SE = BlockTraits::child_end(const_cast(BB)); SI != SE; ++SI) {
if (!contains(*SI))
return true;
}
@@ -127,7 +129,10 @@
unsigned NumBackEdges = 0;
BlockT *H = getHeader();
- for (pred_iterator I = pred_begin(H), E = pred_end(H); I != E; ++I)
+ typedef GraphTraits > InvBlockTraits;
+ for (typename InvBlockTraits::ChildIteratorType I =
+ InvBlockTraits::child_begin(const_cast(H)),
+ E = InvBlockTraits::child_end(const_cast(H)); I != E; ++I)
if (contains(*I))
++NumBackEdges;
@@ -160,9 +165,12 @@
SmallVector LoopBBs(block_begin(), block_end());
std::sort(LoopBBs.begin(), LoopBBs.end());
+ typedef GraphTraits BlockTraits;
for (typename std::vector::const_iterator BI = Blocks.begin(),
BE = Blocks.end(); BI != BE; ++BI)
- for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I)
+ for (typename BlockTraits::ChildIteratorType I =
+ BlockTraits::child_begin(*BI), E = BlockTraits::child_end(*BI);
+ I != E; ++I)
if (!std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I)) {
// Not in current loop? It must be an exit block.
ExitingBlocks.push_back(*BI);
@@ -179,9 +187,12 @@
SmallVector LoopBBs(block_begin(), block_end());
std::sort(LoopBBs.begin(), LoopBBs.end());
+ typedef GraphTraits BlockTraits;
for (typename std::vector::const_iterator BI = Blocks.begin(),
BE = Blocks.end(); BI != BE; ++BI)
- for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I)
+ for (typename BlockTraits::ChildIteratorType I =
+ BlockTraits::child_begin(*BI), E = BlockTraits::child_end(*BI);
+ I != E; ++I)
if (!std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I))
// Not in current loop? It must be an exit block.
ExitBlocks.push_back(*I);
@@ -205,12 +216,17 @@
BlockT *current = *BI;
switchExitBlocks.clear();
- for (succ_iterator I = succ_begin(*BI), E = succ_end(*BI); I != E; ++I) {
+ typedef GraphTraits BlockTraits;
+ typedef GraphTraits > InvBlockTraits;
+ for (typename BlockTraits::ChildIteratorType I =
+ BlockTraits::child_begin(*BI), E = BlockTraits::child_end(*BI);
+ I != E; ++I) {
if (std::binary_search(LoopBBs.begin(), LoopBBs.end(), *I))
// If block is inside the loop then it is not a exit block.
continue;
-
- pred_iterator PI = pred_begin(*I);
+
+ typename InvBlockTraits::ChildIteratorType PI =
+ InvBlockTraits::child_begin(*I);
BlockT *firstPred = *PI;
// If current basic block is this exit block's first predecessor
@@ -223,7 +239,8 @@
// If a terminator has more then two successors, for example SwitchInst,
// then it is possible that there are multiple edges from current block
// to one exit block.
- if (current->getTerminator()->getNumSuccessors() <= 2) {
+ if (std::distance(BlockTraits::child_begin(current),
+ BlockTraits::child_end(current)) <= 2) {
ExitBlocks.push_back(*I);
continue;
}
@@ -253,8 +270,11 @@
// Loop over the predecessors of the header node...
BlockT *Header = getHeader();
- for (pred_iterator PI = pred_begin(Header), PE = pred_end(Header);
- PI != PE; ++PI)
+ typedef GraphTraits BlockTraits;
+ typedef GraphTraits > InvBlockTraits;
+ for (typename InvBlockTraits::ChildIteratorType PI =
+ InvBlockTraits::child_begin(Header),
+ PE = InvBlockTraits::child_end(Header); PI != PE; ++PI)
if (!contains(*PI)) { // If the block is not in the loop...
if (Out && Out != *PI)
return 0; // Multiple predecessors outside the loop
@@ -263,9 +283,9 @@
// Make sure there is only one exit out of the preheader.
assert(Out && "Header of loop has no predecessors from outside loop?");
- succ_iterator SI = succ_begin(Out);
+ typename BlockTraits::ChildIteratorType SI = BlockTraits::child_begin(Out);
++SI;
- if (SI != succ_end(Out))
+ if (SI != BlockTraits::child_end(Out))
return 0; // Multiple exits from the block, must not be a preheader.
// If there is exactly one preheader, return it. If there was zero, then Out
@@ -279,7 +299,11 @@
/// block.
BlockT *getLoopLatch() const {
BlockT *Header = getHeader();
- pred_iterator PI = pred_begin(Header), PE = pred_end(Header);
+ typedef GraphTraits > InvBlockTraits;
+ typename InvBlockTraits::ChildIteratorType PI =
+ InvBlockTraits::child_begin(Header);
+ typename InvBlockTraits::ChildIteratorType PE =
+ InvBlockTraits::child_end(Header);
if (PI == PE) return 0; // no preds?
BlockT *Latch = 0;
@@ -307,12 +331,15 @@
BlockT *H = getHeader();
BlockT *Incoming = 0, *Backedge = 0;
- pred_iterator PI = pred_begin(H);
- assert(PI != pred_end(H) && "Loop must have at least one backedge!");
+ typedef GraphTraits > InvBlockTraits;
+ typename InvBlockTraits::ChildIteratorType PI =
+ InvBlockTraits::child_begin(H);
+ assert(PI != InvBlockTraits::child_end(H) &&
+ "Loop must have at least one backedge!");
Backedge = *PI++;
- if (PI == pred_end(H)) return 0; // dead loop
+ if (PI == InvBlockTraits::child_end(H)) return 0; // dead loop
Incoming = *PI++;
- if (PI != pred_end(H)) return 0; // multiple backedges?
+ if (PI != InvBlockTraits::child_end(H)) return 0; // multiple backedges?
if (contains(Incoming)) {
if (contains(Backedge))
@@ -414,7 +441,7 @@
/// to the specified LoopInfo object as being in the current basic block. It
/// is not valid to replace the loop header with this method.
///
- void addBasicBlockToLoop(BlockT *NewBB, LoopInfo &LI);
+ void addBasicBlockToLoop(BlockT *NewBB, LoopInfoBase &LI);
/// replaceChildLoopWith - This is used when splitting loops up. It replaces
/// the OldChild entry in our children list with NewChild, and updates the
@@ -533,7 +560,7 @@
template
class LoopInfoBase {
// BBMap - Mapping of basic blocks to the inner most loop they occur in
- std::map BBMap;
+ std::map*> BBMap;
std::vector*> TopLevelLoops;
friend class LoopBase;
@@ -562,7 +589,7 @@
///
LoopBase *getLoopFor(const BlockT *BB) const {
typename std::map*>::const_iterator I=
- BBMap.find(const_cast(BB));
+ BBMap.find(const_cast(BB));
return I != BBMap.end() ? I->second : 0;
}
@@ -575,13 +602,13 @@
/// getLoopDepth - Return the loop nesting level of the specified block...
///
unsigned getLoopDepth(const BlockT *BB) const {
- const Loop *L = getLoopFor(BB);
+ const LoopBase *L = getLoopFor(BB);
return L ? L->getLoopDepth() : 0;
}
// isLoopHeader - True if the block is a loop header node
bool isLoopHeader(BlockT *BB) const {
- const Loop *L = getLoopFor(BB);
+ const LoopBase *L = getLoopFor(BB);
return L && L->getHeader() == BB;
}
@@ -630,7 +657,7 @@
void removeBlock(BlockT *BB) {
typename std::map*>::iterator I = BBMap.find(BB);
if (I != BBMap.end()) {
- for (Loop *L = I->second; L; L = L->getParentLoop())
+ for (LoopBase *L = I->second; L; L = L->getParentLoop())
L->removeBlockFromLoop(BB);
BBMap.erase(I);
@@ -639,13 +666,14 @@
// Internals
- static bool isNotAlreadyContainedIn(Loop *SubLoop, Loop *ParentLoop) {
+ static bool isNotAlreadyContainedIn(LoopBase *SubLoop,
+ LoopBase *ParentLoop) {
if (SubLoop == 0) return true;
if (SubLoop == ParentLoop) return false;
return isNotAlreadyContainedIn(SubLoop->getParentLoop(), ParentLoop);
}
- void Calculate(DominatorTree &DT) {
+ void Calculate(DominatorTreeBase &DT) {
BlockT *RootNode = DT.getRootNode()->getBlock();
for (df_iterator NI = df_begin(RootNode),
@@ -654,14 +682,17 @@
TopLevelLoops.push_back(L);
}
- LoopBase *ConsiderForLoop(BlockT *BB, DominatorTree &DT) {
+ LoopBase *ConsiderForLoop(BlockT *BB, DominatorTreeBase &DT) {
if (BBMap.find(BB) != BBMap.end()) return 0;// Haven't processed this node?
std::vector TodoStack;
// Scan the predecessors of BB, checking to see if BB dominates any of
// them. This identifies backedges which target this node...
- for (pred_iterator I = pred_begin(BB), E = pred_end(BB); I != E; ++I)
+ typedef GraphTraits > InvBlockTraits;
+ for (typename InvBlockTraits::ChildIteratorType I =
+ InvBlockTraits::child_begin(BB), E = InvBlockTraits::child_end(BB);
+ I != E; ++I)
if (DT.dominates(BB, *I)) // If BB dominates it's predecessor...
TodoStack.push_back(*I);
@@ -702,9 +733,12 @@
// Normal case, add the block to our loop...
L->Blocks.push_back(X);
-
+
+ typedef GraphTraits > InvBlockTraits;
+
// Add all of the predecessors of X to the end of the work stack...
- TodoStack.insert(TodoStack.end(), pred_begin(X), pred_end(X));
+ TodoStack.insert(TodoStack.end(), InvBlockTraits::child_begin(X),
+ InvBlockTraits::child_end(X));
}
}
@@ -826,7 +860,6 @@
LoopInfoBase* LI;
friend class LoopBase;
- LoopInfoBase& getBase() { return *LI; }
public:
static char ID; // Pass identification, replacement for typeid
@@ -836,6 +869,8 @@
~LoopInfo() { delete LI; }
+ LoopInfoBase& getBase() { return *LI; }
+
/// iterator/begin/end - The interface to the top-level loops in the current
/// function.
///
@@ -941,13 +976,11 @@
template
void LoopBase::addBasicBlockToLoop(BlockT *NewBB,
- LoopInfo &LI) {
- assert((Blocks.empty() || LI[getHeader()] == this) &&
+ LoopInfoBase &LIB) {
+ assert((Blocks.empty() || LIB[getHeader()] == this) &&
"Incorrect LI specified for this loop!");
assert(NewBB && "Cannot add a null basic block to the loop!");
- assert(LI[NewBB] == 0 && "BasicBlock already in the loop!");
-
- LoopInfoBase& LIB = LI.getBase();
+ assert(LIB[NewBB] == 0 && "BasicBlock already in the loop!");
// Add the loop mapping to the LoopInfo object...
LIB.BBMap[NewBB] = this;
Modified: llvm/trunk/lib/Analysis/LoopInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopInfo.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopInfo.cpp Mon Nov 26 21:43:35 2007
@@ -43,7 +43,7 @@
//
bool LoopInfo::runOnFunction(Function &) {
releaseMemory();
- LI->Calculate(getAnalysis()); // Update
+ LI->Calculate(getAnalysis().getBase()); // Update
return false;
}
Modified: llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopRotation.cpp Mon Nov 26 21:43:35 2007
@@ -451,7 +451,7 @@
NewHeader);
LoopInfo &LI = LPM.getAnalysis();
if (Loop *PL = LI.getLoopFor(OrigPreHeader))
- PL->addBasicBlockToLoop(NewPreHeader, LI);
+ PL->addBasicBlockToLoop(NewPreHeader, LI.getBase());
new BranchInst(NewHeader, NewPreHeader);
BranchInst *OrigPH_BI = cast(OrigPreHeader->getTerminator());
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Mon Nov 26 21:43:35 2007
@@ -358,7 +358,7 @@
VI != VE; ++VI)
LastValueMap[VI->first] = VI->second;
- L->addBasicBlockToLoop(New, *LI);
+ L->addBasicBlockToLoop(New, LI->getBase());
// Add phi entries for newly created values to all exit blocks except
// the successor of the latch block. The successor of the exit block will
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Nov 26 21:43:35 2007
@@ -542,7 +542,7 @@
for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
I != E; ++I)
if (LI->getLoopFor(*I) == L)
- New->addBasicBlockToLoop(cast(VM[*I]), *LI);
+ New->addBasicBlockToLoop(cast(VM[*I]), LI->getBase());
// Add all of the subloops to the new loop.
for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I)
@@ -793,14 +793,14 @@
if (ParentLoop) {
// Make sure to add the cloned preheader and exit blocks to the parent loop
// as well.
- ParentLoop->addBasicBlockToLoop(NewBlocks[0], *LI);
+ ParentLoop->addBasicBlockToLoop(NewBlocks[0], LI->getBase());
}
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
BasicBlock *NewExit = cast(ValueMap[ExitBlocks[i]]);
// The new exit block should be in the same loop as the old one.
if (Loop *ExitBBLoop = LI->getLoopFor(ExitBlocks[i]))
- ExitBBLoop->addBasicBlockToLoop(NewExit, *LI);
+ ExitBBLoop->addBasicBlockToLoop(NewExit, LI->getBase());
assert(NewExit->getTerminator()->getNumSuccessors() == 1 &&
"Exit block should have been split to have one successor!");
Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Mon Nov 26 21:43:35 2007
@@ -163,7 +163,7 @@
// The new block lives in whichever loop the old one did.
if (Loop *L = LI.getLoopFor(Old))
- L->addBasicBlockToLoop(New, LI);
+ L->addBasicBlockToLoop(New, LI.getBase());
if (DominatorTree *DT = P->getAnalysisToUpdate())
{
Modified: llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/BreakCriticalEdges.cpp Mon Nov 26 21:43:35 2007
@@ -250,13 +250,13 @@
if (Loop *DestLoop = LI->getLoopFor(DestBB)) {
if (TIL == DestLoop) {
// Both in the same loop, the NewBB joins loop.
- DestLoop->addBasicBlockToLoop(NewBB, *LI);
+ DestLoop->addBasicBlockToLoop(NewBB, LI->getBase());
} else if (TIL->contains(DestLoop->getHeader())) {
// Edge from an outer loop to an inner loop. Add to the outer loop.
- TIL->addBasicBlockToLoop(NewBB, *LI);
+ TIL->addBasicBlockToLoop(NewBB, LI->getBase());
} else if (DestLoop->contains(TIL->getHeader())) {
// Edge from an inner loop to an outer loop. Add to the outer loop.
- DestLoop->addBasicBlockToLoop(NewBB, *LI);
+ DestLoop->addBasicBlockToLoop(NewBB, LI->getBase());
} else {
// Edge from two loops with no containment relation. Because these
// are natural loops, we know that the destination block must be the
@@ -265,7 +265,7 @@
assert(DestLoop->getHeader() == DestBB &&
"Should not create irreducible loops!");
if (Loop *P = DestLoop->getParentLoop())
- P->addBasicBlockToLoop(NewBB, *LI);
+ P->addBasicBlockToLoop(NewBB, LI->getBase());
}
}
}
Modified: llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneLoop.cpp Mon Nov 26 21:43:35 2007
@@ -109,7 +109,7 @@
ValueMap[BB] = NewBB;
if (P)
LPM->cloneBasicBlockSimpleAnalysis(BB, NewBB, L);
- NewLoop->addBasicBlockToLoop(NewBB, *LI);
+ NewLoop->addBasicBlockToLoop(NewBB, LI->getBase());
NewBlocks.push_back(NewBB);
}
Modified: llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp?rev=44348&r1=44347&r2=44348&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/LoopSimplify.cpp Mon Nov 26 21:43:35 2007
@@ -380,7 +380,7 @@
// We know that we have loop information to update... update it now.
if (Loop *Parent = L->getParentLoop())
- Parent->addBasicBlockToLoop(NewBB, *LI);
+ Parent->addBasicBlockToLoop(NewBB, LI->getBase());
DT->splitBlock(NewBB);
if (DominanceFrontier *DF = getAnalysisToUpdate())
@@ -412,7 +412,7 @@
while (SuccLoop && !SuccLoop->contains(L->getHeader()))
SuccLoop = SuccLoop->getParentLoop();
if (SuccLoop)
- SuccLoop->addBasicBlockToLoop(NewBB, *LI);
+ SuccLoop->addBasicBlockToLoop(NewBB, LI->getBase());
// Update Dominator Information
DT->splitBlock(NewBB);
@@ -558,7 +558,7 @@
// This block is going to be our new header block: add it to this loop and all
// parent loops.
- NewOuter->addBasicBlockToLoop(NewBB, *LI);
+ NewOuter->addBasicBlockToLoop(NewBB, LI->getBase());
// L is now a subloop of our outer loop.
NewOuter->addChildLoop(L);
@@ -693,7 +693,7 @@
// Update Loop Information - we know that this block is now in the current
// loop and all parent loops.
- L->addBasicBlockToLoop(BEBlock, *LI);
+ L->addBasicBlockToLoop(BEBlock, LI->getBase());
// Update dominator information
DT->splitBlock(BEBlock);
From sabre at nondot.org Tue Nov 27 00:14:13 2007
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 27 Nov 2007 06:14:13 -0000
Subject: [llvm-commits] [llvm] r44351 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200711270614.lAR6EDfT028881@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Nov 27 00:14:12 2007
New Revision: 44351
URL: http://llvm.org/viewvc/llvm-project?rev=44351&view=rev
Log:
don't depend on ADL.
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=44351&r1=44350&r2=44351&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Nov 27 00:14:12 2007
@@ -1915,7 +1915,7 @@
SI.getSuccessorValue(i),
SMBB));
}
- std::sort(Cases.begin(), Cases.end(), CaseCmp());
+ sort(Cases.begin(), Cases.end(), CaseCmp());
// Merge case into clusters
if (Cases.size()>=2)
From sabre at nondot.org Tue Nov 27 00:14:32 2007
From: sabre at nondot.org (Chris Lattner)
Date: Tue, 27 Nov 2007 06:14:32 -0000
Subject: [llvm-commits] [llvm] r44352 -
/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Message-ID: <200711270614.lAR6EWPA028921@zion.cs.uiuc.edu>
Author: lattner
Date: Tue Nov 27 00:14:32 2007
New Revision: 44352
URL: http://llvm.org/viewvc/llvm-project?rev=44352&view=rev
Log:
err, no really.
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=44352&r1=44351&r2=44352&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Nov 27 00:14:32 2007
@@ -1915,7 +1915,7 @@
SI.getSuccessorValue(i),
SMBB));
}
- sort(Cases.begin(), Cases.end(), CaseCmp());
+ std::sort(Cases.begin(), Cases.end(), CaseCmp());
// Merge case into clusters
if (Cases.size()>=2)
From zhousheng00 at gmail.com Tue Nov 27 00:17:02 2007
From: zhousheng00 at gmail.com (Zhou Sheng)
Date: Tue, 27 Nov 2007 06:17:02 -0000
Subject: [llvm-commits] [llvm] r44353 -
/llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
Message-ID: <200711270617.lAR6H2EB029102@zion.cs.uiuc.edu>
Author: sheng
Date: Tue Nov 27 00:17:01 2007
New Revision: 44353
URL: http://llvm.org/viewvc/llvm-project?rev=44353&view=rev
Log:
Make this testcase compatible with CYGWIN.
Modified:
llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
Modified: llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c?rev=44353&r1=44352&r2=44353&view=diff
==============================================================================
--- llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c (original)
+++ llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c Tue Nov 27 00:17:01 2007
@@ -8,7 +8,11 @@
//
// XFAIL: sparc
-#include
+#ifdef __CYGWIN__
+ #include
+#else
+ #include
+#endif
int foo(complex float c) {
return creal(c);
From echristo at apple.com Tue Nov 27 00:22:29 2007
From: echristo at apple.com (Eric Christopher)
Date: Mon, 26 Nov 2007 22:22:29 -0800
Subject: [llvm-commits] [llvm] r44353 -
/llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
In-Reply-To: <200711270617.lAR6H2EB029102@zion.cs.uiuc.edu>
References: <200711270617.lAR6H2EB029102@zion.cs.uiuc.edu>
Message-ID: <03D4045C-7101-46DA-B73E-B379C56E312F@apple.com>
> //
> // XFAIL: sparc
>
> -#include
> +#ifdef __CYGWIN__
> + #include
> +#else
> + #include
> +#endif
IIRC this isn't quite right, you can't depend on mingw with cygwin. I
think cygwin
should have a complex.h, if you want to make this work for mingw then
you should use __MINGW32__.
-eric
From zhousheng00 at gmail.com Tue Nov 27 00:23:59 2007
From: zhousheng00 at gmail.com (Zhou Sheng)
Date: Tue, 27 Nov 2007 06:23:59 -0000
Subject: [llvm-commits] [llvm] r44354 -
/llvm/trunk/test/CFrontend/extern-weak.c
Message-ID: <200711270623.lAR6Nxoi029422@zion.cs.uiuc.edu>
Author: sheng
Date: Tue Nov 27 00:23:59 2007
New Revision: 44354
URL: http://llvm.org/viewvc/llvm-project?rev=44354&view=rev
Log:
Make this pass for CYGWIN.
Modified:
llvm/trunk/test/CFrontend/extern-weak.c
Modified: llvm/trunk/test/CFrontend/extern-weak.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/extern-weak.c?rev=44354&r1=44353&r2=44354&view=diff
==============================================================================
--- llvm/trunk/test/CFrontend/extern-weak.c (original)
+++ llvm/trunk/test/CFrontend/extern-weak.c Tue Nov 27 00:23:59 2007
@@ -1,7 +1,8 @@
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | llvm-as | llc
-#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
+#if !defined(__linux__) && !defined(__FreeBSD__) && \
+ !defined(__OpenBSD__) && !defined(__CYGWIN__)
void foo() __attribute__((weak_import));
#else
void foo() __attribute__((weak));
From clattner at apple.com Tue Nov 27 00:31:51 2007
From: clattner at apple.com (Chris Lattner)
Date: Mon, 26 Nov 2007 22:31:51 -0800
Subject: [llvm-commits] PR889 patch
In-Reply-To:
References:
Message-ID:
On Nov 26, 2007, at 4:46 AM, pawel kunio wrote:
> Hello,
> Please find attached the changelist for PR889. As suggested in
> bugzilla, I devirtualized the Value destructor, renamed the
> destructors of Value-inherited classes to static destroythis methods,
> added the code for type checking and destroythis scheduling to Value
> destructor.
> Currently i am not full-time available for this project but I will try
> to get some new tasks on llvmdev mailing list, as time allows.
Very nice work Pawel!
Some specific comments:
--- include/llvm/BasicBlock.h (revision 44322)
+++ include/llvm/BasicBlock.h (working copy)
@@ -76,7 +76,7 @@
///
explicit BasicBlock(const std::string &Name = "", Function *Parent
= 0,
BasicBlock *InsertBefore = 0);
- ~BasicBlock();
+ static void destroythis(BasicBlock*);
Can this and other instances of 'destroyThis' be made private or
protected? I think only the ~Value() method should be public. This
may require making Value a friend of everything, but that is less
confusing than having this as a public method.
Index: include/llvm/Constants.h
===================================================================
--- include/llvm/Constants.h (revision 44322)
+++ include/llvm/Constants.h (working copy)
@@ -24,6 +24,7 @@
#include "llvm/Type.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APFloat.h"
+#include "llvm/Instructions.h"
Please don't add this #include. Instead, use forward declarations and
move code that needs it out of line (I think that moving the
GetElementPtrConstantExpr ctor out of line would be enough?)
+/// GetElementPtrConstantExpr - Helper class for Constants.cpp, and is
+/// used behind the scenes to implement getelementpr constant exprs.
+struct GetElementPtrConstantExpr : public ConstantExpr {
+ GetElementPtrConstantExpr(Constant *C, const std::vector
&IdxList,
+ const Type *DestTy)
Please define this as a 'class' and use "public" instead of a
'struct'. This improves compatibility with MSVC++.
--- include/llvm/InlineAsm.h (revision 44322)
+++ include/llvm/InlineAsm.h (working copy)
@@ -36,7 +36,8 @@
InlineAsm(const FunctionType *Ty, const std::string &AsmString,
const std::string &Constraints, bool hasSideEffects);
- virtual ~InlineAsm();
+ //static void destroythis(InlineAsm*);
+ //friend Value;
public:
Please remove :), like wise in UnaryInstruction.
+++ include/llvm/Value.h (working copy)
@@ -64,14 +64,17 @@
friend class ValueSymbolTable; // Allow ValueSymbolTable to
directly mod Name.
friend class SymbolTable; // Allow SymbolTable to directly
poke Name.
- ValueName *Name;
+public:
+ ValueName *Name;
Why does this need to be public? If it really needs to be public,
please add a comment explaining why. Also, please remove the tab.
+void ConstantArray::destroythis(ConstantArray*v)
+{
+ delete [] v->OperandList;
}
Unlike destructors, we don't get free "Chaining" of destruction up
through parent classes for free. I think it would be better to
explicitly model the class hierarchy here, with something like:
+void ConstantArray::destroythis(ConstantArray*v)
+{
+ delete [] v->OperandList;
Constant::destroyThis(v);
}
And implement destroyThis for every class (even if it's a trivial
empty forwarding method that just calls destroyThis on its immediate
parent class). What do you think?
+Value::~Value()
+{
+ if(SubclassID == BasicBlockVal)
+ {
+ BasicBlock::destroythis((BasicBlock*)this);
+ }
+ else if(SubclassID == ConstantArrayVal)
+ {
Why not use a switch on subclassid?
+ else if(SubclassID == ConstantExprVal && ((ConstantExpr*)this)-
>SubclassData == Instruction::GetElementPtr)
I'd much prefer that this look like this:
case ConstantExprVal:
if (cast(this)->getOpcode() ==
Instruction::GetElementPtr)
...
+ else if(SubclassID >= InstructionVal)
+ {
+ if(SubclassID == InstructionVal + Instruction::Call)
+ {
+ CallInst::destroythis((CallInst*)this);
+ }
+ else if(SubclassID == InstructionVal + Instruction::PHI)
Likewise, this can be:
default:
if (CallInst *CI = dyn_cast(this))
CallInst::destroyThis(CI);
else if (PHINode *PN = dyn_cast(this))
PHINode::destroyThis(PN);
..
else
Instruction::destroyThis(PN);
I really think it is cleaner if CallInst::destroyThis itself chains to
Instruction::destroyThis, instead of having ~Value do it.
Thanks for tackling this project, it will be very nice to shrinkify
everything!
-Chris
From clattner at apple.com Tue Nov 27 00:33:18 2007
From: clattner at apple.com (Chris Lattner)
Date: Mon, 26 Nov 2007 22:33:18 -0800
Subject: [llvm-commits] [llvm] r44354
- /llvm/trunk/test/CFrontend/extern-weak.c
In-Reply-To: <200711270623.lAR6Nxoi029422@zion.cs.uiuc.edu>
References: <200711270623.lAR6Nxoi029422@zion.cs.uiuc.edu>
Message-ID: <6BB0F51B-9FF2-464C-AA98-CD499E8AC99E@apple.com>
On Nov 26, 2007, at 10:23 PM, Zhou Sheng wrote:
> Author: sheng
> Date: Tue Nov 27 00:23:59 2007
> New Revision: 44354
>
> URL: http://llvm.org/viewvc/llvm-project?rev=44354&view=rev
> Log:
> Make this pass for CYGWIN.
Would this be better written as:
#if defined(__APPLE__)
void foo() __attribute__((weak_import));
#else
void foo() __attribute__((weak));
#endif
?
Does any other platform use weak_import?
-Chris
From asl at math.spbu.ru Tue Nov 27 02:58:57 2007
From: asl at math.spbu.ru (Anton Korobeynikov)
Date: Tue, 27 Nov 2007 11:58:57 +0300
Subject: [llvm-commits] [llvm] r44353
- /llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
In-Reply-To: <03D4045C-7101-46DA-B73E-B379C56E312F.SS496SS@apple.com>
References: <200711270617.lAR6H2EB029102@zion.cs.uiuc.edu>
<03D4045C-7101-46DA-B73E-B379C56E312F.SS496SS@apple.com>
Message-ID: <1196153937.10604.3.camel@asl.dorms.spbu.ru>
Hello,
> IIRC this isn't quite right, you can't depend on mingw with cygwin. I
> think cygwin
> should have a complex.h, if you want to make this work for mingw then
> you should use __MINGW32__.
This pretty much looks like cygwin-related stuff. Actually it needs to
store two sets of headers - "native" and mingw, thus such directory.
My mingw32 installation has complex.h, not mingw/complex.h. However, I
don't understand, why cygwin doesn't have it's complex.h and test should
use mingw-provided one.
--
With best regards, Anton Korobeynikov.
Faculty of Mathematics & Mechanics, Saint Petersburg State University.
From echristo at apple.com Tue Nov 27 03:22:06 2007
From: echristo at apple.com (Eric Christopher)
Date: Tue, 27 Nov 2007 01:22:06 -0800
Subject: [llvm-commits] [llvm] r44353 -
/llvm/trunk/test/CFrontend/2005-02-20-AggregateSAVEEXPR.c
In-Reply-To: <1196153937.10604.3.camel@asl.dorms.spbu.ru>
References: <200711270617.lAR6H2EB029102@zion.cs.uiuc.edu>
<03D4045C-7101-46DA-B73E-B379C56E312F.SS496SS@apple.com>
<1196153937.10604.3.camel@asl.dorms.spbu.ru>
Message-ID:
>>
> This pretty much looks like cygwin-related stuff. Actually it needs to
> store two sets of headers - "native" and mingw, thus such directory.
>
> My mingw32 installation has complex.h, not mingw/complex.h. However, I
> don't understand, why cygwin doesn't have it's complex.h and test
> should
> use mingw-provided one.
Agreed, I thought it did. It has been a while since I've had a cygwin
box though. I can ask those guys tomorrow though.
-eric
From baldrick at free.fr Tue Nov 27 07:23:12 2007
From: baldrick at free.fr (Duncan Sands)
Date: Tue, 27 Nov 2007 13:23:12 -0000
Subject: [llvm-commits] [llvm] r44359 - in /llvm/trunk: docs/ include/llvm/
include/llvm/Support/ lib/Analysis/ lib/AsmParser/ lib/Bitcode/Reader/
lib/Bitcode/Writer/ lib/CodeGen/SelectionDAG/ lib/Linker/
lib/Target/CBackend/ lib/Target/MSIL/ lib/Target/X86/ lib/Transforms/IPO/
lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ test/Assembler/
test/Feature/ test/Integer/ test/Transforms/SimplifyCFG/
tools/llvm-upgrade/ tools/llvm2cpp/
Message-ID: <200711271323.lARDNHq8025649@zion.cs.uiuc.edu>
Author: baldrick
Date: Tue Nov 27 07:23:08 2007
New Revision: 44359
URL: http://llvm.org/viewvc/llvm-project?rev=44359&view=rev
Log:
Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls. This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll). Hopefully
a bitcode guru (who might that be? :) ) will fix it.
Added:
llvm/trunk/test/Assembler/2007-11-26-AttributeOverload.ll
llvm/trunk/test/Assembler/2007-11-27-AutoUpgradeAttributes.ll
Modified:
llvm/trunk/docs/LangRef.html
llvm/trunk/include/llvm/DerivedTypes.h
llvm/trunk/include/llvm/Function.h
llvm/trunk/include/llvm/Instructions.h
llvm/trunk/include/llvm/ParameterAttributes.h
llvm/trunk/include/llvm/Support/CallSite.h
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs
llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs
llvm/trunk/lib/AsmParser/llvmAsmParser.y
llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
llvm/trunk/lib/Linker/LinkModules.cpp
llvm/trunk/lib/Target/CBackend/CBackend.cpp
llvm/trunk/lib/Target/MSIL/MSILWriter.cpp
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp
llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp
llvm/trunk/lib/Transforms/IPO/ExtractFunction.cpp
llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp
llvm/trunk/lib/Transforms/IPO/PruneEH.cpp
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp
llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp
llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp
llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/trunk/lib/VMCore/AsmWriter.cpp
llvm/trunk/lib/VMCore/AutoUpgrade.cpp
llvm/trunk/lib/VMCore/Function.cpp
llvm/trunk/lib/VMCore/Instructions.cpp
llvm/trunk/lib/VMCore/Type.cpp
llvm/trunk/lib/VMCore/Verifier.cpp
llvm/trunk/test/Assembler/2006-05-26-VarargsCallEncode.ll
llvm/trunk/test/Assembler/2007-02-07-UpgradeCSRETCC.ll
llvm/trunk/test/Feature/paramattrs.ll
llvm/trunk/test/Integer/paramattrs_bt.ll
llvm/trunk/test/Transforms/SimplifyCFG/2006-10-29-InvokeCrash.ll
llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs
llvm/trunk/tools/llvm-upgrade/UpgradeParser.h.cvs
llvm/trunk/tools/llvm-upgrade/UpgradeParser.y
llvm/trunk/tools/llvm-upgrade/UpgradeParser.y.cvs
llvm/trunk/tools/llvm2cpp/CppWriter.cpp
Modified: llvm/trunk/docs/LangRef.html
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/docs/LangRef.html (original)
+++ llvm/trunk/docs/LangRef.html Tue Nov 27 07:23:08 2007
@@ -764,9 +764,9 @@
The return type and each parameter of a function type may have a set of
parameter attributes associated with them. Parameter attributes are
used to communicate additional information about the result or parameters of
- a function. Parameter attributes are considered to be part of the function
- type so two functions types that differ only by the parameter attributes
- are different function types.
+ a function. Parameter attributes are considered to be part of the function,
+ not of the function type, so functions with different parameter attributes
+ can have the same function type.
Parameter attributes are simple keywords that follow the type specified. If
multiple parameter attributes are needed, they are space separated. For
@@ -774,15 +774,13 @@
-%someFunc = i16 (i8 signext %someParam) zeroext
-%someFunc = i16 (i8 zeroext %someParam) zeroext
+declare i32 @printf(i8* noalias , ...) nounwind
+declare i32 @atoi(i8*) nounwind readonly
- Note that the two function types above are unique because the parameter has
- a different attribute (signext in the first one, zeroext in
- the second). Also note that the attribute for the function result
- (zeroext) comes immediately after the argument list.
+ Note that any attributes for the function result (nounwind,
+ readonly) come immediately after the argument list.
Currently, only the following parameter attributes are defined:
Modified: llvm/trunk/include/llvm/DerivedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DerivedTypes.h (original)
+++ llvm/trunk/include/llvm/DerivedTypes.h Tue Nov 27 07:23:08 2007
@@ -31,7 +31,6 @@
class VectorValType;
class IntegerValType;
class APInt;
-class ParamAttrsList;
class DerivedType : public Type {
friend class Type;
@@ -140,12 +139,11 @@
class FunctionType : public DerivedType {
friend class TypeMap;
bool isVarArgs;
- const ParamAttrsList *ParamAttrs;
FunctionType(const FunctionType &); // Do not implement
const FunctionType &operator=(const FunctionType &); // Do not implement
FunctionType(const Type *Result, const std::vector &Params,
- bool IsVarArgs, const ParamAttrsList *Attrs = 0);
+ bool IsVarArgs);
public:
/// FunctionType::get - This static method is the primary way of constructing
@@ -154,12 +152,7 @@
static FunctionType *get(
const Type *Result, ///< The result type
const std::vector &Params, ///< The types of the parameters
- bool isVarArg, ///< Whether this is a variable argument length function
- const ParamAttrsList *Attrs = 0
- ///< Indicates the parameter attributes to use, if any. The 0th entry
- ///< in the list refers to the return type. Parameters are numbered
- ///< starting at 1. This argument must be on the heap and FunctionType
- ///< owns it after its passed here.
+ bool isVarArg ///< Whether this is a variable argument length function
);
inline bool isVarArg() const { return isVarArgs; }
@@ -177,14 +170,6 @@
///
unsigned getNumParams() const { return NumContainedTys - 1; }
- bool isStructReturn() const;
-
- /// The parameter attributes for the \p ith parameter are returned. The 0th
- /// parameter refers to the return type of the function.
- /// @returns The ParameterAttributes for the \p ith parameter.
- /// @brief Get the attributes for a parameter
- const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
-
// Implement the AbstractTypeUser interface.
virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
virtual void typeBecameConcrete(const DerivedType *AbsTy);
Modified: llvm/trunk/include/llvm/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Function.h (original)
+++ llvm/trunk/include/llvm/Function.h Tue Nov 27 07:23:08 2007
@@ -68,7 +68,7 @@
BasicBlockListType BasicBlocks; ///< The basic blocks
mutable ArgumentListType ArgumentList; ///< The formal arguments
ValueSymbolTable *SymTab; ///< Symbol table of args/instructions
- ParamAttrsList *ParamAttrs; ///< Parameter attributes
+ const ParamAttrsList *ParamAttrs; ///< Parameter attributes
// The Calling Convention is stored in Value::SubclassData.
/*unsigned CallingConvention;*/
@@ -150,7 +150,10 @@
/// Sets the parameter attributes for this Function. To construct a
/// ParamAttrsList, see ParameterAttributes.h
/// @brief Set the parameter attributes.
- void setParamAttrs(ParamAttrsList *attrs);
+ void setParamAttrs(const ParamAttrsList *attrs);
+
+ /// @brief Determine if the function returns a structure.
+ bool isStructReturn() const;
/// deleteBody - This method deletes the body of the function, and converts
/// the linkage to external.
Modified: llvm/trunk/include/llvm/Instructions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Instructions.h (original)
+++ llvm/trunk/include/llvm/Instructions.h Tue Nov 27 07:23:08 2007
@@ -836,7 +836,7 @@
///
class CallInst : public Instruction {
- ParamAttrsList *ParamAttrs; ///< parameter attributes for call
+ const ParamAttrsList *ParamAttrs; ///< parameter attributes for call
CallInst(const CallInst &CI);
void init(Value *Func, Value* const *Params, unsigned NumParams);
void init(Value *Func, Value *Actual1, Value *Actual2);
@@ -916,12 +916,15 @@
/// parameter attributes information, if any.
/// @returns 0 if no attributes have been set.
/// @brief Get the parameter attributes.
- ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
+ const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
/// Sets the parameter attributes for this CallInst. To construct a
/// ParamAttrsList, see ParameterAttributes.h
/// @brief Set the parameter attributes.
- void setParamAttrs(ParamAttrsList *attrs);
+ void setParamAttrs(const ParamAttrsList *attrs);
+
+ /// @brief Determine if the call returns a structure.
+ bool isStructReturn() const;
/// getCalledFunction - Return the function being called by this instruction
/// if it is a direct call. If it is a call through a function pointer,
@@ -1620,7 +1623,7 @@
/// calling convention of the call.
///
class InvokeInst : public TerminatorInst {
- ParamAttrsList *ParamAttrs;
+ const ParamAttrsList *ParamAttrs;
InvokeInst(const InvokeInst &BI);
void init(Value *Fn, BasicBlock *IfNormal, BasicBlock *IfException,
Value* const *Args, unsigned NumArgs);
@@ -1691,12 +1694,15 @@
/// parameter attributes information, if any.
/// @returns 0 if no attributes have been set.
/// @brief Get the parameter attributes.
- ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
+ const ParamAttrsList *getParamAttrs() const { return ParamAttrs; }
/// Sets the parameter attributes for this InvokeInst. To construct a
/// ParamAttrsList, see ParameterAttributes.h
/// @brief Set the parameter attributes.
- void setParamAttrs(ParamAttrsList *attrs);
+ void setParamAttrs(const ParamAttrsList *attrs);
+
+ /// @brief Determine if the call returns a structure.
+ bool isStructReturn() const;
/// getCalledFunction - Return the function called, or null if this is an
/// indirect function invocation.
Modified: llvm/trunk/include/llvm/ParameterAttributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ParameterAttributes.h (original)
+++ llvm/trunk/include/llvm/ParameterAttributes.h Tue Nov 27 07:23:08 2007
@@ -77,7 +77,7 @@
/// with a parameter index.
/// @brief ParameterAttributes with a parameter index.
struct ParamAttrsWithIndex {
- uint16_t attrs; ///< The attributes that are set, |'d together
+ uint16_t attrs; ///< The attributes that are set, or'd together
uint16_t index; ///< Index of the parameter for which the attributes apply
static ParamAttrsWithIndex get(uint16_t idx, uint16_t attrs) {
@@ -219,6 +219,13 @@
/// @brief Return the number of parameter attributes this type has.
unsigned size() const { return attrs.size(); }
+ /// @brief Return the number of references to this ParamAttrsList.
+ unsigned numRefs() const { return refCount; }
+
+ /// @}
+ /// @name Mutators
+ /// @{
+ public:
/// Classes retaining references to ParamAttrsList objects should call this
/// method to increment the reference count. This ensures that the
/// ParamAttrsList object will not disappear until the class drops it.
Modified: llvm/trunk/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CallSite.h (original)
+++ llvm/trunk/include/llvm/Support/CallSite.h Tue Nov 27 07:23:08 2007
@@ -27,6 +27,7 @@
class CallInst;
class InvokeInst;
+class ParamAttrsList;
class CallSite {
Instruction *I;
@@ -57,6 +58,11 @@
unsigned getCallingConv() const;
void setCallingConv(unsigned CC);
+ /// getParamAttrs/setParamAttrs - get or set the parameter attributes of
+ /// the call.
+ const ParamAttrsList *getParamAttrs() const;
+ void setParamAttrs(const ParamAttrsList *PAL);
+
/// getType - Return the type of the instruction that generated this call site
///
const Type *getType() const { return I->getType(); }
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Tue Nov 27 07:23:08 2007
@@ -268,7 +268,7 @@
static bool isNoAliasArgument(const Argument *Arg) {
const Function *Func = Arg->getParent();
- const ParamAttrsList *Attr = Func->getFunctionType()->getParamAttrs();
+ const ParamAttrsList *Attr = Func->getParamAttrs();
if (Attr) {
unsigned Idx = 1;
for (Function::const_arg_iterator I = Func->arg_begin(),
@@ -839,7 +839,7 @@
return UnknownModRefBehavior;
}
- const ParamAttrsList *Attrs = F->getFunctionType()->getParamAttrs();
+ const ParamAttrsList *Attrs = F->getParamAttrs();
if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ReadNone))
return DoesNotAccessMemory;
if (Attrs && Attrs->paramHasAttr(0, ParamAttr::ReadOnly))
Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=44359&r1=44358&r2=44359&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original)
+++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Tue Nov 27 07:23:08 2007
@@ -214,8 +214,8 @@
NOALIAS = 395,
BYVAL = 396,
NEST = 397,
- CONST = 398,
- PURE = 399,
+ READNONE = 398,
+ READONLY = 399,
DEFAULT = 400,
HIDDEN = 401,
PROTECTED = 402
@@ -362,8 +362,8 @@
#define NOALIAS 395
#define BYVAL 396
#define NEST 397
-#define CONST 398
-#define PURE 399
+#define READNONE 398
+#define READONLY 399
#define DEFAULT 400
#define HIDDEN 401
#define PROTECTED 402
@@ -372,7 +372,7 @@
/* Copy the first part of user declarations. */
-#line 14 "/llvm/lib/AsmParser/llvmAsmParser.y"
+#line 14 "/home/duncan/LLVM/llvm.top/llvm/lib/AsmParser/llvmAsmParser.y"
#include "ParserInternals.h"
#include "llvm/CallingConv.h"
@@ -391,9 +391,6 @@
#include
#include