llvm-project/llvm/test/CodeGen/ARM/ifcvt-dead-def.ll

56 lines
2.4 KiB
LLVM
Raw Normal View History

; RUN: llc %s -o - -verify-machineinstrs | FileCheck %s
target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32"
target triple = "thumbv7-unknown-unknown"
%struct.ref_s = type { %union.v, i16, i16 }
%union.v = type { i32 }
%struct.gs_color_s = type { i16, i16, i16, i16, i8, i8 }
; In this case, the if converter was cloning the return instruction so that we had
[CodeGen] Use MachineOperand::print in the MIRPrinter for MO_Register. Work towards the unification of MIR and debug output by refactoring the interfaces. For MachineOperand::print, keep a simple version that can be easily called from `dump()`, and a more complex one which will be called from both the MIRPrinter and MachineInstr::print. Add extra checks inside MachineOperand for detached operands (operands with getParent() == nullptr). https://reviews.llvm.org/D40836 * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/kill: ([^ ]+) ([^ ]+)<def> ([^ ]+)/kill: \1 def \2 \3/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/kill: ([^ ]+) ([^ ]+) ([^ ]+)<def>/kill: \1 \2 def \3/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/kill: def ([^ ]+) ([^ ]+) ([^ ]+)<def>/kill: def \1 \2 def \3/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/<def>//g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<kill>/killed \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<imp-use,kill>/implicit killed \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<dead>/dead \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<def[ ]*,[ ]*dead>/dead \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<imp-def[ ]*,[ ]*dead>/implicit-def dead \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<imp-def>/implicit-def \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<imp-use>/implicit \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<internal>/internal \1/g' * find . \( -name "*.mir" -o -name "*.cpp" -o -name "*.h" -o -name "*.ll" -o -name "*.s" \) -type f -print0 | xargs -0 sed -i '' -E 's/([^ ]+)<undef>/undef \1/g' llvm-svn: 320022
2017-12-07 18:40:31 +08:00
; r2 = ...
; return [pred] r2<dead,def>
; ldr <r2, kill>
; return
; The problem here was that the dead def on the first return was making the machine verifier
; think that the load read from an undefined register. We need to remove the dead flag from
; the return, and also add an implicit use of the prior value of r2.
; CHECK: ldrh
; Function Attrs: minsize nounwind optsize ssp
define i32 @test(%struct.ref_s* %pref1, %struct.ref_s* %pref2, %struct.gs_color_s** %tmp152) #0 {
bb:
%nref = alloca %struct.ref_s, align 4
%tmp46 = call %struct.ref_s* @name_string_ref(%struct.ref_s* %pref1, %struct.ref_s* %nref) #2
%tmp153 = load %struct.gs_color_s*, %struct.gs_color_s** %tmp152, align 4
%tmp154 = bitcast %struct.ref_s* %pref2 to %struct.gs_color_s**
%tmp155 = load %struct.gs_color_s*, %struct.gs_color_s** %tmp154, align 4
%tmp162 = getelementptr inbounds %struct.gs_color_s, %struct.gs_color_s* %tmp153, i32 0, i32 1
%tmp163 = load i16, i16* %tmp162, align 2
%tmp164 = getelementptr inbounds %struct.gs_color_s, %struct.gs_color_s* %tmp155, i32 0, i32 1
%tmp165 = load i16, i16* %tmp164, align 2
%tmp166 = icmp eq i16 %tmp163, %tmp165
br i1 %tmp166, label %bb167, label %bb173
bb167: ; preds = %bb
%tmp168 = getelementptr inbounds %struct.gs_color_s, %struct.gs_color_s* %tmp153, i32 0, i32 2
%tmp169 = load i16, i16* %tmp168, align 2
%tmp170 = getelementptr inbounds %struct.gs_color_s, %struct.gs_color_s* %tmp155, i32 0, i32 2
%tmp171 = load i16, i16* %tmp170, align 2
%tmp172 = icmp eq i16 %tmp169, %tmp171
br label %bb173
bb173: ; preds = %bb167, %bb
%tmp174 = phi i1 [ false, %bb ], [ %tmp172, %bb167 ]
%tmp175 = zext i1 %tmp174 to i32
ret i32 %tmp175
}
; Function Attrs: minsize optsize
declare %struct.ref_s* @name_string_ref(%struct.ref_s*, %struct.ref_s*) #1
attributes #0 = { minsize nounwind optsize }
attributes #1 = { minsize optsize }
attributes #2 = { minsize nounwind optsize }