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) { 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 +}