SuccessChanges

Summary

  1. [InstCombine] visitPHINode(): use InstCombiner::replaceInstUsesWith() instead of RAUW (details)
  2. [NFC][InstCombine] select.ll: remove outdated TODO comment (details)
  3. [NFC][InstCombine] Add STATISTIC() for how many iterations we did (details)
  4. [NFC] Instruction::isIdenticalToWhenDefined(): s/nessesairly/necessarily/ (details)
  5. [NFC][InstCombine] Fix some comments: the code already uses IC::replaceInstUsesWith() (details)
  6. [InstCombine] canonicalizeICmpPredicate(): use InstCombiner::replaceInstUsesWith() instead of RAUW (details)
  7. [InstCombine] foldAggregateConstructionIntoAggregateReuse(): use InstCombiner::replaceInstUsesWith() instead of RAUW (details)
  8. [MC] [Win64EH] Fill in FuncletOrFuncEnd if missing (details)
  9. [AArch64] Generate and parse SEH assembly directives (details)
  10. [InstCombine] Return replaceInstUsesWith() result (NFC) (details)
  11. Revert "[InstCombine] Take 2: Perform trivial PHI CSE" (details)
Commit 4f4eecf0ec56a15b3dc377cac3799463cbf77a1f by lebedev.ri
[InstCombine] visitPHINode(): use InstCombiner::replaceInstUsesWith() instead of RAUW

As noted in post-commit review, we really shouldn't use RAUW in InstCombine
because we should consistently update Worklist to avoid extra iterations.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
Commit 9c1ca8a3f7c5bda04405da761c7a59b1d5b1a129 by lebedev.ri
[NFC][InstCombine] select.ll: remove outdated TODO comment

Fixed by 3e69871ab5a66fb55913a2a2f5e7f5b42899a4c9
The file was modifiedllvm/test/Transforms/InstCombine/select.ll
Commit 49d223274f69bd67fe6e24535e3a2f68182f011b by lebedev.ri
[NFC][InstCombine] Add STATISTIC() for how many iterations we did

As we've established, if it takes more than two iterations
(one to perform folding and one to ensure that no folding opportunities
remain) per function, then there are worklist management issues.
So it may be interesting to keep track of it.
The file was modifiedllvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Commit 65b3854e106e30b88f6b10e62a3448ac953b797a by lebedev.ri
[NFC] Instruction::isIdenticalToWhenDefined(): s/nessesairly/necessarily/
The file was modifiedllvm/lib/IR/Instruction.cpp
Commit bd12113f575be38b6b3d65fa599ac6bb84918689 by lebedev.ri
[NFC][InstCombine] Fix some comments: the code already uses IC::replaceInstUsesWith()
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Commit e65f2131782bc39ec66fc9c74991ff6c2ff1d93b by lebedev.ri
[InstCombine] canonicalizeICmpPredicate(): use InstCombiner::replaceInstUsesWith() instead of RAUW

We really shouldn't use RAUW in InstCombine
because we should consistently update Worklist to avoid extra iterations.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineInternal.h
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
Commit 71ac9105cd392a257d15515579c70f06c970c5cb by lebedev.ri
[InstCombine] foldAggregateConstructionIntoAggregateReuse(): use InstCombiner::replaceInstUsesWith() instead of RAUW

We really shouldn't use RAUW in InstCombine
because we should consistently update Worklist to avoid extra iterations.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
Commit 20f7773bb4bb458c3f3b4e46d1601465e6479746 by martin
[MC] [Win64EH] Fill in FuncletOrFuncEnd if missing

This can happen e.g. for code that declare .seh_proc/.seh_endproc
in assembly, or for code that use .seh_handlerdata (which triggers
the unwind info to be emitted before the end of the function).

The TextSection field must be made non-const to be able to use it
with Streamer.SwitchSection().

Differential Revision: https://reviews.llvm.org/D86528
The file was modifiedllvm/include/llvm/MC/MCWinEH.h
The file was modifiedllvm/test/MC/AArch64/seh.s
The file was modifiedllvm/lib/MC/MCStreamer.cpp
The file was modifiedllvm/lib/MC/MCWin64EH.cpp
Commit 5b86d130e2baed7221b09087c506f5974fe65f22 by martin
[AArch64] Generate and parse SEH assembly directives

