My earlier patch failed to check null ptr before dyn_cast.
Details
Diff Detail
- Repository
 - rL LLVM
 
Event Timeline
| lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp | ||
|---|---|---|
| 828 ↗ | (On Diff #47676) | You might consider using dyn_cast_or_null(), so you can reduce indent and fold the null checks into the inner if condition.  | 
| test/CodeGen/AArch64/gep-nullptr.ll | ||
| 6 ↗ | (On Diff #47676) | Can you please simplify some of the names, so this is more human readable?  | 
| 29 ↗ | (On Diff #47676) | Please drop the attribute/metadata if it's not relevant to reproducing the issue.  | 
| lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp | ||
|---|---|---|
| 829 ↗ | (On Diff #47850) | I believe you still need to add the nullptr checks for FirstGEP and SecondGEP.  | 
| lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp | ||
|---|---|---|
| 829 ↗ | (On Diff #47853) | Thanks, Chad: That's not needed because I checked in isLegalToSwapOperand().  | 
Can you please cleanup the test case to be more human readable?
Is the test just verifying that we don't get a compiler ICE due to dereferencing a nullptr? If so, please add a comment to the test case expressing this.
| lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp | ||
|---|---|---|
| 829 ↗ | (On Diff #47853) | Okay, that's fine.  | 
| test/CodeGen/AArch64/gep-nullptr.ll | ||
| 10 ↗ | (On Diff #47853) | Is the lifetime intrinsic relevant to the test?  | 
| 17 ↗ | (On Diff #47853) | You should probably use a CHECK-LABEL directive like ; CHECK-LABEL: test  | 
| test/CodeGen/AArch64/gep-nullptr.ll | ||
|---|---|---|
| 2 ↗ | (On Diff #47853) | Why is an assert build required?  |