From 1f6a3c820a997fd3c4c08dedff6706f5e045e42d Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 13 Nov 2009 23:16:41 +0000 Subject: [PATCH] Fix PR5411. Bug in UpdateKills. A reg def partially define its super-registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88719 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/VirtRegRewriter.cpp | 4 ++ .../CodeGen/ARM/2009-11-13-ScavengerAssert.ll | 42 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/CodeGen/ARM/2009-11-13-ScavengerAssert.ll diff --git a/lib/CodeGen/VirtRegRewriter.cpp b/lib/CodeGen/VirtRegRewriter.cpp index e357214b8a2..dcd2a75ae0e 100644 --- a/lib/CodeGen/VirtRegRewriter.cpp +++ b/lib/CodeGen/VirtRegRewriter.cpp @@ -583,6 +583,10 @@ static void UpdateKills(MachineInstr &MI, const TargetRegisterInfo* TRI, RegKills.reset(*SR); KillOps[*SR] = NULL; } + for (const unsigned *SR = TRI->getSuperRegisters(Reg); *SR; ++SR) { + RegKills.reset(*SR); + KillOps[*SR] = NULL; + } } } diff --git a/test/CodeGen/ARM/2009-11-13-ScavengerAssert.ll b/test/CodeGen/ARM/2009-11-13-ScavengerAssert.ll new file mode 100644 index 00000000000..6cce02dd48c --- /dev/null +++ b/test/CodeGen/ARM/2009-11-13-ScavengerAssert.ll @@ -0,0 +1,42 @@ +; RUN: llc -mtriple=armv7-eabi -mcpu=cortex-a8 < %s +; PR5411 + +%bar = type { %quad, float, float, [3 x %quux*], [3 x %bar*], [2 x %bar*], [3 x i8], i8 } +%baz = type { %bar*, i32 } +%foo = type { i8, %quuz, %quad, float, [64 x %quux], [128 x %bar], i32, %baz, %baz } +%quad = type { [4 x float] } +%quux = type { %quad, %quad } +%quuz = type { [4 x %quux*], [4 x float], i32 } + +define arm_aapcs_vfpcc %bar* @aaa(%foo* nocapture %this, %quux* %a, %quux* %b, %quux* %c, i8 zeroext %forced) { +entry: + br i1 undef, label %bb85, label %bb + +bb: ; preds = %entry + %0 = getelementptr inbounds %bar* null, i32 0, i32 0, i32 0, i32 2 ; [#uses=2] + %1 = load float* undef, align 4 ; [#uses=1] + %2 = fsub float 0.000000e+00, undef ; [#uses=2] + %3 = fmul float 0.000000e+00, undef ; [#uses=1] + %4 = load float* %0, align 4 ; [#uses=3] + %5 = fmul float %4, %2 ; [#uses=1] + %6 = fsub float %3, %5 ; [#uses=1] + %7 = fmul float %4, undef ; [#uses=1] + %8 = fsub float %7, undef ; [#uses=1] + %9 = fmul float undef, %2 ; [#uses=1] + %10 = fmul float 0.000000e+00, undef ; [#uses=1] + %11 = fsub float %9, %10 ; [#uses=1] + %12 = fmul float undef, %6 ; [#uses=1] + %13 = fmul float 0.000000e+00, %8 ; [#uses=1] + %14 = fadd float %12, %13 ; [#uses=1] + %15 = fmul float %1, %11 ; [#uses=1] + %16 = fadd float %14, %15 ; [#uses=1] + %17 = select i1 undef, float undef, float %16 ; [#uses=1] + %18 = fdiv float %17, 0.000000e+00 ; [#uses=1] + store float %18, float* undef, align 4 + %19 = fmul float %4, undef ; [#uses=1] + store float %19, float* %0, align 4 + ret %bar* null + +bb85: ; preds = %entry + ret %bar* null +}