From sabre at nondot.org Mon May 23 00:15:43 2011 From: sabre at nondot.org (Chris Lattner) Date: Mon, 23 May 2011 05:15:43 -0000 Subject: [llvm-commits] [llvm] r131897 - in /llvm/trunk: lib/Analysis/BasicAliasAnalysis.cpp test/Transforms/DeadStoreElimination/simple.ll Message-ID: <20110523051543.403BE2A6C12C@llvm.org> Author: lattner Date: Mon May 23 00:15:43 2011 New Revision: 131897 URL: http://llvm.org/viewvc/llvm-project?rev=131897&view=rev Log: fix a really nasty basicaa mod/ref calculation bug that was causing miscompilation of UnitTests/ObjC/messages-2.m with the recent optimizer improvements. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=131897&r1=131896&r2=131897&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon May 23 00:15:43 2011 @@ -680,9 +680,12 @@ unsigned ArgNo = 0; for (ImmutableCallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); CI != CE; ++CI, ++ArgNo) { - // Only look at the no-capture pointer arguments. + // Only look at the no-capture or byval pointer arguments. If this + // pointer were passed to arguments that were neither of these, then it + // couldn't be no-capture. if (!(*CI)->getType()->isPointerTy() || - !CS.paramHasAttr(ArgNo+1, Attribute::NoCapture)) + (!CS.paramHasAttr(ArgNo+1, Attribute::NoCapture) && + !CS.paramHasAttr(ArgNo+1, Attribute::ByVal))) continue; // If this is a no-capture pointer argument, see if we can tell that it Modified: llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll?rev=131897&r1=131896&r2=131897&view=diff ============================================================================== --- llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll (original) +++ llvm/trunk/test/Transforms/DeadStoreElimination/simple.ll Mon May 23 00:15:43 2011 @@ -236,3 +236,20 @@ ; CHECK-NEXT: call void @llvm.memcpy ; CHECK-NEXT: ret } + + +; The store here is not dead because the byval call reads it. +declare void @test19f({i32}* byval align 4 %P) + +define void @test19({i32} * nocapture byval align 4 %arg5) nounwind ssp { +bb: + %tmp7 = getelementptr inbounds {i32}* %arg5, i32 0, i32 0 + store i32 912, i32* %tmp7 + call void @test19f({i32}* byval align 4 %arg5) + ret void + +; CHECK: @test19( +; CHECK: store i32 912 +; CHECK: call void @test19f +} + From rengolin at systemcall.org Mon May 23 09:07:10 2011 From: rengolin at systemcall.org (Renato Golin) Date: Mon, 23 May 2011 15:07:10 +0100 Subject: [llvm-commits] [Patch] ARM EABI divmod modifications Message-ID: Hi all, The following patch was extracted from today's trunk. I've added the necessary tests. Rationale: RTABI 4.2 specifies _eabi_{u,}{i,l}divmod library helpers. This patch adds them in the library call list and use it for calculating the reminder (srem/urem) when in EABI mode. cheers, --renato -------------- next part -------------- A non-text attachment was scrubbed... Name: divrem.patch Type: text/x-diff Size: 9199 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110523/687c0822/attachment-0001.bin From grosser at fim.uni-passau.de Mon May 23 10:23:36 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Mon, 23 May 2011 15:23:36 -0000 Subject: [llvm-commits] [polly] r131898 - /polly/trunk/lib/CodeGeneration.cpp Message-ID: <20110523152336.ABCFB2A6C12C@llvm.org> Author: grosser Date: Mon May 23 10:23:36 2011 New Revision: 131898 URL: http://llvm.org/viewvc/llvm-project?rev=131898&view=rev Log: CodeGeneration: Use FIXME instead of XXX Cleanup suggested by ether. Modified: polly/trunk/lib/CodeGeneration.cpp Modified: polly/trunk/lib/CodeGeneration.cpp URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CodeGeneration.cpp?rev=131898&r1=131897&r2=131898&view=diff ============================================================================== --- polly/trunk/lib/CodeGeneration.cpp (original) +++ polly/trunk/lib/CodeGeneration.cpp Mon May 23 10:23:36 2011 @@ -1489,14 +1489,14 @@ AU.addPreserved(); AU.addPreserved(); - // XXX: We do not create LoopInfo for the newly generated loops. + // FIXME: We do not create LoopInfo for the newly generated loops. AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); - // XXX: We do not yet add regions for the newly generated code to the region - // tree. + // FIXME: We do not yet add regions for the newly generated code to the + // region tree. AU.addPreserved(); AU.addPreserved(); AU.addPreserved(); From grosser at fim.uni-passau.de Mon May 23 10:30:10 2011 From: grosser at fim.uni-passau.de (Tobias Grosser) Date: Mon, 23 May 2011 12:30:10 -0300 Subject: [llvm-commits] [polly] r131360 - /polly/trunk/lib/CodeGeneration.cpp In-Reply-To: References: <20110514190245.B08092A6C12D@llvm.org> Message-ID: <4DDA7D82.30907@fim.uni-passau.de> On 05/21/2011 10:44 PM, ether zhhb wrote: > hi tobi, > > On Sun, May 15, 2011 at 3:02 AM, Tobias Grosser > wrote: > >> + >> + // XXX: We do not create LoopInfo for the newly generated loops. > use FIXME or other meaningful word instead of XXX? I now use FIXME instead of XXX. Change committed in 131898 Cheers Tobi From cdavis at mines.edu Mon May 23 11:43:09 2011 From: cdavis at mines.edu (Charles Davis) Date: Mon, 23 May 2011 16:43:09 -0000 Subject: [llvm-commits] [llvm] r131899 - /llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Message-ID: <20110523164309.D651E2A6C12C@llvm.org> Author: cdavis Date: Mon May 23 11:43:09 2011 New Revision: 131899 URL: http://llvm.org/viewvc/llvm-project?rev=131899&view=rev Log: Implement .seh_stackalloc and .seh_pushframe parsing. I haven't implemented any of the ones that take registers yet. The problem is that for x86-64 the streamer methods expect a native x86 register number (note: %r8-%r15 want 8-15 instead of 0-7; same for %xmm8-%xmm15). I haven't figured out exactly how I want to do that yet. Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp?rev=131899&r1=131898&r2=131899&view=diff ============================================================================== --- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original) +++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Mon May 23 11:43:09 2011 @@ -256,8 +256,17 @@ return Error(L, "not implemented yet"); } -bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc L) { - return Error(L, "not implemented yet"); +bool COFFAsmParser::ParseSEHDirectiveAllocStack(StringRef, SMLoc) { + int64_t Size; + if (getParser().ParseAbsoluteExpression(Size)) + return true; + + if (getLexer().isNot(AsmToken::EndOfStatement)) + return TokError("unexpected token in directive"); + + Lex(); + getStreamer().EmitWin64EHAllocStack(Size); + return false; } bool COFFAsmParser::ParseSEHDirectiveSaveReg(StringRef, SMLoc L) { @@ -268,8 +277,22 @@ return Error(L, "not implemented yet"); } -bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc L) { - return Error(L, "not implemented yet"); +bool COFFAsmParser::ParseSEHDirectivePushFrame(StringRef, SMLoc) { + bool Code; + StringRef CodeID; + SMLoc startLoc = getLexer().getLoc(); + if (!getParser().ParseIdentifier(CodeID)) { + if (CodeID != "@code") + return Error(startLoc, "expected @code"); + Code = true; + } + + if (getLexer().isNot(AsmToken::EndOfStatement)) + return TokError("unexpected token in directive"); + + Lex(); + getStreamer().EmitWin64EHPushFrame(Code); + return false; } bool COFFAsmParser::ParseSEHDirectiveEndProlog(StringRef, SMLoc) { From aggarwa4 at illinois.edu Mon May 23 11:43:20 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Mon, 23 May 2011 16:43:20 -0000 Subject: [llvm-commits] [poolalloc] r131900 - in /poolalloc/trunk: include/assistDS/TypeChecks.h lib/AssistDS/TypeChecks.cpp Message-ID: <20110523164320.49F102A6C12C@llvm.org> Author: aggarwa4 Date: Mon May 23 11:43:20 2011 New Revision: 131900 URL: http://llvm.org/viewvc/llvm-project?rev=131900&view=rev Log: std::map operator[] creates an entry if one is not found. Thus, we do not need to explicitly initialize the map. This ensures that we only create entries in the map if that type is used in any tracking operation. Reduces the number of types we think need metadata. Might help reduce the number of bits needed in the metadata, if we can find a upper limit in some large examples. Modified: poolalloc/trunk/include/assistDS/TypeChecks.h poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Modified: poolalloc/trunk/include/assistDS/TypeChecks.h URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/assistDS/TypeChecks.h?rev=131900&r1=131899&r2=131900&view=diff ============================================================================== --- poolalloc/trunk/include/assistDS/TypeChecks.h (original) +++ poolalloc/trunk/include/assistDS/TypeChecks.h Mon May 23 11:43:20 2011 @@ -31,21 +31,13 @@ class TypeChecks : public ModulePass { private: - unsigned int maxType; std::map UsedTypes; - std::map UsedValues; // Analysis from other passes. TargetData *TD; TypeAnalysis *TA; dsa::TypeSafety *TS; - // Incorporate one type and all of its subtypes into the collection of used types. - void IncorporateType(const Type *Ty); - - // Incorporate all of the types used by this value. - void IncorporateValue(const Value *V); - public: static char ID; TypeChecks() : ModulePass(&ID) {} Modified: poolalloc/trunk/lib/AssistDS/TypeChecks.cpp URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/AssistDS/TypeChecks.cpp?rev=131900&r1=131899&r2=131900&view=diff ============================================================================== --- poolalloc/trunk/lib/AssistDS/TypeChecks.cpp (original) +++ poolalloc/trunk/lib/AssistDS/TypeChecks.cpp Mon May 23 11:43:20 2011 @@ -37,6 +37,7 @@ // Pass statistics STATISTIC(numLoadChecks, "Number of Load Insts that need type checks"); STATISTIC(numStoreChecks, "Number of Store Insts that need type checks"); +STATISTIC(numTypes, "Number of Types used in the module"); namespace { static cl::opt EnableTypeSafeOpt("enable-type-safe-opt", @@ -52,37 +53,6 @@ static const Type *Int64Ty = 0; static const PointerType *VoidPtrTy = 0; -// Incorporate one type and all of its subtypes into the collection of used types. -void TypeChecks::IncorporateType(const Type *Ty) { - // If Ty doesn't already exist in the used types map, add it now. Otherwise, return. - if (UsedTypes[Ty] != 0) { - return; - } - - UsedTypes[Ty] = maxType; - ++maxType; - - // Make sure to add any types this type references now. - for (Type::subtype_iterator I = Ty->subtype_begin(), E = Ty->subtype_end(); I != E; ++I) { - IncorporateType(*I); - } -} - -// Incorporate all of the types used by this value. -void TypeChecks::IncorporateValue(const Value *V) { - IncorporateType(V->getType()); - UsedValues[V] = V->getType(); - - // If this is a constant, it could be using other types. - if (const Constant *C = dyn_cast(V)) { - if (!isa(C)) { - for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end(); OI != OE; ++OI) { - IncorporateValue(*OI); - } - } - } -} - bool TypeChecks::runOnModule(Module &M) { bool modified = false; // Flags whether we modified the module. @@ -98,15 +68,6 @@ VoidPtrTy = PointerType::getUnqual(Int8Ty); UsedTypes.clear(); // Reset if run multiple times. - maxType = 1; - - // Loop over global variables, incorporating their types. - for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { - IncorporateType(I->getType()); - if (I->hasInitializer()) { - IncorporateValue(I->getInitializer()); - } - } Function *MainF = M.getFunction("main"); if (MainF == 0 || MainF->isDeclaration()) { @@ -117,12 +78,11 @@ // Insert the shadow initialization function. modified |= initShadow(M); - inst_iterator MainI = inst_begin(MainF); - // record argv - modified |= visitMain(M, *MainF); + // record all globals + inst_iterator MainI = inst_begin(MainF); for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { if(!I->getNumUses() == 1) @@ -134,7 +94,6 @@ std::vector toProcess; for (Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI) { - IncorporateType(MI->getType()); Function &F = *MI; toProcess.push_back(&F); @@ -143,11 +102,6 @@ for (inst_iterator II = inst_begin(F), IE = inst_end(F); II != IE; ++II) { Instruction &I = *II; - IncorporateType(I.getType()); // Incorporate the type of the instruction. - for (User::op_iterator OI = I.op_begin(), OE = I.op_end(); OI != OE; ++OI) { - IncorporateValue(*OI); // Insert instruction operand types. - } - if (StoreInst *SI = dyn_cast(&I)) { if (TA->isCopyingStore(SI)) { Value *SS = TA->getStoreSource(SI); @@ -182,6 +136,7 @@ modified |= visitVarArgFunction(M, *F); } + numTypes += UsedTypes.size(); return modified; } @@ -195,7 +150,7 @@ if(!F.hasInternalLinkage()) return false; // FIXME:handle external functions - + // Modify the function to add a call to get the num of arguments VAArgInst *VASize = NULL; VAArgInst *VAMetaData = NULL; @@ -571,14 +526,7 @@ OS << '\n'; } - OS << "\nValues in use by this module:\n"; - for (std::map::const_iterator I = UsedValues.begin(), E = UsedValues.end(); I != E; ++I) { - OS << " " << I->first << " = "; - WriteTypeSymbolic(OS, I->second, M); - OS << '\n'; - } - - OS << "\nNumber of types: " << maxType << '\n'; + OS << "\nNumber of types: " << UsedTypes.size() << '\n'; } // Initialize the shadow memory which contains the 1:1 mapping. From aggarwa4 at illinois.edu Mon May 23 11:46:35 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Mon, 23 May 2011 16:46:35 -0000 Subject: [llvm-commits] [poolalloc] r131901 - in /poolalloc/trunk/test: TEST.types.Makefile TEST.types.report Message-ID: <20110523164635.CDF9D2A6C12C@llvm.org> Author: aggarwa4 Date: Mon May 23 11:46:35 2011 New Revision: 131901 URL: http://llvm.org/viewvc/llvm-project?rev=131901&view=rev Log: Remove dead stat. Modified: poolalloc/trunk/test/TEST.types.Makefile poolalloc/trunk/test/TEST.types.report Modified: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=131901&r1=131900&r2=131901&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (original) +++ poolalloc/trunk/test/TEST.types.Makefile Mon May 23 11:46:35 2011 @@ -358,9 +358,6 @@ @/bin/echo -n "CLONED_INDCLONE: " >> $@ - at grep 'Number of Functions Cloned in IndClone' $<.info >> $@ @echo >> $@ - @/bin/echo -n "VARARGS_CALLS: " >> $@ - - at grep 'Number of Calls Simplified' $<.info >> $@ - @echo >> $@ @/bin/echo -n "GEP_CALLS: " >> $@ - at grep 'Number of Calls Modified' $<.info >> $@ @echo >> $@ Modified: poolalloc/trunk/test/TEST.types.report URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.report?rev=131901&r1=131900&r2=131901&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.report (original) +++ poolalloc/trunk/test/TEST.types.report Mon May 23 11:46:35 2011 @@ -163,7 +163,6 @@ ["I2P", "ACCESSES I2P: *([0-9]+)"], # Nodes Folded [], - ["VAFUNC", "VARARGS_CALLS: *([0-9]+)"], ["GEPFUNC", "GEP_CALLS: *([0-9]+)"], ["ARGSMPL", "ARG_SMPL: *([0-9]+)"], ["FUNCSPEC", "CLONED_FUNCSPEC: *([0-9]+)"], From aggarwa4 at illinois.edu Mon May 23 11:48:31 2011 From: aggarwa4 at illinois.edu (Arushi Aggarwal) Date: Mon, 23 May 2011 16:48:31 -0000 Subject: [llvm-commits] [poolalloc] r131902 - /poolalloc/trunk/test/TEST.types.Makefile Message-ID: <20110523164831.AEEE02A6C12C@llvm.org> Author: aggarwa4 Date: Mon May 23 11:48:31 2011 New Revision: 131902 URL: http://llvm.org/viewvc/llvm-project?rev=131902&view=rev Log: 1. dynamic counting of LS instructions is now in the Assist_DS module 2. LLC-2.9 does not like the -f flag. Modified: poolalloc/trunk/test/TEST.types.Makefile Modified: poolalloc/trunk/test/TEST.types.Makefile URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/test/TEST.types.Makefile?rev=131902&r1=131901&r2=131902&view=diff ============================================================================== --- poolalloc/trunk/test/TEST.types.Makefile (original) +++ poolalloc/trunk/test/TEST.types.Makefile Mon May 23 11:48:31 2011 @@ -56,15 +56,15 @@ $(PROGRAMS_TO_TEST:%=Output/%.count.bc): \ Output/%.count.bc: Output/%.opt.bc $(LOPT) $(ASSIST_SO) - -$(RUNOPT) -enable-type-inference-opts -dsa-stdlib-no-fold -dyncount -disable-opt -info-output-file=$(CURDIR)/$@.info $< -f -o $@ + -$(RUNOPT) -load $(ASSIST_SO) -enable-type-inference-opts -dsa-stdlib-no-fold -dyncount -disable-opt -info-output-file=$(CURDIR)/$@.info $< -f -o $@ $(PROGRAMS_TO_TEST:%=Output/%.count1.bc): \ Output/%.count1.bc: Output/%.opt.bc $(LOPT) $(ASSIST_SO) - -$(RUNOPT) -dyncount -disable-opt -info-output-file=$(CURDIR)/$@.info $< -f -o $@ + -$(RUNOPT) -load $(ASSIST_SO) -dyncount -disable-opt -info-output-file=$(CURDIR)/$@.info $< -f -o $@ $(PROGRAMS_TO_TEST:%=Output/%.tc.bc): \ Output/%.tc.bc: Output/%.opt.bc $(LOPT) $(ASSIST_SO) - -$(RUNOPT) -load $(ASSIST_SO) -typechecks -dce -ipsccp -dce -stats -info-output-file=$(CURDIR)/$@.info $< -f -o $@.temp + -$(RUNOPT) -load $(ASSIST_SO) -typechecks -dce -ipsccp -dce -stats -info-output-file=$(CURDIR)/$@.info $< -f -o $@.temp -$(LLVMLD) -disable-opt -o $@.ld $@.temp $(TYPE_RT_BC) -$(LOPT) $(SAFE_OPTS) $@.ld.bc -o $@ -f @@ -83,25 +83,25 @@ $(PROGRAMS_TO_TEST:%=Output/%.count.s): \ Output/%.count.s: Output/%.count.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.count1.s): \ Output/%.count1.s: Output/%.count1.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.opt.s): \ Output/%.opt.s: Output/%.opt.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.llvm1.s): \ Output/%.llvm1.s: Output/%.llvm1.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.tc.s): \ Output/%.tc.s: Output/%.tc.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.tco.s): \ Output/%.tco.s: Output/%.tco.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.tcoo.s): \ Output/%.tcoo.s: Output/%.tcoo.bc $(LLC) - -$(LLC) -f $< -o $@ + -$(LLC) $< -o $@ $(PROGRAMS_TO_TEST:%=Output/%.opt): \ Output/%.opt: Output/%.opt.s From baldrick at free.fr Mon May 23 11:50:29 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 May 2011 16:50:29 -0000 Subject: [llvm-commits] [llvm] r131903 - in /llvm/trunk: autoconf/configure.ac configure Message-ID: <20110523165029.C39A32A6C12C@llvm.org> Author: baldrick Date: Mon May 23 11:50:29 2011 New Revision: 131903 URL: http://llvm.org/viewvc/llvm-project?rev=131903&view=rev Log: The dragonegg option to disable LLVM optimizations changed. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=131903&r1=131902&r2=131903&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon May 23 11:50:29 2011 @@ -1528,7 +1528,7 @@ dnl in llvmgcc if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir" - LLVMCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns" + LLVMCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-llvm-ir-optimize=0" else LLVMCC_EMITIR_FLAG="-emit-llvm" LLVMCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns" Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=131903&r1=131902&r2=131903&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon May 23 11:50:29 2011 @@ -22245,7 +22245,7 @@ if test "$llvm_cv_llvmgcc_dragonegg" = "yes" ; then LLVMCC_EMITIR_FLAG="-fplugin-arg-dragonegg-emit-ir" - LLVMCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-disable-llvm-optzns" + LLVMCC_DISABLEOPT_FLAGS="-fplugin-arg-dragonegg-llvm-ir-optimize=0" else LLVMCC_EMITIR_FLAG="-emit-llvm" LLVMCC_DISABLEOPT_FLAGS="-mllvm -disable-llvm-optzns" From dpatel at apple.com Mon May 23 11:58:19 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 09:58:19 -0700 Subject: [llvm-commits] [llvm] r130409 - /llvm/trunk/lib/VMCore/AsmWriter.cpp In-Reply-To: <1AA1649F-BD86-4E69-B580-65A580981063@apple.com> References: <20110428174138.4D5332A6C135@llvm.org> <1AA1649F-BD86-4E69-B580-65A580981063@apple.com> Message-ID: On May 21, 2011, at 11:31 AM, Chris Lattner wrote: > > On Apr 28, 2011, at 10:41 AM, Devang Patel wrote: > >> Author: dpatel >> Date: Thu Apr 28 12:41:38 2011 >> New Revision: 130409 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=130409&view=rev >> Log: >> Add command line option to print debug info in human readable form as comment in llvm IR output. This, i.e -enable-debug-info-comment, is very useful if you want to easily find out which optimization pass is losing line number information. > > Hi Devang, why don't you implement this as an AssemblyAnnotationWriter? That's the entire point of having that API. :) I did not find a way to use AssemblyAnnotationWriter from default AsmWriter such that I can have this info available @ gdb prompt. Thoughts ? - Devang From dpatel at apple.com Mon May 23 11:59:29 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 09:59:29 -0700 Subject: [llvm-commits] [llvm] r127381 - in /llvm/trunk: include/llvm/DebugInfoProbe.h lib/Analysis/LoopPass.cpp lib/VMCore/DebugInfoProbe.cpp lib/VMCore/PassManager.cpp In-Reply-To: References: <20110310002125.4BA842A6C12C@llvm.org> Message-ID: On May 21, 2011, at 9:09 PM, Chris Lattner wrote: > On Mar 9, 2011, at 4:21 PM, Devang Patel wrote: > >> Author: dpatel >> Date: Wed Mar 9 18:21:25 2011 >> New Revision: 127381 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=127381&view=rev >> Log: >> Introduce DebugInfoProbe. This is used to monitor how llvm optimizer is treating debugging information. >> It generates output that lools like >> >> 8 times line number info lost by Scalar Replacement of Aggregates (SSAUp) >> 1 times line number info lost by Simplify well-known library calls >> 12 times variable info lost by Jump Threading > > Hi Devang, > > This looks like very interesting functionality, but it is really unfortunate that it has to be so intricately intertwined into the core PassManager. We don't do this for any other functionality, why should this be different? Pass manager is involved because we need a way to collect data after every pass. BTW, We do this for pass timer also. - Devang -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20110523/93105de8/attachment.html From baldrick at free.fr Mon May 23 12:09:46 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 May 2011 17:09:46 -0000 Subject: [llvm-commits] [dragonegg] r131904 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110523170946.8EC602A6C12C@llvm.org> Author: baldrick Date: Mon May 23 12:09:46 2011 New Revision: 131904 URL: http://llvm.org/viewvc/llvm-project?rev=131904&view=rev Log: Fail in a less in-your-face way when a command line options is given with a wrong parameter (the compiler will still bail out, but without saying that the plugin failed). If a command line option is not recognized then output a warning rather than an error like gcc does. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=131904&r1=131903&r2=131904&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Mon May 23 12:09:46 2011 @@ -2423,12 +2423,12 @@ if (!argv[i].value) { error(G_("no value supplied for option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key); - return 1; + continue; } if (argv[i].value[0] < '0' || argv[i].value[0] > '9' || argv[i].value[1]) { error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value); - return 1; + continue; } int OptLevel = argv[i].value[0] - '0'; if (argv[i].key[5] == 'i') @@ -2442,7 +2442,7 @@ if (argv[i].value) { error(G_("invalid option argument '-fplugin-arg-%s-%s=%s'"), plugin_name, argv[i].key, argv[i].value); - return 1; + continue; } // Look for a matching flag. @@ -2454,11 +2454,9 @@ break; } - if (!Found) { - error(G_("invalid option '-fplugin-arg-%s-%s'"), + if (!Found) + warning(0, G_("unrecognised option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key); - return 1; - } } } From baldrick at free.fr Mon May 23 12:11:01 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 May 2011 17:11:01 -0000 Subject: [llvm-commits] [dragonegg] r131905 - /dragonegg/trunk/src/Backend.cpp Message-ID: <20110523171102.079F72A6C12C@llvm.org> Author: baldrick Date: Mon May 23 12:11:01 2011 New Revision: 131905 URL: http://llvm.org/viewvc/llvm-project?rev=131905&view=rev Log: Remove a bunch of commented out stuff related to precompiled header support. This is not relevant to dragonegg: just use gcc's precompiled header support. Modified: dragonegg/trunk/src/Backend.cpp Modified: dragonegg/trunk/src/Backend.cpp URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=131905&r1=131904&r2=131905&view=diff ============================================================================== --- dragonegg/trunk/src/Backend.cpp (original) +++ dragonegg/trunk/src/Backend.cpp Mon May 23 12:11:01 2011 @@ -77,9 +77,6 @@ #error Unsupported GCC major version #endif -// Non-zero if bytecode from PCH is successfully read. -int flag_llvm_pch_read; - // Non-zero if libcalls should not be simplified. int flag_no_simplify_libcalls; @@ -124,8 +121,6 @@ static void createPerFunctionOptimizationPasses(); static void createPerModuleOptimizationPasses(); -//TODOstatic void destroyOptimizationPasses(); - //===----------------------------------------------------------------------===// // Matching LLVM Values with GCC DECL trees @@ -192,65 +187,6 @@ llvm_replace_cached(Old, New); } -//TODO/// readLLVMValues - Read LLVM Types string table -//TODOvoid readLLVMValues() { -//TODO GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values"); -//TODO if (!V) -//TODO return; -//TODO -//TODO GlobalVariable *GV = cast(V); -//TODO ConstantStruct *ValuesFromPCH = cast(GV->getOperand(0)); -//TODO -//TODO for (unsigned i = 0; i < ValuesFromPCH->getNumOperands(); ++i) { -//TODO Value *Va = ValuesFromPCH->getOperand(i); -//TODO -//TODO if (!Va) { -//TODO // If V is empty then insert NULL to represent empty entries. -//TODO LLVMValues.push_back(Va); -//TODO continue; -//TODO } -//TODO if (ConstantArray *CA = dyn_cast(Va)) { -//TODO std::string Str = CA->getAsString(); -//TODO Va = TheModule->getValueSymbolTable().lookup(Str); -//TODO } -//TODO assert (Va != NULL && "Invalid Value in LLVMValues string table"); -//TODO LLVMValues.push_back(Va); -//TODO } -//TODO -//TODO // Now, llvm.pch.values is not required so remove it from the symbol table. -//TODO GV->eraseFromParent(); -//TODO} -//TODO -//TODO/// writeLLVMValues - GCC tree's uses LLVMValues vector's index to reach LLVM -//TODO/// Values. Create a string table to hold these LLVM Values' names. This string -//TODO/// table will be used to recreate LTypes vector after loading PCH. -//TODOvoid writeLLVMValues() { -//TODO if (LLVMValues.empty()) -//TODO return; -//TODO -//TODO LLVMContext &Context = getGlobalContext(); -//TODO -//TODO std::vector ValuesForPCH; -//TODO for (std::vector::iterator I = LLVMValues.begin(), -//TODO E = LLVMValues.end(); I != E; ++I) { -//TODO if (Constant *C = dyn_cast_or_null(*I)) -//TODO ValuesForPCH.push_back(C); -//TODO else -//TODO // Non constant values, e.g. arguments, are not at global scope. -//TODO // When PCH is read, only global scope values are used. -//TODO ValuesForPCH.push_back(Constant::getNullValue(Type::getInt32Ty(Context))); -//TODO } -//TODO -//TODO // Create string table. -//TODO Constant *LLVMValuesTable = ConstantStruct::get(Context, ValuesForPCH, false); -//TODO -//TODO // Create variable to hold this string table. -//TODO new GlobalVariable(*TheModule, LLVMValuesTable->getType(), true, -//TODO GlobalValue::ExternalLinkage, -//TODO LLVMValuesTable, -//TODO "llvm.pch.values"); -//TODO} - /// handleVisibility - Forward decl visibility style to global. void handleVisibility(tree decl, GlobalValue *GV) { // If decl has visibility specified explicitely (via attribute) - honour @@ -614,91 +550,6 @@ formatted_raw_ostream::PRESERVE_STREAM); } -//TODOoFILEstream *AsmIntermediateOutStream = 0; -//TODO -//TODO/// llvm_pch_read - Read bytecode from PCH file. Initialize TheModule and setup -//TODO/// LTypes vector. -//TODOvoid llvm_pch_read(const unsigned char *Buffer, unsigned Size) { -//TODO std::string ModuleName = TheModule->getModuleIdentifier(); -//TODO -//TODO delete TheModule; -//TODO delete TheDebugInfo; -//TODO -//TODO clearTargetBuiltinCache(); -//TODO -//TODO MemoryBuffer *MB = MemoryBuffer::getNewMemBuffer(Size, ModuleName.c_str()); -//TODO memcpy((char*)MB->getBufferStart(), Buffer, Size); -//TODO -//TODO std::string ErrMsg; -//TODO TheModule = ParseBitcodeFile(MB, getGlobalContext(), &ErrMsg); -//TODO delete MB; -//TODO -//TODO // FIXME - Do not disable debug info while writing pch. -//TODO if (!flag_pch_file && debug_info_level > DINFO_LEVEL_NONE) { -//TODO TheDebugInfo = new DebugInfo(TheModule); -//TODO TheDebugInfo->Initialize(); -//TODO } -//TODO -//TODO if (!TheModule) { -//TODO errs() << "Error reading bytecodes from PCH file\n"; -//TODO errs() << ErrMsg << "\n"; -//TODO exit(1); -//TODO } -//TODO -//TODO if (PerFunctionPasses || PerModulePasses) { -//TODO destroyOptimizationPasses(); -//TODO -//TODO // Don't run codegen, when we should output PCH -//TODO if (flag_pch_file) -//TODO llvm_pch_write_init(); -//TODO } -//TODO -//TODO // Read LLVM Types string table -//TODO readLLVMTypesStringTable(); -//TODO readLLVMValues(); -//TODO -//TODO flag_llvm_pch_read = 1; -//TODO} -//TODO -//TODO/// llvm_pch_write_init - Initialize PCH writing. -//TODOvoid llvm_pch_write_init(void) { -//TODO timevar_push(TV_LLVM_INIT); -//TODO AsmOutStream = new oFILEstream(asm_out_file); -//TODO // FIXME: disentangle ostream madness here. Kill off ostream and FILE. -//TODO AsmOutRawStream = -//TODO new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream), -//TODO formatted_raw_ostream::DELETE_STREAM); -//TODO -//TODO PerModulePasses = new PassManager(); -//TODO PerModulePasses->add(new TargetData(*TheTarget->getTargetData())); -//TODO -//TODO // If writing to stdout, set binary mode. -//TODO if (asm_out_file == stdout) -//TODO sys::Program::ChangeStdoutToBinary(); -//TODO -//TODO // Emit an LLVM .bc file to the output. This is used when passed -//TODO // -emit-llvm -c to the GCC driver. -//TODO PerModulePasses->add(createBitcodeWriterPass(*AsmOutStream)); -//TODO -//TODO // Disable emission of .ident into the output file... which is completely -//TODO // wrong for llvm/.bc emission cases. -//TODO flag_no_ident = 1; -//TODO -//TODO flag_llvm_pch_read = 0; -//TODO -//TODO timevar_pop(TV_LLVM_INIT); -//TODO} - -//TODOstatic void destroyOptimizationPasses() { -//TODO delete PerFunctionPasses; -//TODO delete PerModulePasses; -//TODO delete CodeGenPasses; -//TODO -//TODO PerFunctionPasses = 0; -//TODO PerModulePasses = 0; -//TODO CodeGenPasses = 0; -//TODO} - static void createPerFunctionOptimizationPasses() { if (PerFunctionPasses) return; @@ -814,31 +665,6 @@ } } -//TODO/// llvm_asm_file_start - Start the .s file. -//TODOvoid llvm_asm_file_start(void) { -//TODO timevar_push(TV_LLVM_INIT); -//TODO AsmOutStream = new oFILEstream(asm_out_file); -//TODO // FIXME: disentangle ostream madness here. Kill off ostream and FILE. -//TODO AsmOutRawStream = -//TODO new formatted_raw_ostream(*new raw_os_ostream(*AsmOutStream), -//TODO formatted_raw_ostream::DELETE_STREAM); -//TODO -//TODO flag_llvm_pch_read = 0; -//TODO -//TODO if (EmitIR) -//TODO // Disable emission of .ident into the output file... which is completely -//TODO // wrong for llvm/.bc emission cases. -//TODO flag_no_ident = 1; -//TODO -//TODO // If writing to stdout, set binary mode. -//TODO if (asm_out_file == stdout) -//TODO sys::Program::ChangeStdoutToBinary(); -//TODO -//TODO AttributeUsedGlobals.clear(); -//TODO AttributeCompilerUsedGlobals.clear(); -//TODO timevar_pop(TV_LLVM_INIT); -//TODO} - /// ConvertStructorsList - Convert a list of static ctors/dtors to an /// initializer suitable for the llvm.global_[cd]tors globals. static void CreateStructorsList(std::vector > &Tors, @@ -2091,11 +1917,6 @@ LLVMContext &Context = getGlobalContext(); createPerFunctionOptimizationPasses(); -//TODO -//TODO if (flag_pch_file) { -//TODO writeLLVMTypesStringTable(); -//TODO writeLLVMValues(); -//TODO } //TODO for (Module::iterator I = TheModule->begin(), E = TheModule->end(); //TODO I != E; ++I) @@ -2168,33 +1989,6 @@ if (PerFunctionPasses) PerFunctionPasses->doFinalization(); -//TODO // Emit intermediate file before module level optimization passes are run. -//TODO if (flag_debug_llvm_module_opt) { -//TODO -//TODO static PassManager *IntermediatePM = new PassManager(); -//TODO IntermediatePM->add(new TargetData(*TheTarget->getTargetData())); -//TODO -//TODO char asm_intermediate_out_filename[MAXPATHLEN]; -//TODO strcpy(&asm_intermediate_out_filename[0], llvm_asm_file_name); -//TODO strcat(&asm_intermediate_out_filename[0],".0"); -//TODO FILE *asm_intermediate_out_file = fopen(asm_intermediate_out_filename, "w+b"); -//TODO AsmIntermediateOutStream = new oFILEstream(asm_intermediate_out_file); -//TODO raw_ostream *AsmIntermediateRawOutStream = -//TODO new raw_os_ostream(*AsmIntermediateOutStream); -//TODO if (EmitIR && 0) -//TODO IntermediatePM->add(createBitcodeWriterPass(*AsmIntermediateOutStream)); -//TODO if (EmitIR) -//TODO IntermediatePM->add(createPrintModulePass(AsmIntermediateRawOutStream)); -//TODO IntermediatePM->run(*TheModule); -//TODO AsmIntermediateRawOutStream->flush(); -//TODO delete AsmIntermediateRawOutStream; -//TODO AsmIntermediateRawOutStream = 0; -//TODO AsmIntermediateOutStream->flush(); -//TODO fflush(asm_intermediate_out_file); -//TODO delete AsmIntermediateOutStream; -//TODO AsmIntermediateOutStream = 0; -//TODO } - // Run module-level optimizers, if any are present. createPerModuleOptimizationPasses(); if (PerModulePasses) @@ -2212,10 +2006,6 @@ FormattedOutStream.flush(); OutStream->flush(); -//TODO delete AsmOutRawStream; -//TODO AsmOutRawStream = 0; -//TODO delete AsmOutStream; -//TODO AsmOutStream = 0; //TODO timevar_pop(TV_LLVM_PERFILE); // We have finished - shutdown the plugin. Doing this here ensures that timer From baldrick at free.fr Mon May 23 12:27:40 2011 From: baldrick at free.fr (Duncan Sands) Date: Mon, 23 May 2011 19:27:40 +0200 Subject: [llvm-commits] [llvm] r131887 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp test/Transforms/InstCombine/shift.ll In-Reply-To: <20110523002150.4EC242A6C12C@llvm.org> References: <20110523002150.4EC242A6C12C@llvm.org> Message-ID: <4DDA990C.1000502@free.fr> Hi Chris, > Transform any logical shift of a power of two into an exact/NUW shift when > in a known-non-zero context. in "x div (1 << y)" this will mark the shift as "nuw" always, due to the following logic: (A) isPowerOfTwo will say that "1 << y" is a power of two, because either the 1 is shifted off the end so yielding an undef which can be assumed to be a power of two, or the 1 isn't shifted off the end in which case it sure is a power of two; (B) then your logic will deduce that 1 was not shifted off the end, and will add a nsw flag to the shift. Thus this transform potentially upgrades an undef value to a trap value: if later on some pass discovers for example that y is big enough that it shifts 1 off the end then now you get a trap value while before this transform you got an undef. Yet trap values are defined to only occur when violating a nsw/nuw/ exact flag on an operation, but there was no such flag in the original code! I don't know if this matters but it seems a bit dubious to me. Ciao, Duncan. From dpatel at apple.com Mon May 23 12:34:18 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 17:34:18 -0000 Subject: [llvm-commits] [llvm] r131906 - /llvm/trunk/lib/VMCore/DebugInfoProbe.cpp Message-ID: <20110523173418.807142A6C12C@llvm.org> Author: dpatel Date: Mon May 23 12:34:18 2011 New Revision: 131906 URL: http://llvm.org/viewvc/llvm-project?rev=131906&view=rev Log: Clear list of instructions without DebugLoc. Modified: llvm/trunk/lib/VMCore/DebugInfoProbe.cpp Modified: llvm/trunk/lib/VMCore/DebugInfoProbe.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DebugInfoProbe.cpp?rev=131906&r1=131905&r2=131906&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/DebugInfoProbe.cpp (original) +++ llvm/trunk/lib/VMCore/DebugInfoProbe.cpp Mon May 23 12:34:18 2011 @@ -65,6 +65,7 @@ PassName = PName; DbgVariables.clear(); + MissingDebugLoc.clear(); TheFn = &F; for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) From dpatel at apple.com Mon May 23 12:35:09 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 17:35:09 -0000 Subject: [llvm-commits] [llvm] r131907 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp test/CodeGen/X86/dbg-value-dag-combine.ll Message-ID: <20110523173509.44FD42A6C12C@llvm.org> Author: dpatel Date: Mon May 23 12:35:08 2011 New Revision: 131907 URL: http://llvm.org/viewvc/llvm-project?rev=131907&view=rev Log: While replacing all uses of a SDValue with another value, do not forget to transfer SDDbgValue. Added: llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=131907&r1=131906&r2=131907&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon May 23 12:35:08 2011 @@ -5150,6 +5150,9 @@ "Cannot replace with this method!"); assert(From != To.getNode() && "Cannot replace uses of with self"); + // Transfer debug values. + TransferDbgValues(FromN, To); + // Iterate over all the existing uses of From. New uses will be added // to the beginning of the use list, which we avoid visiting. // This specifically avoids visiting uses of From that arise while the Added: llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll?rev=131907&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-value-dag-combine.ll Mon May 23 12:35:08 2011 @@ -0,0 +1,48 @@ +; RUN: llc < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" +; PR 9817 + + +declare <4 x i32> @__amdil_get_global_id_int() +declare void @llvm.dbg.value(metadata , i64 , metadata ) +define void @__OpenCL_test_kernel(i32 addrspace(1)* %ip) nounwind { +entry: + call void @llvm.dbg.value(metadata !{i32 addrspace(1)* %ip}, i64 0, metadata +!7), !dbg !8 + %0 = call <4 x i32> @__amdil_get_global_id_int() nounwind + %1 = extractelement <4 x i32> %0, i32 0 + call void @llvm.dbg.value(metadata !{i32 %1}, i64 0, metadata !9), !dbg !11 + call void @llvm.dbg.value(metadata !12, i64 0, metadata !13), !dbg !14 + %tmp2 = load i32 addrspace(1)* %ip, align 4, !dbg !15 + %tmp3 = add i32 0, %tmp2, !dbg !15 +; CHECK: ##DEBUG_VALUE: idx <- EAX+0 + call void @llvm.dbg.value(metadata !{i32 %tmp3}, i64 0, metadata !13), !dbg +!15 + %arrayidx = getelementptr i32 addrspace(1)* %ip, i32 %1, !dbg !16 + store i32 %tmp3, i32 addrspace(1)* %arrayidx, align 4, !dbg !16 + ret void, !dbg !17 +} +!llvm.dbg.sp = !{!0} + +!0 = metadata !{i32 589870, i32 0, metadata !1, metadata +!"__OpenCL_test_kernel", metadata !"__OpenCL_test_kernel", metadata +!"__OpenCL_test_kernel", metadata !1, i32 2, metadata !3, i1 false, i1 true, i32 0, i32 0, i32 0, i32 0, i1 false, null} ; [ DW_TAG_subprogram ] +!1 = metadata !{i32 589865, metadata !"OCL6368.tmp.cl", metadata !"E:\5CUsers\5Cmvillmow.AMD\5CAppData\5CLocal\5CTemp", metadata !2} ; [ DW_TAG_file_type ] +!2 = metadata !{i32 589841, i32 0, i32 1, metadata !"OCL6368.tmp.cl", metadata !"E:\5CUsers\5Cmvillmow.AMD\5CAppData\5CLocal\5CTemp", metadata !"clc", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ] +!3 = metadata !{i32 589845, metadata !1, metadata !"", metadata !1, i32 0, i64 0, i64 0, i32 0, i32 0, i32 0, metadata !4, i32 0, i32 0} ; [ DW_TAG_subroutine_type ] +!4 = metadata !{null, metadata !5} +!5 = metadata !{i32 589839, metadata !2, metadata !"", null, i32 0, i64 32, i64 32, i64 0, i32 0, metadata !6} ; [ DW_TAG_pointer_type ] +!6 = metadata !{i32 589860, metadata !2, metadata !"unsigned int", null, i32 0, i64 32, i64 32, i64 0, i32 0, i32 7} ; [ DW_TAG_base_type ] +!7 = metadata !{i32 590081, metadata !0, metadata !"ip", metadata !1, i32 1, metadata !5, i32 0} ; [ DW_TAG_arg_variable ] +!8 = metadata !{i32 1, i32 42, metadata !0, null} +!9 = metadata !{i32 590080, metadata !10, metadata !"gid", metadata !1, i32 3, metadata !6, i32 0} ; [ DW_TAG_auto_variable ] +!10 = metadata !{i32 589835, metadata !0, i32 2, i32 1, metadata !1, i32 0} ; [ DW_TAG_lexical_block ] +!11 = metadata !{i32 3, i32 41, metadata !10, null} +!12 = metadata !{i32 0} +!13 = metadata !{i32 590080, metadata !10, metadata !"idx", metadata !1, i32 4, metadata !6, i32 0} ; [ DW_TAG_auto_variable ] +!14 = metadata !{i32 4, i32 20, metadata !10, null} +!15 = metadata !{i32 5, i32 15, metadata !10, null} +!16 = metadata !{i32 6, i32 18, metadata !10, null} +!17 = metadata !{i32 7, i32 1, metadata !0, null} + From eli.friedman at gmail.com Mon May 23 12:42:14 2011 From: eli.friedman at gmail.com (Eli Friedman) Date: Mon, 23 May 2011 10:42:14 -0700 Subject: [llvm-commits] [llvm] r131887 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineMulDivRem.cpp test/Transforms/InstCombine/shift.ll In-Reply-To: <4DDA990C.1000502@free.fr> References: <20110523002150.4EC242A6C12C@llvm.org> <4DDA990C.1000502@free.fr> Message-ID: On Mon, May 23, 2011 at 10:27 AM, Duncan Sands wrote: > Hi Chris, > >> Transform any logical shift of a power of two into an exact/NUW shift when >> in a known-non-zero context. > > in "x div (1 << y)" this will mark the shift as "nuw" always, due to the > following logic: (A) isPowerOfTwo will say that "1 << y" is a power of > two, because either the 1 is shifted off the end so yielding an undef which > can be assumed to be a power of two, or the 1 isn't shifted off the end in > which case it sure is a power of two; (B) then your logic will deduce that > 1 was not shifted off the end, and will add a nsw flag to the shift. > > Thus this transform potentially upgrades an undef value to a trap value: if > later on some pass discovers for example that y is big enough that it shifts 1 > off the end then now you get a trap value while before this transform you got > an undef. ?Yet trap values are defined to only occur when violating a nsw/nuw/ > exact flag on an operation, but there was no such flag in the original code! > I don't know if this matters but it seems a bit dubious to me. I don't see how the difference between an undef value and a trap value matters here; dividing by undef and dividing by trap have the same result: UB. And I don't see any reason to guarantee that the optimizer will never introduce trap values (assuming the semantics of the program don't change). -Eli From dpatel at apple.com Mon May 23 12:44:14 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 17:44:14 -0000 Subject: [llvm-commits] [llvm] r131908 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGBuilder.cpp SelectionDAGBuilder.h SelectionDAGISel.cpp Message-ID: <20110523174414.201F82A6C12C@llvm.org> Author: dpatel Date: Mon May 23 12:44:13 2011 New Revision: 131908 URL: http://llvm.org/viewvc/llvm-project?rev=131908&view=rev Log: Preserve debug info during iSel by keeping DanglingDebugInfoMap live until end of function. Patch by Micah Villmow Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=131908&r1=131907&r2=131908&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Mon May 23 12:44:13 2011 @@ -783,11 +783,20 @@ UnusedArgNodeMap.clear(); PendingLoads.clear(); PendingExports.clear(); - DanglingDebugInfoMap.clear(); CurDebugLoc = DebugLoc(); HasTailCall = false; } +/// clearDanglingDebugInfo - Clear the dangling debug information +/// map. This function is seperated from the clear so that debug +/// information that is dangling in a basic block can be properly +/// resolved in a different basic block. This allows the +/// SelectionDAG to resolve dangling debug information attached +/// to PHI nodes. +void SelectionDAGBuilder::clearDanglingDebugInfo() { + DanglingDebugInfoMap.clear(); +} + /// getRoot - Return the current virtual root of the Selection DAG, /// flushing any PendingLoad items. This must be done before emitting /// a store or any other node that may need to be ordered after any Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h?rev=131908&r1=131907&r2=131908&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h Mon May 23 12:44:13 2011 @@ -332,6 +332,14 @@ /// consumed. void clear(); + /// clearDanglingDebugInfo - Clear the dangling debug information + /// map. This function is seperated from the clear so that debug + /// information that is dangling in a basic block can be properly + /// resolved in a different basic block. This allows the + /// SelectionDAG to resolve dangling debug information attached + /// to PHI nodes. + void clearDanglingDebugInfo(); + /// getRoot - Return the current virtual root of the Selection DAG, /// flushing any PendingLoad items. This must be done before emitting /// a store or any other node that may need to be ordered after any Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=131908&r1=131907&r2=131908&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon May 23 12:44:13 2011 @@ -1019,6 +1019,7 @@ MBI != MBE; ++MBI) CheckLineNumbers(MBI); #endif + SDB->clearDanglingDebugInfo(); } void From dpatel at apple.com Mon May 23 12:49:29 2011 From: dpatel at apple.com (Devang Patel) Date: Mon, 23 May 2011 17:49:29 -0000 Subject: [llvm-commits] [llvm] r131909 - /llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll Message-ID: <20110523174929.31A232A6C12D@llvm.org> Author: dpatel Date: Mon May 23 12:49:29 2011 New Revision: 131909 URL: http://llvm.org/viewvc/llvm-project?rev=131909&view=rev Log: Test case for r131908. Added: llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll Added: llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll?rev=131909&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll (added) +++ llvm/trunk/test/CodeGen/X86/dbg-value-isel.ll Mon May 23 12:49:29 2011 @@ -0,0 +1,102 @@ +; RUN: llc < %s | FileCheck %s +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin10.0.0" +; PR 9879 + +; CHECK: ##DEBUG_VALUE: tid <- R14D+0 +%0 = type { i8*, i8*, i8*, i8*, i32 } + + at sgv = internal addrspace(2) constant [1 x i8] zeroinitializer + at fgv = internal addrspace(2) constant [1 x i8] zeroinitializer + at lvgv = internal constant [0 x i8*] zeroinitializer + at llvm.global.annotations = appending global [1 x %0] [%0 { i8* bitcast (void (i32 addrspace(1)*)* @__OpenCL_nbt02_kernel to i8*), i8* bitcast ([1 x i8] addrspace(2)* @sgv to i8*), i8* bitcast ([1 x i8] addrspace(2)* @fgv to i8*), i8* bitcast ([0 x i8*]* @lvgv to i8*), i32 0 }], section "llvm.metadata" + +define void @__OpenCL_nbt02_kernel(i32 addrspace(1)* %ip) nounwind { +entry: + call void @llvm.dbg.value(metadata !{i32 addrspace(1)* %ip}, i64 0, metadata !8), !dbg !9 + %0 = call <4 x i32> @__amdil_get_local_id_int() nounwind + %1 = extractelement <4 x i32> %0, i32 0 + br label %2 + +;