1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Revert "[TargetLowering] Only inspect attributes in the arguments for ArgListEntry"

Needs to be discussed more.

This reverts commit 255a5c1baa6020c009934b4fa342f9f6dbbcc46
This reverts commit df2056ff3730316f376f29d9986c9913b95ceb1
This reverts commit faff79b7ca144e505da6bc74aa2b2f7cffbbf23
This reverts commit d2a9020785c6e02afebc876aa2778fa64c5cafd
This commit is contained in:
Arthur Eubanks 2021-06-07 15:54:35 -07:00
parent edd1bdcef9
commit 4cc1a31398
18 changed files with 79 additions and 153 deletions

View File

@ -74,13 +74,6 @@ Changes to building LLVM
Changes to TableGen Changes to TableGen
------------------- -------------------
Changes to Backend Code Generation
----------------------------------
* When lowering calls, only ABI attributes on the call itself are checked, not
the caller. Frontends need to make sure to properly set ABI attributes on
calls (and always should have).
Changes to the ARM Backend Changes to the ARM Backend
-------------------------- --------------------------

View File

@ -102,32 +102,29 @@ bool TargetLowering::parametersInCSRMatch(const MachineRegisterInfo &MRI,
return true; return true;
} }
/// Set CallLoweringInfo attribute flags based on the call instruction's /// Set CallLoweringInfo attribute flags based on a call instruction
/// argument attributes. /// and called function attributes.
void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call, void TargetLoweringBase::ArgListEntry::setAttributes(const CallBase *Call,
unsigned ArgIdx) { unsigned ArgIdx) {
auto Attrs = Call->getAttributes(); IsSExt = Call->paramHasAttr(ArgIdx, Attribute::SExt);
IsZExt = Call->paramHasAttr(ArgIdx, Attribute::ZExt);
IsSExt = Attrs.hasParamAttribute(ArgIdx, Attribute::SExt); IsInReg = Call->paramHasAttr(ArgIdx, Attribute::InReg);
IsZExt = Attrs.hasParamAttribute(ArgIdx, Attribute::ZExt); IsSRet = Call->paramHasAttr(ArgIdx, Attribute::StructRet);
IsInReg = Attrs.hasParamAttribute(ArgIdx, Attribute::InReg); IsNest = Call->paramHasAttr(ArgIdx, Attribute::Nest);
IsSRet = Attrs.hasParamAttribute(ArgIdx, Attribute::StructRet); IsByVal = Call->paramHasAttr(ArgIdx, Attribute::ByVal);
IsNest = Attrs.hasParamAttribute(ArgIdx, Attribute::Nest); IsPreallocated = Call->paramHasAttr(ArgIdx, Attribute::Preallocated);
IsReturned = Attrs.hasParamAttribute(ArgIdx, Attribute::Returned); IsInAlloca = Call->paramHasAttr(ArgIdx, Attribute::InAlloca);
IsSwiftSelf = Attrs.hasParamAttribute(ArgIdx, Attribute::SwiftSelf); IsReturned = Call->paramHasAttr(ArgIdx, Attribute::Returned);
IsSwiftAsync = Attrs.hasParamAttribute(ArgIdx, Attribute::SwiftAsync); IsSwiftSelf = Call->paramHasAttr(ArgIdx, Attribute::SwiftSelf);
IsSwiftError = Attrs.hasParamAttribute(ArgIdx, Attribute::SwiftError); IsSwiftAsync = Call->paramHasAttr(ArgIdx, Attribute::SwiftAsync);
Alignment = Attrs.getParamStackAlignment(ArgIdx); IsSwiftError = Call->paramHasAttr(ArgIdx, Attribute::SwiftError);
Alignment = Call->getParamStackAlign(ArgIdx);
IsByVal = Attrs.hasParamAttribute(ArgIdx, Attribute::ByVal);
ByValType = nullptr; ByValType = nullptr;
if (IsByVal) { if (IsByVal) {
ByValType = Call->getParamByValType(ArgIdx); ByValType = Call->getParamByValType(ArgIdx);
if (!Alignment) if (!Alignment)
Alignment = Call->getParamAlign(ArgIdx); Alignment = Call->getParamAlign(ArgIdx);
} }
IsInAlloca = Attrs.hasParamAttribute(ArgIdx, Attribute::InAlloca);
IsPreallocated = Attrs.hasParamAttribute(ArgIdx, Attribute::Preallocated);
PreallocatedType = nullptr; PreallocatedType = nullptr;
if (IsPreallocated) if (IsPreallocated)
PreallocatedType = Call->getParamPreallocatedType(ArgIdx); PreallocatedType = Call->getParamPreallocatedType(ArgIdx);

View File

@ -1241,7 +1241,6 @@ DataFlowSanitizer::buildWrapperFunction(Function *F, StringRef NewFName,
std::vector<Value *> Args(ArgIt, ArgIt + FT->getNumParams()); std::vector<Value *> Args(ArgIt, ArgIt + FT->getNumParams());
CallInst *CI = CallInst::Create(F, Args, "", BB); CallInst *CI = CallInst::Create(F, Args, "", BB);
CI->setAttributes(F->getAttributes());
if (FT->getReturnType()->isVoidTy()) if (FT->getReturnType()->isVoidTy())
ReturnInst::Create(*Ctx, BB); ReturnInst::Create(*Ctx, BB);
else else
@ -2481,17 +2480,13 @@ void DFSanVisitor::visitLoadInst(LoadInst &LI) {
Value *DFSanFunction::updateOriginIfTainted(Value *Shadow, Value *Origin, Value *DFSanFunction::updateOriginIfTainted(Value *Shadow, Value *Origin,
IRBuilder<> &IRB) { IRBuilder<> &IRB) {
assert(DFS.shouldTrackOrigins()); assert(DFS.shouldTrackOrigins());
auto *CB = IRB.CreateCall(DFS.DFSanChainOriginIfTaintedFn, {Shadow, Origin}); return IRB.CreateCall(DFS.DFSanChainOriginIfTaintedFn, {Shadow, Origin});
CB->setAttributes(CB->getCalledFunction()->getAttributes());
return CB;
} }
Value *DFSanFunction::updateOrigin(Value *V, IRBuilder<> &IRB) { Value *DFSanFunction::updateOrigin(Value *V, IRBuilder<> &IRB) {
if (!DFS.shouldTrackOrigins()) if (!DFS.shouldTrackOrigins())
return V; return V;
auto *CB = IRB.CreateCall(DFS.DFSanChainOriginFn, V); return IRB.CreateCall(DFS.DFSanChainOriginFn, V);
CB->setAttributes(CB->getCalledFunction()->getAttributes());
return CB;
} }
Value *DFSanFunction::originToIntptr(IRBuilder<> &IRB, Value *Origin) { Value *DFSanFunction::originToIntptr(IRBuilder<> &IRB, Value *Origin) {
@ -2566,11 +2561,10 @@ void DFSanFunction::storeOrigin(Instruction *Pos, Value *Addr, uint64_t Size,
} }
if (shouldInstrumentWithCall()) { if (shouldInstrumentWithCall()) {
auto *CB = IRB.CreateCall(DFS.DFSanMaybeStoreOriginFn, IRB.CreateCall(DFS.DFSanMaybeStoreOriginFn,
{CollapsedShadow, {CollapsedShadow,
IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()), IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
ConstantInt::get(DFS.IntptrTy, Size), Origin}); ConstantInt::get(DFS.IntptrTy, Size), Origin});
CB->setAttributes(CB->getCalledFunction()->getAttributes());
} else { } else {
Value *Cmp = convertToBool(CollapsedShadow, IRB, "_dfscmp"); Value *Cmp = convertToBool(CollapsedShadow, IRB, "_dfscmp");
Instruction *CheckTerm = SplitBlockAndInsertIfThen( Instruction *CheckTerm = SplitBlockAndInsertIfThen(
@ -2943,12 +2937,11 @@ void DFSanVisitor::visitMemSetInst(MemSetInst &I) {
Value *ValOrigin = DFSF.DFS.shouldTrackOrigins() Value *ValOrigin = DFSF.DFS.shouldTrackOrigins()
? DFSF.getOrigin(I.getValue()) ? DFSF.getOrigin(I.getValue())
: DFSF.DFS.ZeroOrigin; : DFSF.DFS.ZeroOrigin;
auto *CB = IRB.CreateCall( IRB.CreateCall(
DFSF.DFS.DFSanSetLabelFn, DFSF.DFS.DFSanSetLabelFn,
{ValShadow, ValOrigin, {ValShadow, ValOrigin,
IRB.CreateBitCast(I.getDest(), Type::getInt8PtrTy(*DFSF.DFS.Ctx)), IRB.CreateBitCast(I.getDest(), Type::getInt8PtrTy(*DFSF.DFS.Ctx)),
IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy)}); IRB.CreateZExtOrTrunc(I.getLength(), DFSF.DFS.IntptrTy)});
CB->setAttributes(CB->getCalledFunction()->getAttributes());
} }
void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) { void DFSanVisitor::visitMemTransferInst(MemTransferInst &I) {

View File

@ -840,9 +840,8 @@ void ModuleSanitizerCoverage::InjectTraceForDiv(
TypeSize == 64 ? 1 : -1; TypeSize == 64 ? 1 : -1;
if (CallbackIdx < 0) continue; if (CallbackIdx < 0) continue;
auto Ty = Type::getIntNTy(*C, TypeSize); auto Ty = Type::getIntNTy(*C, TypeSize);
auto *CB = IRB.CreateCall(SanCovTraceDivFunction[CallbackIdx], IRB.CreateCall(SanCovTraceDivFunction[CallbackIdx],
{IRB.CreateIntCast(A1, Ty, true)}); {IRB.CreateIntCast(A1, Ty, true)});
CB->setAttributes(CB->getCalledFunction()->getAttributes());
} }
} }
@ -886,10 +885,8 @@ void ModuleSanitizerCoverage::InjectTraceForCmp(
} }
auto Ty = Type::getIntNTy(*C, TypeSize); auto Ty = Type::getIntNTy(*C, TypeSize);
auto *CB = IRB.CreateCall(CallbackFunc, {IRB.CreateIntCast(A0, Ty, true),
IRB.CreateCall(CallbackFunc, {IRB.CreateIntCast(A0, Ty, true), IRB.CreateIntCast(A1, Ty, true)});
IRB.CreateIntCast(A1, Ty, true)});
CB->setAttributes(CB->getCalledFunction()->getAttributes());
} }
} }
} }

