Skip to content

Commit be7239e

Browse files
authored
[Inline] Remove bitcast handling in CallAnalyzer::stripAndComputeInBoundsConstantOffsets (#97988)
As we are now using opaque pointers, bitcast handling is no longer needed. Closes #97590.
1 parent ed51908 commit be7239e

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,8 +2644,6 @@ ConstantInt *CallAnalyzer::stripAndComputeInBoundsConstantOffsets(Value *&V) {
26442644
if (!GEP->isInBounds() || !accumulateGEPOffset(*GEP, Offset))
26452645
return nullptr;
26462646
V = GEP->getPointerOperand();
2647-
} else if (Operator::getOpcode(V) == Instruction::BitCast) {
2648-
V = cast<Operator>(V)->getOperand(0);
26492647
} else if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V)) {
26502648
if (GA->isInterposable())
26512649
break;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S -passes=inline < %s | FileCheck %s
3+
4+
; Check that we don't crash when computing the
5+
; base pointer of `bitcast <1 x ptr> to ptr`
6+
7+
define void @caller(<1 x ptr> %x) {
8+
; CHECK-LABEL: define void @caller(
9+
; CHECK-SAME: <1 x ptr> [[X:%.*]]) {
10+
; CHECK-NEXT: [[ENTRY:.*:]]
11+
; CHECK-NEXT: [[P:%.*]] = bitcast <1 x ptr> [[X]] to ptr
12+
; CHECK-NEXT: ret void
13+
;
14+
entry:
15+
%p = bitcast <1 x ptr> %x to ptr
16+
call void @callee(ptr %p)
17+
ret void
18+
}
19+
20+
define void @callee(ptr %p) {
21+
; CHECK-LABEL: define void @callee(
22+
; CHECK-SAME: ptr [[P:%.*]]) {
23+
; CHECK-NEXT: [[ENTRY:.*:]]
24+
; CHECK-NEXT: ret void
25+
;
26+
entry:
27+
ret void
28+
}

0 commit comments

Comments
 (0)