r309004 - Revert "This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements." as it is causing msan failures.

Eric Christopher via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 25 12:17:32 PDT 2017


Author: echristo
Date: Tue Jul 25 12:17:32 2017
New Revision: 309004

URL: http://llvm.org/viewvc/llvm-project?rev=309004&view=rev
Log:
Revert "This patch enables the usage of constant Enum identifiers within Microsoft style inline assembly statements." as it is causing msan failures.

This reverts commits r308985 and r308965

Removed:
    cfe/trunk/test/CodeGen/x86-ms-inline-asm-enum_feature.cpp
Modified:
    cfe/trunk/lib/Sema/SemaStmtAsm.cpp
    cfe/trunk/test/CodeGen/ms-inline-asm.c
    cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp

Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=309004&r1=309003&r2=309004&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Tue Jul 25 12:17:32 2017
@@ -645,8 +645,8 @@ ExprResult Sema::LookupInlineAsmIdentifi
   // Referring to parameters is not allowed in naked functions.
   if (CheckNakedParmReference(Result.get(), *this))
     return ExprError();
-  Expr *Res = Result.get();
-  QualType T = Res->getType();
+
+  QualType T = Result.get()->getType();
 
   if (T->isDependentType()) {
     return Result;
@@ -658,26 +658,16 @@ ExprResult Sema::LookupInlineAsmIdentifi
   }
 
   // Otherwise, it needs to be a complete type.
-  if (RequireCompleteExprType(Res, diag::err_asm_incomplete_type)) {
+  if (RequireCompleteExprType(Result.get(), diag::err_asm_incomplete_type)) {
     return ExprError();
   }
 
   fillInlineAsmTypeInfo(Context, T, Info);
 
   // We can work with the expression as long as it's not an r-value.
-  if (!Res->isRValue()) {
-    Info.setKindVariable();
-    return Result;
-  }
+  if (!Result.get()->isRValue())
+    Info.IsVarDecl = true;
 
-  Expr::EvalResult EvlResult;
-  // Try to evaluate the identifier as enum constant, currently we do not allow
-  // other constant integers to be folded.
-  if (isa<clang::EnumType>(T) &&
-    Res->EvaluateAsRValue(EvlResult, getASTContext())) {
-    Info.ConstIntValue = EvlResult.Val.getInt();
-    Info.setKindConstEnum();
-  }
   return Result;
 }
 
@@ -784,7 +774,7 @@ Sema::LookupInlineAsmVarDeclField(Expr *
   fillInlineAsmTypeInfo(Context, Result.get()->getType(), Info);
 
   // Fields are "variables" as far as inline assembly is concerned.
-  Info.setKindVariable();
+  Info.IsVarDecl = true;
 
   return Result;
 }

