The findSuitableCompare method can fail if debug instructions are
present in the MBB -- fix this by using helpers to skip over debug
insts.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp | ||
---|---|---|
161 | Might be worth rewriting in terms of an iterator range, e.g. something like reverseInstructionsWithoutDebug(I == MBB->begin() ? I : std::prev(I), MBB->begin()) |
llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp | ||
---|---|---|
161 | I have a mild preference for the current version as I feel that the ternary adds some complexity. Happy to change this though if anyone has a strong opinion otherwise. |
llvm/lib/Target/AArch64/AArch64ConditionOptimizer.cpp | ||
---|---|---|
161 | It would be nice to be clear that we're skipping debug instructions in the loop header, I suppose? I think in general it would be nice to avoid having to explicitly skip debug instructions within the loop itself. |
I cannot build llvm locally using ninja clean && ninja check-all with this patch due to the following error:
AArch64ConditionOptimizer.cpp: In member function 'llvm::MachineInstr* {anonymous}::AArch64ConditionOptimizer::findSuitableCompare(llvm::MachineBasicBlock*) ... no matching function call to 'prev(llvm::MachineInstr&)'
Using the following cmake command in llvm-project/build
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lld" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_TARGETS_TO_BUILD="ARM;X86;AArch64" -DLLVM_ENABLE_SOLVER_Z3=Off -DPARALLEL_LINK_JOBS=2 -DLLVM_USE_LINKER=gold ../llvm
It looks as though harbourmaster is failing as well.
Based on commit hash 3a53806 on master
Looks like it's a scope error in gcc <= 5.5.
https://gcc.godbolt.org/z/ECqRJJ
The minimum required version to build LLVM GCC 5.1.
https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
I suggest renaming one of the Is.
Sorry about the breakage, I've renamed the variable in 210616bd38d589020b45f8cbbf9f9ef1296f2729.
Might be worth rewriting in terms of an iterator range, e.g. something like reverseInstructionsWithoutDebug(I == MBB->begin() ? I : std::prev(I), MBB->begin())