<div dir="ltr"><div dir="ltr"><div dir="ltr">The previous code was not written to appropriately handle a string of 16-bit values either. But, it looks as though the signature checking in TargetLibraryInfoImpl::isValidProtoForLibFunc should be stricter (for this function, and likely some others as well).<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 5, 2019 at 3:01 AM Mikael Holmén <<a href="mailto:mikael.holmen@ericsson.com">mikael.holmen@ericsson.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I noticed that with this patch the following starts hitting an assert:<br>
<br>
opt -instcombine -S -o - call-strlen.ll<br>
<br>
gives<br>
<br>
opt: ../lib/IR/Instructions.cpp:1185: <br>
llvm::LoadInst::LoadInst(llvm::Type *, llvm::Value *, const llvm::Twine <br>
&, bool, unsigned int, llvm::AtomicOrdering, SyncScope::ID, <br>
llvm::Instruction *): Assertion `Ty == <br>
cast<PointerType>(Ptr->getType())->getElementType()' failed.<br>
Stack dump:<br>
0. Program arguments: build-all/bin/opt -instcombine -S -o - <br>
call-strlen.ll<br>
1. Running pass 'Function Pass Manager' on module 'call-strlen.ll'.<br>
2. Running pass 'Combine redundant instructions' on function '@test_it'<br>
#0 0x00000000022a2ef4 PrintStackTraceSignalHandler(void*) <br>
(build-all/bin/opt+0x22a2ef4)<br>
#1 0x00000000022a0f00 llvm::sys::RunSignalHandlers() <br>
(build-all/bin/opt+0x22a0f00)<br>
#2 0x00000000022a3258 SignalHandler(int) (build-all/bin/opt+0x22a3258)<br>
#3 0x00007f39507a3330 __restore_rt <br>
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)<br>
#4 0x00007f394f392c37 gsignal <br>
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0<br>
#5 0x00007f394f396028 abort <br>
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0<br>
#6 0x00007f394f38bbf6 __assert_fail_base <br>
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0<br>
#7 0x00007f394f38bca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)<br>
#8 0x0000000001c870bb llvm::LoadInst::LoadInst(llvm::Type*, <br>
llvm::Value*, llvm::Twine const&, bool, unsigned int, <br>
llvm::AtomicOrdering, unsigned char, llvm::Instruction*) <br>
(build-all/bin/opt+0x1c870bb)<br>
#9 0x0000000001c86e73 llvm::LoadInst::LoadInst(llvm::Type*, <br>
llvm::Value*, llvm::Twine const&, llvm::Instruction*) <br>
(build-all/bin/opt+0x1c86e73)<br>
#10 0x0000000002393743 <br>
llvm::LibCallSimplifier::optimizeStringLength(llvm::CallInst*, <br>
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&, <br>
unsigned int) (build-all/bin/opt+0x2393743)<br>
#11 0x000000000239f91c <br>
llvm::LibCallSimplifier::optimizeStringMemoryLibCall(llvm::CallInst*, <br>
llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>&) <br>
(build-all/bin/opt+0x239f91c)<br>
#12 0x00000000023a08d8 <br>
llvm::LibCallSimplifier::optimizeCall(llvm::CallInst*) <br>
(build-all/bin/opt+0x23a08d8)<br>
#13 0x0000000001e58716 <br>
llvm::InstCombiner::tryOptimizeCall(llvm::CallInst*) <br>
(build-all/bin/opt+0x1e58716)<br>
#14 0x0000000001e54104 <br>
llvm::InstCombiner::visitCallBase(llvm::CallBase&) <br>
(build-all/bin/opt+0x1e54104)<br>
#15 0x0000000001e52190 <br>
llvm::InstCombiner::visitCallInst(llvm::CallInst&) <br>
(build-all/bin/opt+0x1e52190)<br>
#16 0x0000000001e12c09 llvm::InstCombiner::run() <br>
(build-all/bin/opt+0x1e12c09)<br>
#17 0x0000000001e14ca1 combineInstructionsOverFunction(llvm::Function&, <br>
llvm::InstCombineWorklist&, llvm::AAResults*, llvm::AssumptionCache&, <br>
llvm::TargetLibraryInfo&, llvm::DominatorTree&, <br>
llvm::OptimizationRemarkEmitter&, bool, llvm::LoopInfo*) <br>
(build-all/bin/opt+0x1e14ca1)<br>
#18 0x0000000001e1537b <br>
llvm::InstructionCombiningPass::runOnFunction(llvm::Function&) <br>
(build-all/bin/opt+0x1e1537b)<br>
#19 0x0000000001ca6e9d <br>
llvm::FPPassManager::runOnFunction(llvm::Function&) <br>
(build-all/bin/opt+0x1ca6e9d)<br>
#20 0x0000000001ca7158 llvm::FPPassManager::runOnModule(llvm::Module&) <br>
(build-all/bin/opt+0x1ca7158)<br>
#21 0x0000000001ca75ba llvm::legacy::PassManagerImpl::run(llvm::Module&) <br>
(build-all/bin/opt+0x1ca75ba)<br>
#22 0x00000000007a270b main (build-all/bin/opt+0x7a270b)<br>
#23 0x00007f394f37df45 __libc_start_main <br>
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0<br>
#24 0x000000000078815d _start (build-all/bin/opt+0x78815d)<br>
Abort<br>
<br>
Changing the argument type of the strlen from i16* to i8* makes opt <br>
happy, but I suppose it shouldn't crash.<br>
<br>
/Mikael<br>
<br>
On 2/1/19 9:44 PM, James Y Knight via llvm-commits wrote:<br>
> Author: jyknight<br>
> Date: Fri Feb 1 12:44:24 2019<br>
> New Revision: 352911<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=352911&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=352911&view=rev</a><br>
> Log:<br>
> [opaque pointer types] Pass value type to LoadInst creation.<br>
> <br>
> This cleans up all LoadInst creation in LLVM to explicitly pass the<br>
> value type rather than deriving it from the pointer's element-type.<br>
> <br>
> Differential Revision: <a href="https://reviews.llvm.org/D57172" rel="noreferrer" target="_blank">https://reviews.llvm.org/D57172</a><br>
> <br>
> Modified:<br>
> llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
> llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp<br>
> llvm/trunk/lib/CodeGen/GCRootLowering.cpp<br>
> llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp<br>
> llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp<br>
> llvm/trunk/lib/CodeGen/SafeStack.cpp<br>
> llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp<br>
> llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp<br>
> llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp<br>
> llvm/trunk/lib/CodeGen/StackProtector.cpp<br>
> llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp<br>
> llvm/trunk/lib/CodeGen/WinEHPrepare.cpp<br>
> llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp<br>
> llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp<br>
> llvm/trunk/lib/IR/AutoUpgrade.cpp<br>
> llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp<br>
> llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp<br>
> llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp<br>
> llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp<br>
> llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp<br>
> llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp<br>
> llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp<br>
> llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp<br>
> llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
> llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp<br>
> llvm/trunk/lib/Target/X86/X86WinEHState.cpp<br>
> llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp<br>
> llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp<br>
> llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp<br>
> llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp<br>
> llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp<br>
> llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp<br>
> llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp<br>
> llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp<br>
> llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
> llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br>
> llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp<br>
> llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp<br>
> llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/LICM.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/SROA.cpp<br>
> llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp<br>
> llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp<br>
> llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp<br>
> llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp<br>
> llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp<br>
> llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp<br>
> llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp<br>
> llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp<br>
> llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br>
> llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp<br>
> llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll<br>
> llvm/trunk/tools/bugpoint/Miscompilation.cpp<br>
> llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp<br>
> llvm/trunk/unittests/Analysis/MemorySSATest.cpp<br>
> llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp<br>
> llvm/trunk/unittests/Analysis/PhiValuesTest.cpp<br>
> llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp<br>
> llvm/trunk/unittests/Analysis/SparsePropagation.cpp<br>
> llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp<br>
> llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp<br>
> llvm/trunk/unittests/IR/IRBuilderTest.cpp<br>
> llvm/trunk/unittests/IR/PatternMatch.cpp<br>
> llvm/trunk/unittests/Linker/LinkModulesTest.cpp<br>
> llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp<br>
> llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp<br>
> <br>
> Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)<br>
> +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -4404,7 +4404,7 @@ Error BitcodeReader::parseFunctionBody(F<br>
> unsigned Align;<br>
> if (Error Err = parseAlignmentValue(Record[OpNum], Align))<br>
> return Err;<br>
> - I = new LoadInst(Op, "", Record[OpNum+1], Align, Ordering, SSID);<br>
> + I = new LoadInst(Ty, Op, "", Record[OpNum + 1], Align, Ordering, SSID);<br>
> <br>
> InstructionList.push_back(I);<br>
> break;<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/AtomicExpandPass.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -381,7 +381,7 @@ LoadInst *AtomicExpand::convertAtomicLoa<br>
> Addr->getType()->getPointerAddressSpace());<br>
> Value *NewAddr = Builder.CreateBitCast(Addr, PT);<br>
> <br>
> - auto *NewLI = Builder.CreateLoad(NewAddr);<br>
> + auto *NewLI = Builder.CreateLoad(NewTy, NewAddr);<br>
> NewLI->setAlignment(LI->getAlignment());<br>
> NewLI->setVolatile(LI->isVolatile());<br>
> NewLI->setAtomic(LI->getOrdering(), LI->getSyncScopeID());<br>
> @@ -1769,8 +1769,8 @@ bool AtomicExpand::expandAtomicOpToLibca<br>
> // from call}<br>
> Type *FinalResultTy = I->getType();<br>
> Value *V = UndefValue::get(FinalResultTy);<br>
> - Value *ExpectedOut =<br>
> - Builder.CreateAlignedLoad(AllocaCASExpected, AllocaAlignment);<br>
> + Value *ExpectedOut = Builder.CreateAlignedLoad(<br>
> + CASExpected->getType(), AllocaCASExpected, AllocaAlignment);<br>
> Builder.CreateLifetimeEnd(AllocaCASExpected_i8, SizeVal64);<br>
> V = Builder.CreateInsertValue(V, ExpectedOut, 0);<br>
> V = Builder.CreateInsertValue(V, Result, 1);<br>
> @@ -1780,7 +1780,8 @@ bool AtomicExpand::expandAtomicOpToLibca<br>
> if (UseSizedLibcall)<br>
> V = Builder.CreateBitOrPointerCast(Result, I->getType());<br>
> else {<br>
> - V = Builder.CreateAlignedLoad(AllocaResult, AllocaAlignment);<br>
> + V = Builder.CreateAlignedLoad(I->getType(), AllocaResult,<br>
> + AllocaAlignment);<br>
> Builder.CreateLifetimeEnd(AllocaResult_i8, SizeVal64);<br>
> }<br>
> I->replaceAllUsesWith(V);<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/GCRootLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCRootLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GCRootLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/GCRootLowering.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/GCRootLowering.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -213,7 +213,7 @@ bool LowerIntrinsics::DoLowering(Functio<br>
> }<br>
> case Intrinsic::gcread: {<br>
> // Replace a read barrier with a simple load.<br>
> - Value *Ld = new LoadInst(CI->getArgOperand(1), "", CI);<br>
> + Value *Ld = new LoadInst(CI->getType(), CI->getArgOperand(1), "", CI);<br>
> Ld->takeName(CI);<br>
> CI->replaceAllUsesWith(Ld);<br>
> CI->eraseFromParent();<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/InterleavedLoadCombinePass.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1218,7 +1218,7 @@ bool InterleavedLoadCombineImpl::combine<br>
> "interleaved.wide.ptrcast");<br>
> <br>
> // Create the wide load and update the MemorySSA.<br>
> - auto LI = Builder.CreateAlignedLoad(CI, InsertionPoint->getAlignment(),<br>
> + auto LI = Builder.CreateAlignedLoad(ILTy, CI, InsertionPoint->getAlignment(),<br>
> "interleaved.wide.load");<br>
> auto MSSAU = MemorySSAUpdater(&MSSA);<br>
> MemoryUse *MSSALoad = cast<MemoryUse>(MSSAU.createMemoryAccessBefore(<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/PreISelIntrinsicLowering.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -44,7 +44,7 @@ static bool lowerLoadRelative(Function &<br>
> Value *OffsetPtr =<br>
> B.CreateGEP(Int8Ty, CI->getArgOperand(0), CI->getArgOperand(1));<br>
> Value *OffsetPtrI32 = B.CreateBitCast(OffsetPtr, Int32PtrTy);<br>
> - Value *OffsetI32 = B.CreateAlignedLoad(OffsetPtrI32, 4);<br>
> + Value *OffsetI32 = B.CreateAlignedLoad(Int32Ty, OffsetPtrI32, 4);<br>
> <br>
> Value *ResultPtr = B.CreateGEP(Int8Ty, CI->getArgOperand(0), OffsetI32);<br>
> <br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/SafeStack.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SafeStack.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SafeStack.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/SafeStack.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/SafeStack.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -371,7 +371,7 @@ Value *SafeStack::getStackGuard(IRBuilde<br>
> if (!StackGuardVar)<br>
> StackGuardVar =<br>
> F.getParent()->getOrInsertGlobal("__stack_chk_guard", StackPtrTy);<br>
> - return IRB.CreateLoad(StackGuardVar, "StackGuard");<br>
> + return IRB.CreateLoad(StackPtrTy, StackGuardVar, "StackGuard");<br>
> }<br>
> <br>
> void SafeStack::findInsts(Function &F,<br>
> @@ -452,7 +452,8 @@ SafeStack::createStackRestorePoints(IRBu<br>
> ++NumUnsafeStackRestorePoints;<br>
> <br>
> IRB.SetInsertPoint(I->getNextNode());<br>
> - Value *CurrentTop = DynamicTop ? IRB.CreateLoad(DynamicTop) : StaticTop;<br>
> + Value *CurrentTop =<br>
> + DynamicTop ? IRB.CreateLoad(StackPtrTy, DynamicTop) : StaticTop;<br>
> IRB.CreateStore(CurrentTop, UnsafeStackPtr);<br>
> }<br>
> <br>
> @@ -461,7 +462,7 @@ SafeStack::createStackRestorePoints(IRBu<br>
> <br>
> void SafeStack::checkStackGuard(IRBuilder<> &IRB, Function &F, ReturnInst &RI,<br>
> AllocaInst *StackGuardSlot, Value *StackGuard) {<br>
> - Value *V = IRB.CreateLoad(StackGuardSlot);<br>
> + Value *V = IRB.CreateLoad(StackPtrTy, StackGuardSlot);<br>
> Value *Cmp = IRB.CreateICmpNE(StackGuard, V);<br>
> <br>
> auto SuccessProb = BranchProbabilityInfo::getBranchProbStackProtector(true);<br>
> @@ -659,7 +660,8 @@ void SafeStack::moveDynamicAllocasToUnsa<br>
> uint64_t TySize = DL.getTypeAllocSize(Ty);<br>
> Value *Size = IRB.CreateMul(ArraySize, ConstantInt::get(IntPtrTy, TySize));<br>
> <br>
> - Value *SP = IRB.CreatePtrToInt(IRB.CreateLoad(UnsafeStackPtr), IntPtrTy);<br>
> + Value *SP = IRB.CreatePtrToInt(IRB.CreateLoad(StackPtrTy, UnsafeStackPtr),<br>
> + IntPtrTy);<br>
> SP = IRB.CreateSub(SP, Size);<br>
> <br>
> // Align the SP value to satisfy the AllocaInst, type and stack alignments.<br>
> @@ -697,7 +699,7 @@ void SafeStack::moveDynamicAllocasToUnsa<br>
> <br>
> if (II->getIntrinsicID() == Intrinsic::stacksave) {<br>
> IRBuilder<> IRB(II);<br>
> - Instruction *LI = IRB.CreateLoad(UnsafeStackPtr);<br>
> + Instruction *LI = IRB.CreateLoad(StackPtrTy, UnsafeStackPtr);<br>
> LI->takeName(II);<br>
> II->replaceAllUsesWith(LI);<br>
> II->eraseFromParent();<br>
> @@ -792,7 +794,7 @@ bool SafeStack::run() {<br>
> // Load the current stack pointer (we'll also use it as a base pointer).<br>
> // FIXME: use a dedicated register for it ?<br>
> Instruction *BasePointer =<br>
> - IRB.CreateLoad(UnsafeStackPtr, false, "unsafe_stack_ptr");<br>
> + IRB.CreateLoad(StackPtrTy, UnsafeStackPtr, false, "unsafe_stack_ptr");<br>
> assert(BasePointer->getType() == StackPtrTy);<br>
> <br>
> AllocaInst *StackGuardSlot = nullptr;<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -143,7 +143,7 @@ static void scalarizeMaskedLoad(CallInst<br>
> <br>
> // Short-cut if the mask is all-true.<br>
> if (isa<Constant>(Mask) && cast<Constant>(Mask)->isAllOnesValue()) {<br>
> - Value *NewI = Builder.CreateAlignedLoad(Ptr, AlignVal);<br>
> + Value *NewI = Builder.CreateAlignedLoad(VecType, Ptr, AlignVal);<br>
> CI->replaceAllUsesWith(NewI);<br>
> CI->eraseFromParent();<br>
> return;<br>
> @@ -166,7 +166,7 @@ static void scalarizeMaskedLoad(CallInst<br>
> continue;<br>
> Value *Gep =<br>
> Builder.CreateInBoundsGEP(EltTy, FirstEltPtr, Builder.getInt32(Idx));<br>
> - LoadInst *Load = Builder.CreateAlignedLoad(Gep, AlignVal);<br>
> + LoadInst *Load = Builder.CreateAlignedLoad(EltTy, Gep, AlignVal);<br>
> VResult =<br>
> Builder.CreateInsertElement(VResult, Load, Builder.getInt32(Idx));<br>
> }<br>
> @@ -198,7 +198,7 @@ static void scalarizeMaskedLoad(CallInst<br>
> <br>
> Value *Gep =<br>
> Builder.CreateInBoundsGEP(EltTy, FirstEltPtr, Builder.getInt32(Idx));<br>
> - LoadInst *Load = Builder.CreateAlignedLoad(Gep, AlignVal);<br>
> + LoadInst *Load = Builder.CreateAlignedLoad(EltTy, Gep, AlignVal);<br>
> Value *NewVResult = Builder.CreateInsertElement(VResult, Load,<br>
> Builder.getInt32(Idx));<br>
> <br>
> @@ -366,6 +366,7 @@ static void scalarizeMaskedGather(CallIn<br>
> Value *Src0 = CI->getArgOperand(3);<br>
> <br>
> VectorType *VecType = cast<VectorType>(CI->getType());<br>
> + Type *EltTy = VecType->getElementType();<br>
> <br>
> IRBuilder<> Builder(CI->getContext());<br>
> Instruction *InsertPt = CI;<br>
> @@ -387,7 +388,7 @@ static void scalarizeMaskedGather(CallIn<br>
> Value *Ptr = Builder.CreateExtractElement(Ptrs, Builder.getInt32(Idx),<br>
> "Ptr" + Twine(Idx));<br>
> LoadInst *Load =<br>
> - Builder.CreateAlignedLoad(Ptr, AlignVal, "Load" + Twine(Idx));<br>
> + Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal, "Load" + Twine(Idx));<br>
> VResult = Builder.CreateInsertElement(<br>
> VResult, Load, Builder.getInt32(Idx), "Res" + Twine(Idx));<br>
> }<br>
> @@ -418,7 +419,7 @@ static void scalarizeMaskedGather(CallIn<br>
> Value *Ptr = Builder.CreateExtractElement(Ptrs, Builder.getInt32(Idx),<br>
> "Ptr" + Twine(Idx));<br>
> LoadInst *Load =<br>
> - Builder.CreateAlignedLoad(Ptr, AlignVal, "Load" + Twine(Idx));<br>
> + Builder.CreateAlignedLoad(EltTy, Ptr, AlignVal, "Load" + Twine(Idx));<br>
> Value *NewVResult = Builder.CreateInsertElement(VResult, Load,<br>
> Builder.getInt32(Idx),<br>
> "Res" + Twine(Idx));<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/ShadowStackGCLowering.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -312,7 +312,8 @@ bool ShadowStackGCLowering::runOnFunctio<br>
> AtEntry.SetInsertPoint(IP->getParent(), IP);<br>
> <br>
> // Initialize the map pointer and load the current head of the shadow stack.<br>
> - Instruction *CurrentHead = AtEntry.CreateLoad(Head, "gc_currhead");<br>
> + Instruction *CurrentHead =<br>
> + AtEntry.CreateLoad(StackEntryTy->getPointerTo(), Head, "gc_currhead");<br>
> Instruction *EntryMapPtr = CreateGEP(Context, AtEntry, ConcreteStackEntryTy,<br>
> StackEntry, 0, 1, "gc_frame.map");<br>
> AtEntry.CreateStore(FrameMap, EntryMapPtr);<br>
> @@ -353,7 +354,8 @@ bool ShadowStackGCLowering::runOnFunctio<br>
> Instruction *EntryNextPtr2 =<br>
> CreateGEP(Context, *AtExit, ConcreteStackEntryTy, StackEntry, 0, 0,<br>
> "gc_frame.next");<br>
> - Value *SavedHead = AtExit->CreateLoad(EntryNextPtr2, "gc_savedhead");<br>
> + Value *SavedHead = AtExit->CreateLoad(StackEntryTy->getPointerTo(),<br>
> + EntryNextPtr2, "gc_savedhead");<br>
> AtExit->CreateStore(SavedHead, Head);<br>
> }<br>
> <br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/SjLjEHPrepare.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -189,14 +189,16 @@ Value *SjLjEHPrepare::setupFunctionConte<br>
> Builder.CreateConstGEP2_32(FunctionContextTy, FuncCtx, 0, 2, "__data");<br>
> <br>
> // The exception values come back in context->__data[0].<br>
> + Type *Int32Ty = Type::getInt32Ty(F.getContext());<br>
> Value *ExceptionAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData,<br>
> 0, 0, "exception_gep");<br>
> - Value *ExnVal = Builder.CreateLoad(ExceptionAddr, true, "exn_val");<br>
> + Value *ExnVal = Builder.CreateLoad(Int32Ty, ExceptionAddr, true, "exn_val");<br>
> ExnVal = Builder.CreateIntToPtr(ExnVal, Builder.getInt8PtrTy());<br>
> <br>
> Value *SelectorAddr = Builder.CreateConstGEP2_32(doubleUnderDataTy, FCData,<br>
> 0, 1, "exn_selector_gep");<br>
> - Value *SelVal = Builder.CreateLoad(SelectorAddr, true, "exn_selector_val");<br>
> + Value *SelVal =<br>
> + Builder.CreateLoad(Int32Ty, SelectorAddr, true, "exn_selector_val");<br>
> <br>
> substituteLPadValues(LPI, ExnVal, SelVal);<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/StackProtector.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StackProtector.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/StackProtector.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/StackProtector.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -322,7 +322,7 @@ static Value *getStackGuard(const Target<br>
> IRBuilder<> &B,<br>
> bool *SupportsSelectionDAGSP = nullptr) {<br>
> if (Value *Guard = TLI->getIRStackGuard(B))<br>
> - return B.CreateLoad(Guard, true, "StackGuard");<br>
> + return B.CreateLoad(B.getInt8PtrTy(), Guard, true, "StackGuard");<br>
> <br>
> // Use SelectionDAG SSP handling, since there isn't an IR guard.<br>
> //<br>
> @@ -417,7 +417,7 @@ bool StackProtector::InsertStackProtecto<br>
> // Generate the function-based epilogue instrumentation.<br>
> // The target provides a guard check function, generate a call to it.<br>
> IRBuilder<> B(RI);<br>
> - LoadInst *Guard = B.CreateLoad(AI, true, "Guard");<br>
> + LoadInst *Guard = B.CreateLoad(B.getInt8PtrTy(), AI, true, "Guard");<br>
> CallInst *Call = B.CreateCall(GuardCheck, {Guard});<br>
> Call->setAttributes(GuardCheck->getAttributes());<br>
> Call->setCallingConv(GuardCheck->getCallingConv());<br>
> @@ -472,7 +472,7 @@ bool StackProtector::InsertStackProtecto<br>
> // Generate the stack protector instructions in the old basic block.<br>
> IRBuilder<> B(BB);<br>
> Value *Guard = getStackGuard(TLI, M, B);<br>
> - LoadInst *LI2 = B.CreateLoad(AI, true);<br>
> + LoadInst *LI2 = B.CreateLoad(B.getInt8PtrTy(), AI, true);<br>
> Value *Cmp = B.CreateICmpEQ(Guard, LI2);<br>
> auto SuccessProb =<br>
> BranchProbabilityInfo::getBranchProbStackProtector(true);<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/WasmEHPrepare.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -344,7 +344,8 @@ void WasmEHPrepare::prepareEHPad(BasicBl<br>
> PersCI->setDoesNotThrow();<br>
> <br>
> // Pseudocode: int selector = __wasm.landingpad_context.selector;<br>
> - Instruction *Selector = IRB.CreateLoad(SelectorField, "selector");<br>
> + Instruction *Selector =<br>
> + IRB.CreateLoad(IRB.getInt32Ty(), SelectorField, "selector");<br>
> <br>
> // Replace the return value from wasm.get.ehselector() with the selector value<br>
> // loaded from __wasm_lpad_context.selector.<br>
> <br>
> Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)<br>
> +++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1079,7 +1079,8 @@ AllocaInst *WinEHPrepare::insertPHILoads<br>
> SpillSlot = new AllocaInst(PN->getType(), DL->getAllocaAddrSpace(), nullptr,<br>
> Twine(PN->getName(), ".wineh.spillslot"),<br>
> &F.getEntryBlock().front());<br>
> - Value *V = new LoadInst(SpillSlot, Twine(PN->getName(), ".wineh.reload"),<br>
> + Value *V = new LoadInst(PN->getType(), SpillSlot,<br>
> + Twine(PN->getName(), ".wineh.reload"),<br>
> &*PHIBlock->getFirstInsertionPt());<br>
> PN->replaceAllUsesWith(V);<br>
> return SpillSlot;<br>
> @@ -1221,13 +1222,15 @@ void WinEHPrepare::replaceUseWithLoad(Va<br>
> Value *&Load = Loads[IncomingBlock];<br>
> // Insert the load into the predecessor block<br>
> if (!Load)<br>
> - Load = new LoadInst(SpillSlot, Twine(V->getName(), ".wineh.reload"),<br>
> + Load = new LoadInst(V->getType(), SpillSlot,<br>
> + Twine(V->getName(), ".wineh.reload"),<br>
> /*Volatile=*/false, IncomingBlock->getTerminator());<br>
> <br>
> U.set(Load);<br>
> } else {<br>
> // Reload right before the old use.<br>
> - auto *Load = new LoadInst(SpillSlot, Twine(V->getName(), ".wineh.reload"),<br>
> + auto *Load = new LoadInst(V->getType(), SpillSlot,<br>
> + Twine(V->getName(), ".wineh.reload"),<br>
> /*Volatile=*/false, UsingInst);<br>
> U.set(Load);<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp (original)<br>
> +++ llvm/trunk/lib/ExecutionEngine/Orc/IndirectionUtils.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -235,14 +235,13 @@ void makeStub(Function &F, Value &ImplPo<br>
> assert(F.isDeclaration() && "Can't turn a definition into a stub.");<br>
> assert(F.getParent() && "Function isn't in a module.");<br>
> Module &M = *F.getParent();<br>
> - FunctionType *FTy = F.getFunctionType();<br>
> BasicBlock *EntryBlock = BasicBlock::Create(M.getContext(), "entry", &F);<br>
> IRBuilder<> Builder(EntryBlock);<br>
> - LoadInst *ImplAddr = Builder.CreateLoad(&ImplPointer);<br>
> + LoadInst *ImplAddr = Builder.CreateLoad(F.getType(), &ImplPointer);<br>
> std::vector<Value*> CallArgs;<br>
> for (auto &A : F.args())<br>
> CallArgs.push_back(&A);<br>
> - CallInst *Call = Builder.CreateCall(FTy, ImplAddr, CallArgs);<br>
> + CallInst *Call = Builder.CreateCall(F.getFunctionType(), ImplAddr, CallArgs);<br>
> Call->setTailCall();<br>
> Call->setAttributes(F.getAttributes());<br>
> if (F.getReturnType()->isVoidTy())<br>
> <br>
> Modified: llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp (original)<br>
> +++ llvm/trunk/lib/FuzzMutate/RandomIRBuilder.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -53,7 +53,8 @@ Value *RandomIRBuilder::newSource(BasicB<br>
> IP = ++I->getIterator();<br>
> assert(IP != BB.end() && "guaranteed by the findPointer");<br>
> }<br>
> - auto *NewLoad = new LoadInst(Ptr, "L", &*IP);<br>
> + auto *NewLoad = new LoadInst(<br>
> + cast<PointerType>(Ptr->getType())->getElementType(), Ptr, "L", &*IP);<br>
> <br>
> // Only sample this load if it really matches the descriptor<br>
> if (Pred.matches(Srcs, NewLoad))<br>
> <br>
> Modified: llvm/trunk/lib/IR/AutoUpgrade.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AutoUpgrade.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/IR/AutoUpgrade.cpp (original)<br>
> +++ llvm/trunk/lib/IR/AutoUpgrade.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1162,16 +1162,16 @@ static Value *UpgradeMaskedStore(IRBuild<br>
> static Value *UpgradeMaskedLoad(IRBuilder<> &Builder,<br>
> Value *Ptr, Value *Passthru, Value *Mask,<br>
> bool Aligned) {<br>
> + Type *ValTy = Passthru->getType();<br>
> // Cast the pointer to the right type.<br>
> - Ptr = Builder.CreateBitCast(Ptr,<br>
> - llvm::PointerType::getUnqual(Passthru->getType()));<br>
> + Ptr = Builder.CreateBitCast(Ptr, llvm::PointerType::getUnqual(ValTy));<br>
> unsigned Align =<br>
> Aligned ? cast<VectorType>(Passthru->getType())->getBitWidth() / 8 : 1;<br>
> <br>
> // If the mask is all ones just emit a regular store.<br>
> if (const auto *C = dyn_cast<Constant>(Mask))<br>
> if (C->isAllOnesValue())<br>
> - return Builder.CreateAlignedLoad(Ptr, Align);<br>
> + return Builder.CreateAlignedLoad(ValTy, Ptr, Align);<br>
> <br>
> // Convert the mask from an integer type to a vector of i1.<br>
> unsigned NumElts = Passthru->getType()->getVectorNumElements();<br>
> @@ -2199,7 +2199,7 @@ void llvm::UpgradeIntrinsicCall(CallInst<br>
> Type *VT = VectorType::get(EltTy, NumSrcElts);<br>
> Value *Op = Builder.CreatePointerCast(CI->getArgOperand(0),<br>
> PointerType::getUnqual(VT));<br>
> - Value *Load = Builder.CreateAlignedLoad(Op, 1);<br>
> + Value *Load = Builder.CreateAlignedLoad(VT, Op, 1);<br>
> if (NumSrcElts == 2)<br>
> Rep = Builder.CreateShuffleVector(Load, UndefValue::get(Load->getType()),<br>
> { 0, 1, 0, 1 });<br>
> @@ -2945,7 +2945,7 @@ void llvm::UpgradeIntrinsicCall(CallInst<br>
> // Convert the type of the pointer to a pointer to the stored type.<br>
> Value *BC =<br>
> Builder.CreateBitCast(Ptr, PointerType::getUnqual(VTy), "cast");<br>
> - LoadInst *LI = Builder.CreateAlignedLoad(BC, VTy->getBitWidth() / 8);<br>
> + LoadInst *LI = Builder.CreateAlignedLoad(VTy, BC, VTy->getBitWidth() / 8);<br>
> LI->setMetadata(M->getMDKindID("nontemporal"), Node);<br>
> Rep = LI;<br>
> } else if (IsX86 &&<br>
> <br>
> Modified: llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp (original)<br>
> +++ llvm/trunk/lib/Target/AArch64/AArch64PromoteConstant.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -493,7 +493,8 @@ void AArch64PromoteConstant::insertDefin<br>
> for (const auto &IPI : InsertPts) {<br>
> // Create the load of the global variable.<br>
> IRBuilder<> Builder(IPI.first);<br>
> - LoadInst *LoadedCst = Builder.CreateLoad(&PromotedGV);<br>
> + LoadInst *LoadedCst =<br>
> + Builder.CreateLoad(PromotedGV.getValueType(), &PromotedGV);<br>
> LLVM_DEBUG(dbgs() << "**********\n");<br>
> LLVM_DEBUG(dbgs() << "New def: ");<br>
> LLVM_DEBUG(LoadedCst->print(dbgs()));<br>
> <br>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp (original)<br>
> +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -806,7 +806,7 @@ bool AMDGPUCodeGenPrepare::visitLoadInst<br>
> Type *I32Ty = Builder.getInt32Ty();<br>
> Type *PT = PointerType::get(I32Ty, I.getPointerAddressSpace());<br>
> Value *BitCast= Builder.CreateBitCast(I.getPointerOperand(), PT);<br>
> - LoadInst *WidenLoad = Builder.CreateLoad(BitCast);<br>
> + LoadInst *WidenLoad = Builder.CreateLoad(I32Ty, BitCast);<br>
> WidenLoad->copyMetadata(I);<br>
> <br>
> // If we have range metadata, we need to convert the type, and not make<br>
> <br>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp (original)<br>
> +++ llvm/trunk/lib/Target/AMDGPU/AMDGPULibCalls.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1357,12 +1357,12 @@ bool AMDGPULibCalls::fold_sincos(CallIns<br>
> if (!isSin) { // CI->cos, UI->sin<br>
> B.SetInsertPoint(&*ItOld);<br>
> UI->replaceAllUsesWith(&*Call);<br>
> - Instruction *Reload = B.CreateLoad(Alloc);<br>
> + Instruction *Reload = B.CreateLoad(Alloc->getAllocatedType(), Alloc);<br>
> CI->replaceAllUsesWith(Reload);<br>
> UI->eraseFromParent();<br>
> CI->eraseFromParent();<br>
> } else { // CI->sin, UI->cos<br>
> - Instruction *Reload = B.CreateLoad(Alloc);<br>
> + Instruction *Reload = B.CreateLoad(Alloc->getAllocatedType(), Alloc);<br>
> UI->replaceAllUsesWith(Reload);<br>
> CI->replaceAllUsesWith(Call);<br>
> UI->eraseFromParent();<br>
> <br>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp (original)<br>
> +++ llvm/trunk/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -132,6 +132,7 @@ bool AMDGPULowerKernelArguments::runOnFu<br>
> KernArgBaseAlign);<br>
> <br>
> Value *ArgPtr;<br>
> + Type *AdjustedArgTy;<br>
> if (DoShiftOpt) { // FIXME: Handle aggregate types<br>
> // Since we don't have sub-dword scalar loads, avoid doing an extload by<br>
> // loading earlier than the argument address, and extracting the relevant<br>
> @@ -144,25 +145,25 @@ bool AMDGPULowerKernelArguments::runOnFu<br>
> KernArgSegment,<br>
> AlignDownOffset,<br>
> Arg.getName() + ".kernarg.offset.align.down");<br>
> - ArgPtr = Builder.CreateBitCast(ArgPtr,<br>
> - Builder.getInt32Ty()->getPointerTo(AS),<br>
> - ArgPtr->getName() + ".cast");<br>
> + AdjustedArgTy = Builder.getInt32Ty();<br>
> } else {<br>
> ArgPtr = Builder.CreateConstInBoundsGEP1_64(<br>
> KernArgSegment,<br>
> EltOffset,<br>
> Arg.getName() + ".kernarg.offset");<br>
> - ArgPtr = Builder.CreateBitCast(ArgPtr, ArgTy->getPointerTo(AS),<br>
> - ArgPtr->getName() + ".cast");<br>
> + AdjustedArgTy = ArgTy;<br>
> }<br>
> <br>
> if (IsV3 && Size >= 32) {<br>
> V4Ty = VectorType::get(VT->getVectorElementType(), 4);<br>
> // Use the hack that clang uses to avoid SelectionDAG ruining v3 loads<br>
> - ArgPtr = Builder.CreateBitCast(ArgPtr, V4Ty->getPointerTo(AS));<br>
> + AdjustedArgTy = V4Ty;<br>
> }<br>
> <br>
> - LoadInst *Load = Builder.CreateAlignedLoad(ArgPtr, AdjustedAlign);<br>
> + ArgPtr = Builder.CreateBitCast(ArgPtr, AdjustedArgTy->getPointerTo(AS),<br>
> + ArgPtr->getName() + ".cast");<br>
> + LoadInst *Load =<br>
> + Builder.CreateAlignedLoad(AdjustedArgTy, ArgPtr, AdjustedAlign);<br>
> Load->setMetadata(LLVMContext::MD_invariant_load, MDNode::get(Ctx, {}));<br>
> <br>
> MDBuilder MDB(Ctx);<br>
> <br>
> Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp (original)<br>
> +++ llvm/trunk/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -245,10 +245,10 @@ AMDGPUPromoteAlloca::getLocalSizeYZ(IRBu<br>
> // 32-bit and extract sequence is already present, and it is probably easier<br>
> // to CSE this. The loads should be mergable later anyway.<br>
> Value *GEPXY = Builder.CreateConstInBoundsGEP1_64(CastDispatchPtr, 1);<br>
> - LoadInst *LoadXY = Builder.CreateAlignedLoad(GEPXY, 4);<br>
> + LoadInst *LoadXY = Builder.CreateAlignedLoad(I32Ty, GEPXY, 4);<br>
> <br>
> Value *GEPZU = Builder.CreateConstInBoundsGEP1_64(CastDispatchPtr, 2);<br>
> - LoadInst *LoadZU = Builder.CreateAlignedLoad(GEPZU, 4);<br>
> + LoadInst *LoadZU = Builder.CreateAlignedLoad(I32Ty, GEPZU, 4);<br>
> <br>
> MDNode *MD = MDNode::get(Mod->getContext(), None);<br>
> LoadXY->setMetadata(LLVMContext::MD_invariant_load, MD);<br>
> @@ -426,7 +426,7 @@ static bool tryPromoteAllocaToVector(All<br>
> Value *Index = calculateVectorIndex(Ptr, GEPVectorIdx);<br>
> <br>
> Value *BitCast = Builder.CreateBitCast(Alloca, VecPtrTy);<br>
> - Value *VecValue = Builder.CreateLoad(BitCast);<br>
> + Value *VecValue = Builder.CreateLoad(VectorTy, BitCast);<br>
> Value *ExtractElement = Builder.CreateExtractElement(VecValue, Index);<br>
> Inst->replaceAllUsesWith(ExtractElement);<br>
> Inst->eraseFromParent();<br>
> @@ -441,7 +441,7 @@ static bool tryPromoteAllocaToVector(All<br>
> Value *Ptr = SI->getPointerOperand();<br>
> Value *Index = calculateVectorIndex(Ptr, GEPVectorIdx);<br>
> Value *BitCast = Builder.CreateBitCast(Alloca, VecPtrTy);<br>
> - Value *VecValue = Builder.CreateLoad(BitCast);<br>
> + Value *VecValue = Builder.CreateLoad(VectorTy, BitCast);<br>
> Value *NewVecValue = Builder.CreateInsertElement(VecValue,<br>
> SI->getValueOperand(),<br>
> Index);<br>
> <br>
> Modified: llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp (original)<br>
> +++ llvm/trunk/lib/Target/ARM/ARMParallelDSP.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -688,12 +688,12 @@ bool ARMParallelDSP::MatchSMLAD(Function<br>
> }<br>
> <br>
> static LoadInst *CreateLoadIns(IRBuilder<NoFolder> &IRB, LoadInst &BaseLoad,<br>
> - const Type *LoadTy) {<br>
> + Type *LoadTy) {<br>
> const unsigned AddrSpace = BaseLoad.getPointerAddressSpace();<br>
> <br>
> Value *VecPtr = IRB.CreateBitCast(BaseLoad.getPointerOperand(),<br>
> LoadTy->getPointerTo(AddrSpace));<br>
> - return IRB.CreateAlignedLoad(VecPtr, BaseLoad.getAlignment());<br>
> + return IRB.CreateAlignedLoad(LoadTy, VecPtr, BaseLoad.getAlignment());<br>
> }<br>
> <br>
> Instruction *ARMParallelDSP::CreateSMLADCall(LoadInst *VecLd0, LoadInst *VecLd1,<br>
> @@ -709,7 +709,7 @@ Instruction *ARMParallelDSP::CreateSMLAD<br>
> ++BasicBlock::iterator(InsertAfter));<br>
> <br>
> // Replace the reduction chain with an intrinsic call<br>
> - const Type *Ty = IntegerType::get(M->getContext(), 32);<br>
> + Type *Ty = IntegerType::get(M->getContext(), 32);<br>
> LoadInst *NewLd0 = CreateLoadIns(Builder, VecLd0[0], Ty);<br>
> LoadInst *NewLd1 = CreateLoadIns(Builder, VecLd1[0], Ty);<br>
> Value* Args[] = { NewLd0, NewLd1, Acc };<br>
> <br>
> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp (original)<br>
> +++ llvm/trunk/lib/Target/NVPTX/NVPTXLowerArgs.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -169,7 +169,8 @@ void NVPTXLowerArgs::handleByValParam(Ar<br>
> Value *ArgInParam = new AddrSpaceCastInst(<br>
> Arg, PointerType::get(StructType, ADDRESS_SPACE_PARAM), Arg->getName(),<br>
> FirstInst);<br>
> - LoadInst *LI = new LoadInst(ArgInParam, Arg->getName(), FirstInst);<br>
> + LoadInst *LI =<br>
> + new LoadInst(StructType, ArgInParam, Arg->getName(), FirstInst);<br>
> new StoreInst(LI, AllocA, FirstInst);<br>
> }<br>
> <br>
> <br>
> Modified: llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (original)<br>
> +++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -445,7 +445,8 @@ Value *WebAssemblyLowerEmscriptenEHSjLj:<br>
> <br>
> // Post-invoke<br>
> // %__THREW__.val = __THREW__; __THREW__ = 0;<br>
> - Value *Threw = IRB.CreateLoad(ThrewGV, ThrewGV->getName() + ".val");<br>
> + Value *Threw =<br>
> + IRB.CreateLoad(IRB.getInt32Ty(), ThrewGV, ThrewGV->getName() + ".val");<br>
> IRB.CreateStore(IRB.getInt32(0), ThrewGV);<br>
> return Threw;<br>
> }<br>
> @@ -548,8 +549,8 @@ void WebAssemblyLowerEmscriptenEHSjLj::w<br>
> BasicBlock *ElseBB1 = BasicBlock::Create(C, "if.else1", F);<br>
> BasicBlock *EndBB1 = BasicBlock::Create(C, "if.end", F);<br>
> Value *ThrewCmp = IRB.CreateICmpNE(Threw, IRB.getInt32(0));<br>
> - Value *ThrewValue =<br>
> - IRB.CreateLoad(ThrewValueGV, ThrewValueGV->getName() + ".val");<br>
> + Value *ThrewValue = IRB.CreateLoad(IRB.getInt32Ty(), ThrewValueGV,<br>
> + ThrewValueGV->getName() + ".val");<br>
> Value *ThrewValueCmp = IRB.CreateICmpNE(ThrewValue, IRB.getInt32(0));<br>
> Value *Cmp1 = IRB.CreateAnd(ThrewCmp, ThrewValueCmp, "cmp1");<br>
> IRB.CreateCondBr(Cmp1, ThenBB1, ElseBB1);<br>
> @@ -561,8 +562,8 @@ void WebAssemblyLowerEmscriptenEHSjLj::w<br>
> BasicBlock *EndBB2 = BasicBlock::Create(C, "if.end2", F);<br>
> Value *ThrewInt = IRB.CreateIntToPtr(Threw, Type::getInt32PtrTy(C),<br>
> Threw->getName() + ".i32p");<br>
> - Value *LoadedThrew =<br>
> - IRB.CreateLoad(ThrewInt, ThrewInt->getName() + ".loaded");<br>
> + Value *LoadedThrew = IRB.CreateLoad(IRB.getInt32Ty(), ThrewInt,<br>
> + ThrewInt->getName() + ".loaded");<br>
> Value *ThenLabel = IRB.CreateCall(<br>
> TestSetjmpF, {LoadedThrew, SetjmpTable, SetjmpTableSize}, "label");<br>
> Value *Cmp2 = IRB.CreateICmpEQ(ThenLabel, IRB.getInt32(0));<br>
> <br>
> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br>
> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -25362,7 +25362,6 @@ X86TargetLowering::lowerIdempotentRMWInt<br>
> // We must restrict the ordering to avoid generating loads with Release or<br>
> // ReleaseAcquire orderings.<br>
> auto Order = AtomicCmpXchgInst::getStrongestFailureOrdering(AI->getOrdering());<br>
> - auto Ptr = AI->getPointerOperand();<br>
> <br>
> // Before the load we need a fence. Here is an example lifted from<br>
> // <a href="http://www.hpl.hp.com/techreports/2012/HPL-2012-68.pdf" rel="noreferrer" target="_blank">http://www.hpl.hp.com/techreports/2012/HPL-2012-68.pdf</a> showing why a fence<br>
> @@ -25397,8 +25396,9 @@ X86TargetLowering::lowerIdempotentRMWInt<br>
> Builder.CreateCall(MFence, {});<br>
> <br>
> // Finally we can emit the atomic load.<br>
> - LoadInst *Loaded = Builder.CreateAlignedLoad(Ptr,<br>
> - AI->getType()->getPrimitiveSizeInBits());<br>
> + LoadInst *Loaded =<br>
> + Builder.CreateAlignedLoad(AI->getType(), AI->getPointerOperand(),<br>
> + AI->getType()->getPrimitiveSizeInBits());<br>
> Loaded->setAtomic(Order, SSID);<br>
> AI->replaceAllUsesWith(Loaded);<br>
> AI->eraseFromParent();<br>
> <br>
> Modified: llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp (original)<br>
> +++ llvm/trunk/lib/Target/X86/X86InterleavedAccess.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -193,7 +193,7 @@ void X86InterleavedAccessGroup::decompos<br>
> <br>
> // Decompose the load instruction.<br>
> LoadInst *LI = cast<LoadInst>(VecInst);<br>
> - Type *VecBasePtrTy = SubVecTy->getPointerTo(LI->getPointerAddressSpace());<br>
> + Type *VecBaseTy, *VecBasePtrTy;<br>
> Value *VecBasePtr;<br>
> unsigned int NumLoads = NumSubVectors;<br>
> // In the case of stride 3 with a vector of 32 elements load the information<br>
> @@ -201,18 +201,21 @@ void X86InterleavedAccessGroup::decompos<br>
> // [0,1...,VF/2-1,VF/2+VF,VF/2+VF+1,...,2VF-1]<br>
> unsigned VecLength = DL.getTypeSizeInBits(VecWidth);<br>
> if (VecLength == 768 || VecLength == 1536) {<br>
> - Type *VecTran =<br>
> - VectorType::get(Type::getInt8Ty(LI->getContext()), 16)->getPointerTo();<br>
> - VecBasePtr = Builder.CreateBitCast(LI->getPointerOperand(), VecTran);<br>
> + VecBaseTy = VectorType::get(Type::getInt8Ty(LI->getContext()), 16);<br>
> + VecBasePtrTy = VecBaseTy->getPointerTo(LI->getPointerAddressSpace());<br>
> + VecBasePtr = Builder.CreateBitCast(LI->getPointerOperand(), VecBasePtrTy);<br>
> NumLoads = NumSubVectors * (VecLength / 384);<br>
> - } else<br>
> + } else {<br>
> + VecBaseTy = SubVecTy;<br>
> + VecBasePtrTy = VecBaseTy->getPointerTo(LI->getPointerAddressSpace());<br>
> VecBasePtr = Builder.CreateBitCast(LI->getPointerOperand(), VecBasePtrTy);<br>
> + }<br>
> // Generate N loads of T type.<br>
> for (unsigned i = 0; i < NumLoads; i++) {<br>
> // TODO: Support inbounds GEP.<br>
> Value *NewBasePtr = Builder.CreateGEP(VecBasePtr, Builder.getInt32(i));<br>
> Instruction *NewLoad =<br>
> - Builder.CreateAlignedLoad(NewBasePtr, LI->getAlignment());<br>
> + Builder.CreateAlignedLoad(VecBaseTy, NewBasePtr, LI->getAlignment());<br>
> DecomposedVectors.push_back(NewLoad);<br>
> }<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/Target/X86/X86WinEHState.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86WinEHState.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86WinEHState.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Target/X86/X86WinEHState.cpp (original)<br>
> +++ llvm/trunk/lib/Target/X86/X86WinEHState.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -432,7 +432,7 @@ void WinEHStatePass::linkExceptionRegist<br>
> // Next = [fs:00]<br>
> Constant *FSZero =<br>
> Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));<br>
> - Value *Next = Builder.CreateLoad(FSZero);<br>
> + Value *Next = Builder.CreateLoad(LinkTy->getPointerTo(), FSZero);<br>
> Builder.CreateStore(Next, Builder.CreateStructGEP(LinkTy, Link, 0));<br>
> // [fs:00] = Link<br>
> Builder.CreateStore(Link, FSZero);<br>
> @@ -447,8 +447,8 @@ void WinEHStatePass::unlinkExceptionRegi<br>
> }<br>
> Type *LinkTy = getEHLinkRegistrationType();<br>
> // [fs:00] = Link->Next<br>
> - Value *Next =<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(LinkTy, Link, 0));<br>
> + Value *Next = Builder.CreateLoad(LinkTy->getPointerTo(),<br>
> + Builder.CreateStructGEP(LinkTy, Link, 0));<br>
> Constant *FSZero =<br>
> Constant::getNullValue(LinkTy->getPointerTo()->getPointerTo(257));<br>
> Builder.CreateStore(Next, FSZero);<br>
> @@ -783,7 +783,7 @@ void WinEHStatePass::addStateStores(Func<br>
> if (InCleanup) {<br>
> Value *StateField =<br>
> Builder.CreateStructGEP(nullptr, RegNode, StateFieldIndex);<br>
> - State = Builder.CreateLoad(StateField);<br>
> + State = Builder.CreateLoad(Builder.getInt32Ty(), StateField);<br>
> } else {<br>
> State = Builder.getInt32(getStateForCallSite(BlockColors, FuncInfo, CS));<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Coroutines/CoroCleanup.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -49,7 +49,7 @@ static void lowerSubFn(IRBuilder<> &Buil<br>
> Builder.SetInsertPoint(SubFn);<br>
> auto *FramePtr = Builder.CreateBitCast(FrameRaw, FramePtrTy);<br>
> auto *Gep = Builder.CreateConstInBoundsGEP2_32(FrameTy, FramePtr, 0, Index);<br>
> - auto *Load = Builder.CreateLoad(Gep);<br>
> + auto *Load = Builder.CreateLoad(FrameTy->getElementType(Index), Gep);<br>
> <br>
> SubFn->replaceAllUsesWith(Load);<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Coroutines/CoroEarly.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -97,7 +97,7 @@ void Lowerer::lowerCoroDone(IntrinsicIns<br>
> Builder.SetInsertPoint(II);<br>
> auto *BCI = Builder.CreateBitCast(Operand, FramePtrTy);<br>
> auto *Gep = Builder.CreateConstInBoundsGEP1_32(FrameTy, BCI, 0);<br>
> - auto *Load = Builder.CreateLoad(Gep);<br>
> + auto *Load = Builder.CreateLoad(FrameTy, Gep);<br>
> auto *Cond = Builder.CreateICmpEQ(Load, NullPtr);<br>
> <br>
> II->replaceAllUsesWith(Cond);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Coroutines/CoroFrame.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -471,10 +471,10 @@ static Instruction *splitBeforeCatchSwit<br>
> static Instruction *insertSpills(SpillInfo &Spills, coro::Shape &Shape) {<br>
> auto *CB = Shape.CoroBegin;<br>
> IRBuilder<> Builder(CB->getNextNode());<br>
> - PointerType *FramePtrTy = Shape.FrameTy->getPointerTo();<br>
> + StructType *FrameTy = Shape.FrameTy;<br>
> + PointerType *FramePtrTy = FrameTy->getPointerTo();<br>
> auto *FramePtr =<br>
> cast<Instruction>(Builder.CreateBitCast(CB, FramePtrTy, "FramePtr"));<br>
> - Type *FrameTy = FramePtrTy->getElementType();<br>
> <br>
> Value *CurrentValue = nullptr;<br>
> BasicBlock *CurrentBlock = nullptr;<br>
> @@ -501,7 +501,7 @@ static Instruction *insertSpills(SpillIn<br>
> Twine(".reload.addr"));<br>
> return isa<AllocaInst>(CurrentValue)<br>
> ? G<br>
> - : Builder.CreateLoad(G,<br>
> + : Builder.CreateLoad(FrameTy->getElementType(Index), G,<br>
> CurrentValue->getName() + Twine(".reload"));<br>
> };<br>
> <br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Coroutines/CoroSplit.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -93,7 +93,7 @@ static BasicBlock *createResumeEntryBloc<br>
> auto *FrameTy = Shape.FrameTy;<br>
> auto *GepIndex = Builder.CreateConstInBoundsGEP2_32(<br>
> FrameTy, FramePtr, 0, coro::Shape::IndexField, "index.addr");<br>
> - auto *Index = Builder.CreateLoad(GepIndex, "index");<br>
> + auto *Index = Builder.CreateLoad(Shape.getIndexType(), GepIndex, "index");<br>
> auto *Switch =<br>
> Builder.CreateSwitch(Index, UnreachBB, Shape.CoroSuspends.size());<br>
> Shape.ResumeSwitch = Switch;<br>
> @@ -229,7 +229,8 @@ static void handleFinalSuspend(IRBuilder<br>
> Builder.SetInsertPoint(OldSwitchBB->getTerminator());<br>
> auto *GepIndex = Builder.CreateConstInBoundsGEP2_32(Shape.FrameTy, FramePtr,<br>
> 0, 0, "ResumeFn.addr");<br>
> - auto *Load = Builder.CreateLoad(GepIndex);<br>
> + auto *Load = Builder.CreateLoad(<br>
> + Shape.FrameTy->getElementType(coro::Shape::ResumeField), GepIndex);<br>
> auto *NullPtr =<br>
> ConstantPointerNull::get(cast<PointerType>(Load->getType()));<br>
> auto *Cond = Builder.CreateICmpEQ(Load, NullPtr);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/IPO/ArgumentPromotion.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -263,7 +263,8 @@ doPromotion(Function *F, SmallPtrSetImpl<br>
> Value *Idx = GetElementPtrInst::Create(<br>
> STy, *AI, Idxs, (*AI)->getName() + "." + Twine(i), Call);<br>
> // TODO: Tell AA about the new values?<br>
> - Args.push_back(new LoadInst(Idx, Idx->getName() + ".val", Call));<br>
> + Args.push_back(new LoadInst(STy->getElementType(i), Idx,<br>
> + Idx->getName() + ".val", Call));<br>
> ArgAttrVec.push_back(AttributeSet());<br>
> }<br>
> } else if (!I->use_empty()) {<br>
> @@ -299,7 +300,8 @@ doPromotion(Function *F, SmallPtrSetImpl<br>
> }<br>
> // Since we're replacing a load make sure we take the alignment<br>
> // of the previous load.<br>
> - LoadInst *newLoad = new LoadInst(V, V->getName() + ".val", Call);<br>
> + LoadInst *newLoad =<br>
> + new LoadInst(OrigLoad->getType(), V, V->getName() + ".val", Call);<br>
> newLoad->setAlignment(OrigLoad->getAlignment());<br>
> // Transfer the AA info too.<br>
> AAMDNodes AAInfo;<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -905,9 +905,10 @@ OptimizeGlobalAddressOfMalloc(GlobalVari<br>
> <br>
> // Replace the cmp X, 0 with a use of the bool value.<br>
> // Sink the load to where the compare was, if atomic rules allow us to.<br>
> - Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", false, 0,<br>
> + Value *LV = new LoadInst(InitBool->getValueType(), InitBool,<br>
> + InitBool->getName() + ".val", false, 0,<br>
> LI->getOrdering(), LI->getSyncScopeID(),<br>
> - LI->isUnordered() ? (Instruction*)ICI : LI);<br>
> + LI->isUnordered() ? (Instruction *)ICI : LI);<br>
> InitBoolUsed = true;<br>
> switch (ICI->getPredicate()) {<br>
> default: llvm_unreachable("Unknown ICmp Predicate!");<br>
> @@ -1040,7 +1041,8 @@ static void ReplaceUsesOfMallocWithGloba<br>
> }<br>
> <br>
> // Insert a load from the global, and use it instead of the malloc.<br>
> - Value *NL = new LoadInst(GV, GV->getName()+".val", InsertPt);<br>
> + Value *NL =<br>
> + new LoadInst(GV->getValueType(), GV, GV->getName() + ".val", InsertPt);<br>
> U->replaceUsesOfWith(Alloc, NL);<br>
> }<br>
> }<br>
> @@ -1163,10 +1165,10 @@ static Value *GetHeapSROAValue(Value *V,<br>
> if (LoadInst *LI = dyn_cast<LoadInst>(V)) {<br>
> // This is a scalarized version of the load from the global. Just create<br>
> // a new Load of the scalarized global.<br>
> - Result = new LoadInst(GetHeapSROAValue(LI->getOperand(0), FieldNo,<br>
> - InsertedScalarizedValues,<br>
> - PHIsToRewrite),<br>
> - LI->getName()+".f"+Twine(FieldNo), LI);<br>
> + Value *V = GetHeapSROAValue(LI->getOperand(0), FieldNo,<br>
> + InsertedScalarizedValues, PHIsToRewrite);<br>
> + Result = new LoadInst(V->getType()->getPointerElementType(), V,<br>
> + LI->getName() + ".f" + Twine(FieldNo), LI);<br>
> } else {<br>
> PHINode *PN = cast<PHINode>(V);<br>
> // PN's type is pointer to struct. Make a new PHI of pointer to struct<br>
> @@ -1356,7 +1358,9 @@ static GlobalVariable *PerformHeapAllocS<br>
> // Within the NullPtrBlock, we need to emit a comparison and branch for each<br>
> // pointer, because some may be null while others are not.<br>
> for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) {<br>
> - Value *GVVal = new LoadInst(FieldGlobals[i], "tmp", NullPtrBlock);<br>
> + Value *GVVal =<br>
> + new LoadInst(cast<GlobalVariable>(FieldGlobals[i])->getValueType(),<br>
> + FieldGlobals[i], "tmp", NullPtrBlock);<br>
> Value *Cmp = new ICmpInst(*NullPtrBlock, ICmpInst::ICMP_NE, GVVal,<br>
> Constant::getNullValue(GVVal->getType()));<br>
> BasicBlock *FreeBlock = BasicBlock::Create(Cmp->getContext(), "free_it",<br>
> @@ -1700,7 +1704,8 @@ static bool TryToShrinkGlobalToBoolean(G<br>
> if (LoadInst *LI = dyn_cast<LoadInst>(StoredVal)) {<br>
> assert(LI->getOperand(0) == GV && "Not a copy!");<br>
> // Insert a new load, to preserve the saved value.<br>
> - StoreVal = new LoadInst(NewGV, LI->getName()+".b", false, 0,<br>
> + StoreVal = new LoadInst(NewGV->getValueType(), NewGV,<br>
> + LI->getName() + ".b", false, 0,<br>
> LI->getOrdering(), LI->getSyncScopeID(), LI);<br>
> } else {<br>
> assert((isa<CastInst>(StoredVal) || isa<SelectInst>(StoredVal)) &&<br>
> @@ -1716,8 +1721,9 @@ static bool TryToShrinkGlobalToBoolean(G<br>
> } else {<br>
> // Change the load into a load of bool then a select.<br>
> LoadInst *LI = cast<LoadInst>(UI);<br>
> - LoadInst *NLI = new LoadInst(NewGV, LI->getName()+".b", false, 0,<br>
> - LI->getOrdering(), LI->getSyncScopeID(), LI);<br>
> + LoadInst *NLI =<br>
> + new LoadInst(NewGV->getValueType(), NewGV, LI->getName() + ".b",<br>
> + false, 0, LI->getOrdering(), LI->getSyncScopeID(), LI);<br>
> Instruction *NSI;<br>
> if (IsOneZero)<br>
> NSI = new ZExtInst(NLI, LI->getType(), "", LI);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -618,7 +618,7 @@ Value *LowerTypeTestsModule::createBitSe<br>
> }<br>
> <br>
> Value *ByteAddr = B.CreateGEP(Int8Ty, ByteArray, BitOffset);<br>
> - Value *Byte = B.CreateLoad(ByteAddr);<br>
> + Value *Byte = B.CreateLoad(Int8Ty, ByteAddr);<br>
> <br>
> Value *ByteAndMask =<br>
> B.CreateAnd(Byte, ConstantExpr::getPtrToInt(TIL.BitMask, Int8Ty));<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/IPO/WholeProgramDevirt.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1183,7 +1183,7 @@ void DevirtModule::applyVirtualConstProp<br>
> Value *Addr =<br>
> B.CreateGEP(Int8Ty, B.CreateBitCast(Call.VTable, Int8PtrTy), Byte);<br>
> if (RetType->getBitWidth() == 1) {<br>
> - Value *Bits = B.CreateLoad(Addr);<br>
> + Value *Bits = B.CreateLoad(Int8Ty, Addr);<br>
> Value *BitsAndBit = B.CreateAnd(Bits, Bit);<br>
> auto IsBitSet = B.CreateICmpNE(BitsAndBit, ConstantInt::get(Int8Ty, 0));<br>
> Call.replaceAndErase("virtual-const-prop-1-bit", FnName, RemarksEnabled,<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -171,7 +171,7 @@ Instruction *InstCombiner::SimplifyAnyMe<br>
> <br>
> Value *Src = Builder.CreateBitCast(MI->getArgOperand(1), NewSrcPtrTy);<br>
> Value *Dest = Builder.CreateBitCast(MI->getArgOperand(0), NewDstPtrTy);<br>
> - LoadInst *L = Builder.CreateLoad(Src);<br>
> + LoadInst *L = Builder.CreateLoad(IntType, Src);<br>
> // Alignment from the mem intrinsic will be better, so use it.<br>
> L->setAlignment(CopySrcAlign);<br>
> if (CopyMD)<br>
> @@ -1182,7 +1182,8 @@ static Value *simplifyMaskedLoad(const I<br>
> if (maskIsAllOneOrUndef(II.getArgOperand(2))) {<br>
> Value *LoadPtr = II.getArgOperand(0);<br>
> unsigned Alignment = cast<ConstantInt>(II.getArgOperand(1))->getZExtValue();<br>
> - return Builder.CreateAlignedLoad(LoadPtr, Alignment, "unmaskedload");<br>
> + return Builder.CreateAlignedLoad(II.getType(), LoadPtr, Alignment,<br>
> + "unmaskedload");<br>
> }<br>
> <br>
> return nullptr;<br>
> @@ -1499,7 +1500,7 @@ static Value *simplifyNeonVld1(const Int<br>
> <br>
> auto *BCastInst = Builder.CreateBitCast(II.getArgOperand(0),<br>
> PointerType::get(II.getType(), 0));<br>
> - return Builder.CreateAlignedLoad(BCastInst, Alignment);<br>
> + return Builder.CreateAlignedLoad(II.getType(), BCastInst, Alignment);<br>
> }<br>
> <br>
> // Returns true iff the 2 intrinsics have the same operands, limiting the<br>
> @@ -2300,7 +2301,7 @@ Instruction *InstCombiner::visitCallInst<br>
> &DT) >= 16) {<br>
> Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),<br>
> PointerType::getUnqual(II->getType()));<br>
> - return new LoadInst(Ptr);<br>
> + return new LoadInst(II->getType(), Ptr);<br>
> }<br>
> break;<br>
> case Intrinsic::ppc_vsx_lxvw4x:<br>
> @@ -2308,7 +2309,7 @@ Instruction *InstCombiner::visitCallInst<br>
> // Turn PPC VSX loads into normal loads.<br>
> Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),<br>
> PointerType::getUnqual(II->getType()));<br>
> - return new LoadInst(Ptr, Twine(""), false, 1);<br>
> + return new LoadInst(II->getType(), Ptr, Twine(""), false, 1);<br>
> }<br>
> case Intrinsic::ppc_altivec_stvx:<br>
> case Intrinsic::ppc_altivec_stvxl:<br>
> @@ -2336,7 +2337,7 @@ Instruction *InstCombiner::visitCallInst<br>
> II->getType()->getVectorNumElements());<br>
> Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),<br>
> PointerType::getUnqual(VTy));<br>
> - Value *Load = Builder.CreateLoad(Ptr);<br>
> + Value *Load = Builder.CreateLoad(VTy, Ptr);<br>
> return new FPExtInst(Load, II->getType());<br>
> }<br>
> break;<br>
> @@ -2346,7 +2347,7 @@ Instruction *InstCombiner::visitCallInst<br>
> &DT) >= 32) {<br>
> Value *Ptr = Builder.CreateBitCast(II->getArgOperand(0),<br>
> PointerType::getUnqual(II->getType()));<br>
> - return new LoadInst(Ptr);<br>
> + return new LoadInst(II->getType(), Ptr);<br>
> }<br>
> break;<br>
> case Intrinsic::ppc_qpx_qvstfs:<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -298,7 +298,7 @@ void PointerReplacer::replace(Instructio<br>
> if (auto *LT = dyn_cast<LoadInst>(I)) {<br>
> auto *V = getReplacement(LT->getPointerOperand());<br>
> assert(V && "Operand not replaced");<br>
> - auto *NewI = new LoadInst(V);<br>
> + auto *NewI = new LoadInst(I->getType(), V);<br>
> NewI->takeName(LT);<br>
> IC.InsertNewInstWith(NewI, *LT);<br>
> IC.replaceInstUsesWith(*LT, NewI);<br>
> @@ -465,7 +465,7 @@ static LoadInst *combineLoadToNewType(In<br>
> NewPtr = IC.Builder.CreateBitCast(Ptr, NewTy->getPointerTo(AS));<br>
> <br>
> LoadInst *NewLoad = IC.Builder.CreateAlignedLoad(<br>
> - NewPtr, LI.getAlignment(), LI.isVolatile(), LI.getName() + Suffix);<br>
> + NewTy, NewPtr, LI.getAlignment(), LI.isVolatile(), LI.getName() + Suffix);<br>
> NewLoad->setAtomic(LI.getOrdering(), LI.getSyncScopeID());<br>
> MDBuilder MDB(NewLoad->getContext());<br>
> for (const auto &MDPair : MD) {<br>
> @@ -724,7 +724,8 @@ static Instruction *unpackLoadToAggregat<br>
> auto *Ptr = IC.Builder.CreateInBoundsGEP(ST, Addr, makeArrayRef(Indices),<br>
> Name + ".elt");<br>
> auto EltAlign = MinAlign(Align, SL->getElementOffset(i));<br>
> - auto *L = IC.Builder.CreateAlignedLoad(Ptr, EltAlign, Name + ".unpack");<br>
> + auto *L = IC.Builder.CreateAlignedLoad(ST->getElementType(i), Ptr,<br>
> + EltAlign, Name + ".unpack");<br>
> // Propagate AA metadata. It'll still be valid on the narrowed load.<br>
> AAMDNodes AAMD;<br>
> LI.getAAMetadata(AAMD);<br>
> @@ -774,8 +775,8 @@ static Instruction *unpackLoadToAggregat<br>
> };<br>
> auto *Ptr = IC.Builder.CreateInBoundsGEP(AT, Addr, makeArrayRef(Indices),<br>
> Name + ".elt");<br>
> - auto *L = IC.Builder.CreateAlignedLoad(Ptr, MinAlign(Align, Offset),<br>
> - Name + ".unpack");<br>
> + auto *L = IC.Builder.CreateAlignedLoad(<br>
> + AT->getElementType(), Ptr, MinAlign(Align, Offset), Name + ".unpack");<br>
> AAMDNodes AAMD;<br>
> LI.getAAMetadata(AAMD);<br>
> L->setAAMetadata(AAMD);<br>
> @@ -1065,10 +1066,12 @@ Instruction *InstCombiner::visitLoadInst<br>
> unsigned Align = LI.getAlignment();<br>
> if (isSafeToLoadUnconditionally(SI->getOperand(1), Align, DL, SI) &&<br>
> isSafeToLoadUnconditionally(SI->getOperand(2), Align, DL, SI)) {<br>
> - LoadInst *V1 = Builder.CreateLoad(SI->getOperand(1),<br>
> - SI->getOperand(1)->getName()+".val");<br>
> - LoadInst *V2 = Builder.CreateLoad(SI->getOperand(2),<br>
> - SI->getOperand(2)->getName()+".val");<br>
> + LoadInst *V1 =<br>
> + Builder.CreateLoad(LI.getType(), SI->getOperand(1),<br>
> + SI->getOperand(1)->getName() + ".val");<br>
> + LoadInst *V2 =<br>
> + Builder.CreateLoad(LI.getType(), SI->getOperand(2),<br>
> + SI->getOperand(2)->getName() + ".val");<br>
> assert(LI.isUnordered() && "implied by above");<br>
> V1->setAlignment(Align);<br>
> V1->setAtomic(LI.getOrdering(), LI.getSyncScopeID());<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombinePHI.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -595,7 +595,8 @@ Instruction *InstCombiner::FoldPHIArgLoa<br>
> <br>
> Value *InVal = FirstLI->getOperand(0);<br>
> NewPN->addIncoming(InVal, PN.getIncomingBlock(0));<br>
> - LoadInst *NewLI = new LoadInst(NewPN, "", isVolatile, LoadAlignment);<br>
> + LoadInst *NewLI =<br>
> + new LoadInst(FirstLI->getType(), NewPN, "", isVolatile, LoadAlignment);<br>
> <br>
> unsigned KnownIDs[] = {<br>
> LLVMContext::MD_tbaa,<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -2686,7 +2686,7 @@ Instruction *InstCombiner::visitExtractV<br>
> Builder.SetInsertPoint(L);<br>
> Value *GEP = Builder.CreateInBoundsGEP(L->getType(),<br>
> L->getPointerOperand(), Indices);<br>
> - Instruction *NL = Builder.CreateLoad(GEP);<br>
> + Instruction *NL = Builder.CreateLoad(EV.getType(), GEP);<br>
> // Whatever aliasing information we had for the orignal load must also<br>
> // hold for the smaller load, so propagate the annotations.<br>
> AAMDNodes Nodes;<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -949,8 +949,9 @@ struct FunctionStackPoisoner : public In<br>
> DynamicAreaOffset);<br>
> }<br>
> <br>
> - IRB.CreateCall(AsanAllocasUnpoisonFunc,<br>
> - {IRB.CreateLoad(DynamicAllocaLayout), DynamicAreaPtr});<br>
> + IRB.CreateCall(<br>
> + AsanAllocasUnpoisonFunc,<br>
> + {IRB.CreateLoad(IntptrTy, DynamicAllocaLayout), DynamicAreaPtr});<br>
> }<br>
> <br>
> // Unpoison dynamic allocas redzones.<br>
> @@ -1552,7 +1553,7 @@ void AddressSanitizer::instrumentAddress<br>
> Value *ShadowPtr = memToShadow(AddrLong, IRB);<br>
> Value *CmpVal = Constant::getNullValue(ShadowTy);<br>
> Value *ShadowValue =<br>
> - IRB.CreateLoad(IRB.CreateIntToPtr(ShadowPtr, ShadowPtrTy));<br>
> + IRB.CreateLoad(ShadowTy, IRB.CreateIntToPtr(ShadowPtr, ShadowPtrTy));<br>
> <br>
> Value *Cmp = IRB.CreateICmpNE(ShadowValue, CmpVal);<br>
> size_t Granularity = 1ULL << Mapping.Scale;<br>
> @@ -2444,7 +2445,7 @@ void AddressSanitizer::maybeInsertDynami<br>
> } else {<br>
> Value *GlobalDynamicAddress = F.getParent()->getOrInsertGlobal(<br>
> kAsanShadowMemoryDynamicAddress, IntptrTy);<br>
> - LocalDynamicShadow = IRB.CreateLoad(GlobalDynamicAddress);<br>
> + LocalDynamicShadow = IRB.CreateLoad(IntptrTy, GlobalDynamicAddress);<br>
> }<br>
> }<br>
> <br>
> @@ -2948,9 +2949,9 @@ void FunctionStackPoisoner::processStati<br>
> // void *LocalStackBase = (FakeStack) ? FakeStack : alloca(LocalStackSize);<br>
> Constant *OptionDetectUseAfterReturn = F.getParent()->getOrInsertGlobal(<br>
> kAsanOptionDetectUseAfterReturn, IRB.getInt32Ty());<br>
> - Value *UseAfterReturnIsEnabled =<br>
> - IRB.CreateICmpNE(IRB.CreateLoad(OptionDetectUseAfterReturn),<br>
> - Constant::getNullValue(IRB.getInt32Ty()));<br>
> + Value *UseAfterReturnIsEnabled = IRB.CreateICmpNE(<br>
> + IRB.CreateLoad(IRB.getInt32Ty(), OptionDetectUseAfterReturn),<br>
> + Constant::getNullValue(IRB.getInt32Ty()));<br>
> Instruction *Term =<br>
> SplitBlockAndInsertIfThen(UseAfterReturnIsEnabled, InsBefore, false);<br>
> IRBuilder<> IRBIf(Term);<br>
> @@ -3084,7 +3085,7 @@ void FunctionStackPoisoner::processStati<br>
> FakeStack,<br>
> ConstantInt::get(IntptrTy, ClassSize - ASan.LongSize / 8));<br>
> Value *SavedFlagPtr = IRBPoison.CreateLoad(<br>
> - IRBPoison.CreateIntToPtr(SavedFlagPtrPtr, IntptrPtrTy));<br>
> + IntptrTy, IRBPoison.CreateIntToPtr(SavedFlagPtrPtr, IntptrPtrTy));<br>
> IRBPoison.CreateStore(<br>
> Constant::getNullValue(IRBPoison.getInt8Ty()),<br>
> IRBPoison.CreateIntToPtr(SavedFlagPtr, IRBPoison.getInt8PtrTy()));<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1033,7 +1033,8 @@ Value *DFSanFunction::getShadow(Value *V<br>
> DFS.ArgTLS ? &*F->getEntryBlock().begin()<br>
> : cast<Instruction>(ArgTLSPtr)->getNextNode();<br>
> IRBuilder<> IRB(ArgTLSPos);<br>
> - Shadow = IRB.CreateLoad(getArgTLS(A->getArgNo(), ArgTLSPos));<br>
> + Shadow =<br>
> + IRB.CreateLoad(DFS.ShadowTy, getArgTLS(A->getArgNo(), ArgTLSPos));<br>
> break;<br>
> }<br>
> case DataFlowSanitizer::IA_Args: {<br>
> @@ -1183,7 +1184,7 @@ Value *DFSanFunction::loadShadow(Value *<br>
> const auto i = AllocaShadowMap.find(AI);<br>
> if (i != AllocaShadowMap.end()) {<br>
> IRBuilder<> IRB(Pos);<br>
> - return IRB.CreateLoad(i->second);<br>
> + return IRB.CreateLoad(DFS.ShadowTy, i->second);<br>
> }<br>
> }<br>
> <br>
> @@ -1208,7 +1209,7 @@ Value *DFSanFunction::loadShadow(Value *<br>
> case 0:<br>
> return DFS.ZeroShadow;<br>
> case 1: {<br>
> - LoadInst *LI = new LoadInst(ShadowAddr, "", Pos);<br>
> + LoadInst *LI = new LoadInst(DFS.ShadowTy, ShadowAddr, "", Pos);<br>
> LI->setAlignment(ShadowAlign);<br>
> return LI;<br>
> }<br>
> @@ -1216,8 +1217,9 @@ Value *DFSanFunction::loadShadow(Value *<br>
> IRBuilder<> IRB(Pos);<br>
> Value *ShadowAddr1 = IRB.CreateGEP(DFS.ShadowTy, ShadowAddr,<br>
> ConstantInt::get(DFS.IntptrTy, 1));<br>
> - return combineShadows(IRB.CreateAlignedLoad(ShadowAddr, ShadowAlign),<br>
> - IRB.CreateAlignedLoad(ShadowAddr1, ShadowAlign), Pos);<br>
> + return combineShadows(<br>
> + IRB.CreateAlignedLoad(DFS.ShadowTy, ShadowAddr, ShadowAlign),<br>
> + IRB.CreateAlignedLoad(DFS.ShadowTy, ShadowAddr1, ShadowAlign), Pos);<br>
> }<br>
> }<br>
> if (!AvoidNewBlocks && Size % (64 / DFS.ShadowWidth) == 0) {<br>
> @@ -1236,7 +1238,8 @@ Value *DFSanFunction::loadShadow(Value *<br>
> IRBuilder<> IRB(Pos);<br>
> Value *WideAddr =<br>
> IRB.CreateBitCast(ShadowAddr, Type::getInt64PtrTy(*DFS.Ctx));<br>
> - Value *WideShadow = IRB.CreateAlignedLoad(WideAddr, ShadowAlign);<br>
> + Value *WideShadow =<br>
> + IRB.CreateAlignedLoad(IRB.getInt64Ty(), WideAddr, ShadowAlign);<br>
> Value *TruncShadow = IRB.CreateTrunc(WideShadow, DFS.ShadowTy);<br>
> Value *ShlShadow = IRB.CreateShl(WideShadow, DFS.ShadowWidth);<br>
> Value *ShrShadow = IRB.CreateLShr(WideShadow, 64 - DFS.ShadowWidth);<br>
> @@ -1269,7 +1272,8 @@ Value *DFSanFunction::loadShadow(Value *<br>
> IRBuilder<> NextIRB(NextBB);<br>
> WideAddr = NextIRB.CreateGEP(Type::getInt64Ty(*DFS.Ctx), WideAddr,<br>
> ConstantInt::get(DFS.IntptrTy, 1));<br>
> - Value *NextWideShadow = NextIRB.CreateAlignedLoad(WideAddr, ShadowAlign);<br>
> + Value *NextWideShadow = NextIRB.CreateAlignedLoad(NextIRB.getInt64Ty(),<br>
> + WideAddr, ShadowAlign);<br>
> ShadowsEq = NextIRB.CreateICmpEQ(WideShadow, NextWideShadow);<br>
> LastBr->setSuccessor(0, NextBB);<br>
> LastBr = NextIRB.CreateCondBr(ShadowsEq, FallbackBB, FallbackBB);<br>
> @@ -1646,7 +1650,8 @@ void DFSanVisitor::visitCallSite(CallSit<br>
> }<br>
> <br>
> if (!FT->getReturnType()->isVoidTy()) {<br>
> - LoadInst *LabelLoad = IRB.CreateLoad(DFSF.LabelReturnAlloca);<br>
> + LoadInst *LabelLoad =<br>
> + IRB.CreateLoad(DFSF.DFS.ShadowTy, DFSF.LabelReturnAlloca);<br>
> DFSF.setShadow(CustomCI, LabelLoad);<br>
> }<br>
> <br>
> @@ -1684,7 +1689,7 @@ void DFSanVisitor::visitCallSite(CallSit<br>
> <br>
> if (DFSF.DFS.getInstrumentedABI() == DataFlowSanitizer::IA_TLS) {<br>
> IRBuilder<> NextIRB(Next);<br>
> - LoadInst *LI = NextIRB.CreateLoad(DFSF.getRetvalTLS());<br>
> + LoadInst *LI = NextIRB.CreateLoad(DFSF.DFS.ShadowTy, DFSF.getRetvalTLS());<br>
> DFSF.SkipInsts.insert(LI);<br>
> DFSF.setShadow(CS.getInstruction(), LI);<br>
> DFSF.NonZeroChecks.push_back(LI);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/EfficiencySanitizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -790,7 +790,7 @@ bool EfficiencySanitizer::insertCounterU<br>
> ConstantExpr::getGetElementPtr(<br>
> ArrayType::get(IRB.getInt64Ty(), getStructCounterSize(StructTy)),<br>
> CounterArray, Indices);<br>
> - Value *Load = IRB.CreateLoad(Counter);<br>
> + Value *Load = IRB.CreateLoad(IRB.getInt64Ty(), Counter);<br>
> IRB.CreateStore(IRB.CreateAdd(Load, ConstantInt::get(IRB.getInt64Ty(), 1)),<br>
> Counter);<br>
> return true;<br>
> @@ -875,7 +875,8 @@ bool EfficiencySanitizer::instrumentFast<br>
> // memory access, if they are not already set.<br>
> Value *ValueMask = ConstantInt::get(ShadowTy, 0x81); // 10000001B<br>
> <br>
> - Value *OldValue = IRB.CreateLoad(IRB.CreateIntToPtr(ShadowPtr, ShadowPtrTy));<br>
> + Value *OldValue =<br>
> + IRB.CreateLoad(ShadowTy, IRB.CreateIntToPtr(ShadowPtr, ShadowPtrTy));<br>
> // The AND and CMP will be turned into a TEST instruction by the compiler.<br>
> Value *Cmp = IRB.CreateICmpNE(IRB.CreateAnd(OldValue, ValueMask), ValueMask);<br>
> Instruction *CmpTerm = SplitBlockAndInsertIfThen(Cmp, I, false);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -817,7 +817,7 @@ bool GCOVProfiler::emitProfileArcs() {<br>
> <br>
> // Skip phis, landingpads.<br>
> IRBuilder<> Builder(&*BB.getFirstInsertionPt());<br>
> - Value *Count = Builder.CreateLoad(Phi);<br>
> + Value *Count = Builder.CreateLoad(Builder.getInt64Ty(), Phi);<br>
> Count = Builder.CreateAdd(Count, Builder.getInt64(1));<br>
> Builder.CreateStore(Count, Phi);<br>
> <br>
> @@ -828,7 +828,7 @@ bool GCOVProfiler::emitProfileArcs() {<br>
> const unsigned Edge = It->second;<br>
> Value *Counter =<br>
> Builder.CreateConstInBoundsGEP2_64(Counters, 0, Edge);<br>
> - Value *Count = Builder.CreateLoad(Counter);<br>
> + Value *Count = Builder.CreateLoad(Builder.getInt64Ty(), Counter);<br>
> Count = Builder.CreateAdd(Count, Builder.getInt64(1));<br>
> Builder.CreateStore(Count, Counter);<br>
> }<br>
> @@ -1089,17 +1089,20 @@ Function *GCOVProfiler::insertCounterWri<br>
> auto *StartFileCallArgsPtr = Builder.CreateStructGEP(FileInfoPtr, 0);<br>
> auto *StartFileCall = Builder.CreateCall(<br>
> StartFile,<br>
> - {Builder.CreateLoad(Builder.CreateStructGEP(StartFileCallArgsPtr, 0)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(StartFileCallArgsPtr, 1)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(StartFileCallArgsPtr, 2))});<br>
> + {Builder.CreateLoad(StartFileCallArgsTy->getElementType(0),<br>
> + Builder.CreateStructGEP(StartFileCallArgsPtr, 0)),<br>
> + Builder.CreateLoad(StartFileCallArgsTy->getElementType(1),<br>
> + Builder.CreateStructGEP(StartFileCallArgsPtr, 1)),<br>
> + Builder.CreateLoad(StartFileCallArgsTy->getElementType(2),<br>
> + Builder.CreateStructGEP(StartFileCallArgsPtr, 2))});<br>
> if (auto AK = TLI->getExtAttrForI32Param(false))<br>
> StartFileCall->addParamAttr(2, AK);<br>
> - auto *NumCounters =<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(FileInfoPtr, 1));<br>
> - auto *EmitFunctionCallArgsArray =<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(FileInfoPtr, 2));<br>
> - auto *EmitArcsCallArgsArray =<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(FileInfoPtr, 3));<br>
> + auto *NumCounters = Builder.CreateLoad(<br>
> + FileInfoTy->getElementType(1), Builder.CreateStructGEP(FileInfoPtr, 1));<br>
> + auto *EmitFunctionCallArgsArray = Builder.CreateLoad(<br>
> + FileInfoTy->getElementType(2), Builder.CreateStructGEP(FileInfoPtr, 2));<br>
> + auto *EmitArcsCallArgsArray = Builder.CreateLoad(<br>
> + FileInfoTy->getElementType(3), Builder.CreateStructGEP(FileInfoPtr, 3));<br>
> auto *EnterCounterLoopCond =<br>
> Builder.CreateICmpSLT(Builder.getInt32(0), NumCounters);<br>
> Builder.CreateCondBr(EnterCounterLoopCond, CounterLoopHeader, FileLoopLatch);<br>
> @@ -1111,11 +1114,16 @@ Function *GCOVProfiler::insertCounterWri<br>
> Builder.CreateInBoundsGEP(EmitFunctionCallArgsArray, {JV});<br>
> auto *EmitFunctionCall = Builder.CreateCall(<br>
> EmitFunction,<br>
> - {Builder.CreateLoad(Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 0)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 1)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 2)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 3)),<br>
> + {Builder.CreateLoad(EmitFunctionCallArgsTy->getElementType(0),<br>
> + Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 0)),<br>
> + Builder.CreateLoad(EmitFunctionCallArgsTy->getElementType(1),<br>
> + Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 1)),<br>
> + Builder.CreateLoad(EmitFunctionCallArgsTy->getElementType(2),<br>
> + Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 2)),<br>
> + Builder.CreateLoad(EmitFunctionCallArgsTy->getElementType(3),<br>
> + Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 3)),<br>
> Builder.CreateLoad(<br>
> + EmitFunctionCallArgsTy->getElementType(4),<br>
> Builder.CreateStructGEP(EmitFunctionCallArgsPtr, 4))});<br>
> if (auto AK = TLI->getExtAttrForI32Param(false)) {<br>
> EmitFunctionCall->addParamAttr(0, AK);<br>
> @@ -1127,8 +1135,10 @@ Function *GCOVProfiler::insertCounterWri<br>
> Builder.CreateInBoundsGEP(EmitArcsCallArgsArray, {JV});<br>
> auto *EmitArcsCall = Builder.CreateCall(<br>
> EmitArcs,<br>
> - {Builder.CreateLoad(Builder.CreateStructGEP(EmitArcsCallArgsPtr, 0)),<br>
> - Builder.CreateLoad(Builder.CreateStructGEP(EmitArcsCallArgsPtr, 1))});<br>
> + {Builder.CreateLoad(EmitArcsCallArgsTy->getElementType(0),<br>
> + Builder.CreateStructGEP(EmitArcsCallArgsPtr, 0)),<br>
> + Builder.CreateLoad(EmitArcsCallArgsTy->getElementType(1),<br>
> + Builder.CreateStructGEP(EmitArcsCallArgsPtr, 1))});<br>
> if (auto AK = TLI->getExtAttrForI32Param(false))<br>
> EmitArcsCall->addParamAttr(0, AK);<br>
> auto *NextJV = Builder.CreateAdd(JV, Builder.getInt32(1));<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -428,7 +428,7 @@ Value *HWAddressSanitizer::getDynamicSha<br>
> Value *GlobalDynamicAddress =<br>
> IRB.GetInsertBlock()->getParent()->getParent()->getOrInsertGlobal(<br>
> kHwasanShadowMemoryDynamicAddress, Int8PtrTy);<br>
> - return IRB.CreateLoad(GlobalDynamicAddress);<br>
> + return IRB.CreateLoad(Int8PtrTy, GlobalDynamicAddress);<br>
> }<br>
> }<br>
> <br>
> @@ -557,7 +557,7 @@ void HWAddressSanitizer::instrumentMemAc<br>
> IRB.getInt8Ty());<br>
> Value *AddrLong = untagPointer(IRB, PtrLong);<br>
> Value *Shadow = memToShadow(AddrLong, IRB);<br>
> - Value *MemTag = IRB.CreateLoad(Shadow);<br>
> + Value *MemTag = IRB.CreateLoad(Int8Ty, Shadow);<br>
> Value *TagMismatch = IRB.CreateICmpNE(PtrTag, MemTag);<br>
> <br>
> int matchAllTag = ClMatchAllTag.getNumOccurrences() > 0 ?<br>
> @@ -841,7 +841,7 @@ Value *HWAddressSanitizer::emitPrologue(<br>
> Value *SlotPtr = getHwasanThreadSlotPtr(IRB, IntptrTy);<br>
> assert(SlotPtr);<br>
> <br>
> - Instruction *ThreadLong = IRB.CreateLoad(SlotPtr);<br>
> + Instruction *ThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr);<br>
> <br>
> Function *F = IRB.GetInsertBlock()->getParent();<br>
> if (F->getFnAttribute("hwasan-abi").getValueAsString() == "interceptor") {<br>
> @@ -855,7 +855,7 @@ Value *HWAddressSanitizer::emitPrologue(<br>
> // FIXME: This should call a new runtime function with a custom calling<br>
> // convention to avoid needing to spill all arguments here.<br>
> IRB.CreateCall(HwasanThreadEnterFunc);<br>
> - LoadInst *ReloadThreadLong = IRB.CreateLoad(SlotPtr);<br>
> + LoadInst *ReloadThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr);<br>
> <br>
> IRB.SetInsertPoint(&*Br->getSuccessor(0)->begin());<br>
> PHINode *ThreadLongPhi = IRB.CreatePHI(IntptrTy, 2);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/InstrProfiling.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -195,6 +195,7 @@ public:<br>
> // block.<br>
> Value *LiveInValue = SSA.GetValueInMiddleOfBlock(ExitBlock);<br>
> Value *Addr = cast<StoreInst>(Store)->getPointerOperand();<br>
> + Type *Ty = LiveInValue->getType();<br>
> IRBuilder<> Builder(InsertPos);<br>
> if (AtomicCounterUpdatePromoted)<br>
> // automic update currently can only be promoted across the current<br>
> @@ -202,7 +203,7 @@ public:<br>
> Builder.CreateAtomicRMW(AtomicRMWInst::Add, Addr, LiveInValue,<br>
> AtomicOrdering::SequentiallyConsistent);<br>
> else {<br>
> - LoadInst *OldVal = Builder.CreateLoad(Addr, "pgocount.promoted");<br>
> + LoadInst *OldVal = Builder.CreateLoad(Ty, Addr, "pgocount.promoted");<br>
> auto *NewVal = Builder.CreateAdd(OldVal, LiveInValue);<br>
> auto *NewStore = Builder.CreateStore(NewVal, Addr);<br>
> <br>
> @@ -603,7 +604,8 @@ void InstrProfiling::lowerIncrement(Inst<br>
> Builder.CreateAtomicRMW(AtomicRMWInst::Add, Addr, Inc->getStep(),<br>
> AtomicOrdering::Monotonic);<br>
> } else {<br>
> - Value *Load = Builder.CreateLoad(Addr, "pgocount");<br>
> + Value *IncStep = Inc->getStep();<br>
> + Value *Load = Builder.CreateLoad(IncStep->getType(), Addr, "pgocount");<br>
> auto *Count = Builder.CreateAdd(Load, Inc->getStep());<br>
> auto *Store = Builder.CreateStore(Count, Addr);<br>
> if (isCounterPromotionEnabled())<br>
> @@ -950,7 +952,7 @@ bool InstrProfiling::emitRuntimeHook() {<br>
> User->setComdat(M->getOrInsertComdat(User->getName()));<br>
> <br>
> IRBuilder<> IRB(BasicBlock::Create(M->getContext(), "", User));<br>
> - auto *Load = IRB.CreateLoad(Var);<br>
> + auto *Load = IRB.CreateLoad(Int32Ty, Var);<br>
> IRB.CreateRet(Load);<br>
> <br>
> // Mark the user variable as used so that it isn't stripped out.<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1401,7 +1401,7 @@ struct MemorySanitizerVisitor : public I<br>
> IRB.CreateAnd(OriginLong, ConstantInt::get(MS.IntptrTy, ~Mask));<br>
> }<br>
> OriginPtr =<br>
> - IRB.CreateIntToPtr(OriginLong, PointerType::get(IRB.getInt32Ty(), 0));<br>
> + IRB.CreateIntToPtr(OriginLong, PointerType::get(MS.OriginTy, 0));<br>
> }<br>
> return std::make_pair(ShadowPtr, OriginPtr);<br>
> }<br>
> @@ -1618,8 +1618,8 @@ struct MemorySanitizerVisitor : public I<br>
> // ParamTLS overflow.<br>
> *ShadowPtr = getCleanShadow(V);<br>
> } else {<br>
> - *ShadowPtr =<br>
> - EntryIRB.CreateAlignedLoad(Base, kShadowTLSAlignment);<br>
> + *ShadowPtr = EntryIRB.CreateAlignedLoad(getShadowTy(&FArg), Base,<br>
> + kShadowTLSAlignment);<br>
> }<br>
> }<br>
> LLVM_DEBUG(dbgs()<br>
> @@ -1627,7 +1627,7 @@ struct MemorySanitizerVisitor : public I<br>
> if (MS.TrackOrigins && !Overflow) {<br>
> Value *OriginPtr =<br>
> getOriginPtrForArgument(&FArg, EntryIRB, ArgOffset);<br>
> - setOrigin(A, EntryIRB.CreateLoad(OriginPtr));<br>
> + setOrigin(A, EntryIRB.CreateLoad(MS.OriginTy, OriginPtr));<br>
> } else {<br>
> setOrigin(A, getCleanOrigin());<br>
> }<br>
> @@ -1758,7 +1758,8 @@ struct MemorySanitizerVisitor : public I<br>
> if (PropagateShadow) {<br>
> std::tie(ShadowPtr, OriginPtr) =<br>
> getShadowOriginPtr(Addr, IRB, ShadowTy, Alignment, /*isStore*/ false);<br>
> - setShadow(&I, IRB.CreateAlignedLoad(ShadowPtr, Alignment, "_msld"));<br>
> + setShadow(&I,<br>
> + IRB.CreateAlignedLoad(ShadowTy, ShadowPtr, Alignment, "_msld"));<br>
> } else {<br>
> setShadow(&I, getCleanShadow(&I));<br>
> }<br>
> @@ -1772,7 +1773,8 @@ struct MemorySanitizerVisitor : public I<br>
> if (MS.TrackOrigins) {<br>
> if (PropagateShadow) {<br>
> unsigned OriginAlignment = std::max(kMinOriginAlignment, Alignment);<br>
> - setOrigin(&I, IRB.CreateAlignedLoad(OriginPtr, OriginAlignment));<br>
> + setOrigin(<br>
> + &I, IRB.CreateAlignedLoad(MS.OriginTy, OriginPtr, OriginAlignment));<br>
> } else {<br>
> setOrigin(&I, getCleanOrigin());<br>
> }<br>
> @@ -2452,7 +2454,8 @@ struct MemorySanitizerVisitor : public I<br>
> unsigned Alignment = 1;<br>
> std::tie(ShadowPtr, OriginPtr) =<br>
> getShadowOriginPtr(Addr, IRB, ShadowTy, Alignment, /*isStore*/ false);<br>
> - setShadow(&I, IRB.CreateAlignedLoad(ShadowPtr, Alignment, "_msld"));<br>
> + setShadow(&I,<br>
> + IRB.CreateAlignedLoad(ShadowTy, ShadowPtr, Alignment, "_msld"));<br>
> } else {<br>
> setShadow(&I, getCleanShadow(&I));<br>
> }<br>
> @@ -2462,7 +2465,7 @@ struct MemorySanitizerVisitor : public I<br>
> <br>
> if (MS.TrackOrigins) {<br>
> if (PropagateShadow)<br>
> - setOrigin(&I, IRB.CreateLoad(OriginPtr));<br>
> + setOrigin(&I, IRB.CreateLoad(MS.OriginTy, OriginPtr));<br>
> else<br>
> setOrigin(&I, getCleanOrigin());<br>
> }<br>
> @@ -2845,9 +2848,9 @@ struct MemorySanitizerVisitor : public I<br>
> if (ClCheckAccessAddress)<br>
> insertShadowCheck(Addr, &I);<br>
> <br>
> - Value *Shadow = IRB.CreateAlignedLoad(ShadowPtr, Alignment, "_ldmxcsr");<br>
> - Value *Origin =<br>
> - MS.TrackOrigins ? IRB.CreateLoad(OriginPtr) : getCleanOrigin();<br>
> + Value *Shadow = IRB.CreateAlignedLoad(Ty, ShadowPtr, Alignment, "_ldmxcsr");<br>
> + Value *Origin = MS.TrackOrigins ? IRB.CreateLoad(MS.OriginTy, OriginPtr)<br>
> + : getCleanOrigin();<br>
> insertShadowCheck(Shadow, Origin, &I);<br>
> }<br>
> <br>
> @@ -2921,7 +2924,7 @@ struct MemorySanitizerVisitor : public I<br>
> <br>
> Value *Origin = IRB.CreateSelect(<br>
> IRB.CreateICmpNE(Acc, Constant::getNullValue(Acc->getType())),<br>
> - getOrigin(PassThru), IRB.CreateLoad(OriginPtr));<br>
> + getOrigin(PassThru), IRB.CreateLoad(MS.OriginTy, OriginPtr));<br>
> <br>
> setOrigin(&I, Origin);<br>
> } else {<br>
> @@ -3284,12 +3287,13 @@ struct MemorySanitizerVisitor : public I<br>
> "Could not find insertion point for retval shadow load");<br>
> }<br>
> IRBuilder<> IRBAfter(&*NextInsn);<br>
> - Value *RetvalShadow =<br>
> - IRBAfter.CreateAlignedLoad(getShadowPtrForRetval(&I, IRBAfter),<br>
> - kShadowTLSAlignment, "_msret");<br>
> + Value *RetvalShadow = IRBAfter.CreateAlignedLoad(<br>
> + getShadowTy(&I), getShadowPtrForRetval(&I, IRBAfter),<br>
> + kShadowTLSAlignment, "_msret");<br>
> setShadow(&I, RetvalShadow);<br>
> if (MS.TrackOrigins)<br>
> - setOrigin(&I, IRBAfter.CreateLoad(getOriginPtrForRetval(IRBAfter)));<br>
> + setOrigin(&I, IRBAfter.CreateLoad(MS.OriginTy,<br>
> + getOriginPtrForRetval(IRBAfter)));<br>
> }<br>
> <br>
> bool isAMustTailRetVal(Value *RetVal) {<br>
> @@ -3837,7 +3841,8 @@ struct VarArgAMD64Helper : public VarArg<br>
> // If there is a va_start in this function, make a backup copy of<br>
> // va_arg_tls somewhere in the function entry block.<br>
> IRBuilder<> IRB(MSV.ActualFnStart->getFirstNonPHI());<br>
> - VAArgOverflowSize = IRB.CreateLoad(MS.VAArgOverflowSizeTLS);<br>
> + VAArgOverflowSize =<br>
> + IRB.CreateLoad(IRB.getInt64Ty(), MS.VAArgOverflowSizeTLS);<br>
> Value *CopySize =<br>
> IRB.CreateAdd(ConstantInt::get(MS.IntptrTy, AMD64FpEndOffset),<br>
> VAArgOverflowSize);<br>
> @@ -3856,11 +3861,13 @@ struct VarArgAMD64Helper : public VarArg<br>
> IRBuilder<> IRB(OrigInst->getNextNode());<br>
> Value *VAListTag = OrigInst->getArgOperand(0);<br>
> <br>
> + Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C);<br>
> Value *RegSaveAreaPtrPtr = IRB.CreateIntToPtr(<br>
> IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> ConstantInt::get(MS.IntptrTy, 16)),<br>
> - PointerType::get(Type::getInt64PtrTy(*MS.C), 0));<br>
> - Value *RegSaveAreaPtr = IRB.CreateLoad(RegSaveAreaPtrPtr);<br>
> + PointerType::get(RegSaveAreaPtrTy, 0));<br>
> + Value *RegSaveAreaPtr =<br>
> + IRB.CreateLoad(RegSaveAreaPtrTy, RegSaveAreaPtrPtr);<br>
> Value *RegSaveAreaShadowPtr, *RegSaveAreaOriginPtr;<br>
> unsigned Alignment = 16;<br>
> std::tie(RegSaveAreaShadowPtr, RegSaveAreaOriginPtr) =<br>
> @@ -3871,11 +3878,13 @@ struct VarArgAMD64Helper : public VarArg<br>
> if (MS.TrackOrigins)<br>
> IRB.CreateMemCpy(RegSaveAreaOriginPtr, Alignment, VAArgTLSOriginCopy,<br>
> Alignment, AMD64FpEndOffset);<br>
> + Type *OverflowArgAreaPtrTy = Type::getInt64PtrTy(*MS.C);<br>
> Value *OverflowArgAreaPtrPtr = IRB.CreateIntToPtr(<br>
> IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> ConstantInt::get(MS.IntptrTy, 8)),<br>
> - PointerType::get(Type::getInt64PtrTy(*MS.C), 0));<br>
> - Value *OverflowArgAreaPtr = IRB.CreateLoad(OverflowArgAreaPtrPtr);<br>
> + PointerType::get(OverflowArgAreaPtrTy, 0));<br>
> + Value *OverflowArgAreaPtr =<br>
> + IRB.CreateLoad(OverflowArgAreaPtrTy, OverflowArgAreaPtrPtr);<br>
> Value *OverflowArgAreaShadowPtr, *OverflowArgAreaOriginPtr;<br>
> std::tie(OverflowArgAreaShadowPtr, OverflowArgAreaOriginPtr) =<br>
> MSV.getShadowOriginPtr(OverflowArgAreaPtr, IRB, IRB.getInt8Ty(),<br>
> @@ -3977,7 +3986,7 @@ struct VarArgMIPS64Helper : public VarAr<br>
> assert(!VAArgSize && !VAArgTLSCopy &&<br>
> "finalizeInstrumentation called twice");<br>
> IRBuilder<> IRB(MSV.ActualFnStart->getFirstNonPHI());<br>
> - VAArgSize = IRB.CreateLoad(MS.VAArgOverflowSizeTLS);<br>
> + VAArgSize = IRB.CreateLoad(IRB.getInt64Ty(), MS.VAArgOverflowSizeTLS);<br>
> Value *CopySize = IRB.CreateAdd(ConstantInt::get(MS.IntptrTy, 0),<br>
> VAArgSize);<br>
> <br>
> @@ -3994,10 +4003,12 @@ struct VarArgMIPS64Helper : public VarAr<br>
> CallInst *OrigInst = VAStartInstrumentationList[i];<br>
> IRBuilder<> IRB(OrigInst->getNextNode());<br>
> Value *VAListTag = OrigInst->getArgOperand(0);<br>
> + Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C);<br>
> Value *RegSaveAreaPtrPtr =<br>
> IRB.CreateIntToPtr(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> - PointerType::get(Type::getInt64PtrTy(*MS.C), 0));<br>
> - Value *RegSaveAreaPtr = IRB.CreateLoad(RegSaveAreaPtrPtr);<br>
> + PointerType::get(RegSaveAreaPtrTy, 0));<br>
> + Value *RegSaveAreaPtr =<br>
> + IRB.CreateLoad(RegSaveAreaPtrTy, RegSaveAreaPtrPtr);<br>
> Value *RegSaveAreaShadowPtr, *RegSaveAreaOriginPtr;<br>
> unsigned Alignment = 8;<br>
> std::tie(RegSaveAreaShadowPtr, RegSaveAreaOriginPtr) =<br>
> @@ -4147,7 +4158,7 @@ struct VarArgAArch64Helper : public VarA<br>
> IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> ConstantInt::get(MS.IntptrTy, offset)),<br>
> Type::getInt64PtrTy(*MS.C));<br>
> - return IRB.CreateLoad(SaveAreaPtrPtr);<br>
> + return IRB.CreateLoad(Type::getInt64Ty(*MS.C), SaveAreaPtrPtr);<br>
> }<br>
> <br>
> // Retrieve a va_list field of 'int' size.<br>
> @@ -4157,7 +4168,7 @@ struct VarArgAArch64Helper : public VarA<br>
> IRB.CreateAdd(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> ConstantInt::get(MS.IntptrTy, offset)),<br>
> Type::getInt32PtrTy(*MS.C));<br>
> - Value *SaveArea32 = IRB.CreateLoad(SaveAreaPtr);<br>
> + Value *SaveArea32 = IRB.CreateLoad(IRB.getInt32Ty(), SaveAreaPtr);<br>
> return IRB.CreateSExt(SaveArea32, MS.IntptrTy);<br>
> }<br>
> <br>
> @@ -4168,7 +4179,8 @@ struct VarArgAArch64Helper : public VarA<br>
> // If there is a va_start in this function, make a backup copy of<br>
> // va_arg_tls somewhere in the function entry block.<br>
> IRBuilder<> IRB(MSV.ActualFnStart->getFirstNonPHI());<br>
> - VAArgOverflowSize = IRB.CreateLoad(MS.VAArgOverflowSizeTLS);<br>
> + VAArgOverflowSize =<br>
> + IRB.CreateLoad(IRB.getInt64Ty(), MS.VAArgOverflowSizeTLS);<br>
> Value *CopySize =<br>
> IRB.CreateAdd(ConstantInt::get(MS.IntptrTy, AArch64VAEndOffset),<br>
> VAArgOverflowSize);<br>
> @@ -4411,7 +4423,7 @@ struct VarArgPowerPC64Helper : public Va<br>
> assert(!VAArgSize && !VAArgTLSCopy &&<br>
> "finalizeInstrumentation called twice");<br>
> IRBuilder<> IRB(MSV.ActualFnStart->getFirstNonPHI());<br>
> - VAArgSize = IRB.CreateLoad(MS.VAArgOverflowSizeTLS);<br>
> + VAArgSize = IRB.CreateLoad(IRB.getInt64Ty(), MS.VAArgOverflowSizeTLS);<br>
> Value *CopySize = IRB.CreateAdd(ConstantInt::get(MS.IntptrTy, 0),<br>
> VAArgSize);<br>
> <br>
> @@ -4428,10 +4440,12 @@ struct VarArgPowerPC64Helper : public Va<br>
> CallInst *OrigInst = VAStartInstrumentationList[i];<br>
> IRBuilder<> IRB(OrigInst->getNextNode());<br>
> Value *VAListTag = OrigInst->getArgOperand(0);<br>
> + Type *RegSaveAreaPtrTy = Type::getInt64PtrTy(*MS.C);<br>
> Value *RegSaveAreaPtrPtr =<br>
> IRB.CreateIntToPtr(IRB.CreatePtrToInt(VAListTag, MS.IntptrTy),<br>
> - PointerType::get(Type::getInt64PtrTy(*MS.C), 0));<br>
> - Value *RegSaveAreaPtr = IRB.CreateLoad(RegSaveAreaPtrPtr);<br>
> + PointerType::get(RegSaveAreaPtrTy, 0));<br>
> + Value *RegSaveAreaPtr =<br>
> + IRB.CreateLoad(RegSaveAreaPtrTy, RegSaveAreaPtrPtr);<br>
> Value *RegSaveAreaShadowPtr, *RegSaveAreaOriginPtr;<br>
> unsigned Alignment = 8;<br>
> std::tie(RegSaveAreaShadowPtr, RegSaveAreaOriginPtr) =<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Instrumentation/SanitizerCoverage.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -822,7 +822,7 @@ void SanitizerCoverageModule::InjectCove<br>
> auto CounterPtr = IRB.CreateGEP(<br>
> Function8bitCounterArray,<br>
> {ConstantInt::get(IntptrTy, 0), ConstantInt::get(IntptrTy, Idx)});<br>
> - auto Load = IRB.CreateLoad(CounterPtr);<br>
> + auto Load = IRB.CreateLoad(Int8Ty, CounterPtr);<br>
> auto Inc = IRB.CreateAdd(Load, ConstantInt::get(Int8Ty, 1));<br>
> auto Store = IRB.CreateStore(Inc, CounterPtr);<br>
> SetNoSanitizeMetadata(Load);<br>
> @@ -835,7 +835,7 @@ void SanitizerCoverageModule::InjectCove<br>
> auto FrameAddrPtr =<br>
> IRB.CreateCall(GetFrameAddr, {Constant::getNullValue(Int32Ty)});<br>
> auto FrameAddrInt = IRB.CreatePtrToInt(FrameAddrPtr, IntptrTy);<br>
> - auto LowestStack = IRB.CreateLoad(SanCovLowestStack);<br>
> + auto LowestStack = IRB.CreateLoad(IntptrTy, SanCovLowestStack);<br>
> auto IsStackLower = IRB.CreateICmpULT(FrameAddrInt, LowestStack);<br>
> auto ThenTerm = SplitBlockAndInsertIfThen(IsStackLower, &*IP, false);<br>
> IRBuilder<> ThenIRB(ThenTerm);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1234,10 +1234,10 @@ bool GVN::PerformLoadPRE(LoadInst *LI, A<br>
> BasicBlock *UnavailablePred = PredLoad.first;<br>
> Value *LoadPtr = PredLoad.second;<br>
> <br>
> - auto *NewLoad = new LoadInst(LoadPtr, LI->getName()+".pre",<br>
> - LI->isVolatile(), LI->getAlignment(),<br>
> - LI->getOrdering(), LI->getSyncScopeID(),<br>
> - UnavailablePred->getTerminator());<br>
> + auto *NewLoad =<br>
> + new LoadInst(LI->getType(), LoadPtr, LI->getName() + ".pre",<br>
> + LI->isVolatile(), LI->getAlignment(), LI->getOrdering(),<br>
> + LI->getSyncScopeID(), UnavailablePred->getTerminator());<br>
> NewLoad->setDebugLoc(LI->getDebugLoc());<br>
> <br>
> // Transfer the old load's AA tags to the new load.<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1445,11 +1445,11 @@ bool JumpThreadingPass::SimplifyPartiall<br>
> if (UnavailablePred) {<br>
> assert(UnavailablePred->getTerminator()->getNumSuccessors() == 1 &&<br>
> "Can't handle critical edge here!");<br>
> - LoadInst *NewVal =<br>
> - new LoadInst(LoadedPtr->DoPHITranslation(LoadBB, UnavailablePred),<br>
> - LoadI->getName() + ".pr", false, LoadI->getAlignment(),<br>
> - LoadI->getOrdering(), LoadI->getSyncScopeID(),<br>
> - UnavailablePred->getTerminator());<br>
> + LoadInst *NewVal = new LoadInst(<br>
> + LoadI->getType(), LoadedPtr->DoPHITranslation(LoadBB, UnavailablePred),<br>
> + LoadI->getName() + ".pr", false, LoadI->getAlignment(),<br>
> + LoadI->getOrdering(), LoadI->getSyncScopeID(),<br>
> + UnavailablePred->getTerminator());<br>
> NewVal->setDebugLoc(LoadI->getDebugLoc());<br>
> if (AATags)<br>
> NewVal->setAAMetadata(AATags);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1947,7 +1947,8 @@ bool llvm::promoteLoopAccessesToScalars(<br>
> // Set up the preheader to have a definition of the value. It is the live-out<br>
> // value from the preheader that uses in the loop will use.<br>
> LoadInst *PreheaderLoad = new LoadInst(<br>
> - SomePtr, SomePtr->getName() + ".promoted", Preheader->getTerminator());<br>
> + SomePtr->getType()->getPointerElementType(), SomePtr,<br>
> + SomePtr->getName() + ".promoted", Preheader->getTerminator());<br>
> if (SawUnorderedAtomic)<br>
> PreheaderLoad->setOrdering(AtomicOrdering::Unordered);<br>
> PreheaderLoad->setAlignment(Alignment);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/LoopLoadElimination.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -427,9 +427,9 @@ public:<br>
> auto *PH = L->getLoopPreheader();<br>
> Value *InitialPtr = SEE.expandCodeFor(PtrSCEV->getStart(), Ptr->getType(),<br>
> PH->getTerminator());<br>
> - Value *Initial =<br>
> - new LoadInst(InitialPtr, "load_initial", /* isVolatile */ false,<br>
> - Cand.Load->getAlignment(), PH->getTerminator());<br>
> + Value *Initial = new LoadInst(<br>
> + Cand.Load->getType(), InitialPtr, "load_initial",<br>
> + /* isVolatile */ false, Cand.Load->getAlignment(), PH->getTerminator());<br>
> <br>
> PHINode *PHI = PHINode::Create(Initial->getType(), 2, "store_forwarded",<br>
> &L->getHeader()->front());<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/LowerAtomic.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -26,7 +26,7 @@ static bool LowerAtomicCmpXchgInst(Atomi<br>
> Value *Cmp = CXI->getCompareOperand();<br>
> Value *Val = CXI->getNewValOperand();<br>
> <br>
> - LoadInst *Orig = Builder.CreateLoad(Ptr);<br>
> + LoadInst *Orig = Builder.CreateLoad(Val->getType(), Ptr);<br>
> Value *Equal = Builder.CreateICmpEQ(Orig, Cmp);<br>
> Value *Res = Builder.CreateSelect(Equal, Val, Orig);<br>
> Builder.CreateStore(Res, Ptr);<br>
> @@ -44,7 +44,7 @@ static bool LowerAtomicRMWInst(AtomicRMW<br>
> Value *Ptr = RMWI->getPointerOperand();<br>
> Value *Val = RMWI->getValOperand();<br>
> <br>
> - LoadInst *Orig = Builder.CreateLoad(Ptr);<br>
> + LoadInst *Orig = Builder.CreateLoad(Val->getType(), Ptr);<br>
> Value *Res = nullptr;<br>
> <br>
> switch (RMWI->getOperation()) {<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1636,7 +1636,7 @@ makeStatepointExplicit(DominatorTree &DT<br>
> // for sanity checking.<br>
> static void<br>
> insertRelocationStores(iterator_range<Value::user_iterator> GCRelocs,<br>
> - DenseMap<Value *, Value *> &AllocaMap,<br>
> + DenseMap<Value *, AllocaInst *> &AllocaMap,<br>
> DenseSet<Value *> &VisitedLiveValues) {<br>
> for (User *U : GCRelocs) {<br>
> GCRelocateInst *Relocate = dyn_cast<GCRelocateInst>(U);<br>
> @@ -1671,7 +1671,7 @@ insertRelocationStores(iterator_range<Va<br>
> // "insertRelocationStores" but works for rematerialized values.<br>
> static void insertRematerializationStores(<br>
> const RematerializedValueMapTy &RematerializedValues,<br>
> - DenseMap<Value *, Value *> &AllocaMap,<br>
> + DenseMap<Value *, AllocaInst *> &AllocaMap,<br>
> DenseSet<Value *> &VisitedLiveValues) {<br>
> for (auto RematerializedValuePair: RematerializedValues) {<br>
> Instruction *RematerializedValue = RematerializedValuePair.first;<br>
> @@ -1704,7 +1704,7 @@ static void relocationViaAlloca(<br>
> #endif<br>
> <br>
> // TODO-PERF: change data structures, reserve<br>
> - DenseMap<Value *, Value *> AllocaMap;<br>
> + DenseMap<Value *, AllocaInst *> AllocaMap;<br>
> SmallVector<AllocaInst *, 200> PromotableAllocas;<br>
> // Used later to chack that we have enough allocas to store all values<br>
> std::size_t NumRematerializedValues = 0;<br>
> @@ -1774,7 +1774,7 @@ static void relocationViaAlloca(<br>
> SmallVector<AllocaInst *, 64> ToClobber;<br>
> for (auto Pair : AllocaMap) {<br>
> Value *Def = Pair.first;<br>
> - AllocaInst *Alloca = cast<AllocaInst>(Pair.second);<br>
> + AllocaInst *Alloca = Pair.second;<br>
> <br>
> // This value was relocated<br>
> if (VisitedLiveValues.count(Def)) {<br>
> @@ -1806,7 +1806,7 @@ static void relocationViaAlloca(<br>
> // Update use with load allocas and add store for gc_relocated.<br>
> for (auto Pair : AllocaMap) {<br>
> Value *Def = Pair.first;<br>
> - Value *Alloca = Pair.second;<br>
> + AllocaInst *Alloca = Pair.second;<br>
> <br>
> // We pre-record the uses of allocas so that we dont have to worry about<br>
> // later update that changes the user information..<br>
> @@ -1834,13 +1834,15 @@ static void relocationViaAlloca(<br>
> PHINode *Phi = cast<PHINode>(Use);<br>
> for (unsigned i = 0; i < Phi->getNumIncomingValues(); i++) {<br>
> if (Def == Phi->getIncomingValue(i)) {<br>
> - LoadInst *Load = new LoadInst(<br>
> - Alloca, "", Phi->getIncomingBlock(i)->getTerminator());<br>
> + LoadInst *Load =<br>
> + new LoadInst(Alloca->getAllocatedType(), Alloca, "",<br>
> + Phi->getIncomingBlock(i)->getTerminator());<br>
> Phi->setIncomingValue(i, Load);<br>
> }<br>
> }<br>
> } else {<br>
> - LoadInst *Load = new LoadInst(Alloca, "", Use);<br>
> + LoadInst *Load =<br>
> + new LoadInst(Alloca->getAllocatedType(), Alloca, "", Use);<br>
> Use->replaceUsesOfWith(Def, Load);<br>
> }<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1231,15 +1231,14 @@ static bool isSafePHIToSpeculate(PHINode<br>
> static void speculatePHINodeLoads(PHINode &PN) {<br>
> LLVM_DEBUG(dbgs() << " original: " << PN << "\n");<br>
> <br>
> - Type *LoadTy = cast<PointerType>(PN.getType())->getElementType();<br>
> + LoadInst *SomeLoad = cast<LoadInst>(PN.user_back());<br>
> + Type *LoadTy = SomeLoad->getType();<br>
> IRBuilderTy PHIBuilder(&PN);<br>
> PHINode *NewPN = PHIBuilder.CreatePHI(LoadTy, PN.getNumIncomingValues(),<br>
> PN.getName() + ".sroa.speculated");<br>
> <br>
> // Get the AA tags and alignment to use from one of the loads. It doesn't<br>
> // matter which one we get and if any differ.<br>
> - LoadInst *SomeLoad = cast<LoadInst>(PN.user_back());<br>
> -<br>
> AAMDNodes AATags;<br>
> SomeLoad->getAAMetadata(AATags);<br>
> unsigned Align = SomeLoad->getAlignment();<br>
> @@ -1270,7 +1269,8 @@ static void speculatePHINodeLoads(PHINod<br>
> IRBuilderTy PredBuilder(TI);<br>
> <br>
> LoadInst *Load = PredBuilder.CreateLoad(<br>
> - InVal, (PN.getName() + ".sroa.speculate.load." + Pred->getName()));<br>
> + LoadTy, InVal,<br>
> + (PN.getName() + ".sroa.speculate.load." + Pred->getName()));<br>
> ++NumLoadsSpeculated;<br>
> Load->setAlignment(Align);<br>
> if (AATags)<br>
> @@ -1330,10 +1330,10 @@ static void speculateSelectInstLoads(Sel<br>
> assert(LI->isSimple() && "We only speculate simple loads");<br>
> <br>
> IRB.SetInsertPoint(LI);<br>
> - LoadInst *TL =<br>
> - IRB.CreateLoad(TV, LI->getName() + ".sroa.speculate.load.true");<br>
> - LoadInst *FL =<br>
> - IRB.CreateLoad(FV, LI->getName() + ".sroa.speculate.load.false");<br>
> + LoadInst *TL = IRB.CreateLoad(LI->getType(), TV,<br>
> + LI->getName() + ".sroa.speculate.load.true");<br>
> + LoadInst *FL = IRB.CreateLoad(LI->getType(), FV,<br>
> + LI->getName() + ".sroa.speculate.load.false");<br>
> NumLoadsSpeculated += 2;<br>
> <br>
> // Transfer alignment and AA info if present.<br>
> @@ -2410,14 +2410,16 @@ private:<br>
> unsigned EndIndex = getIndex(NewEndOffset);<br>
> assert(EndIndex > BeginIndex && "Empty vector!");<br>
> <br>
> - Value *V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "load");<br>
> + Value *V = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "load");<br>
> return extractVector(IRB, V, BeginIndex, EndIndex, "vec");<br>
> }<br>
> <br>
> Value *rewriteIntegerLoad(LoadInst &LI) {<br>
> assert(IntTy && "We cannot insert an integer to the alloca");<br>
> assert(!LI.isVolatile());<br>
> - Value *V = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "load");<br>
> + Value *V = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "load");<br>
> V = convertValue(DL, IRB, V, IntTy);<br>
> assert(NewBeginOffset >= NewAllocaBeginOffset && "Out of bounds offset");<br>
> uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;<br>
> @@ -2461,7 +2463,8 @@ private:<br>
> (canConvertValue(DL, NewAllocaTy, TargetTy) ||<br>
> (IsLoadPastEnd && NewAllocaTy->isIntegerTy() &&<br>
> TargetTy->isIntegerTy()))) {<br>
> - LoadInst *NewLI = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(),<br>
> + LoadInst *NewLI = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(),<br>
> LI.isVolatile(), LI.getName());<br>
> if (AATags)<br>
> NewLI->setAAMetadata(AATags);<br>
> @@ -2497,9 +2500,9 @@ private:<br>
> }<br>
> } else {<br>
> Type *LTy = TargetTy->getPointerTo(AS);<br>
> - LoadInst *NewLI = IRB.CreateAlignedLoad(getNewAllocaSlicePtr(IRB, LTy),<br>
> - getSliceAlign(TargetTy),<br>
> - LI.isVolatile(), LI.getName());<br>
> + LoadInst *NewLI = IRB.CreateAlignedLoad(<br>
> + TargetTy, getNewAllocaSlicePtr(IRB, LTy), getSliceAlign(TargetTy),<br>
> + LI.isVolatile(), LI.getName());<br>
> if (AATags)<br>
> NewLI->setAAMetadata(AATags);<br>
> if (LI.isVolatile())<br>
> @@ -2525,8 +2528,8 @@ private:<br>
> // basis for the new value. This allows us to replace the uses of LI with<br>
> // the computed value, and then replace the placeholder with LI, leaving<br>
> // LI only used for this computation.<br>
> - Value *Placeholder =<br>
> - new LoadInst(UndefValue::get(LI.getType()->getPointerTo(AS)));<br>
> + Value *Placeholder = new LoadInst(<br>
> + LI.getType(), UndefValue::get(LI.getType()->getPointerTo(AS)));<br>
> V = insertInteger(DL, IRB, Placeholder, V, NewBeginOffset - BeginOffset,<br>
> "insert");<br>
> LI.replaceAllUsesWith(V);<br>
> @@ -2557,7 +2560,8 @@ private:<br>
> V = convertValue(DL, IRB, V, SliceTy);<br>
> <br>
> // Mix in the existing elements.<br>
> - Value *Old = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "load");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "load");<br>
> V = insertVector(IRB, Old, V, BeginIndex, "vec");<br>
> }<br>
> StoreInst *Store = IRB.CreateAlignedStore(V, &NewAI, NewAI.getAlignment());<br>
> @@ -2573,8 +2577,8 @@ private:<br>
> assert(IntTy && "We cannot extract an integer from the alloca");<br>
> assert(!SI.isVolatile());<br>
> if (DL.getTypeSizeInBits(V->getType()) != IntTy->getBitWidth()) {<br>
> - Value *Old =<br>
> - IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "oldload");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "oldload");<br>
> Old = convertValue(DL, IRB, Old, IntTy);<br>
> assert(BeginOffset >= NewAllocaBeginOffset && "Out of bounds offset");<br>
> uint64_t Offset = BeginOffset - NewAllocaBeginOffset;<br>
> @@ -2766,8 +2770,8 @@ private:<br>
> if (NumElements > 1)<br>
> Splat = getVectorSplat(Splat, NumElements);<br>
> <br>
> - Value *Old =<br>
> - IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "oldload");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "oldload");<br>
> V = insertVector(IRB, Old, Splat, BeginIndex, "vec");<br>
> } else if (IntTy) {<br>
> // If this is a memset on an alloca where we can widen stores, insert the<br>
> @@ -2779,8 +2783,8 @@ private:<br>
> <br>
> if (IntTy && (BeginOffset != NewAllocaBeginOffset ||<br>
> EndOffset != NewAllocaBeginOffset)) {<br>
> - Value *Old =<br>
> - IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "oldload");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "oldload");<br>
> Old = convertValue(DL, IRB, Old, IntTy);<br>
> uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;<br>
> V = insertInteger(DL, IRB, Old, V, Offset, "insert");<br>
> @@ -2940,18 +2944,18 @@ private:<br>
> <br>
> // Reset the other pointer type to match the register type we're going to<br>
> // use, but using the address space of the original other pointer.<br>
> + Type *OtherTy;<br>
> if (VecTy && !IsWholeAlloca) {<br>
> if (NumElements == 1)<br>
> - OtherPtrTy = VecTy->getElementType();<br>
> + OtherTy = VecTy->getElementType();<br>
> else<br>
> - OtherPtrTy = VectorType::get(VecTy->getElementType(), NumElements);<br>
> -<br>
> - OtherPtrTy = OtherPtrTy->getPointerTo(OtherAS);<br>
> + OtherTy = VectorType::get(VecTy->getElementType(), NumElements);<br>
> } else if (IntTy && !IsWholeAlloca) {<br>
> - OtherPtrTy = SubIntTy->getPointerTo(OtherAS);<br>
> + OtherTy = SubIntTy;<br>
> } else {<br>
> - OtherPtrTy = NewAllocaTy->getPointerTo(OtherAS);<br>
> + OtherTy = NewAllocaTy;<br>
> }<br>
> + OtherPtrTy = OtherTy->getPointerTo(OtherAS);<br>
> <br>
> Value *SrcPtr = getAdjustedPtr(IRB, DL, OtherPtr, OtherOffset, OtherPtrTy,<br>
> OtherPtr->getName() + ".");<br>
> @@ -2965,28 +2969,30 @@ private:<br>
> <br>
> Value *Src;<br>
> if (VecTy && !IsWholeAlloca && !IsDest) {<br>
> - Src = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "load");<br>
> + Src = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "load");<br>
> Src = extractVector(IRB, Src, BeginIndex, EndIndex, "vec");<br>
> } else if (IntTy && !IsWholeAlloca && !IsDest) {<br>
> - Src = IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "load");<br>
> + Src = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "load");<br>
> Src = convertValue(DL, IRB, Src, IntTy);<br>
> uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;<br>
> Src = extractInteger(DL, IRB, Src, SubIntTy, Offset, "extract");<br>
> } else {<br>
> - LoadInst *Load = IRB.CreateAlignedLoad(SrcPtr, SrcAlign, II.isVolatile(),<br>
> - "copyload");<br>
> + LoadInst *Load = IRB.CreateAlignedLoad(OtherTy, SrcPtr, SrcAlign,<br>
> + II.isVolatile(), "copyload");<br>
> if (AATags)<br>
> Load->setAAMetadata(AATags);<br>
> Src = Load;<br>
> }<br>
> <br>
> if (VecTy && !IsWholeAlloca && IsDest) {<br>
> - Value *Old =<br>
> - IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "oldload");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "oldload");<br>
> Src = insertVector(IRB, Old, Src, BeginIndex, "vec");<br>
> } else if (IntTy && !IsWholeAlloca && IsDest) {<br>
> - Value *Old =<br>
> - IRB.CreateAlignedLoad(&NewAI, NewAI.getAlignment(), "oldload");<br>
> + Value *Old = IRB.CreateAlignedLoad(NewAI.getAllocatedType(), &NewAI,<br>
> + NewAI.getAlignment(), "oldload");<br>
> Old = convertValue(DL, IRB, Old, IntTy);<br>
> uint64_t Offset = NewBeginOffset - NewAllocaBeginOffset;<br>
> Src = insertInteger(DL, IRB, Old, Src, Offset, "insert");<br>
> @@ -3293,7 +3299,7 @@ private:<br>
> // Load the single value and insert it using the indices.<br>
> Value *GEP =<br>
> IRB.CreateInBoundsGEP(nullptr, Ptr, GEPIndices, Name + ".gep");<br>
> - LoadInst *Load = IRB.CreateAlignedLoad(GEP, Align, Name + ".load");<br>
> + LoadInst *Load = IRB.CreateAlignedLoad(Ty, GEP, Align, Name + ".load");<br>
> if (AATags)<br>
> Load->setAAMetadata(AATags);<br>
> Agg = IRB.CreateInsertValue(Agg, Load, Indices, Name + ".insert");<br>
> @@ -3787,6 +3793,7 @@ bool SROA::presplitLoadsAndStores(Alloca<br>
> auto AS = LI->getPointerAddressSpace();<br>
> auto *PartPtrTy = PartTy->getPointerTo(AS);<br>
> LoadInst *PLoad = IRB.CreateAlignedLoad(<br>
> + PartTy,<br>
> getAdjustedPtr(IRB, DL, BasePtr,<br>
> APInt(DL.getIndexSizeInBits(AS), PartOffset),<br>
> PartPtrTy, BasePtr->getName() + "."),<br>
> @@ -3928,6 +3935,7 @@ bool SROA::presplitLoadsAndStores(Alloca<br>
> IRB.SetInsertPoint(LI);<br>
> auto AS = LI->getPointerAddressSpace();<br>
> PLoad = IRB.CreateAlignedLoad(<br>
> + PartTy,<br>
> getAdjustedPtr(IRB, DL, LoadBasePtr,<br>
> APInt(DL.getIndexSizeInBits(AS), PartOffset),<br>
> LoadPartPtrTy, LoadBasePtr->getName() + "."),<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Scalar/Scalarizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -743,7 +743,8 @@ bool ScalarizerVisitor::visitLoadInst(Lo<br>
> Res.resize(NumElems);<br>
> <br>
> for (unsigned I = 0; I < NumElems; ++I)<br>
> - Res[I] = Builder.CreateAlignedLoad(Ptr[I], Layout.getElemAlign(I),<br>
> + Res[I] = Builder.CreateAlignedLoad(Layout.VecTy->getElementType(), Ptr[I],<br>
> + Layout.getElemAlign(I),<br>
> LI.getName() + ".i" + Twine(I));<br>
> gather(&LI, Res);<br>
> return true;<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -844,7 +844,8 @@ Function *CodeExtractor::constructFuncti<br>
> Instruction *TI = newFunction->begin()->getTerminator();<br>
> GetElementPtrInst *GEP = GetElementPtrInst::Create(<br>
> StructTy, &*AI, Idx, "gep_" + inputs[i]->getName(), TI);<br>
> - RewriteVal = new LoadInst(GEP, "loadgep_" + inputs[i]->getName(), TI);<br>
> + RewriteVal = new LoadInst(StructTy->getElementType(i), GEP,<br>
> + "loadgep_" + inputs[i]->getName(), TI);<br>
> } else<br>
> RewriteVal = &*AI++;<br>
> <br>
> @@ -1054,7 +1055,8 @@ CallInst *CodeExtractor::emitCallAndSwit<br>
> } else {<br>
> Output = ReloadOutputs[i];<br>
> }<br>
> - LoadInst *load = new LoadInst(Output, outputs[i]->getName()+".reload");<br>
> + LoadInst *load = new LoadInst(outputs[i]->getType(), Output,<br>
> + outputs[i]->getName() + ".reload");<br>
> Reloads.push_back(load);<br>
> codeReplacer->getInstList().push_back(load);<br>
> std::vector<User *> Users(outputs[i]->user_begin(), outputs[i]->user_end());<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/DemoteRegToStack.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -72,7 +72,8 @@ AllocaInst *llvm::DemoteRegToStack(Instr<br>
> Value *&V = Loads[PN->getIncomingBlock(i)];<br>
> if (!V) {<br>
> // Insert the load into the predecessor block<br>
> - V = new LoadInst(Slot, I.getName()+".reload", VolatileLoads,<br>
> + V = new LoadInst(I.getType(), Slot, I.getName() + ".reload",<br>
> + VolatileLoads,<br>
> PN->getIncomingBlock(i)->getTerminator());<br>
> }<br>
> PN->setIncomingValue(i, V);<br>
> @@ -80,7 +81,8 @@ AllocaInst *llvm::DemoteRegToStack(Instr<br>
> <br>
> } else {<br>
> // If this is a normal instruction, just insert a load.<br>
> - Value *V = new LoadInst(Slot, I.getName()+".reload", VolatileLoads, U);<br>
> + Value *V = new LoadInst(I.getType(), Slot, I.getName() + ".reload",<br>
> + VolatileLoads, U);<br>
> U->replaceUsesOfWith(&I, V);<br>
> }<br>
> }<br>
> @@ -141,7 +143,8 @@ AllocaInst *llvm::DemotePHIToStack(PHINo<br>
> for (; isa<PHINode>(InsertPt) || InsertPt->isEHPad(); ++InsertPt)<br>
> /* empty */; // Don't insert before PHI nodes or landingpad instrs.<br>
> <br>
> - Value *V = new LoadInst(Slot, P->getName() + ".reload", &*InsertPt);<br>
> + Value *V =<br>
> + new LoadInst(P->getType(), Slot, P->getName() + ".reload", &*InsertPt);<br>
> P->replaceAllUsesWith(V);<br>
> <br>
> // Delete PHI.<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/LowerMemIntrinsics.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -72,7 +72,7 @@ void llvm::createMemCpyLoopKnownSize(Ins<br>
> // Loop Body<br>
> Value *SrcGEP =<br>
> LoopBuilder.CreateInBoundsGEP(LoopOpType, SrcAddr, LoopIndex);<br>
> - Value *Load = LoopBuilder.CreateLoad(SrcGEP, SrcIsVolatile);<br>
> + Value *Load = LoopBuilder.CreateLoad(LoopOpType, SrcGEP, SrcIsVolatile);<br>
> Value *DstGEP =<br>
> LoopBuilder.CreateInBoundsGEP(LoopOpType, DstAddr, LoopIndex);<br>
> LoopBuilder.CreateStore(Load, DstGEP, DstIsVolatile);<br>
> @@ -114,7 +114,7 @@ void llvm::createMemCpyLoopKnownSize(Ins<br>
> : RBuilder.CreateBitCast(SrcAddr, SrcPtrType);<br>
> Value *SrcGEP = RBuilder.CreateInBoundsGEP(<br>
> OpTy, CastedSrc, ConstantInt::get(TypeOfCopyLen, GepIndex));<br>
> - Value *Load = RBuilder.CreateLoad(SrcGEP, SrcIsVolatile);<br>
> + Value *Load = RBuilder.CreateLoad(OpTy, SrcGEP, SrcIsVolatile);<br>
> <br>
> // Cast destination to operand type and store.<br>
> PointerType *DstPtrType = PointerType::get(OpTy, DstAS);<br>
> @@ -181,7 +181,7 @@ void llvm::createMemCpyLoopUnknownSize(I<br>
> LoopIndex->addIncoming(ConstantInt::get(CopyLenType, 0U), PreLoopBB);<br>
> <br>
> Value *SrcGEP = LoopBuilder.CreateInBoundsGEP(LoopOpType, SrcAddr, LoopIndex);<br>
> - Value *Load = LoopBuilder.CreateLoad(SrcGEP, SrcIsVolatile);<br>
> + Value *Load = LoopBuilder.CreateLoad(LoopOpType, SrcGEP, SrcIsVolatile);<br>
> Value *DstGEP = LoopBuilder.CreateInBoundsGEP(LoopOpType, DstAddr, LoopIndex);<br>
> LoopBuilder.CreateStore(Load, DstGEP, DstIsVolatile);<br>
> <br>
> @@ -234,7 +234,7 @@ void llvm::createMemCpyLoopUnknownSize(I<br>
> Value *FullOffset = ResBuilder.CreateAdd(RuntimeBytesCopied, ResidualIndex);<br>
> Value *SrcGEP =<br>
> ResBuilder.CreateInBoundsGEP(Int8Type, SrcAsInt8, FullOffset);<br>
> - Value *Load = ResBuilder.CreateLoad(SrcGEP, SrcIsVolatile);<br>
> + Value *Load = ResBuilder.CreateLoad(Int8Type, SrcGEP, SrcIsVolatile);<br>
> Value *DstGEP =<br>
> ResBuilder.CreateInBoundsGEP(Int8Type, DstAsInt8, FullOffset);<br>
> ResBuilder.CreateStore(Load, DstGEP, DstIsVolatile);<br>
> @@ -292,6 +292,8 @@ static void createMemMoveLoop(Instructio<br>
> BasicBlock *OrigBB = InsertBefore->getParent();<br>
> Function *F = OrigBB->getParent();<br>
> <br>
> + Type *EltTy = cast<PointerType>(SrcAddr->getType())->getElementType();<br>
> +<br>
> // Create the a comparison of src and dst, based on which we jump to either<br>
> // the forward-copy part of the function (if src >= dst) or the backwards-copy<br>
> // part (if src < dst).<br>
> @@ -330,7 +332,7 @@ static void createMemMoveLoop(Instructio<br>
> Value *IndexPtr = LoopBuilder.CreateSub(<br>
> LoopPhi, ConstantInt::get(TypeOfCopyLen, 1), "index_ptr");<br>
> Value *Element = LoopBuilder.CreateLoad(<br>
> - LoopBuilder.CreateInBoundsGEP(SrcAddr, IndexPtr), "element");<br>
> + EltTy, LoopBuilder.CreateInBoundsGEP(SrcAddr, IndexPtr), "element");<br>
> LoopBuilder.CreateStore(Element,<br>
> LoopBuilder.CreateInBoundsGEP(DstAddr, IndexPtr));<br>
> LoopBuilder.CreateCondBr(<br>
> @@ -347,7 +349,7 @@ static void createMemMoveLoop(Instructio<br>
> IRBuilder<> FwdLoopBuilder(FwdLoopBB);<br>
> PHINode *FwdCopyPhi = FwdLoopBuilder.CreatePHI(TypeOfCopyLen, 0, "index_ptr");<br>
> Value *FwdElement = FwdLoopBuilder.CreateLoad(<br>
> - FwdLoopBuilder.CreateInBoundsGEP(SrcAddr, FwdCopyPhi), "element");<br>
> + EltTy, FwdLoopBuilder.CreateInBoundsGEP(SrcAddr, FwdCopyPhi), "element");<br>
> FwdLoopBuilder.CreateStore(<br>
> FwdElement, FwdLoopBuilder.CreateInBoundsGEP(DstAddr, FwdCopyPhi));<br>
> Value *FwdIndexPtr = FwdLoopBuilder.CreateAdd(<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/SimplifyCFG.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -5090,7 +5090,9 @@ Value *SwitchLookupTable::BuildLookup(Va<br>
> Value *GEPIndices[] = {Builder.getInt32(0), Index};<br>
> Value *GEP = Builder.CreateInBoundsGEP(Array->getValueType(), Array,<br>
> GEPIndices, "switch.gep");<br>
> - return Builder.CreateLoad(GEP, "switch.load");<br>
> + return Builder.CreateLoad(<br>
> + cast<ArrayType>(Array->getValueType())->getElementType(), GEP,<br>
> + "switch.load");<br>
> }<br>
> }<br>
> llvm_unreachable("Unknown lookup table kind!");<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/SimplifyLibCalls.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -333,11 +333,12 @@ Value *LibCallSimplifier::optimizeStrCmp<br>
> return ConstantInt::get(CI->getType(), Str1.compare(Str2));<br>
> <br>
> if (HasStr1 && Str1.empty()) // strcmp("", x) -> -*x<br>
> - return B.CreateNeg(<br>
> - B.CreateZExt(B.CreateLoad(Str2P, "strcmpload"), CI->getType()));<br>
> + return B.CreateNeg(B.CreateZExt(<br>
> + B.CreateLoad(B.getInt8Ty(), Str2P, "strcmpload"), CI->getType()));<br>
> <br>
> if (HasStr2 && Str2.empty()) // strcmp(x,"") -> *x<br>
> - return B.CreateZExt(B.CreateLoad(Str1P, "strcmpload"), CI->getType());<br>
> + return B.CreateZExt(B.CreateLoad(B.getInt8Ty(), Str1P, "strcmpload"),<br>
> + CI->getType());<br>
> <br>
> // strcmp(P, "x") -> memcmp(P, "x", 2)<br>
> uint64_t Len1 = GetStringLength(Str1P);<br>
> @@ -397,11 +398,12 @@ Value *LibCallSimplifier::optimizeStrNCm<br>
> }<br>
> <br>
> if (HasStr1 && Str1.empty()) // strncmp("", x, n) -> -*x<br>
> - return B.CreateNeg(<br>
> - B.CreateZExt(B.CreateLoad(Str2P, "strcmpload"), CI->getType()));<br>
> + return B.CreateNeg(B.CreateZExt(<br>
> + B.CreateLoad(B.getInt8Ty(), Str2P, "strcmpload"), CI->getType()));<br>
> <br>
> if (HasStr2 && Str2.empty()) // strncmp(x, "", n) -> *x<br>
> - return B.CreateZExt(B.CreateLoad(Str1P, "strcmpload"), CI->getType());<br>
> + return B.CreateZExt(B.CreateLoad(B.getInt8Ty(), Str1P, "strcmpload"),<br>
> + CI->getType());<br>
> <br>
> uint64_t Len1 = GetStringLength(Str1P);<br>
> uint64_t Len2 = GetStringLength(Str2P);<br>
> @@ -590,7 +592,8 @@ Value *LibCallSimplifier::optimizeString<br>
> // strlen(x) != 0 --> *x != 0<br>
> // strlen(x) == 0 --> *x == 0<br>
> if (isOnlyUsedInZeroEqualityComparison(CI))<br>
> - return B.CreateZExt(B.CreateLoad(Src, "strlenfirst"), CI->getType());<br>
> + return B.CreateZExt(B.CreateLoad(B.getIntNTy(CharSize), Src, "strlenfirst"),<br>
> + CI->getType());<br>
> <br>
> return nullptr;<br>
> }<br>
> @@ -844,10 +847,12 @@ Value *LibCallSimplifier::optimizeMemCmp<br>
> <br>
> // memcmp(S1,S2,1) -> *(unsigned char*)LHS - *(unsigned char*)RHS<br>
> if (Len == 1) {<br>
> - Value *LHSV = B.CreateZExt(B.CreateLoad(castToCStr(LHS, B), "lhsc"),<br>
> - CI->getType(), "lhsv");<br>
> - Value *RHSV = B.CreateZExt(B.CreateLoad(castToCStr(RHS, B), "rhsc"),<br>
> - CI->getType(), "rhsv");<br>
> + Value *LHSV =<br>
> + B.CreateZExt(B.CreateLoad(B.getInt8Ty(), castToCStr(LHS, B), "lhsc"),<br>
> + CI->getType(), "lhsv");<br>
> + Value *RHSV =<br>
> + B.CreateZExt(B.CreateLoad(B.getInt8Ty(), castToCStr(RHS, B), "rhsc"),<br>
> + CI->getType(), "rhsv");<br>
> return B.CreateSub(LHSV, RHSV, "chardiff");<br>
> }<br>
> <br>
> @@ -877,12 +882,12 @@ Value *LibCallSimplifier::optimizeMemCmp<br>
> if (!LHSV) {<br>
> Type *LHSPtrTy =<br>
> IntType->getPointerTo(LHS->getType()->getPointerAddressSpace());<br>
> - LHSV = B.CreateLoad(B.CreateBitCast(LHS, LHSPtrTy), "lhsv");<br>
> + LHSV = B.CreateLoad(IntType, B.CreateBitCast(LHS, LHSPtrTy), "lhsv");<br>
> }<br>
> if (!RHSV) {<br>
> Type *RHSPtrTy =<br>
> IntType->getPointerTo(RHS->getType()->getPointerAddressSpace());<br>
> - RHSV = B.CreateLoad(B.CreateBitCast(RHS, RHSPtrTy), "rhsv");<br>
> + RHSV = B.CreateLoad(IntType, B.CreateBitCast(RHS, RHSPtrTy), "rhsv");<br>
> }<br>
> return B.CreateZExt(B.CreateICmpNE(LHSV, RHSV), CI->getType(), "memcmp");<br>
> }<br>
> @@ -2286,7 +2291,8 @@ Value *LibCallSimplifier::optimizeFWrite<br>
> // If this is writing one byte, turn it into fputc.<br>
> // This optimisation is only valid, if the return value is unused.<br>
> if (Bytes == 1 && CI->use_empty()) { // fwrite(S,1,1,F) -> fputc(S[0],F)<br>
> - Value *Char = B.CreateLoad(castToCStr(CI->getArgOperand(0), B), "char");<br>
> + Value *Char = B.CreateLoad(B.getInt8Ty(),<br>
> + castToCStr(CI->getArgOperand(0), B), "char");<br>
> Value *NewCI = emitFPutC(Char, CI->getArgOperand(3), B, TLI);<br>
> return NewCI ? ConstantInt::get(CI->getType(), 1) : nullptr;<br>
> }<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Utils/VNCoercion.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -386,12 +386,12 @@ Value *getLoadValueForLoad(LoadInst *Src<br>
> // memdep queries will find the new load. We can't easily remove the old<br>
> // load completely because it is already in the value numbering table.<br>
> IRBuilder<> Builder(SrcVal->getParent(), ++BasicBlock::iterator(SrcVal));<br>
> - Type *DestPTy = IntegerType::get(LoadTy->getContext(), NewLoadSize * 8);<br>
> - DestPTy =<br>
> - PointerType::get(DestPTy, PtrVal->getType()->getPointerAddressSpace());<br>
> + Type *DestTy = IntegerType::get(LoadTy->getContext(), NewLoadSize * 8);<br>
> + Type *DestPTy =<br>
> + PointerType::get(DestTy, PtrVal->getType()->getPointerAddressSpace());<br>
> Builder.SetCurrentDebugLocation(SrcVal->getDebugLoc());<br>
> PtrVal = Builder.CreateBitCast(PtrVal, DestPTy);<br>
> - LoadInst *NewLoad = Builder.CreateLoad(PtrVal);<br>
> + LoadInst *NewLoad = Builder.CreateLoad(DestTy, PtrVal);<br>
> NewLoad->takeName(SrcVal);<br>
> NewLoad->setAlignment(SrcVal->getAlignment());<br>
> <br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -1181,7 +1181,7 @@ bool Vectorizer::vectorizeLoadChain(<br>
> <br>
> Value *Bitcast =<br>
> Builder.CreateBitCast(L0->getPointerOperand(), VecTy->getPointerTo(AS));<br>
> - LoadInst *LI = Builder.CreateAlignedLoad(Bitcast, Alignment);<br>
> + LoadInst *LI = Builder.CreateAlignedLoad(VecTy, Bitcast, Alignment);<br>
> propagateMetadata(LI, Chain);<br>
> <br>
> if (VecLoadTy) {<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -2100,8 +2100,8 @@ void InnerLoopVectorizer::vectorizeInter<br>
> GroupMask, UndefVec, "wide.masked.vec");<br>
> }<br>
> else<br>
> - NewLoad = Builder.CreateAlignedLoad(NewPtrs[Part],<br>
> - Group->getAlignment(), "wide.vec");<br>
> + NewLoad = Builder.CreateAlignedLoad(VecTy, NewPtrs[Part],<br>
> + Group->getAlignment(), "wide.vec");<br>
> Group->addMetadata(NewLoad);<br>
> NewLoads.push_back(NewLoad);<br>
> }<br>
> @@ -2312,7 +2312,8 @@ void InnerLoopVectorizer::vectorizeMemor<br>
> UndefValue::get(DataTy),<br>
> "wide.masked.load");<br>
> else<br>
> - NewLI = Builder.CreateAlignedLoad(VecPtr, Alignment, "wide.load");<br>
> + NewLI =<br>
> + Builder.CreateAlignedLoad(DataTy, VecPtr, Alignment, "wide.load");<br>
> <br>
> // Add metadata to the load, but setVectorValue to the reverse shuffle.<br>
> addMetadata(NewLI, LI);<br>
> <br>
> Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -3136,7 +3136,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry<br>
> Builder.SetInsertPoint(LI);<br>
> PointerType *PtrTy = PointerType::get(VecTy, LI->getPointerAddressSpace());<br>
> Value *Ptr = Builder.CreateBitCast(LI->getOperand(0), PtrTy);<br>
> - LoadInst *V = Builder.CreateAlignedLoad(Ptr, LI->getAlignment());<br>
> + LoadInst *V = Builder.CreateAlignedLoad(VecTy, Ptr, LI->getAlignment());<br>
> Value *NewV = propagateMetadata(V, E->Scalars);<br>
> if (!E->ReorderIndices.empty()) {<br>
> OrdersType Mask;<br>
> @@ -3341,7 +3341,7 @@ Value *BoUpSLP::vectorizeTree(TreeEntry<br>
> ExternalUses.push_back(ExternalUser(PO, cast<User>(VecPtr), 0));<br>
> <br>
> unsigned Alignment = LI->getAlignment();<br>
> - LI = Builder.CreateLoad(VecPtr);<br>
> + LI = Builder.CreateLoad(VecTy, VecPtr);<br>
> if (!Alignment) {<br>
> Alignment = DL->getABITypeAlignment(ScalarLoadTy);<br>
> }<br>
> <br>
> Modified: llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll (original)<br>
> +++ llvm/trunk/test/CodeGen/AMDGPU/lower-kernargs.ll Fri Feb 1 12:44:24 2019<br>
> @@ -306,20 +306,18 @@ define amdgpu_kernel void @kern_v3i32(<3<br>
> ; HSA-LABEL: @kern_v3i32(<br>
> ; HSA-NEXT: [[KERN_V3I32_KERNARG_SEGMENT:%.*]] = call nonnull align 16 dereferenceable(16) i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()<br>
> ; HSA-NEXT: [[ARG0_KERNARG_OFFSET:%.*]] = getelementptr inbounds i8, i8 addrspace(4)* [[KERN_V3I32_KERNARG_SEGMENT]], i64 0<br>
> -; HSA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to <3 x i32> addrspace(4)*<br>
> -; HSA-NEXT: [[TMP1:%.*]] = bitcast <3 x i32> addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]] to <4 x i32> addrspace(4)*<br>
> -; HSA-NEXT: [[TMP2:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[TMP1]], align 16, !invariant.load !0<br>
> -; HSA-NEXT: [[ARG0_LOAD:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> +; HSA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to <4 x i32> addrspace(4)*<br>
> +; HSA-NEXT: [[TMP:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]], align 16, !invariant.load !0<br>
> +; HSA-NEXT: [[ARG0_LOAD:%.*]] = shufflevector <4 x i32> [[TMP]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> ; HSA-NEXT: store <3 x i32> [[ARG0_LOAD]], <3 x i32> addrspace(1)* undef, align 4<br>
> ; HSA-NEXT: ret void<br>
> ;<br>
> ; MESA-LABEL: @kern_v3i32(<br>
> ; MESA-NEXT: [[KERN_V3I32_KERNARG_SEGMENT:%.*]] = call nonnull align 16 dereferenceable(52) i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()<br>
> ; MESA-NEXT: [[ARG0_KERNARG_OFFSET:%.*]] = getelementptr inbounds i8, i8 addrspace(4)* [[KERN_V3I32_KERNARG_SEGMENT]], i64 36<br>
> -; MESA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to <3 x i32> addrspace(4)*<br>
> -; MESA-NEXT: [[TMP1:%.*]] = bitcast <3 x i32> addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]] to <4 x i32> addrspace(4)*<br>
> -; MESA-NEXT: [[TMP2:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[TMP1]], align 4, !invariant.load !0<br>
> -; MESA-NEXT: [[ARG0_LOAD:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> +; MESA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to <4 x i32> addrspace(4)*<br>
> +; MESA-NEXT: [[TMP:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]], align 4, !invariant.load !0<br>
> +; MESA-NEXT: [[ARG0_LOAD:%.*]] = shufflevector <4 x i32> [[TMP]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> ; MESA-NEXT: store <3 x i32> [[ARG0_LOAD]], <3 x i32> addrspace(1)* undef, align 4<br>
> ; MESA-NEXT: ret void<br>
> ;<br>
> @@ -397,10 +395,9 @@ define amdgpu_kernel void @kern_i32_v3i3<br>
> ; HSA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to i32 addrspace(4)*<br>
> ; HSA-NEXT: [[ARG0_LOAD:%.*]] = load i32, i32 addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]], align 16, !invariant.load !0<br>
> ; HSA-NEXT: [[ARG1_KERNARG_OFFSET:%.*]] = getelementptr inbounds i8, i8 addrspace(4)* [[KERN_I32_V3I32_KERNARG_SEGMENT]], i64 16<br>
> -; HSA-NEXT: [[ARG1_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG1_KERNARG_OFFSET]] to <3 x i32> addrspace(4)*<br>
> -; HSA-NEXT: [[TMP1:%.*]] = bitcast <3 x i32> addrspace(4)* [[ARG1_KERNARG_OFFSET_CAST]] to <4 x i32> addrspace(4)*<br>
> -; HSA-NEXT: [[TMP2:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[TMP1]], align 16, !invariant.load !0<br>
> -; HSA-NEXT: [[ARG1_LOAD:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> +; HSA-NEXT: [[ARG1_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG1_KERNARG_OFFSET]] to <4 x i32> addrspace(4)*<br>
> +; HSA-NEXT: [[TMP:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[ARG1_KERNARG_OFFSET_CAST]], align 16, !invariant.load !0<br>
> +; HSA-NEXT: [[ARG1_LOAD:%.*]] = shufflevector <4 x i32> [[TMP]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> ; HSA-NEXT: store i32 [[ARG0_LOAD]], i32 addrspace(1)* undef<br>
> ; HSA-NEXT: store <3 x i32> [[ARG1_LOAD]], <3 x i32> addrspace(1)* undef, align 4<br>
> ; HSA-NEXT: ret void<br>
> @@ -411,10 +408,9 @@ define amdgpu_kernel void @kern_i32_v3i3<br>
> ; MESA-NEXT: [[ARG0_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG0_KERNARG_OFFSET]] to i32 addrspace(4)*<br>
> ; MESA-NEXT: [[ARG0_LOAD:%.*]] = load i32, i32 addrspace(4)* [[ARG0_KERNARG_OFFSET_CAST]], align 4, !invariant.load !0<br>
> ; MESA-NEXT: [[ARG1_KERNARG_OFFSET:%.*]] = getelementptr inbounds i8, i8 addrspace(4)* [[KERN_I32_V3I32_KERNARG_SEGMENT]], i64 52<br>
> -; MESA-NEXT: [[ARG1_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG1_KERNARG_OFFSET]] to <3 x i32> addrspace(4)*<br>
> -; MESA-NEXT: [[TMP1:%.*]] = bitcast <3 x i32> addrspace(4)* [[ARG1_KERNARG_OFFSET_CAST]] to <4 x i32> addrspace(4)*<br>
> -; MESA-NEXT: [[TMP2:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[TMP1]], align 4, !invariant.load !0<br>
> -; MESA-NEXT: [[ARG1_LOAD:%.*]] = shufflevector <4 x i32> [[TMP2]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> +; MESA-NEXT: [[ARG1_KERNARG_OFFSET_CAST:%.*]] = bitcast i8 addrspace(4)* [[ARG1_KERNARG_OFFSET]] to <4 x i32> addrspace(4)*<br>
> +; MESA-NEXT: [[TMP:%.*]] = load <4 x i32>, <4 x i32> addrspace(4)* [[ARG1_KERNARG_OFFSET_CAST]], align 4, !invariant.load !0<br>
> +; MESA-NEXT: [[ARG1_LOAD:%.*]] = shufflevector <4 x i32> [[TMP]], <4 x i32> undef, <3 x i32> <i32 0, i32 1, i32 2><br>
> ; MESA-NEXT: store i32 [[ARG0_LOAD]], i32 addrspace(1)* undef<br>
> ; MESA-NEXT: store <3 x i32> [[ARG1_LOAD]], <3 x i32> addrspace(1)* undef, align 4<br>
> ; MESA-NEXT: ret void<br>
> <br>
> Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)<br>
> +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -879,7 +879,8 @@ CleanupAndPrepareModules(BugDriver &BD,<br>
> BasicBlock::Create(F->getContext(), "lookupfp", FuncWrapper);<br>
> <br>
> // Check to see if we already looked up the value.<br>
> - Value *CachedVal = new LoadInst(Cache, "fpcache", EntryBB);<br>
> + Value *CachedVal =<br>
> + new LoadInst(F->getType(), Cache, "fpcache", EntryBB);<br>
> Value *IsNull = new ICmpInst(*EntryBB, ICmpInst::ICMP_EQ, CachedVal,<br>
> NullPtr, "isNull");<br>
> BranchInst::Create(LookupBB, DoCallBB, IsNull, EntryBB);<br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/AliasAnalysisTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -174,7 +174,7 @@ TEST_F(AliasAnalysisTest, getModRefInfo)<br>
> auto *Addr = ConstantPointerNull::get(PtrType);<br>
> <br>
> auto *Store1 = new StoreInst(Value, Addr, BB);<br>
> - auto *Load1 = new LoadInst(Addr, "load", BB);<br>
> + auto *Load1 = new LoadInst(IntType, Addr, "load", BB);<br>
> auto *Add1 = BinaryOperator::CreateAdd(Value, Value, "add", BB);<br>
> auto *VAArg1 = new VAArgInst(Addr, PtrType, "vaarg", BB);<br>
> auto *CmpXChg1 = new AtomicCmpXchgInst(<br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/MemorySSATest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/MemorySSATest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/MemorySSATest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/MemorySSATest.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/MemorySSATest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -92,7 +92,7 @@ TEST_F(MemorySSATest, CreateALoad) {<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> // Add the load<br>
> B.SetInsertPoint(Merge);<br>
> - LoadInst *LoadInst = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> // MemoryPHI should already exist.<br>
> MemoryPhi *MP = MSSA.getMemoryAccess(Merge);<br>
> @@ -138,7 +138,7 @@ TEST_F(MemorySSATest, CreateLoadsAndStor<br>
> <br>
> // Add the load<br>
> B.SetInsertPoint(Merge, Merge->begin());<br>
> - LoadInst *FirstLoad = B.CreateLoad(PointerArg);<br>
> + LoadInst *FirstLoad = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> // MemoryPHI should not already exist.<br>
> MemoryPhi *MP = MSSA.getMemoryAccess(Merge);<br>
> @@ -162,7 +162,7 @@ TEST_F(MemorySSATest, CreateLoadsAndStor<br>
> // We don't touch existing loads, so we need to create a new one to get a phi<br>
> // Add the second load<br>
> B.SetInsertPoint(Merge, Merge->begin());<br>
> - LoadInst *SecondLoad = B.CreateLoad(PointerArg);<br>
> + LoadInst *SecondLoad = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> // MemoryPHI should not already exist.<br>
> MP = MSSA.getMemoryAccess(Merge);<br>
> @@ -228,7 +228,7 @@ TEST_F(MemorySSATest, CreateALoadUpdater<br>
> <br>
> // Add the load<br>
> B.SetInsertPoint(Merge, Merge->begin());<br>
> - LoadInst *LoadInst = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> // MemoryPHI should not already exist.<br>
> MemoryPhi *MP = MSSA.getMemoryAccess(Merge);<br>
> @@ -262,7 +262,7 @@ TEST_F(MemorySSATest, SinkLoad) {<br>
> <br>
> // Load in left block<br>
> B.SetInsertPoint(Left, Left->begin());<br>
> - LoadInst *LoadInst1 = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst1 = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> // Store in merge block<br>
> B.SetInsertPoint(Merge, Merge->begin());<br>
> B.CreateStore(B.getInt8(16), PointerArg);<br>
> @@ -310,7 +310,7 @@ TEST_F(MemorySSATest, MoveAStore) {<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - B.CreateLoad(PointerArg);<br>
> + B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> @@ -346,7 +346,7 @@ TEST_F(MemorySSATest, MoveAStoreUpdater)<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - auto *MergeLoad = B.CreateLoad(PointerArg);<br>
> + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> @@ -392,7 +392,7 @@ TEST_F(MemorySSATest, MoveAStoreUpdaterM<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - auto *MergeLoad = B.CreateLoad(PointerArg);<br>
> + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> @@ -436,7 +436,7 @@ TEST_F(MemorySSATest, MoveAStoreAllAroun<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - auto *MergeLoad = B.CreateLoad(PointerArg);<br>
> + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> @@ -490,7 +490,7 @@ TEST_F(MemorySSATest, RemoveAPhi) {<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - LoadInst *LoadInst = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -535,7 +535,7 @@ TEST_F(MemorySSATest, RemoveMemoryAccess<br>
> BranchInst::Create(Merge, Left);<br>
> BranchInst::Create(Merge, Right);<br>
> B.SetInsertPoint(Merge);<br>
> - LoadInst *LoadInst = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -631,7 +631,7 @@ TEST_F(MemorySSATest, TestStoreAndLoad)<br>
> Type *Int8 = Type::getInt8Ty(C);<br>
> Value *Alloca = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "A");<br>
> Instruction *SI = B.CreateStore(ConstantInt::get(Int8, 0), Alloca);<br>
> - Instruction *LI = B.CreateLoad(Alloca);<br>
> + Instruction *LI = B.CreateLoad(Int8, Alloca);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -715,12 +715,12 @@ TEST_F(MemorySSATest, PartialWalkerCache<br>
> B.SetInsertPoint(IfThen);<br>
> Instruction *FirstStore = B.CreateStore(Zero, AllocA);<br>
> B.CreateStore(Zero, AllocB);<br>
> - Instruction *ALoad0 = B.CreateLoad(AllocA, "");<br>
> + Instruction *ALoad0 = B.CreateLoad(Int8, AllocA, "");<br>
> Instruction *BStore = B.CreateStore(Zero, AllocB);<br>
> // Due to use optimization/etc. we make a store to A, which is removed after<br>
> // we build MSSA. This helps keep the test case simple-ish.<br>
> Instruction *KillStore = B.CreateStore(Zero, AllocA);<br>
> - Instruction *ALoad = B.CreateLoad(AllocA, "");<br>
> + Instruction *ALoad = B.CreateLoad(Int8, AllocA, "");<br>
> B.CreateBr(IfEnd);<br>
> <br>
> B.SetInsertPoint(IfEnd);<br>
> @@ -771,7 +771,7 @@ TEST_F(MemorySSATest, WalkerInvariantLoa<br>
> Value *AllocA = B.CreateAlloca(Int8, One, "");<br>
> <br>
> Instruction *Store = B.CreateStore(One, AllocA);<br>
> - Instruction *Load = B.CreateLoad(AllocA);<br>
> + Instruction *Load = B.CreateLoad(Int8, AllocA);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -800,7 +800,7 @@ TEST_F(MemorySSATest, WalkerReopt) {<br>
> Instruction *SIA = B.CreateStore(ConstantInt::get(Int8, 0), AllocaA);<br>
> Value *AllocaB = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "B");<br>
> Instruction *SIB = B.CreateStore(ConstantInt::get(Int8, 0), AllocaB);<br>
> - Instruction *LIA = B.CreateLoad(AllocaA);<br>
> + Instruction *LIA = B.CreateLoad(Int8, AllocaA);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -834,11 +834,11 @@ TEST_F(MemorySSATest, MoveAboveMemoryDef<br>
> <br>
> StoreInst *StoreA0 = B.CreateStore(ConstantInt::get(Int8, 0), A);<br>
> StoreInst *StoreB = B.CreateStore(ConstantInt::get(Int8, 0), B_);<br>
> - LoadInst *LoadB = B.CreateLoad(B_);<br>
> + LoadInst *LoadB = B.CreateLoad(Int8, B_);<br>
> StoreInst *StoreA1 = B.CreateStore(ConstantInt::get(Int8, 4), A);<br>
> StoreInst *StoreC = B.CreateStore(ConstantInt::get(Int8, 4), C);<br>
> StoreInst *StoreA2 = B.CreateStore(ConstantInt::get(Int8, 4), A);<br>
> - LoadInst *LoadC = B.CreateLoad(C);<br>
> + LoadInst *LoadC = B.CreateLoad(Int8, C);<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -902,7 +902,7 @@ TEST_F(MemorySSATest, Irreducible) {<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> MemorySSAUpdater Updater(&MSSA);<br>
> // Create the load memory acccess<br>
> - LoadInst *LoadInst = B.CreateLoad(FirstArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), FirstArg);<br>
> MemoryUse *LoadAccess = cast<MemoryUse>(Updater.createMemoryAccessInBB(<br>
> LoadInst, nullptr, AfterLoopBB, MemorySSA::Beginning));<br>
> Updater.insertUse(LoadAccess);<br>
> @@ -1010,15 +1010,15 @@ TEST_F(MemorySSATest, TestLoadMustAlias)<br>
> <br>
> B.CreateStore(ConstantInt::get(Int8, 1), AllocaB);<br>
> // Check load from LOE<br>
> - LoadInst *LA1 = B.CreateLoad(AllocaA, "");<br>
> + LoadInst *LA1 = B.CreateLoad(Int8, AllocaA, "");<br>
> // Check load alias cached for second load<br>
> - LoadInst *LA2 = B.CreateLoad(AllocaA, "");<br>
> + LoadInst *LA2 = B.CreateLoad(Int8, AllocaA, "");<br>
> <br>
> B.CreateStore(ConstantInt::get(Int8, 1), AllocaA);<br>
> // Check load from store/def<br>
> - LoadInst *LA3 = B.CreateLoad(AllocaA, "");<br>
> + LoadInst *LA3 = B.CreateLoad(Int8, AllocaA, "");<br>
> // Check load alias cached for second load<br>
> - LoadInst *LA4 = B.CreateLoad(AllocaA, "");<br>
> + LoadInst *LA4 = B.CreateLoad(Int8, AllocaA, "");<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> @@ -1103,13 +1103,13 @@ TEST_F(MemorySSATest, TestLoadMayAlias)<br>
> Argument *PointerA = &*ArgIt;<br>
> Argument *PointerB = &*(++ArgIt);<br>
> B.CreateStore(ConstantInt::get(Int8, 1), PointerB);<br>
> - LoadInst *LA1 = B.CreateLoad(PointerA, "");<br>
> + LoadInst *LA1 = B.CreateLoad(Int8, PointerA, "");<br>
> B.CreateStore(ConstantInt::get(Int8, 0), PointerA);<br>
> - LoadInst *LB1 = B.CreateLoad(PointerB, "");<br>
> + LoadInst *LB1 = B.CreateLoad(Int8, PointerB, "");<br>
> B.CreateStore(ConstantInt::get(Int8, 0), PointerA);<br>
> - LoadInst *LA2 = B.CreateLoad(PointerA, "");<br>
> + LoadInst *LA2 = B.CreateLoad(Int8, PointerA, "");<br>
> B.CreateStore(ConstantInt::get(Int8, 0), PointerB);<br>
> - LoadInst *LB2 = B.CreateLoad(PointerB, "");<br>
> + LoadInst *LB2 = B.CreateLoad(Int8, PointerB, "");<br>
> <br>
> setupAnalyses();<br>
> MemorySSA &MSSA = *Analyses->MSSA;<br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/OrderedInstructionsTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -44,13 +44,13 @@ TEST(OrderedInstructionsTest, DominanceT<br>
> BasicBlock *BBX = BasicBlock::Create(Ctx, "bbx", F);<br>
> B.SetInsertPoint(BBX);<br>
> Argument *PointerArg = &*F->arg_begin();<br>
> - LoadInst *LoadInstX = B.CreateLoad(PointerArg);<br>
> - LoadInst *LoadInstY = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInstX = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> + LoadInst *LoadInstY = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> <br>
> // Create BBY with 1 load.<br>
> BasicBlock *BBY = BasicBlock::Create(Ctx, "bby", F);<br>
> B.SetInsertPoint(BBY);<br>
> - LoadInst *LoadInstZ = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInstZ = B.CreateLoad(B.getInt8Ty(), PointerArg);<br>
> B.CreateRet(LoadInstZ);<br>
> std::unique_ptr<DominatorTree> DT(new DominatorTree(*F));<br>
> OrderedInstructions OI(&*DT);<br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/PhiValuesTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/PhiValuesTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/PhiValuesTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/PhiValuesTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/PhiValuesTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -37,10 +37,10 @@ TEST(PhiValuesTest, SimplePhi) {<br>
> BranchInst::Create(Then, If);<br>
> BranchInst::Create(Then, Else);<br>
> <br>
> - Value *Val1 = new LoadInst(UndefValue::get(I32PtrTy), "val1", Entry);<br>
> - Value *Val2 = new LoadInst(UndefValue::get(I32PtrTy), "val2", Entry);<br>
> - Value *Val3 = new LoadInst(UndefValue::get(I32PtrTy), "val3", Entry);<br>
> - Value *Val4 = new LoadInst(UndefValue::get(I32PtrTy), "val4", Entry);<br>
> + Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry);<br>
> + Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry);<br>
> + Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry);<br>
> + Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry);<br>
> <br>
> PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then);<br>
> Phi1->addIncoming(Val1, If);<br>
> @@ -110,10 +110,10 @@ TEST(PhiValuesTest, DependentPhi) {<br>
> BranchInst::Create(End, If2);<br>
> BranchInst::Create(End, Else2);<br>
> <br>
> - Value *Val1 = new LoadInst(UndefValue::get(I32PtrTy), "val1", Entry);<br>
> - Value *Val2 = new LoadInst(UndefValue::get(I32PtrTy), "val2", Entry);<br>
> - Value *Val3 = new LoadInst(UndefValue::get(I32PtrTy), "val3", Entry);<br>
> - Value *Val4 = new LoadInst(UndefValue::get(I32PtrTy), "val4", Entry);<br>
> + Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry);<br>
> + Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry);<br>
> + Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry);<br>
> + Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry);<br>
> <br>
> PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then);<br>
> Phi1->addIncoming(Val1, If1);<br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -407,9 +407,11 @@ TEST_F(ScalarEvolutionsTest, CompareValu<br>
> <br>
> const int ValueDepth = 10;<br>
> for (int i = 0; i < ValueDepth; i++) {<br>
> - X = new LoadInst(new IntToPtrInst(X, IntPtrPtrTy, "", EntryBB), "",<br>
> + X = new LoadInst(IntPtrTy, new IntToPtrInst(X, IntPtrPtrTy, "", EntryBB),<br>
> + "",<br>
> /*isVolatile*/ false, EntryBB);<br>
> - Y = new LoadInst(new IntToPtrInst(Y, IntPtrPtrTy, "", EntryBB), "",<br>
> + Y = new LoadInst(IntPtrTy, new IntToPtrInst(Y, IntPtrPtrTy, "", EntryBB),<br>
> + "",<br>
> /*isVolatile*/ false, EntryBB);<br>
> }<br>
> <br>
> <br>
> Modified: llvm/trunk/unittests/Analysis/SparsePropagation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/SparsePropagation.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/SparsePropagation.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Analysis/SparsePropagation.cpp (original)<br>
> +++ llvm/trunk/unittests/Analysis/SparsePropagation.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -381,7 +381,7 @@ TEST_F(SparsePropagationTest, FunctionDe<br>
> BasicBlock *Else = BasicBlock::Create(Context, "else", F);<br>
> F->arg_begin()->setName("cond");<br>
> Builder.SetInsertPoint(If);<br>
> - LoadInst *Cond = Builder.CreateLoad(F->arg_begin());<br>
> + LoadInst *Cond = Builder.CreateLoad(Type::getInt1Ty(Context), F->arg_begin());<br>
> Builder.CreateCondBr(Cond, Then, Else);<br>
> Builder.SetInsertPoint(Then);<br>
> Builder.CreateRet(Builder.getInt64(1));<br>
> @@ -421,7 +421,7 @@ TEST_F(SparsePropagationTest, FunctionOv<br>
> BasicBlock *Else = BasicBlock::Create(Context, "else", F);<br>
> F->arg_begin()->setName("cond");<br>
> Builder.SetInsertPoint(If);<br>
> - LoadInst *Cond = Builder.CreateLoad(F->arg_begin());<br>
> + LoadInst *Cond = Builder.CreateLoad(Type::getInt1Ty(Context), F->arg_begin());<br>
> Builder.CreateCondBr(Cond, Then, Else);<br>
> Builder.SetInsertPoint(Then);<br>
> Builder.CreateRet(Builder.getInt64(0));<br>
> <br>
> Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp (original)<br>
> +++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -211,10 +211,10 @@ TEST_F(MCJITMultipleModuleTest, two_modu<br>
> GVB = insertGlobalInt32(B.get(), "GVB", initialNum);<br>
> FA = startFunction(A.get(),<br>
> FunctionType::get(Builder.getInt32Ty(), {}, false), "FA");<br>
> - endFunctionWithRet(FA, Builder.CreateLoad(GVA));<br>
> + endFunctionWithRet(FA, Builder.CreateLoad(Builder.getInt32Ty(), GVA));<br>
> FB = startFunction(B.get(),<br>
> FunctionType::get(Builder.getInt32Ty(), {}, false), "FB");<br>
> - endFunctionWithRet(FB, Builder.CreateLoad(GVB));<br>
> + endFunctionWithRet(FB, Builder.CreateLoad(Builder.getInt32Ty(), GVB));<br>
> <br>
> GVC = insertGlobalInt32(B.get(), "GVC", initialNum);<br>
> GVC->setLinkage(GlobalValue::InternalLinkage);<br>
> <br>
> Modified: llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp (original)<br>
> +++ llvm/trunk/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -101,7 +101,7 @@ TEST_F(MCJITTest, return_global) {<br>
> Function *ReturnGlobal =<br>
> startFunction(M.get(), FunctionType::get(Builder.getInt32Ty(), {}, false),<br>
> "ReturnGlobal");<br>
> - Value *ReadGlobal = Builder.CreateLoad(GV);<br>
> + Value *ReadGlobal = Builder.CreateLoad(Builder.getInt32Ty(), GV);<br>
> endFunctionWithRet(ReturnGlobal, ReadGlobal);<br>
> <br>
> createJIT(std::move(M));<br>
> <br>
> Modified: llvm/trunk/unittests/IR/IRBuilderTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/IRBuilderTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/IR/IRBuilderTest.cpp (original)<br>
> +++ llvm/trunk/unittests/IR/IRBuilderTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -54,7 +54,7 @@ TEST_F(IRBuilderTest, Intrinsics) {<br>
> CallInst *Call;<br>
> IntrinsicInst *II;<br>
> <br>
> - V = Builder.CreateLoad(GV);<br>
> + V = Builder.CreateLoad(GV->getValueType(), GV);<br>
> I = cast<Instruction>(Builder.CreateFAdd(V, V));<br>
> I->setHasNoInfs(true);<br>
> I->setHasNoNaNs(false);<br>
> @@ -207,7 +207,7 @@ TEST_F(IRBuilderTest, FastMathFlags) {<br>
> Value *F, *FC;<br>
> Instruction *FDiv, *FAdd, *FCmp, *FCall;<br>
> <br>
> - F = Builder.CreateLoad(GV);<br>
> + F = Builder.CreateLoad(GV->getValueType(), GV);<br>
> F = Builder.CreateFAdd(F, F);<br>
> <br>
> EXPECT_FALSE(Builder.getFastMathFlags().any());<br>
> @@ -394,7 +394,7 @@ TEST_F(IRBuilderTest, WrapFlags) {<br>
> // Test instructions.<br>
> GlobalVariable *G = new GlobalVariable(*M, Builder.getInt32Ty(), true,<br>
> GlobalValue::ExternalLinkage, nullptr);<br>
> - Value *V = Builder.CreateLoad(G);<br>
> + Value *V = Builder.CreateLoad(G->getValueType(), G);<br>
> EXPECT_TRUE(<br>
> cast<BinaryOperator>(Builder.CreateNSWAdd(V, V))->hasNoSignedWrap());<br>
> EXPECT_TRUE(<br>
> @@ -461,7 +461,7 @@ TEST_F(IRBuilderTest, RAIIHelpersTest) {<br>
> EXPECT_FALSE(Builder.getFastMathFlags().allowReciprocal());<br>
> EXPECT_EQ(FPMathA, Builder.getDefaultFPMathTag());<br>
> <br>
> - Value *F = Builder.CreateLoad(GV);<br>
> + Value *F = Builder.CreateLoad(GV->getValueType(), GV);<br>
> <br>
> {<br>
> IRBuilder<>::InsertPointGuard Guard(Builder);<br>
> <br>
> Modified: llvm/trunk/unittests/IR/PatternMatch.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PatternMatch.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/PatternMatch.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/IR/PatternMatch.cpp (original)<br>
> +++ llvm/trunk/unittests/IR/PatternMatch.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -397,7 +397,7 @@ TEST_F(PatternMatchTest, LoadStoreOps) {<br>
> // store i32 42, i32* %0<br>
> <br>
> Value *Alloca = IRB.CreateAlloca(IRB.getInt32Ty());<br>
> - Value *LoadInst = IRB.CreateLoad(Alloca);<br>
> + Value *LoadInst = IRB.CreateLoad(IRB.getInt32Ty(), Alloca);<br>
> Value *FourtyTwo = IRB.getInt32(42);<br>
> Value *StoreInst = IRB.CreateStore(FourtyTwo, Alloca);<br>
> Value *MatchLoad, *MatchStoreVal, *MatchStorePointer;<br>
> <br>
> Modified: llvm/trunk/unittests/Linker/LinkModulesTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Linker/LinkModulesTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Linker/LinkModulesTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Linker/LinkModulesTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Linker/LinkModulesTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -83,7 +83,7 @@ TEST_F(LinkModuleTest, BlockAddress) {<br>
> GEPIndices.push_back(&*F->arg_begin());<br>
> <br>
> Value *GEP = Builder.CreateGEP(AT, GV, GEPIndices, "switch.gep");<br>
> - Value *Load = Builder.CreateLoad(GEP, "switch.load");<br>
> + Value *Load = Builder.CreateLoad(AT->getElementType(), GEP, "switch.load");<br>
> <br>
> Builder.CreateRet(Load);<br>
> <br>
> <br>
> Modified: llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Transforms/Scalar/LoopPassManagerTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -908,7 +908,8 @@ TEST_F(LoopPassManagerTest, LoopChildIns<br>
> ASSERT_THAT(BBI, F.end());<br>
> auto CreateCondBr = [&](BasicBlock *TrueBB, BasicBlock *FalseBB,<br>
> const char *Name, BasicBlock *BB) {<br>
> - auto *Cond = new LoadInst(&Ptr, Name, /*isVolatile*/ true, BB);<br>
> + auto *Cond = new LoadInst(Type::getInt1Ty(Context), &Ptr, Name,<br>
> + /*isVolatile*/ true, BB);<br>
> BranchInst::Create(TrueBB, FalseBB, Cond, BB);<br>
> };<br>
> <br>
> @@ -1110,7 +1111,8 @@ TEST_F(LoopPassManagerTest, LoopPeerInse<br>
> ASSERT_THAT(BBI, F.end());<br>
> auto CreateCondBr = [&](BasicBlock *TrueBB, BasicBlock *FalseBB,<br>
> const char *Name, BasicBlock *BB) {<br>
> - auto *Cond = new LoadInst(&Ptr, Name, /*isVolatile*/ true, BB);<br>
> + auto *Cond = new LoadInst(Type::getInt1Ty(Context), &Ptr, Name,<br>
> + /*isVolatile*/ true, BB);<br>
> BranchInst::Create(TrueBB, FalseBB, Cond, BB);<br>
> };<br>
> <br>
> @@ -1503,8 +1505,9 @@ TEST_F(LoopPassManagerTest, LoopDeletion<br>
> auto *NewLoop03BB =<br>
> BasicBlock::Create(Context, "loop.0.3", &F, &Loop0LatchBB);<br>
> BranchInst::Create(NewLoop03BB, NewLoop03PHBB);<br>
> - auto *Cond = new LoadInst(&Ptr, "cond.0.3", /*isVolatile*/ true,<br>
> - NewLoop03BB);<br>
> + auto *Cond =<br>
> + new LoadInst(Type::getInt1Ty(Context), &Ptr, "cond.0.3",<br>
> + /*isVolatile*/ true, NewLoop03BB);<br>
> BranchInst::Create(&Loop0LatchBB, NewLoop03BB, Cond, NewLoop03BB);<br>
> Loop02PHBB.getTerminator()->replaceUsesOfWith(&Loop0LatchBB,<br>
> NewLoop03PHBB);<br>
> <br>
> Modified: llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp?rev=352911&r1=352910&r2=352911&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp?rev=352911&r1=352910&r2=352911&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp (original)<br>
> +++ llvm/trunk/unittests/Transforms/Utils/FunctionComparatorTest.cpp Fri Feb 1 12:44:24 2019<br>
> @@ -31,7 +31,7 @@ struct TestFunction {<br>
> BB = BasicBlock::Create(Ctx, "", F);<br>
> B.SetInsertPoint(BB);<br>
> Argument *PointerArg = &*F->arg_begin();<br>
> - LoadInst *LoadInst = B.CreateLoad(PointerArg);<br>
> + LoadInst *LoadInst = B.CreateLoad(T, PointerArg);<br>
> C = B.getInt8(addVal);<br>
> I = cast<Instruction>(B.CreateAdd(LoadInst, C));<br>
> B.CreateRet(I);<br>
> <br>
> <br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
> <br>
</blockquote></div>