[PATCH] D103408: DetectDeadLanes: Remove assert for subregister defs
Ahsan Saghir via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 1 07:33:16 PDT 2021
saghir updated this revision to Diff 348973.
saghir added a comment.
Herald added a subscriber: nemanjai.
Added test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103408/new/
https://reviews.llvm.org/D103408
Files:
llvm/lib/CodeGen/DetectDeadLanes.cpp
llvm/test/CodeGen/PowerPC/detect-dead-lanes-subreg-assertion.ll
Index: llvm/test/CodeGen/PowerPC/detect-dead-lanes-subreg-assertion.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/PowerPC/detect-dead-lanes-subreg-assertion.ll
@@ -0,0 +1,45 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-unknown \
+; RUN: -ppc-track-subreg-liveness < %s | FileCheck %s
+
+declare i64 @strlen() local_unnamed_addr
+
+define dso_local fastcc void @check_format_info_main() unnamed_addr {
+; CHECK-LABEL: check_format_info_main:
+; CHECK: # %bb.0: # %entry
+; CHECK-NEXT: b .LBB0_2
+; CHECK-NEXT: # %bb.1: # %if.end40
+; CHECK-NEXT: mflr 0
+; CHECK-NEXT: std 0, 16(1)
+; CHECK-NEXT: stdu 1, -32(1)
+; CHECK-NEXT: .cfi_def_cfa_offset 32
+; CHECK-NEXT: .cfi_offset lr, 16
+; CHECK-NEXT: bl strlen
+; CHECK-NEXT: nop
+; CHECK-NEXT: extsw 3, 3
+; CHECK-NEXT: li 4, 0
+; CHECK-NEXT: addi 5, 3, 1
+; CHECK-NEXT: stb 4, 0(3)
+; CHECK-NEXT: extsw 5, 5
+; CHECK-NEXT: stb 4, 0(5)
+; CHECK-NEXT: .LBB0_2: # %if.then32
+entry:
+ switch i8 undef, label %if.end40 [
+ i8 0, label %if.then32
+ ]
+
+if.then32: ; preds = %entry
+ unreachable
+
+if.end40: ; preds = %entry
+ %call413 = call i64 @strlen()
+ %sext1679 = shl i64 %call413, 32
+ %idxprom418 = ashr exact i64 %sext1679, 32
+ %arrayidx419 = getelementptr inbounds [256 x i8], [256 x i8]* null, i64 0, i64 %idxprom418
+ store i8 0, i8* %arrayidx419, align 1
+ %sext1680 = add i64 %sext1679, 4294967296
+ %idxprom420 = ashr exact i64 %sext1680, 32
+ %arrayidx421 = getelementptr inbounds [256 x i8], [256 x i8]* null, i64 0, i64 %idxprom420
+ store i8 0, i8* %arrayidx421, align 1
+ unreachable
+}
Index: llvm/lib/CodeGen/DetectDeadLanes.cpp
===================================================================
--- llvm/lib/CodeGen/DetectDeadLanes.cpp
+++ llvm/lib/CodeGen/DetectDeadLanes.cpp
@@ -340,8 +340,8 @@
llvm_unreachable("function must be called with COPY-like instruction");
}
- assert(Def.getSubReg() == 0 &&
- "Should not have subregister defs in machine SSA phase");
+ unsigned SubIdx = Def.getSubReg();
+ DefinedLanes = TRI->composeSubRegIndexLaneMask(SubIdx, DefinedLanes);
DefinedLanes &= MRI->getMaxLaneMaskForVReg(Def.getReg());
return DefinedLanes;
}
@@ -406,9 +406,9 @@
if (DefMI.isImplicitDef() || Def.isDead())
return LaneBitmask::getNone();
- assert(Def.getSubReg() == 0 &&
- "Should not have subregister defs in machine SSA phase");
- return MRI->getMaxLaneMaskForVReg(Reg);
+ unsigned SubReg = Def.getSubReg();
+ return SubReg != 0 ? TRI->getSubRegIndexLaneMask(SubReg)
+ : MRI->getMaxLaneMaskForVReg(Reg);
}
LaneBitmask DetectDeadLanes::determineInitialUsedLanes(unsigned Reg) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103408.348973.patch
Type: text/x-patch
Size: 2939 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210601/c29d8c58/attachment.bin>
More information about the llvm-commits
mailing list