Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion llvm/lib/CodeGen/GlobalISel/GISelValueTracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,20 @@ void GISelValueTracking::computeKnownBitsImpl(Register R, KnownBits &Known,
Known = KnownBits::shl(LHSKnown, RHSKnown);
break;
}
case TargetOpcode::G_PTRTOADDR: {
if (DstTy.isVector())
break;
Register SrcReg = MI.getOperand(1).getReg();
computeKnownBitsImpl(SrcReg, Known, DemandedElts, Depth + 1);
unsigned PtrAS = MRI.getType(SrcReg).getAddressSpace();
unsigned AddrWidth = DL.getAddressSizeInBits(PtrAS);
if (AddrWidth < BitWidth)
Known = Known.trunc(AddrWidth);
Known = Known.zextOrTrunc(BitWidth);
break;
}
case TargetOpcode::G_INTTOPTR:
case TargetOpcode::G_PTRTOINT:
case TargetOpcode::G_PTRTOADDR:
if (DstTy.isVector())
break;
// Fall through and handle them the same as zext/trunc.
Expand Down
3 changes: 1 addition & 2 deletions llvm/test/CodeGen/AMDGPU/GlobalISel/knownbits-ptrtoaddr.mir
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ body: |
...
---
## We should see 208 high zeroes followed by 48 unknown bits for extending PtrToAddr.
## FIXME: this is currently wrong
name: PtrToAddrExt
body: |
bb.0:
Expand All @@ -32,7 +31,7 @@ body: |
; CHECK-NEXT: %2:_ KnownBits:???????????????????????????????? SignBits:1
; CHECK-NEXT: %3:_ KnownBits:???????????????????????????????? SignBits:1
; CHECK-NEXT: %4:_ KnownBits:???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? SignBits:1
; CHECK-NEXT: %5:_ KnownBits:00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? SignBits:128
; CHECK-NEXT: %5:_ KnownBits:0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000???????????????????????????????????????????????? SignBits:208
%0:_(s32) = COPY $vgpr0
%1:_(s32) = COPY $vgpr1
%2:_(s32) = COPY $vgpr2
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.