This ensures that you get the same output regardless if generating
code directly to an object file or if generating assembly and
assembling that.

Add implementations of the EmitARM64WinCFI*() methods in
AArch64TargetAsmStreamer, and fill in one blank in MCAsmStreamer.

Add corresponding directive handlers in AArch64AsmParser and
COFFAsmParser.

Some SEH directive names have been picked to match the prior art
for SEH assembly directives for x86_64, e.g. the spelling of
".seh_startepilogue" matching the preexisting ".seh_endprologue".

For the directives for saving registers, the exact spelling
from the arm64 documentation is picked, e.g. ".seh_save_reg" (to follow
that naming for all the other ones, e.g. ".seh_save_fregp_x"), while
the corresponding one for x86_64 is plain ".seh_savereg" without the
second underscore.

Directives in the epilogues have the same names as in prologues,
e.g. .seh_savereg, even though the registers are restored, not
saved, at that point.

Differential Revision: https://reviews.llvm.org/D86529
The file was modifiedllvm/lib/MC/MCAsmStreamer.cpp
The file was modifiedllvm/test/CodeGen/AArch64/wineh-try-catch-cbz.ll
The file was modifiedllvm/test/CodeGen/AArch64/wineh-try-catch-realign.ll
The file was modifiedllvm/test/CodeGen/AArch64/arm64-windows-calls.ll
The file was modifiedllvm/test/CodeGen/AArch64/wineh-try-catch-nobase.ll
The file was modifiedllvm/test/CodeGen/AArch64/lrint-conv-win.ll
The file was modifiedllvm/test/CodeGen/AArch64/lround-conv-win.ll
The file was modifiedllvm/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
The file was modifiedllvm/test/CodeGen/AArch64/win_cst_pool.ll
The file was modifiedllvm/test/CodeGen/AArch64/wineh1.mir
The file was modifiedllvm/test/CodeGen/AArch64/lround-conv-fp16-win.ll
The file was modifiedllvm/test/CodeGen/AArch64/wineh-try-catch-vla.ll
The file was modifiedllvm/test/CodeGen/AArch64/lrint-conv-fp16-win.ll
The file was modifiedllvm/test/CodeGen/AArch64/win64-jumptable.ll
The file was modifiedllvm/test/MC/AArch64/seh.s
The file was modifiedllvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
The file was modifiedllvm/test/CodeGen/AArch64/powi-windows.ll
The file was modifiedllvm/test/CodeGen/AArch64/seh_funclet_x1.ll
The file was modifiedllvm/lib/MC/MCParser/COFFAsmParser.cpp
The file was modifiedllvm/test/CodeGen/AArch64/windows-extern-weak.ll
Commit 6093b14c2c1fc785bfb7040ecebfe4127e1ab9ab by nikita.ppv
[InstCombine] Return replaceInstUsesWith() result (NFC)

Follow the usual usage pattern for this function and return the
result.
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
Commit bdaa3f86a040b138c58de41d73d35b76fdec1380 by lebedev.ri
Revert "[InstCombine] Take 2: Perform trivial PHI CSE"

While the original variant with doing this in InstSimplify (rightfully)
caused questions and ultimately was detected to be a culprit
of stage2-stage3 mismatch, it was expected that
InstCombine-based implementation would be fine.

But apparently it's not, as
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/24095/steps/compare-compilers/logs/stdio
suggests.

Which suggests that somewhere in InstCombine there is a loop
over nondeterministically sorted container, which causes
different worklist ordering.

This reverts commit 3e69871ab5a66fb55913a2a2f5e7f5b42899a4c9.
The file was modifiedllvm/test/Transforms/LoopVectorize/reduction.ll
The file was modifiedllvm/test/Transforms/InstCombine/merging-multiple-stores-into-successor.ll
The file was modifiedllvm/test/Transforms/InstCombine/select.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
The file was modifiedllvm/test/Transforms/InstCombine/phi-equal-incoming-pointers.ll
The file was modifiedllvm/test/Transforms/InstCombine/phi-cse.ll
The file was modifiedllvm/test/Transforms/InstCombine/phi-aware-aggregate-reconstruction.ll