stripPointerCasts strips instruction pointer casts (getelementptr and bitcast) and returns the original value without the casts.
(value llvm.Value)
| 80 | // stripPointerCasts strips instruction pointer casts (getelementptr and |
| 81 | // bitcast) and returns the original value without the casts. |
| 82 | func stripPointerCasts(value llvm.Value) llvm.Value { |
| 83 | if !value.IsAConstantExpr().IsNil() { |
| 84 | switch value.Opcode() { |
| 85 | case llvm.GetElementPtr, llvm.BitCast: |
| 86 | return stripPointerCasts(value.Operand(0)) |
| 87 | } |
| 88 | } |
| 89 | if !value.IsAInstruction().IsNil() { |
| 90 | switch value.InstructionOpcode() { |
| 91 | case llvm.GetElementPtr, llvm.BitCast: |
| 92 | return stripPointerCasts(value.Operand(0)) |
| 93 | } |
| 94 | } |
| 95 | return value |
| 96 | } |
no test coverage detected