summaryrefslogtreecommitdiffstats
path: root/polly/lib/CodeGen/IslNodeBuilder.cpp
diff options
context:
space:
mode:
authorTobias Grosser <tobias@grosser.es>2016-06-11 19:17:15 +0000
committerTobias Grosser <tobias@grosser.es>2016-06-11 19:17:15 +0000
commit3717aa5ddbf9bd5b14f9604b5bd0803dc7e8fe8a (patch)
tree2d274550963818cd6987ea447de338ba1cb68c5c /polly/lib/CodeGen/IslNodeBuilder.cpp
parent594ffa3d368ef069f56916fc126ae43493a8fb7f (diff)
downloadbcm5719-llvm-3717aa5ddbf9bd5b14f9604b5bd0803dc7e8fe8a.tar.gz
bcm5719-llvm-3717aa5ddbf9bd5b14f9604b5bd0803dc7e8fe8a.zip
This reverts recent expression type changes
The recent expression type changes still need more discussion, which will happen on phabricator or on the mailing list. The precise list of commits reverted are: - "Refactor division generation code" - "[NFC] Generate runtime checks after the SCoP" - "[FIX] Determine insertion point during SCEV expansion" - "Look through IntToPtr & PtrToInt instructions" - "Use minimal types for generated expressions" - "Temporarily promote values to i64 again" - "[NFC] Avoid unnecessary comparison for min/max expressions" - "[Polly] Fix -Wunused-variable warnings (NFC)" - "[NFC] Simplify min/max expression generation" - "Simplify the type adjustment in the IslExprBuilder" Some of them are just reverted as we would otherwise get conflicts. I will try to re-commit them if possible. llvm-svn: 272483
Diffstat (limited to 'polly/lib/CodeGen/IslNodeBuilder.cpp')
-rw-r--r--polly/lib/CodeGen/IslNodeBuilder.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/polly/lib/CodeGen/IslNodeBuilder.cpp b/polly/lib/CodeGen/IslNodeBuilder.cpp
index b73ed3f53a0..8ef6476b344 100644
--- a/polly/lib/CodeGen/IslNodeBuilder.cpp
+++ b/polly/lib/CodeGen/IslNodeBuilder.cpp
@@ -390,11 +390,14 @@ void IslNodeBuilder::createForVector(__isl_take isl_ast_node *For,
Value *ValueLB = ExprBuilder.create(Init);
Value *ValueInc = ExprBuilder.create(Inc);
- CmpInst::Predicate Predicate;
- auto *UB = getUpperBound(For, Predicate);
- auto *ValueUB = ExprBuilder.create(UB);
+ Type *MaxType = ExprBuilder.getType(Iterator);
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
- ExprBuilder.unifyTypes(ValueLB, ValueUB, ValueInc);
+ if (MaxType != ValueLB->getType())
+ ValueLB = Builder.CreateSExt(ValueLB, MaxType);
+ if (MaxType != ValueInc->getType())
+ ValueInc = Builder.CreateSExt(ValueInc, MaxType);
std::vector<Value *> IVS(VectorWidth);
IVS[0] = ValueLB;
@@ -442,6 +445,7 @@ void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For,
isl_ast_expr *Init, *Inc, *Iterator, *UB;
isl_id *IteratorID;
Value *ValueLB, *ValueUB, *ValueInc;
+ Type *MaxType;
BasicBlock *ExitBlock;
Value *IV;
CmpInst::Predicate Predicate;
@@ -468,7 +472,17 @@ void IslNodeBuilder::createForSequential(__isl_take isl_ast_node *For,
ValueUB = ExprBuilder.create(UB);
ValueInc = ExprBuilder.create(Inc);
- ExprBuilder.unifyTypes(ValueLB, ValueUB, ValueInc);
+ MaxType = ExprBuilder.getType(Iterator);
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueUB->getType());
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
+
+ if (MaxType != ValueLB->getType())
+ ValueLB = Builder.CreateSExt(ValueLB, MaxType);
+ if (MaxType != ValueUB->getType())
+ ValueUB = Builder.CreateSExt(ValueUB, MaxType);
+ if (MaxType != ValueInc->getType())
+ ValueInc = Builder.CreateSExt(ValueInc, MaxType);
// If we can show that LB <Predicate> UB holds at least once, we can
// omit the GuardBB in front of the loop.
@@ -540,6 +554,7 @@ void IslNodeBuilder::createForParallel(__isl_take isl_ast_node *For) {
isl_ast_expr *Init, *Inc, *Iterator, *UB;
isl_id *IteratorID;
Value *ValueLB, *ValueUB, *ValueInc;
+ Type *MaxType;
Value *IV;
CmpInst::Predicate Predicate;
@@ -568,7 +583,17 @@ void IslNodeBuilder::createForParallel(__isl_take isl_ast_node *For) {
ValueUB = Builder.CreateAdd(
ValueUB, Builder.CreateSExt(Builder.getTrue(), ValueUB->getType()));
- ExprBuilder.unifyTypes(ValueLB, ValueUB, ValueInc);
+ MaxType = ExprBuilder.getType(Iterator);
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueLB->getType());
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueUB->getType());
+ MaxType = ExprBuilder.getWidestType(MaxType, ValueInc->getType());
+
+ if (MaxType != ValueLB->getType())
+ ValueLB = Builder.CreateSExt(ValueLB, MaxType);
+ if (MaxType != ValueUB->getType())
+ ValueUB = Builder.CreateSExt(ValueUB, MaxType);
+ if (MaxType != ValueInc->getType())
+ ValueInc = Builder.CreateSExt(ValueInc, MaxType);
BasicBlock::iterator LoopBody;
OpenPOWER on IntegriCloud