View File

@ -11,10 +11,8 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "llvm/Transforms/Utils/BuildLibCalls.h" #include "llvm/Transforms/Utils/BuildLibCalls.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
@ -24,6 +22,7 @@
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Type.h" #include "llvm/IR/Type.h"
#include "llvm/Analysis/MemoryBuiltins.h"
using namespace llvm; using namespace llvm;
@ -1499,15 +1498,9 @@ static Value *emitBinaryFloatFnCallHelper(Value *Op1, Value *Op2,
// The incoming attribute set may have come from a speculatable intrinsic, but // The incoming attribute set may have come from a speculatable intrinsic, but
// is being replaced with a library call which is not allowed to be // is being replaced with a library call which is not allowed to be
// speculatable. // speculatable.
// We also need to merge with the callee's attributes, which may contain ABI CI->setAttributes(Attrs.removeAttribute(B.getContext(),
// attributes. AttributeList::FunctionIndex,
AttributeList NewAttrs = AttributeList::get( Attribute::Speculatable));
B.getContext(),
makeArrayRef(
{Attrs.removeAttribute(B.getContext(), AttributeList::FunctionIndex,
Attribute::Speculatable),
CI->getCalledFunction()->getAttributes()}));
CI->setAttributes(NewAttrs);
if (const Function *F = if (const Function *F =
dyn_cast<Function>(Callee.getCallee()->stripPointerCasts())) dyn_cast<Function>(Callee.getCallee()->stripPointerCasts()))
CI->setCallingConv(F->getCallingConv()); CI->setCallingConv(F->getCallingConv());

