Index: lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp =================================================================== --- lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp +++ lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp @@ -195,23 +195,12 @@ return false; // Constant case - if (const MCConstantExpr *ConstExpr = dyn_cast(Imm.Value)) { - int64_t Value = ConstExpr->getValue(); - // Check if value fits in 25 bits with 2 least significant bits 0. - return isShiftedUInt<23, 2>(static_cast(Value)); - } - - // Symbolic reference expression - if (const LanaiMCExpr *SymbolRefExpr = dyn_cast(Imm.Value)) - return SymbolRefExpr->getKind() == LanaiMCExpr::VK_Lanai_None; - - // Binary expression - if (const MCBinaryExpr *BinaryExpr = dyn_cast(Imm.Value)) - if (const LanaiMCExpr *SymbolRefExpr = - dyn_cast(BinaryExpr->getLHS())) - return SymbolRefExpr->getKind() == LanaiMCExpr::VK_Lanai_None; - - return false; + const MCConstantExpr *MCE = dyn_cast(Imm.Value); + if (!MCE) + return true; + int64_t Value = MCE->getValue(); + // Check if value fits in 25 bits with 2 least significant bits 0. + return isShiftedUInt<23, 2>(static_cast(Value)); } bool isBrTarget() { return isBrImm() || isToken(); } Index: test/CodeGen/Lanai/inlineasm-global.ll =================================================================== --- test/CodeGen/Lanai/inlineasm-global.ll +++ test/CodeGen/Lanai/inlineasm-global.ll @@ -0,0 +1,20 @@ +; RUN: llc < %s -march=lanai | FileCheck %s + +; CHECK: bt .Ltmp +; CHECK: Ltmp +; CHECK-NEXT: bt f + +module asm ".globl start" +module asm "start:" +module asm "\09 .space 48,0" +module asm "\09 bt 1f" +module asm "\09 nop " +module asm "1: " +module asm "\09bt f" +module asm "\09nop" + +; Function Attrs: norecurse nounwind readnone +define void @f() #0 { +entry: + ret void +}