[DirectX][Fail crash in DXILPrepareModule pass when input has typed ptr.

Check supportsTypedPointers instead of hasSetOpaquePointersValue when query if has typed ptr.

Reviewed By: beanz

Differential Revision: https://reviews.llvm.org/D127268
This commit is contained in:
python3kgae 2022-06-07 18:38:29 -07:00 committed by Xiang Li
parent e14d04909d
commit 12ca031b0d
2 changed files with 11 additions and 1 deletions

View File

@ -127,7 +127,7 @@ public:
continue;
}
// Only insert bitcasts if the IR is using opaque pointers.
if (!M.getContext().hasSetOpaquePointersValue())
if (M.getContext().supportsTypedPointers())
continue;
// Emtting NoOp bitcast instructions allows the ValueEnumerator to be

View File

@ -0,0 +1,10 @@
; RUN: opt -S -dxil-prepare < %s | FileCheck %s
target triple = "dxil-unknown-unknown"
; Make sure not crash when has typed ptr.
; CHECK:@test
define i64 @test(i64* %p) {
%v = load i64, i64* %p
ret i64 %v
}