llvm.org GIT mirror llvm / 5d7c896
[ValueTracking] Enabling ValueTracking patch by default (recommit). Part 2. The original patch was an improvement to IR ValueTracking on non-negative integers. It has been checked in to trunk (D18777, r284022). But was disabled by default due to performance regressions. Perf impact has improved. The patch would be enabled by default. Reviewers: reames, hfinkel Differential Revision: https://reviews.llvm.org/D34101 Patch by: Olga Chupina <olga.chupina@intel.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310583 91177308-0d34-0410-b5e6-96231b3b80d8 Nikolai Bozhenov 2 years ago
2 changed file(s) with 27 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
5252 // dominating comparisons.
5353 static cl::opt DomConditionsMaxUses("dom-conditions-max-uses",
5454 cl::Hidden, cl::init(20));
55
56 // This optimization is known to cause performance regressions is some cases,
57 // keep it under a temporary flag for now.
58 static cl::opt
59 DontImproveNonNegativePhiBits("dont-improve-non-negative-phi-bits",
60 cl::Hidden, cl::init(true));
6155
6256 /// Returns the bitwidth of the given scalar or pointer type. For vector types,
6357 /// returns the element type's bitwidth.
12561250
12571251 Known.Zero.setLowBits(std::min(Known2.countMinTrailingZeros(),
12581252 Known3.countMinTrailingZeros()));
1259
1260 if (DontImproveNonNegativePhiBits)
1261 break;
12621253
12631254 auto *OverflowOp = dyn_cast(LU);
12641255 if (OverflowOp && OverflowOp->hasNoSignedWrap()) {
0 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
1 ; RUN: opt -instcombine < %s -S | FileCheck %s
2
3 define void @test() #0 {
4 ; CHECK-LABEL: @test(
5 ; CHECK-NEXT: entry:
6 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
7 ; CHECK: for.body:
8 ; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ 0, [[ENTRY:%.*]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
9 ; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
10 ; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ult i64 [[INDVARS_IV_NEXT]], 40
11 ; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_END:%.*]], label [[FOR_BODY]]
12 ; CHECK: for.end:
13 ; CHECK-NEXT: ret void
14 ;
15 entry:
16 br label %for.body
17
18 for.body: ; preds = %for.body, %entry
19 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
20 %indvars.iv.next = add nsw i64 %indvars.iv, 1
21 %exitcond = icmp slt i64 %indvars.iv.next, 40
22 br i1 %exitcond, label %for.end, label %for.body
23
24 for.end: ; preds = %for.body
25 ret void
26 }