[PATCH] [CodeGen] Emit Constants, not ScalarExprs, for "immediate"-constrained inlineasm arguments.

Daniel Sanders daniel.sanders at imgtec.com
Mon Jun 8 02:06:45 PDT 2015

I'm wondering if the assert ought to be a normal error message and I think we may need a REQUIRES for buildbots lacking sanitizer support but apart from that this patch LGTM.

Just to mention it, there's something odd about the 'i' constraint in the backends but I haven't had chance to investigate it yet. For some reason, it has to be handled in *DAGToDAGISel::SelectInlineAsmMemoryOperand() despite not being a memory operand.

Comment at: lib/CodeGen/CGStmt.cpp:1759-1760
@@ +1758,4 @@
+      return llvm::ConstantInt::get(getLLVMContext(), Result);
+    assert(!Info.requiresImmediateConstant() &&
+           "Required-immediate inlineasm arg isn't constant?");
+  }
Should this cause an error to be emitted on release builds too?

Comment at: test/CodeGen/inline-asm-immediate-ubsan.c:2
@@ +1,3 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s \
+// RUN:     -fsanitize=signed-integer-overflow \
+// RUN:   | FileCheck %s --check-prefix=CHECK
Sanitizers aren't always available. It's possible we need a 'REQUIRES:' line to disable the test for some buildbots.



More information about the cfe-commits mailing list