[PATCH] D155023: Don't assert on a non-pointer value being used for a "p" inline asm constraint.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 15:38:57 PDT 2023
aemerson created this revision.
aemerson added reviewers: xiangzhangllvm, LuoYuanke, pengfei, RKSimon.
aemerson added a project: LLVM.
Herald added a subscriber: hiraditya.
Herald added a project: All.
aemerson requested review of this revision.
GCC and existing codebases allow the use of integral values to be used
with this constraint. A recent change D133914 <https://reviews.llvm.org/D133914> in this area started causing asserts.
Removing the assert is enough as the rest of the code works fine.
rdar://109675485
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155023
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
Index: llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
===================================================================
--- llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
+++ llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
@@ -15,3 +15,12 @@
ret ptr %1
; CHECK-NEXT: retq
}
+
+define void @intptr() {
+; Don't assert on a non-ptr operand, existing code & gcc accept these.
+entry:
+; CHECK-LABEL: intptr:
+; CHECK: ud1l 49150(%eax), %eax
+ call void asm "ud1l $0(%eax), %eax", "p,~{dirflag},~{fpsr},~{flags}"(i32 49150)
+ unreachable
+}
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9368,10 +9368,6 @@
}
if (OpInfo.ConstraintType == TargetLowering::C_Address) {
- assert(InOperandVal.getValueType() ==
- TLI.getPointerTy(DAG.getDataLayout()) &&
- "Address operands expect pointer values");
-
unsigned ConstraintID =
TLI.getInlineAsmMemConstraint(OpInfo.ConstraintCode);
assert(ConstraintID != InlineAsm::Constraint_Unknown &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155023.539312.patch
Type: text/x-patch
Size: 1229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/673714f9/attachment.bin>
More information about the llvm-commits
mailing list