From 3717aa5ddbf9bd5b14f9604b5bd0803dc7e8fe8a Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sat, 11 Jun 2016 19:17:15 +0000 Subject: 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 --- polly/lib/CodeGen/IslNodeBuilder.cpp | 37 ++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'polly/lib/CodeGen/IslNodeBuilder.cpp') 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 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 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; -- cgit v1.2.3