[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262977. zequanwu added a comment. add `nomerge` case in `CodeExtractor.cpp` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: llvm/docs/LangRef.rst llvm/include/llvm/Bitcode/LLVMBitCodes.h

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262971. zequanwu marked an inline comment as done. zequanwu added a comment. use `ConstEvaluatedExprVisitor` to recursively looking up for call expr CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/ https://reviews.llvm.org/D79121 Files:

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262933. zequanwu marked an inline comment as done. zequanwu added a comment. update comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: llvm/docs/LangRef.rst

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-08 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 262922. zequanwu added a comment. use `ConstStmtVisitor` to do recursive lookup for call expression. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/ https://reviews.llvm.org/D79121 Files: clang/include/clang/Basic/Attr.td

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-05 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu marked an inline comment as done. zequanwu added inline comments. Comment at: clang/lib/Sema/SemaStmtAttr.cpp:178 +return true; + return llvm::any_of(S->children(), hasCallExpr); +} rsmith wrote: > This will recurse into too much (eg, the bodies of

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-04 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added inline comments. Comment at: clang/lib/CodeGen/CGStmt.cpp:611 void CodeGenFunction::EmitAttributedStmt(const AttributedStmt ) { + for (const auto *A: S.getAttrs()) +if (A->getKind() == attr::NoMerge) { rnk wrote: > Can we use S.hasAttr, or

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-04 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 261973. zequanwu marked 10 inline comments as done. zequanwu added a comment. To keep it simple, `nomerge` attribute should not be applied to decl statement. Since label statement calls `ProcessDeclAttributeList` to handle attributes, label statement

[PATCH] D79121: Add nomerge function attribute to clang

2020-05-03 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 261698. zequanwu marked 4 inline comments as done. zequanwu added a comment. Add Sema test. Check if nomerge attribute has no arguments and statement contains call expressions. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/

[PATCH] D79121: Add nomerge function attribute to clang

2020-04-30 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 261406. zequanwu added a comment. change `nomerge` to statement attribute CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/ https://reviews.llvm.org/D79121 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td

[PATCH] D79121: Add nomerge function attribute to clang

2020-04-30 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 261292. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D79121/new/ https://reviews.llvm.org/D79121 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td clang/lib/CodeGen/CGCall.cpp clang/test/CodeGen/attr-nomerge.c

[PATCH] D79121: Add nomerge function attribute to clang

2020-04-30 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu marked 2 inline comments as done. zequanwu added inline comments. Comment at: clang/include/clang/Basic/Attr.td:1799 + let Spellings = [Clang<"nomerge">]; + let Subjects = SubjectList<[Function]>; + let Documentation = [NoMergeDocs]; rnk wrote: >

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-29 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 261059. zequanwu marked 4 inline comments as done. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: llvm/docs/LangRef.rst llvm/include/llvm/Bitcode/LLVMBitCodes.h

[PATCH] D79121: Add nomerge function attribute to clang

2020-04-29 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu created this revision. zequanwu added a reviewer: rnk. zequanwu added a project: clang. Herald added a subscriber: cfe-commits. Related to D78659 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D79121 Files:

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-28 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 260780. zequanwu added a comment. Add test case for preventing hoisting. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: llvm/docs/LangRef.rst llvm/include/llvm/Bitcode/LLVMBitCodes.h

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-28 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment. > Does sinking and hoisting remove the debug source location? I assumed that it > wouldn't, but now after all the smooth stepping work, maybe it does. Yes, both sinking and hoisting in simplifycfg remove the debug source location by `Instruction::applyMergedLocation`

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-27 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 260529. zequanwu added a comment. Split the the original differential to 2 smaller ones. This one add nomerge function attribute in IR level. Another one will add the attribute to let frontend recognize it. CHANGES SINCE LAST ACTION

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-24 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 260039. zequanwu added a comment. Add check in LICM to prevent sink or hoist on `nomerge` call CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: clang/include/clang/Basic/Attr.td

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-24 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 260038. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td clang/lib/CodeGen/CGCall.cpp clang/test/CodeGen/attr-nomerge.c

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-24 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 259938. Herald added subscribers: dexonsmith, steven_wu. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu added a comment. In D78659#1997528 , @lebedev.ri wrote: > 1. Tests missing > 2. Why isn't `noinline` sufficient, why a whole new attribue? 1. Test added. 2. We want to avoid merging multiple call sites of same function, but `noinline` cannot

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu updated this revision to Diff 259455. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D78659/new/ https://reviews.llvm.org/D78659 Files: clang/include/clang/Basic/Attr.td clang/include/clang/Basic/AttrDocs.td clang/lib/CodeGen/CGCall.cpp clang/test/CodeGen/attr-nomerge.c

[PATCH] D78659: Add nomerge function attribute to supress tail merge optimization in simplifyCFG

2020-04-22 Thread Zequan Wu via Phabricator via cfe-commits
zequanwu created this revision. zequanwu added reviewers: asbirlea, rnk. zequanwu added projects: LLVM, clang. Herald added subscribers: cfe-commits, hiraditya. We want to add a way to avoid tail calls to noreturn function from being merged. This patch add nomerge to disable the optimization in

<    1   2   3   4   5