[llvm] 432338a - Don't assert on a non-pointer value being used for a "p" inline asm constraint.
Amara Emerson via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 13 10:46:14 PDT 2023
Author: Amara Emerson
Date: 2023-07-13T10:45:56-07:00
New Revision: 432338a673c827302c7a73561c20736ccd97c39a
URL: https://github.com/llvm/llvm-project/commit/432338a673c827302c7a73561c20736ccd97c39a
DIFF: https://github.com/llvm/llvm-project/commit/432338a673c827302c7a73561c20736ccd97c39a.diff
LOG: Don't assert on a non-pointer value being used for a "p" inline asm constraint.
GCC and existing codebases allow the use of integral values to be used
with this constraint. A recent change D133914 in this area started causing asserts.
Removing the assert is enough as the rest of the code works fine.
rdar://109675485
Differential Revision: https://reviews.llvm.org/D155023
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index d9e01c4ac2fa87..9595da9d0d8a0a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -9370,10 +9370,6 @@ void SelectionDAGBuilder::visitInlineAsm(const CallBase &Call,
}
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 &&
diff --git a/llvm/test/CodeGen/X86/inline-asm-p-constraint.ll b/llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
index 2b09995eca28a3..50185343662b74 100644
--- a/llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
+++ b/llvm/test/CodeGen/X86/inline-asm-p-constraint.ll
@@ -15,3 +15,12 @@ define ptr @foo(ptr %Ptr) {
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
+}
More information about the llvm-commits
mailing list