[all-commits] [llvm/llvm-project] 35a8bd: [NFCI][IndVars] rewriteLoopExitValues(): nowadays ...
Roman Lebedev via All-commits
all-commits at lists.llvm.org
Sun Aug 15 09:05:57 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 35a8bdc775817ce13a6c9b5cf81502052634aa1f
https://github.com/llvm/llvm-project/commit/35a8bdc775817ce13a6c9b5cf81502052634aa1f
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2021-08-15 (Sun, 15 Aug 2021)
Changed paths:
M llvm/lib/Transforms/Utils/LoopUtils.cpp
Log Message:
-----------
[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not change `GEP` base pointer
Currently/previously, while SCEV guaranteed that it produces the same value,
the way it was produced may be illegal IR, so we have an ugly check that
the replacement is valid.
But now that the SCEV strictness wrt the pointer/integer types has been improved,
i believe this invariant is already upheld by the SCEV itself, natively.
I think we should add an assertion, wait for a week, and then, if all is good,
rip out all this checking.
Or we could just do the latter directly i guess.
This reverts commit rL127839.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D108043
Commit: 77a06a9c33a6731fbe800ffaf8ca398bbe00dcba
https://github.com/llvm/llvm-project/commit/77a06a9c33a6731fbe800ffaf8ca398bbe00dcba
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2021-08-15 (Sun, 15 Aug 2021)
Changed paths:
M llvm/test/Transforms/SimplifyCFG/fold-branch-to-common-dest.ll
Log Message:
-----------
[NFC][SimplifyCFG] Autogenerate check lines in a test to declutter further update
Commit: 78af5cb213b2f9fe3f47bf23947f14ac07024155
https://github.com/llvm/llvm-project/commit/78af5cb213b2f9fe3f47bf23947f14ac07024155
Author: Roman Lebedev <lebedev.ri at gmail.com>
Date: 2021-08-15 (Sun, 15 Aug 2021)
Changed paths:
M llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Log Message:
-----------
[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)
LLVM IR SSA form is "implicit" in `@pr51125`. While is a valid LLVM IR,
and does not require any PHI nodes, that completely breaks the further logic
in `CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()`
that updates the live-out uses of the bonus instructions.
What i believe we need to do, is to first make the SSA form explicit,
by inserting tautological PHI nodes, and rewriting the offending uses.
```
$ /builddirs/llvm-project/build-Clang12/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -tv -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 -tv -o /dev/null /tmp/test.ll
----------------------------------------
@global_pr51125 = global 4 bytes, align 4
define i32 @pr51125() {
%entry:
br label %L
%L:
%ld = load i32, * @global_pr51125, align 4
%iszero = icmp eq i32 %ld, 0
br i1 %iszero, label %exit, label %L2
%L2:
store i32 4294967295, * @global_pr51125, align 4
%cmp = icmp eq i32 %ld, 4294967295
br i1 %cmp, label %L, label %exit
%exit:
%r = phi i32 [ %ld, %L2 ], [ %ld, %L ]
ret i32 %r
}
=>
@global_pr51125 = global 4 bytes, align 4
define i32 @pr51125() {
%entry:
%ld.old = load i32, * @global_pr51125, align 4
%iszero.old = icmp eq i32 %ld.old, 0
br i1 %iszero.old, label %exit, label %L2
%L2:
%ld2 = phi i32 [ %ld.old, %entry ], [ %ld, %L2 ]
store i32 4294967295, * @global_pr51125, align 4
%cmp = icmp ne i32 %ld2, 4294967295
%ld = load i32, * @global_pr51125, align 4
%iszero = icmp eq i32 %ld, 0
%or.cond = select i1 %cmp, i1 1, i1 %iszero
br i1 %or.cond, label %exit, label %L2
%exit:
%ld1 = phi i32 [ poison, %L2 ], [ %ld.old, %entry ]
%r = phi i32 [ %ld2, %L2 ], [ %ld.old, %entry ]
ret i32 %r
}
Transformation seems to be correct!
```
Fixes https://bugs.llvm.org/show_bug.cgi?id=51125
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D106317
Compare: https://github.com/llvm/llvm-project/compare/944dfa4975e8...78af5cb213b2
More information about the All-commits
mailing list