[llvm] r241099 - [NVPTX] Fix issue introduced in D10321
Jingyue Wu
jingyue at google.com
Tue Jun 30 11:59:19 PDT 2015
Author: jingyue
Date: Tue Jun 30 13:59:19 2015
New Revision: 241099
URL: http://llvm.org/viewvc/llvm-project?rev=241099&view=rev
Log:
[NVPTX] Fix issue introduced in D10321
Summary:
Really check if %SP is not used in other places, instead of checking only exact
one non-dbg use.
Patched by Xuetian Weng.
Test Plan:
@foo4 in test/CodeGen/NVPTX/local-stack-frame.ll, create a case that
SP will appear twice.
Reviewers: jholewinski, jingyue
Reviewed By: jingyue
Subscribers: llvm-commits, sfantao, jholewinski
Differential Revision: http://reviews.llvm.org/D10844
Modified:
llvm/trunk/lib/Target/NVPTX/NVPTXFrameLowering.cpp
llvm/trunk/test/CodeGen/NVPTX/local-stack-frame.ll
Modified: llvm/trunk/lib/Target/NVPTX/NVPTXFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXFrameLowering.cpp?rev=241099&r1=241098&r2=241099&view=diff
==============================================================================
--- llvm/trunk/lib/Target/NVPTX/NVPTXFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/NVPTX/NVPTXFrameLowering.cpp Tue Jun 30 13:59:19 2015
@@ -47,20 +47,19 @@ void NVPTXFrameLowering::emitPrologue(Ma
// cvta.local %SP, %SPL;
if (static_cast<const NVPTXTargetMachine &>(MF.getTarget()).is64Bit()) {
// Check if %SP is actually used
- if (MR.hasOneNonDBGUse(NVPTX::VRFrame)) {
+ if (!MR.use_empty(NVPTX::VRFrame)) {
MI = BuildMI(MBB, MI, dl, MF.getSubtarget().getInstrInfo()->get(
NVPTX::cvta_local_yes_64),
NVPTX::VRFrame)
.addReg(NVPTX::VRFrameLocal);
}
-
BuildMI(MBB, MI, dl,
MF.getSubtarget().getInstrInfo()->get(NVPTX::MOV_DEPOT_ADDR_64),
NVPTX::VRFrameLocal)
.addImm(MF.getFunctionNumber());
} else {
// Check if %SP is actually used
- if (MR.hasOneNonDBGUse(NVPTX::VRFrame)) {
+ if (!MR.use_empty(NVPTX::VRFrame)) {
MI = BuildMI(MBB, MI, dl, MF.getSubtarget().getInstrInfo()->get(
NVPTX::cvta_local_yes),
NVPTX::VRFrame)
Modified: llvm/trunk/test/CodeGen/NVPTX/local-stack-frame.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/NVPTX/local-stack-frame.ll?rev=241099&r1=241098&r2=241099&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/NVPTX/local-stack-frame.ll (original)
+++ llvm/trunk/test/CodeGen/NVPTX/local-stack-frame.ll Tue Jun 30 13:59:19 2015
@@ -56,3 +56,21 @@ define void @foo3(i32 %a) {
store i32 %a, i32* %2
ret void
}
+
+; PTX32: cvta.local.u32 %SP, %SPL;
+; PTX32: add.u32 {{%r[0-9]+}}, %SP, 0;
+; PTX32: st.local.u32 [{{%r[0-9]+}}], {{%r[0-9]+}}
+; PTX32: st.local.u32 [{{%r[0-9]+}}], {{%r[0-9]+}}
+; PTX64: cvta.local.u64 %SP, %SPL;
+; PTX64: add.u64 {{%rd[0-9]+}}, %SP, 0;
+; PTX64: st.local.u32 [{{%rd[0-9]+}}], {{%r[0-9]+}}
+; PTX64: st.local.u32 [{{%rd[0-9]+}}], {{%r[0-9]+}}
+define void @foo4() {
+ %A = alloca i32
+ %B = alloca i32
+ store i32 0, i32* %A
+ store i32 0, i32* %B
+ call void @bar(i32* %A)
+ call void @bar(i32* %B)
+ ret void
+}
More information about the llvm-commits
mailing list