
CodeGenPrepare needs to support the maintenence of DPValues, the non-instruction replacement for dbg.value intrinsics. This means there are a few functions we need to duplicate or replicate the functionality of: * fixupDbgValue for setting users of sunk addr GEPs, * The remains of placeDbgValues needs a DPValue implementation for sinking * Rollback of RAUWs needs to update DPValues * Rollback of instruction removal needs supporting (see github #73350) * A few places where we have to use iterators rather than instructions. There are three places where we have to use the setHeadBit call on iterators to indicate which portion of debug-info records we're about to splice around. This is because CodeGenPrepare, unlike other optimisation passes, is very much concerned with which block an operation occurs in and where in the block instructions are because it's preparing things to be in a format that's good for SelectionDAG. There isn't a large amount of test coverage for debuginfo behaviours in this pass, hence I've added some more.
33 lines
1.4 KiB
LLVM
33 lines
1.4 KiB
LLVM
; RUN: opt -S -debugify -codegenprepare %s -o - | FileCheck %s --check-prefix=DEBUGIFY
|
|
; RUN: opt -S -debugify -codegenprepare %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=DEBUGIFY
|
|
;
|
|
; Copied from codegen-prepare-addrmode-sext.ll -- for the twoArgsNoPromotion
|
|
; function, CGP attempts a type promotion transaction on the sext to replace
|
|
; it with %add, but then rolls it back. This involves re-inserting the sext
|
|
; instruction between two dbg.value intrinsics, and un-RAUWing the users of
|
|
; the sext.
|
|
; This test checks that this works correctly in both dbg.value mode, but also
|
|
; RemoveDIs non-intrinsic debug-info mode.
|
|
|
|
target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128"
|
|
target triple = "x86_64-apple-macosx"
|
|
|
|
; DEBUGIFY-LABEL: @twoArgsNoPromotion
|
|
; DEBUGIFY-NEXT: %add = add
|
|
; DEBUGIFY-NEXT: call void @llvm.dbg.value(metadata i32 %add,
|
|
; DEBUGIFY-NEXT: %sextadd = sext
|
|
; DEBUGIFY-NEXT: call void @llvm.dbg.value(metadata i64 %sextadd,
|
|
; DEBUGIFY-NEXT: %arrayidx = getelementptr
|
|
; DEBUGIFY-NEXT: call void @llvm.dbg.value(metadata ptr %arrayidx,
|
|
; DEBUGIFY-NEXT: %res = load i8,
|
|
; DEBUGIFY-NEXT: call void @llvm.dbg.value(metadata i8 %res,
|
|
; DEBUGIFY-NEXT: ret i8 %res,
|
|
define i8 @twoArgsNoPromotion(i32 %arg1, i32 %arg2, ptr %base) {
|
|
%add = add nsw i32 %arg1, %arg2
|
|
%sextadd = sext i32 %add to i64
|
|
%arrayidx = getelementptr inbounds i8, ptr %base, i64 %sextadd
|
|
%res = load i8, ptr %arrayidx
|
|
ret i8 %res
|
|
}
|
|
|