[PATCH] D90091: [SelectionDAGBuilder] Let asm constraint "i" accept an undef operand.

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 24 01:55:49 PDT 2020


jonpa created this revision.
jonpa added reviewers: uweigand, nickdesaulniers.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
jonpa requested review of this revision.

Make LowerAsmOperandForConstraint() accept an undef operand for the "i" constraint.


https://reviews.llvm.org/D90091

Files:
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/test/CodeGen/SystemZ/asm-20.ll


Index: llvm/test/CodeGen/SystemZ/asm-20.ll
===================================================================
--- llvm/test/CodeGen/SystemZ/asm-20.ll
+++ llvm/test/CodeGen/SystemZ/asm-20.ll
@@ -1,7 +1,6 @@
-; Test that asm goto can be compiled.
-;
 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z14
 
+; Test that asm goto can be compiled.
 define i32 @c() {
 entry:
   callbr void asm sideeffect "j d", "X"(i8* blockaddress(@c, %d))
@@ -13,3 +12,10 @@
 d:                             ; preds = %asm.fallthrough, %entry
   ret i32 undef
 }
+
+; Test that constraint "i" accepts an undef operand.
+define void @fun1() {
+entry:
+  tail call void asm sideeffect "", "i"(i32 undef)
+  ret void
+}
Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -4442,6 +4442,8 @@
             BA->getBlockAddress(), BA->getValueType(0),
             Offset + BA->getOffset(), BA->getTargetFlags()));
         return;
+      } else if (Op.isUndef()) {
+        Ops.push_back(Op);
       } else {
         const unsigned OpCode = Op.getOpcode();
         if (OpCode == ISD::ADD || OpCode == ISD::SUB) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90091.300466.patch
Type: text/x-patch
Size: 1269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201024/ca130216/attachment.bin>


More information about the llvm-commits mailing list