Author: Xiang1 Zhang
Date: 2021-07-05T09:29:51+08:00
New Revision: a39bb960fc1e097ac573f3a13e831de3f8826ca2

URL: 
https://github.com/llvm/llvm-project/commit/a39bb960fc1e097ac573f3a13e831de3f8826ca2
DIFF: 
https://github.com/llvm/llvm-project/commit/a39bb960fc1e097ac573f3a13e831de3f8826ca2.diff

LOG: [X86] Refine code of generating BB labels in Keylocker

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D105336

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 494f998e3114..0a1a3f319dc1 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -14758,40 +14758,34 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
   case X86::BI__builtin_ia32_aesenc256kl_u8:
   case X86::BI__builtin_ia32_aesdec256kl_u8: {
     Intrinsic::ID IID;
-    StringRef StrNoErr, StrErr, StrEnd;
+    StringRef BlockName;
     switch (BuiltinID) {
-    default: llvm_unreachable("Unexpected builtin");
+    default:
+      llvm_unreachable("Unexpected builtin");
     case X86::BI__builtin_ia32_aesenc128kl_u8:
       IID = Intrinsic::x86_aesenc128kl;
-      StrNoErr = "aesenc128kl_no_error";
-      StrErr = "aesenc128kl_error";
-      StrEnd = "aesenc128kl_end";
+      BlockName = "aesenc128kl";
       break;
     case X86::BI__builtin_ia32_aesdec128kl_u8:
       IID = Intrinsic::x86_aesdec128kl;
-      StrNoErr = "aesdec128kl_no_error";
-      StrErr = "aesdec128kl_error";
-      StrEnd = "aesdec128kl_end";
+      BlockName = "aesdec128kl";
       break;
     case X86::BI__builtin_ia32_aesenc256kl_u8:
       IID = Intrinsic::x86_aesenc256kl;
-      StrNoErr = "aesenc256kl_no_error";
-      StrErr = "aesenc256kl_error";
-      StrEnd = "aesenc256kl_end";
+      BlockName = "aesenc256kl";
       break;
     case X86::BI__builtin_ia32_aesdec256kl_u8:
       IID = Intrinsic::x86_aesdec256kl;
-      StrNoErr = "aesdec256kl_no_error";
-      StrErr = "aesdec256kl_error";
-      StrEnd = "aesdec256kl_end";
+      BlockName = "aesdec256kl";
       break;
     }
 
     Value *Call = Builder.CreateCall(CGM.getIntrinsic(IID), {Ops[1], Ops[2]});
 
-    BasicBlock *NoError = createBasicBlock(StrNoErr, this->CurFn);
-    BasicBlock *Error = createBasicBlock(StrErr, this->CurFn);
-    BasicBlock *End = createBasicBlock(StrEnd, this->CurFn);
+    BasicBlock *NoError =
+        createBasicBlock(BlockName + "_no_error", this->CurFn);
+    BasicBlock *Error = createBasicBlock(BlockName + "_error", this->CurFn);
+    BasicBlock *End = createBasicBlock(BlockName + "_end", this->CurFn);
 
     Value *Ret = Builder.CreateExtractValue(Call, 0);
     Value *Succ = Builder.CreateTrunc(Ret, Builder.getInt1Ty());
@@ -14815,31 +14809,23 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
   case X86::BI__builtin_ia32_aesencwide256kl_u8:
   case X86::BI__builtin_ia32_aesdecwide256kl_u8: {
     Intrinsic::ID IID;
-    StringRef StrNoErr, StrErr, StrEnd;
+    StringRef BlockName;
     switch (BuiltinID) {
     case X86::BI__builtin_ia32_aesencwide128kl_u8:
       IID = Intrinsic::x86_aesencwide128kl;
-      StrNoErr = "aesencwide128kl_no_error";
-      StrErr = "aesencwide128kl_error";
-      StrEnd = "aesencwide128kl_end";
+      BlockName = "aesencwide128kl";
       break;
     case X86::BI__builtin_ia32_aesdecwide128kl_u8:
       IID = Intrinsic::x86_aesdecwide128kl;
-      StrNoErr = "aesdecwide128kl_no_error";
-      StrErr = "aesdecwide128kl_error";
-      StrEnd = "aesdecwide128kl_end";
+      BlockName = "aesdecwide128kl";
       break;
     case X86::BI__builtin_ia32_aesencwide256kl_u8:
       IID = Intrinsic::x86_aesencwide256kl;
-      StrNoErr = "aesencwide256kl_no_error";
-      StrErr = "aesencwide256kl_error";
-      StrEnd = "aesencwide256kl_end";
+      BlockName = "aesencwide256kl";
       break;
     case X86::BI__builtin_ia32_aesdecwide256kl_u8:
       IID = Intrinsic::x86_aesdecwide256kl;
-      StrNoErr = "aesdecwide256kl_no_error";
-      StrErr = "aesdecwide256kl_error";
-      StrEnd = "aesdecwide256kl_end";
+      BlockName = "aesdecwide256kl";
       break;
     }
 
@@ -14853,9 +14839,10 @@ Value *CodeGenFunction::EmitX86BuiltinExpr(unsigned 
BuiltinID,
 
     Value *Call = Builder.CreateCall(CGM.getIntrinsic(IID), InOps);
 
-    BasicBlock *NoError = createBasicBlock(StrNoErr, this->CurFn);
-    BasicBlock *Error = createBasicBlock(StrErr, this->CurFn);
-    BasicBlock *End = createBasicBlock(StrEnd, this->CurFn);
+    BasicBlock *NoError =
+        createBasicBlock(BlockName + "_no_error", this->CurFn);
+    BasicBlock *Error = createBasicBlock(BlockName + "_error", this->CurFn);
+    BasicBlock *End = createBasicBlock(BlockName + "_end", this->CurFn);
 
     Value *Ret = Builder.CreateExtractValue(Call, 0);
     Value *Succ = Builder.CreateTrunc(Ret, Builder.getInt1Ty());


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to