File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
test/Transforms/CorrelatedValuePropagation Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -376,9 +376,17 @@ FPClassTest CallBase::getParamNoFPClass(unsigned i) const {
376
376
}
377
377
378
378
std::optional<ConstantRange> CallBase::getRange () const {
379
- const Attribute RangeAttr = getRetAttr (llvm::Attribute::Range);
380
- if (RangeAttr.isValid ())
381
- return RangeAttr.getRange ();
379
+ Attribute CallAttr = Attrs.getRetAttr (Attribute::Range);
380
+ Attribute FnAttr;
381
+ if (const Function *F = getCalledFunction ())
382
+ FnAttr = F->getRetAttribute (Attribute::Range);
383
+
384
+ if (CallAttr.isValid () && FnAttr.isValid ())
385
+ return CallAttr.getRange ().intersectWith (FnAttr.getRange ());
386
+ if (CallAttr.isValid ())
387
+ return CallAttr.getRange ();
388
+ if (FnAttr.isValid ())
389
+ return FnAttr.getRange ();
382
390
return std::nullopt;
383
391
}
384
392
Original file line number Diff line number Diff line change @@ -312,11 +312,9 @@ define i8 @ucmp_switch_callsite_range(i32 %x, i32 %y) {
312
312
; CHECK-LABEL: @ucmp_switch_callsite_range(
313
313
; CHECK-NEXT: [[CMP:%.*]] = call range(i8 -2, 3) i8 @llvm.ucmp.i8.i32(i32 [[X:%.*]], i32 [[Y:%.*]])
314
314
; CHECK-NEXT: switch i8 [[CMP]], label [[DEFAULT_UNREACHABLE:%.*]] [
315
- ; CHECK-NEXT: i8 -2 , label [[BB_NEG2 :%.*]]
315
+ ; CHECK-NEXT: i8 1 , label [[BB_1 :%.*]]
316
316
; CHECK-NEXT: i8 -1, label [[BB_NEG1:%.*]]
317
317
; CHECK-NEXT: i8 0, label [[BB_0:%.*]]
318
- ; CHECK-NEXT: i8 1, label [[BB_1:%.*]]
319
- ; CHECK-NEXT: i8 2, label [[BB_2:%.*]]
320
318
; CHECK-NEXT: ]
321
319
; CHECK: bb.neg2:
322
320
; CHECK-NEXT: ret i8 -2
You can’t perform that action at this time.
0 commit comments