Modified: cfe/trunk/test/CodeGen/ms-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-inline-asm.c?rev=309004&r1=309003&r2=309004&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c (original)
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c Tue Jul 25 12:17:32 2017
@@ -42,7 +42,7 @@ void t5(void) {
 void t6(void) {
   __asm int 0x2c
 // CHECK: t6
-// CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "int $$0x2c", "~{dirflag},~{fpsr},~{flags}"()
 }
 
 void t7() {
@@ -61,7 +61,7 @@ void t7() {
     mov eax, ebx
   }
 // CHECK: t7
-// CHECK: call void asm sideeffect inteldialect "int $$44", "~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call void asm sideeffect inteldialect "int $$0x2cU", "~{dirflag},~{fpsr},~{flags}"()
 // CHECK: call void asm sideeffect inteldialect "", "~{dirflag},~{fpsr},~{flags}"()
 // CHECK: call void asm sideeffect inteldialect "mov eax, ebx", "~{eax},~{dirflag},~{fpsr},~{flags}"()
 }
@@ -94,7 +94,7 @@ void t9() {
 // CHECK: t9
 // CHECK: call void asm sideeffect inteldialect
 // CHECK-SAME: push ebx
-// CHECK-SAME: mov ebx, $$7
+// CHECK-SAME: mov ebx, $$0x07
 // CHECK-SAME: pop ebx
 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
 }
@@ -265,7 +265,7 @@ void t21() {
 // CHECK: t21
 // CHECK: call void asm sideeffect inteldialect
 // CHECK-SAME: push ebx
-// CHECK-SAME: mov ebx, $$7
+// CHECK-SAME: mov ebx, $$07H
 // CHECK-SAME: pop ebx
 // CHECK-SAME: "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
 }
@@ -312,13 +312,13 @@ void t24() {
 void t25() {
 // CHECK: t25
   __asm mov eax, 0ffffffffh
-// CHECK: mov eax, $$4294967295
+// CHECK: mov eax, $$0ffffffffh
   __asm mov eax, 0fhU
 // CHECK: mov eax, $$15
   __asm mov eax, 0a2h
-// CHECK: mov eax, $$162
+// CHECK: mov eax, $$0a2h
   __asm mov eax, 10100010b
-// CHECK: mov eax, $$162
+// CHECK: mov eax, $$10100010b
   __asm mov eax, 10100010BU
 // CHECK: mov eax, $$162
 // CHECK: "~{eax},~{dirflag},~{fpsr},~{flags}"()

Removed: cfe/trunk/test/CodeGen/x86-ms-inline-asm-enum_feature.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/x86-ms-inline-asm-enum_feature.cpp?rev=309003&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/x86-ms-inline-asm-enum_feature.cpp (original)
+++ cfe/trunk/test/CodeGen/x86-ms-inline-asm-enum_feature.cpp (removed)
@@ -1,60 +0,0 @@
-// REQUIRES: x86-registered-target
-// RUN: %clang_cc1 %s -triple x86_64-pc-win32 -fasm-blocks -emit-llvm -o - | FileCheck %s
-namespace x {
-enum { A = 12 };
-struct y_t {
-	enum { A = 17 };
-	int r;
-} y;
-}
-// CHECK-LABEL: x86_enum_only
-void x86_enum_only(){
-  const int a = 0;
-  // CHECK-NOT: mov eax, [$$0]
-  // Other constant type folding is currently unwanted.
-  __asm mov eax, [a]
-  }
-
-// CHECK-LABEL: x86_enum_namespaces
-void x86_enum_namespaces() {
-  enum { A = 1 };
-  // CHECK: call void asm
-  // CHECK-SAME: mov eax, $$12
-  __asm mov eax, x::A
-  // CHECK-SAME: mov eax, $$17
-  __asm mov eax, x::y_t::A
-  // CHECK-NEXT: call void asm
-  // CHECK-SAME: mov eax, $$1
-  __asm {mov eax, A}
-}
-
-// CHECK-LABEL: x86_enum_arithmethic
-void x86_enum_arithmethic() {
-  enum { A = 1, B };
-  // CHECK: call void asm
-  // CHECK-SAME: mov eax, $$21
-  __asm mov eax, (A + 9) * 2 + A
-  // CHECK-SAME: mov eax, $$4
-  __asm mov eax, A << 2
-  // CHECK-SAME: mov eax, $$2
-  __asm mov eax, B & 3
-  // CHECK-SAME: mov eax, $$5
-  __asm mov eax, 3 + (B & 3)
-  // CHECK-SAME: mov eax, $$8
-  __asm mov eax, 2 << A * B
-}
-
-// CHECK-LABEL: x86_enum_mem
-void x86_enum_mem() {
-  int arr[4];
-  enum { A = 4, B };
-  // CHECK: call void asm
-  // CHECK-SAME: mov eax, [($$12 + $$9) + $$4 * $$5 + $$3 + $$3 + eax]
-  __asm { mov eax, [(x::A + 9) + A * B + 3 + 3 + eax] }
-  // CHECK-NEXT: call void asm
-  // CHECK-SAME: mov eax, dword ptr $$4$0
-  __asm { mov eax, dword ptr [arr + A] }
-  // CHECK-NEXT: call void asm
-  // CHECK-SAME: mov eax, dword ptr $$8$0
-  __asm { mov eax, dword ptr A[arr + A] }
-}

Modified: cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp?rev=309004&r1=309003&r2=309004&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/ms-inline-asm-return.cpp Tue Jul 25 12:17:32 2017
@@ -70,7 +70,7 @@ FourChars f_s4() {
   }
 }
 // CHECK-LABEL: define i32 @f_s4()
-// CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$16843009", "={eax},~{eax},{{.*}}"
+// CHECK: %[[r:[^ ]*]] = call i32 asm sideeffect inteldialect "mov eax, $$0x01010101", "={eax},~{eax},{{.*}}"
 // CHECK: store i32 %[[r]], i32* %{{.*}}
 // CHECK: %[[r_i32:[^ ]*]] = load i32, i32* %{{.*}}
 // CHECK: ret i32 %[[r_i32]]
@@ -85,7 +85,7 @@ EightChars f_s8() {
   }
 }
 // CHECK-LABEL: define i64 @f_s8()
-// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$16843009\0A\09mov edx, $$85", "=A,~{eax},{{.*}}"
+// CHECK: %[[r:[^ ]*]] = call i64 asm sideeffect inteldialect "mov eax, $$01010101h\0A\09mov edx, $$01010101b", "=A,~{eax},{{.*}}"
 // CHECK: store i64 %[[r]], i64* %{{.*}}
 // CHECK: %[[r_i64:[^ ]*]] = load i64, i64* %{{.*}}
 // CHECK: ret i64 %[[r_i64]]




More information about the cfe-commits mailing list