[PATCH] D115688: [SelectionDAG] treat X constrained labels as i for asm

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 15:07:55 PST 2021


nickdesaulniers added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5083
 
-    if (Op.getNode() && Op.getOpcode() == ISD::TargetBlockAddress)
+    if (isa<BasicBlock>(v) || isa<BlockAddress>(v)) {
+      OpInfo.ConstraintCode = "i";
----------------
nickdesaulniers wrote:
> jyknight wrote:
> > I'm still confused as to why this deals in both BlockAddress and BasicBlock types -- why aren't the values all BlockAddresses?
> `llvm/test/CodeGen/X86/asm-block-labels.ll` with assert without the check for `BasicBlock`.
> ```
> Value type is non-standard value, Other.
> UNREACHABLE executed at /android0/llvm-project/llvm/include/llvm/Support/MachineValueType.h:865!
> ...
> 2.	Running pass 'X86 DAG->DAG Instruction Selection' on function '@bar'
> ...
>  #8 0x00000000030d9abc getCopyToParts(llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue*, unsigned int, llvm::MVT, llvm::Value const*, llvm::Optional<unsigned int>, llvm::ISD::NodeType) SelectionDAGBuilder.cpp:0:0
>  #9 0x00000000030d9207 llvm::RegsForValue::getCopyToRegs(llvm::SDValue, llvm::SelectionDAG&, llvm::SDLoc const&, llvm::SDValue&, llvm::SDValue*, llvm::Value const*, llvm::ISD::NodeType) const (/android0/llvm-project/llvm/build/bin/llc+0x30d9207)
> #10 0x00000000030feb26 llvm::SelectionDAGBuilder::visitInlineAsm(llvm::CallBase const&, llvm::BasicBlock const*) (/android0/llvm-project/llvm/build/bin/llc+0x30feb26)
> #11 0x00000000030dca47 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/android0/llvm-project/llvm/build/bin/llc+0x30dca47)
> ```
> ie. `call` (and technically `callbr`) can accept a `label` operand; not just a `blockaddress`. Why are `label` operands distinct from `blockaddress`es? /me shrugs.
So it looks like a `label` is a `Type` that a `Value` can have, while `blockaddress` is a `Constant` `Value`, IIUC. Still, this holds:

> call (and technically callbr) can accept a label operand; not just a blockaddress.

See also the above relationship between `ISD::TargetBlockAddress` and `ISD::BlockAddress`; they're the same `SDNode` (`BlockAddressSDNode`). This hunk of this change is unifying the operands rather than relying one of the possible opcodes for this type of `SDNode`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115688/new/

https://reviews.llvm.org/D115688



More information about the llvm-commits mailing list