View File

@ -1,45 +0,0 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
; This tests that we only look at the call site for ABI attributes, so f and f2 should codegen differently
define void @b(i8* byval(i8) %p) {
; CHECK-LABEL: b:
; CHECK: # %bb.0:
; CHECK-NEXT: retq
ret void
}
define void @f(i8 %p) {
; CHECK-LABEL: f:
; CHECK: # %bb.0:
; CHECK-NEXT: subq $24, %rsp
; CHECK-NEXT: .cfi_def_cfa_offset 32
; CHECK-NEXT: movb {{[0-9]+}}(%rsp), %al
; CHECK-NEXT: movb %al, (%rsp)
; CHECK-NEXT: callq b@PLT
; CHECK-NEXT: addq $24, %rsp
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: retq
%a = alloca i8
;store i8 %p, i8* %a
call void @b(i8* byval(i8) %a)
ret void
}
define void @f2(i8 %p) {
; CHECK-LABEL: f2:
; CHECK: # %bb.0:
; CHECK-NEXT: pushq %rax
; CHECK-NEXT: .cfi_def_cfa_offset 16
; CHECK-NEXT: leaq {{[0-9]+}}(%rsp), %rdi
; CHECK-NEXT: callq b@PLT
; CHECK-NEXT: popq %rax
; CHECK-NEXT: .cfi_def_cfa_offset 8
; CHECK-NEXT: retq
%a = alloca i8
;store i8 %p, i8* %a
call void @b(i8* %a)
ret void
}

View File

