summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-04-19 15:05:47 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-04-19 15:05:47 +0000
commitb789165e6bd13757da0243618757211d9530e078 (patch)
tree4f8e29a6a726c0ea502c87cc7164a36b58536607 /llvm/test/Transforms
parentd92c37e0909e7b72fd13e7fbb67151664d5a9002 (diff)
downloadbcm5719-llvm-b789165e6bd13757da0243618757211d9530e078.tar.gz
bcm5719-llvm-b789165e6bd13757da0243618757211d9530e078.zip
[NewGVN] Add ops as dependency if we cannot find a leader for ValueOp.
If those operands change, we might find a leader for ValueOp, which could enable new phi-of-op creation. This fixes a case where we missed creating a phi-of-ops node. With D43865 and this patch, bootstrapping clang/llvm works with -enable-newgvn, whereas without it, the "value changed after iteration" assertion is triggered. Reviewers: dberlin, davide Reviewed By: dberlin Differential Revision: https://reviews.llvm.org/D42180 llvm-svn: 330334
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/NewGVN/pr35074.ll62
1 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/Transforms/NewGVN/pr35074.ll b/llvm/test/Transforms/NewGVN/pr35074.ll
new file mode 100644
index 00000000000..5117cc0ee77
--- /dev/null
+++ b/llvm/test/Transforms/NewGVN/pr35074.ll
@@ -0,0 +1,62 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -newgvn -S | FileCheck %s
+
+define void @sort(i64 %.16) {
+; CHECK-LABEL: @sort(
+; CHECK-NEXT: Entry:
+; CHECK-NEXT: [[TMP0:%.*]] = extractvalue { i64, i1 } undef, 0
+; CHECK-NEXT: [[TMP1:%.*]] = lshr i64 [[TMP0]], 2
+; CHECK-NEXT: br i1 undef, label [[DIVZEROFAIL2_I:%.*]], label [[WHILEBODY_LR_PH:%.*]]
+; CHECK: DivZeroFail2.i:
+; CHECK-NEXT: unreachable
+; CHECK: WhileBody.lr.ph:
+; CHECK-NEXT: [[TMP2:%.*]] = udiv i64 [[DOT16:%.*]], [[TMP1]]
+; CHECK-NEXT: br label [[WHILEBODY:%.*]]
+; CHECK: WhileBody:
+; CHECK-NEXT: [[ITERATOR:%.*]] = phi i64 [ 0, [[WHILEBODY_LR_PH]] ], [ [[TMP6:%.*]], [[BOUNDSCHECKOK276:%.*]] ]
+; CHECK-NEXT: [[TMP3:%.*]] = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[ITERATOR]], i64 [[TMP2]])
+; CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i64, i1 } [[TMP3]], 0
+; CHECK-NEXT: [[TMP5:%.*]] = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 [[TMP4]], i64 1)
+; CHECK-NEXT: [[TMP6]] = extractvalue { i64, i1 } [[TMP5]], 0
+; CHECK-NEXT: br i1 false, label [[BOUNDSCHECKFAIL275:%.*]], label [[BOUNDSCHECKOK276]]
+; CHECK: WhileEnd:
+; CHECK-NEXT: ret void
+; CHECK: BoundsCheckFail275:
+; CHECK-NEXT: unreachable
+; CHECK: BoundsCheckOk276:
+; CHECK-NEXT: [[TMP7:%.*]] = icmp ult i64 [[TMP6]], [[DOT16]]
+; CHECK-NEXT: br i1 [[TMP7]], label [[WHILEBODY]], label [[WHILEEND:%.*]]
+;
+Entry:
+ %0 = extractvalue { i64, i1 } undef, 0
+ %1 = lshr i64 %0, 2
+ br i1 undef, label %DivZeroFail2.i, label %WhileBody.lr.ph
+
+DivZeroFail2.i: ; preds = %Entry
+ unreachable
+
+WhileBody.lr.ph: ; preds = %Entry
+ %2 = udiv i64 %.16, %1
+ br label %WhileBody
+
+WhileBody: ; preds = %BoundsCheckOk276, %WhileBody.lr.ph
+ %iterator = phi i64 [ 0, %WhileBody.lr.ph ], [ %6, %BoundsCheckOk276 ]
+ %3 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %iterator, i64 %2)
+ %4 = extractvalue { i64, i1 } %3, 0
+ %5 = tail call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %4, i64 1)
+ %6 = extractvalue { i64, i1 } %5, 0
+ %7 = icmp ugt i64 %iterator, %.16
+ br i1 %7, label %BoundsCheckFail275, label %BoundsCheckOk276
+
+WhileEnd: ; preds = %BoundsCheckOk276
+ ret void
+
+BoundsCheckFail275: ; preds = %WhileBody
+ unreachable
+
+BoundsCheckOk276: ; preds = %WhileBody
+ %8 = icmp ult i64 %6, %.16
+ br i1 %8, label %WhileBody, label %WhileEnd
+}
+
+declare { i64, i1 } @llvm.uadd.with.overflow.i64(i64, i64)
OpenPOWER on IntegriCloud