[clang] 765dd8b - [CGBuiltin] Simplify code. NFCI.
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 14 07:02:53 PST 2022
Author: Benjamin Kramer
Date: 2022-01-14T16:02:02+01:00
New Revision: 765dd8b8a44cd9689c87c0433739f421b9871061
URL: https://github.com/llvm/llvm-project/commit/765dd8b8a44cd9689c87c0433739f421b9871061
DIFF: https://github.com/llvm/llvm-project/commit/765dd8b8a44cd9689c87c0433739f421b9871061.diff
LOG: [CGBuiltin] Simplify code. NFCI.
Added:
Modified:
clang/lib/CodeGen/CGBuiltin.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index f68b7d3260e1..f9633f875b61 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -18462,15 +18462,11 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
llvm_unreachable("unexpected builtin ID");
}
llvm::Type *SrcT = Vec->getType();
- llvm::Type *TruncT =
- SrcT->getWithNewType(llvm::IntegerType::get(getLLVMContext(), 32));
+ llvm::Type *TruncT = SrcT->getWithNewType(Builder.getInt32Ty());
Function *Callee = CGM.getIntrinsic(IntNo, {TruncT, SrcT});
Value *Trunc = Builder.CreateCall(Callee, Vec);
- Value *Splat = Builder.CreateVectorSplat(2, Builder.getInt32(0));
- Value *ConcatMask =
- llvm::ConstantVector::get({Builder.getInt32(0), Builder.getInt32(1),
- Builder.getInt32(2), Builder.getInt32(3)});
- return Builder.CreateShuffleVector(Trunc, Splat, ConcatMask);
+ Value *Splat = Constant::getNullValue(TruncT);
+ return Builder.CreateShuffleVector(Trunc, Splat, ArrayRef<int>{0, 1, 2, 3});
}
case WebAssembly::BI__builtin_wasm_shuffle_i8x16: {
Value *Ops[18];
More information about the cfe-commits
mailing list