-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IndVars creates an invalid phi node after r367485 #45180
Comments
Link to referenced revision: f8e7b53 |
Shorter repro: https://godbolt.org/z/ypwWWr The highlighted phi node has two (identical) values from the same BB, but the first is considered llvm-project/llvm/lib/Transforms/Utils/LoopUtils.cpp Lines 1412 to 1417 in 616657b
To double check this, I confirmed that the phi remains valid under both of So, what to do? Any thoughts on...
|
For anyone curious where the different values of HighCost come from... When we're recursively looking at the second NAry operand [0] of the first value, that operand is considered high cost due to [1]: if (isa(S)) When we're looking at the second NAry operand of the second value, it is considered low cost due to [2]: // If we can find an existing value for this scev available at the point "At" [0] https://github.com/llvm/llvm-project/blob/release/10.x/llvm/lib/Analysis/ScalarEvolutionExpander.cpp#L2198-L2205 |
In IRC, LebedevRI wondered what kind of code generates such phi nodes. This comes from the pointer-overflow sanitizer. We have a line of C that does switch.early.test141.i: ; preds = %cont9.i handler.pointer_overflow11.i: ; preds = %switch.early.test141.i [...SNIP...], %cont9.i |
Proposed patch: https://reviews.llvm.org/D79720 |
Alternative patch: https://reviews.llvm.org/D79787 |
Landed in b2df961. |
Thanks again! Here's an updated version of the diff against release/10.x: https://reviews.llvm.org/P8223 |
Merged: 4d0626a |
Extended Description
https://godbolt.org/z/Me95yj
After r367485/llvmorg-10-init-991-gf8e7b536571, this phi node:
%a.mux.lcssa4 = phi i8* [ %a.mux, %switch.early.test.i ], [ %a.mux, %switch.early.test.i ], [ %a.mux, %cond.end ]
becomes
%a.mux.lcssa4 = phi i8* [ %a.mux, %switch.early.test.i ], [ %scevgep, %switch.early.test.i ], [ %scevgep, %cond.end ]
which has two different values for %switch.early.test.i.
This started out as an investigation of a clang hang in LICM (full repro available on request) but this phi node is the first place that the verifier started complaining, so I assume the rest is GIGO from there.
The bad phi is no longer seen after llvmorg-11-init-4213-gd6f47aeb519, but as that is a cost model patch, I assume it's not really a fix but just an avoidance.
The text was updated successfully, but these errors were encountered: