-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Open
Labels
backend:RISC-Vllvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingllvm:globalisel
Description
Repro:
$ sed 's/iXLen/i32/g' llvm-project/llvm/test/CodeGen/RISCV/GlobalISel/vararg.ll > liveness-varargs.ll
$ ./bin/llc -mtriple=riscv64 -global-isel -verify-machineinstrs liveness-varargs.ll -debug
Before Combiner
# *** IR Dump After Verify generated machine code (machineverifier) ***:
# Machine code for function va1: IsSSA, TracksLiveness
Frame Objects:
fi#-2: size=8, align=16, fixed, at location [SP-64]
fi#-1: size=56, align=8, fixed, at location [SP-56]
fi#0: size=8, align=8, at location [SP]
save/restore points:
save points are empty
restore points are empty
Function Live Ins: $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17
bb.1 (%ir-block.0):
liveins: $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17
%0:_(p0) = COPY $x10
%1:_(p0) = G_FRAME_INDEX %fixed-stack.1
%2:_(s64) = G_CONSTANT i64 8
%3:_(s64) = COPY $x11
G_STORE %3:_(s64), %1:_(p0) :: (store (s64) into %fixed-stack.1)
%4:_(p0) = G_PTR_ADD %1:_, %2:_(s64)
%5:_(s64) = COPY $x12
G_STORE %5:_(s64), %4:_(p0) :: (store (s64) into %fixed-stack.1 + 8)
%6:_(p0) = G_PTR_ADD %4:_, %2:_(s64)
%7:_(s64) = COPY $x13
G_STORE %7:_(s64), %6:_(p0) :: (store (s64) into %fixed-stack.1 + 16)
%8:_(p0) = G_PTR_ADD %6:_, %2:_(s64)
%9:_(s64) = COPY $x14
G_STORE %9:_(s64), %8:_(p0) :: (store (s64) into %fixed-stack.1 + 24)
%10:_(p0) = G_PTR_ADD %8:_, %2:_(s64)
%11:_(s64) = COPY $x15
G_STORE %11:_(s64), %10:_(p0) :: (store (s64) into %fixed-stack.1 + 32)
%12:_(p0) = G_PTR_ADD %10:_, %2:_(s64)
%13:_(s64) = COPY $x16
G_STORE %13:_(s64), %12:_(p0) :: (store (s64) into %fixed-stack.1 + 40)
%14:_(p0) = G_PTR_ADD %12:_, %2:_(s64)
%15:_(s64) = COPY $x17
G_STORE %15:_(s64), %14:_(p0) :: (store (s64) into %fixed-stack.1 + 48)
%16:_(p0) = G_PTR_ADD %14:_, %2:_(s64)
%17:_(p0) = G_FRAME_INDEX %stack.0.va
G_VASTART %17:_(p0) :: (store (s64) into %ir.va)
%18:_(p0) = G_LOAD %17:_(p0) :: (dereferenceable load (p0) from %ir.va, align 4)
%19:_(s64) = G_CONSTANT i64 4
%20:_(p0) = nuw nusw inbounds G_PTR_ADD %18:_, %19:_(s64)
G_STORE %20:_(p0), %17:_(p0) :: (store (p0) into %ir.va, align 4)
%21:_(s32) = G_LOAD %18:_(p0) :: (load (s32) from %ir.argp.cur)
%22:_(s64) = G_ANYEXT %21:_(s32)
$x10 = COPY %22:_(s64)
PseudoRET implicit $x10
# End machine code for function va1.Somewhere in between
Combiner iteration #1
Dead: %16:_(p0) = G_PTR_ADD %14:_, %2:_(s64)
Dead: %0:_(p0) = COPY $x10
After the copy instruction is removed, X10 is no longer a live in.
After combiner
# *** IR Dump After RISCVPreLegalizerCombiner (riscv-prelegalizer-combiner) ***:
# Machine code for function va1: IsSSA, TracksLiveness
Frame Objects:
fi#-2: size=8, align=16, fixed, at location [SP-64]
fi#-1: size=56, align=8, fixed, at location [SP-56]
fi#0: size=8, align=8, at location [SP]
save/restore points:
save points are empty
restore points are empty
Function Live Ins: $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17
bb.1 (%ir-block.0):
liveins: $x10, $x11, $x12, $x13, $x14, $x15, $x16, $x17
%1:_(p0) = G_FRAME_INDEX %fixed-stack.1
%2:_(s64) = G_CONSTANT i64 8
%3:_(s64) = COPY $x11
G_STORE %3:_(s64), %1:_(p0) :: (store (s64) into %fixed-stack.1)
%4:_(p0) = G_PTR_ADD %1:_, %2:_(s64)
%5:_(s64) = COPY $x12
G_STORE %5:_(s64), %4:_(p0) :: (store (s64) into %fixed-stack.1 + 8)
%23:_(s64) = G_CONSTANT i64 16
%6:_(p0) = G_PTR_ADD %1:_, %23:_(s64)
%7:_(s64) = COPY $x13
G_STORE %7:_(s64), %6:_(p0) :: (store (s64) into %fixed-stack.1 + 16)
%24:_(s64) = G_CONSTANT i64 24
%8:_(p0) = G_PTR_ADD %1:_, %24:_(s64)
%9:_(s64) = COPY $x14
G_STORE %9:_(s64), %8:_(p0) :: (store (s64) into %fixed-stack.1 + 24)
%25:_(s64) = G_CONSTANT i64 32
%10:_(p0) = G_PTR_ADD %1:_, %25:_(s64)
%11:_(s64) = COPY $x15
G_STORE %11:_(s64), %10:_(p0) :: (store (s64) into %fixed-stack.1 + 32)
%26:_(s64) = G_CONSTANT i64 40
%12:_(p0) = G_PTR_ADD %1:_, %26:_(s64)
%13:_(s64) = COPY $x16
G_STORE %13:_(s64), %12:_(p0) :: (store (s64) into %fixed-stack.1 + 40)
%27:_(s64) = G_CONSTANT i64 48
%14:_(p0) = G_PTR_ADD %1:_, %27:_(s64)
%15:_(s64) = COPY $x17
G_STORE %15:_(s64), %14:_(p0) :: (store (s64) into %fixed-stack.1 + 48)
%17:_(p0) = G_FRAME_INDEX %stack.0.va
G_VASTART %17:_(p0) :: (store (s64) into %ir.va)
%18:_(p0) = G_LOAD %17:_(p0) :: (dereferenceable load (p0) from %ir.va, align 4)
%19:_(s64) = G_CONSTANT i64 4
%20:_(p0) = nuw nusw inbounds G_PTR_ADD %18:_, %19:_(s64)
G_STORE %20:_(p0), %17:_(p0) :: (store (p0) into %ir.va, align 4)
%22:_(s64) = G_LOAD %18:_(p0) :: (load (s32) from %ir.argp.cur)
$x10 = COPY %22:_(s64)
PseudoRET implicit $x10
# End machine code for function va1.Metadata
Metadata
Assignees
Labels
backend:RISC-Vllvm:analysisIncludes value tracking, cost tables and constant foldingIncludes value tracking, cost tables and constant foldingllvm:globalisel