1; RUN: opt -S -debugify -codegenprepare %s -o - | FileCheck %s --check-prefix=DEBUGIFY 2; RUN: opt -S -debugify -codegenprepare %s -o - --try-experimental-debuginfo-iterators | FileCheck %s --check-prefix=DEBUGIFY 3; 4; Copied from codegen-prepare-addrmode-sext.ll -- for the twoArgsNoPromotion 5; function, CGP attempts a type promotion transaction on the sext to replace 6; it with %add, but then rolls it back. This involves re-inserting the sext 7; instruction between two dbg.value intrinsics, and un-RAUWing the users of 8; the sext. 9; This test checks that this works correctly in both dbg.value mode, but also 10; RemoveDIs non-intrinsic debug-info mode. 11 12target datalayout = "e-i64:64-f80:128-s:64-n8:16:32:64-S128" 13target triple = "x86_64-apple-macosx" 14 15; DEBUGIFY-LABEL: @twoArgsNoPromotion 16; DEBUGIFY-NEXT: %add = add 17; DEBUGIFY-NEXT: #dbg_value(i32 %add, 18; DEBUGIFY-NEXT: %sextadd = sext 19; DEBUGIFY-NEXT: #dbg_value(i64 %sextadd, 20; DEBUGIFY-NEXT: %arrayidx = getelementptr 21; DEBUGIFY-NEXT: #dbg_value(ptr %arrayidx, 22; DEBUGIFY-NEXT: %res = load i8, 23; DEBUGIFY-NEXT: #dbg_value(i8 %res, 24; DEBUGIFY-NEXT: ret i8 %res, 25define i8 @twoArgsNoPromotion(i32 %arg1, i32 %arg2, ptr %base) { 26 %add = add nsw i32 %arg1, %arg2 27 %sextadd = sext i32 %add to i64 28 %arrayidx = getelementptr inbounds i8, ptr %base, i64 %sextadd 29 %res = load i8, ptr %arrayidx 30 ret i8 %res 31} 32 33