Files
clang-p2996/llvm/test/CodeGen/DirectX/conflicting-bitcast-insert.ll
Chris Bieneman f5d054cdc1 Modify DXILPrepare to emit no-op bitcasts
In supporting opaque pointers we need to re-materialize typed pointers
in bitcode emission. Because of how the value-enumerator pre-allocates
types and instructions we need to insert some no-op bitcasts in the
places that we'll need bitcasts for the pointer types.

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D122269
2022-05-09 13:40:47 -05:00

27 lines
729 B
LLVM

; RUN: llc --filetype=asm %s -o - | FileCheck %s
target triple = "dxil-unknown-unknown"
define i64 @test(ptr %p) {
store i32 0, ptr %p
%v = load i64, ptr %p
ret i64 %v
}
; CHECK: define i64 @test(ptr %p) {
; CHECK-NEXT: %1 = bitcast ptr %p to ptr
; CHECK-NEXT: store i32 0, ptr %1, align 4
; CHECK-NEXT: %2 = bitcast ptr %p to ptr
; CHECK-NEXT: %3 = load i64, ptr %2, align 8
define i64 @testGEP(ptr %p) {
%ptr = getelementptr i32, ptr %p, i32 4
%val = load i64, ptr %p
ret i64 %val
}
; CHECK: define i64 @testGEP(ptr %p) {
; CHECK-NEXT: %1 = bitcast ptr %p to ptr
; CHECK-NEXT: %ptr = getelementptr i32, ptr %1, i32 4
; CHECK-NEXT: %2 = bitcast ptr %p to ptr
; CHECK-NEXT: %3 = load i64, ptr %2, align 8