Skip to content
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

Wrong translation to PIR when calling c(1,2) #1280

Open
skrynski opened this issue May 14, 2024 · 0 comments
Open

Wrong translation to PIR when calling c(1,2) #1280

skrynski opened this issue May 14, 2024 · 0 comments
Labels
bug pir to be solved in the compiler, the PIR, the optimizer (/compiler)

Comments

@skrynski
Copy link
Collaborator

Running the following snippet (without running f), produced the PIR code below. Notice we call the builtin c in both branches instead of LdFun

f <- function() {
    x <- c(1,2)
    x
}

rir.compile(f)
pir.compile(f)

┌──────────────────────────────────────────────────────────────────────────────┐                                                         
│ f[0x5645a8b596f0]                                                            │                                                         
│ Context: CorrOrd,!TMany                                                      │                                                         
│ Properties:  Eager, !Reflection                                              │                                                         
├────── PIR Version After Optimizations                                                                                                  
f[0x5645a8b596f0]                                                                                                                        
BB0                                                                                                                                      
  goto BB1                                                                                                                               
BB1   <- [0]                                                                                                                             
  val?^ | miss    %1.0  = LdVar              eR    c, R_GlobalEnv                                                                        
  lgl$#-          %1.1  = Identical                <blt c>, %1.0   <@?>                                                                  
  void                    Branch                   %1.1 -> BB2 (if true) | BB4 (if false)                                                
BB2   <- [1]                                                                                                                             
  real-           %2.0  = CallSafeBuiltin    wed   c(1, 2)                                                                               
  goto BB3                                                                                                                               
BB4   <- [1]                                                                                                                             
  **real-           %4.0  = CallSafeBuiltin    wed   c(1, 2)**                                                                               
  goto BB3                                                                                                                               
BB3   <- [2, 4]                                                                                                                          
  real-           %3.0  = Phi                      %4.0:BB4, %2.0:BB2   <val?_>                                                          
  void                    Visible            v                                                                                           
  void                    Return             l     %3.0                                                                                  
                                                                                                                                         
│ f[0x5645a8b596f0]                                                            │                                                         
└──────────────────────────────────────────────────────────────────────────────┘      
@skrynski skrynski added bug pir to be solved in the compiler, the PIR, the optimizer (/compiler) labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug pir to be solved in the compiler, the PIR, the optimizer (/compiler)
Projects
None yet
Development

No branches or pull requests

1 participant