-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR][CodeGen] Add new SizedCapabilityType for use in CodeGen
EVT::getTypeForEVT currently returns a PointerType for MVT::cN, but this has a couple of issues. The first issue is we have to hard-code the address space, though that's not such a big deal given we do that elsewhere too. The bigger issue is that, when we later pass that to MVT::getVT or EVT::getEVT, it doesn't know what the right size is, so returns MVT::cPTR instead, which is not a true value type, and is supposed to only be used by TableGen. This has been seen to confuse TargetLoweringBase::getTypeConversion, as when presented with a vector of capability pointers it can end up trying to recreate a smaller vector of the same type, but this trips up various assertions for the MVT::cPTR as both the IR methods and the code here are expecting to be dealing with actual value types. Borrowing the idea of TypedPointerType (DXILPointerTyID) a bit, introduce a new IR type, SizedCapabilityType, to represent a fixed-size capability during CodeGen, which allows lossless roundtripping from MVT to Type and back. This fixes building cheritest, which has crashed since the introduction of cPTR due to cPTR not being a value type, mirroring iPTR, unlike the old iFATPTRAny which was its own weird beast, but wouldn't have tripped up these assertions. It probably didn't do the most sensible things though. Fixes: 7aa7f2e ("[CodeGen] Rework MVT representation of capabilities and add type inference")
- Loading branch information
Showing
13 changed files
with
124 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
llvm/test/Transforms/SLPVectorizer/cheri-crash-cPTR-element.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py | ||
; RUN: opt -mattr=+cheri128 -mcpu=beri -passes="function(slp-vectorizer)" -S < %s | FileCheck %s | ||
|
||
target datalayout = "E-m:e-pf200:128:128:128:64-i8:8:32-i16:16:32-i64:64-n32:64-S128" | ||
target triple = "mips64c128-unknown-freebsd" | ||
|
||
;; This previously crashed in TargetLoweringBase due to creating a vector which | ||
;; gave an element type of MVT::cPTR when queried rather than MVT::c128. | ||
define ptr @cmemcpy(ptr addrspace(200) %0, ptr addrspace(200) %1, i1 %tobool) { | ||
; CHECK-LABEL: @cmemcpy( | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: br i1 [[TOBOOL:%.*]], label [[IF_END12:%.*]], label [[DO_BODY45:%.*]] | ||
; CHECK: if.end12: | ||
; CHECK-NEXT: br label [[DO_BODY45]] | ||
; CHECK: do.body45: | ||
; CHECK-NEXT: [[SRC2_0:%.*]] = phi ptr addrspace(200) [ [[TMP0:%.*]], [[IF_END12]] ], [ [[TMP1:%.*]], [[ENTRY:%.*]] ] | ||
; CHECK-NEXT: [[DST1_0:%.*]] = phi ptr addrspace(200) [ [[TMP1]], [[IF_END12]] ], [ [[TMP0]], [[ENTRY]] ] | ||
; CHECK-NEXT: [[TMP2:%.*]] = load i64, ptr addrspace(200) [[SRC2_0]], align 8 | ||
; CHECK-NEXT: store i64 [[TMP2]], ptr addrspace(200) [[DST1_0]], align 8 | ||
; CHECK-NEXT: ret ptr null | ||
; | ||
entry: | ||
br i1 %tobool, label %if.end12, label %do.body45 | ||
|
||
if.end12: | ||
br label %do.body45 | ||
|
||
do.body45: | ||
%src2.0 = phi ptr addrspace(200) [ %0, %if.end12 ], [ %1, %entry ] | ||
%dst1.0 = phi ptr addrspace(200) [ %1, %if.end12 ], [ %0, %entry ] | ||
%2 = load i64, ptr addrspace(200) %src2.0, align 8 | ||
store i64 %2, ptr addrspace(200) %dst1.0, align 8 | ||
ret ptr null | ||
} |