[PATCH] D42129: [polly] [ScopInfo] Don't use isl_val_get_num_si.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 14:00:56 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322766: [polly] [ScopInfo] Don't use isl_val_get_num_si. (authored by efriedma, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42129?vs=130022&id=130268#toc
Repository:
rL LLVM
https://reviews.llvm.org/D42129
Files:
polly/trunk/lib/Analysis/ScopInfo.cpp
polly/trunk/test/ScopInfo/multidim_fold_constant_dim.ll
Index: polly/trunk/lib/Analysis/ScopInfo.cpp
===================================================================
--- polly/trunk/lib/Analysis/ScopInfo.cpp
+++ polly/trunk/lib/Analysis/ScopInfo.cpp
@@ -3428,9 +3428,13 @@
int ValInt = 1;
- if (isl_val_is_int(Val))
- ValInt = isl_val_get_num_si(Val);
- isl_val_free(Val);
+ if (isl_val_is_int(Val)) {
+ auto ValAPInt = APIntFromVal(Val);
+ if (ValAPInt.isSignedIntN(32))
+ ValInt = ValAPInt.getSExtValue();
+ } else {
+ isl_val_free(Val);
+ }
Int.push_back(ValInt);
Index: polly/trunk/test/ScopInfo/multidim_fold_constant_dim.ll
===================================================================
--- polly/trunk/test/ScopInfo/multidim_fold_constant_dim.ll
+++ polly/trunk/test/ScopInfo/multidim_fold_constant_dim.ll
@@ -36,6 +36,7 @@
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
%struct.com = type { double, double }
+%struct.com2 = type { [20000000000 x double] }
define void @foo(i64 %n, %struct.com* %A) {
entry:
@@ -84,10 +85,39 @@
ret void
}
-define i32 @main() {
+; CHECK: Arrays {
+; CHECK-NEXT: double MemRef_O[*][%n]; // Element size 8
+; CHECK-NEXT: }
+
+define void @foo_overflow(i64 %n, %struct.com2* nocapture %O) local_unnamed_addr #0 {
entry:
- %A = alloca [100 x [1000 x %struct.com]], align 16
- %tmp = getelementptr inbounds [100 x [1000 x %struct.com]], [100 x [1000 x %struct.com]]* %A, i64 0, i64 0, i64 0
- call void @foo(i64 1000, %struct.com* nonnull %tmp)
- ret i32 0
+ br label %for.body
+
+for.cond.cleanup: ; preds = %for.cond.cleanup3
+ ret void
+
+for.body: ; preds = %for.cond.cleanup3, %entry
+ %i.024 = phi i64 [ 0, %entry ], [ %inc12, %for.cond.cleanup3 ]
+ %0 = mul nsw i64 %i.024, %n
+ %arrayidx = getelementptr inbounds %struct.com2, %struct.com2* %O, i64 %0
+ br label %for.body4
+
+for.cond.cleanup3: ; preds = %for.body4
+ %inc12 = add nuw nsw i64 %i.024, 1
+ %exitcond25 = icmp eq i64 %inc12, 100
+ br i1 %exitcond25, label %for.cond.cleanup, label %for.body
+
+for.body4: ; preds = %for.body4, %for.body
+ %j.023 = phi i64 [ 0, %for.body ], [ %inc, %for.body4 ]
+ %arrayidx5 = getelementptr inbounds %struct.com2, %struct.com2* %arrayidx, i64 %j.023
+ %Real = getelementptr inbounds %struct.com2, %struct.com2* %arrayidx5, i64 0, i32 0
+ %arrayidx6 = getelementptr inbounds [20000000000 x double], [20000000000 x double]* %Real, i64 0, i64 1
+ %1 = load double, double* %arrayidx6, align 8
+ %arrayidx10 = getelementptr inbounds [20000000000 x double], [20000000000 x double]* %Real, i64 0, i64 0
+ %2 = load double, double* %arrayidx10, align 8
+ %add = fadd double %1, %2
+ store double %add, double* %arrayidx10, align 8
+ %inc = add nuw nsw i64 %j.023, 1
+ %exitcond = icmp eq i64 %inc, 1000
+ br i1 %exitcond, label %for.cond.cleanup3, label %for.body4
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42129.130268.patch
Type: text/x-patch
Size: 3066 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180117/2208ec39/attachment.bin>
More information about the llvm-commits
mailing list