-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Problem with CodeExtractor.cpp #1376
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
Comments
Can you provide some information on how to reproduce this? The code extractor requires critical edges to If so, this case shouldn't occur. -Chris |
bug reproduced information |
bug reproduced information Compile one.cpp and run on example1.bc. You will see error message: I think that CodeExtractor doesn't correctly modify phi instruction. |
Right, so you're taking code which hasn't been run through break-crit-edges, Function* func = ExtractCodeRegion((DominatorSet)0, region, false); The trouble is that there's no PassManager to recognize the need to run BCE Because your code is special-case anyways, I don't think you should bother with FunctionPass *BCE = createBreakCriticalEdgesPass(); before you run the code extractor ought to fix it up for you. |
The problem is that the code extractor expects critical edges to be broken and they are not. -Chris |
Fixes stack allocation growth issue. When in a loop, allocating on the
Original Clang's implementation: https://github.com/llvm/clangir/blob/2df2022c90e00c0eac542eba4078e79306155c7b/clang/lib/CodeGen/CGBuiltin.cpp#L4131-L4133 https://github.com/llvm/clangir/blob/2df2022c90e00c0eac542eba4078e79306155c7b/clang/lib/CodeGen/CGBuiltin.cpp#L762-L776 Compared with non-elementwise exp https://github.com/llvm/clangir/blob/2df2022c90e00c0eac542eba4078e79306155c7b/clang/lib/CodeGen/CGBuiltin.cpp#L3006-L3016 https://github.com/llvm/clangir/blob/2df2022c90e00c0eac542eba4078e79306155c7b/clang/lib/CodeGen/CGBuiltin.cpp#L669-L685 elementwise version doesn't handle constrained situation. I'm not sure whether it is intended. For renaming, it is to match original clang's implementation closely. Resolves: llvm/clangir#1375
Extended Description
I have this code:
loopexit.6:
... // something
no_exit.7:
... // something
loopexit.7: ; preds = %no_exit.7, %loopexit.6
%n.3.1 = phi int [ 0, %loopexit.6 ], [ %n.2, %no_exit.7 ]
...
I want extract code region, which contains loopexit.6 and no_exit.7.
CodeExtractor creates new function and puts those basic blocks to this function.
CodeExtractor creates codeReplacer block containing call-instr to new function.
So CodeExtractor modifies phi-node instruction in loopexit.7 :
%n.3.1 = phi int [ 0, %codeRepl1 ], [ %n.2.reload, %codeRepl1 ]
And verifier say 'Error' :
PHINode should have one entry for each predecessor of its parent basic block!
%n.3.1 = phi int [ 0, %codeRepl1 ], [ %n.2.reload, %codeRepl1 ]
; [#uses=1]
Broken module found, compilation aborted!
The text was updated successfully, but these errors were encountered: