aboutsummaryrefslogtreecommitdiffhomepage
path: root/transform/llvm.go
diff options
context:
space:
mode:
Diffstat (limited to 'transform/llvm.go')
-rw-r--r--transform/llvm.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/transform/llvm.go b/transform/llvm.go
index 7042b32d0..045bb050f 100644
--- a/transform/llvm.go
+++ b/transform/llvm.go
@@ -80,6 +80,12 @@ func replaceGlobalIntWithArray(mod llvm.Module, name string, buf interface{}) ll
// stripPointerCasts strips instruction pointer casts (getelementptr and
// bitcast) and returns the original value without the casts.
func stripPointerCasts(value llvm.Value) llvm.Value {
+ if !value.IsAConstantExpr().IsNil() {
+ switch value.Opcode() {
+ case llvm.GetElementPtr, llvm.BitCast:
+ return stripPointerCasts(value.Operand(0))
+ }
+ }
if !value.IsAInstruction().IsNil() {
switch value.InstructionOpcode() {
case llvm.GetElementPtr, llvm.BitCast: