Instead, just EvaluateAsInt().
Follow-up to r239549: rsmith points out that isICE() is expensive;
seems like it's not the right concept anyway, as it fails on
`static const' in C, and will actually trigger the assert below on:
test/Sema/inline-asm-validate-x86.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239651
91177308-0d34-0410-b5e6-
96231b3b80d8
// (immediate or symbolic), try to emit it as such.
if (!Info.allowsRegister() && !Info.allowsMemory()) {
llvm::APSInt Result;
- if (InputExpr->isIntegerConstantExpr(Result, getContext()))
+ if (InputExpr->EvaluateAsInt(Result, getContext()))
return llvm::ConstantInt::get(getLLVMContext(), Result);
assert(!Info.requiresImmediateConstant() &&
"Required-immediate inlineasm arg isn't constant?");
// CHECK-LABEL: @test_inlineasm_I
// CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 2)
+// CHECK: call void asm sideeffect "int $0", "I{{.*}}"(i32 3)
void test_inlineasm_I() {
__asm__ __volatile__("int %0" :: "I"(1 + 1));
+
+ // Also check a C non-ICE.
+ static const int N = 1;
+ __asm__ __volatile__("int %0" :: "I"(N + 2));
}