[PATCH] D62555: [TailDuplicator] prevent tail duplication for INLINEASM_BR
Nick Desaulniers via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 28 16:17:08 PDT 2019
nickdesaulniers updated this revision to Diff 201782.
nickdesaulniers added a comment.
- get rid of some debug info
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62555/new/
https://reviews.llvm.org/D62555
Files:
llvm/lib/CodeGen/TailDuplicator.cpp
llvm/test/CodeGen/ARM/taildup.ll
Index: llvm/test/CodeGen/ARM/taildup.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/ARM/taildup.ll
@@ -0,0 +1,43 @@
+; RUN: llc -mtriple=arm-linux-gnueabi -print-machineinstrs=tailduplication %s \
+; RUN: -o /dev/null 2>&1 | FileCheck %s
+
+; Check that INLINEASM_BR did not get duplicated into the previously duplicated
+; blocks. Test case is a c-reduced then bugpointed sound/soc/ti/davinci-i2s.c
+; from the Linux kernel.
+
+; CHECK: bb.2.if.else:
+; CHECK: INLINEASM &"str $1, $0" [sideeffect] [mayload] [attdialect], $0:[mem:Q], killed renamable $r0, $1:[reguse:GPR], killed renamable $r1
+; CHECK: bb.3.if.end:
+; CHECK: INLINEASM_BR &"" [sideeffect] [attdialect], $0:[imm], blockaddress(@f, %ir-block.g)
+
+ at a = external dso_local local_unnamed_addr global i32*, align 4
+ at c = external dso_local local_unnamed_addr global i32, align 4
+
+define dso_local i32 @f() #0 {
+entry:
+ %0 = load i32, i32* @c, align 4
+ %tobool = icmp eq i32 %0, 0
+ %1 = load i32*, i32** @a, align 4
+ br i1 %tobool, label %if.else, label %if.then
+
+if.then: ; preds = %entry
+ tail call void asm sideeffect "str $1, $0", "*Qo,r"(i32* %1, i32 1) #1
+ br label %if.end
+
+if.else: ; preds = %entry
+ tail call void asm sideeffect "str $1, $0", "*Qo,r"(i32* %1, i32 0) #1
+ br label %if.end
+
+if.end: ; preds = %if.else, %if.then
+ callbr void asm sideeffect "", "X"(i8* blockaddress(@f, %g)) #1
+ to label %asm.fallthrough [label %g]
+
+asm.fallthrough: ; preds = %if.end
+ unreachable
+
+g: ; preds = %if.end
+ ret i32 undef
+}
+
+attributes #0 = { "use-soft-float"="false" }
+attributes #1 = { nounwind }
Index: llvm/lib/CodeGen/TailDuplicator.cpp
===================================================================
--- llvm/lib/CodeGen/TailDuplicator.cpp
+++ llvm/lib/CodeGen/TailDuplicator.cpp
@@ -781,6 +781,9 @@
return false;
if (!PredCond.empty())
return false;
+ for (MachineInstr &I : *TailBB)
+ if (I.getOpcode() == TargetOpcode::INLINEASM_BR)
+ return false;
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62555.201782.patch
Type: text/x-patch
Size: 2285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190528/ae49d734/attachment.bin>
More information about the llvm-commits
mailing list