@ -10,7 +10,7 @@ declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1)
define void @ms(i8* %p, i8 %v) { define void @ms(i8* %p, i8 %v) {
; CHECK-LABEL: @"dfs$ms" ; CHECK-LABEL: @"dfs$ms"
; CHECK-SAME: (i8* %0, i8 %1, i[[#SBITS]] %2, i[[#SBITS]] %3) ; CHECK-SAME: (i8* %0, i8 %1, i[[#SBITS]] %2, i[[#SBITS]] %3)
; CHECK: call void @__dfsan_set_label(i[[#SBITS]] zeroext %3, i32 zeroext 0, i8* %0, i64 1) ; CHECK: call void @__dfsan_set_label(i[[#SBITS]] %3, i32 0, i8* %0, i64 1)
call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1) call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1)
ret void ret void
} }

View File

@ -36,7 +36,7 @@ define void @memset(i8* %p, i8 %v) {
; CHECK: @"dfs$memset" ; CHECK: @"dfs$memset"
; CHECK: [[O:%.*]] = load i32, i32* getelementptr inbounds ([200 x i32], [200 x i32]* @__dfsan_arg_origin_tls, i64 0, i64 1), align 4 ; CHECK: [[O:%.*]] = load i32, i32* getelementptr inbounds ([200 x i32], [200 x i32]* @__dfsan_arg_origin_tls, i64 0, i64 1), align 4
; CHECK: [[S:%.*]] = load i[[#SBITS]], i[[#SBITS]]* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__dfsan_arg_tls to i64), i64 2) to i[[#SBITS]]*), align [[ALIGN:2]] ; CHECK: [[S:%.*]] = load i[[#SBITS]], i[[#SBITS]]* inttoptr (i64 add (i64 ptrtoint ([100 x i64]* @__dfsan_arg_tls to i64), i64 2) to i[[#SBITS]]*), align [[ALIGN:2]]
; CHECK: call void @__dfsan_set_label(i[[#SBITS]] zeroext [[S]], i32 zeroext [[O]], i8* %p, i64 1) ; CHECK: call void @__dfsan_set_label(i[[#SBITS]] [[S]], i32 [[O]], i8* %p, i64 1)
call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1) call void @llvm.memset.p0i8.i64(i8* %p, i8 %v, i64 1, i1 1)
ret void ret void
} }

View File

@ -63,7 +63,7 @@ define void @store_nonzero_to_escaped_alloca(i16 %a) {
; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0 ; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0
; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]], ; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]],
; CHECK: [[L1]]: ; CHECK: [[L1]]:
; CHECK-NEXT: %[[#NO:]] = call zeroext i32 @__dfsan_chain_origin(i32 zeroext %[[#AO]]) ; CHECK-NEXT: %[[#NO:]] = call i32 @__dfsan_chain_origin(i32 %[[#AO]])
; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#ORIGIN_PTR]], align 4 ; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#ORIGIN_PTR]], align 4
; CHECK-NEXT: br label %[[L2]] ; CHECK-NEXT: br label %[[L2]]
; CHECK: [[L2]]: ; CHECK: [[L2]]:
@ -91,7 +91,7 @@ define void @store64_align8(i64* %p, i64 %a) {
; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0 ; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0
; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]], ; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]],
; CHECK: [[L1]]: ; CHECK: [[L1]]:
; CHECK-NEXT: %[[#NO:]] = call zeroext i32 @__dfsan_chain_origin(i32 zeroext %[[#AO]]) ; CHECK-NEXT: %[[#NO:]] = call i32 @__dfsan_chain_origin(i32 %[[#AO]])
; CHECK-NEXT: %[[#NO_ZEXT:]] = zext i32 %[[#NO]] to i64 ; CHECK-NEXT: %[[#NO_ZEXT:]] = zext i32 %[[#NO]] to i64
; CHECK-NEXT: %[[#NO_SHL:]] = shl i64 %[[#NO_ZEXT]], 32 ; CHECK-NEXT: %[[#NO_SHL:]] = shl i64 %[[#NO_ZEXT]], 32
; CHECK-NEXT: %[[#NO2:]] = or i64 %[[#NO_ZEXT]], %[[#NO_SHL]] ; CHECK-NEXT: %[[#NO2:]] = or i64 %[[#NO_ZEXT]], %[[#NO_SHL]]
@ -121,7 +121,7 @@ define void @store64_align2(i64* %p, i64 %a) {
; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0 ; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0
; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]], ; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]],
; CHECK: [[L1]]: ; CHECK: [[L1]]:
; CHECK-NEXT: %[[#NO:]] = call zeroext i32 @__dfsan_chain_origin(i32 zeroext %[[#AO]]) ; CHECK-NEXT: %[[#NO:]] = call i32 @__dfsan_chain_origin(i32 %[[#AO]])
; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#O_PTR0:]], align 4 ; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#O_PTR0:]], align 4
; CHECK-NEXT: %[[#O_PTR1:]] = getelementptr i32, i32* %[[#O_PTR0]], i32 1 ; CHECK-NEXT: %[[#O_PTR1:]] = getelementptr i32, i32* %[[#O_PTR0]], i32 1
; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#O_PTR1]], align 4 ; CHECK-NEXT: store i32 %[[#NO]], i32* %[[#O_PTR1]], align 4
@ -148,7 +148,7 @@ define void @store96_align8(i96* %p, i96 %a) {
; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0 ; CHECK: %_dfscmp = icmp ne i[[#SBITS]] %[[#AS]], 0
; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]], ; CHECK-NEXT: br i1 %_dfscmp, label %[[L1:.*]], label %[[L2:.*]],
; CHECK: [[L1]]: ; CHECK: [[L1]]:
; CHECK-NEXT: %[[#NO:]] = call zeroext i32 @__dfsan_chain_origin(i32 zeroext %[[#AO]]) ; CHECK-NEXT: %[[#NO:]] = call i32 @__dfsan_chain_origin(i32 %[[#AO]])
; CHECK-NEXT: %[[#NO_ZEXT:]] = zext i32 %[[#NO]] to i64 ; CHECK-NEXT: %[[#NO_ZEXT:]] = zext i32 %[[#NO]] to i64
; CHECK-NEXT: %[[#NO_SHL:]] = shl i64 %[[#NO_ZEXT]], 32 ; CHECK-NEXT: %[[#NO_SHL:]] = shl i64 %[[#NO_ZEXT]], 32
; CHECK-NEXT: %[[#NO2:]] = or i64 %[[#NO_ZEXT]], %[[#NO_SHL]] ; CHECK-NEXT: %[[#NO2:]] = or i64 %[[#NO_ZEXT]], %[[#NO_SHL]]

View File

@ -14,7 +14,7 @@ define void @store_threshold([2 x i64]* %p, [2 x i64] %a) {
; CHECK: [[AS1:%.*]] = extractvalue [2 x i[[#SBITS]]] [[AS]], 1 ; CHECK: [[AS1:%.*]] = extractvalue [2 x i[[#SBITS]]] [[AS]], 1
; CHECK: [[AS01:%.*]] = or i[[#SBITS]] [[AS0]], [[AS1]] ; CHECK: [[AS01:%.*]] = or i[[#SBITS]] [[AS0]], [[AS1]]
; CHECK: [[ADDR:%.*]] = bitcast [2 x i64]* %p to i8* ; CHECK: [[ADDR:%.*]] = bitcast [2 x i64]* %p to i8*
; CHECK: call void @__dfsan_maybe_store_origin(i[[#SBITS]] zeroext [[AS01]], i8* [[ADDR]], i64 16, i32 zeroext [[AO]]) ; CHECK: call void @__dfsan_maybe_store_origin(i[[#SBITS]] [[AS01]], i8* [[ADDR]], i64 16, i32 [[AO]])
; CHECK: store [2 x i64] %a, [2 x i64]* %p, align 8 ; CHECK: store [2 x i64] %a, [2 x i64]* %p, align 8
store [2 x i64] %a, [2 x i64]* %p store [2 x i64] %a, [2 x i64]* %p

View File

@ -17,7 +17,7 @@ define i64 @load64(i64* %p) {
; CHECK-NEXT: %[[#LABEL_ORIGIN_H32:]] = lshr i64 %[[#LABEL_ORIGIN]], 32 ; CHECK-NEXT: %[[#LABEL_ORIGIN_H32:]] = lshr i64 %[[#LABEL_ORIGIN]], 32
; CHECK-NEXT: %[[#LABEL:]] = trunc i64 %[[#LABEL_ORIGIN_H32]] to i[[#SBITS]] ; CHECK-NEXT: %[[#LABEL:]] = trunc i64 %[[#LABEL_ORIGIN_H32]] to i[[#SBITS]]
; CHECK-NEXT: %[[#ORIGIN:]] = trunc i64 %[[#LABEL_ORIGIN]] to i32 ; CHECK-NEXT: %[[#ORIGIN:]] = trunc i64 %[[#LABEL_ORIGIN]] to i32
; CHECK-NEXT: %[[#ORIGIN_CHAINED:]] = call zeroext i32 @__dfsan_chain_origin_if_tainted(i[[#SBITS]] zeroext %[[#LABEL]], i32 zeroext %[[#ORIGIN]]) ; CHECK-NEXT: %[[#ORIGIN_CHAINED:]] = call i32 @__dfsan_chain_origin_if_tainted(i[[#SBITS]] %[[#LABEL]], i32 %[[#ORIGIN]])
; CHECK-NEXT: %[[#LABEL:]] = or i[[#SBITS]] %[[#LABEL]], %[[#PS]] ; CHECK-NEXT: %[[#LABEL:]] = or i[[#SBITS]] %[[#LABEL]], %[[#PS]]
; CHECK-NEXT: %[[#NZ:]] = icmp ne i[[#SBITS]] %[[#PS]], 0 ; CHECK-NEXT: %[[#NZ:]] = icmp ne i[[#SBITS]] %[[#PS]], 0

View File

@ -41,15 +41,15 @@ entry:
declare zeroext i16 @dfsan_get_label(i64 signext) declare zeroext i16 @dfsan_get_label(i64 signext)
; CHECK-LABEL: @"dfsw$dfsan_get_label" ; CHECK-LABEL: @"dfsw$dfsan_get_label"
; CHECK: %{{.*}} = call zeroext i16 @__dfsw_dfsan_get_label(i64 signext %0, i[[#SBITS]] zeroext %1, i[[#SBITS]]* %{{.*}}) ; CHECK: %{{.*}} = call i16 @__dfsw_dfsan_get_label(i64 %0, i[[#SBITS]] zeroext %1, i[[#SBITS]]* %{{.*}})
declare zeroext i16 @k2(i64 signext, i64 signext) declare zeroext i16 @k2(i64 signext, i64 signext)
; CHECK-LABEL: @"dfsw$k2" ; CHECK-LABEL: @"dfsw$k2"
; CHECK: %{{.*}} = call zeroext i16 @__dfsw_k2(i64 signext %{{.*}}, i64 signext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]]* %{{.*}}) ; CHECK: %{{.*}} = call i16 @__dfsw_k2(i64 %{{.*}}, i64 %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]]* %{{.*}})
declare zeroext i16 @k4(i64 signext, i64 signext, i64 signext, i64 signext) declare zeroext i16 @k4(i64 signext, i64 signext, i64 signext, i64 signext)
; CHECK-LABEL: @"dfsw$k4" ; CHECK-LABEL: @"dfsw$k4"
; CHECK: %{{.*}} = call zeroext i16 @__dfsw_k4(i64 signext %{{.*}}, i64 signext %{{.*}}, i64 signext %{{.*}}, i64 signext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]]* %{{.*}}) ; CHECK: %{{.*}} = call i16 @__dfsw_k4(i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, i64 %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]] zeroext %{{.*}}, i[[#SBITS]]* %{{.*}})
; CHECK: declare zeroext i16 @__dfsw_dfsan_get_label(i64 signext, i[[#SBITS]], i[[#SBITS]]*) ; CHECK: declare zeroext i16 @__dfsw_dfsan_get_label(i64 signext, i[[#SBITS]], i[[#SBITS]]*)

View File

@ -14,12 +14,12 @@ entry:
; compare (const, non-const) ; compare (const, non-const)
icmp slt i32 %a, 1 icmp slt i32 %a, 1
; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 zeroext 1, i32 zeroext %a) ; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a)
; CHECK-NEXT: icmp slt i32 %a, 1 ; CHECK-NEXT: icmp slt i32 %a, 1
; compare (non-const, const) ; compare (non-const, const)
icmp slt i32 1, %a icmp slt i32 1, %a
; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 zeroext 1, i32 zeroext %a) ; CHECK: call void @__sanitizer_cov_trace_const_cmp4(i32 1, i32 %a)
; CHECK-NEXT: icmp slt i32 1, %a ; CHECK-NEXT: icmp slt i32 1, %a
; compare (const, const) - should not be instrumented ; compare (const, const) - should not be instrumented
@ -31,22 +31,22 @@ entry:
%x = trunc i32 %a to i8 %x = trunc i32 %a to i8
icmp slt i8 %x, 1 icmp slt i8 %x, 1
; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 zeroext 1, i8 zeroext %x) ; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x)
; CHECK-NEXT: icmp slt i8 %x, 1 ; CHECK-NEXT: icmp slt i8 %x, 1
icmp slt i8 1, %x icmp slt i8 1, %x
; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 zeroext 1, i8 zeroext %x) ; CHECK: call void @__sanitizer_cov_trace_const_cmp1(i8 1, i8 %x)
; CHECK-NEXT: icmp slt i8 1, %x ; CHECK-NEXT: icmp slt i8 1, %x
; compare variables of word size ; compare variables of word size
%y = trunc i32 %a to i16 %y = trunc i32 %a to i16
icmp slt i16 %y, 1 icmp slt i16 %y, 1
; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 zeroext 1, i16 zeroext %y) ; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y)
; CHECK-NEXT: icmp slt i16 %y, 1 ; CHECK-NEXT: icmp slt i16 %y, 1
icmp slt i16 1, %y icmp slt i16 1, %y
; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 zeroext 1, i16 zeroext %y) ; CHECK: call void @__sanitizer_cov_trace_const_cmp2(i16 1, i16 %y)
; CHECK-NEXT: icmp slt i16 1, %y ; CHECK-NEXT: icmp slt i16 1, %y
; compare variables of qword size ; compare variables of qword size

View File

@ -12,7 +12,7 @@ entry:
} }
; CHECK-LABEL: @div_a_b ; CHECK-LABEL: @div_a_b
; CHECK: call void @__sanitizer_cov_trace_div4(i32 zeroext %b) ; CHECK: call void @__sanitizer_cov_trace_div4(i32 %b)
; CHECK: ret ; CHECK: ret

View File

@ -15,7 +15,7 @@ declare float @exp2f(float)
define double @test_simplify1(i32 %x) { define double @test_simplify1(i32 %x) {
; LDEXP32-LABEL: @test_simplify1( ; LDEXP32-LABEL: @test_simplify1(
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[X:%.*]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[X:%.*]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify1( ; LDEXP16-LABEL: @test_simplify1(
@ -24,7 +24,7 @@ define double @test_simplify1(i32 %x) {
; LDEXP16-NEXT: ret double [[RET]] ; LDEXP16-NEXT: ret double [[RET]]
; ;
; NOLDEXPF-LABEL: @test_simplify1( ; NOLDEXPF-LABEL: @test_simplify1(
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[X:%.*]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[X:%.*]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify1( ; NOLDEXP-LABEL: @test_simplify1(
@ -40,16 +40,16 @@ define double @test_simplify1(i32 %x) {
define double @test_simplify2(i16 signext %x) { define double @test_simplify2(i16 signext %x) {
; LDEXP32-LABEL: @test_simplify2( ; LDEXP32-LABEL: @test_simplify2(
; LDEXP32-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify2( ; LDEXP16-LABEL: @test_simplify2(
; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[X:%.*]]) ; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[X:%.*]])
; LDEXP16-NEXT: ret double [[LDEXP]] ; LDEXP16-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXPF-LABEL: @test_simplify2( ; NOLDEXPF-LABEL: @test_simplify2(
; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32 ; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i16 [[X:%.*]] to i32
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify2( ; NOLDEXP-LABEL: @test_simplify2(
@ -65,17 +65,17 @@ define double @test_simplify2(i16 signext %x) {
define double @test_simplify3(i8 signext %x) { define double @test_simplify3(i8 signext %x) {
; LDEXP32-LABEL: @test_simplify3( ; LDEXP32-LABEL: @test_simplify3(
; LDEXP32-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify3( ; LDEXP16-LABEL: @test_simplify3(
; LDEXP16-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i16 ; LDEXP16-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i16
; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) ; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]])
; LDEXP16-NEXT: ret double [[LDEXP]] ; LDEXP16-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXPF-LABEL: @test_simplify3( ; NOLDEXPF-LABEL: @test_simplify3(
; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32 ; NOLDEXPF-NEXT: [[TMP1:%.*]] = sext i8 [[X:%.*]] to i32
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify3( ; NOLDEXP-LABEL: @test_simplify3(
@ -90,7 +90,7 @@ define double @test_simplify3(i8 signext %x) {
define float @test_simplify4(i32 %x) { define float @test_simplify4(i32 %x) {
; LDEXP32-LABEL: @test_simplify4( ; LDEXP32-LABEL: @test_simplify4(
; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) ; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[X:%.*]])
; LDEXP32-NEXT: ret float [[LDEXPF]] ; LDEXP32-NEXT: ret float [[LDEXPF]]
; ;
; LDEXP16-LABEL: @test_simplify4( ; LDEXP16-LABEL: @test_simplify4(
@ -144,7 +144,7 @@ define double @test_no_simplify1(i32 %x) {
define double @test_simplify6(i16 zeroext %x) { define double @test_simplify6(i16 zeroext %x) {
; LDEXP32-LABEL: @test_simplify6( ; LDEXP32-LABEL: @test_simplify6(
; LDEXP32-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify6( ; LDEXP16-LABEL: @test_simplify6(
@ -154,7 +154,7 @@ define double @test_simplify6(i16 zeroext %x) {
; ;
; NOLDEXPF-LABEL: @test_simplify6( ; NOLDEXPF-LABEL: @test_simplify6(
; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32 ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i16 [[X:%.*]] to i32
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify6( ; NOLDEXP-LABEL: @test_simplify6(
@ -170,17 +170,17 @@ define double @test_simplify6(i16 zeroext %x) {
define double @test_simplify7(i8 zeroext %x) { define double @test_simplify7(i8 zeroext %x) {
; LDEXP32-LABEL: @test_simplify7( ; LDEXP32-LABEL: @test_simplify7(
; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify7( ; LDEXP16-LABEL: @test_simplify7(
; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16
; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) ; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]])
; LDEXP16-NEXT: ret double [[LDEXP]] ; LDEXP16-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXPF-LABEL: @test_simplify7( ; NOLDEXPF-LABEL: @test_simplify7(
; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify7( ; NOLDEXP-LABEL: @test_simplify7(
@ -196,12 +196,12 @@ define double @test_simplify7(i8 zeroext %x) {
define float @test_simplify8(i8 zeroext %x) { define float @test_simplify8(i8 zeroext %x) {
; LDEXP32-LABEL: @test_simplify8( ; LDEXP32-LABEL: @test_simplify8(
; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret float [[LDEXPF]] ; LDEXP32-NEXT: ret float [[LDEXPF]]
; ;
; LDEXP16-LABEL: @test_simplify8( ; LDEXP16-LABEL: @test_simplify8(
; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16
; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) ; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[TMP1]])
; LDEXP16-NEXT: ret float [[LDEXPF]] ; LDEXP16-NEXT: ret float [[LDEXPF]]
; ;
; NOLDEXPF-LABEL: @test_simplify8( ; NOLDEXPF-LABEL: @test_simplify8(
@ -225,17 +225,17 @@ declare float @llvm.exp2.f32(float)
define double @test_simplify9(i8 zeroext %x) { define double @test_simplify9(i8 zeroext %x) {
; LDEXP32-LABEL: @test_simplify9( ; LDEXP32-LABEL: @test_simplify9(
; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret double [[LDEXP]] ; LDEXP32-NEXT: ret double [[LDEXP]]
; ;
; LDEXP16-LABEL: @test_simplify9( ; LDEXP16-LABEL: @test_simplify9(
; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16
; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 signext [[TMP1]]) ; LDEXP16-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i16 [[TMP1]])
; LDEXP16-NEXT: ret double [[LDEXP]] ; LDEXP16-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXPF-LABEL: @test_simplify9( ; NOLDEXPF-LABEL: @test_simplify9(
; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; NOLDEXPF-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 signext [[TMP1]]) ; NOLDEXPF-NEXT: [[LDEXP:%.*]] = call double @ldexp(double 1.000000e+00, i32 [[TMP1]])
; NOLDEXPF-NEXT: ret double [[LDEXP]] ; NOLDEXPF-NEXT: ret double [[LDEXP]]
; ;
; NOLDEXP-LABEL: @test_simplify9( ; NOLDEXP-LABEL: @test_simplify9(
@ -251,12 +251,12 @@ define double @test_simplify9(i8 zeroext %x) {
define float @test_simplify10(i8 zeroext %x) { define float @test_simplify10(i8 zeroext %x) {
; LDEXP32-LABEL: @test_simplify10( ; LDEXP32-LABEL: @test_simplify10(
; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32 ; LDEXP32-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i32
; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) ; LDEXP32-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[TMP1]])
; LDEXP32-NEXT: ret float [[LDEXPF]] ; LDEXP32-NEXT: ret float [[LDEXPF]]
; ;
; LDEXP16-LABEL: @test_simplify10( ; LDEXP16-LABEL: @test_simplify10(
; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16 ; LDEXP16-NEXT: [[TMP1:%.*]] = zext i8 [[X:%.*]] to i16
; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) ; LDEXP16-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[TMP1]])
; LDEXP16-NEXT: ret float [[LDEXPF]] ; LDEXP16-NEXT: ret float [[LDEXPF]]
; ;
; NOLDEXPF-LABEL: @test_simplify10( ; NOLDEXPF-LABEL: @test_simplify10(

View File

@ -51,7 +51,7 @@ define double @pow_uitofp_double_const_base_fast(i31 %x) {
define double @pow_sitofp_double_const_base_2_fast(i32 %x) { define double @pow_sitofp_double_const_base_2_fast(i32 %x) {
; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast( ; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast(
; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 [[X:%.*]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;
@ -78,7 +78,7 @@ define double @pow_sitofp_double_const_base_power_of_2_fast(i32 %x) {
define double @pow_uitofp_const_base_2_fast(i31 %x) { define double @pow_uitofp_const_base_2_fast(i31 %x) {
; CHECK-LABEL: @pow_uitofp_const_base_2_fast( ; CHECK-LABEL: @pow_uitofp_const_base_2_fast(
; CHECK-NEXT: [[TMP1:%.*]] = zext i31 [[X:%.*]] to i32 ; CHECK-NEXT: [[TMP1:%.*]] = zext i31 [[X:%.*]] to i32
; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 signext [[TMP1]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i32 [[TMP1]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;
@ -343,7 +343,7 @@ define double @pow_uitofp_const_base_no_fast(i32 %x) {
define double @pow_sitofp_const_base_2_no_fast(i32 %x) { define double @pow_sitofp_const_base_2_no_fast(i32 %x) {
; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast( ; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast(
; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 signext [[X:%.*]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i32 [[X:%.*]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;

View File

@ -57,7 +57,7 @@ define double @pow_uitofp_double_const_base_fast(i15 %x) {
define double @pow_sitofp_double_const_base_2_fast(i16 %x) { define double @pow_sitofp_double_const_base_2_fast(i16 %x) {
; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast( ; CHECK-LABEL: @pow_sitofp_double_const_base_2_fast(
; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 signext [[X:%.*]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 [[X:%.*]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;
@ -84,7 +84,7 @@ define double @pow_sitofp_double_const_base_power_of_2_fast(i16 %x) {
define double @pow_uitofp_const_base_2_fast(i15 %x) { define double @pow_uitofp_const_base_2_fast(i15 %x) {
; CHECK-LABEL: @pow_uitofp_const_base_2_fast( ; CHECK-LABEL: @pow_uitofp_const_base_2_fast(
; CHECK-NEXT: [[TMP1:%.*]] = zext i15 [[X:%.*]] to i16 ; CHECK-NEXT: [[TMP1:%.*]] = zext i15 [[X:%.*]] to i16
; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 signext [[TMP1]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call afn float @ldexpf(float 1.000000e+00, i16 [[TMP1]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;
@ -322,7 +322,7 @@ define double @pow_uitofp_const_base_no_fast(i16 %x) {
define double @pow_sitofp_const_base_2_no_fast(i16 %x) { define double @pow_sitofp_const_base_2_no_fast(i16 %x) {
; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast( ; CHECK-LABEL: @pow_sitofp_const_base_2_no_fast(
; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 signext [[X:%.*]]) ; CHECK-NEXT: [[LDEXPF:%.*]] = call float @ldexpf(float 1.000000e+00, i16 [[X:%.*]])
; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double ; CHECK-NEXT: [[RES:%.*]] = fpext float [[LDEXPF]] to double
; CHECK-NEXT: ret double [[RES]] ; CHECK-NEXT: ret double [[RES]]
; ;

View File

@ -190,7 +190,7 @@ define double @fake_exp2(double %x) {
} }
define double @fake_ldexp(i32 %x) { define double @fake_ldexp(i32 %x) {
; CHECK32-LABEL: @fake_ldexp( ; CHECK32-LABEL: @fake_ldexp(
; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 signext %x) ; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 %x)
; CHECK32-NEXT: ret double [[Z]] ; CHECK32-NEXT: ret double [[Z]]
; CHECK16-LABEL: @fake_ldexp( ; CHECK16-LABEL: @fake_ldexp(
@ -205,11 +205,11 @@ define double @fake_ldexp(i32 %x) {
define double @fake_ldexp_16(i16 %x) { define double @fake_ldexp_16(i16 %x) {
; CHECK32-LABEL: @fake_ldexp_16( ; CHECK32-LABEL: @fake_ldexp_16(
; CHECK32-NEXT: [[Y:%.*]] = sext i16 %x to i32 ; CHECK32-NEXT: [[Y:%.*]] = sext i16 %x to i32
; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 signext [[Y]]) ; CHECK32-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i32 [[Y]])
; CHECK32-NEXT: ret double [[Z]] ; CHECK32-NEXT: ret double [[Z]]
; CHECK16-LABEL: @fake_ldexp_16( ; CHECK16-LABEL: @fake_ldexp_16(
; CHECK16-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i16 signext %x) ; CHECK16-NEXT: [[Z:%.*]] = call double @ldexp(double 1.0{{.*}}, i16 %x)
; CHECK16-NEXT: ret double [[Z]] ; CHECK16-NEXT: ret double [[Z]]
%y = sitofp i16 %x to double %y = sitofp i16 %x to double
@ -217,8 +217,6 @@ define double @fake_ldexp_16(i16 %x) {
ret double %z ret double %z
} }
; CHECK: declare double @ldexp(double, i{{16|32}} signext)
attributes #0 = { nobuiltin } attributes #0 = { nobuiltin }
attributes #1 = { builtin } attributes #1 = { builtin }