diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-09-16 16:58:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-09-16 16:58:29 +0000 |
commit | 16d6b3b3da62aa5baaf3c66c8d4e6f8c8f70aeb7 (patch) | |
tree | 6031356a30dab2c3c69c332095eb59f34b4e0961 /contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | |
parent | ceff9b9d2587c46759fd6fb312916d5748986918 (diff) | |
parent | e588341d487d7ec86b5282968e3223f8c0e6de27 (diff) | |
download | src-16d6b3b3da62aa5baaf3c66c8d4e6f8c8f70aeb7.tar.gz src-16d6b3b3da62aa5baaf3c66c8d4e6f8c8f70aeb7.zip |
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc2-91-g6e042866c30.
MFC after: 6 weeks
X-MFC-With: r364284
Notes
Notes:
svn path=/head/; revision=365807
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp index 2259a29f838a..f125ca011cd2 100644 --- a/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp +++ b/contrib/llvm-project/llvm/lib/Target/PowerPC/PPCBoolRetToInt.cpp @@ -78,9 +78,9 @@ class PPCBoolRetToInt : public FunctionPass { Value *Curr = WorkList.back(); WorkList.pop_back(); auto *CurrUser = dyn_cast<User>(Curr); - // Operands of CallInst are skipped because they may not be Bool type, - // and their positions are defined by ABI. - if (CurrUser && !isa<CallInst>(Curr)) + // Operands of CallInst/Constant are skipped because they may not be Bool + // type. For CallInst, their positions are defined by ABI. + if (CurrUser && !isa<CallInst>(Curr) && !isa<Constant>(Curr)) for (auto &Op : CurrUser->operands()) if (Defs.insert(Op).second) WorkList.push_back(Op); @@ -90,6 +90,9 @@ class PPCBoolRetToInt : public FunctionPass { // Translate a i1 value to an equivalent i32/i64 value: Value *translate(Value *V) { + assert(V->getType() == Type::getInt1Ty(V->getContext()) && + "Expect an i1 value"); + Type *IntTy = ST->isPPC64() ? Type::getInt64Ty(V->getContext()) : Type::getInt32Ty(V->getContext()); @@ -252,9 +255,9 @@ class PPCBoolRetToInt : public FunctionPass { auto *First = dyn_cast<User>(Pair.first); auto *Second = dyn_cast<User>(Pair.second); assert((!First || Second) && "translated from user to non-user!?"); - // Operands of CallInst are skipped because they may not be Bool type, - // and their positions are defined by ABI. - if (First && !isa<CallInst>(First)) + // Operands of CallInst/Constant are skipped because they may not be Bool + // type. For CallInst, their positions are defined by ABI. + if (First && !isa<CallInst>(First) && !isa<Constant>(First)) for (unsigned i = 0; i < First->getNumOperands(); ++i) Second->setOperand(i, BoolToIntMap[First->getOperand(i)]); } |